diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2017, Nikita Volkov
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,50 @@
+import Data.Maybe
+import Data.Monoid
+import System.Directory
+import Distribution.Simple
+import Distribution.Simple.Setup
+import Distribution.Simple.Utils (rawSystemExit)
+import Distribution.PackageDescription
+import Distribution.Verbosity
+import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..), InstallDirs(..), absoluteInstallDirs)
+
+main =
+  defaultMainWithHooks hooks
+  where
+    hooks =
+      simpleUserHooks {
+        confHook = theConfHook
+      }
+
+theConfHook :: (GenericPackageDescription, HookedBuildInfo) -> ConfigFlags -> IO LocalBuildInfo
+theConfHook (description, buildInfo) flags = do
+  localBuildInfo <- confHook simpleUserHooks (description, buildInfo) flags
+  make (fromFlag (configVerbosity flags))
+  updateLocalBuildInfo localBuildInfo
+
+make :: Verbosity -> IO ()
+make verbosity =
+  do
+    rawSystemExit verbosity "mkdir" ["-p", "dist/build"]
+    rawSystemExit verbosity "cp" ["-a", "foreign/libpg_query", "dist/build/libpg_query"]
+    rawSystemExit verbosity "env" ["CFLAGS=-D_LIB", "make", "--directory=dist/build/libpg_query", "libpg_query.a"]
+
+updateLocalBuildInfo :: LocalBuildInfo -> IO LocalBuildInfo
+updateLocalBuildInfo =
+  def
+  where
+    def x =
+      do
+        path <- getCurrentDirectory
+        return (addExtraLibDir (path <> "/dist/build/libpg_query") x)
+      where
+    updatePackageDescription fn localBuildInfo =
+      localBuildInfo { localPkgDescr = fn (localPkgDescr localBuildInfo) }
+    updateLibrary fn =
+      updatePackageDescription (\x -> x { library = fmap fn (library x) })
+    updateLibBuildInfo fn =
+      updateLibrary (\x -> x { libBuildInfo = fn (libBuildInfo x) })
+    updateExtraLibDirs fn =
+      updateLibBuildInfo (\x -> x { extraLibDirs = fn (extraLibDirs x) })
+    addExtraLibDir path =
+      updateExtraLibDirs (\x -> path : x)
diff --git a/demo/Main.hs b/demo/Main.hs
new file mode 100644
--- /dev/null
+++ b/demo/Main.hs
@@ -0,0 +1,22 @@
+module Main where
+
+import Prelude
+import qualified PostgreSQL.Syntax as A
+
+
+main =
+  do
+    demo ""
+    demo "wrong"
+    demo "SELECT *"
+    demo "SELECT * FROM a"
+    demo "SELECT"
+    demo "SELECT from b"
+    demo "SELECT * from b"
+    demo "SELECT * from b WHERE"
+    demo "SELECT * from b WHERE c"
+    demo "SELECT * from b WHERE ?"
+    demo "SELECT * from b WHERE $2"
+  where
+    demo =
+      print . A.validate
diff --git a/foreign/ffi/validation.c b/foreign/ffi/validation.c
new file mode 100644
--- /dev/null
+++ b/foreign/ffi/validation.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "pg_query.h"
+
+
+int validate(const char *sql, char *output) {
+
+  PgQueryParseResult result = pg_query_parse(sql);
+  PgQueryError *error = result.error;
+
+  if (error) {
+    sprintf(output, "%s at offset %d", error->message, error->cursorpos - 1);
+  }
+
+  pg_query_free_parse_result(result);
+
+  return error ? 1 : 0;
+
+}
diff --git a/foreign/libpg_query/LICENSE b/foreign/libpg_query/LICENSE
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/LICENSE
@@ -0,0 +1,28 @@
+Copyright (c) 2015, Lukas Fittl <lukas@fittl.com>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+
+* Neither the name of pg_query nor the names of its contributors may be used
+to endorse or promote products derived from this software without specific
+prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/foreign/libpg_query/Makefile b/foreign/libpg_query/Makefile
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/Makefile
@@ -0,0 +1,129 @@
+root_dir := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
+
+TARGET = pg_query
+ARLIB = lib$(TARGET).a
+PGDIR = $(root_dir)/tmp/postgres
+PGDIRBZ2 = $(root_dir)/tmp/postgres.tar.bz2
+
+PG_VERSION = 9.5.3
+
+SRC_FILES := $(wildcard src/*.c src/postgres/*.c)
+OBJ_FILES := $(SRC_FILES:.c=.o)
+NOT_OBJ_FILES := src/pg_query_fingerprint_defs.o src/pg_query_fingerprint_conds.o src/pg_query_json_defs.o src/pg_query_json_conds.o src/postgres/guc-file.o src/postgres/scan.o src/pg_query_json_helper.o
+OBJ_FILES := $(filter-out $(NOT_OBJ_FILES), $(OBJ_FILES))
+
+CFLAGS  = -I. -I./src/postgres/include -Wall -Wno-unused-function -Wno-unused-value -Wno-unused-variable -fno-strict-aliasing -fwrapv -fPIC
+LIBPATH = -L.
+
+PG_CONFIGURE_FLAGS = -q --without-readline --without-zlib
+PG_CFLAGS = -fPIC
+
+ifeq ($(DEBUG),1)
+	CFLAGS += -O0 -g
+	PG_CONFIGURE_FLAGS += --enable-cassert --enable-debug
+else
+	CFLAGS += -O3 -g
+	PG_CFLAGS += -O3
+endif
+
+CLEANLIBS = $(ARLIB)
+CLEANOBJS = $(OBJ_FILES)
+CLEANFILES = $(PGDIRBZ2)
+
+AR = ar rs
+RM = rm -f
+ECHO = echo
+
+CC ?= cc
+
+all: examples test build
+
+build: $(ARLIB)
+
+clean:
+	-@ $(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) $(EXAMPLES) $(TESTS)
+	-@ $(RM) -rf {test,examples}/*.dSYM
+	-@ $(RM) -r $(PGDIR) $(PGDIRBZ2)
+
+.PHONY: all clean build extract_source examples test
+
+$(PGDIR):
+	curl -o $(PGDIRBZ2) https://ftp.postgresql.org/pub/source/v$(PG_VERSION)/postgresql-$(PG_VERSION).tar.bz2
+	tar -xjf $(PGDIRBZ2)
+	mv $(root_dir)/postgresql-$(PG_VERSION) $(PGDIR)
+	cd $(PGDIR); patch -p1 < $(root_dir)/patches/01_parse_replacement_char.patch
+	cd $(PGDIR); patch -p1 < $(root_dir)/patches/02_normalize_alter_role_password.patch
+	cd $(PGDIR); CFLAGS="$(PG_CFLAGS)" ./configure $(PG_CONFIGURE_FLAGS)
+	cd $(PGDIR); make -C src/port pg_config_paths.h
+	cd $(PGDIR); make -C src/backend parser-recursive # Triggers copying of includes to where they belong, as well as generating gram.c/scan.c
+
+extract_source: $(PGDIR)
+	-@ $(RM) -rf ./src/postgres/
+	mkdir ./src/postgres
+	mkdir ./src/postgres/include
+	ruby ./scripts/extract_source.rb $(PGDIR)/ ./src/postgres/
+	cp $(PGDIR)/src/include/storage/dsm_impl.h ./src/postgres/include/storage
+	touch ./src/postgres/guc-file.c
+	# This causes compatibility problems on some Linux distros, with "xlocale.h" not being available
+	echo "#undef HAVE_LOCALE_T" >> ./src/postgres/include/pg_config.h
+	echo "#undef LOCALE_T_IN_XLOCALE" >> ./src/postgres/include/pg_config.h
+	echo "#undef WCSTOMBS_L_IN_XLOCALE" >> ./src/postgres/include/pg_config.h
+
+.c.o:
+	@$(ECHO) compiling $(<)
+	@$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
+
+$(ARLIB): $(OBJ_FILES) Makefile
+	@$(AR) $@ $(OBJ_FILES)
+
+EXAMPLES = examples/simple examples/normalize examples/simple_error examples/normalize_error examples/simple_plpgsql
+examples: $(EXAMPLES)
+	examples/simple
+	examples/normalize
+	examples/simple_error
+	examples/normalize_error
+	examples/simple_plpgsql
+
+examples/simple: examples/simple.c $(ARLIB)
+	$(CC) -I. -o $@ -g examples/simple.c $(ARLIB)
+
+examples/normalize: examples/normalize.c $(ARLIB)
+	$(CC) -I. -o $@ -g examples/normalize.c $(ARLIB)
+
+examples/simple_error: examples/simple_error.c $(ARLIB)
+	$(CC) -I. -o $@ -g examples/simple_error.c $(ARLIB)
+
+examples/normalize_error: examples/normalize_error.c $(ARLIB)
+	$(CC) -I. -o $@ -g examples/normalize_error.c $(ARLIB)
+
+examples/simple_plpgsql: examples/simple_plpgsql.c $(ARLIB)
+	$(CC) -I. -o $@ -g examples/simple_plpgsql.c $(ARLIB)
+
+TESTS = test/complex test/concurrency test/fingerprint test/normalize test/parse test/parse_plpgsql
+test: $(TESTS)
+	test/complex
+	test/concurrency
+	test/fingerprint
+	test/normalize
+	test/parse
+	# Output-based tests
+	test/parse_plpgsql
+	diff -Naur test/plpgsql_samples.expected.json test/plpgsql_samples.actual.json
+
+test/complex: test/complex.c $(ARLIB)
+	$(CC) -I. -Isrc -o $@ -g test/complex.c $(ARLIB)
+
+test/concurrency: test/concurrency.c test/parse_tests.c $(ARLIB)
+	$(CC) -I. -o $@ -pthread -g test/concurrency.c $(ARLIB)
+
+test/fingerprint: test/fingerprint.c test/fingerprint_tests.c $(ARLIB)
+	$(CC) -I. -Isrc -o $@ -g test/fingerprint.c $(ARLIB)
+
+test/normalize: test/normalize.c test/normalize_tests.c $(ARLIB)
+	$(CC) -I. -Isrc -o $@ -g test/normalize.c $(ARLIB)
+
+test/parse: test/parse.c test/parse_tests.c $(ARLIB)
+	$(CC) -I. -o $@ -g test/parse.c $(ARLIB)
+
+test/parse_plpgsql: test/parse_plpgsql.c $(ARLIB)
+	$(CC) -I. -o $@ -I./src -I./src/postgres/include -g test/parse_plpgsql.c $(ARLIB)
diff --git a/foreign/libpg_query/pg_query.h b/foreign/libpg_query/pg_query.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/pg_query.h
@@ -0,0 +1,59 @@
+#ifndef PG_QUERY_H
+#define PG_QUERY_H
+
+typedef struct {
+	char* message; // exception message
+	char* funcname; // source function of exception (e.g. SearchSysCache)
+	char* filename; // source of exception (e.g. parse.l)
+	int lineno; // source of exception (e.g. 104)
+	int cursorpos; // char in query at which exception occurred
+	char* context; // additional context (optional, can be NULL)
+} PgQueryError;
+
+typedef struct {
+  char* parse_tree;
+  char* stderr_buffer;
+  PgQueryError* error;
+} PgQueryParseResult;
+
+typedef struct {
+  char* plpgsql_funcs;
+  PgQueryError* error;
+} PgQueryPlpgsqlParseResult;
+
+typedef struct {
+  char* hexdigest;
+  char* stderr_buffer;
+  PgQueryError* error;
+} PgQueryFingerprintResult;
+
+typedef struct {
+  char* normalized_query;
+  PgQueryError* error;
+} PgQueryNormalizeResult;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+PgQueryNormalizeResult pg_query_normalize(const char* input);
+PgQueryParseResult pg_query_parse(const char* input);
+PgQueryPlpgsqlParseResult pg_query_parse_plpgsql(const char* input);
+
+PgQueryFingerprintResult pg_query_fingerprint(const char* input);
+
+void pg_query_free_normalize_result(PgQueryNormalizeResult result);
+void pg_query_free_parse_result(PgQueryParseResult result);
+void pg_query_free_plpgsql_parse_result(PgQueryPlpgsqlParseResult result);
+void pg_query_free_fingerprint_result(PgQueryFingerprintResult result);
+
+
+// Deprecated APIs below
+
+void pg_query_init(void); // Deprecated as of 9.5-1.4.1, this is now run automatically as needed
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/foreign/libpg_query/src/pg_query.c b/foreign/libpg_query/src/pg_query.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/pg_query.c
@@ -0,0 +1,54 @@
+#include "pg_query.h"
+#include "pg_query_internal.h"
+#include <mb/pg_wchar.h>
+#include <signal.h>
+
+const char* progname = "pg_query";
+
+__thread sig_atomic_t pg_query_initialized = 0;
+
+void pg_query_init(void)
+{
+	if (pg_query_initialized != 0) return;
+	pg_query_initialized = 1;
+
+	MemoryContextInit();
+	SetDatabaseEncoding(PG_UTF8);
+}
+
+MemoryContext pg_query_enter_memory_context(const char* ctx_name)
+{
+	MemoryContext ctx = NULL;
+
+	pg_query_init();
+
+	ctx = AllocSetContextCreate(TopMemoryContext,
+								ctx_name,
+								ALLOCSET_DEFAULT_MINSIZE,
+								ALLOCSET_DEFAULT_INITSIZE,
+								ALLOCSET_DEFAULT_MAXSIZE);
+	MemoryContextSwitchTo(ctx);
+
+	return ctx;
+}
+
+void pg_query_exit_memory_context(MemoryContext ctx)
+{
+	// Return to previous PostgreSQL memory context
+	MemoryContextSwitchTo(TopMemoryContext);
+
+	MemoryContextDelete(ctx);
+}
+
+void pg_query_free_error(PgQueryError *error)
+{
+	free(error->message);
+	free(error->funcname);
+	free(error->filename);
+
+	if (error->context) {
+		free(error->context);
+	}
+
+	free(error);
+}
diff --git a/foreign/libpg_query/src/pg_query_fingerprint.c b/foreign/libpg_query/src/pg_query_fingerprint.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/pg_query_fingerprint.c
@@ -0,0 +1,318 @@
+#include "pg_query.h"
+#include "pg_query_internal.h"
+#include "pg_query_fingerprint.h"
+
+#include "postgres.h"
+#include "sha1.h"
+#include "lib/ilist.h"
+
+#include "parser/parser.h"
+#include "parser/scanner.h"
+#include "parser/scansup.h"
+
+#include "nodes/parsenodes.h"
+#include "nodes/value.h"
+
+#include <unistd.h>
+#include <fcntl.h>
+
+// Definitions
+
+typedef struct FingerprintContext
+{
+	dlist_head tokens;
+	SHA1_CTX *sha1; // If this is NULL we write tokens, otherwise we write the sha1sum directly
+} FingerprintContext;
+
+typedef struct FingerprintToken
+{
+	char *str;
+	dlist_node list_node;
+} FingerprintToken;
+
+static void _fingerprintNode(FingerprintContext *ctx, const void *obj, const void *parent, char *parent_field_name, unsigned int depth);
+static void _fingerprintInitForTokens(FingerprintContext *ctx);
+static void _fingerprintCopyTokens(FingerprintContext *source, FingerprintContext *target, char *field_name);
+
+#define PG_QUERY_FINGERPRINT_VERSION 1
+
+// Implementations
+
+static void
+_fingerprintString(FingerprintContext *ctx, const char *str)
+{
+	if (ctx->sha1 != NULL) {
+		SHA1Update(ctx->sha1, (uint8*) str, strlen(str));
+	} else {
+		FingerprintToken *token = palloc0(sizeof(FingerprintToken));
+		token->str = pstrdup(str);
+		dlist_push_tail(&ctx->tokens, &token->list_node);
+	}
+}
+
+static void
+_fingerprintInteger(FingerprintContext *ctx, const Value *node)
+{
+	if (node->val.ival != 0) {
+		_fingerprintString(ctx, "Integer");
+		_fingerprintString(ctx, "ival");
+		char buffer[50];
+		sprintf(buffer, "%ld", node->val.ival);
+		_fingerprintString(ctx, buffer);
+	}
+}
+
+static void
+_fingerprintFloat(FingerprintContext *ctx, const Value *node)
+{
+	if (node->val.str != NULL) {
+		_fingerprintString(ctx, "Float");
+		_fingerprintString(ctx, "str");
+		_fingerprintString(ctx, node->val.str);
+	}
+}
+
+static void
+_fingerprintBitString(FingerprintContext *ctx, const Value *node)
+{
+	if (node->val.str != NULL) {
+		_fingerprintString(ctx, "BitString");
+		_fingerprintString(ctx, "str");
+		_fingerprintString(ctx, node->val.str);
+	}
+}
+
+#define FINGERPRINT_CMP_STRBUF 1024
+
+static int compareFingerprintContext(const void *a, const void *b)
+{
+	FingerprintContext *ca = *(FingerprintContext**) a;
+	FingerprintContext *cb = *(FingerprintContext**) b;
+
+	char strBufA[FINGERPRINT_CMP_STRBUF + 1] = {'\0'};
+	char strBufB[FINGERPRINT_CMP_STRBUF + 1] = {'\0'};
+
+	dlist_iter iterA;
+	dlist_iter iterB;
+
+	dlist_foreach(iterA, &ca->tokens)
+	{
+		FingerprintToken *token = dlist_container(FingerprintToken, list_node, iterA.cur);
+
+		strncat(strBufA, token->str, FINGERPRINT_CMP_STRBUF - strlen(strBufA));
+	}
+
+	dlist_foreach(iterB, &cb->tokens)
+	{
+		FingerprintToken *token = dlist_container(FingerprintToken, list_node, iterB.cur);
+
+		strncat(strBufB, token->str, FINGERPRINT_CMP_STRBUF - strlen(strBufB));
+	}
+
+	//printf("COMP %s <=> %s = %d\n", strBufA, strBufB, strcmp(strBufA, strBufB));
+
+	return strcmp(strBufA, strBufB);
+}
+
+static void
+_fingerprintList(FingerprintContext *ctx, const List *node, const void *parent, char *field_name, unsigned int depth)
+{
+	if (field_name != NULL && (strcmp(field_name, "fromClause") == 0 || strcmp(field_name, "targetList") == 0 ||
+			strcmp(field_name, "cols") == 0 || strcmp(field_name, "rexpr") == 0)) {
+
+		FingerprintContext** subCtxArr = palloc0(node->length * sizeof(FingerprintContext*));
+		size_t subCtxCount = 0;
+		size_t i;
+		const ListCell *lc;
+
+		foreach(lc, node)
+		{
+			FingerprintContext* subCtx = palloc0(sizeof(FingerprintContext));
+
+			_fingerprintInitForTokens(subCtx);
+			_fingerprintNode(subCtx, lfirst(lc), parent, field_name, depth + 1);
+
+			bool exists = false;
+			for (i = 0; i < subCtxCount; i++) {
+				if (compareFingerprintContext(&subCtxArr[i], &subCtx) == 0) {
+					exists = true;
+					break;
+				}
+			}
+
+			if (!exists) {
+				subCtxArr[subCtxCount] = subCtx;
+				subCtxCount += 1;
+			}
+
+			lnext(lc);
+		}
+
+		pg_qsort(subCtxArr, subCtxCount, sizeof(FingerprintContext*), compareFingerprintContext);
+
+		for (i = 0; i < subCtxCount; i++) {
+			_fingerprintCopyTokens(subCtxArr[i], ctx, NULL);
+		}
+	} else {
+		const ListCell *lc;
+
+		foreach(lc, node)
+		{
+			_fingerprintNode(ctx, lfirst(lc), parent, field_name, depth + 1);
+
+			lnext(lc);
+		}
+	}
+}
+
+static void
+_fingerprintInitForTokens(FingerprintContext *ctx) {
+	ctx->sha1 = NULL;
+	dlist_init(&ctx->tokens);
+}
+
+static void
+_fingerprintCopyTokens(FingerprintContext *source, FingerprintContext *target, char *field_name) {
+	dlist_iter iter;
+
+	if (dlist_is_empty(&source->tokens)) return;
+
+	if (field_name != NULL) {
+		_fingerprintString(target, field_name);
+	}
+
+	dlist_foreach(iter, &source->tokens)
+	{
+		FingerprintToken *token = dlist_container(FingerprintToken, list_node, iter.cur);
+
+		_fingerprintString(target, token->str);
+	}
+}
+
+#include "pg_query_fingerprint_defs.c"
+
+void
+_fingerprintNode(FingerprintContext *ctx, const void *obj, const void *parent, char *field_name, unsigned int depth)
+{
+	// Some queries are overly complex in their parsetree - lets consistently cut them off at 100 nodes deep
+	if (depth >= 100) {
+		return;
+	}
+
+	if (obj == NULL)
+	{
+		return; // Ignore
+	}
+
+	if (IsA(obj, List))
+	{
+		_fingerprintList(ctx, obj, parent, field_name, depth);
+	}
+	else
+	{
+		switch (nodeTag(obj))
+		{
+			case T_Integer:
+				_fingerprintInteger(ctx, obj);
+				break;
+			case T_Float:
+				_fingerprintFloat(ctx, obj);
+				break;
+			case T_String:
+				_fingerprintString(ctx, "String");
+				_fingerprintString(ctx, "str");
+				_fingerprintString(ctx, ((Value*) obj)->val.str);
+				break;
+			case T_BitString:
+				_fingerprintBitString(ctx, obj);
+				break;
+
+			#include "pg_query_fingerprint_conds.c"
+
+			default:
+				elog(WARNING, "could not fingerprint unrecognized node type: %d",
+					 (int) nodeTag(obj));
+
+				return;
+		}
+	}
+}
+
+PgQueryFingerprintResult pg_query_fingerprint_with_opts(const char* input, bool printTokens)
+{
+	MemoryContext ctx = NULL;
+	PgQueryInternalParsetreeAndError parsetree_and_error;
+	PgQueryFingerprintResult result = {0};
+
+	ctx = pg_query_enter_memory_context("pg_query_fingerprint");
+
+	parsetree_and_error = pg_query_raw_parse(input);
+
+	// These are all malloc-ed and will survive exiting the memory context, the caller is responsible to free them now
+	result.stderr_buffer = parsetree_and_error.stderr_buffer;
+	result.error = parsetree_and_error.error;
+
+	if (parsetree_and_error.tree != NULL || result.error == NULL) {
+		FingerprintContext ctx;
+		int i;
+		uint8 sha1result[SHA1_RESULTLEN];
+
+		ctx.sha1 = palloc0(sizeof(SHA1_CTX));
+		SHA1Init(ctx.sha1);
+
+		if (parsetree_and_error.tree != NULL) {
+			_fingerprintNode(&ctx, parsetree_and_error.tree, NULL, NULL, 0);
+		}
+
+		SHA1Final(sha1result, ctx.sha1);
+
+		// This is intentionally malloc-ed and will survive exiting the memory context
+		result.hexdigest = calloc((1 + SHA1_RESULTLEN) * 2 + 1, sizeof(char));
+
+		sprintf(result.hexdigest, "%02x", PG_QUERY_FINGERPRINT_VERSION);
+
+		for (i = 0; i < SHA1_RESULTLEN; i++) {
+			sprintf(result.hexdigest + (1 + i) * 2, "%02x", sha1result[i]);
+		}
+
+		if (printTokens) {
+			FingerprintContext debugCtx;
+			dlist_iter iter;
+
+			_fingerprintInitForTokens(&debugCtx);
+			_fingerprintNode(&debugCtx, parsetree_and_error.tree, NULL, NULL, 0);
+
+			printf("[");
+
+			dlist_foreach(iter, &debugCtx.tokens)
+			{
+				FingerprintToken *token = dlist_container(FingerprintToken, list_node, iter.cur);
+
+				printf("%s, ", token->str);
+			}
+
+			printf("]\n");
+		}
+	}
+
+	pg_query_exit_memory_context(ctx);
+
+	return result;
+}
+
+PgQueryFingerprintResult pg_query_fingerprint(const char* input)
+{
+	return pg_query_fingerprint_with_opts(input, false);
+}
+
+void pg_query_free_fingerprint_result(PgQueryFingerprintResult result)
+{
+	if (result.error) {
+		free(result.error->message);
+		free(result.error->filename);
+		free(result.error);
+	}
+
+	free(result.hexdigest);
+	free(result.stderr_buffer);
+}
diff --git a/foreign/libpg_query/src/pg_query_fingerprint.h b/foreign/libpg_query/src/pg_query_fingerprint.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/pg_query_fingerprint.h
@@ -0,0 +1,8 @@
+#ifndef PG_QUERY_FINGERPRINT_H
+#define PG_QUERY_FINGERPRINT_H
+
+#include <stdbool.h>
+
+PgQueryFingerprintResult pg_query_fingerprint_with_opts(const char* input, bool printTokens);
+
+#endif
diff --git a/foreign/libpg_query/src/pg_query_fingerprint_conds.c b/foreign/libpg_query/src/pg_query_fingerprint_conds.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/pg_query_fingerprint_conds.c
@@ -0,0 +1,576 @@
+case T_Alias:
+  _fingerprintAlias(ctx, obj, parent, field_name, depth);
+  break;
+case T_RangeVar:
+  _fingerprintRangeVar(ctx, obj, parent, field_name, depth);
+  break;
+case T_Expr:
+  _fingerprintExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_Var:
+  _fingerprintVar(ctx, obj, parent, field_name, depth);
+  break;
+case T_Const:
+  _fingerprintConst(ctx, obj, parent, field_name, depth);
+  break;
+case T_Param:
+  _fingerprintParam(ctx, obj, parent, field_name, depth);
+  break;
+case T_Aggref:
+  _fingerprintAggref(ctx, obj, parent, field_name, depth);
+  break;
+case T_GroupingFunc:
+  _fingerprintGroupingFunc(ctx, obj, parent, field_name, depth);
+  break;
+case T_WindowFunc:
+  _fingerprintWindowFunc(ctx, obj, parent, field_name, depth);
+  break;
+case T_ArrayRef:
+  _fingerprintArrayRef(ctx, obj, parent, field_name, depth);
+  break;
+case T_FuncExpr:
+  _fingerprintFuncExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_NamedArgExpr:
+  _fingerprintNamedArgExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_OpExpr:
+  _fingerprintOpExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_ScalarArrayOpExpr:
+  _fingerprintScalarArrayOpExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_BoolExpr:
+  _fingerprintBoolExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_SubLink:
+  _fingerprintSubLink(ctx, obj, parent, field_name, depth);
+  break;
+case T_SubPlan:
+  _fingerprintSubPlan(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlternativeSubPlan:
+  _fingerprintAlternativeSubPlan(ctx, obj, parent, field_name, depth);
+  break;
+case T_FieldSelect:
+  _fingerprintFieldSelect(ctx, obj, parent, field_name, depth);
+  break;
+case T_FieldStore:
+  _fingerprintFieldStore(ctx, obj, parent, field_name, depth);
+  break;
+case T_RelabelType:
+  _fingerprintRelabelType(ctx, obj, parent, field_name, depth);
+  break;
+case T_CoerceViaIO:
+  _fingerprintCoerceViaIO(ctx, obj, parent, field_name, depth);
+  break;
+case T_ArrayCoerceExpr:
+  _fingerprintArrayCoerceExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_ConvertRowtypeExpr:
+  _fingerprintConvertRowtypeExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_CollateExpr:
+  _fingerprintCollateExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_CaseExpr:
+  _fingerprintCaseExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_CaseWhen:
+  _fingerprintCaseWhen(ctx, obj, parent, field_name, depth);
+  break;
+case T_CaseTestExpr:
+  _fingerprintCaseTestExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_ArrayExpr:
+  _fingerprintArrayExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_RowExpr:
+  _fingerprintRowExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_RowCompareExpr:
+  _fingerprintRowCompareExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_CoalesceExpr:
+  _fingerprintCoalesceExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_MinMaxExpr:
+  _fingerprintMinMaxExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_XmlExpr:
+  _fingerprintXmlExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_NullTest:
+  _fingerprintNullTest(ctx, obj, parent, field_name, depth);
+  break;
+case T_BooleanTest:
+  _fingerprintBooleanTest(ctx, obj, parent, field_name, depth);
+  break;
+case T_CoerceToDomain:
+  _fingerprintCoerceToDomain(ctx, obj, parent, field_name, depth);
+  break;
+case T_CoerceToDomainValue:
+  _fingerprintCoerceToDomainValue(ctx, obj, parent, field_name, depth);
+  break;
+case T_SetToDefault:
+  _fingerprintSetToDefault(ctx, obj, parent, field_name, depth);
+  break;
+case T_CurrentOfExpr:
+  _fingerprintCurrentOfExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_InferenceElem:
+  _fingerprintInferenceElem(ctx, obj, parent, field_name, depth);
+  break;
+case T_TargetEntry:
+  _fingerprintTargetEntry(ctx, obj, parent, field_name, depth);
+  break;
+case T_RangeTblRef:
+  _fingerprintRangeTblRef(ctx, obj, parent, field_name, depth);
+  break;
+case T_JoinExpr:
+  _fingerprintJoinExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_FromExpr:
+  _fingerprintFromExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_OnConflictExpr:
+  _fingerprintOnConflictExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_IntoClause:
+  _fingerprintIntoClause(ctx, obj, parent, field_name, depth);
+  break;
+case T_Query:
+  _fingerprintQuery(ctx, obj, parent, field_name, depth);
+  break;
+case T_InsertStmt:
+  _fingerprintInsertStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_DeleteStmt:
+  _fingerprintDeleteStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_UpdateStmt:
+  _fingerprintUpdateStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_SelectStmt:
+  _fingerprintSelectStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterTableStmt:
+  _fingerprintAlterTableStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterTableCmd:
+  _fingerprintAlterTableCmd(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterDomainStmt:
+  _fingerprintAlterDomainStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_SetOperationStmt:
+  _fingerprintSetOperationStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_GrantStmt:
+  _fingerprintGrantStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_GrantRoleStmt:
+  _fingerprintGrantRoleStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterDefaultPrivilegesStmt:
+  _fingerprintAlterDefaultPrivilegesStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_ClosePortalStmt:
+  _fingerprintClosePortalStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_ClusterStmt:
+  _fingerprintClusterStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CopyStmt:
+  _fingerprintCopyStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateStmt:
+  _fingerprintCreateStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_DefineStmt:
+  _fingerprintDefineStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_DropStmt:
+  _fingerprintDropStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_TruncateStmt:
+  _fingerprintTruncateStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CommentStmt:
+  _fingerprintCommentStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_FetchStmt:
+  _fingerprintFetchStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_IndexStmt:
+  _fingerprintIndexStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateFunctionStmt:
+  _fingerprintCreateFunctionStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterFunctionStmt:
+  _fingerprintAlterFunctionStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_DoStmt:
+  _fingerprintDoStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_RenameStmt:
+  _fingerprintRenameStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_RuleStmt:
+  _fingerprintRuleStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_NotifyStmt:
+  _fingerprintNotifyStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_ListenStmt:
+  _fingerprintListenStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_UnlistenStmt:
+  _fingerprintUnlistenStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_TransactionStmt:
+  _fingerprintTransactionStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_ViewStmt:
+  _fingerprintViewStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_LoadStmt:
+  _fingerprintLoadStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateDomainStmt:
+  _fingerprintCreateDomainStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreatedbStmt:
+  _fingerprintCreatedbStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_DropdbStmt:
+  _fingerprintDropdbStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_VacuumStmt:
+  _fingerprintVacuumStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_ExplainStmt:
+  _fingerprintExplainStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateTableAsStmt:
+  _fingerprintCreateTableAsStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateSeqStmt:
+  _fingerprintCreateSeqStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterSeqStmt:
+  _fingerprintAlterSeqStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_VariableSetStmt:
+  _fingerprintVariableSetStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_VariableShowStmt:
+  _fingerprintVariableShowStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_DiscardStmt:
+  _fingerprintDiscardStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateTrigStmt:
+  _fingerprintCreateTrigStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreatePLangStmt:
+  _fingerprintCreatePLangStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateRoleStmt:
+  _fingerprintCreateRoleStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterRoleStmt:
+  _fingerprintAlterRoleStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_DropRoleStmt:
+  _fingerprintDropRoleStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_LockStmt:
+  _fingerprintLockStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_ConstraintsSetStmt:
+  _fingerprintConstraintsSetStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_ReindexStmt:
+  _fingerprintReindexStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CheckPointStmt:
+  _fingerprintCheckPointStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateSchemaStmt:
+  _fingerprintCreateSchemaStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterDatabaseStmt:
+  _fingerprintAlterDatabaseStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterDatabaseSetStmt:
+  _fingerprintAlterDatabaseSetStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterRoleSetStmt:
+  _fingerprintAlterRoleSetStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateConversionStmt:
+  _fingerprintCreateConversionStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateCastStmt:
+  _fingerprintCreateCastStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateOpClassStmt:
+  _fingerprintCreateOpClassStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateOpFamilyStmt:
+  _fingerprintCreateOpFamilyStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterOpFamilyStmt:
+  _fingerprintAlterOpFamilyStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_PrepareStmt:
+  _fingerprintPrepareStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_ExecuteStmt:
+  _fingerprintExecuteStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_DeallocateStmt:
+  _fingerprintDeallocateStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_DeclareCursorStmt:
+  _fingerprintDeclareCursorStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateTableSpaceStmt:
+  _fingerprintCreateTableSpaceStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_DropTableSpaceStmt:
+  _fingerprintDropTableSpaceStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterObjectSchemaStmt:
+  _fingerprintAlterObjectSchemaStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterOwnerStmt:
+  _fingerprintAlterOwnerStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_DropOwnedStmt:
+  _fingerprintDropOwnedStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_ReassignOwnedStmt:
+  _fingerprintReassignOwnedStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CompositeTypeStmt:
+  _fingerprintCompositeTypeStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateEnumStmt:
+  _fingerprintCreateEnumStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateRangeStmt:
+  _fingerprintCreateRangeStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterEnumStmt:
+  _fingerprintAlterEnumStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterTSDictionaryStmt:
+  _fingerprintAlterTSDictionaryStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterTSConfigurationStmt:
+  _fingerprintAlterTSConfigurationStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateFdwStmt:
+  _fingerprintCreateFdwStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterFdwStmt:
+  _fingerprintAlterFdwStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateForeignServerStmt:
+  _fingerprintCreateForeignServerStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterForeignServerStmt:
+  _fingerprintAlterForeignServerStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateUserMappingStmt:
+  _fingerprintCreateUserMappingStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterUserMappingStmt:
+  _fingerprintAlterUserMappingStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_DropUserMappingStmt:
+  _fingerprintDropUserMappingStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterTableSpaceOptionsStmt:
+  _fingerprintAlterTableSpaceOptionsStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterTableMoveAllStmt:
+  _fingerprintAlterTableMoveAllStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_SecLabelStmt:
+  _fingerprintSecLabelStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateForeignTableStmt:
+  _fingerprintCreateForeignTableStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_ImportForeignSchemaStmt:
+  _fingerprintImportForeignSchemaStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateExtensionStmt:
+  _fingerprintCreateExtensionStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterExtensionStmt:
+  _fingerprintAlterExtensionStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterExtensionContentsStmt:
+  _fingerprintAlterExtensionContentsStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateEventTrigStmt:
+  _fingerprintCreateEventTrigStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterEventTrigStmt:
+  _fingerprintAlterEventTrigStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_RefreshMatViewStmt:
+  _fingerprintRefreshMatViewStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_ReplicaIdentityStmt:
+  _fingerprintReplicaIdentityStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterSystemStmt:
+  _fingerprintAlterSystemStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreatePolicyStmt:
+  _fingerprintCreatePolicyStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_AlterPolicyStmt:
+  _fingerprintAlterPolicyStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateTransformStmt:
+  _fingerprintCreateTransformStmt(ctx, obj, parent, field_name, depth);
+  break;
+case T_A_Expr:
+  _fingerprintA_Expr(ctx, obj, parent, field_name, depth);
+  break;
+case T_ColumnRef:
+  _fingerprintColumnRef(ctx, obj, parent, field_name, depth);
+  break;
+case T_ParamRef:
+  _fingerprintParamRef(ctx, obj, parent, field_name, depth);
+  break;
+case T_A_Const:
+  _fingerprintA_Const(ctx, obj, parent, field_name, depth);
+  break;
+case T_FuncCall:
+  _fingerprintFuncCall(ctx, obj, parent, field_name, depth);
+  break;
+case T_A_Star:
+  _fingerprintA_Star(ctx, obj, parent, field_name, depth);
+  break;
+case T_A_Indices:
+  _fingerprintA_Indices(ctx, obj, parent, field_name, depth);
+  break;
+case T_A_Indirection:
+  _fingerprintA_Indirection(ctx, obj, parent, field_name, depth);
+  break;
+case T_A_ArrayExpr:
+  _fingerprintA_ArrayExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_ResTarget:
+  _fingerprintResTarget(ctx, obj, parent, field_name, depth);
+  break;
+case T_MultiAssignRef:
+  _fingerprintMultiAssignRef(ctx, obj, parent, field_name, depth);
+  break;
+case T_TypeCast:
+  _fingerprintTypeCast(ctx, obj, parent, field_name, depth);
+  break;
+case T_CollateClause:
+  _fingerprintCollateClause(ctx, obj, parent, field_name, depth);
+  break;
+case T_SortBy:
+  _fingerprintSortBy(ctx, obj, parent, field_name, depth);
+  break;
+case T_WindowDef:
+  _fingerprintWindowDef(ctx, obj, parent, field_name, depth);
+  break;
+case T_RangeSubselect:
+  _fingerprintRangeSubselect(ctx, obj, parent, field_name, depth);
+  break;
+case T_RangeFunction:
+  _fingerprintRangeFunction(ctx, obj, parent, field_name, depth);
+  break;
+case T_RangeTableSample:
+  _fingerprintRangeTableSample(ctx, obj, parent, field_name, depth);
+  break;
+case T_TypeName:
+  _fingerprintTypeName(ctx, obj, parent, field_name, depth);
+  break;
+case T_ColumnDef:
+  _fingerprintColumnDef(ctx, obj, parent, field_name, depth);
+  break;
+case T_IndexElem:
+  _fingerprintIndexElem(ctx, obj, parent, field_name, depth);
+  break;
+case T_Constraint:
+  _fingerprintConstraint(ctx, obj, parent, field_name, depth);
+  break;
+case T_DefElem:
+  _fingerprintDefElem(ctx, obj, parent, field_name, depth);
+  break;
+case T_RangeTblEntry:
+  _fingerprintRangeTblEntry(ctx, obj, parent, field_name, depth);
+  break;
+case T_RangeTblFunction:
+  _fingerprintRangeTblFunction(ctx, obj, parent, field_name, depth);
+  break;
+case T_TableSampleClause:
+  _fingerprintTableSampleClause(ctx, obj, parent, field_name, depth);
+  break;
+case T_WithCheckOption:
+  _fingerprintWithCheckOption(ctx, obj, parent, field_name, depth);
+  break;
+case T_SortGroupClause:
+  _fingerprintSortGroupClause(ctx, obj, parent, field_name, depth);
+  break;
+case T_GroupingSet:
+  _fingerprintGroupingSet(ctx, obj, parent, field_name, depth);
+  break;
+case T_WindowClause:
+  _fingerprintWindowClause(ctx, obj, parent, field_name, depth);
+  break;
+case T_FuncWithArgs:
+  _fingerprintFuncWithArgs(ctx, obj, parent, field_name, depth);
+  break;
+case T_AccessPriv:
+  _fingerprintAccessPriv(ctx, obj, parent, field_name, depth);
+  break;
+case T_CreateOpClassItem:
+  _fingerprintCreateOpClassItem(ctx, obj, parent, field_name, depth);
+  break;
+case T_TableLikeClause:
+  _fingerprintTableLikeClause(ctx, obj, parent, field_name, depth);
+  break;
+case T_FunctionParameter:
+  _fingerprintFunctionParameter(ctx, obj, parent, field_name, depth);
+  break;
+case T_LockingClause:
+  _fingerprintLockingClause(ctx, obj, parent, field_name, depth);
+  break;
+case T_RowMarkClause:
+  _fingerprintRowMarkClause(ctx, obj, parent, field_name, depth);
+  break;
+case T_XmlSerialize:
+  _fingerprintXmlSerialize(ctx, obj, parent, field_name, depth);
+  break;
+case T_WithClause:
+  _fingerprintWithClause(ctx, obj, parent, field_name, depth);
+  break;
+case T_InferClause:
+  _fingerprintInferClause(ctx, obj, parent, field_name, depth);
+  break;
+case T_OnConflictClause:
+  _fingerprintOnConflictClause(ctx, obj, parent, field_name, depth);
+  break;
+case T_CommonTableExpr:
+  _fingerprintCommonTableExpr(ctx, obj, parent, field_name, depth);
+  break;
+case T_RoleSpec:
+  _fingerprintRoleSpec(ctx, obj, parent, field_name, depth);
+  break;
+case T_InlineCodeBlock:
+  _fingerprintInlineCodeBlock(ctx, obj, parent, field_name, depth);
+  break;
diff --git a/foreign/libpg_query/src/pg_query_fingerprint_defs.c b/foreign/libpg_query/src/pg_query_fingerprint_defs.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/pg_query_fingerprint_defs.c
@@ -0,0 +1,6614 @@
+static void
+_fingerprintAlias(FingerprintContext *ctx, const Alias *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  // Intentionally ignoring all fields for fingerprinting
+}
+
+static void
+_fingerprintRangeVar(FingerprintContext *ctx, const RangeVar *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "RangeVar");
+  if (node->alias != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->alias, node, "alias", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "alias");
+  }
+
+  if (node->catalogname != NULL) {
+    _fingerprintString(ctx, "catalogname");
+    _fingerprintString(ctx, node->catalogname);
+  }
+
+  if (node->inhOpt != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->inhOpt);
+    _fingerprintString(ctx, "inhOpt");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+
+  if (node->relname != NULL) {
+    _fingerprintString(ctx, "relname");
+    _fingerprintString(ctx, node->relname);
+  }
+
+  if (node->relpersistence != 0) {
+    char str[2] = {node->relpersistence, '\0'};
+    _fingerprintString(ctx, "relpersistence");
+    _fingerprintString(ctx, str);
+  }
+
+
+  if (node->schemaname != NULL) {
+    _fingerprintString(ctx, "schemaname");
+    _fingerprintString(ctx, node->schemaname);
+  }
+
+}
+
+static void
+_fingerprintExpr(FingerprintContext *ctx, const Expr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "Expr");
+}
+
+static void
+_fingerprintVar(FingerprintContext *ctx, const Var *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "Var");
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->varattno != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->varattno);
+    _fingerprintString(ctx, "varattno");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->varcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->varcollid);
+    _fingerprintString(ctx, "varcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->varlevelsup != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->varlevelsup);
+    _fingerprintString(ctx, "varlevelsup");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->varno != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->varno);
+    _fingerprintString(ctx, "varno");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->varnoold != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->varnoold);
+    _fingerprintString(ctx, "varnoold");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->varoattno != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->varoattno);
+    _fingerprintString(ctx, "varoattno");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->vartype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->vartype);
+    _fingerprintString(ctx, "vartype");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->vartypmod != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->vartypmod);
+    _fingerprintString(ctx, "vartypmod");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintConst(FingerprintContext *ctx, const Const *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "Const");
+
+  if (node->constbyval) {    _fingerprintString(ctx, "constbyval");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->constcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->constcollid);
+    _fingerprintString(ctx, "constcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->constisnull) {    _fingerprintString(ctx, "constisnull");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->constlen != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->constlen);
+    _fingerprintString(ctx, "constlen");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->consttype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->consttype);
+    _fingerprintString(ctx, "consttype");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->consttypmod != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->consttypmod);
+    _fingerprintString(ctx, "consttypmod");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+}
+
+static void
+_fingerprintParam(FingerprintContext *ctx, const Param *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "Param");
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->paramcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->paramcollid);
+    _fingerprintString(ctx, "paramcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->paramid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->paramid);
+    _fingerprintString(ctx, "paramid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->paramkind != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->paramkind);
+    _fingerprintString(ctx, "paramkind");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->paramtype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->paramtype);
+    _fingerprintString(ctx, "paramtype");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->paramtypmod != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->paramtypmod);
+    _fingerprintString(ctx, "paramtypmod");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintAggref(FingerprintContext *ctx, const Aggref *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "Aggref");
+  if (node->aggcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->aggcollid);
+    _fingerprintString(ctx, "aggcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->aggdirectargs != NULL && node->aggdirectargs->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->aggdirectargs, node, "aggdirectargs", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "aggdirectargs");
+  }
+  if (node->aggdistinct != NULL && node->aggdistinct->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->aggdistinct, node, "aggdistinct", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "aggdistinct");
+  }
+  if (node->aggfilter != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->aggfilter, node, "aggfilter", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "aggfilter");
+  }
+  if (node->aggfnoid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->aggfnoid);
+    _fingerprintString(ctx, "aggfnoid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->aggkind != 0) {
+    char str[2] = {node->aggkind, '\0'};
+    _fingerprintString(ctx, "aggkind");
+    _fingerprintString(ctx, str);
+  }
+
+  if (node->agglevelsup != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->agglevelsup);
+    _fingerprintString(ctx, "agglevelsup");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->aggorder != NULL && node->aggorder->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->aggorder, node, "aggorder", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "aggorder");
+  }
+
+  if (node->aggstar) {    _fingerprintString(ctx, "aggstar");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->aggtype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->aggtype);
+    _fingerprintString(ctx, "aggtype");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->aggvariadic) {    _fingerprintString(ctx, "aggvariadic");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  if (node->inputcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->inputcollid);
+    _fingerprintString(ctx, "inputcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+}
+
+static void
+_fingerprintGroupingFunc(FingerprintContext *ctx, const GroupingFunc *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "GroupingFunc");
+  if (node->agglevelsup != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->agglevelsup);
+    _fingerprintString(ctx, "agglevelsup");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  if (node->cols != NULL && node->cols->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->cols, node, "cols", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "cols");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->refs != NULL && node->refs->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->refs, node, "refs", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "refs");
+  }
+}
+
+static void
+_fingerprintWindowFunc(FingerprintContext *ctx, const WindowFunc *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "WindowFunc");
+  if (node->aggfilter != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->aggfilter, node, "aggfilter", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "aggfilter");
+  }
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  if (node->inputcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->inputcollid);
+    _fingerprintString(ctx, "inputcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+
+  if (node->winagg) {    _fingerprintString(ctx, "winagg");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->wincollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->wincollid);
+    _fingerprintString(ctx, "wincollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->winfnoid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->winfnoid);
+    _fingerprintString(ctx, "winfnoid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->winref != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->winref);
+    _fingerprintString(ctx, "winref");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->winstar) {    _fingerprintString(ctx, "winstar");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->wintype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->wintype);
+    _fingerprintString(ctx, "wintype");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintArrayRef(FingerprintContext *ctx, const ArrayRef *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ArrayRef");
+  if (node->refarraytype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->refarraytype);
+    _fingerprintString(ctx, "refarraytype");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->refassgnexpr != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->refassgnexpr, node, "refassgnexpr", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "refassgnexpr");
+  }
+  if (node->refcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->refcollid);
+    _fingerprintString(ctx, "refcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->refelemtype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->refelemtype);
+    _fingerprintString(ctx, "refelemtype");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->refexpr != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->refexpr, node, "refexpr", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "refexpr");
+  }
+  if (node->reflowerindexpr != NULL && node->reflowerindexpr->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->reflowerindexpr, node, "reflowerindexpr", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "reflowerindexpr");
+  }
+  if (node->reftypmod != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->reftypmod);
+    _fingerprintString(ctx, "reftypmod");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->refupperindexpr != NULL && node->refupperindexpr->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->refupperindexpr, node, "refupperindexpr", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "refupperindexpr");
+  }
+}
+
+static void
+_fingerprintFuncExpr(FingerprintContext *ctx, const FuncExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "FuncExpr");
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  if (node->funccollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->funccollid);
+    _fingerprintString(ctx, "funccollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->funcformat != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->funcformat);
+    _fingerprintString(ctx, "funcformat");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->funcid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->funcid);
+    _fingerprintString(ctx, "funcid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->funcresulttype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->funcresulttype);
+    _fingerprintString(ctx, "funcresulttype");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->funcretset) {    _fingerprintString(ctx, "funcretset");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->funcvariadic) {    _fingerprintString(ctx, "funcvariadic");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->inputcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->inputcollid);
+    _fingerprintString(ctx, "inputcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+}
+
+static void
+_fingerprintNamedArgExpr(FingerprintContext *ctx, const NamedArgExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "NamedArgExpr");
+  if (node->arg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg, node, "arg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg");
+  }
+  if (node->argnumber != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->argnumber);
+    _fingerprintString(ctx, "argnumber");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+
+  if (node->name != NULL) {
+    _fingerprintString(ctx, "name");
+    _fingerprintString(ctx, node->name);
+  }
+
+}
+
+static void
+_fingerprintOpExpr(FingerprintContext *ctx, const OpExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "OpExpr");
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  if (node->inputcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->inputcollid);
+    _fingerprintString(ctx, "inputcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->opcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->opcollid);
+    _fingerprintString(ctx, "opcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->opfuncid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->opfuncid);
+    _fingerprintString(ctx, "opfuncid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->opno != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->opno);
+    _fingerprintString(ctx, "opno");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->opresulttype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->opresulttype);
+    _fingerprintString(ctx, "opresulttype");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->opretset) {    _fingerprintString(ctx, "opretset");
+    _fingerprintString(ctx, "true");
+  }
+
+}
+
+static void
+_fingerprintScalarArrayOpExpr(FingerprintContext *ctx, const ScalarArrayOpExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ScalarArrayOpExpr");
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  if (node->inputcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->inputcollid);
+    _fingerprintString(ctx, "inputcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->opfuncid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->opfuncid);
+    _fingerprintString(ctx, "opfuncid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->opno != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->opno);
+    _fingerprintString(ctx, "opno");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->useOr) {    _fingerprintString(ctx, "useOr");
+    _fingerprintString(ctx, "true");
+  }
+
+}
+
+static void
+_fingerprintBoolExpr(FingerprintContext *ctx, const BoolExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "BoolExpr");
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  if (node->boolop != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->boolop);
+    _fingerprintString(ctx, "boolop");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+}
+
+static void
+_fingerprintSubLink(FingerprintContext *ctx, const SubLink *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "SubLink");
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->operName != NULL && node->operName->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->operName, node, "operName", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "operName");
+  }
+  if (node->subLinkId != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->subLinkId);
+    _fingerprintString(ctx, "subLinkId");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->subLinkType != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->subLinkType);
+    _fingerprintString(ctx, "subLinkType");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->subselect != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->subselect, node, "subselect", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "subselect");
+  }
+  if (node->testexpr != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->testexpr, node, "testexpr", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "testexpr");
+  }
+}
+
+static void
+_fingerprintSubPlan(FingerprintContext *ctx, const SubPlan *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "SubPlan");
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  if (node->firstColCollation != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->firstColCollation);
+    _fingerprintString(ctx, "firstColCollation");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->firstColType != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->firstColType);
+    _fingerprintString(ctx, "firstColType");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->firstColTypmod != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->firstColTypmod);
+    _fingerprintString(ctx, "firstColTypmod");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->parParam != NULL && node->parParam->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->parParam, node, "parParam", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "parParam");
+  }
+  if (node->paramIds != NULL && node->paramIds->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->paramIds, node, "paramIds", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "paramIds");
+  }
+if (node->per_call_cost != 0) {
+  char buffer[50];
+  sprintf(buffer, "%f", node->per_call_cost);
+  _fingerprintString(ctx, "per_call_cost");
+  _fingerprintString(ctx, buffer);
+}
+
+  if (node->plan_id != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->plan_id);
+    _fingerprintString(ctx, "plan_id");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->plan_name != NULL) {
+    _fingerprintString(ctx, "plan_name");
+    _fingerprintString(ctx, node->plan_name);
+  }
+
+  if (node->setParam != NULL && node->setParam->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->setParam, node, "setParam", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "setParam");
+  }
+if (node->startup_cost != 0) {
+  char buffer[50];
+  sprintf(buffer, "%f", node->startup_cost);
+  _fingerprintString(ctx, "startup_cost");
+  _fingerprintString(ctx, buffer);
+}
+
+  if (node->subLinkType != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->subLinkType);
+    _fingerprintString(ctx, "subLinkType");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->testexpr != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->testexpr, node, "testexpr", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "testexpr");
+  }
+
+  if (node->unknownEqFalse) {    _fingerprintString(ctx, "unknownEqFalse");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->useHashTable) {    _fingerprintString(ctx, "useHashTable");
+    _fingerprintString(ctx, "true");
+  }
+
+}
+
+static void
+_fingerprintAlternativeSubPlan(FingerprintContext *ctx, const AlternativeSubPlan *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlternativeSubPlan");
+  if (node->subplans != NULL && node->subplans->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->subplans, node, "subplans", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "subplans");
+  }
+}
+
+static void
+_fingerprintFieldSelect(FingerprintContext *ctx, const FieldSelect *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "FieldSelect");
+  if (node->arg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg, node, "arg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg");
+  }
+  if (node->fieldnum != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->fieldnum);
+    _fingerprintString(ctx, "fieldnum");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->resultcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resultcollid);
+    _fingerprintString(ctx, "resultcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->resulttype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resulttype);
+    _fingerprintString(ctx, "resulttype");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->resulttypmod != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resulttypmod);
+    _fingerprintString(ctx, "resulttypmod");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintFieldStore(FingerprintContext *ctx, const FieldStore *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "FieldStore");
+  if (node->arg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg, node, "arg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg");
+  }
+  if (node->fieldnums != NULL && node->fieldnums->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->fieldnums, node, "fieldnums", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "fieldnums");
+  }
+  if (node->newvals != NULL && node->newvals->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->newvals, node, "newvals", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "newvals");
+  }
+  if (node->resulttype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resulttype);
+    _fingerprintString(ctx, "resulttype");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintRelabelType(FingerprintContext *ctx, const RelabelType *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "RelabelType");
+  if (node->arg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg, node, "arg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->relabelformat != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->relabelformat);
+    _fingerprintString(ctx, "relabelformat");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->resultcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resultcollid);
+    _fingerprintString(ctx, "resultcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->resulttype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resulttype);
+    _fingerprintString(ctx, "resulttype");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->resulttypmod != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resulttypmod);
+    _fingerprintString(ctx, "resulttypmod");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintCoerceViaIO(FingerprintContext *ctx, const CoerceViaIO *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CoerceViaIO");
+  if (node->arg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg, node, "arg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg");
+  }
+  if (node->coerceformat != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->coerceformat);
+    _fingerprintString(ctx, "coerceformat");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->resultcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resultcollid);
+    _fingerprintString(ctx, "resultcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->resulttype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resulttype);
+    _fingerprintString(ctx, "resulttype");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintArrayCoerceExpr(FingerprintContext *ctx, const ArrayCoerceExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ArrayCoerceExpr");
+  if (node->arg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg, node, "arg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg");
+  }
+  if (node->coerceformat != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->coerceformat);
+    _fingerprintString(ctx, "coerceformat");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->elemfuncid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->elemfuncid);
+    _fingerprintString(ctx, "elemfuncid");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->isExplicit) {    _fingerprintString(ctx, "isExplicit");
+    _fingerprintString(ctx, "true");
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->resultcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resultcollid);
+    _fingerprintString(ctx, "resultcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->resulttype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resulttype);
+    _fingerprintString(ctx, "resulttype");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->resulttypmod != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resulttypmod);
+    _fingerprintString(ctx, "resulttypmod");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintConvertRowtypeExpr(FingerprintContext *ctx, const ConvertRowtypeExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ConvertRowtypeExpr");
+  if (node->arg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg, node, "arg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg");
+  }
+  if (node->convertformat != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->convertformat);
+    _fingerprintString(ctx, "convertformat");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->resulttype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resulttype);
+    _fingerprintString(ctx, "resulttype");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintCollateExpr(FingerprintContext *ctx, const CollateExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CollateExpr");
+  if (node->arg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg, node, "arg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg");
+  }
+  if (node->collOid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->collOid);
+    _fingerprintString(ctx, "collOid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+}
+
+static void
+_fingerprintCaseExpr(FingerprintContext *ctx, const CaseExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CaseExpr");
+  if (node->arg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg, node, "arg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg");
+  }
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  if (node->casecollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->casecollid);
+    _fingerprintString(ctx, "casecollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->casetype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->casetype);
+    _fingerprintString(ctx, "casetype");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->defresult != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->defresult, node, "defresult", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "defresult");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+}
+
+static void
+_fingerprintCaseWhen(FingerprintContext *ctx, const CaseWhen *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CaseWhen");
+  if (node->expr != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->expr, node, "expr", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "expr");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->result != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->result, node, "result", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "result");
+  }
+}
+
+static void
+_fingerprintCaseTestExpr(FingerprintContext *ctx, const CaseTestExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CaseTestExpr");
+  if (node->collation != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->collation);
+    _fingerprintString(ctx, "collation");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->typeId != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->typeId);
+    _fingerprintString(ctx, "typeId");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->typeMod != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->typeMod);
+    _fingerprintString(ctx, "typeMod");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintArrayExpr(FingerprintContext *ctx, const ArrayExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ArrayExpr");
+  if (node->array_collid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->array_collid);
+    _fingerprintString(ctx, "array_collid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->array_typeid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->array_typeid);
+    _fingerprintString(ctx, "array_typeid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->element_typeid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->element_typeid);
+    _fingerprintString(ctx, "element_typeid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->elements != NULL && node->elements->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->elements, node, "elements", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "elements");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+
+  if (node->multidims) {    _fingerprintString(ctx, "multidims");
+    _fingerprintString(ctx, "true");
+  }
+
+}
+
+static void
+_fingerprintRowExpr(FingerprintContext *ctx, const RowExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "RowExpr");
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  if (node->colnames != NULL && node->colnames->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->colnames, node, "colnames", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "colnames");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->row_format != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->row_format);
+    _fingerprintString(ctx, "row_format");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->row_typeid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->row_typeid);
+    _fingerprintString(ctx, "row_typeid");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintRowCompareExpr(FingerprintContext *ctx, const RowCompareExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "RowCompareExpr");
+  if (node->inputcollids != NULL && node->inputcollids->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->inputcollids, node, "inputcollids", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "inputcollids");
+  }
+  if (node->largs != NULL && node->largs->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->largs, node, "largs", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "largs");
+  }
+  if (node->opfamilies != NULL && node->opfamilies->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->opfamilies, node, "opfamilies", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "opfamilies");
+  }
+  if (node->opnos != NULL && node->opnos->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->opnos, node, "opnos", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "opnos");
+  }
+  if (node->rargs != NULL && node->rargs->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->rargs, node, "rargs", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "rargs");
+  }
+  if (node->rctype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->rctype);
+    _fingerprintString(ctx, "rctype");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintCoalesceExpr(FingerprintContext *ctx, const CoalesceExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CoalesceExpr");
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  if (node->coalescecollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->coalescecollid);
+    _fingerprintString(ctx, "coalescecollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->coalescetype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->coalescetype);
+    _fingerprintString(ctx, "coalescetype");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+}
+
+static void
+_fingerprintMinMaxExpr(FingerprintContext *ctx, const MinMaxExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "MinMaxExpr");
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  if (node->inputcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->inputcollid);
+    _fingerprintString(ctx, "inputcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->minmaxcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->minmaxcollid);
+    _fingerprintString(ctx, "minmaxcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->minmaxtype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->minmaxtype);
+    _fingerprintString(ctx, "minmaxtype");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->op != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->op);
+    _fingerprintString(ctx, "op");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintXmlExpr(FingerprintContext *ctx, const XmlExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "XmlExpr");
+  if (node->arg_names != NULL && node->arg_names->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg_names, node, "arg_names", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg_names");
+  }
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+
+  if (node->name != NULL) {
+    _fingerprintString(ctx, "name");
+    _fingerprintString(ctx, node->name);
+  }
+
+  if (node->named_args != NULL && node->named_args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->named_args, node, "named_args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "named_args");
+  }
+  if (node->op != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->op);
+    _fingerprintString(ctx, "op");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->type != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->type);
+    _fingerprintString(ctx, "type");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->typmod != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->typmod);
+    _fingerprintString(ctx, "typmod");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->xmloption != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->xmloption);
+    _fingerprintString(ctx, "xmloption");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintNullTest(FingerprintContext *ctx, const NullTest *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "NullTest");
+  if (node->arg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg, node, "arg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg");
+  }
+
+  if (node->argisrow) {    _fingerprintString(ctx, "argisrow");
+    _fingerprintString(ctx, "true");
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->nulltesttype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->nulltesttype);
+    _fingerprintString(ctx, "nulltesttype");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintBooleanTest(FingerprintContext *ctx, const BooleanTest *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "BooleanTest");
+  if (node->arg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg, node, "arg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg");
+  }
+  if (node->booltesttype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->booltesttype);
+    _fingerprintString(ctx, "booltesttype");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+}
+
+static void
+_fingerprintCoerceToDomain(FingerprintContext *ctx, const CoerceToDomain *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CoerceToDomain");
+  if (node->arg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg, node, "arg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg");
+  }
+  if (node->coercionformat != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->coercionformat);
+    _fingerprintString(ctx, "coercionformat");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->resultcollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resultcollid);
+    _fingerprintString(ctx, "resultcollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->resulttype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resulttype);
+    _fingerprintString(ctx, "resulttype");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->resulttypmod != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resulttypmod);
+    _fingerprintString(ctx, "resulttypmod");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintCoerceToDomainValue(FingerprintContext *ctx, const CoerceToDomainValue *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CoerceToDomainValue");
+  if (node->collation != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->collation);
+    _fingerprintString(ctx, "collation");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->typeId != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->typeId);
+    _fingerprintString(ctx, "typeId");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->typeMod != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->typeMod);
+    _fingerprintString(ctx, "typeMod");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintSetToDefault(FingerprintContext *ctx, const SetToDefault *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  // Intentionally ignoring all fields for fingerprinting
+}
+
+static void
+_fingerprintCurrentOfExpr(FingerprintContext *ctx, const CurrentOfExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CurrentOfExpr");
+
+  if (node->cursor_name != NULL) {
+    _fingerprintString(ctx, "cursor_name");
+    _fingerprintString(ctx, node->cursor_name);
+  }
+
+  if (node->cursor_param != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->cursor_param);
+    _fingerprintString(ctx, "cursor_param");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->cvarno != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->cvarno);
+    _fingerprintString(ctx, "cvarno");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintInferenceElem(FingerprintContext *ctx, const InferenceElem *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "InferenceElem");
+  if (node->expr != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->expr, node, "expr", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "expr");
+  }
+  if (node->infercollid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->infercollid);
+    _fingerprintString(ctx, "infercollid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->inferopclass != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->inferopclass);
+    _fingerprintString(ctx, "inferopclass");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintTargetEntry(FingerprintContext *ctx, const TargetEntry *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "TargetEntry");
+  if (node->expr != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->expr, node, "expr", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "expr");
+  }
+
+  if (node->resjunk) {    _fingerprintString(ctx, "resjunk");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->resname != NULL) {
+    _fingerprintString(ctx, "resname");
+    _fingerprintString(ctx, node->resname);
+  }
+
+  if (node->resno != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resno);
+    _fingerprintString(ctx, "resno");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->resorigcol != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resorigcol);
+    _fingerprintString(ctx, "resorigcol");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->resorigtbl != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resorigtbl);
+    _fingerprintString(ctx, "resorigtbl");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->ressortgroupref != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->ressortgroupref);
+    _fingerprintString(ctx, "ressortgroupref");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintRangeTblRef(FingerprintContext *ctx, const RangeTblRef *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "RangeTblRef");
+  if (node->rtindex != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->rtindex);
+    _fingerprintString(ctx, "rtindex");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintJoinExpr(FingerprintContext *ctx, const JoinExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "JoinExpr");
+  if (node->alias != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->alias, node, "alias", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "alias");
+  }
+
+  if (node->isNatural) {    _fingerprintString(ctx, "isNatural");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->jointype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->jointype);
+    _fingerprintString(ctx, "jointype");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->larg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->larg, node, "larg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "larg");
+  }
+  if (node->quals != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->quals, node, "quals", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "quals");
+  }
+  if (node->rarg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->rarg, node, "rarg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "rarg");
+  }
+  if (node->rtindex != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->rtindex);
+    _fingerprintString(ctx, "rtindex");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->usingClause != NULL && node->usingClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->usingClause, node, "usingClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "usingClause");
+  }
+}
+
+static void
+_fingerprintFromExpr(FingerprintContext *ctx, const FromExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "FromExpr");
+  if (node->fromlist != NULL && node->fromlist->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->fromlist, node, "fromlist", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "fromlist");
+  }
+  if (node->quals != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->quals, node, "quals", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "quals");
+  }
+}
+
+static void
+_fingerprintOnConflictExpr(FingerprintContext *ctx, const OnConflictExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "OnConflictExpr");
+  if (node->action != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->action);
+    _fingerprintString(ctx, "action");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->arbiterElems != NULL && node->arbiterElems->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arbiterElems, node, "arbiterElems", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arbiterElems");
+  }
+  if (node->arbiterWhere != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arbiterWhere, node, "arbiterWhere", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arbiterWhere");
+  }
+  if (node->constraint != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->constraint);
+    _fingerprintString(ctx, "constraint");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->exclRelIndex != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->exclRelIndex);
+    _fingerprintString(ctx, "exclRelIndex");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->exclRelTlist != NULL && node->exclRelTlist->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->exclRelTlist, node, "exclRelTlist", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "exclRelTlist");
+  }
+  if (node->onConflictSet != NULL && node->onConflictSet->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->onConflictSet, node, "onConflictSet", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "onConflictSet");
+  }
+  if (node->onConflictWhere != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->onConflictWhere, node, "onConflictWhere", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "onConflictWhere");
+  }
+}
+
+static void
+_fingerprintIntoClause(FingerprintContext *ctx, const IntoClause *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "IntoClause");
+  if (node->colNames != NULL && node->colNames->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->colNames, node, "colNames", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "colNames");
+  }
+  if (node->onCommit != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->onCommit);
+    _fingerprintString(ctx, "onCommit");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+  if (node->rel != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->rel, node, "rel", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "rel");
+  }
+
+  if (node->skipData) {    _fingerprintString(ctx, "skipData");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->tableSpaceName != NULL) {
+    _fingerprintString(ctx, "tableSpaceName");
+    _fingerprintString(ctx, node->tableSpaceName);
+  }
+
+  if (node->viewQuery != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->viewQuery, node, "viewQuery", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "viewQuery");
+  }
+}
+
+static void
+_fingerprintQuery(FingerprintContext *ctx, const Query *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "Query");
+
+  if (node->canSetTag) {    _fingerprintString(ctx, "canSetTag");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->commandType != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->commandType);
+    _fingerprintString(ctx, "commandType");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->constraintDeps != NULL && node->constraintDeps->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->constraintDeps, node, "constraintDeps", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "constraintDeps");
+  }
+  if (node->cteList != NULL && node->cteList->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->cteList, node, "cteList", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "cteList");
+  }
+  if (node->distinctClause != NULL && node->distinctClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->distinctClause, node, "distinctClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "distinctClause");
+  }
+  if (node->groupClause != NULL && node->groupClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->groupClause, node, "groupClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "groupClause");
+  }
+  if (node->groupingSets != NULL && node->groupingSets->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->groupingSets, node, "groupingSets", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "groupingSets");
+  }
+
+  if (node->hasAggs) {    _fingerprintString(ctx, "hasAggs");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->hasDistinctOn) {    _fingerprintString(ctx, "hasDistinctOn");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->hasForUpdate) {    _fingerprintString(ctx, "hasForUpdate");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->hasModifyingCTE) {    _fingerprintString(ctx, "hasModifyingCTE");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->hasRecursive) {    _fingerprintString(ctx, "hasRecursive");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->hasRowSecurity) {    _fingerprintString(ctx, "hasRowSecurity");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->hasSubLinks) {    _fingerprintString(ctx, "hasSubLinks");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->hasWindowFuncs) {    _fingerprintString(ctx, "hasWindowFuncs");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->havingQual != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->havingQual, node, "havingQual", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "havingQual");
+  }
+  if (node->jointree != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->jointree, node, "jointree", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "jointree");
+  }
+  if (node->limitCount != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->limitCount, node, "limitCount", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "limitCount");
+  }
+  if (node->limitOffset != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->limitOffset, node, "limitOffset", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "limitOffset");
+  }
+  if (node->onConflict != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->onConflict, node, "onConflict", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "onConflict");
+  }
+  if (node->queryId != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->queryId);
+    _fingerprintString(ctx, "queryId");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->querySource != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->querySource);
+    _fingerprintString(ctx, "querySource");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->resultRelation != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->resultRelation);
+    _fingerprintString(ctx, "resultRelation");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->returningList != NULL && node->returningList->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->returningList, node, "returningList", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "returningList");
+  }
+  if (node->rowMarks != NULL && node->rowMarks->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->rowMarks, node, "rowMarks", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "rowMarks");
+  }
+  if (node->rtable != NULL && node->rtable->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->rtable, node, "rtable", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "rtable");
+  }
+  if (node->setOperations != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->setOperations, node, "setOperations", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "setOperations");
+  }
+  if (node->sortClause != NULL && node->sortClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->sortClause, node, "sortClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "sortClause");
+  }
+  if (node->targetList != NULL && node->targetList->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->targetList, node, "targetList", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "targetList");
+  }
+  if (node->utilityStmt != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->utilityStmt, node, "utilityStmt", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "utilityStmt");
+  }
+  if (node->windowClause != NULL && node->windowClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->windowClause, node, "windowClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "windowClause");
+  }
+  if (node->withCheckOptions != NULL && node->withCheckOptions->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->withCheckOptions, node, "withCheckOptions", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "withCheckOptions");
+  }
+}
+
+static void
+_fingerprintInsertStmt(FingerprintContext *ctx, const InsertStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "InsertStmt");
+  if (node->cols != NULL && node->cols->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->cols, node, "cols", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "cols");
+  }
+  if (node->onConflictClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->onConflictClause, node, "onConflictClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "onConflictClause");
+  }
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+  if (node->returningList != NULL && node->returningList->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->returningList, node, "returningList", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "returningList");
+  }
+  if (node->selectStmt != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->selectStmt, node, "selectStmt", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "selectStmt");
+  }
+  if (node->withClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->withClause, node, "withClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "withClause");
+  }
+}
+
+static void
+_fingerprintDeleteStmt(FingerprintContext *ctx, const DeleteStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "DeleteStmt");
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+  if (node->returningList != NULL && node->returningList->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->returningList, node, "returningList", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "returningList");
+  }
+  if (node->usingClause != NULL && node->usingClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->usingClause, node, "usingClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "usingClause");
+  }
+  if (node->whereClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->whereClause, node, "whereClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "whereClause");
+  }
+  if (node->withClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->withClause, node, "withClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "withClause");
+  }
+}
+
+static void
+_fingerprintUpdateStmt(FingerprintContext *ctx, const UpdateStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "UpdateStmt");
+  if (node->fromClause != NULL && node->fromClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->fromClause, node, "fromClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "fromClause");
+  }
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+  if (node->returningList != NULL && node->returningList->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->returningList, node, "returningList", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "returningList");
+  }
+  if (node->targetList != NULL && node->targetList->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->targetList, node, "targetList", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "targetList");
+  }
+  if (node->whereClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->whereClause, node, "whereClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "whereClause");
+  }
+  if (node->withClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->withClause, node, "withClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "withClause");
+  }
+}
+
+static void
+_fingerprintSelectStmt(FingerprintContext *ctx, const SelectStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "SelectStmt");
+
+  if (node->all) {    _fingerprintString(ctx, "all");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->distinctClause != NULL && node->distinctClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->distinctClause, node, "distinctClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "distinctClause");
+  }
+  if (node->fromClause != NULL && node->fromClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->fromClause, node, "fromClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "fromClause");
+  }
+  if (node->groupClause != NULL && node->groupClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->groupClause, node, "groupClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "groupClause");
+  }
+  if (node->havingClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->havingClause, node, "havingClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "havingClause");
+  }
+  if (node->intoClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->intoClause, node, "intoClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "intoClause");
+  }
+  if (node->larg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->larg, node, "larg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "larg");
+  }
+  if (node->limitCount != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->limitCount, node, "limitCount", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "limitCount");
+  }
+  if (node->limitOffset != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->limitOffset, node, "limitOffset", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "limitOffset");
+  }
+  if (node->lockingClause != NULL && node->lockingClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->lockingClause, node, "lockingClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "lockingClause");
+  }
+  if (node->op != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->op);
+    _fingerprintString(ctx, "op");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->rarg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->rarg, node, "rarg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "rarg");
+  }
+  if (node->sortClause != NULL && node->sortClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->sortClause, node, "sortClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "sortClause");
+  }
+  if (node->targetList != NULL && node->targetList->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->targetList, node, "targetList", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "targetList");
+  }
+  if (node->valuesLists != NULL && node->valuesLists->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->valuesLists, node, "valuesLists", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "valuesLists");
+  }
+  if (node->whereClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->whereClause, node, "whereClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "whereClause");
+  }
+  if (node->windowClause != NULL && node->windowClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->windowClause, node, "windowClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "windowClause");
+  }
+  if (node->withClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->withClause, node, "withClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "withClause");
+  }
+}
+
+static void
+_fingerprintAlterTableStmt(FingerprintContext *ctx, const AlterTableStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterTableStmt");
+  if (node->cmds != NULL && node->cmds->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->cmds, node, "cmds", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "cmds");
+  }
+
+  if (node->missing_ok) {    _fingerprintString(ctx, "missing_ok");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+  if (node->relkind != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->relkind);
+    _fingerprintString(ctx, "relkind");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintAlterTableCmd(FingerprintContext *ctx, const AlterTableCmd *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterTableCmd");
+  if (node->behavior != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->behavior);
+    _fingerprintString(ctx, "behavior");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->def != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->def, node, "def", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "def");
+  }
+
+  if (node->missing_ok) {    _fingerprintString(ctx, "missing_ok");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->name != NULL) {
+    _fingerprintString(ctx, "name");
+    _fingerprintString(ctx, node->name);
+  }
+
+  if (node->newowner != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->newowner, node, "newowner", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "newowner");
+  }
+  if (node->subtype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->subtype);
+    _fingerprintString(ctx, "subtype");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintAlterDomainStmt(FingerprintContext *ctx, const AlterDomainStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterDomainStmt");
+  if (node->behavior != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->behavior);
+    _fingerprintString(ctx, "behavior");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->def != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->def, node, "def", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "def");
+  }
+
+  if (node->missing_ok) {    _fingerprintString(ctx, "missing_ok");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->name != NULL) {
+    _fingerprintString(ctx, "name");
+    _fingerprintString(ctx, node->name);
+  }
+
+  if (node->subtype != 0) {
+    char str[2] = {node->subtype, '\0'};
+    _fingerprintString(ctx, "subtype");
+    _fingerprintString(ctx, str);
+  }
+
+  if (node->typeName != NULL && node->typeName->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->typeName, node, "typeName", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "typeName");
+  }
+}
+
+static void
+_fingerprintSetOperationStmt(FingerprintContext *ctx, const SetOperationStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "SetOperationStmt");
+
+  if (node->all) {    _fingerprintString(ctx, "all");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->colCollations != NULL && node->colCollations->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->colCollations, node, "colCollations", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "colCollations");
+  }
+  if (node->colTypes != NULL && node->colTypes->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->colTypes, node, "colTypes", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "colTypes");
+  }
+  if (node->colTypmods != NULL && node->colTypmods->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->colTypmods, node, "colTypmods", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "colTypmods");
+  }
+  if (node->groupClauses != NULL && node->groupClauses->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->groupClauses, node, "groupClauses", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "groupClauses");
+  }
+  if (node->larg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->larg, node, "larg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "larg");
+  }
+  if (node->op != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->op);
+    _fingerprintString(ctx, "op");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->rarg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->rarg, node, "rarg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "rarg");
+  }
+}
+
+static void
+_fingerprintGrantStmt(FingerprintContext *ctx, const GrantStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "GrantStmt");
+  if (node->behavior != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->behavior);
+    _fingerprintString(ctx, "behavior");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->grant_option) {    _fingerprintString(ctx, "grant_option");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->grantees != NULL && node->grantees->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->grantees, node, "grantees", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "grantees");
+  }
+
+  if (node->is_grant) {    _fingerprintString(ctx, "is_grant");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->objects != NULL && node->objects->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->objects, node, "objects", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "objects");
+  }
+  if (node->objtype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->objtype);
+    _fingerprintString(ctx, "objtype");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->privileges != NULL && node->privileges->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->privileges, node, "privileges", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "privileges");
+  }
+  if (node->targtype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->targtype);
+    _fingerprintString(ctx, "targtype");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintGrantRoleStmt(FingerprintContext *ctx, const GrantRoleStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "GrantRoleStmt");
+
+  if (node->admin_opt) {    _fingerprintString(ctx, "admin_opt");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->behavior != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->behavior);
+    _fingerprintString(ctx, "behavior");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->granted_roles != NULL && node->granted_roles->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->granted_roles, node, "granted_roles", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "granted_roles");
+  }
+  if (node->grantee_roles != NULL && node->grantee_roles->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->grantee_roles, node, "grantee_roles", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "grantee_roles");
+  }
+  if (node->grantor != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->grantor, node, "grantor", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "grantor");
+  }
+
+  if (node->is_grant) {    _fingerprintString(ctx, "is_grant");
+    _fingerprintString(ctx, "true");
+  }
+
+}
+
+static void
+_fingerprintAlterDefaultPrivilegesStmt(FingerprintContext *ctx, const AlterDefaultPrivilegesStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterDefaultPrivilegesStmt");
+  if (node->action != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->action, node, "action", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "action");
+  }
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+}
+
+static void
+_fingerprintClosePortalStmt(FingerprintContext *ctx, const ClosePortalStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ClosePortalStmt");
+
+  if (node->portalname != NULL) {
+    _fingerprintString(ctx, "portalname");
+    _fingerprintString(ctx, node->portalname);
+  }
+
+}
+
+static void
+_fingerprintClusterStmt(FingerprintContext *ctx, const ClusterStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ClusterStmt");
+
+  if (node->indexname != NULL) {
+    _fingerprintString(ctx, "indexname");
+    _fingerprintString(ctx, node->indexname);
+  }
+
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+
+  if (node->verbose) {    _fingerprintString(ctx, "verbose");
+    _fingerprintString(ctx, "true");
+  }
+
+}
+
+static void
+_fingerprintCopyStmt(FingerprintContext *ctx, const CopyStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CopyStmt");
+  if (node->attlist != NULL && node->attlist->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->attlist, node, "attlist", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "attlist");
+  }
+
+  if (node->filename != NULL) {
+    _fingerprintString(ctx, "filename");
+    _fingerprintString(ctx, node->filename);
+  }
+
+
+  if (node->is_from) {    _fingerprintString(ctx, "is_from");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->is_program) {    _fingerprintString(ctx, "is_program");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+  if (node->query != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->query, node, "query", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "query");
+  }
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+}
+
+static void
+_fingerprintCreateStmt(FingerprintContext *ctx, const CreateStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateStmt");
+  if (node->constraints != NULL && node->constraints->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->constraints, node, "constraints", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "constraints");
+  }
+
+  if (node->if_not_exists) {    _fingerprintString(ctx, "if_not_exists");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->inhRelations != NULL && node->inhRelations->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->inhRelations, node, "inhRelations", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "inhRelations");
+  }
+  if (node->ofTypename != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->ofTypename, node, "ofTypename", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "ofTypename");
+  }
+  if (node->oncommit != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->oncommit);
+    _fingerprintString(ctx, "oncommit");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+  if (node->tableElts != NULL && node->tableElts->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->tableElts, node, "tableElts", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "tableElts");
+  }
+
+  if (node->tablespacename != NULL) {
+    _fingerprintString(ctx, "tablespacename");
+    _fingerprintString(ctx, node->tablespacename);
+  }
+
+}
+
+static void
+_fingerprintDefineStmt(FingerprintContext *ctx, const DefineStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "DefineStmt");
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  if (node->definition != NULL && node->definition->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->definition, node, "definition", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "definition");
+  }
+  if (node->defnames != NULL && node->defnames->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->defnames, node, "defnames", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "defnames");
+  }
+  if (node->kind != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->kind);
+    _fingerprintString(ctx, "kind");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->oldstyle) {    _fingerprintString(ctx, "oldstyle");
+    _fingerprintString(ctx, "true");
+  }
+
+}
+
+static void
+_fingerprintDropStmt(FingerprintContext *ctx, const DropStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "DropStmt");
+  if (node->arguments != NULL && node->arguments->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arguments, node, "arguments", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arguments");
+  }
+  if (node->behavior != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->behavior);
+    _fingerprintString(ctx, "behavior");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->concurrent) {    _fingerprintString(ctx, "concurrent");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->missing_ok) {    _fingerprintString(ctx, "missing_ok");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->objects != NULL && node->objects->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->objects, node, "objects", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "objects");
+  }
+  if (node->removeType != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->removeType);
+    _fingerprintString(ctx, "removeType");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintTruncateStmt(FingerprintContext *ctx, const TruncateStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "TruncateStmt");
+  if (node->behavior != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->behavior);
+    _fingerprintString(ctx, "behavior");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->relations != NULL && node->relations->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relations, node, "relations", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relations");
+  }
+
+  if (node->restart_seqs) {    _fingerprintString(ctx, "restart_seqs");
+    _fingerprintString(ctx, "true");
+  }
+
+}
+
+static void
+_fingerprintCommentStmt(FingerprintContext *ctx, const CommentStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CommentStmt");
+
+  if (node->comment != NULL) {
+    _fingerprintString(ctx, "comment");
+    _fingerprintString(ctx, node->comment);
+  }
+
+  if (node->objargs != NULL && node->objargs->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->objargs, node, "objargs", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "objargs");
+  }
+  if (node->objname != NULL && node->objname->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->objname, node, "objname", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "objname");
+  }
+  if (node->objtype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->objtype);
+    _fingerprintString(ctx, "objtype");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintFetchStmt(FingerprintContext *ctx, const FetchStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "FetchStmt");
+  if (node->direction != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->direction);
+    _fingerprintString(ctx, "direction");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->howMany != 0) {
+    char buffer[50];
+    sprintf(buffer, "%ld", node->howMany);
+    _fingerprintString(ctx, "howMany");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->ismove) {    _fingerprintString(ctx, "ismove");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->portalname != NULL) {
+    _fingerprintString(ctx, "portalname");
+    _fingerprintString(ctx, node->portalname);
+  }
+
+}
+
+static void
+_fingerprintIndexStmt(FingerprintContext *ctx, const IndexStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "IndexStmt");
+
+  if (node->accessMethod != NULL) {
+    _fingerprintString(ctx, "accessMethod");
+    _fingerprintString(ctx, node->accessMethod);
+  }
+
+
+  if (node->concurrent) {    _fingerprintString(ctx, "concurrent");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->deferrable) {    _fingerprintString(ctx, "deferrable");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->excludeOpNames != NULL && node->excludeOpNames->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->excludeOpNames, node, "excludeOpNames", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "excludeOpNames");
+  }
+
+  if (node->idxcomment != NULL) {
+    _fingerprintString(ctx, "idxcomment");
+    _fingerprintString(ctx, node->idxcomment);
+  }
+
+
+  if (node->idxname != NULL) {
+    _fingerprintString(ctx, "idxname");
+    _fingerprintString(ctx, node->idxname);
+  }
+
+
+  if (node->if_not_exists) {    _fingerprintString(ctx, "if_not_exists");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->indexOid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->indexOid);
+    _fingerprintString(ctx, "indexOid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->indexParams != NULL && node->indexParams->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->indexParams, node, "indexParams", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "indexParams");
+  }
+
+  if (node->initdeferred) {    _fingerprintString(ctx, "initdeferred");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->isconstraint) {    _fingerprintString(ctx, "isconstraint");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->oldNode != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->oldNode);
+    _fingerprintString(ctx, "oldNode");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+
+  if (node->primary) {    _fingerprintString(ctx, "primary");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+
+  if (node->tableSpace != NULL) {
+    _fingerprintString(ctx, "tableSpace");
+    _fingerprintString(ctx, node->tableSpace);
+  }
+
+
+  if (node->transformed) {    _fingerprintString(ctx, "transformed");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->unique) {    _fingerprintString(ctx, "unique");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->whereClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->whereClause, node, "whereClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "whereClause");
+  }
+}
+
+static void
+_fingerprintCreateFunctionStmt(FingerprintContext *ctx, const CreateFunctionStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateFunctionStmt");
+  if (node->funcname != NULL && node->funcname->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->funcname, node, "funcname", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "funcname");
+  }
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+  if (node->parameters != NULL && node->parameters->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->parameters, node, "parameters", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "parameters");
+  }
+
+  if (node->replace) {    _fingerprintString(ctx, "replace");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->returnType != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->returnType, node, "returnType", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "returnType");
+  }
+  if (node->withClause != NULL && node->withClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->withClause, node, "withClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "withClause");
+  }
+}
+
+static void
+_fingerprintAlterFunctionStmt(FingerprintContext *ctx, const AlterFunctionStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterFunctionStmt");
+  if (node->actions != NULL && node->actions->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->actions, node, "actions", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "actions");
+  }
+  if (node->func != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->func, node, "func", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "func");
+  }
+}
+
+static void
+_fingerprintDoStmt(FingerprintContext *ctx, const DoStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "DoStmt");
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+}
+
+static void
+_fingerprintRenameStmt(FingerprintContext *ctx, const RenameStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "RenameStmt");
+  if (node->behavior != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->behavior);
+    _fingerprintString(ctx, "behavior");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->missing_ok) {    _fingerprintString(ctx, "missing_ok");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->newname != NULL) {
+    _fingerprintString(ctx, "newname");
+    _fingerprintString(ctx, node->newname);
+  }
+
+  if (node->objarg != NULL && node->objarg->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->objarg, node, "objarg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "objarg");
+  }
+  if (node->object != NULL && node->object->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->object, node, "object", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "object");
+  }
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+  if (node->relationType != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->relationType);
+    _fingerprintString(ctx, "relationType");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->renameType != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->renameType);
+    _fingerprintString(ctx, "renameType");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->subname != NULL) {
+    _fingerprintString(ctx, "subname");
+    _fingerprintString(ctx, node->subname);
+  }
+
+}
+
+static void
+_fingerprintRuleStmt(FingerprintContext *ctx, const RuleStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "RuleStmt");
+  if (node->actions != NULL && node->actions->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->actions, node, "actions", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "actions");
+  }
+  if (node->event != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->event);
+    _fingerprintString(ctx, "event");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->instead) {    _fingerprintString(ctx, "instead");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+
+  if (node->replace) {    _fingerprintString(ctx, "replace");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->rulename != NULL) {
+    _fingerprintString(ctx, "rulename");
+    _fingerprintString(ctx, node->rulename);
+  }
+
+  if (node->whereClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->whereClause, node, "whereClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "whereClause");
+  }
+}
+
+static void
+_fingerprintNotifyStmt(FingerprintContext *ctx, const NotifyStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "NotifyStmt");
+
+  if (node->conditionname != NULL) {
+    _fingerprintString(ctx, "conditionname");
+    _fingerprintString(ctx, node->conditionname);
+  }
+
+
+  if (node->payload != NULL) {
+    _fingerprintString(ctx, "payload");
+    _fingerprintString(ctx, node->payload);
+  }
+
+}
+
+static void
+_fingerprintListenStmt(FingerprintContext *ctx, const ListenStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ListenStmt");
+
+  if (node->conditionname != NULL) {
+    _fingerprintString(ctx, "conditionname");
+    _fingerprintString(ctx, node->conditionname);
+  }
+
+}
+
+static void
+_fingerprintUnlistenStmt(FingerprintContext *ctx, const UnlistenStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "UnlistenStmt");
+
+  if (node->conditionname != NULL) {
+    _fingerprintString(ctx, "conditionname");
+    _fingerprintString(ctx, node->conditionname);
+  }
+
+}
+
+static void
+_fingerprintTransactionStmt(FingerprintContext *ctx, const TransactionStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "TransactionStmt");
+  // Intentionally ignoring node->gid for fingerprinting
+  if (node->kind != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->kind);
+    _fingerprintString(ctx, "kind");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->options for fingerprinting
+}
+
+static void
+_fingerprintViewStmt(FingerprintContext *ctx, const ViewStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ViewStmt");
+  if (node->aliases != NULL && node->aliases->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->aliases, node, "aliases", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "aliases");
+  }
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+  if (node->query != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->query, node, "query", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "query");
+  }
+
+  if (node->replace) {    _fingerprintString(ctx, "replace");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->view != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->view, node, "view", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "view");
+  }
+  if (node->withCheckOption != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->withCheckOption);
+    _fingerprintString(ctx, "withCheckOption");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintLoadStmt(FingerprintContext *ctx, const LoadStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "LoadStmt");
+
+  if (node->filename != NULL) {
+    _fingerprintString(ctx, "filename");
+    _fingerprintString(ctx, node->filename);
+  }
+
+}
+
+static void
+_fingerprintCreateDomainStmt(FingerprintContext *ctx, const CreateDomainStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateDomainStmt");
+  if (node->collClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->collClause, node, "collClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "collClause");
+  }
+  if (node->constraints != NULL && node->constraints->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->constraints, node, "constraints", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "constraints");
+  }
+  if (node->domainname != NULL && node->domainname->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->domainname, node, "domainname", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "domainname");
+  }
+  if (node->typeName != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->typeName, node, "typeName", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "typeName");
+  }
+}
+
+static void
+_fingerprintCreatedbStmt(FingerprintContext *ctx, const CreatedbStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreatedbStmt");
+
+  if (node->dbname != NULL) {
+    _fingerprintString(ctx, "dbname");
+    _fingerprintString(ctx, node->dbname);
+  }
+
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+}
+
+static void
+_fingerprintDropdbStmt(FingerprintContext *ctx, const DropdbStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "DropdbStmt");
+
+  if (node->dbname != NULL) {
+    _fingerprintString(ctx, "dbname");
+    _fingerprintString(ctx, node->dbname);
+  }
+
+
+  if (node->missing_ok) {    _fingerprintString(ctx, "missing_ok");
+    _fingerprintString(ctx, "true");
+  }
+
+}
+
+static void
+_fingerprintVacuumStmt(FingerprintContext *ctx, const VacuumStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "VacuumStmt");
+  if (node->options != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->options);
+    _fingerprintString(ctx, "options");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+  if (node->va_cols != NULL && node->va_cols->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->va_cols, node, "va_cols", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "va_cols");
+  }
+}
+
+static void
+_fingerprintExplainStmt(FingerprintContext *ctx, const ExplainStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ExplainStmt");
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+  if (node->query != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->query, node, "query", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "query");
+  }
+}
+
+static void
+_fingerprintCreateTableAsStmt(FingerprintContext *ctx, const CreateTableAsStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateTableAsStmt");
+
+  if (node->if_not_exists) {    _fingerprintString(ctx, "if_not_exists");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->into != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->into, node, "into", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "into");
+  }
+
+  if (node->is_select_into) {    _fingerprintString(ctx, "is_select_into");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->query != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->query, node, "query", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "query");
+  }
+  if (node->relkind != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->relkind);
+    _fingerprintString(ctx, "relkind");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintCreateSeqStmt(FingerprintContext *ctx, const CreateSeqStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateSeqStmt");
+
+  if (node->if_not_exists) {    _fingerprintString(ctx, "if_not_exists");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+  if (node->ownerId != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->ownerId);
+    _fingerprintString(ctx, "ownerId");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->sequence != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->sequence, node, "sequence", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "sequence");
+  }
+}
+
+static void
+_fingerprintAlterSeqStmt(FingerprintContext *ctx, const AlterSeqStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterSeqStmt");
+
+  if (node->missing_ok) {    _fingerprintString(ctx, "missing_ok");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+  if (node->sequence != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->sequence, node, "sequence", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "sequence");
+  }
+}
+
+static void
+_fingerprintVariableSetStmt(FingerprintContext *ctx, const VariableSetStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "VariableSetStmt");
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+
+  if (node->is_local) {    _fingerprintString(ctx, "is_local");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->kind != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->kind);
+    _fingerprintString(ctx, "kind");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->name != NULL) {
+    _fingerprintString(ctx, "name");
+    _fingerprintString(ctx, node->name);
+  }
+
+}
+
+static void
+_fingerprintVariableShowStmt(FingerprintContext *ctx, const VariableShowStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "VariableShowStmt");
+
+  if (node->name != NULL) {
+    _fingerprintString(ctx, "name");
+    _fingerprintString(ctx, node->name);
+  }
+
+}
+
+static void
+_fingerprintDiscardStmt(FingerprintContext *ctx, const DiscardStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "DiscardStmt");
+  if (node->target != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->target);
+    _fingerprintString(ctx, "target");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintCreateTrigStmt(FingerprintContext *ctx, const CreateTrigStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateTrigStmt");
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  if (node->columns != NULL && node->columns->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->columns, node, "columns", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "columns");
+  }
+  if (node->constrrel != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->constrrel, node, "constrrel", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "constrrel");
+  }
+
+  if (node->deferrable) {    _fingerprintString(ctx, "deferrable");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->events != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->events);
+    _fingerprintString(ctx, "events");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->funcname != NULL && node->funcname->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->funcname, node, "funcname", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "funcname");
+  }
+
+  if (node->initdeferred) {    _fingerprintString(ctx, "initdeferred");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->isconstraint) {    _fingerprintString(ctx, "isconstraint");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+
+  if (node->row) {    _fingerprintString(ctx, "row");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->timing != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->timing);
+    _fingerprintString(ctx, "timing");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->trigname != NULL) {
+    _fingerprintString(ctx, "trigname");
+    _fingerprintString(ctx, node->trigname);
+  }
+
+  if (node->whenClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->whenClause, node, "whenClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "whenClause");
+  }
+}
+
+static void
+_fingerprintCreatePLangStmt(FingerprintContext *ctx, const CreatePLangStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreatePLangStmt");
+  if (node->plhandler != NULL && node->plhandler->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->plhandler, node, "plhandler", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "plhandler");
+  }
+  if (node->plinline != NULL && node->plinline->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->plinline, node, "plinline", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "plinline");
+  }
+
+  if (node->plname != NULL) {
+    _fingerprintString(ctx, "plname");
+    _fingerprintString(ctx, node->plname);
+  }
+
+
+  if (node->pltrusted) {    _fingerprintString(ctx, "pltrusted");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->plvalidator != NULL && node->plvalidator->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->plvalidator, node, "plvalidator", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "plvalidator");
+  }
+
+  if (node->replace) {    _fingerprintString(ctx, "replace");
+    _fingerprintString(ctx, "true");
+  }
+
+}
+
+static void
+_fingerprintCreateRoleStmt(FingerprintContext *ctx, const CreateRoleStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateRoleStmt");
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+
+  if (node->role != NULL) {
+    _fingerprintString(ctx, "role");
+    _fingerprintString(ctx, node->role);
+  }
+
+  if (node->stmt_type != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->stmt_type);
+    _fingerprintString(ctx, "stmt_type");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintAlterRoleStmt(FingerprintContext *ctx, const AlterRoleStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterRoleStmt");
+  if (node->action != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->action);
+    _fingerprintString(ctx, "action");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+  if (node->role != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->role, node, "role", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "role");
+  }
+}
+
+static void
+_fingerprintDropRoleStmt(FingerprintContext *ctx, const DropRoleStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "DropRoleStmt");
+
+  if (node->missing_ok) {    _fingerprintString(ctx, "missing_ok");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->roles != NULL && node->roles->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->roles, node, "roles", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "roles");
+  }
+}
+
+static void
+_fingerprintLockStmt(FingerprintContext *ctx, const LockStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "LockStmt");
+  if (node->mode != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->mode);
+    _fingerprintString(ctx, "mode");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->nowait) {    _fingerprintString(ctx, "nowait");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->relations != NULL && node->relations->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relations, node, "relations", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relations");
+  }
+}
+
+static void
+_fingerprintConstraintsSetStmt(FingerprintContext *ctx, const ConstraintsSetStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ConstraintsSetStmt");
+  if (node->constraints != NULL && node->constraints->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->constraints, node, "constraints", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "constraints");
+  }
+
+  if (node->deferred) {    _fingerprintString(ctx, "deferred");
+    _fingerprintString(ctx, "true");
+  }
+
+}
+
+static void
+_fingerprintReindexStmt(FingerprintContext *ctx, const ReindexStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ReindexStmt");
+  if (node->kind != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->kind);
+    _fingerprintString(ctx, "kind");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->name != NULL) {
+    _fingerprintString(ctx, "name");
+    _fingerprintString(ctx, node->name);
+  }
+
+  if (node->options != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->options);
+    _fingerprintString(ctx, "options");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+}
+
+static void
+_fingerprintCheckPointStmt(FingerprintContext *ctx, const CheckPointStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CheckPointStmt");
+}
+
+static void
+_fingerprintCreateSchemaStmt(FingerprintContext *ctx, const CreateSchemaStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateSchemaStmt");
+  if (node->authrole != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->authrole, node, "authrole", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "authrole");
+  }
+
+  if (node->if_not_exists) {    _fingerprintString(ctx, "if_not_exists");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->schemaElts != NULL && node->schemaElts->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->schemaElts, node, "schemaElts", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "schemaElts");
+  }
+
+  if (node->schemaname != NULL) {
+    _fingerprintString(ctx, "schemaname");
+    _fingerprintString(ctx, node->schemaname);
+  }
+
+}
+
+static void
+_fingerprintAlterDatabaseStmt(FingerprintContext *ctx, const AlterDatabaseStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterDatabaseStmt");
+
+  if (node->dbname != NULL) {
+    _fingerprintString(ctx, "dbname");
+    _fingerprintString(ctx, node->dbname);
+  }
+
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+}
+
+static void
+_fingerprintAlterDatabaseSetStmt(FingerprintContext *ctx, const AlterDatabaseSetStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterDatabaseSetStmt");
+
+  if (node->dbname != NULL) {
+    _fingerprintString(ctx, "dbname");
+    _fingerprintString(ctx, node->dbname);
+  }
+
+  if (node->setstmt != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->setstmt, node, "setstmt", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "setstmt");
+  }
+}
+
+static void
+_fingerprintAlterRoleSetStmt(FingerprintContext *ctx, const AlterRoleSetStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterRoleSetStmt");
+
+  if (node->database != NULL) {
+    _fingerprintString(ctx, "database");
+    _fingerprintString(ctx, node->database);
+  }
+
+  if (node->role != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->role, node, "role", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "role");
+  }
+  if (node->setstmt != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->setstmt, node, "setstmt", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "setstmt");
+  }
+}
+
+static void
+_fingerprintCreateConversionStmt(FingerprintContext *ctx, const CreateConversionStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateConversionStmt");
+  if (node->conversion_name != NULL && node->conversion_name->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->conversion_name, node, "conversion_name", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "conversion_name");
+  }
+
+  if (node->def) {    _fingerprintString(ctx, "def");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->for_encoding_name != NULL) {
+    _fingerprintString(ctx, "for_encoding_name");
+    _fingerprintString(ctx, node->for_encoding_name);
+  }
+
+  if (node->func_name != NULL && node->func_name->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->func_name, node, "func_name", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "func_name");
+  }
+
+  if (node->to_encoding_name != NULL) {
+    _fingerprintString(ctx, "to_encoding_name");
+    _fingerprintString(ctx, node->to_encoding_name);
+  }
+
+}
+
+static void
+_fingerprintCreateCastStmt(FingerprintContext *ctx, const CreateCastStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateCastStmt");
+  if (node->context != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->context);
+    _fingerprintString(ctx, "context");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->func != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->func, node, "func", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "func");
+  }
+
+  if (node->inout) {    _fingerprintString(ctx, "inout");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->sourcetype != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->sourcetype, node, "sourcetype", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "sourcetype");
+  }
+  if (node->targettype != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->targettype, node, "targettype", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "targettype");
+  }
+}
+
+static void
+_fingerprintCreateOpClassStmt(FingerprintContext *ctx, const CreateOpClassStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateOpClassStmt");
+
+  if (node->amname != NULL) {
+    _fingerprintString(ctx, "amname");
+    _fingerprintString(ctx, node->amname);
+  }
+
+  if (node->datatype != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->datatype, node, "datatype", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "datatype");
+  }
+
+  if (node->isDefault) {    _fingerprintString(ctx, "isDefault");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->items != NULL && node->items->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->items, node, "items", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "items");
+  }
+  if (node->opclassname != NULL && node->opclassname->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->opclassname, node, "opclassname", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "opclassname");
+  }
+  if (node->opfamilyname != NULL && node->opfamilyname->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->opfamilyname, node, "opfamilyname", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "opfamilyname");
+  }
+}
+
+static void
+_fingerprintCreateOpFamilyStmt(FingerprintContext *ctx, const CreateOpFamilyStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateOpFamilyStmt");
+
+  if (node->amname != NULL) {
+    _fingerprintString(ctx, "amname");
+    _fingerprintString(ctx, node->amname);
+  }
+
+  if (node->opfamilyname != NULL && node->opfamilyname->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->opfamilyname, node, "opfamilyname", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "opfamilyname");
+  }
+}
+
+static void
+_fingerprintAlterOpFamilyStmt(FingerprintContext *ctx, const AlterOpFamilyStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterOpFamilyStmt");
+
+  if (node->amname != NULL) {
+    _fingerprintString(ctx, "amname");
+    _fingerprintString(ctx, node->amname);
+  }
+
+
+  if (node->isDrop) {    _fingerprintString(ctx, "isDrop");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->items != NULL && node->items->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->items, node, "items", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "items");
+  }
+  if (node->opfamilyname != NULL && node->opfamilyname->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->opfamilyname, node, "opfamilyname", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "opfamilyname");
+  }
+}
+
+static void
+_fingerprintPrepareStmt(FingerprintContext *ctx, const PrepareStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "PrepareStmt");
+  if (node->argtypes != NULL && node->argtypes->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->argtypes, node, "argtypes", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "argtypes");
+  }
+  // Intentionally ignoring node->name for fingerprinting
+  if (node->query != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->query, node, "query", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "query");
+  }
+}
+
+static void
+_fingerprintExecuteStmt(FingerprintContext *ctx, const ExecuteStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ExecuteStmt");
+  // Intentionally ignoring node->name for fingerprinting
+  if (node->params != NULL && node->params->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->params, node, "params", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "params");
+  }
+}
+
+static void
+_fingerprintDeallocateStmt(FingerprintContext *ctx, const DeallocateStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "DeallocateStmt");
+  // Intentionally ignoring node->name for fingerprinting
+}
+
+static void
+_fingerprintDeclareCursorStmt(FingerprintContext *ctx, const DeclareCursorStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "DeclareCursorStmt");
+  if (node->options != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->options);
+    _fingerprintString(ctx, "options");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->portalname != NULL) {
+    _fingerprintString(ctx, "portalname");
+    _fingerprintString(ctx, node->portalname);
+  }
+
+  if (node->query != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->query, node, "query", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "query");
+  }
+}
+
+static void
+_fingerprintCreateTableSpaceStmt(FingerprintContext *ctx, const CreateTableSpaceStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateTableSpaceStmt");
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+  if (node->owner != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->owner, node, "owner", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "owner");
+  }
+
+  if (node->tablespacename != NULL) {
+    _fingerprintString(ctx, "tablespacename");
+    _fingerprintString(ctx, node->tablespacename);
+  }
+
+}
+
+static void
+_fingerprintDropTableSpaceStmt(FingerprintContext *ctx, const DropTableSpaceStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "DropTableSpaceStmt");
+
+  if (node->missing_ok) {    _fingerprintString(ctx, "missing_ok");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->tablespacename != NULL) {
+    _fingerprintString(ctx, "tablespacename");
+    _fingerprintString(ctx, node->tablespacename);
+  }
+
+}
+
+static void
+_fingerprintAlterObjectSchemaStmt(FingerprintContext *ctx, const AlterObjectSchemaStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterObjectSchemaStmt");
+
+  if (node->missing_ok) {    _fingerprintString(ctx, "missing_ok");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->newschema != NULL) {
+    _fingerprintString(ctx, "newschema");
+    _fingerprintString(ctx, node->newschema);
+  }
+
+  if (node->objarg != NULL && node->objarg->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->objarg, node, "objarg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "objarg");
+  }
+  if (node->object != NULL && node->object->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->object, node, "object", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "object");
+  }
+  if (node->objectType != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->objectType);
+    _fingerprintString(ctx, "objectType");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+}
+
+static void
+_fingerprintAlterOwnerStmt(FingerprintContext *ctx, const AlterOwnerStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterOwnerStmt");
+  if (node->newowner != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->newowner, node, "newowner", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "newowner");
+  }
+  if (node->objarg != NULL && node->objarg->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->objarg, node, "objarg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "objarg");
+  }
+  if (node->object != NULL && node->object->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->object, node, "object", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "object");
+  }
+  if (node->objectType != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->objectType);
+    _fingerprintString(ctx, "objectType");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+}
+
+static void
+_fingerprintDropOwnedStmt(FingerprintContext *ctx, const DropOwnedStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "DropOwnedStmt");
+  if (node->behavior != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->behavior);
+    _fingerprintString(ctx, "behavior");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->roles != NULL && node->roles->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->roles, node, "roles", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "roles");
+  }
+}
+
+static void
+_fingerprintReassignOwnedStmt(FingerprintContext *ctx, const ReassignOwnedStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ReassignOwnedStmt");
+  if (node->newrole != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->newrole, node, "newrole", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "newrole");
+  }
+  if (node->roles != NULL && node->roles->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->roles, node, "roles", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "roles");
+  }
+}
+
+static void
+_fingerprintCompositeTypeStmt(FingerprintContext *ctx, const CompositeTypeStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CompositeTypeStmt");
+  if (node->coldeflist != NULL && node->coldeflist->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->coldeflist, node, "coldeflist", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "coldeflist");
+  }
+  if (node->typevar != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->typevar, node, "typevar", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "typevar");
+  }
+}
+
+static void
+_fingerprintCreateEnumStmt(FingerprintContext *ctx, const CreateEnumStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateEnumStmt");
+  if (node->typeName != NULL && node->typeName->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->typeName, node, "typeName", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "typeName");
+  }
+  if (node->vals != NULL && node->vals->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->vals, node, "vals", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "vals");
+  }
+}
+
+static void
+_fingerprintCreateRangeStmt(FingerprintContext *ctx, const CreateRangeStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateRangeStmt");
+  if (node->params != NULL && node->params->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->params, node, "params", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "params");
+  }
+  if (node->typeName != NULL && node->typeName->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->typeName, node, "typeName", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "typeName");
+  }
+}
+
+static void
+_fingerprintAlterEnumStmt(FingerprintContext *ctx, const AlterEnumStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterEnumStmt");
+
+  if (node->newVal != NULL) {
+    _fingerprintString(ctx, "newVal");
+    _fingerprintString(ctx, node->newVal);
+  }
+
+
+  if (node->newValIsAfter) {    _fingerprintString(ctx, "newValIsAfter");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->newValNeighbor != NULL) {
+    _fingerprintString(ctx, "newValNeighbor");
+    _fingerprintString(ctx, node->newValNeighbor);
+  }
+
+
+  if (node->skipIfExists) {    _fingerprintString(ctx, "skipIfExists");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->typeName != NULL && node->typeName->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->typeName, node, "typeName", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "typeName");
+  }
+}
+
+static void
+_fingerprintAlterTSDictionaryStmt(FingerprintContext *ctx, const AlterTSDictionaryStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterTSDictionaryStmt");
+  if (node->dictname != NULL && node->dictname->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->dictname, node, "dictname", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "dictname");
+  }
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+}
+
+static void
+_fingerprintAlterTSConfigurationStmt(FingerprintContext *ctx, const AlterTSConfigurationStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterTSConfigurationStmt");
+  if (node->cfgname != NULL && node->cfgname->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->cfgname, node, "cfgname", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "cfgname");
+  }
+  if (node->dicts != NULL && node->dicts->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->dicts, node, "dicts", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "dicts");
+  }
+  if (node->kind != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->kind);
+    _fingerprintString(ctx, "kind");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->missing_ok) {    _fingerprintString(ctx, "missing_ok");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->override) {    _fingerprintString(ctx, "override");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->replace) {    _fingerprintString(ctx, "replace");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->tokentype != NULL && node->tokentype->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->tokentype, node, "tokentype", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "tokentype");
+  }
+}
+
+static void
+_fingerprintCreateFdwStmt(FingerprintContext *ctx, const CreateFdwStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateFdwStmt");
+
+  if (node->fdwname != NULL) {
+    _fingerprintString(ctx, "fdwname");
+    _fingerprintString(ctx, node->fdwname);
+  }
+
+  if (node->func_options != NULL && node->func_options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->func_options, node, "func_options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "func_options");
+  }
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+}
+
+static void
+_fingerprintAlterFdwStmt(FingerprintContext *ctx, const AlterFdwStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterFdwStmt");
+
+  if (node->fdwname != NULL) {
+    _fingerprintString(ctx, "fdwname");
+    _fingerprintString(ctx, node->fdwname);
+  }
+
+  if (node->func_options != NULL && node->func_options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->func_options, node, "func_options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "func_options");
+  }
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+}
+
+static void
+_fingerprintCreateForeignServerStmt(FingerprintContext *ctx, const CreateForeignServerStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateForeignServerStmt");
+
+  if (node->fdwname != NULL) {
+    _fingerprintString(ctx, "fdwname");
+    _fingerprintString(ctx, node->fdwname);
+  }
+
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+
+  if (node->servername != NULL) {
+    _fingerprintString(ctx, "servername");
+    _fingerprintString(ctx, node->servername);
+  }
+
+
+  if (node->servertype != NULL) {
+    _fingerprintString(ctx, "servertype");
+    _fingerprintString(ctx, node->servertype);
+  }
+
+
+  if (node->version != NULL) {
+    _fingerprintString(ctx, "version");
+    _fingerprintString(ctx, node->version);
+  }
+
+}
+
+static void
+_fingerprintAlterForeignServerStmt(FingerprintContext *ctx, const AlterForeignServerStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterForeignServerStmt");
+
+  if (node->has_version) {    _fingerprintString(ctx, "has_version");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+
+  if (node->servername != NULL) {
+    _fingerprintString(ctx, "servername");
+    _fingerprintString(ctx, node->servername);
+  }
+
+
+  if (node->version != NULL) {
+    _fingerprintString(ctx, "version");
+    _fingerprintString(ctx, node->version);
+  }
+
+}
+
+static void
+_fingerprintCreateUserMappingStmt(FingerprintContext *ctx, const CreateUserMappingStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateUserMappingStmt");
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+
+  if (node->servername != NULL) {
+    _fingerprintString(ctx, "servername");
+    _fingerprintString(ctx, node->servername);
+  }
+
+  if (node->user != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->user, node, "user", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "user");
+  }
+}
+
+static void
+_fingerprintAlterUserMappingStmt(FingerprintContext *ctx, const AlterUserMappingStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterUserMappingStmt");
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+
+  if (node->servername != NULL) {
+    _fingerprintString(ctx, "servername");
+    _fingerprintString(ctx, node->servername);
+  }
+
+  if (node->user != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->user, node, "user", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "user");
+  }
+}
+
+static void
+_fingerprintDropUserMappingStmt(FingerprintContext *ctx, const DropUserMappingStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "DropUserMappingStmt");
+
+  if (node->missing_ok) {    _fingerprintString(ctx, "missing_ok");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->servername != NULL) {
+    _fingerprintString(ctx, "servername");
+    _fingerprintString(ctx, node->servername);
+  }
+
+  if (node->user != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->user, node, "user", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "user");
+  }
+}
+
+static void
+_fingerprintAlterTableSpaceOptionsStmt(FingerprintContext *ctx, const AlterTableSpaceOptionsStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterTableSpaceOptionsStmt");
+
+  if (node->isReset) {    _fingerprintString(ctx, "isReset");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+
+  if (node->tablespacename != NULL) {
+    _fingerprintString(ctx, "tablespacename");
+    _fingerprintString(ctx, node->tablespacename);
+  }
+
+}
+
+static void
+_fingerprintAlterTableMoveAllStmt(FingerprintContext *ctx, const AlterTableMoveAllStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterTableMoveAllStmt");
+
+  if (node->new_tablespacename != NULL) {
+    _fingerprintString(ctx, "new_tablespacename");
+    _fingerprintString(ctx, node->new_tablespacename);
+  }
+
+
+  if (node->nowait) {    _fingerprintString(ctx, "nowait");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->objtype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->objtype);
+    _fingerprintString(ctx, "objtype");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->orig_tablespacename != NULL) {
+    _fingerprintString(ctx, "orig_tablespacename");
+    _fingerprintString(ctx, node->orig_tablespacename);
+  }
+
+  if (node->roles != NULL && node->roles->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->roles, node, "roles", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "roles");
+  }
+}
+
+static void
+_fingerprintSecLabelStmt(FingerprintContext *ctx, const SecLabelStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "SecLabelStmt");
+
+  if (node->label != NULL) {
+    _fingerprintString(ctx, "label");
+    _fingerprintString(ctx, node->label);
+  }
+
+  if (node->objargs != NULL && node->objargs->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->objargs, node, "objargs", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "objargs");
+  }
+  if (node->objname != NULL && node->objname->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->objname, node, "objname", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "objname");
+  }
+  if (node->objtype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->objtype);
+    _fingerprintString(ctx, "objtype");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->provider != NULL) {
+    _fingerprintString(ctx, "provider");
+    _fingerprintString(ctx, node->provider);
+  }
+
+}
+
+static void
+_fingerprintCreateForeignTableStmt(FingerprintContext *ctx, const CreateForeignTableStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateForeignTableStmt");
+  _fingerprintString(ctx, "base");
+  _fingerprintCreateStmt(ctx, (const CreateStmt*) &node->base, node, "base", depth);
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+
+  if (node->servername != NULL) {
+    _fingerprintString(ctx, "servername");
+    _fingerprintString(ctx, node->servername);
+  }
+
+}
+
+static void
+_fingerprintImportForeignSchemaStmt(FingerprintContext *ctx, const ImportForeignSchemaStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ImportForeignSchemaStmt");
+  if (node->list_type != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->list_type);
+    _fingerprintString(ctx, "list_type");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->local_schema != NULL) {
+    _fingerprintString(ctx, "local_schema");
+    _fingerprintString(ctx, node->local_schema);
+  }
+
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+
+  if (node->remote_schema != NULL) {
+    _fingerprintString(ctx, "remote_schema");
+    _fingerprintString(ctx, node->remote_schema);
+  }
+
+
+  if (node->server_name != NULL) {
+    _fingerprintString(ctx, "server_name");
+    _fingerprintString(ctx, node->server_name);
+  }
+
+  if (node->table_list != NULL && node->table_list->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->table_list, node, "table_list", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "table_list");
+  }
+}
+
+static void
+_fingerprintCreateExtensionStmt(FingerprintContext *ctx, const CreateExtensionStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateExtensionStmt");
+
+  if (node->extname != NULL) {
+    _fingerprintString(ctx, "extname");
+    _fingerprintString(ctx, node->extname);
+  }
+
+
+  if (node->if_not_exists) {    _fingerprintString(ctx, "if_not_exists");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+}
+
+static void
+_fingerprintAlterExtensionStmt(FingerprintContext *ctx, const AlterExtensionStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterExtensionStmt");
+
+  if (node->extname != NULL) {
+    _fingerprintString(ctx, "extname");
+    _fingerprintString(ctx, node->extname);
+  }
+
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+}
+
+static void
+_fingerprintAlterExtensionContentsStmt(FingerprintContext *ctx, const AlterExtensionContentsStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterExtensionContentsStmt");
+  if (node->action != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->action);
+    _fingerprintString(ctx, "action");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->extname != NULL) {
+    _fingerprintString(ctx, "extname");
+    _fingerprintString(ctx, node->extname);
+  }
+
+  if (node->objargs != NULL && node->objargs->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->objargs, node, "objargs", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "objargs");
+  }
+  if (node->objname != NULL && node->objname->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->objname, node, "objname", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "objname");
+  }
+  if (node->objtype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->objtype);
+    _fingerprintString(ctx, "objtype");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintCreateEventTrigStmt(FingerprintContext *ctx, const CreateEventTrigStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateEventTrigStmt");
+
+  if (node->eventname != NULL) {
+    _fingerprintString(ctx, "eventname");
+    _fingerprintString(ctx, node->eventname);
+  }
+
+  if (node->funcname != NULL && node->funcname->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->funcname, node, "funcname", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "funcname");
+  }
+
+  if (node->trigname != NULL) {
+    _fingerprintString(ctx, "trigname");
+    _fingerprintString(ctx, node->trigname);
+  }
+
+  if (node->whenclause != NULL && node->whenclause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->whenclause, node, "whenclause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "whenclause");
+  }
+}
+
+static void
+_fingerprintAlterEventTrigStmt(FingerprintContext *ctx, const AlterEventTrigStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterEventTrigStmt");
+  if (node->tgenabled != 0) {
+    char str[2] = {node->tgenabled, '\0'};
+    _fingerprintString(ctx, "tgenabled");
+    _fingerprintString(ctx, str);
+  }
+
+
+  if (node->trigname != NULL) {
+    _fingerprintString(ctx, "trigname");
+    _fingerprintString(ctx, node->trigname);
+  }
+
+}
+
+static void
+_fingerprintRefreshMatViewStmt(FingerprintContext *ctx, const RefreshMatViewStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "RefreshMatViewStmt");
+
+  if (node->concurrent) {    _fingerprintString(ctx, "concurrent");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+
+  if (node->skipData) {    _fingerprintString(ctx, "skipData");
+    _fingerprintString(ctx, "true");
+  }
+
+}
+
+static void
+_fingerprintReplicaIdentityStmt(FingerprintContext *ctx, const ReplicaIdentityStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ReplicaIdentityStmt");
+  if (node->identity_type != 0) {
+    char str[2] = {node->identity_type, '\0'};
+    _fingerprintString(ctx, "identity_type");
+    _fingerprintString(ctx, str);
+  }
+
+
+  if (node->name != NULL) {
+    _fingerprintString(ctx, "name");
+    _fingerprintString(ctx, node->name);
+  }
+
+}
+
+static void
+_fingerprintAlterSystemStmt(FingerprintContext *ctx, const AlterSystemStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterSystemStmt");
+  if (node->setstmt != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->setstmt, node, "setstmt", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "setstmt");
+  }
+}
+
+static void
+_fingerprintCreatePolicyStmt(FingerprintContext *ctx, const CreatePolicyStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreatePolicyStmt");
+
+  if (node->cmd_name != NULL) {
+    _fingerprintString(ctx, "cmd_name");
+    _fingerprintString(ctx, node->cmd_name);
+  }
+
+
+  if (node->policy_name != NULL) {
+    _fingerprintString(ctx, "policy_name");
+    _fingerprintString(ctx, node->policy_name);
+  }
+
+  if (node->qual != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->qual, node, "qual", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "qual");
+  }
+  if (node->roles != NULL && node->roles->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->roles, node, "roles", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "roles");
+  }
+  if (node->table != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->table, node, "table", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "table");
+  }
+  if (node->with_check != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->with_check, node, "with_check", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "with_check");
+  }
+}
+
+static void
+_fingerprintAlterPolicyStmt(FingerprintContext *ctx, const AlterPolicyStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AlterPolicyStmt");
+
+  if (node->policy_name != NULL) {
+    _fingerprintString(ctx, "policy_name");
+    _fingerprintString(ctx, node->policy_name);
+  }
+
+  if (node->qual != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->qual, node, "qual", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "qual");
+  }
+  if (node->roles != NULL && node->roles->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->roles, node, "roles", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "roles");
+  }
+  if (node->table != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->table, node, "table", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "table");
+  }
+  if (node->with_check != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->with_check, node, "with_check", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "with_check");
+  }
+}
+
+static void
+_fingerprintCreateTransformStmt(FingerprintContext *ctx, const CreateTransformStmt *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateTransformStmt");
+  if (node->fromsql != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->fromsql, node, "fromsql", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "fromsql");
+  }
+
+  if (node->lang != NULL) {
+    _fingerprintString(ctx, "lang");
+    _fingerprintString(ctx, node->lang);
+  }
+
+
+  if (node->replace) {    _fingerprintString(ctx, "replace");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->tosql != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->tosql, node, "tosql", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "tosql");
+  }
+  if (node->type_name != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->type_name, node, "type_name", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "type_name");
+  }
+}
+
+static void
+_fingerprintA_Expr(FingerprintContext *ctx, const A_Expr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "A_Expr");
+  if (node->kind != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->kind);
+    _fingerprintString(ctx, "kind");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->lexpr != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->lexpr, node, "lexpr", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "lexpr");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->name != NULL && node->name->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->name, node, "name", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "name");
+  }
+  if (node->rexpr != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->rexpr, node, "rexpr", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "rexpr");
+  }
+}
+
+static void
+_fingerprintColumnRef(FingerprintContext *ctx, const ColumnRef *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ColumnRef");
+  if (node->fields != NULL && node->fields->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->fields, node, "fields", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "fields");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+}
+
+static void
+_fingerprintParamRef(FingerprintContext *ctx, const ParamRef *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  // Intentionally ignoring all fields for fingerprinting
+}
+
+static void
+_fingerprintA_Const(FingerprintContext *ctx, const A_Const *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  // Intentionally ignoring all fields for fingerprinting
+}
+
+static void
+_fingerprintFuncCall(FingerprintContext *ctx, const FuncCall *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "FuncCall");
+
+  if (node->agg_distinct) {    _fingerprintString(ctx, "agg_distinct");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->agg_filter != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->agg_filter, node, "agg_filter", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "agg_filter");
+  }
+  if (node->agg_order != NULL && node->agg_order->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->agg_order, node, "agg_order", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "agg_order");
+  }
+
+  if (node->agg_star) {    _fingerprintString(ctx, "agg_star");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->agg_within_group) {    _fingerprintString(ctx, "agg_within_group");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+
+  if (node->func_variadic) {    _fingerprintString(ctx, "func_variadic");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->funcname != NULL && node->funcname->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->funcname, node, "funcname", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "funcname");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->over != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->over, node, "over", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "over");
+  }
+}
+
+static void
+_fingerprintA_Star(FingerprintContext *ctx, const A_Star *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "A_Star");
+}
+
+static void
+_fingerprintA_Indices(FingerprintContext *ctx, const A_Indices *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "A_Indices");
+  if (node->lidx != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->lidx, node, "lidx", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "lidx");
+  }
+  if (node->uidx != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->uidx, node, "uidx", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "uidx");
+  }
+}
+
+static void
+_fingerprintA_Indirection(FingerprintContext *ctx, const A_Indirection *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "A_Indirection");
+  if (node->arg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg, node, "arg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg");
+  }
+  if (node->indirection != NULL && node->indirection->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->indirection, node, "indirection", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "indirection");
+  }
+}
+
+static void
+_fingerprintA_ArrayExpr(FingerprintContext *ctx, const A_ArrayExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "A_ArrayExpr");
+  if (node->elements != NULL && node->elements->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->elements, node, "elements", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "elements");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+}
+
+static void
+_fingerprintResTarget(FingerprintContext *ctx, const ResTarget *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ResTarget");
+  if (node->indirection != NULL && node->indirection->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->indirection, node, "indirection", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "indirection");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->name != NULL && (field_name == NULL || parent == NULL || !IsA(parent, SelectStmt) || strcmp(field_name, "targetList") != 0)) {
+    _fingerprintString(ctx, "name");
+    _fingerprintString(ctx, node->name);
+  }
+  if (node->val != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->val, node, "val", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "val");
+  }
+}
+
+static void
+_fingerprintMultiAssignRef(FingerprintContext *ctx, const MultiAssignRef *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "MultiAssignRef");
+  if (node->colno != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->colno);
+    _fingerprintString(ctx, "colno");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->ncolumns != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->ncolumns);
+    _fingerprintString(ctx, "ncolumns");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->source != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->source, node, "source", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "source");
+  }
+}
+
+static void
+_fingerprintTypeCast(FingerprintContext *ctx, const TypeCast *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "TypeCast");
+  if (node->arg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg, node, "arg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->typeName != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->typeName, node, "typeName", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "typeName");
+  }
+}
+
+static void
+_fingerprintCollateClause(FingerprintContext *ctx, const CollateClause *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CollateClause");
+  if (node->arg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg, node, "arg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg");
+  }
+  if (node->collname != NULL && node->collname->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->collname, node, "collname", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "collname");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+}
+
+static void
+_fingerprintSortBy(FingerprintContext *ctx, const SortBy *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "SortBy");
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->node != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->node, node, "node", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "node");
+  }
+  if (node->sortby_dir != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->sortby_dir);
+    _fingerprintString(ctx, "sortby_dir");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->sortby_nulls != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->sortby_nulls);
+    _fingerprintString(ctx, "sortby_nulls");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->useOp != NULL && node->useOp->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->useOp, node, "useOp", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "useOp");
+  }
+}
+
+static void
+_fingerprintWindowDef(FingerprintContext *ctx, const WindowDef *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "WindowDef");
+  if (node->endOffset != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->endOffset, node, "endOffset", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "endOffset");
+  }
+  if (node->frameOptions != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->frameOptions);
+    _fingerprintString(ctx, "frameOptions");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+
+  if (node->name != NULL) {
+    _fingerprintString(ctx, "name");
+    _fingerprintString(ctx, node->name);
+  }
+
+  if (node->orderClause != NULL && node->orderClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->orderClause, node, "orderClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "orderClause");
+  }
+  if (node->partitionClause != NULL && node->partitionClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->partitionClause, node, "partitionClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "partitionClause");
+  }
+
+  if (node->refname != NULL) {
+    _fingerprintString(ctx, "refname");
+    _fingerprintString(ctx, node->refname);
+  }
+
+  if (node->startOffset != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->startOffset, node, "startOffset", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "startOffset");
+  }
+}
+
+static void
+_fingerprintRangeSubselect(FingerprintContext *ctx, const RangeSubselect *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "RangeSubselect");
+  if (node->alias != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->alias, node, "alias", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "alias");
+  }
+
+  if (node->lateral) {    _fingerprintString(ctx, "lateral");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->subquery != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->subquery, node, "subquery", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "subquery");
+  }
+}
+
+static void
+_fingerprintRangeFunction(FingerprintContext *ctx, const RangeFunction *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "RangeFunction");
+  if (node->alias != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->alias, node, "alias", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "alias");
+  }
+  if (node->coldeflist != NULL && node->coldeflist->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->coldeflist, node, "coldeflist", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "coldeflist");
+  }
+  if (node->functions != NULL && node->functions->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->functions, node, "functions", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "functions");
+  }
+
+  if (node->is_rowsfrom) {    _fingerprintString(ctx, "is_rowsfrom");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->lateral) {    _fingerprintString(ctx, "lateral");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->ordinality) {    _fingerprintString(ctx, "ordinality");
+    _fingerprintString(ctx, "true");
+  }
+
+}
+
+static void
+_fingerprintRangeTableSample(FingerprintContext *ctx, const RangeTableSample *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "RangeTableSample");
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->method != NULL && node->method->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->method, node, "method", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "method");
+  }
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+  if (node->repeatable != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->repeatable, node, "repeatable", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "repeatable");
+  }
+}
+
+static void
+_fingerprintTypeName(FingerprintContext *ctx, const TypeName *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "TypeName");
+  if (node->arrayBounds != NULL && node->arrayBounds->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arrayBounds, node, "arrayBounds", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arrayBounds");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->names != NULL && node->names->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->names, node, "names", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "names");
+  }
+
+  if (node->pct_type) {    _fingerprintString(ctx, "pct_type");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->setof) {    _fingerprintString(ctx, "setof");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->typeOid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->typeOid);
+    _fingerprintString(ctx, "typeOid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->typemod != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->typemod);
+    _fingerprintString(ctx, "typemod");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->typmods != NULL && node->typmods->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->typmods, node, "typmods", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "typmods");
+  }
+}
+
+static void
+_fingerprintColumnDef(FingerprintContext *ctx, const ColumnDef *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "ColumnDef");
+  if (node->collClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->collClause, node, "collClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "collClause");
+  }
+  if (node->collOid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->collOid);
+    _fingerprintString(ctx, "collOid");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->colname != NULL) {
+    _fingerprintString(ctx, "colname");
+    _fingerprintString(ctx, node->colname);
+  }
+
+  if (node->constraints != NULL && node->constraints->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->constraints, node, "constraints", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "constraints");
+  }
+  if (node->cooked_default != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->cooked_default, node, "cooked_default", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "cooked_default");
+  }
+  if (node->fdwoptions != NULL && node->fdwoptions->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->fdwoptions, node, "fdwoptions", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "fdwoptions");
+  }
+  if (node->inhcount != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->inhcount);
+    _fingerprintString(ctx, "inhcount");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->is_from_type) {    _fingerprintString(ctx, "is_from_type");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->is_local) {    _fingerprintString(ctx, "is_local");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->is_not_null) {    _fingerprintString(ctx, "is_not_null");
+    _fingerprintString(ctx, "true");
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->raw_default != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->raw_default, node, "raw_default", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "raw_default");
+  }
+  if (node->storage != 0) {
+    char str[2] = {node->storage, '\0'};
+    _fingerprintString(ctx, "storage");
+    _fingerprintString(ctx, str);
+  }
+
+  if (node->typeName != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->typeName, node, "typeName", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "typeName");
+  }
+}
+
+static void
+_fingerprintIndexElem(FingerprintContext *ctx, const IndexElem *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "IndexElem");
+  if (node->collation != NULL && node->collation->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->collation, node, "collation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "collation");
+  }
+  if (node->expr != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->expr, node, "expr", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "expr");
+  }
+
+  if (node->indexcolname != NULL) {
+    _fingerprintString(ctx, "indexcolname");
+    _fingerprintString(ctx, node->indexcolname);
+  }
+
+
+  if (node->name != NULL) {
+    _fingerprintString(ctx, "name");
+    _fingerprintString(ctx, node->name);
+  }
+
+  if (node->nulls_ordering != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->nulls_ordering);
+    _fingerprintString(ctx, "nulls_ordering");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->opclass != NULL && node->opclass->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->opclass, node, "opclass", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "opclass");
+  }
+  if (node->ordering != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->ordering);
+    _fingerprintString(ctx, "ordering");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintConstraint(FingerprintContext *ctx, const Constraint *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "Constraint");
+
+  if (node->access_method != NULL) {
+    _fingerprintString(ctx, "access_method");
+    _fingerprintString(ctx, node->access_method);
+  }
+
+
+  if (node->conname != NULL) {
+    _fingerprintString(ctx, "conname");
+    _fingerprintString(ctx, node->conname);
+  }
+
+  if (node->contype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->contype);
+    _fingerprintString(ctx, "contype");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->cooked_expr != NULL) {
+    _fingerprintString(ctx, "cooked_expr");
+    _fingerprintString(ctx, node->cooked_expr);
+  }
+
+
+  if (node->deferrable) {    _fingerprintString(ctx, "deferrable");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->exclusions != NULL && node->exclusions->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->exclusions, node, "exclusions", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "exclusions");
+  }
+  if (node->fk_attrs != NULL && node->fk_attrs->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->fk_attrs, node, "fk_attrs", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "fk_attrs");
+  }
+  if (node->fk_del_action != 0) {
+    char str[2] = {node->fk_del_action, '\0'};
+    _fingerprintString(ctx, "fk_del_action");
+    _fingerprintString(ctx, str);
+  }
+
+  if (node->fk_matchtype != 0) {
+    char str[2] = {node->fk_matchtype, '\0'};
+    _fingerprintString(ctx, "fk_matchtype");
+    _fingerprintString(ctx, str);
+  }
+
+  if (node->fk_upd_action != 0) {
+    char str[2] = {node->fk_upd_action, '\0'};
+    _fingerprintString(ctx, "fk_upd_action");
+    _fingerprintString(ctx, str);
+  }
+
+
+  if (node->indexname != NULL) {
+    _fingerprintString(ctx, "indexname");
+    _fingerprintString(ctx, node->indexname);
+  }
+
+
+  if (node->indexspace != NULL) {
+    _fingerprintString(ctx, "indexspace");
+    _fingerprintString(ctx, node->indexspace);
+  }
+
+
+  if (node->initdeferred) {    _fingerprintString(ctx, "initdeferred");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->initially_valid) {    _fingerprintString(ctx, "initially_valid");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->is_no_inherit) {    _fingerprintString(ctx, "is_no_inherit");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->keys != NULL && node->keys->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->keys, node, "keys", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "keys");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->old_conpfeqop != NULL && node->old_conpfeqop->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->old_conpfeqop, node, "old_conpfeqop", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "old_conpfeqop");
+  }
+  if (node->old_pktable_oid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->old_pktable_oid);
+    _fingerprintString(ctx, "old_pktable_oid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->options != NULL && node->options->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->options, node, "options", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "options");
+  }
+  if (node->pk_attrs != NULL && node->pk_attrs->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->pk_attrs, node, "pk_attrs", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "pk_attrs");
+  }
+  if (node->pktable != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->pktable, node, "pktable", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "pktable");
+  }
+  if (node->raw_expr != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->raw_expr, node, "raw_expr", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "raw_expr");
+  }
+
+  if (node->skip_validation) {    _fingerprintString(ctx, "skip_validation");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->where_clause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->where_clause, node, "where_clause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "where_clause");
+  }
+}
+
+static void
+_fingerprintDefElem(FingerprintContext *ctx, const DefElem *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "DefElem");
+  if (node->arg != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->arg, node, "arg", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "arg");
+  }
+  if (node->defaction != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->defaction);
+    _fingerprintString(ctx, "defaction");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->defname != NULL) {
+    _fingerprintString(ctx, "defname");
+    _fingerprintString(ctx, node->defname);
+  }
+
+
+  if (node->defnamespace != NULL) {
+    _fingerprintString(ctx, "defnamespace");
+    _fingerprintString(ctx, node->defnamespace);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+}
+
+static void
+_fingerprintRangeTblEntry(FingerprintContext *ctx, const RangeTblEntry *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "RangeTblEntry");
+  if (node->alias != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->alias, node, "alias", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "alias");
+  }
+  if (node->checkAsUser != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->checkAsUser);
+    _fingerprintString(ctx, "checkAsUser");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->ctecolcollations != NULL && node->ctecolcollations->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->ctecolcollations, node, "ctecolcollations", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "ctecolcollations");
+  }
+  if (node->ctecoltypes != NULL && node->ctecoltypes->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->ctecoltypes, node, "ctecoltypes", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "ctecoltypes");
+  }
+  if (node->ctecoltypmods != NULL && node->ctecoltypmods->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->ctecoltypmods, node, "ctecoltypmods", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "ctecoltypmods");
+  }
+  if (node->ctelevelsup != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->ctelevelsup);
+    _fingerprintString(ctx, "ctelevelsup");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->ctename != NULL) {
+    _fingerprintString(ctx, "ctename");
+    _fingerprintString(ctx, node->ctename);
+  }
+
+  if (node->eref != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->eref, node, "eref", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "eref");
+  }
+
+  if (node->funcordinality) {    _fingerprintString(ctx, "funcordinality");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->functions != NULL && node->functions->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->functions, node, "functions", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "functions");
+  }
+
+  if (node->inFromCl) {    _fingerprintString(ctx, "inFromCl");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->inh) {    _fingerprintString(ctx, "inh");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (true) {
+    int x;
+    Bitmapset	*bms = bms_copy(node->insertedCols);
+
+    _fingerprintString(ctx, "insertedCols");
+
+  	while ((x = bms_first_member(bms)) >= 0) {
+      char buffer[50];
+      sprintf(buffer, "%d", x);
+      _fingerprintString(ctx, buffer);
+    }
+
+    bms_free(bms);
+  }
+  if (node->joinaliasvars != NULL && node->joinaliasvars->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->joinaliasvars, node, "joinaliasvars", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "joinaliasvars");
+  }
+  if (node->jointype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->jointype);
+    _fingerprintString(ctx, "jointype");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->lateral) {    _fingerprintString(ctx, "lateral");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->relid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->relid);
+    _fingerprintString(ctx, "relid");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->relkind != 0) {
+    char str[2] = {node->relkind, '\0'};
+    _fingerprintString(ctx, "relkind");
+    _fingerprintString(ctx, str);
+  }
+
+  if (node->requiredPerms != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->requiredPerms);
+    _fingerprintString(ctx, "requiredPerms");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->rtekind != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->rtekind);
+    _fingerprintString(ctx, "rtekind");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->securityQuals != NULL && node->securityQuals->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->securityQuals, node, "securityQuals", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "securityQuals");
+  }
+
+  if (node->security_barrier) {    _fingerprintString(ctx, "security_barrier");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (true) {
+    int x;
+    Bitmapset	*bms = bms_copy(node->selectedCols);
+
+    _fingerprintString(ctx, "selectedCols");
+
+  	while ((x = bms_first_member(bms)) >= 0) {
+      char buffer[50];
+      sprintf(buffer, "%d", x);
+      _fingerprintString(ctx, buffer);
+    }
+
+    bms_free(bms);
+  }
+
+  if (node->self_reference) {    _fingerprintString(ctx, "self_reference");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->subquery != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->subquery, node, "subquery", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "subquery");
+  }
+  if (node->tablesample != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->tablesample, node, "tablesample", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "tablesample");
+  }
+  if (true) {
+    int x;
+    Bitmapset	*bms = bms_copy(node->updatedCols);
+
+    _fingerprintString(ctx, "updatedCols");
+
+  	while ((x = bms_first_member(bms)) >= 0) {
+      char buffer[50];
+      sprintf(buffer, "%d", x);
+      _fingerprintString(ctx, buffer);
+    }
+
+    bms_free(bms);
+  }
+  if (node->values_collations != NULL && node->values_collations->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->values_collations, node, "values_collations", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "values_collations");
+  }
+  if (node->values_lists != NULL && node->values_lists->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->values_lists, node, "values_lists", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "values_lists");
+  }
+}
+
+static void
+_fingerprintRangeTblFunction(FingerprintContext *ctx, const RangeTblFunction *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "RangeTblFunction");
+  if (node->funccolcollations != NULL && node->funccolcollations->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->funccolcollations, node, "funccolcollations", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "funccolcollations");
+  }
+  if (node->funccolcount != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->funccolcount);
+    _fingerprintString(ctx, "funccolcount");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->funccolnames != NULL && node->funccolnames->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->funccolnames, node, "funccolnames", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "funccolnames");
+  }
+  if (node->funccoltypes != NULL && node->funccoltypes->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->funccoltypes, node, "funccoltypes", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "funccoltypes");
+  }
+  if (node->funccoltypmods != NULL && node->funccoltypmods->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->funccoltypmods, node, "funccoltypmods", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "funccoltypmods");
+  }
+  if (node->funcexpr != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->funcexpr, node, "funcexpr", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "funcexpr");
+  }
+  if (true) {
+    int x;
+    Bitmapset	*bms = bms_copy(node->funcparams);
+
+    _fingerprintString(ctx, "funcparams");
+
+  	while ((x = bms_first_member(bms)) >= 0) {
+      char buffer[50];
+      sprintf(buffer, "%d", x);
+      _fingerprintString(ctx, buffer);
+    }
+
+    bms_free(bms);
+  }
+}
+
+static void
+_fingerprintTableSampleClause(FingerprintContext *ctx, const TableSampleClause *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "TableSampleClause");
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  if (node->repeatable != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->repeatable, node, "repeatable", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "repeatable");
+  }
+  if (node->tsmhandler != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->tsmhandler);
+    _fingerprintString(ctx, "tsmhandler");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintWithCheckOption(FingerprintContext *ctx, const WithCheckOption *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "WithCheckOption");
+
+  if (node->cascaded) {    _fingerprintString(ctx, "cascaded");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->kind != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->kind);
+    _fingerprintString(ctx, "kind");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->polname != NULL) {
+    _fingerprintString(ctx, "polname");
+    _fingerprintString(ctx, node->polname);
+  }
+
+  if (node->qual != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->qual, node, "qual", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "qual");
+  }
+
+  if (node->relname != NULL) {
+    _fingerprintString(ctx, "relname");
+    _fingerprintString(ctx, node->relname);
+  }
+
+}
+
+static void
+_fingerprintSortGroupClause(FingerprintContext *ctx, const SortGroupClause *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "SortGroupClause");
+  if (node->eqop != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->eqop);
+    _fingerprintString(ctx, "eqop");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->hashable) {    _fingerprintString(ctx, "hashable");
+    _fingerprintString(ctx, "true");
+  }
+
+
+  if (node->nulls_first) {    _fingerprintString(ctx, "nulls_first");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->sortop != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->sortop);
+    _fingerprintString(ctx, "sortop");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->tleSortGroupRef != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->tleSortGroupRef);
+    _fingerprintString(ctx, "tleSortGroupRef");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintGroupingSet(FingerprintContext *ctx, const GroupingSet *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "GroupingSet");
+  if (node->content != NULL && node->content->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->content, node, "content", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "content");
+  }
+  if (node->kind != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->kind);
+    _fingerprintString(ctx, "kind");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+}
+
+static void
+_fingerprintWindowClause(FingerprintContext *ctx, const WindowClause *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "WindowClause");
+
+  if (node->copiedOrder) {    _fingerprintString(ctx, "copiedOrder");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->endOffset != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->endOffset, node, "endOffset", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "endOffset");
+  }
+  if (node->frameOptions != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->frameOptions);
+    _fingerprintString(ctx, "frameOptions");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->name != NULL) {
+    _fingerprintString(ctx, "name");
+    _fingerprintString(ctx, node->name);
+  }
+
+  if (node->orderClause != NULL && node->orderClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->orderClause, node, "orderClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "orderClause");
+  }
+  if (node->partitionClause != NULL && node->partitionClause->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->partitionClause, node, "partitionClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "partitionClause");
+  }
+
+  if (node->refname != NULL) {
+    _fingerprintString(ctx, "refname");
+    _fingerprintString(ctx, node->refname);
+  }
+
+  if (node->startOffset != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->startOffset, node, "startOffset", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "startOffset");
+  }
+  if (node->winref != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->winref);
+    _fingerprintString(ctx, "winref");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintFuncWithArgs(FingerprintContext *ctx, const FuncWithArgs *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "FuncWithArgs");
+  if (node->funcargs != NULL && node->funcargs->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->funcargs, node, "funcargs", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "funcargs");
+  }
+  if (node->funcname != NULL && node->funcname->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->funcname, node, "funcname", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "funcname");
+  }
+}
+
+static void
+_fingerprintAccessPriv(FingerprintContext *ctx, const AccessPriv *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "AccessPriv");
+  if (node->cols != NULL && node->cols->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->cols, node, "cols", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "cols");
+  }
+
+  if (node->priv_name != NULL) {
+    _fingerprintString(ctx, "priv_name");
+    _fingerprintString(ctx, node->priv_name);
+  }
+
+}
+
+static void
+_fingerprintCreateOpClassItem(FingerprintContext *ctx, const CreateOpClassItem *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CreateOpClassItem");
+  if (node->args != NULL && node->args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->args, node, "args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "args");
+  }
+  if (node->class_args != NULL && node->class_args->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->class_args, node, "class_args", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "class_args");
+  }
+  if (node->itemtype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->itemtype);
+    _fingerprintString(ctx, "itemtype");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->name != NULL && node->name->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->name, node, "name", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "name");
+  }
+  if (node->number != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->number);
+    _fingerprintString(ctx, "number");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->order_family != NULL && node->order_family->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->order_family, node, "order_family", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "order_family");
+  }
+  if (node->storedtype != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->storedtype, node, "storedtype", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "storedtype");
+  }
+}
+
+static void
+_fingerprintTableLikeClause(FingerprintContext *ctx, const TableLikeClause *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "TableLikeClause");
+  if (node->options != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->options);
+    _fingerprintString(ctx, "options");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->relation != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->relation, node, "relation", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "relation");
+  }
+}
+
+static void
+_fingerprintFunctionParameter(FingerprintContext *ctx, const FunctionParameter *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "FunctionParameter");
+  if (node->argType != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->argType, node, "argType", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "argType");
+  }
+  if (node->defexpr != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->defexpr, node, "defexpr", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "defexpr");
+  }
+  if (node->mode != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->mode);
+    _fingerprintString(ctx, "mode");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->name != NULL) {
+    _fingerprintString(ctx, "name");
+    _fingerprintString(ctx, node->name);
+  }
+
+}
+
+static void
+_fingerprintLockingClause(FingerprintContext *ctx, const LockingClause *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "LockingClause");
+  if (node->lockedRels != NULL && node->lockedRels->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->lockedRels, node, "lockedRels", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "lockedRels");
+  }
+  if (node->strength != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->strength);
+    _fingerprintString(ctx, "strength");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->waitPolicy != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->waitPolicy);
+    _fingerprintString(ctx, "waitPolicy");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintRowMarkClause(FingerprintContext *ctx, const RowMarkClause *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "RowMarkClause");
+
+  if (node->pushedDown) {    _fingerprintString(ctx, "pushedDown");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->rti != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->rti);
+    _fingerprintString(ctx, "rti");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->strength != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->strength);
+    _fingerprintString(ctx, "strength");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->waitPolicy != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->waitPolicy);
+    _fingerprintString(ctx, "waitPolicy");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintXmlSerialize(FingerprintContext *ctx, const XmlSerialize *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "XmlSerialize");
+  if (node->expr != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->expr, node, "expr", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "expr");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->typeName != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->typeName, node, "typeName", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "typeName");
+  }
+  if (node->xmloption != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->xmloption);
+    _fingerprintString(ctx, "xmloption");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintWithClause(FingerprintContext *ctx, const WithClause *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "WithClause");
+  if (node->ctes != NULL && node->ctes->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->ctes, node, "ctes", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "ctes");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+
+  if (node->recursive) {    _fingerprintString(ctx, "recursive");
+    _fingerprintString(ctx, "true");
+  }
+
+}
+
+static void
+_fingerprintInferClause(FingerprintContext *ctx, const InferClause *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "InferClause");
+
+  if (node->conname != NULL) {
+    _fingerprintString(ctx, "conname");
+    _fingerprintString(ctx, node->conname);
+  }
+
+  if (node->indexElems != NULL && node->indexElems->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->indexElems, node, "indexElems", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "indexElems");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->whereClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->whereClause, node, "whereClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "whereClause");
+  }
+}
+
+static void
+_fingerprintOnConflictClause(FingerprintContext *ctx, const OnConflictClause *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "OnConflictClause");
+  if (node->action != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->action);
+    _fingerprintString(ctx, "action");
+    _fingerprintString(ctx, buffer);
+  }
+
+  if (node->infer != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->infer, node, "infer", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "infer");
+  }
+  // Intentionally ignoring node->location for fingerprinting
+  if (node->targetList != NULL && node->targetList->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->targetList, node, "targetList", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "targetList");
+  }
+  if (node->whereClause != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->whereClause, node, "whereClause", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "whereClause");
+  }
+}
+
+static void
+_fingerprintCommonTableExpr(FingerprintContext *ctx, const CommonTableExpr *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "CommonTableExpr");
+  if (node->aliascolnames != NULL && node->aliascolnames->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->aliascolnames, node, "aliascolnames", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "aliascolnames");
+  }
+  if (node->ctecolcollations != NULL && node->ctecolcollations->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->ctecolcollations, node, "ctecolcollations", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "ctecolcollations");
+  }
+  if (node->ctecolnames != NULL && node->ctecolnames->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->ctecolnames, node, "ctecolnames", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "ctecolnames");
+  }
+  if (node->ctecoltypes != NULL && node->ctecoltypes->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->ctecoltypes, node, "ctecoltypes", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "ctecoltypes");
+  }
+  if (node->ctecoltypmods != NULL && node->ctecoltypmods->length > 0) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->ctecoltypmods, node, "ctecoltypmods", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "ctecoltypmods");
+  }
+
+  if (node->ctename != NULL) {
+    _fingerprintString(ctx, "ctename");
+    _fingerprintString(ctx, node->ctename);
+  }
+
+  if (node->ctequery != NULL) {
+    FingerprintContext subCtx;
+    _fingerprintInitForTokens(&subCtx);
+    _fingerprintNode(&subCtx, node->ctequery, node, "ctequery", depth + 1);
+    _fingerprintCopyTokens(&subCtx, ctx, "ctequery");
+  }
+
+  if (node->cterecursive) {    _fingerprintString(ctx, "cterecursive");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->cterefcount != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->cterefcount);
+    _fingerprintString(ctx, "cterefcount");
+    _fingerprintString(ctx, buffer);
+  }
+
+  // Intentionally ignoring node->location for fingerprinting
+}
+
+static void
+_fingerprintRoleSpec(FingerprintContext *ctx, const RoleSpec *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "RoleSpec");
+  // Intentionally ignoring node->location for fingerprinting
+
+  if (node->rolename != NULL) {
+    _fingerprintString(ctx, "rolename");
+    _fingerprintString(ctx, node->rolename);
+  }
+
+  if (node->roletype != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->roletype);
+    _fingerprintString(ctx, "roletype");
+    _fingerprintString(ctx, buffer);
+  }
+
+}
+
+static void
+_fingerprintInlineCodeBlock(FingerprintContext *ctx, const InlineCodeBlock *node, const void *parent, const char *field_name, unsigned int depth)
+{
+  _fingerprintString(ctx, "InlineCodeBlock");
+
+  if (node->langIsTrusted) {    _fingerprintString(ctx, "langIsTrusted");
+    _fingerprintString(ctx, "true");
+  }
+
+  if (node->langOid != 0) {
+    char buffer[50];
+    sprintf(buffer, "%d", node->langOid);
+    _fingerprintString(ctx, "langOid");
+    _fingerprintString(ctx, buffer);
+  }
+
+
+  if (node->source_text != NULL) {
+    _fingerprintString(ctx, "source_text");
+    _fingerprintString(ctx, node->source_text);
+  }
+
+}
+
diff --git a/foreign/libpg_query/src/pg_query_internal.h b/foreign/libpg_query/src/pg_query_internal.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/pg_query_internal.h
@@ -0,0 +1,24 @@
+#ifndef PG_QUERY_INTERNAL_H
+#define PG_QUERY_INTERNAL_H
+
+#include "postgres.h"
+#include "utils/memutils.h"
+#include "nodes/pg_list.h"
+
+#define STDERR_BUFFER_LEN 4096
+#define DEBUG
+
+typedef struct {
+  List *tree;
+  char* stderr_buffer;
+  PgQueryError* error;
+} PgQueryInternalParsetreeAndError;
+
+PgQueryInternalParsetreeAndError pg_query_raw_parse(const char* input);
+
+void pg_query_free_error(PgQueryError *error);
+
+MemoryContext pg_query_enter_memory_context(const char* ctx_name);
+void pg_query_exit_memory_context(MemoryContext ctx);
+
+#endif
diff --git a/foreign/libpg_query/src/pg_query_json.c b/foreign/libpg_query/src/pg_query_json.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/pg_query_json.c
@@ -0,0 +1,227 @@
+#include "pg_query_json.h"
+
+#include "postgres.h"
+
+#include <ctype.h>
+
+#include "nodes/plannodes.h"
+#include "nodes/relation.h"
+#include "utils/datum.h"
+
+static void _outNode(StringInfo str, const void *obj);
+
+#include "pg_query_json_helper.c"
+
+#define WRITE_NODE_FIELD(fldname) \
+	if (true) { \
+		 appendStringInfo(str, "\"" CppAsString(fldname) "\": "); \
+	     _outNode(str, &node->fldname); \
+		 appendStringInfo(str, ", "); \
+  	}
+
+#define WRITE_NODE_FIELD_WITH_TYPE(fldname, typename) \
+	if (true) { \
+		 appendStringInfo(str, "\"" CppAsString(fldname) "\": {"); \
+	   	 _out##typename(str, (const typename *) &node->fldname); \
+		 removeTrailingDelimiter(str); \
+ 		 appendStringInfo(str, "}}, "); \
+	}
+
+#define WRITE_NODE_PTR_FIELD(fldname) \
+	if (node->fldname != NULL) { \
+		 appendStringInfo(str, "\"" CppAsString(fldname) "\": "); \
+		 _outNode(str, node->fldname); \
+		 appendStringInfo(str, ", "); \
+	}
+
+#define WRITE_BITMAPSET_FIELD(fldname) \
+	(appendStringInfo(str, "\"" CppAsString(fldname) "\": "), \
+	 _outBitmapset(str, node->fldname), \
+	 appendStringInfo(str, ", "))
+
+
+static void
+_outList(StringInfo str, const List *node)
+{
+	const ListCell *lc;
+
+	// Simple lists are frequent structures - we don't make them into full nodes to avoid super-verbose output
+	appendStringInfoChar(str, '[');
+
+	foreach(lc, node)
+	{
+		_outNode(str, lfirst(lc));
+
+		if (lnext(lc))
+			appendStringInfoString(str, ", ");
+	}
+
+	appendStringInfoChar(str, ']');
+}
+
+static void
+_outIntList(StringInfo str, const List *node)
+{
+	const ListCell *lc;
+
+	WRITE_NODE_TYPE("IntList");
+	appendStringInfo(str, "\"items\": ");
+	appendStringInfoChar(str, '[');
+
+	foreach(lc, node)
+	{
+		appendStringInfo(str, " %d", lfirst_int(lc));
+
+		if (lnext(lc))
+			appendStringInfoString(str, ", ");
+	}
+
+	appendStringInfoChar(str, ']');
+	appendStringInfo(str, ", ");
+}
+
+static void
+_outOidList(StringInfo str, const List *node)
+{
+	const ListCell *lc;
+
+	WRITE_NODE_TYPE("OidList");
+	appendStringInfo(str, "\"items\": ");
+	appendStringInfoChar(str, '[');
+
+	foreach(lc, node)
+	{
+		appendStringInfo(str, " %u", lfirst_oid(lc));
+
+		if (lnext(lc))
+			appendStringInfoString(str, ", ");
+	}
+
+	appendStringInfoChar(str, ']');
+	appendStringInfo(str, ", ");
+}
+
+static void
+_outBitmapset(StringInfo str, const Bitmapset *bms)
+{
+	Bitmapset	*tmpset;
+	int			x;
+
+	appendStringInfoChar(str, '[');
+	/*appendStringInfoChar(str, 'b');*/
+	tmpset = bms_copy(bms);
+	while ((x = bms_first_member(tmpset)) >= 0)
+		appendStringInfo(str, "%d, ", x);
+	bms_free(tmpset);
+	removeTrailingDelimiter(str);
+	appendStringInfoChar(str, ']');
+}
+
+static void
+_outInteger(StringInfo str, const Value *node)
+{
+	WRITE_NODE_TYPE("Integer");
+	appendStringInfo(str, "\"ival\": %ld, ", node->val.ival);
+}
+
+static void
+_outFloat(StringInfo str, const Value *node)
+{
+	WRITE_NODE_TYPE("Float");
+	appendStringInfo(str, "\"str\": ");
+	_outToken(str, node->val.str);
+	appendStringInfo(str, ", ");
+}
+
+static void
+_outString(StringInfo str, const Value *node)
+{
+	WRITE_NODE_TYPE("String");
+	appendStringInfo(str, "\"str\": ");
+	_outToken(str, node->val.str);
+	appendStringInfo(str, ", ");
+}
+
+static void
+_outBitString(StringInfo str, const Value *node)
+{
+	WRITE_NODE_TYPE("BitString");
+	appendStringInfo(str, "\"str\": ");
+	_outToken(str, node->val.str);
+	appendStringInfo(str, ", ");
+}
+
+static void
+_outNull(StringInfo str, const Value *node)
+{
+	WRITE_NODE_TYPE("Null");
+}
+
+#include "pg_query_json_defs.c"
+
+static void
+_outNode(StringInfo str, const void *obj)
+{
+	if (obj == NULL)
+	{
+		appendStringInfoString(str, "null");
+	}
+	else if (IsA(obj, List))
+	{
+		_outList(str, obj);
+	}
+	else
+	{
+		appendStringInfoChar(str, '{');
+		switch (nodeTag(obj))
+		{
+			case T_Integer:
+				_outInteger(str, obj);
+				break;
+			case T_Float:
+				_outFloat(str, obj);
+				break;
+			case T_String:
+				_outString(str, obj);
+				break;
+			case T_BitString:
+				_outBitString(str, obj);
+				break;
+			case T_Null:
+				_outNull(str, obj);
+				break;
+			case T_IntList:
+				_outIntList(str, obj);
+				break;
+			case T_OidList:
+				_outOidList(str, obj);
+				break;
+
+			#include "pg_query_json_conds.c"
+
+			default:
+				elog(WARNING, "could not dump unrecognized node type: %d",
+					 (int) nodeTag(obj));
+
+				appendStringInfo(str, "}");
+				return;
+		}
+		removeTrailingDelimiter(str);
+		appendStringInfo(str, "}}");
+	}
+}
+
+char *
+pg_query_nodes_to_json(const void *obj)
+{
+	StringInfoData str;
+
+	initStringInfo(&str);
+
+	if (obj == NULL) /* Make sure we generate valid JSON for empty queries */
+		appendStringInfoString(&str, "[]");
+	else
+		_outNode(&str, obj);
+
+	return str.data;
+}
diff --git a/foreign/libpg_query/src/pg_query_json.h b/foreign/libpg_query/src/pg_query_json.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/pg_query_json.h
@@ -0,0 +1,6 @@
+#ifndef PG_QUERY_JSON_H
+#define PG_QUERY_JSON_H
+
+char *pg_query_nodes_to_json(const void *obj);
+
+#endif
diff --git a/foreign/libpg_query/src/pg_query_json_conds.c b/foreign/libpg_query/src/pg_query_json_conds.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/pg_query_json_conds.c
@@ -0,0 +1,576 @@
+case T_Alias:
+  _outAlias(str, obj);
+  break;
+case T_RangeVar:
+  _outRangeVar(str, obj);
+  break;
+case T_Var:
+  _outVar(str, obj);
+  break;
+case T_Param:
+  _outParam(str, obj);
+  break;
+case T_Aggref:
+  _outAggref(str, obj);
+  break;
+case T_GroupingFunc:
+  _outGroupingFunc(str, obj);
+  break;
+case T_WindowFunc:
+  _outWindowFunc(str, obj);
+  break;
+case T_ArrayRef:
+  _outArrayRef(str, obj);
+  break;
+case T_FuncExpr:
+  _outFuncExpr(str, obj);
+  break;
+case T_NamedArgExpr:
+  _outNamedArgExpr(str, obj);
+  break;
+case T_OpExpr:
+  _outOpExpr(str, obj);
+  break;
+case T_DistinctExpr:
+  _outDistinctExpr(str, obj);
+  break;
+case T_NullIfExpr:
+  _outNullIfExpr(str, obj);
+  break;
+case T_ScalarArrayOpExpr:
+  _outScalarArrayOpExpr(str, obj);
+  break;
+case T_BoolExpr:
+  _outBoolExpr(str, obj);
+  break;
+case T_SubLink:
+  _outSubLink(str, obj);
+  break;
+case T_SubPlan:
+  _outSubPlan(str, obj);
+  break;
+case T_AlternativeSubPlan:
+  _outAlternativeSubPlan(str, obj);
+  break;
+case T_FieldSelect:
+  _outFieldSelect(str, obj);
+  break;
+case T_FieldStore:
+  _outFieldStore(str, obj);
+  break;
+case T_RelabelType:
+  _outRelabelType(str, obj);
+  break;
+case T_CoerceViaIO:
+  _outCoerceViaIO(str, obj);
+  break;
+case T_ArrayCoerceExpr:
+  _outArrayCoerceExpr(str, obj);
+  break;
+case T_ConvertRowtypeExpr:
+  _outConvertRowtypeExpr(str, obj);
+  break;
+case T_CollateExpr:
+  _outCollateExpr(str, obj);
+  break;
+case T_CaseExpr:
+  _outCaseExpr(str, obj);
+  break;
+case T_CaseWhen:
+  _outCaseWhen(str, obj);
+  break;
+case T_CaseTestExpr:
+  _outCaseTestExpr(str, obj);
+  break;
+case T_ArrayExpr:
+  _outArrayExpr(str, obj);
+  break;
+case T_RowExpr:
+  _outRowExpr(str, obj);
+  break;
+case T_RowCompareExpr:
+  _outRowCompareExpr(str, obj);
+  break;
+case T_CoalesceExpr:
+  _outCoalesceExpr(str, obj);
+  break;
+case T_MinMaxExpr:
+  _outMinMaxExpr(str, obj);
+  break;
+case T_XmlExpr:
+  _outXmlExpr(str, obj);
+  break;
+case T_NullTest:
+  _outNullTest(str, obj);
+  break;
+case T_BooleanTest:
+  _outBooleanTest(str, obj);
+  break;
+case T_CoerceToDomain:
+  _outCoerceToDomain(str, obj);
+  break;
+case T_CoerceToDomainValue:
+  _outCoerceToDomainValue(str, obj);
+  break;
+case T_SetToDefault:
+  _outSetToDefault(str, obj);
+  break;
+case T_CurrentOfExpr:
+  _outCurrentOfExpr(str, obj);
+  break;
+case T_InferenceElem:
+  _outInferenceElem(str, obj);
+  break;
+case T_TargetEntry:
+  _outTargetEntry(str, obj);
+  break;
+case T_RangeTblRef:
+  _outRangeTblRef(str, obj);
+  break;
+case T_JoinExpr:
+  _outJoinExpr(str, obj);
+  break;
+case T_FromExpr:
+  _outFromExpr(str, obj);
+  break;
+case T_OnConflictExpr:
+  _outOnConflictExpr(str, obj);
+  break;
+case T_IntoClause:
+  _outIntoClause(str, obj);
+  break;
+case T_Query:
+  _outQuery(str, obj);
+  break;
+case T_InsertStmt:
+  _outInsertStmt(str, obj);
+  break;
+case T_DeleteStmt:
+  _outDeleteStmt(str, obj);
+  break;
+case T_UpdateStmt:
+  _outUpdateStmt(str, obj);
+  break;
+case T_SelectStmt:
+  _outSelectStmt(str, obj);
+  break;
+case T_AlterTableStmt:
+  _outAlterTableStmt(str, obj);
+  break;
+case T_AlterTableCmd:
+  _outAlterTableCmd(str, obj);
+  break;
+case T_AlterDomainStmt:
+  _outAlterDomainStmt(str, obj);
+  break;
+case T_SetOperationStmt:
+  _outSetOperationStmt(str, obj);
+  break;
+case T_GrantStmt:
+  _outGrantStmt(str, obj);
+  break;
+case T_GrantRoleStmt:
+  _outGrantRoleStmt(str, obj);
+  break;
+case T_AlterDefaultPrivilegesStmt:
+  _outAlterDefaultPrivilegesStmt(str, obj);
+  break;
+case T_ClosePortalStmt:
+  _outClosePortalStmt(str, obj);
+  break;
+case T_ClusterStmt:
+  _outClusterStmt(str, obj);
+  break;
+case T_CopyStmt:
+  _outCopyStmt(str, obj);
+  break;
+case T_CreateStmt:
+  _outCreateStmt(str, obj);
+  break;
+case T_DefineStmt:
+  _outDefineStmt(str, obj);
+  break;
+case T_DropStmt:
+  _outDropStmt(str, obj);
+  break;
+case T_TruncateStmt:
+  _outTruncateStmt(str, obj);
+  break;
+case T_CommentStmt:
+  _outCommentStmt(str, obj);
+  break;
+case T_FetchStmt:
+  _outFetchStmt(str, obj);
+  break;
+case T_IndexStmt:
+  _outIndexStmt(str, obj);
+  break;
+case T_CreateFunctionStmt:
+  _outCreateFunctionStmt(str, obj);
+  break;
+case T_AlterFunctionStmt:
+  _outAlterFunctionStmt(str, obj);
+  break;
+case T_DoStmt:
+  _outDoStmt(str, obj);
+  break;
+case T_RenameStmt:
+  _outRenameStmt(str, obj);
+  break;
+case T_RuleStmt:
+  _outRuleStmt(str, obj);
+  break;
+case T_NotifyStmt:
+  _outNotifyStmt(str, obj);
+  break;
+case T_ListenStmt:
+  _outListenStmt(str, obj);
+  break;
+case T_UnlistenStmt:
+  _outUnlistenStmt(str, obj);
+  break;
+case T_TransactionStmt:
+  _outTransactionStmt(str, obj);
+  break;
+case T_ViewStmt:
+  _outViewStmt(str, obj);
+  break;
+case T_LoadStmt:
+  _outLoadStmt(str, obj);
+  break;
+case T_CreateDomainStmt:
+  _outCreateDomainStmt(str, obj);
+  break;
+case T_CreatedbStmt:
+  _outCreatedbStmt(str, obj);
+  break;
+case T_DropdbStmt:
+  _outDropdbStmt(str, obj);
+  break;
+case T_VacuumStmt:
+  _outVacuumStmt(str, obj);
+  break;
+case T_ExplainStmt:
+  _outExplainStmt(str, obj);
+  break;
+case T_CreateTableAsStmt:
+  _outCreateTableAsStmt(str, obj);
+  break;
+case T_CreateSeqStmt:
+  _outCreateSeqStmt(str, obj);
+  break;
+case T_AlterSeqStmt:
+  _outAlterSeqStmt(str, obj);
+  break;
+case T_VariableSetStmt:
+  _outVariableSetStmt(str, obj);
+  break;
+case T_VariableShowStmt:
+  _outVariableShowStmt(str, obj);
+  break;
+case T_DiscardStmt:
+  _outDiscardStmt(str, obj);
+  break;
+case T_CreateTrigStmt:
+  _outCreateTrigStmt(str, obj);
+  break;
+case T_CreatePLangStmt:
+  _outCreatePLangStmt(str, obj);
+  break;
+case T_CreateRoleStmt:
+  _outCreateRoleStmt(str, obj);
+  break;
+case T_AlterRoleStmt:
+  _outAlterRoleStmt(str, obj);
+  break;
+case T_DropRoleStmt:
+  _outDropRoleStmt(str, obj);
+  break;
+case T_LockStmt:
+  _outLockStmt(str, obj);
+  break;
+case T_ConstraintsSetStmt:
+  _outConstraintsSetStmt(str, obj);
+  break;
+case T_ReindexStmt:
+  _outReindexStmt(str, obj);
+  break;
+case T_CheckPointStmt:
+  _outCheckPointStmt(str, obj);
+  break;
+case T_CreateSchemaStmt:
+  _outCreateSchemaStmt(str, obj);
+  break;
+case T_AlterDatabaseStmt:
+  _outAlterDatabaseStmt(str, obj);
+  break;
+case T_AlterDatabaseSetStmt:
+  _outAlterDatabaseSetStmt(str, obj);
+  break;
+case T_AlterRoleSetStmt:
+  _outAlterRoleSetStmt(str, obj);
+  break;
+case T_CreateConversionStmt:
+  _outCreateConversionStmt(str, obj);
+  break;
+case T_CreateCastStmt:
+  _outCreateCastStmt(str, obj);
+  break;
+case T_CreateOpClassStmt:
+  _outCreateOpClassStmt(str, obj);
+  break;
+case T_CreateOpFamilyStmt:
+  _outCreateOpFamilyStmt(str, obj);
+  break;
+case T_AlterOpFamilyStmt:
+  _outAlterOpFamilyStmt(str, obj);
+  break;
+case T_PrepareStmt:
+  _outPrepareStmt(str, obj);
+  break;
+case T_ExecuteStmt:
+  _outExecuteStmt(str, obj);
+  break;
+case T_DeallocateStmt:
+  _outDeallocateStmt(str, obj);
+  break;
+case T_DeclareCursorStmt:
+  _outDeclareCursorStmt(str, obj);
+  break;
+case T_CreateTableSpaceStmt:
+  _outCreateTableSpaceStmt(str, obj);
+  break;
+case T_DropTableSpaceStmt:
+  _outDropTableSpaceStmt(str, obj);
+  break;
+case T_AlterObjectSchemaStmt:
+  _outAlterObjectSchemaStmt(str, obj);
+  break;
+case T_AlterOwnerStmt:
+  _outAlterOwnerStmt(str, obj);
+  break;
+case T_DropOwnedStmt:
+  _outDropOwnedStmt(str, obj);
+  break;
+case T_ReassignOwnedStmt:
+  _outReassignOwnedStmt(str, obj);
+  break;
+case T_CompositeTypeStmt:
+  _outCompositeTypeStmt(str, obj);
+  break;
+case T_CreateEnumStmt:
+  _outCreateEnumStmt(str, obj);
+  break;
+case T_CreateRangeStmt:
+  _outCreateRangeStmt(str, obj);
+  break;
+case T_AlterEnumStmt:
+  _outAlterEnumStmt(str, obj);
+  break;
+case T_AlterTSDictionaryStmt:
+  _outAlterTSDictionaryStmt(str, obj);
+  break;
+case T_AlterTSConfigurationStmt:
+  _outAlterTSConfigurationStmt(str, obj);
+  break;
+case T_CreateFdwStmt:
+  _outCreateFdwStmt(str, obj);
+  break;
+case T_AlterFdwStmt:
+  _outAlterFdwStmt(str, obj);
+  break;
+case T_CreateForeignServerStmt:
+  _outCreateForeignServerStmt(str, obj);
+  break;
+case T_AlterForeignServerStmt:
+  _outAlterForeignServerStmt(str, obj);
+  break;
+case T_CreateUserMappingStmt:
+  _outCreateUserMappingStmt(str, obj);
+  break;
+case T_AlterUserMappingStmt:
+  _outAlterUserMappingStmt(str, obj);
+  break;
+case T_DropUserMappingStmt:
+  _outDropUserMappingStmt(str, obj);
+  break;
+case T_AlterTableSpaceOptionsStmt:
+  _outAlterTableSpaceOptionsStmt(str, obj);
+  break;
+case T_AlterTableMoveAllStmt:
+  _outAlterTableMoveAllStmt(str, obj);
+  break;
+case T_SecLabelStmt:
+  _outSecLabelStmt(str, obj);
+  break;
+case T_CreateForeignTableStmt:
+  _outCreateForeignTableStmt(str, obj);
+  break;
+case T_ImportForeignSchemaStmt:
+  _outImportForeignSchemaStmt(str, obj);
+  break;
+case T_CreateExtensionStmt:
+  _outCreateExtensionStmt(str, obj);
+  break;
+case T_AlterExtensionStmt:
+  _outAlterExtensionStmt(str, obj);
+  break;
+case T_AlterExtensionContentsStmt:
+  _outAlterExtensionContentsStmt(str, obj);
+  break;
+case T_CreateEventTrigStmt:
+  _outCreateEventTrigStmt(str, obj);
+  break;
+case T_AlterEventTrigStmt:
+  _outAlterEventTrigStmt(str, obj);
+  break;
+case T_RefreshMatViewStmt:
+  _outRefreshMatViewStmt(str, obj);
+  break;
+case T_ReplicaIdentityStmt:
+  _outReplicaIdentityStmt(str, obj);
+  break;
+case T_AlterSystemStmt:
+  _outAlterSystemStmt(str, obj);
+  break;
+case T_CreatePolicyStmt:
+  _outCreatePolicyStmt(str, obj);
+  break;
+case T_AlterPolicyStmt:
+  _outAlterPolicyStmt(str, obj);
+  break;
+case T_CreateTransformStmt:
+  _outCreateTransformStmt(str, obj);
+  break;
+case T_A_Expr:
+  _outA_Expr(str, obj);
+  break;
+case T_ColumnRef:
+  _outColumnRef(str, obj);
+  break;
+case T_ParamRef:
+  _outParamRef(str, obj);
+  break;
+case T_A_Const:
+  _outA_Const(str, obj);
+  break;
+case T_FuncCall:
+  _outFuncCall(str, obj);
+  break;
+case T_A_Star:
+  _outA_Star(str, obj);
+  break;
+case T_A_Indices:
+  _outA_Indices(str, obj);
+  break;
+case T_A_Indirection:
+  _outA_Indirection(str, obj);
+  break;
+case T_A_ArrayExpr:
+  _outA_ArrayExpr(str, obj);
+  break;
+case T_ResTarget:
+  _outResTarget(str, obj);
+  break;
+case T_MultiAssignRef:
+  _outMultiAssignRef(str, obj);
+  break;
+case T_TypeCast:
+  _outTypeCast(str, obj);
+  break;
+case T_CollateClause:
+  _outCollateClause(str, obj);
+  break;
+case T_SortBy:
+  _outSortBy(str, obj);
+  break;
+case T_WindowDef:
+  _outWindowDef(str, obj);
+  break;
+case T_RangeSubselect:
+  _outRangeSubselect(str, obj);
+  break;
+case T_RangeFunction:
+  _outRangeFunction(str, obj);
+  break;
+case T_RangeTableSample:
+  _outRangeTableSample(str, obj);
+  break;
+case T_TypeName:
+  _outTypeName(str, obj);
+  break;
+case T_ColumnDef:
+  _outColumnDef(str, obj);
+  break;
+case T_IndexElem:
+  _outIndexElem(str, obj);
+  break;
+case T_Constraint:
+  _outConstraint(str, obj);
+  break;
+case T_DefElem:
+  _outDefElem(str, obj);
+  break;
+case T_RangeTblEntry:
+  _outRangeTblEntry(str, obj);
+  break;
+case T_RangeTblFunction:
+  _outRangeTblFunction(str, obj);
+  break;
+case T_TableSampleClause:
+  _outTableSampleClause(str, obj);
+  break;
+case T_WithCheckOption:
+  _outWithCheckOption(str, obj);
+  break;
+case T_SortGroupClause:
+  _outSortGroupClause(str, obj);
+  break;
+case T_GroupingSet:
+  _outGroupingSet(str, obj);
+  break;
+case T_WindowClause:
+  _outWindowClause(str, obj);
+  break;
+case T_FuncWithArgs:
+  _outFuncWithArgs(str, obj);
+  break;
+case T_AccessPriv:
+  _outAccessPriv(str, obj);
+  break;
+case T_CreateOpClassItem:
+  _outCreateOpClassItem(str, obj);
+  break;
+case T_TableLikeClause:
+  _outTableLikeClause(str, obj);
+  break;
+case T_FunctionParameter:
+  _outFunctionParameter(str, obj);
+  break;
+case T_LockingClause:
+  _outLockingClause(str, obj);
+  break;
+case T_RowMarkClause:
+  _outRowMarkClause(str, obj);
+  break;
+case T_XmlSerialize:
+  _outXmlSerialize(str, obj);
+  break;
+case T_WithClause:
+  _outWithClause(str, obj);
+  break;
+case T_InferClause:
+  _outInferClause(str, obj);
+  break;
+case T_OnConflictClause:
+  _outOnConflictClause(str, obj);
+  break;
+case T_CommonTableExpr:
+  _outCommonTableExpr(str, obj);
+  break;
+case T_RoleSpec:
+  _outRoleSpec(str, obj);
+  break;
+case T_InlineCodeBlock:
+  _outInlineCodeBlock(str, obj);
+  break;
diff --git a/foreign/libpg_query/src/pg_query_json_defs.c b/foreign/libpg_query/src/pg_query_json_defs.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/pg_query_json_defs.c
@@ -0,0 +1,2298 @@
+static void
+_outAlias(StringInfo str, const Alias *node)
+{
+  WRITE_NODE_TYPE("Alias");
+
+  WRITE_STRING_FIELD(aliasname);
+  WRITE_NODE_PTR_FIELD(colnames);
+}
+
+static void
+_outRangeVar(StringInfo str, const RangeVar *node)
+{
+  WRITE_NODE_TYPE("RangeVar");
+
+  WRITE_STRING_FIELD(schemaname);
+  WRITE_STRING_FIELD(relname);
+  WRITE_ENUM_FIELD(inhOpt);
+  WRITE_CHAR_FIELD(relpersistence);
+  WRITE_NODE_PTR_FIELD(alias);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outVar(StringInfo str, const Var *node)
+{
+  WRITE_NODE_TYPE("Var");
+
+  WRITE_UINT_FIELD(varno);
+  WRITE_INT_FIELD(varattno);
+  WRITE_UINT_FIELD(vartype);
+  WRITE_INT_FIELD(vartypmod);
+  WRITE_UINT_FIELD(varcollid);
+  WRITE_UINT_FIELD(varlevelsup);
+  WRITE_UINT_FIELD(varnoold);
+  WRITE_INT_FIELD(varoattno);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outParam(StringInfo str, const Param *node)
+{
+  WRITE_NODE_TYPE("Param");
+
+  WRITE_ENUM_FIELD(paramkind);
+  WRITE_INT_FIELD(paramid);
+  WRITE_UINT_FIELD(paramtype);
+  WRITE_INT_FIELD(paramtypmod);
+  WRITE_UINT_FIELD(paramcollid);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outAggref(StringInfo str, const Aggref *node)
+{
+  WRITE_NODE_TYPE("Aggref");
+
+  WRITE_UINT_FIELD(aggfnoid);
+  WRITE_UINT_FIELD(aggtype);
+  WRITE_UINT_FIELD(aggcollid);
+  WRITE_UINT_FIELD(inputcollid);
+  WRITE_NODE_PTR_FIELD(aggdirectargs);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_NODE_PTR_FIELD(aggorder);
+  WRITE_NODE_PTR_FIELD(aggdistinct);
+  WRITE_NODE_PTR_FIELD(aggfilter);
+  WRITE_BOOL_FIELD(aggstar);
+  WRITE_BOOL_FIELD(aggvariadic);
+  WRITE_CHAR_FIELD(aggkind);
+  WRITE_UINT_FIELD(agglevelsup);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outGroupingFunc(StringInfo str, const GroupingFunc *node)
+{
+  WRITE_NODE_TYPE("GroupingFunc");
+
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_NODE_PTR_FIELD(refs);
+  WRITE_NODE_PTR_FIELD(cols);
+  WRITE_UINT_FIELD(agglevelsup);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outWindowFunc(StringInfo str, const WindowFunc *node)
+{
+  WRITE_NODE_TYPE("WindowFunc");
+
+  WRITE_UINT_FIELD(winfnoid);
+  WRITE_UINT_FIELD(wintype);
+  WRITE_UINT_FIELD(wincollid);
+  WRITE_UINT_FIELD(inputcollid);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_NODE_PTR_FIELD(aggfilter);
+  WRITE_UINT_FIELD(winref);
+  WRITE_BOOL_FIELD(winstar);
+  WRITE_BOOL_FIELD(winagg);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outArrayRef(StringInfo str, const ArrayRef *node)
+{
+  WRITE_NODE_TYPE("ArrayRef");
+
+  WRITE_UINT_FIELD(refarraytype);
+  WRITE_UINT_FIELD(refelemtype);
+  WRITE_INT_FIELD(reftypmod);
+  WRITE_UINT_FIELD(refcollid);
+  WRITE_NODE_PTR_FIELD(refupperindexpr);
+  WRITE_NODE_PTR_FIELD(reflowerindexpr);
+  WRITE_NODE_PTR_FIELD(refexpr);
+  WRITE_NODE_PTR_FIELD(refassgnexpr);
+}
+
+static void
+_outFuncExpr(StringInfo str, const FuncExpr *node)
+{
+  WRITE_NODE_TYPE("FuncExpr");
+
+  WRITE_UINT_FIELD(funcid);
+  WRITE_UINT_FIELD(funcresulttype);
+  WRITE_BOOL_FIELD(funcretset);
+  WRITE_BOOL_FIELD(funcvariadic);
+  WRITE_ENUM_FIELD(funcformat);
+  WRITE_UINT_FIELD(funccollid);
+  WRITE_UINT_FIELD(inputcollid);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outNamedArgExpr(StringInfo str, const NamedArgExpr *node)
+{
+  WRITE_NODE_TYPE("NamedArgExpr");
+
+  WRITE_NODE_PTR_FIELD(arg);
+  WRITE_STRING_FIELD(name);
+  WRITE_INT_FIELD(argnumber);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outOpExpr(StringInfo str, const OpExpr *node)
+{
+  WRITE_NODE_TYPE("OpExpr");
+
+  WRITE_UINT_FIELD(opno);
+  WRITE_UINT_FIELD(opfuncid);
+  WRITE_UINT_FIELD(opresulttype);
+  WRITE_BOOL_FIELD(opretset);
+  WRITE_UINT_FIELD(opcollid);
+  WRITE_UINT_FIELD(inputcollid);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outDistinctExpr(StringInfo str, const DistinctExpr *node)
+{
+  WRITE_NODE_TYPE("OpExpr");
+
+  WRITE_UINT_FIELD(opno);
+  WRITE_UINT_FIELD(opfuncid);
+  WRITE_UINT_FIELD(opresulttype);
+  WRITE_BOOL_FIELD(opretset);
+  WRITE_UINT_FIELD(opcollid);
+  WRITE_UINT_FIELD(inputcollid);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outNullIfExpr(StringInfo str, const NullIfExpr *node)
+{
+  WRITE_NODE_TYPE("OpExpr");
+
+  WRITE_UINT_FIELD(opno);
+  WRITE_UINT_FIELD(opfuncid);
+  WRITE_UINT_FIELD(opresulttype);
+  WRITE_BOOL_FIELD(opretset);
+  WRITE_UINT_FIELD(opcollid);
+  WRITE_UINT_FIELD(inputcollid);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outScalarArrayOpExpr(StringInfo str, const ScalarArrayOpExpr *node)
+{
+  WRITE_NODE_TYPE("ScalarArrayOpExpr");
+
+  WRITE_UINT_FIELD(opno);
+  WRITE_UINT_FIELD(opfuncid);
+  WRITE_BOOL_FIELD(useOr);
+  WRITE_UINT_FIELD(inputcollid);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outBoolExpr(StringInfo str, const BoolExpr *node)
+{
+  WRITE_NODE_TYPE("BoolExpr");
+
+  WRITE_ENUM_FIELD(boolop);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outSubLink(StringInfo str, const SubLink *node)
+{
+  WRITE_NODE_TYPE("SubLink");
+
+  WRITE_ENUM_FIELD(subLinkType);
+  WRITE_INT_FIELD(subLinkId);
+  WRITE_NODE_PTR_FIELD(testexpr);
+  WRITE_NODE_PTR_FIELD(operName);
+  WRITE_NODE_PTR_FIELD(subselect);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outSubPlan(StringInfo str, const SubPlan *node)
+{
+  WRITE_NODE_TYPE("SubPlan");
+
+  WRITE_ENUM_FIELD(subLinkType);
+  WRITE_NODE_PTR_FIELD(testexpr);
+  WRITE_NODE_PTR_FIELD(paramIds);
+  WRITE_INT_FIELD(plan_id);
+  WRITE_STRING_FIELD(plan_name);
+  WRITE_UINT_FIELD(firstColType);
+  WRITE_INT_FIELD(firstColTypmod);
+  WRITE_UINT_FIELD(firstColCollation);
+  WRITE_BOOL_FIELD(useHashTable);
+  WRITE_BOOL_FIELD(unknownEqFalse);
+  WRITE_NODE_PTR_FIELD(setParam);
+  WRITE_NODE_PTR_FIELD(parParam);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_FLOAT_FIELD(startup_cost);
+  WRITE_FLOAT_FIELD(per_call_cost);
+}
+
+static void
+_outAlternativeSubPlan(StringInfo str, const AlternativeSubPlan *node)
+{
+  WRITE_NODE_TYPE("AlternativeSubPlan");
+
+  WRITE_NODE_PTR_FIELD(subplans);
+}
+
+static void
+_outFieldSelect(StringInfo str, const FieldSelect *node)
+{
+  WRITE_NODE_TYPE("FieldSelect");
+
+  WRITE_NODE_PTR_FIELD(arg);
+  WRITE_INT_FIELD(fieldnum);
+  WRITE_UINT_FIELD(resulttype);
+  WRITE_INT_FIELD(resulttypmod);
+  WRITE_UINT_FIELD(resultcollid);
+}
+
+static void
+_outFieldStore(StringInfo str, const FieldStore *node)
+{
+  WRITE_NODE_TYPE("FieldStore");
+
+  WRITE_NODE_PTR_FIELD(arg);
+  WRITE_NODE_PTR_FIELD(newvals);
+  WRITE_NODE_PTR_FIELD(fieldnums);
+  WRITE_UINT_FIELD(resulttype);
+}
+
+static void
+_outRelabelType(StringInfo str, const RelabelType *node)
+{
+  WRITE_NODE_TYPE("RelabelType");
+
+  WRITE_NODE_PTR_FIELD(arg);
+  WRITE_UINT_FIELD(resulttype);
+  WRITE_INT_FIELD(resulttypmod);
+  WRITE_UINT_FIELD(resultcollid);
+  WRITE_ENUM_FIELD(relabelformat);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outCoerceViaIO(StringInfo str, const CoerceViaIO *node)
+{
+  WRITE_NODE_TYPE("CoerceViaIO");
+
+  WRITE_NODE_PTR_FIELD(arg);
+  WRITE_UINT_FIELD(resulttype);
+  WRITE_UINT_FIELD(resultcollid);
+  WRITE_ENUM_FIELD(coerceformat);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outArrayCoerceExpr(StringInfo str, const ArrayCoerceExpr *node)
+{
+  WRITE_NODE_TYPE("ArrayCoerceExpr");
+
+  WRITE_NODE_PTR_FIELD(arg);
+  WRITE_UINT_FIELD(elemfuncid);
+  WRITE_UINT_FIELD(resulttype);
+  WRITE_INT_FIELD(resulttypmod);
+  WRITE_UINT_FIELD(resultcollid);
+  WRITE_BOOL_FIELD(isExplicit);
+  WRITE_ENUM_FIELD(coerceformat);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outConvertRowtypeExpr(StringInfo str, const ConvertRowtypeExpr *node)
+{
+  WRITE_NODE_TYPE("ConvertRowtypeExpr");
+
+  WRITE_NODE_PTR_FIELD(arg);
+  WRITE_UINT_FIELD(resulttype);
+  WRITE_ENUM_FIELD(convertformat);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outCollateExpr(StringInfo str, const CollateExpr *node)
+{
+  WRITE_NODE_TYPE("CollateExpr");
+
+  WRITE_NODE_PTR_FIELD(arg);
+  WRITE_UINT_FIELD(collOid);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outCaseExpr(StringInfo str, const CaseExpr *node)
+{
+  WRITE_NODE_TYPE("CaseExpr");
+
+  WRITE_UINT_FIELD(casetype);
+  WRITE_UINT_FIELD(casecollid);
+  WRITE_NODE_PTR_FIELD(arg);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_NODE_PTR_FIELD(defresult);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outCaseWhen(StringInfo str, const CaseWhen *node)
+{
+  WRITE_NODE_TYPE("CaseWhen");
+
+  WRITE_NODE_PTR_FIELD(expr);
+  WRITE_NODE_PTR_FIELD(result);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outCaseTestExpr(StringInfo str, const CaseTestExpr *node)
+{
+  WRITE_NODE_TYPE("CaseTestExpr");
+
+  WRITE_UINT_FIELD(typeId);
+  WRITE_INT_FIELD(typeMod);
+  WRITE_UINT_FIELD(collation);
+}
+
+static void
+_outArrayExpr(StringInfo str, const ArrayExpr *node)
+{
+  WRITE_NODE_TYPE("ArrayExpr");
+
+  WRITE_UINT_FIELD(array_typeid);
+  WRITE_UINT_FIELD(array_collid);
+  WRITE_UINT_FIELD(element_typeid);
+  WRITE_NODE_PTR_FIELD(elements);
+  WRITE_BOOL_FIELD(multidims);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outRowExpr(StringInfo str, const RowExpr *node)
+{
+  WRITE_NODE_TYPE("RowExpr");
+
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_UINT_FIELD(row_typeid);
+  WRITE_ENUM_FIELD(row_format);
+  WRITE_NODE_PTR_FIELD(colnames);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outRowCompareExpr(StringInfo str, const RowCompareExpr *node)
+{
+  WRITE_NODE_TYPE("RowCompareExpr");
+
+  WRITE_ENUM_FIELD(rctype);
+  WRITE_NODE_PTR_FIELD(opnos);
+  WRITE_NODE_PTR_FIELD(opfamilies);
+  WRITE_NODE_PTR_FIELD(inputcollids);
+  WRITE_NODE_PTR_FIELD(largs);
+  WRITE_NODE_PTR_FIELD(rargs);
+}
+
+static void
+_outCoalesceExpr(StringInfo str, const CoalesceExpr *node)
+{
+  WRITE_NODE_TYPE("CoalesceExpr");
+
+  WRITE_UINT_FIELD(coalescetype);
+  WRITE_UINT_FIELD(coalescecollid);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outMinMaxExpr(StringInfo str, const MinMaxExpr *node)
+{
+  WRITE_NODE_TYPE("MinMaxExpr");
+
+  WRITE_UINT_FIELD(minmaxtype);
+  WRITE_UINT_FIELD(minmaxcollid);
+  WRITE_UINT_FIELD(inputcollid);
+  WRITE_ENUM_FIELD(op);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outXmlExpr(StringInfo str, const XmlExpr *node)
+{
+  WRITE_NODE_TYPE("XmlExpr");
+
+  WRITE_ENUM_FIELD(op);
+  WRITE_STRING_FIELD(name);
+  WRITE_NODE_PTR_FIELD(named_args);
+  WRITE_NODE_PTR_FIELD(arg_names);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_ENUM_FIELD(xmloption);
+  WRITE_UINT_FIELD(type);
+  WRITE_INT_FIELD(typmod);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outNullTest(StringInfo str, const NullTest *node)
+{
+  WRITE_NODE_TYPE("NullTest");
+
+  WRITE_NODE_PTR_FIELD(arg);
+  WRITE_ENUM_FIELD(nulltesttype);
+  WRITE_BOOL_FIELD(argisrow);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outBooleanTest(StringInfo str, const BooleanTest *node)
+{
+  WRITE_NODE_TYPE("BooleanTest");
+
+  WRITE_NODE_PTR_FIELD(arg);
+  WRITE_ENUM_FIELD(booltesttype);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outCoerceToDomain(StringInfo str, const CoerceToDomain *node)
+{
+  WRITE_NODE_TYPE("CoerceToDomain");
+
+  WRITE_NODE_PTR_FIELD(arg);
+  WRITE_UINT_FIELD(resulttype);
+  WRITE_INT_FIELD(resulttypmod);
+  WRITE_UINT_FIELD(resultcollid);
+  WRITE_ENUM_FIELD(coercionformat);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outCoerceToDomainValue(StringInfo str, const CoerceToDomainValue *node)
+{
+  WRITE_NODE_TYPE("CoerceToDomainValue");
+
+  WRITE_UINT_FIELD(typeId);
+  WRITE_INT_FIELD(typeMod);
+  WRITE_UINT_FIELD(collation);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outSetToDefault(StringInfo str, const SetToDefault *node)
+{
+  WRITE_NODE_TYPE("SetToDefault");
+
+  WRITE_UINT_FIELD(typeId);
+  WRITE_INT_FIELD(typeMod);
+  WRITE_UINT_FIELD(collation);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outCurrentOfExpr(StringInfo str, const CurrentOfExpr *node)
+{
+  WRITE_NODE_TYPE("CurrentOfExpr");
+
+  WRITE_UINT_FIELD(cvarno);
+  WRITE_STRING_FIELD(cursor_name);
+  WRITE_INT_FIELD(cursor_param);
+}
+
+static void
+_outInferenceElem(StringInfo str, const InferenceElem *node)
+{
+  WRITE_NODE_TYPE("InferenceElem");
+
+  WRITE_NODE_PTR_FIELD(expr);
+  WRITE_UINT_FIELD(infercollid);
+  WRITE_UINT_FIELD(inferopclass);
+}
+
+static void
+_outTargetEntry(StringInfo str, const TargetEntry *node)
+{
+  WRITE_NODE_TYPE("TargetEntry");
+
+  WRITE_NODE_PTR_FIELD(expr);
+  WRITE_INT_FIELD(resno);
+  WRITE_STRING_FIELD(resname);
+  WRITE_UINT_FIELD(ressortgroupref);
+  WRITE_UINT_FIELD(resorigtbl);
+  WRITE_INT_FIELD(resorigcol);
+  WRITE_BOOL_FIELD(resjunk);
+}
+
+static void
+_outRangeTblRef(StringInfo str, const RangeTblRef *node)
+{
+  WRITE_NODE_TYPE("RangeTblRef");
+
+  WRITE_INT_FIELD(rtindex);
+}
+
+static void
+_outJoinExpr(StringInfo str, const JoinExpr *node)
+{
+  WRITE_NODE_TYPE("JoinExpr");
+
+  WRITE_ENUM_FIELD(jointype);
+  WRITE_BOOL_FIELD(isNatural);
+  WRITE_NODE_PTR_FIELD(larg);
+  WRITE_NODE_PTR_FIELD(rarg);
+  WRITE_NODE_PTR_FIELD(usingClause);
+  WRITE_NODE_PTR_FIELD(quals);
+  WRITE_NODE_PTR_FIELD(alias);
+  WRITE_INT_FIELD(rtindex);
+}
+
+static void
+_outFromExpr(StringInfo str, const FromExpr *node)
+{
+  WRITE_NODE_TYPE("FromExpr");
+
+  WRITE_NODE_PTR_FIELD(fromlist);
+  WRITE_NODE_PTR_FIELD(quals);
+}
+
+static void
+_outOnConflictExpr(StringInfo str, const OnConflictExpr *node)
+{
+  WRITE_NODE_TYPE("OnConflictExpr");
+
+  WRITE_ENUM_FIELD(action);
+  WRITE_NODE_PTR_FIELD(arbiterElems);
+  WRITE_NODE_PTR_FIELD(arbiterWhere);
+  WRITE_UINT_FIELD(constraint);
+  WRITE_NODE_PTR_FIELD(onConflictSet);
+  WRITE_NODE_PTR_FIELD(onConflictWhere);
+  WRITE_INT_FIELD(exclRelIndex);
+  WRITE_NODE_PTR_FIELD(exclRelTlist);
+}
+
+static void
+_outIntoClause(StringInfo str, const IntoClause *node)
+{
+  WRITE_NODE_TYPE("IntoClause");
+
+  WRITE_NODE_PTR_FIELD(rel);
+  WRITE_NODE_PTR_FIELD(colNames);
+  WRITE_NODE_PTR_FIELD(options);
+  WRITE_ENUM_FIELD(onCommit);
+  WRITE_STRING_FIELD(tableSpaceName);
+  WRITE_NODE_PTR_FIELD(viewQuery);
+  WRITE_BOOL_FIELD(skipData);
+}
+
+static void
+_outQuery(StringInfo str, const Query *node)
+{
+  WRITE_NODE_TYPE("Query");
+
+  WRITE_ENUM_FIELD(commandType);
+  WRITE_ENUM_FIELD(querySource);
+  WRITE_BOOL_FIELD(canSetTag);
+  WRITE_NODE_PTR_FIELD(utilityStmt);
+  WRITE_INT_FIELD(resultRelation);
+  WRITE_BOOL_FIELD(hasAggs);
+  WRITE_BOOL_FIELD(hasWindowFuncs);
+  WRITE_BOOL_FIELD(hasSubLinks);
+  WRITE_BOOL_FIELD(hasDistinctOn);
+  WRITE_BOOL_FIELD(hasRecursive);
+  WRITE_BOOL_FIELD(hasModifyingCTE);
+  WRITE_BOOL_FIELD(hasForUpdate);
+  WRITE_BOOL_FIELD(hasRowSecurity);
+  WRITE_NODE_PTR_FIELD(cteList);
+  WRITE_NODE_PTR_FIELD(rtable);
+  WRITE_NODE_PTR_FIELD(jointree);
+  WRITE_NODE_PTR_FIELD(targetList);
+  WRITE_NODE_PTR_FIELD(onConflict);
+  WRITE_NODE_PTR_FIELD(returningList);
+  WRITE_NODE_PTR_FIELD(groupClause);
+  WRITE_NODE_PTR_FIELD(groupingSets);
+  WRITE_NODE_PTR_FIELD(havingQual);
+  WRITE_NODE_PTR_FIELD(windowClause);
+  WRITE_NODE_PTR_FIELD(distinctClause);
+  WRITE_NODE_PTR_FIELD(sortClause);
+  WRITE_NODE_PTR_FIELD(limitOffset);
+  WRITE_NODE_PTR_FIELD(limitCount);
+  WRITE_NODE_PTR_FIELD(rowMarks);
+  WRITE_NODE_PTR_FIELD(setOperations);
+  WRITE_NODE_PTR_FIELD(constraintDeps);
+  WRITE_NODE_PTR_FIELD(withCheckOptions);
+}
+
+static void
+_outInsertStmt(StringInfo str, const InsertStmt *node)
+{
+  WRITE_NODE_TYPE("InsertStmt");
+
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_NODE_PTR_FIELD(cols);
+  WRITE_NODE_PTR_FIELD(selectStmt);
+  WRITE_NODE_PTR_FIELD(onConflictClause);
+  WRITE_NODE_PTR_FIELD(returningList);
+  WRITE_NODE_PTR_FIELD(withClause);
+}
+
+static void
+_outDeleteStmt(StringInfo str, const DeleteStmt *node)
+{
+  WRITE_NODE_TYPE("DeleteStmt");
+
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_NODE_PTR_FIELD(usingClause);
+  WRITE_NODE_PTR_FIELD(whereClause);
+  WRITE_NODE_PTR_FIELD(returningList);
+  WRITE_NODE_PTR_FIELD(withClause);
+}
+
+static void
+_outUpdateStmt(StringInfo str, const UpdateStmt *node)
+{
+  WRITE_NODE_TYPE("UpdateStmt");
+
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_NODE_PTR_FIELD(targetList);
+  WRITE_NODE_PTR_FIELD(whereClause);
+  WRITE_NODE_PTR_FIELD(fromClause);
+  WRITE_NODE_PTR_FIELD(returningList);
+  WRITE_NODE_PTR_FIELD(withClause);
+}
+
+static void
+_outSelectStmt(StringInfo str, const SelectStmt *node)
+{
+  WRITE_NODE_TYPE("SelectStmt");
+
+  WRITE_NODE_PTR_FIELD(distinctClause);
+  WRITE_NODE_PTR_FIELD(intoClause);
+  WRITE_NODE_PTR_FIELD(targetList);
+  WRITE_NODE_PTR_FIELD(fromClause);
+  WRITE_NODE_PTR_FIELD(whereClause);
+  WRITE_NODE_PTR_FIELD(groupClause);
+  WRITE_NODE_PTR_FIELD(havingClause);
+  WRITE_NODE_PTR_FIELD(windowClause);
+  WRITE_NODE_PTR_FIELD(valuesLists);
+  WRITE_NODE_PTR_FIELD(sortClause);
+  WRITE_NODE_PTR_FIELD(limitOffset);
+  WRITE_NODE_PTR_FIELD(limitCount);
+  WRITE_NODE_PTR_FIELD(lockingClause);
+  WRITE_NODE_PTR_FIELD(withClause);
+  WRITE_ENUM_FIELD(op);
+  WRITE_BOOL_FIELD(all);
+  WRITE_NODE_PTR_FIELD(larg);
+  WRITE_NODE_PTR_FIELD(rarg);
+}
+
+static void
+_outAlterTableStmt(StringInfo str, const AlterTableStmt *node)
+{
+  WRITE_NODE_TYPE("AlterTableStmt");
+
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_NODE_PTR_FIELD(cmds);
+  WRITE_ENUM_FIELD(relkind);
+  WRITE_BOOL_FIELD(missing_ok);
+}
+
+static void
+_outAlterTableCmd(StringInfo str, const AlterTableCmd *node)
+{
+  WRITE_NODE_TYPE("AlterTableCmd");
+
+  WRITE_ENUM_FIELD(subtype);
+  WRITE_STRING_FIELD(name);
+  WRITE_NODE_PTR_FIELD(newowner);
+  WRITE_NODE_PTR_FIELD(def);
+  WRITE_ENUM_FIELD(behavior);
+  WRITE_BOOL_FIELD(missing_ok);
+}
+
+static void
+_outAlterDomainStmt(StringInfo str, const AlterDomainStmt *node)
+{
+  WRITE_NODE_TYPE("AlterDomainStmt");
+
+  WRITE_CHAR_FIELD(subtype);
+  WRITE_NODE_PTR_FIELD(typeName);
+  WRITE_STRING_FIELD(name);
+  WRITE_NODE_PTR_FIELD(def);
+  WRITE_ENUM_FIELD(behavior);
+  WRITE_BOOL_FIELD(missing_ok);
+}
+
+static void
+_outSetOperationStmt(StringInfo str, const SetOperationStmt *node)
+{
+  WRITE_NODE_TYPE("SetOperationStmt");
+
+  WRITE_ENUM_FIELD(op);
+  WRITE_BOOL_FIELD(all);
+  WRITE_NODE_PTR_FIELD(larg);
+  WRITE_NODE_PTR_FIELD(rarg);
+  WRITE_NODE_PTR_FIELD(colTypes);
+  WRITE_NODE_PTR_FIELD(colTypmods);
+  WRITE_NODE_PTR_FIELD(colCollations);
+  WRITE_NODE_PTR_FIELD(groupClauses);
+}
+
+static void
+_outGrantStmt(StringInfo str, const GrantStmt *node)
+{
+  WRITE_NODE_TYPE("GrantStmt");
+
+  WRITE_BOOL_FIELD(is_grant);
+  WRITE_ENUM_FIELD(targtype);
+  WRITE_ENUM_FIELD(objtype);
+  WRITE_NODE_PTR_FIELD(objects);
+  WRITE_NODE_PTR_FIELD(privileges);
+  WRITE_NODE_PTR_FIELD(grantees);
+  WRITE_BOOL_FIELD(grant_option);
+  WRITE_ENUM_FIELD(behavior);
+}
+
+static void
+_outGrantRoleStmt(StringInfo str, const GrantRoleStmt *node)
+{
+  WRITE_NODE_TYPE("GrantRoleStmt");
+
+  WRITE_NODE_PTR_FIELD(granted_roles);
+  WRITE_NODE_PTR_FIELD(grantee_roles);
+  WRITE_BOOL_FIELD(is_grant);
+  WRITE_BOOL_FIELD(admin_opt);
+  WRITE_NODE_PTR_FIELD(grantor);
+  WRITE_ENUM_FIELD(behavior);
+}
+
+static void
+_outAlterDefaultPrivilegesStmt(StringInfo str, const AlterDefaultPrivilegesStmt *node)
+{
+  WRITE_NODE_TYPE("AlterDefaultPrivilegesStmt");
+
+  WRITE_NODE_PTR_FIELD(options);
+  WRITE_NODE_PTR_FIELD(action);
+}
+
+static void
+_outClosePortalStmt(StringInfo str, const ClosePortalStmt *node)
+{
+  WRITE_NODE_TYPE("ClosePortalStmt");
+
+  WRITE_STRING_FIELD(portalname);
+}
+
+static void
+_outClusterStmt(StringInfo str, const ClusterStmt *node)
+{
+  WRITE_NODE_TYPE("ClusterStmt");
+
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_STRING_FIELD(indexname);
+  WRITE_BOOL_FIELD(verbose);
+}
+
+static void
+_outCopyStmt(StringInfo str, const CopyStmt *node)
+{
+  WRITE_NODE_TYPE("CopyStmt");
+
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_NODE_PTR_FIELD(query);
+  WRITE_NODE_PTR_FIELD(attlist);
+  WRITE_BOOL_FIELD(is_from);
+  WRITE_BOOL_FIELD(is_program);
+  WRITE_STRING_FIELD(filename);
+  WRITE_NODE_PTR_FIELD(options);
+}
+
+static void
+_outCreateStmt(StringInfo str, const CreateStmt *node)
+{
+  WRITE_NODE_TYPE("CreateStmt");
+
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_NODE_PTR_FIELD(tableElts);
+  WRITE_NODE_PTR_FIELD(inhRelations);
+  WRITE_NODE_PTR_FIELD(ofTypename);
+  WRITE_NODE_PTR_FIELD(constraints);
+  WRITE_NODE_PTR_FIELD(options);
+  WRITE_ENUM_FIELD(oncommit);
+  WRITE_STRING_FIELD(tablespacename);
+  WRITE_BOOL_FIELD(if_not_exists);
+}
+
+static void
+_outDefineStmt(StringInfo str, const DefineStmt *node)
+{
+  WRITE_NODE_TYPE("DefineStmt");
+
+  WRITE_ENUM_FIELD(kind);
+  WRITE_BOOL_FIELD(oldstyle);
+  WRITE_NODE_PTR_FIELD(defnames);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_NODE_PTR_FIELD(definition);
+}
+
+static void
+_outDropStmt(StringInfo str, const DropStmt *node)
+{
+  WRITE_NODE_TYPE("DropStmt");
+
+  WRITE_NODE_PTR_FIELD(objects);
+  WRITE_NODE_PTR_FIELD(arguments);
+  WRITE_ENUM_FIELD(removeType);
+  WRITE_ENUM_FIELD(behavior);
+  WRITE_BOOL_FIELD(missing_ok);
+  WRITE_BOOL_FIELD(concurrent);
+}
+
+static void
+_outTruncateStmt(StringInfo str, const TruncateStmt *node)
+{
+  WRITE_NODE_TYPE("TruncateStmt");
+
+  WRITE_NODE_PTR_FIELD(relations);
+  WRITE_BOOL_FIELD(restart_seqs);
+  WRITE_ENUM_FIELD(behavior);
+}
+
+static void
+_outCommentStmt(StringInfo str, const CommentStmt *node)
+{
+  WRITE_NODE_TYPE("CommentStmt");
+
+  WRITE_ENUM_FIELD(objtype);
+  WRITE_NODE_PTR_FIELD(objname);
+  WRITE_NODE_PTR_FIELD(objargs);
+  WRITE_STRING_FIELD(comment);
+}
+
+static void
+_outFetchStmt(StringInfo str, const FetchStmt *node)
+{
+  WRITE_NODE_TYPE("FetchStmt");
+
+  WRITE_ENUM_FIELD(direction);
+  WRITE_LONG_FIELD(howMany);
+  WRITE_STRING_FIELD(portalname);
+  WRITE_BOOL_FIELD(ismove);
+}
+
+static void
+_outIndexStmt(StringInfo str, const IndexStmt *node)
+{
+  WRITE_NODE_TYPE("IndexStmt");
+
+  WRITE_STRING_FIELD(idxname);
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_STRING_FIELD(accessMethod);
+  WRITE_STRING_FIELD(tableSpace);
+  WRITE_NODE_PTR_FIELD(indexParams);
+  WRITE_NODE_PTR_FIELD(options);
+  WRITE_NODE_PTR_FIELD(whereClause);
+  WRITE_NODE_PTR_FIELD(excludeOpNames);
+  WRITE_STRING_FIELD(idxcomment);
+  WRITE_UINT_FIELD(indexOid);
+  WRITE_UINT_FIELD(oldNode);
+  WRITE_BOOL_FIELD(unique);
+  WRITE_BOOL_FIELD(primary);
+  WRITE_BOOL_FIELD(isconstraint);
+  WRITE_BOOL_FIELD(deferrable);
+  WRITE_BOOL_FIELD(initdeferred);
+  WRITE_BOOL_FIELD(transformed);
+  WRITE_BOOL_FIELD(concurrent);
+  WRITE_BOOL_FIELD(if_not_exists);
+}
+
+static void
+_outCreateFunctionStmt(StringInfo str, const CreateFunctionStmt *node)
+{
+  WRITE_NODE_TYPE("CreateFunctionStmt");
+
+  WRITE_BOOL_FIELD(replace);
+  WRITE_NODE_PTR_FIELD(funcname);
+  WRITE_NODE_PTR_FIELD(parameters);
+  WRITE_NODE_PTR_FIELD(returnType);
+  WRITE_NODE_PTR_FIELD(options);
+  WRITE_NODE_PTR_FIELD(withClause);
+}
+
+static void
+_outAlterFunctionStmt(StringInfo str, const AlterFunctionStmt *node)
+{
+  WRITE_NODE_TYPE("AlterFunctionStmt");
+
+  WRITE_NODE_PTR_FIELD(func);
+  WRITE_NODE_PTR_FIELD(actions);
+}
+
+static void
+_outDoStmt(StringInfo str, const DoStmt *node)
+{
+  WRITE_NODE_TYPE("DoStmt");
+
+  WRITE_NODE_PTR_FIELD(args);
+}
+
+static void
+_outRenameStmt(StringInfo str, const RenameStmt *node)
+{
+  WRITE_NODE_TYPE("RenameStmt");
+
+  WRITE_ENUM_FIELD(renameType);
+  WRITE_ENUM_FIELD(relationType);
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_NODE_PTR_FIELD(object);
+  WRITE_NODE_PTR_FIELD(objarg);
+  WRITE_STRING_FIELD(subname);
+  WRITE_STRING_FIELD(newname);
+  WRITE_ENUM_FIELD(behavior);
+  WRITE_BOOL_FIELD(missing_ok);
+}
+
+static void
+_outRuleStmt(StringInfo str, const RuleStmt *node)
+{
+  WRITE_NODE_TYPE("RuleStmt");
+
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_STRING_FIELD(rulename);
+  WRITE_NODE_PTR_FIELD(whereClause);
+  WRITE_ENUM_FIELD(event);
+  WRITE_BOOL_FIELD(instead);
+  WRITE_NODE_PTR_FIELD(actions);
+  WRITE_BOOL_FIELD(replace);
+}
+
+static void
+_outNotifyStmt(StringInfo str, const NotifyStmt *node)
+{
+  WRITE_NODE_TYPE("NotifyStmt");
+
+  WRITE_STRING_FIELD(conditionname);
+  WRITE_STRING_FIELD(payload);
+}
+
+static void
+_outListenStmt(StringInfo str, const ListenStmt *node)
+{
+  WRITE_NODE_TYPE("ListenStmt");
+
+  WRITE_STRING_FIELD(conditionname);
+}
+
+static void
+_outUnlistenStmt(StringInfo str, const UnlistenStmt *node)
+{
+  WRITE_NODE_TYPE("UnlistenStmt");
+
+  WRITE_STRING_FIELD(conditionname);
+}
+
+static void
+_outTransactionStmt(StringInfo str, const TransactionStmt *node)
+{
+  WRITE_NODE_TYPE("TransactionStmt");
+
+  WRITE_ENUM_FIELD(kind);
+  WRITE_NODE_PTR_FIELD(options);
+  WRITE_STRING_FIELD(gid);
+}
+
+static void
+_outViewStmt(StringInfo str, const ViewStmt *node)
+{
+  WRITE_NODE_TYPE("ViewStmt");
+
+  WRITE_NODE_PTR_FIELD(view);
+  WRITE_NODE_PTR_FIELD(aliases);
+  WRITE_NODE_PTR_FIELD(query);
+  WRITE_BOOL_FIELD(replace);
+  WRITE_NODE_PTR_FIELD(options);
+  WRITE_ENUM_FIELD(withCheckOption);
+}
+
+static void
+_outLoadStmt(StringInfo str, const LoadStmt *node)
+{
+  WRITE_NODE_TYPE("LoadStmt");
+
+  WRITE_STRING_FIELD(filename);
+}
+
+static void
+_outCreateDomainStmt(StringInfo str, const CreateDomainStmt *node)
+{
+  WRITE_NODE_TYPE("CreateDomainStmt");
+
+  WRITE_NODE_PTR_FIELD(domainname);
+  WRITE_NODE_PTR_FIELD(typeName);
+  WRITE_NODE_PTR_FIELD(collClause);
+  WRITE_NODE_PTR_FIELD(constraints);
+}
+
+static void
+_outCreatedbStmt(StringInfo str, const CreatedbStmt *node)
+{
+  WRITE_NODE_TYPE("CreatedbStmt");
+
+  WRITE_STRING_FIELD(dbname);
+  WRITE_NODE_PTR_FIELD(options);
+}
+
+static void
+_outDropdbStmt(StringInfo str, const DropdbStmt *node)
+{
+  WRITE_NODE_TYPE("DropdbStmt");
+
+  WRITE_STRING_FIELD(dbname);
+  WRITE_BOOL_FIELD(missing_ok);
+}
+
+static void
+_outVacuumStmt(StringInfo str, const VacuumStmt *node)
+{
+  WRITE_NODE_TYPE("VacuumStmt");
+
+  WRITE_INT_FIELD(options);
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_NODE_PTR_FIELD(va_cols);
+}
+
+static void
+_outExplainStmt(StringInfo str, const ExplainStmt *node)
+{
+  WRITE_NODE_TYPE("ExplainStmt");
+
+  WRITE_NODE_PTR_FIELD(query);
+  WRITE_NODE_PTR_FIELD(options);
+}
+
+static void
+_outCreateTableAsStmt(StringInfo str, const CreateTableAsStmt *node)
+{
+  WRITE_NODE_TYPE("CreateTableAsStmt");
+
+  WRITE_NODE_PTR_FIELD(query);
+  WRITE_NODE_PTR_FIELD(into);
+  WRITE_ENUM_FIELD(relkind);
+  WRITE_BOOL_FIELD(is_select_into);
+  WRITE_BOOL_FIELD(if_not_exists);
+}
+
+static void
+_outCreateSeqStmt(StringInfo str, const CreateSeqStmt *node)
+{
+  WRITE_NODE_TYPE("CreateSeqStmt");
+
+  WRITE_NODE_PTR_FIELD(sequence);
+  WRITE_NODE_PTR_FIELD(options);
+  WRITE_UINT_FIELD(ownerId);
+  WRITE_BOOL_FIELD(if_not_exists);
+}
+
+static void
+_outAlterSeqStmt(StringInfo str, const AlterSeqStmt *node)
+{
+  WRITE_NODE_TYPE("AlterSeqStmt");
+
+  WRITE_NODE_PTR_FIELD(sequence);
+  WRITE_NODE_PTR_FIELD(options);
+  WRITE_BOOL_FIELD(missing_ok);
+}
+
+static void
+_outVariableSetStmt(StringInfo str, const VariableSetStmt *node)
+{
+  WRITE_NODE_TYPE("VariableSetStmt");
+
+  WRITE_ENUM_FIELD(kind);
+  WRITE_STRING_FIELD(name);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_BOOL_FIELD(is_local);
+}
+
+static void
+_outVariableShowStmt(StringInfo str, const VariableShowStmt *node)
+{
+  WRITE_NODE_TYPE("VariableShowStmt");
+
+  WRITE_STRING_FIELD(name);
+}
+
+static void
+_outDiscardStmt(StringInfo str, const DiscardStmt *node)
+{
+  WRITE_NODE_TYPE("DiscardStmt");
+
+  WRITE_ENUM_FIELD(target);
+}
+
+static void
+_outCreateTrigStmt(StringInfo str, const CreateTrigStmt *node)
+{
+  WRITE_NODE_TYPE("CreateTrigStmt");
+
+  WRITE_STRING_FIELD(trigname);
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_NODE_PTR_FIELD(funcname);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_BOOL_FIELD(row);
+  WRITE_INT_FIELD(timing);
+  WRITE_INT_FIELD(events);
+  WRITE_NODE_PTR_FIELD(columns);
+  WRITE_NODE_PTR_FIELD(whenClause);
+  WRITE_BOOL_FIELD(isconstraint);
+  WRITE_BOOL_FIELD(deferrable);
+  WRITE_BOOL_FIELD(initdeferred);
+  WRITE_NODE_PTR_FIELD(constrrel);
+}
+
+static void
+_outCreatePLangStmt(StringInfo str, const CreatePLangStmt *node)
+{
+  WRITE_NODE_TYPE("CreatePLangStmt");
+
+  WRITE_BOOL_FIELD(replace);
+  WRITE_STRING_FIELD(plname);
+  WRITE_NODE_PTR_FIELD(plhandler);
+  WRITE_NODE_PTR_FIELD(plinline);
+  WRITE_NODE_PTR_FIELD(plvalidator);
+  WRITE_BOOL_FIELD(pltrusted);
+}
+
+static void
+_outCreateRoleStmt(StringInfo str, const CreateRoleStmt *node)
+{
+  WRITE_NODE_TYPE("CreateRoleStmt");
+
+  WRITE_ENUM_FIELD(stmt_type);
+  WRITE_STRING_FIELD(role);
+  WRITE_NODE_PTR_FIELD(options);
+}
+
+static void
+_outAlterRoleStmt(StringInfo str, const AlterRoleStmt *node)
+{
+  WRITE_NODE_TYPE("AlterRoleStmt");
+
+  WRITE_NODE_PTR_FIELD(role);
+  WRITE_NODE_PTR_FIELD(options);
+  WRITE_INT_FIELD(action);
+}
+
+static void
+_outDropRoleStmt(StringInfo str, const DropRoleStmt *node)
+{
+  WRITE_NODE_TYPE("DropRoleStmt");
+
+  WRITE_NODE_PTR_FIELD(roles);
+  WRITE_BOOL_FIELD(missing_ok);
+}
+
+static void
+_outLockStmt(StringInfo str, const LockStmt *node)
+{
+  WRITE_NODE_TYPE("LockStmt");
+
+  WRITE_NODE_PTR_FIELD(relations);
+  WRITE_INT_FIELD(mode);
+  WRITE_BOOL_FIELD(nowait);
+}
+
+static void
+_outConstraintsSetStmt(StringInfo str, const ConstraintsSetStmt *node)
+{
+  WRITE_NODE_TYPE("ConstraintsSetStmt");
+
+  WRITE_NODE_PTR_FIELD(constraints);
+  WRITE_BOOL_FIELD(deferred);
+}
+
+static void
+_outReindexStmt(StringInfo str, const ReindexStmt *node)
+{
+  WRITE_NODE_TYPE("ReindexStmt");
+
+  WRITE_ENUM_FIELD(kind);
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_STRING_FIELD(name);
+  WRITE_INT_FIELD(options);
+}
+
+static void
+_outCheckPointStmt(StringInfo str, const CheckPointStmt *node)
+{
+  WRITE_NODE_TYPE("CheckPointStmt");
+
+}
+
+static void
+_outCreateSchemaStmt(StringInfo str, const CreateSchemaStmt *node)
+{
+  WRITE_NODE_TYPE("CreateSchemaStmt");
+
+  WRITE_STRING_FIELD(schemaname);
+  WRITE_NODE_PTR_FIELD(authrole);
+  WRITE_NODE_PTR_FIELD(schemaElts);
+  WRITE_BOOL_FIELD(if_not_exists);
+}
+
+static void
+_outAlterDatabaseStmt(StringInfo str, const AlterDatabaseStmt *node)
+{
+  WRITE_NODE_TYPE("AlterDatabaseStmt");
+
+  WRITE_STRING_FIELD(dbname);
+  WRITE_NODE_PTR_FIELD(options);
+}
+
+static void
+_outAlterDatabaseSetStmt(StringInfo str, const AlterDatabaseSetStmt *node)
+{
+  WRITE_NODE_TYPE("AlterDatabaseSetStmt");
+
+  WRITE_STRING_FIELD(dbname);
+  WRITE_NODE_PTR_FIELD(setstmt);
+}
+
+static void
+_outAlterRoleSetStmt(StringInfo str, const AlterRoleSetStmt *node)
+{
+  WRITE_NODE_TYPE("AlterRoleSetStmt");
+
+  WRITE_NODE_PTR_FIELD(role);
+  WRITE_STRING_FIELD(database);
+  WRITE_NODE_PTR_FIELD(setstmt);
+}
+
+static void
+_outCreateConversionStmt(StringInfo str, const CreateConversionStmt *node)
+{
+  WRITE_NODE_TYPE("CreateConversionStmt");
+
+  WRITE_NODE_PTR_FIELD(conversion_name);
+  WRITE_STRING_FIELD(for_encoding_name);
+  WRITE_STRING_FIELD(to_encoding_name);
+  WRITE_NODE_PTR_FIELD(func_name);
+  WRITE_BOOL_FIELD(def);
+}
+
+static void
+_outCreateCastStmt(StringInfo str, const CreateCastStmt *node)
+{
+  WRITE_NODE_TYPE("CreateCastStmt");
+
+  WRITE_NODE_PTR_FIELD(sourcetype);
+  WRITE_NODE_PTR_FIELD(targettype);
+  WRITE_NODE_PTR_FIELD(func);
+  WRITE_ENUM_FIELD(context);
+  WRITE_BOOL_FIELD(inout);
+}
+
+static void
+_outCreateOpClassStmt(StringInfo str, const CreateOpClassStmt *node)
+{
+  WRITE_NODE_TYPE("CreateOpClassStmt");
+
+  WRITE_NODE_PTR_FIELD(opclassname);
+  WRITE_NODE_PTR_FIELD(opfamilyname);
+  WRITE_STRING_FIELD(amname);
+  WRITE_NODE_PTR_FIELD(datatype);
+  WRITE_NODE_PTR_FIELD(items);
+  WRITE_BOOL_FIELD(isDefault);
+}
+
+static void
+_outCreateOpFamilyStmt(StringInfo str, const CreateOpFamilyStmt *node)
+{
+  WRITE_NODE_TYPE("CreateOpFamilyStmt");
+
+  WRITE_NODE_PTR_FIELD(opfamilyname);
+  WRITE_STRING_FIELD(amname);
+}
+
+static void
+_outAlterOpFamilyStmt(StringInfo str, const AlterOpFamilyStmt *node)
+{
+  WRITE_NODE_TYPE("AlterOpFamilyStmt");
+
+  WRITE_NODE_PTR_FIELD(opfamilyname);
+  WRITE_STRING_FIELD(amname);
+  WRITE_BOOL_FIELD(isDrop);
+  WRITE_NODE_PTR_FIELD(items);
+}
+
+static void
+_outPrepareStmt(StringInfo str, const PrepareStmt *node)
+{
+  WRITE_NODE_TYPE("PrepareStmt");
+
+  WRITE_STRING_FIELD(name);
+  WRITE_NODE_PTR_FIELD(argtypes);
+  WRITE_NODE_PTR_FIELD(query);
+}
+
+static void
+_outExecuteStmt(StringInfo str, const ExecuteStmt *node)
+{
+  WRITE_NODE_TYPE("ExecuteStmt");
+
+  WRITE_STRING_FIELD(name);
+  WRITE_NODE_PTR_FIELD(params);
+}
+
+static void
+_outDeallocateStmt(StringInfo str, const DeallocateStmt *node)
+{
+  WRITE_NODE_TYPE("DeallocateStmt");
+
+  WRITE_STRING_FIELD(name);
+}
+
+static void
+_outDeclareCursorStmt(StringInfo str, const DeclareCursorStmt *node)
+{
+  WRITE_NODE_TYPE("DeclareCursorStmt");
+
+  WRITE_STRING_FIELD(portalname);
+  WRITE_INT_FIELD(options);
+  WRITE_NODE_PTR_FIELD(query);
+}
+
+static void
+_outCreateTableSpaceStmt(StringInfo str, const CreateTableSpaceStmt *node)
+{
+  WRITE_NODE_TYPE("CreateTableSpaceStmt");
+
+  WRITE_STRING_FIELD(tablespacename);
+  WRITE_NODE_PTR_FIELD(owner);
+  WRITE_STRING_FIELD(location);
+  WRITE_NODE_PTR_FIELD(options);
+}
+
+static void
+_outDropTableSpaceStmt(StringInfo str, const DropTableSpaceStmt *node)
+{
+  WRITE_NODE_TYPE("DropTableSpaceStmt");
+
+  WRITE_STRING_FIELD(tablespacename);
+  WRITE_BOOL_FIELD(missing_ok);
+}
+
+static void
+_outAlterObjectSchemaStmt(StringInfo str, const AlterObjectSchemaStmt *node)
+{
+  WRITE_NODE_TYPE("AlterObjectSchemaStmt");
+
+  WRITE_ENUM_FIELD(objectType);
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_NODE_PTR_FIELD(object);
+  WRITE_NODE_PTR_FIELD(objarg);
+  WRITE_STRING_FIELD(newschema);
+  WRITE_BOOL_FIELD(missing_ok);
+}
+
+static void
+_outAlterOwnerStmt(StringInfo str, const AlterOwnerStmt *node)
+{
+  WRITE_NODE_TYPE("AlterOwnerStmt");
+
+  WRITE_ENUM_FIELD(objectType);
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_NODE_PTR_FIELD(object);
+  WRITE_NODE_PTR_FIELD(objarg);
+  WRITE_NODE_PTR_FIELD(newowner);
+}
+
+static void
+_outDropOwnedStmt(StringInfo str, const DropOwnedStmt *node)
+{
+  WRITE_NODE_TYPE("DropOwnedStmt");
+
+  WRITE_NODE_PTR_FIELD(roles);
+  WRITE_ENUM_FIELD(behavior);
+}
+
+static void
+_outReassignOwnedStmt(StringInfo str, const ReassignOwnedStmt *node)
+{
+  WRITE_NODE_TYPE("ReassignOwnedStmt");
+
+  WRITE_NODE_PTR_FIELD(roles);
+  WRITE_NODE_PTR_FIELD(newrole);
+}
+
+static void
+_outCompositeTypeStmt(StringInfo str, const CompositeTypeStmt *node)
+{
+  WRITE_NODE_TYPE("CompositeTypeStmt");
+
+  WRITE_NODE_PTR_FIELD(typevar);
+  WRITE_NODE_PTR_FIELD(coldeflist);
+}
+
+static void
+_outCreateEnumStmt(StringInfo str, const CreateEnumStmt *node)
+{
+  WRITE_NODE_TYPE("CreateEnumStmt");
+
+  WRITE_NODE_PTR_FIELD(typeName);
+  WRITE_NODE_PTR_FIELD(vals);
+}
+
+static void
+_outCreateRangeStmt(StringInfo str, const CreateRangeStmt *node)
+{
+  WRITE_NODE_TYPE("CreateRangeStmt");
+
+  WRITE_NODE_PTR_FIELD(typeName);
+  WRITE_NODE_PTR_FIELD(params);
+}
+
+static void
+_outAlterEnumStmt(StringInfo str, const AlterEnumStmt *node)
+{
+  WRITE_NODE_TYPE("AlterEnumStmt");
+
+  WRITE_NODE_PTR_FIELD(typeName);
+  WRITE_STRING_FIELD(newVal);
+  WRITE_STRING_FIELD(newValNeighbor);
+  WRITE_BOOL_FIELD(newValIsAfter);
+  WRITE_BOOL_FIELD(skipIfExists);
+}
+
+static void
+_outAlterTSDictionaryStmt(StringInfo str, const AlterTSDictionaryStmt *node)
+{
+  WRITE_NODE_TYPE("AlterTSDictionaryStmt");
+
+  WRITE_NODE_PTR_FIELD(dictname);
+  WRITE_NODE_PTR_FIELD(options);
+}
+
+static void
+_outAlterTSConfigurationStmt(StringInfo str, const AlterTSConfigurationStmt *node)
+{
+  WRITE_NODE_TYPE("AlterTSConfigurationStmt");
+
+  WRITE_ENUM_FIELD(kind);
+  WRITE_NODE_PTR_FIELD(cfgname);
+  WRITE_NODE_PTR_FIELD(tokentype);
+  WRITE_NODE_PTR_FIELD(dicts);
+  WRITE_BOOL_FIELD(override);
+  WRITE_BOOL_FIELD(replace);
+  WRITE_BOOL_FIELD(missing_ok);
+}
+
+static void
+_outCreateFdwStmt(StringInfo str, const CreateFdwStmt *node)
+{
+  WRITE_NODE_TYPE("CreateFdwStmt");
+
+  WRITE_STRING_FIELD(fdwname);
+  WRITE_NODE_PTR_FIELD(func_options);
+  WRITE_NODE_PTR_FIELD(options);
+}
+
+static void
+_outAlterFdwStmt(StringInfo str, const AlterFdwStmt *node)
+{
+  WRITE_NODE_TYPE("AlterFdwStmt");
+
+  WRITE_STRING_FIELD(fdwname);
+  WRITE_NODE_PTR_FIELD(func_options);
+  WRITE_NODE_PTR_FIELD(options);
+}
+
+static void
+_outCreateForeignServerStmt(StringInfo str, const CreateForeignServerStmt *node)
+{
+  WRITE_NODE_TYPE("CreateForeignServerStmt");
+
+  WRITE_STRING_FIELD(servername);
+  WRITE_STRING_FIELD(servertype);
+  WRITE_STRING_FIELD(version);
+  WRITE_STRING_FIELD(fdwname);
+  WRITE_NODE_PTR_FIELD(options);
+}
+
+static void
+_outAlterForeignServerStmt(StringInfo str, const AlterForeignServerStmt *node)
+{
+  WRITE_NODE_TYPE("AlterForeignServerStmt");
+
+  WRITE_STRING_FIELD(servername);
+  WRITE_STRING_FIELD(version);
+  WRITE_NODE_PTR_FIELD(options);
+  WRITE_BOOL_FIELD(has_version);
+}
+
+static void
+_outCreateUserMappingStmt(StringInfo str, const CreateUserMappingStmt *node)
+{
+  WRITE_NODE_TYPE("CreateUserMappingStmt");
+
+  WRITE_NODE_PTR_FIELD(user);
+  WRITE_STRING_FIELD(servername);
+  WRITE_NODE_PTR_FIELD(options);
+}
+
+static void
+_outAlterUserMappingStmt(StringInfo str, const AlterUserMappingStmt *node)
+{
+  WRITE_NODE_TYPE("AlterUserMappingStmt");
+
+  WRITE_NODE_PTR_FIELD(user);
+  WRITE_STRING_FIELD(servername);
+  WRITE_NODE_PTR_FIELD(options);
+}
+
+static void
+_outDropUserMappingStmt(StringInfo str, const DropUserMappingStmt *node)
+{
+  WRITE_NODE_TYPE("DropUserMappingStmt");
+
+  WRITE_NODE_PTR_FIELD(user);
+  WRITE_STRING_FIELD(servername);
+  WRITE_BOOL_FIELD(missing_ok);
+}
+
+static void
+_outAlterTableSpaceOptionsStmt(StringInfo str, const AlterTableSpaceOptionsStmt *node)
+{
+  WRITE_NODE_TYPE("AlterTableSpaceOptionsStmt");
+
+  WRITE_STRING_FIELD(tablespacename);
+  WRITE_NODE_PTR_FIELD(options);
+  WRITE_BOOL_FIELD(isReset);
+}
+
+static void
+_outAlterTableMoveAllStmt(StringInfo str, const AlterTableMoveAllStmt *node)
+{
+  WRITE_NODE_TYPE("AlterTableMoveAllStmt");
+
+  WRITE_STRING_FIELD(orig_tablespacename);
+  WRITE_ENUM_FIELD(objtype);
+  WRITE_NODE_PTR_FIELD(roles);
+  WRITE_STRING_FIELD(new_tablespacename);
+  WRITE_BOOL_FIELD(nowait);
+}
+
+static void
+_outSecLabelStmt(StringInfo str, const SecLabelStmt *node)
+{
+  WRITE_NODE_TYPE("SecLabelStmt");
+
+  WRITE_ENUM_FIELD(objtype);
+  WRITE_NODE_PTR_FIELD(objname);
+  WRITE_NODE_PTR_FIELD(objargs);
+  WRITE_STRING_FIELD(provider);
+  WRITE_STRING_FIELD(label);
+}
+
+static void
+_outCreateForeignTableStmt(StringInfo str, const CreateForeignTableStmt *node)
+{
+  WRITE_NODE_TYPE("CreateForeignTableStmt");
+
+  WRITE_NODE_FIELD_WITH_TYPE(base, CreateStmt);
+  WRITE_STRING_FIELD(servername);
+  WRITE_NODE_PTR_FIELD(options);
+}
+
+static void
+_outImportForeignSchemaStmt(StringInfo str, const ImportForeignSchemaStmt *node)
+{
+  WRITE_NODE_TYPE("ImportForeignSchemaStmt");
+
+  WRITE_STRING_FIELD(server_name);
+  WRITE_STRING_FIELD(remote_schema);
+  WRITE_STRING_FIELD(local_schema);
+  WRITE_ENUM_FIELD(list_type);
+  WRITE_NODE_PTR_FIELD(table_list);
+  WRITE_NODE_PTR_FIELD(options);
+}
+
+static void
+_outCreateExtensionStmt(StringInfo str, const CreateExtensionStmt *node)
+{
+  WRITE_NODE_TYPE("CreateExtensionStmt");
+
+  WRITE_STRING_FIELD(extname);
+  WRITE_BOOL_FIELD(if_not_exists);
+  WRITE_NODE_PTR_FIELD(options);
+}
+
+static void
+_outAlterExtensionStmt(StringInfo str, const AlterExtensionStmt *node)
+{
+  WRITE_NODE_TYPE("AlterExtensionStmt");
+
+  WRITE_STRING_FIELD(extname);
+  WRITE_NODE_PTR_FIELD(options);
+}
+
+static void
+_outAlterExtensionContentsStmt(StringInfo str, const AlterExtensionContentsStmt *node)
+{
+  WRITE_NODE_TYPE("AlterExtensionContentsStmt");
+
+  WRITE_STRING_FIELD(extname);
+  WRITE_INT_FIELD(action);
+  WRITE_ENUM_FIELD(objtype);
+  WRITE_NODE_PTR_FIELD(objname);
+  WRITE_NODE_PTR_FIELD(objargs);
+}
+
+static void
+_outCreateEventTrigStmt(StringInfo str, const CreateEventTrigStmt *node)
+{
+  WRITE_NODE_TYPE("CreateEventTrigStmt");
+
+  WRITE_STRING_FIELD(trigname);
+  WRITE_STRING_FIELD(eventname);
+  WRITE_NODE_PTR_FIELD(whenclause);
+  WRITE_NODE_PTR_FIELD(funcname);
+}
+
+static void
+_outAlterEventTrigStmt(StringInfo str, const AlterEventTrigStmt *node)
+{
+  WRITE_NODE_TYPE("AlterEventTrigStmt");
+
+  WRITE_STRING_FIELD(trigname);
+  WRITE_CHAR_FIELD(tgenabled);
+}
+
+static void
+_outRefreshMatViewStmt(StringInfo str, const RefreshMatViewStmt *node)
+{
+  WRITE_NODE_TYPE("RefreshMatViewStmt");
+
+  WRITE_BOOL_FIELD(concurrent);
+  WRITE_BOOL_FIELD(skipData);
+  WRITE_NODE_PTR_FIELD(relation);
+}
+
+static void
+_outReplicaIdentityStmt(StringInfo str, const ReplicaIdentityStmt *node)
+{
+  WRITE_NODE_TYPE("ReplicaIdentityStmt");
+
+  WRITE_CHAR_FIELD(identity_type);
+  WRITE_STRING_FIELD(name);
+}
+
+static void
+_outAlterSystemStmt(StringInfo str, const AlterSystemStmt *node)
+{
+  WRITE_NODE_TYPE("AlterSystemStmt");
+
+  WRITE_NODE_PTR_FIELD(setstmt);
+}
+
+static void
+_outCreatePolicyStmt(StringInfo str, const CreatePolicyStmt *node)
+{
+  WRITE_NODE_TYPE("CreatePolicyStmt");
+
+  WRITE_STRING_FIELD(policy_name);
+  WRITE_NODE_PTR_FIELD(table);
+  WRITE_STRING_FIELD(cmd_name);
+  WRITE_NODE_PTR_FIELD(roles);
+  WRITE_NODE_PTR_FIELD(qual);
+  WRITE_NODE_PTR_FIELD(with_check);
+}
+
+static void
+_outAlterPolicyStmt(StringInfo str, const AlterPolicyStmt *node)
+{
+  WRITE_NODE_TYPE("AlterPolicyStmt");
+
+  WRITE_STRING_FIELD(policy_name);
+  WRITE_NODE_PTR_FIELD(table);
+  WRITE_NODE_PTR_FIELD(roles);
+  WRITE_NODE_PTR_FIELD(qual);
+  WRITE_NODE_PTR_FIELD(with_check);
+}
+
+static void
+_outCreateTransformStmt(StringInfo str, const CreateTransformStmt *node)
+{
+  WRITE_NODE_TYPE("CreateTransformStmt");
+
+  WRITE_BOOL_FIELD(replace);
+  WRITE_NODE_PTR_FIELD(type_name);
+  WRITE_STRING_FIELD(lang);
+  WRITE_NODE_PTR_FIELD(fromsql);
+  WRITE_NODE_PTR_FIELD(tosql);
+}
+
+static void
+_outA_Expr(StringInfo str, const A_Expr *node)
+{
+  WRITE_NODE_TYPE("A_Expr");
+
+  WRITE_ENUM_FIELD(kind);
+  WRITE_NODE_PTR_FIELD(name);
+  WRITE_NODE_PTR_FIELD(lexpr);
+  WRITE_NODE_PTR_FIELD(rexpr);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outColumnRef(StringInfo str, const ColumnRef *node)
+{
+  WRITE_NODE_TYPE("ColumnRef");
+
+  WRITE_NODE_PTR_FIELD(fields);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outParamRef(StringInfo str, const ParamRef *node)
+{
+  WRITE_NODE_TYPE("ParamRef");
+
+  WRITE_INT_FIELD(number);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outA_Const(StringInfo str, const A_Const *node)
+{
+  WRITE_NODE_TYPE("A_Const");
+
+  WRITE_NODE_FIELD(val);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outFuncCall(StringInfo str, const FuncCall *node)
+{
+  WRITE_NODE_TYPE("FuncCall");
+
+  WRITE_NODE_PTR_FIELD(funcname);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_NODE_PTR_FIELD(agg_order);
+  WRITE_NODE_PTR_FIELD(agg_filter);
+  WRITE_BOOL_FIELD(agg_within_group);
+  WRITE_BOOL_FIELD(agg_star);
+  WRITE_BOOL_FIELD(agg_distinct);
+  WRITE_BOOL_FIELD(func_variadic);
+  WRITE_NODE_PTR_FIELD(over);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outA_Star(StringInfo str, const A_Star *node)
+{
+  WRITE_NODE_TYPE("A_Star");
+
+}
+
+static void
+_outA_Indices(StringInfo str, const A_Indices *node)
+{
+  WRITE_NODE_TYPE("A_Indices");
+
+  WRITE_NODE_PTR_FIELD(lidx);
+  WRITE_NODE_PTR_FIELD(uidx);
+}
+
+static void
+_outA_Indirection(StringInfo str, const A_Indirection *node)
+{
+  WRITE_NODE_TYPE("A_Indirection");
+
+  WRITE_NODE_PTR_FIELD(arg);
+  WRITE_NODE_PTR_FIELD(indirection);
+}
+
+static void
+_outA_ArrayExpr(StringInfo str, const A_ArrayExpr *node)
+{
+  WRITE_NODE_TYPE("A_ArrayExpr");
+
+  WRITE_NODE_PTR_FIELD(elements);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outResTarget(StringInfo str, const ResTarget *node)
+{
+  WRITE_NODE_TYPE("ResTarget");
+
+  WRITE_STRING_FIELD(name);
+  WRITE_NODE_PTR_FIELD(indirection);
+  WRITE_NODE_PTR_FIELD(val);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outMultiAssignRef(StringInfo str, const MultiAssignRef *node)
+{
+  WRITE_NODE_TYPE("MultiAssignRef");
+
+  WRITE_NODE_PTR_FIELD(source);
+  WRITE_INT_FIELD(colno);
+  WRITE_INT_FIELD(ncolumns);
+}
+
+static void
+_outTypeCast(StringInfo str, const TypeCast *node)
+{
+  WRITE_NODE_TYPE("TypeCast");
+
+  WRITE_NODE_PTR_FIELD(arg);
+  WRITE_NODE_PTR_FIELD(typeName);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outCollateClause(StringInfo str, const CollateClause *node)
+{
+  WRITE_NODE_TYPE("CollateClause");
+
+  WRITE_NODE_PTR_FIELD(arg);
+  WRITE_NODE_PTR_FIELD(collname);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outSortBy(StringInfo str, const SortBy *node)
+{
+  WRITE_NODE_TYPE("SortBy");
+
+  WRITE_NODE_PTR_FIELD(node);
+  WRITE_ENUM_FIELD(sortby_dir);
+  WRITE_ENUM_FIELD(sortby_nulls);
+  WRITE_NODE_PTR_FIELD(useOp);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outWindowDef(StringInfo str, const WindowDef *node)
+{
+  WRITE_NODE_TYPE("WindowDef");
+
+  WRITE_STRING_FIELD(name);
+  WRITE_STRING_FIELD(refname);
+  WRITE_NODE_PTR_FIELD(partitionClause);
+  WRITE_NODE_PTR_FIELD(orderClause);
+  WRITE_INT_FIELD(frameOptions);
+  WRITE_NODE_PTR_FIELD(startOffset);
+  WRITE_NODE_PTR_FIELD(endOffset);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outRangeSubselect(StringInfo str, const RangeSubselect *node)
+{
+  WRITE_NODE_TYPE("RangeSubselect");
+
+  WRITE_BOOL_FIELD(lateral);
+  WRITE_NODE_PTR_FIELD(subquery);
+  WRITE_NODE_PTR_FIELD(alias);
+}
+
+static void
+_outRangeFunction(StringInfo str, const RangeFunction *node)
+{
+  WRITE_NODE_TYPE("RangeFunction");
+
+  WRITE_BOOL_FIELD(lateral);
+  WRITE_BOOL_FIELD(ordinality);
+  WRITE_BOOL_FIELD(is_rowsfrom);
+  WRITE_NODE_PTR_FIELD(functions);
+  WRITE_NODE_PTR_FIELD(alias);
+  WRITE_NODE_PTR_FIELD(coldeflist);
+}
+
+static void
+_outRangeTableSample(StringInfo str, const RangeTableSample *node)
+{
+  WRITE_NODE_TYPE("RangeTableSample");
+
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_NODE_PTR_FIELD(method);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_NODE_PTR_FIELD(repeatable);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outTypeName(StringInfo str, const TypeName *node)
+{
+  WRITE_NODE_TYPE("TypeName");
+
+  WRITE_NODE_PTR_FIELD(names);
+  WRITE_UINT_FIELD(typeOid);
+  WRITE_BOOL_FIELD(setof);
+  WRITE_BOOL_FIELD(pct_type);
+  WRITE_NODE_PTR_FIELD(typmods);
+  WRITE_INT_FIELD(typemod);
+  WRITE_NODE_PTR_FIELD(arrayBounds);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outColumnDef(StringInfo str, const ColumnDef *node)
+{
+  WRITE_NODE_TYPE("ColumnDef");
+
+  WRITE_STRING_FIELD(colname);
+  WRITE_NODE_PTR_FIELD(typeName);
+  WRITE_INT_FIELD(inhcount);
+  WRITE_BOOL_FIELD(is_local);
+  WRITE_BOOL_FIELD(is_not_null);
+  WRITE_BOOL_FIELD(is_from_type);
+  WRITE_CHAR_FIELD(storage);
+  WRITE_NODE_PTR_FIELD(raw_default);
+  WRITE_NODE_PTR_FIELD(cooked_default);
+  WRITE_NODE_PTR_FIELD(collClause);
+  WRITE_UINT_FIELD(collOid);
+  WRITE_NODE_PTR_FIELD(constraints);
+  WRITE_NODE_PTR_FIELD(fdwoptions);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outIndexElem(StringInfo str, const IndexElem *node)
+{
+  WRITE_NODE_TYPE("IndexElem");
+
+  WRITE_STRING_FIELD(name);
+  WRITE_NODE_PTR_FIELD(expr);
+  WRITE_STRING_FIELD(indexcolname);
+  WRITE_NODE_PTR_FIELD(collation);
+  WRITE_NODE_PTR_FIELD(opclass);
+  WRITE_ENUM_FIELD(ordering);
+  WRITE_ENUM_FIELD(nulls_ordering);
+}
+
+static void
+_outConstraint(StringInfo str, const Constraint *node)
+{
+  WRITE_NODE_TYPE("Constraint");
+
+  WRITE_ENUM_FIELD(contype);
+  WRITE_STRING_FIELD(conname);
+  WRITE_BOOL_FIELD(deferrable);
+  WRITE_BOOL_FIELD(initdeferred);
+  WRITE_INT_FIELD(location);
+  WRITE_BOOL_FIELD(is_no_inherit);
+  WRITE_NODE_PTR_FIELD(raw_expr);
+  WRITE_STRING_FIELD(cooked_expr);
+  WRITE_NODE_PTR_FIELD(keys);
+  WRITE_NODE_PTR_FIELD(exclusions);
+  WRITE_NODE_PTR_FIELD(options);
+  WRITE_STRING_FIELD(indexname);
+  WRITE_STRING_FIELD(indexspace);
+  WRITE_STRING_FIELD(access_method);
+  WRITE_NODE_PTR_FIELD(where_clause);
+  WRITE_NODE_PTR_FIELD(pktable);
+  WRITE_NODE_PTR_FIELD(fk_attrs);
+  WRITE_NODE_PTR_FIELD(pk_attrs);
+  WRITE_CHAR_FIELD(fk_matchtype);
+  WRITE_CHAR_FIELD(fk_upd_action);
+  WRITE_CHAR_FIELD(fk_del_action);
+  WRITE_NODE_PTR_FIELD(old_conpfeqop);
+  WRITE_UINT_FIELD(old_pktable_oid);
+  WRITE_BOOL_FIELD(skip_validation);
+  WRITE_BOOL_FIELD(initially_valid);
+}
+
+static void
+_outDefElem(StringInfo str, const DefElem *node)
+{
+  WRITE_NODE_TYPE("DefElem");
+
+  WRITE_STRING_FIELD(defnamespace);
+  WRITE_STRING_FIELD(defname);
+  WRITE_NODE_PTR_FIELD(arg);
+  WRITE_ENUM_FIELD(defaction);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outRangeTblEntry(StringInfo str, const RangeTblEntry *node)
+{
+  WRITE_NODE_TYPE("RangeTblEntry");
+
+  WRITE_ENUM_FIELD(rtekind);
+  WRITE_UINT_FIELD(relid);
+  WRITE_CHAR_FIELD(relkind);
+  WRITE_NODE_PTR_FIELD(tablesample);
+  WRITE_NODE_PTR_FIELD(subquery);
+  WRITE_BOOL_FIELD(security_barrier);
+  WRITE_ENUM_FIELD(jointype);
+  WRITE_NODE_PTR_FIELD(joinaliasvars);
+  WRITE_NODE_PTR_FIELD(functions);
+  WRITE_BOOL_FIELD(funcordinality);
+  WRITE_NODE_PTR_FIELD(values_lists);
+  WRITE_NODE_PTR_FIELD(values_collations);
+  WRITE_STRING_FIELD(ctename);
+  WRITE_UINT_FIELD(ctelevelsup);
+  WRITE_BOOL_FIELD(self_reference);
+  WRITE_NODE_PTR_FIELD(ctecoltypes);
+  WRITE_NODE_PTR_FIELD(ctecoltypmods);
+  WRITE_NODE_PTR_FIELD(ctecolcollations);
+  WRITE_NODE_PTR_FIELD(alias);
+  WRITE_NODE_PTR_FIELD(eref);
+  WRITE_BOOL_FIELD(lateral);
+  WRITE_BOOL_FIELD(inh);
+  WRITE_BOOL_FIELD(inFromCl);
+  WRITE_ENUM_FIELD(requiredPerms);
+  WRITE_UINT_FIELD(checkAsUser);
+  WRITE_BITMAPSET_FIELD(selectedCols);
+  WRITE_BITMAPSET_FIELD(insertedCols);
+  WRITE_BITMAPSET_FIELD(updatedCols);
+  WRITE_NODE_PTR_FIELD(securityQuals);
+}
+
+static void
+_outRangeTblFunction(StringInfo str, const RangeTblFunction *node)
+{
+  WRITE_NODE_TYPE("RangeTblFunction");
+
+  WRITE_NODE_PTR_FIELD(funcexpr);
+  WRITE_INT_FIELD(funccolcount);
+  WRITE_NODE_PTR_FIELD(funccolnames);
+  WRITE_NODE_PTR_FIELD(funccoltypes);
+  WRITE_NODE_PTR_FIELD(funccoltypmods);
+  WRITE_NODE_PTR_FIELD(funccolcollations);
+  WRITE_BITMAPSET_FIELD(funcparams);
+}
+
+static void
+_outTableSampleClause(StringInfo str, const TableSampleClause *node)
+{
+  WRITE_NODE_TYPE("TableSampleClause");
+
+  WRITE_UINT_FIELD(tsmhandler);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_NODE_PTR_FIELD(repeatable);
+}
+
+static void
+_outWithCheckOption(StringInfo str, const WithCheckOption *node)
+{
+  WRITE_NODE_TYPE("WithCheckOption");
+
+  WRITE_ENUM_FIELD(kind);
+  WRITE_STRING_FIELD(relname);
+  WRITE_STRING_FIELD(polname);
+  WRITE_NODE_PTR_FIELD(qual);
+  WRITE_BOOL_FIELD(cascaded);
+}
+
+static void
+_outSortGroupClause(StringInfo str, const SortGroupClause *node)
+{
+  WRITE_NODE_TYPE("SortGroupClause");
+
+  WRITE_UINT_FIELD(tleSortGroupRef);
+  WRITE_UINT_FIELD(eqop);
+  WRITE_UINT_FIELD(sortop);
+  WRITE_BOOL_FIELD(nulls_first);
+  WRITE_BOOL_FIELD(hashable);
+}
+
+static void
+_outGroupingSet(StringInfo str, const GroupingSet *node)
+{
+  WRITE_NODE_TYPE("GroupingSet");
+
+  WRITE_ENUM_FIELD(kind);
+  WRITE_NODE_PTR_FIELD(content);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outWindowClause(StringInfo str, const WindowClause *node)
+{
+  WRITE_NODE_TYPE("WindowClause");
+
+  WRITE_STRING_FIELD(name);
+  WRITE_STRING_FIELD(refname);
+  WRITE_NODE_PTR_FIELD(partitionClause);
+  WRITE_NODE_PTR_FIELD(orderClause);
+  WRITE_INT_FIELD(frameOptions);
+  WRITE_NODE_PTR_FIELD(startOffset);
+  WRITE_NODE_PTR_FIELD(endOffset);
+  WRITE_UINT_FIELD(winref);
+  WRITE_BOOL_FIELD(copiedOrder);
+}
+
+static void
+_outFuncWithArgs(StringInfo str, const FuncWithArgs *node)
+{
+  WRITE_NODE_TYPE("FuncWithArgs");
+
+  WRITE_NODE_PTR_FIELD(funcname);
+  WRITE_NODE_PTR_FIELD(funcargs);
+}
+
+static void
+_outAccessPriv(StringInfo str, const AccessPriv *node)
+{
+  WRITE_NODE_TYPE("AccessPriv");
+
+  WRITE_STRING_FIELD(priv_name);
+  WRITE_NODE_PTR_FIELD(cols);
+}
+
+static void
+_outCreateOpClassItem(StringInfo str, const CreateOpClassItem *node)
+{
+  WRITE_NODE_TYPE("CreateOpClassItem");
+
+  WRITE_INT_FIELD(itemtype);
+  WRITE_NODE_PTR_FIELD(name);
+  WRITE_NODE_PTR_FIELD(args);
+  WRITE_INT_FIELD(number);
+  WRITE_NODE_PTR_FIELD(order_family);
+  WRITE_NODE_PTR_FIELD(class_args);
+  WRITE_NODE_PTR_FIELD(storedtype);
+}
+
+static void
+_outTableLikeClause(StringInfo str, const TableLikeClause *node)
+{
+  WRITE_NODE_TYPE("TableLikeClause");
+
+  WRITE_NODE_PTR_FIELD(relation);
+  WRITE_UINT_FIELD(options);
+}
+
+static void
+_outFunctionParameter(StringInfo str, const FunctionParameter *node)
+{
+  WRITE_NODE_TYPE("FunctionParameter");
+
+  WRITE_STRING_FIELD(name);
+  WRITE_NODE_PTR_FIELD(argType);
+  WRITE_ENUM_FIELD(mode);
+  WRITE_NODE_PTR_FIELD(defexpr);
+}
+
+static void
+_outLockingClause(StringInfo str, const LockingClause *node)
+{
+  WRITE_NODE_TYPE("LockingClause");
+
+  WRITE_NODE_PTR_FIELD(lockedRels);
+  WRITE_ENUM_FIELD(strength);
+  WRITE_ENUM_FIELD(waitPolicy);
+}
+
+static void
+_outRowMarkClause(StringInfo str, const RowMarkClause *node)
+{
+  WRITE_NODE_TYPE("RowMarkClause");
+
+  WRITE_UINT_FIELD(rti);
+  WRITE_ENUM_FIELD(strength);
+  WRITE_ENUM_FIELD(waitPolicy);
+  WRITE_BOOL_FIELD(pushedDown);
+}
+
+static void
+_outXmlSerialize(StringInfo str, const XmlSerialize *node)
+{
+  WRITE_NODE_TYPE("XmlSerialize");
+
+  WRITE_ENUM_FIELD(xmloption);
+  WRITE_NODE_PTR_FIELD(expr);
+  WRITE_NODE_PTR_FIELD(typeName);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outWithClause(StringInfo str, const WithClause *node)
+{
+  WRITE_NODE_TYPE("WithClause");
+
+  WRITE_NODE_PTR_FIELD(ctes);
+  WRITE_BOOL_FIELD(recursive);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outInferClause(StringInfo str, const InferClause *node)
+{
+  WRITE_NODE_TYPE("InferClause");
+
+  WRITE_NODE_PTR_FIELD(indexElems);
+  WRITE_NODE_PTR_FIELD(whereClause);
+  WRITE_STRING_FIELD(conname);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outOnConflictClause(StringInfo str, const OnConflictClause *node)
+{
+  WRITE_NODE_TYPE("OnConflictClause");
+
+  WRITE_ENUM_FIELD(action);
+  WRITE_NODE_PTR_FIELD(infer);
+  WRITE_NODE_PTR_FIELD(targetList);
+  WRITE_NODE_PTR_FIELD(whereClause);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outCommonTableExpr(StringInfo str, const CommonTableExpr *node)
+{
+  WRITE_NODE_TYPE("CommonTableExpr");
+
+  WRITE_STRING_FIELD(ctename);
+  WRITE_NODE_PTR_FIELD(aliascolnames);
+  WRITE_NODE_PTR_FIELD(ctequery);
+  WRITE_INT_FIELD(location);
+  WRITE_BOOL_FIELD(cterecursive);
+  WRITE_INT_FIELD(cterefcount);
+  WRITE_NODE_PTR_FIELD(ctecolnames);
+  WRITE_NODE_PTR_FIELD(ctecoltypes);
+  WRITE_NODE_PTR_FIELD(ctecoltypmods);
+  WRITE_NODE_PTR_FIELD(ctecolcollations);
+}
+
+static void
+_outRoleSpec(StringInfo str, const RoleSpec *node)
+{
+  WRITE_NODE_TYPE("RoleSpec");
+
+  WRITE_ENUM_FIELD(roletype);
+  WRITE_STRING_FIELD(rolename);
+  WRITE_INT_FIELD(location);
+}
+
+static void
+_outInlineCodeBlock(StringInfo str, const InlineCodeBlock *node)
+{
+  WRITE_NODE_TYPE("InlineCodeBlock");
+
+  WRITE_STRING_FIELD(source_text);
+  WRITE_UINT_FIELD(langOid);
+  WRITE_BOOL_FIELD(langIsTrusted);
+}
+
diff --git a/foreign/libpg_query/src/pg_query_json_helper.c b/foreign/libpg_query/src/pg_query_json_helper.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/pg_query_json_helper.c
@@ -0,0 +1,129 @@
+#include "lib/stringinfo.h"
+
+/* Write the label for the node type */
+#define WRITE_NODE_TYPE(nodelabel) \
+	appendStringInfoString(str, "\"" nodelabel "\": {")
+
+/* Write an integer field */
+#define WRITE_INT_FIELD(fldname) \
+	if (node->fldname != 0) { \
+		appendStringInfo(str, "\"" CppAsString(fldname) "\": %d, ", node->fldname); \
+	}
+
+#define WRITE_INT_VALUE(fldname, value) \
+	if (value != 0) { \
+		appendStringInfo(str, "\"" CppAsString(fldname) "\": %d, ", value); \
+	}
+
+/* Write an unsigned integer field */
+#define WRITE_UINT_FIELD(fldname) \
+	if (node->fldname != 0) { \
+		appendStringInfo(str, "\"" CppAsString(fldname) "\": %u, ", node->fldname); \
+	}
+
+/* Write a long-integer field */
+#define WRITE_LONG_FIELD(fldname) \
+	if (node->fldname != 0) { \
+		appendStringInfo(str, "\"" CppAsString(fldname) "\": %ld, ", node->fldname); \
+	}
+
+/* Write a char field (ie, one ascii character) */
+#define WRITE_CHAR_FIELD(fldname) \
+	if (node->fldname != 0) { \
+		appendStringInfo(str, "\"" CppAsString(fldname) "\": \"%c\", ", node->fldname); \
+	}
+
+/* Write an enumerated-type field as an integer code */
+#define WRITE_ENUM_FIELD(fldname) \
+	appendStringInfo(str, "\"" CppAsString(fldname) "\": %d, ", \
+					 (int) node->fldname)
+
+/* Write a float field */
+#define WRITE_FLOAT_FIELD(fldname) \
+	appendStringInfo(str, "\"" CppAsString(fldname) "\": %f, ", node->fldname)
+
+/* Write a boolean field */
+#define WRITE_BOOL_FIELD(fldname) \
+	if (node->fldname) { \
+		appendStringInfo(str, "\"" CppAsString(fldname) "\": %s, ", \
+					 	booltostr(node->fldname)); \
+	}
+
+/* Write a character-string (possibly NULL) field */
+#define WRITE_STRING_FIELD(fldname) \
+	if (node->fldname != NULL) { \
+		appendStringInfo(str, "\"" CppAsString(fldname) "\": "); \
+	 	_outToken(str, node->fldname); \
+	 	appendStringInfo(str, ", "); \
+	}
+
+#define WRITE_STRING_VALUE(fldname, value) \
+	if (true) { \
+		appendStringInfo(str, "\"" CppAsString(fldname) "\": "); \
+	 	_outToken(str, value); \
+	 	appendStringInfo(str, ", "); \
+	}
+
+
+#define booltostr(x)	((x) ? "true" : "false")
+
+static void
+removeTrailingDelimiter(StringInfo str)
+{
+	if (str->len >= 2 && str->data[str->len - 2] == ',' && str->data[str->len - 1] == ' ') {
+		str->len -= 2;
+		str->data[str->len] = '\0';
+	} else if (str->len >= 1 && str->data[str->len - 1] == ',') {
+		str->len -= 1;
+		str->data[str->len] = '\0';
+	}
+}
+
+static void
+_outToken(StringInfo buf, const char *str)
+{
+	if (str == NULL)
+	{
+		appendStringInfoString(buf, "null");
+		return;
+	}
+
+	// copied directly from https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/json.c#L2428
+	const char *p;
+
+	appendStringInfoCharMacro(buf, '"');
+	for (p = str; *p; p++)
+	{
+		switch (*p)
+		{
+			case '\b':
+				appendStringInfoString(buf, "\\b");
+				break;
+			case '\f':
+				appendStringInfoString(buf, "\\f");
+				break;
+			case '\n':
+				appendStringInfoString(buf, "\\n");
+				break;
+			case '\r':
+				appendStringInfoString(buf, "\\r");
+				break;
+			case '\t':
+				appendStringInfoString(buf, "\\t");
+				break;
+			case '"':
+				appendStringInfoString(buf, "\\\"");
+				break;
+			case '\\':
+				appendStringInfoString(buf, "\\\\");
+				break;
+			default:
+				if ((unsigned char) *p < ' ')
+					appendStringInfo(buf, "\\u%04x", (int) *p);
+				else
+					appendStringInfoCharMacro(buf, *p);
+				break;
+		}
+	}
+	appendStringInfoCharMacro(buf, '"');
+}
diff --git a/foreign/libpg_query/src/pg_query_json_plpgsql.c b/foreign/libpg_query/src/pg_query_json_plpgsql.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/pg_query_json_plpgsql.c
@@ -0,0 +1,672 @@
+#include "pg_query.h"
+#include "pg_query_json_plpgsql.h"
+
+#include "pg_query_json_helper.c"
+
+#define WRITE_OBJ_FIELD(fldname, outfunc) \
+	if (node->fldname != NULL) { \
+		 appendStringInfo(str, "\"" CppAsString(fldname) "\": {"); \
+		 outfunc(str, node->fldname); \
+		 removeTrailingDelimiter(str); \
+		 appendStringInfo(str, "}}, "); \
+	}
+
+#define WRITE_LIST_FIELD(fldname, fldtype, outfunc) \
+	if (node->fldname != NULL) { \
+		ListCell *lc; \
+		appendStringInfo(str, "\"" CppAsString(fldname) "\": ["); \
+		foreach(lc, node->fldname) { \
+			appendStringInfoString(str, "{"); \
+			outfunc(str, (fldtype *) lfirst(lc)); \
+			removeTrailingDelimiter(str); \
+			appendStringInfoString(str, "}},"); \
+		} \
+		removeTrailingDelimiter(str); \
+		appendStringInfoString(str, "], "); \
+  }
+
+  #define WRITE_STATEMENTS_FIELD(fldname) \
+  	if (node->fldname != NULL) { \
+  		ListCell *lc; \
+  		appendStringInfo(str, "\"" CppAsString(fldname) "\": ["); \
+  		foreach(lc, node->fldname) { \
+  			dump_stmt(str, (PLpgSQL_stmt *) lfirst(lc)); \
+  		} \
+  		removeTrailingDelimiter(str); \
+  		appendStringInfoString(str, "],"); \
+    }
+
+#define WRITE_EXPR_FIELD(fldname)   WRITE_OBJ_FIELD(fldname, dump_expr)
+#define WRITE_BLOCK_FIELD(fldname)  WRITE_OBJ_FIELD(fldname, dump_block)
+#define WRITE_RECORD_FIELD(fldname) WRITE_OBJ_FIELD(fldname, dump_record)
+#define WRITE_ROW_FIELD(fldname)    WRITE_OBJ_FIELD(fldname, dump_row)
+#define WRITE_VAR_FIELD(fldname)    WRITE_OBJ_FIELD(fldname, dump_var)
+
+static void dump_record(StringInfo str, PLpgSQL_rec *stmt);
+static void dump_row(StringInfo str, PLpgSQL_row *stmt);
+static void dump_var(StringInfo str, PLpgSQL_var *stmt);
+static void dump_record_field(StringInfo str, PLpgSQL_recfield *node);
+static void dump_array_elem(StringInfo str, PLpgSQL_arrayelem *node);
+static void dump_stmt(StringInfo str, PLpgSQL_stmt *stmt);
+static void dump_block(StringInfo str, PLpgSQL_stmt_block *block);
+static void dump_exception_block(StringInfo str, PLpgSQL_exception_block *node);
+static void dump_assign(StringInfo str, PLpgSQL_stmt_assign *stmt);
+static void dump_if(StringInfo str, PLpgSQL_stmt_if *stmt);
+static void dump_if_elsif(StringInfo str, PLpgSQL_if_elsif *node);
+static void dump_case(StringInfo str, PLpgSQL_stmt_case *stmt);
+static void dump_case_when(StringInfo str, PLpgSQL_case_when *node);
+static void dump_loop(StringInfo str, PLpgSQL_stmt_loop *stmt);
+static void dump_while(StringInfo str, PLpgSQL_stmt_while *stmt);
+static void dump_fori(StringInfo str, PLpgSQL_stmt_fori *stmt);
+static void dump_fors(StringInfo str, PLpgSQL_stmt_fors *stmt);
+static void dump_forc(StringInfo str, PLpgSQL_stmt_forc *stmt);
+static void dump_foreach_a(StringInfo str, PLpgSQL_stmt_foreach_a *stmt);
+static void dump_exit(StringInfo str, PLpgSQL_stmt_exit *stmt);
+static void dump_return(StringInfo str, PLpgSQL_stmt_return *stmt);
+static void dump_return_next(StringInfo str, PLpgSQL_stmt_return_next *stmt);
+static void dump_return_query(StringInfo str, PLpgSQL_stmt_return_query *stmt);
+static void dump_raise(StringInfo str, PLpgSQL_stmt_raise *stmt);
+static void dump_raise_option(StringInfo str, PLpgSQL_raise_option *node);
+static void dump_execsql(StringInfo str, PLpgSQL_stmt_execsql *stmt);
+static void dump_dynexecute(StringInfo str, PLpgSQL_stmt_dynexecute *stmt);
+static void dump_dynfors(StringInfo str, PLpgSQL_stmt_dynfors *stmt);
+static void dump_getdiag(StringInfo str, PLpgSQL_stmt_getdiag *stmt);
+static void dump_getdiag_item(StringInfo str, PLpgSQL_diag_item *node);
+static void dump_open(StringInfo str, PLpgSQL_stmt_open *stmt);
+static void dump_fetch(StringInfo str, PLpgSQL_stmt_fetch *stmt);
+static void dump_close(StringInfo str, PLpgSQL_stmt_close *stmt);
+static void dump_perform(StringInfo str, PLpgSQL_stmt_perform *stmt);
+static void dump_expr(StringInfo str, PLpgSQL_expr *expr);
+static void dump_function(StringInfo str, PLpgSQL_function *func);
+static void dump_exception(StringInfo str, PLpgSQL_exception *node);
+static void dump_condition(StringInfo str, PLpgSQL_condition *node);
+static void dump_type(StringInfo str, PLpgSQL_type *node);
+
+static void
+dump_stmt(StringInfo str, PLpgSQL_stmt *node)
+{
+	appendStringInfoChar(str, '{');
+	switch ((enum PLpgSQL_stmt_types) node->cmd_type)
+	{
+		case PLPGSQL_STMT_BLOCK:
+			dump_block(str, (PLpgSQL_stmt_block *) node);
+			break;
+		case PLPGSQL_STMT_ASSIGN:
+			dump_assign(str, (PLpgSQL_stmt_assign *) node);
+			break;
+		case PLPGSQL_STMT_IF:
+			dump_if(str, (PLpgSQL_stmt_if *) node);
+			break;
+		case PLPGSQL_STMT_CASE:
+			dump_case(str, (PLpgSQL_stmt_case *) node);
+			break;
+		case PLPGSQL_STMT_LOOP:
+			dump_loop(str, (PLpgSQL_stmt_loop *) node);
+			break;
+		case PLPGSQL_STMT_WHILE:
+			dump_while(str, (PLpgSQL_stmt_while *) node);
+			break;
+		case PLPGSQL_STMT_FORI:
+			dump_fori(str, (PLpgSQL_stmt_fori *) node);
+			break;
+		case PLPGSQL_STMT_FORS:
+			dump_fors(str, (PLpgSQL_stmt_fors *) node);
+			break;
+		case PLPGSQL_STMT_FORC:
+			dump_forc(str, (PLpgSQL_stmt_forc *) node);
+			break;
+		case PLPGSQL_STMT_FOREACH_A:
+			dump_foreach_a(str, (PLpgSQL_stmt_foreach_a *) node);
+			break;
+		case PLPGSQL_STMT_EXIT:
+			dump_exit(str, (PLpgSQL_stmt_exit *) node);
+			break;
+		case PLPGSQL_STMT_RETURN:
+			dump_return(str, (PLpgSQL_stmt_return *) node);
+			break;
+		case PLPGSQL_STMT_RETURN_NEXT:
+			dump_return_next(str, (PLpgSQL_stmt_return_next *) node);
+			break;
+		case PLPGSQL_STMT_RETURN_QUERY:
+			dump_return_query(str, (PLpgSQL_stmt_return_query *) node);
+			break;
+		case PLPGSQL_STMT_RAISE:
+			dump_raise(str, (PLpgSQL_stmt_raise *) node);
+			break;
+		case PLPGSQL_STMT_EXECSQL:
+			dump_execsql(str, (PLpgSQL_stmt_execsql *) node);
+			break;
+		case PLPGSQL_STMT_DYNEXECUTE:
+			dump_dynexecute(str, (PLpgSQL_stmt_dynexecute *) node);
+			break;
+		case PLPGSQL_STMT_DYNFORS:
+			dump_dynfors(str, (PLpgSQL_stmt_dynfors *) node);
+			break;
+		case PLPGSQL_STMT_GETDIAG:
+			dump_getdiag(str, (PLpgSQL_stmt_getdiag *) node);
+			break;
+		case PLPGSQL_STMT_OPEN:
+			dump_open(str, (PLpgSQL_stmt_open *) node);
+			break;
+		case PLPGSQL_STMT_FETCH:
+			dump_fetch(str, (PLpgSQL_stmt_fetch *) node);
+			break;
+		case PLPGSQL_STMT_CLOSE:
+			dump_close(str, (PLpgSQL_stmt_close *) node);
+			break;
+		case PLPGSQL_STMT_PERFORM:
+			dump_perform(str, (PLpgSQL_stmt_perform *) node);
+			break;
+		default:
+			elog(ERROR, "unrecognized cmd_type: %d", node->cmd_type);
+			break;
+	}
+	removeTrailingDelimiter(str);
+	appendStringInfoString(str, "}}, ");
+}
+
+static void
+dump_block(StringInfo str, PLpgSQL_stmt_block *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_block");
+
+	WRITE_INT_FIELD(lineno);
+  	WRITE_STRING_FIELD(label);
+	WRITE_STATEMENTS_FIELD(body);
+	WRITE_OBJ_FIELD(exceptions, dump_exception_block);
+
+	removeTrailingDelimiter(str);
+}
+
+static void
+dump_exception_block(StringInfo str, PLpgSQL_exception_block *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_exception_block");
+
+	WRITE_LIST_FIELD(exc_list, PLpgSQL_exception, dump_exception);
+}
+
+static void
+dump_exception(StringInfo str, PLpgSQL_exception *node)
+{
+	PLpgSQL_condition *cond;
+
+	WRITE_NODE_TYPE("PLpgSQL_exception");
+
+	appendStringInfo(str, "\"conditions\": [");
+	for (cond = node->conditions; cond; cond = cond->next)
+	{
+		appendStringInfoString(str, "{");
+		dump_condition(str, cond);
+		removeTrailingDelimiter(str);
+		appendStringInfoString(str, "}},");
+	}
+	removeTrailingDelimiter(str);
+	appendStringInfoString(str, "], ");
+
+	WRITE_STATEMENTS_FIELD(action);
+}
+
+static void
+dump_condition(StringInfo str, PLpgSQL_condition *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_condition");
+
+	WRITE_STRING_FIELD(condname);
+}
+
+static void
+dump_assign(StringInfo str, PLpgSQL_stmt_assign *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_assign");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_INT_FIELD(varno);
+	WRITE_EXPR_FIELD(expr);
+}
+
+static void
+dump_if(StringInfo str, PLpgSQL_stmt_if *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_if");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_EXPR_FIELD(cond);
+	WRITE_STATEMENTS_FIELD(then_body);
+	WRITE_LIST_FIELD(elsif_list, PLpgSQL_if_elsif, dump_if_elsif);
+	WRITE_STATEMENTS_FIELD(else_body);
+}
+
+static void
+dump_if_elsif(StringInfo str, PLpgSQL_if_elsif *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_if_elsif");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_EXPR_FIELD(cond);
+	WRITE_STATEMENTS_FIELD(stmts);
+}
+
+static void
+dump_case(StringInfo str, PLpgSQL_stmt_case *node)
+{
+	ListCell   *l;
+
+	WRITE_NODE_TYPE("PLpgSQL_stmt_case");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_EXPR_FIELD(t_expr);
+	WRITE_INT_FIELD(t_varno);
+	WRITE_LIST_FIELD(case_when_list, PLpgSQL_case_when, dump_case_when);
+	WRITE_BOOL_FIELD(have_else);
+	WRITE_STATEMENTS_FIELD(else_stmts);
+}
+
+static void
+dump_case_when(StringInfo str, PLpgSQL_case_when *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_case_when");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_EXPR_FIELD(expr);
+	WRITE_STATEMENTS_FIELD(stmts);
+}
+
+static void
+dump_loop(StringInfo str, PLpgSQL_stmt_loop *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_loop");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_STRING_FIELD(label);
+	WRITE_STATEMENTS_FIELD(body);
+}
+
+static void
+dump_while(StringInfo str, PLpgSQL_stmt_while *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_while");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_STRING_FIELD(label);
+	WRITE_EXPR_FIELD(cond);
+	WRITE_STATEMENTS_FIELD(body);
+}
+
+/* FOR statement with integer loopvar	*/
+static void
+dump_fori(StringInfo str, PLpgSQL_stmt_fori *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_fori");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_STRING_FIELD(label);
+	WRITE_VAR_FIELD(var);
+	WRITE_EXPR_FIELD(lower);
+	WRITE_EXPR_FIELD(upper);
+	WRITE_EXPR_FIELD(step);
+	WRITE_BOOL_FIELD(reverse);
+	WRITE_STATEMENTS_FIELD(body);
+}
+
+static void
+dump_fors(StringInfo str, PLpgSQL_stmt_fors *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_fors");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_STRING_FIELD(label);
+	WRITE_RECORD_FIELD(rec);
+	WRITE_ROW_FIELD(row);
+	WRITE_STATEMENTS_FIELD(body);
+	WRITE_EXPR_FIELD(query);
+}
+
+static void
+dump_forc(StringInfo str, PLpgSQL_stmt_forc *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_forc");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_STRING_FIELD(label);
+	WRITE_RECORD_FIELD(rec);
+	WRITE_ROW_FIELD(row);
+	WRITE_STATEMENTS_FIELD(body);
+	WRITE_INT_FIELD(curvar);
+	WRITE_EXPR_FIELD(argquery);
+}
+
+static void
+dump_foreach_a(StringInfo str, PLpgSQL_stmt_foreach_a *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_foreach_a");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_STRING_FIELD(label);
+	WRITE_INT_FIELD(varno);
+	WRITE_INT_FIELD(slice);
+	WRITE_EXPR_FIELD(expr);
+	WRITE_STATEMENTS_FIELD(body);
+}
+
+static void
+dump_open(StringInfo str, PLpgSQL_stmt_open *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_open");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_INT_FIELD(curvar);
+	WRITE_INT_FIELD(cursor_options);
+	WRITE_ROW_FIELD(returntype);
+	WRITE_EXPR_FIELD(argquery);
+	WRITE_EXPR_FIELD(query);
+	WRITE_EXPR_FIELD(dynquery);
+	WRITE_LIST_FIELD(params, PLpgSQL_expr, dump_expr);
+}
+
+static void
+dump_fetch(StringInfo str, PLpgSQL_stmt_fetch *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_fetch");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_RECORD_FIELD(rec);
+	WRITE_ROW_FIELD(row);
+	WRITE_INT_FIELD(curvar);
+	WRITE_ENUM_FIELD(direction);
+	WRITE_LONG_FIELD(how_many);
+	WRITE_EXPR_FIELD(expr);
+	WRITE_BOOL_FIELD(is_move);
+	WRITE_BOOL_FIELD(returns_multiple_rows);
+}
+
+static void
+dump_close(StringInfo str, PLpgSQL_stmt_close *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_close");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_INT_FIELD(curvar);
+}
+
+static void
+dump_perform(StringInfo str, PLpgSQL_stmt_perform *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_perform");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_EXPR_FIELD(expr);
+}
+
+static void
+dump_exit(StringInfo str, PLpgSQL_stmt_exit *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_exit");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_BOOL_FIELD(is_exit);
+	WRITE_STRING_FIELD(label);
+	WRITE_EXPR_FIELD(cond);
+}
+
+static void
+dump_return(StringInfo str, PLpgSQL_stmt_return *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_return");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_EXPR_FIELD(expr);
+	//WRITE_INT_FIELD(retvarno);
+}
+
+static void
+dump_return_next(StringInfo str, PLpgSQL_stmt_return_next *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_return_next");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_EXPR_FIELD(expr);
+	//WRITE_INT_FIELD(retvarno);
+}
+
+static void
+dump_return_query(StringInfo str, PLpgSQL_stmt_return_query *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_return_query");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_EXPR_FIELD(query);
+	WRITE_EXPR_FIELD(dynquery);
+	WRITE_LIST_FIELD(params, PLpgSQL_expr, dump_expr);
+}
+
+static void
+dump_raise(StringInfo str, PLpgSQL_stmt_raise *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_raise");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_INT_FIELD(elog_level);
+	WRITE_STRING_FIELD(condname);
+	WRITE_STRING_FIELD(message);
+	WRITE_LIST_FIELD(params, PLpgSQL_expr, dump_expr);
+	WRITE_LIST_FIELD(options, PLpgSQL_raise_option, dump_raise_option);
+}
+
+static void
+dump_raise_option(StringInfo str, PLpgSQL_raise_option *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_raise_option");
+
+	WRITE_ENUM_FIELD(opt_type);
+	WRITE_EXPR_FIELD(expr);
+}
+
+static void
+dump_execsql(StringInfo str, PLpgSQL_stmt_execsql *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_execsql");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_EXPR_FIELD(sqlstmt);
+	//WRITE_BOOL_FIELD(mod_stmt); // This is only populated when executing the function
+	WRITE_BOOL_FIELD(into);
+	WRITE_BOOL_FIELD(strict);
+	WRITE_RECORD_FIELD(rec);
+	WRITE_ROW_FIELD(row);
+}
+
+static void
+dump_dynexecute(StringInfo str, PLpgSQL_stmt_dynexecute *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_dynexecute");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_EXPR_FIELD(query);
+	WRITE_BOOL_FIELD(into);
+	WRITE_BOOL_FIELD(strict);
+	WRITE_RECORD_FIELD(rec);
+	WRITE_ROW_FIELD(row);
+	WRITE_LIST_FIELD(params, PLpgSQL_expr, dump_expr);
+}
+
+static void
+dump_dynfors(StringInfo str, PLpgSQL_stmt_dynfors *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_dynfors");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_STRING_FIELD(label);
+	WRITE_RECORD_FIELD(rec);
+	WRITE_ROW_FIELD(row);
+	WRITE_STATEMENTS_FIELD(body);
+	WRITE_EXPR_FIELD(query);
+	WRITE_LIST_FIELD(params, PLpgSQL_expr, dump_expr);
+}
+
+static void
+dump_getdiag(StringInfo str, PLpgSQL_stmt_getdiag *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_stmt_getdiag");
+
+	WRITE_INT_FIELD(lineno);
+	WRITE_BOOL_FIELD(is_stacked);
+	WRITE_LIST_FIELD(diag_items, PLpgSQL_diag_item, dump_getdiag_item);
+}
+
+static void
+dump_getdiag_item(StringInfo str, PLpgSQL_diag_item *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_diag_item");
+
+	WRITE_STRING_VALUE(kind, plpgsql_getdiag_kindname(node->kind));
+	WRITE_INT_FIELD(target);
+}
+
+static void
+dump_expr(StringInfo str, PLpgSQL_expr *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_expr");
+
+	WRITE_STRING_FIELD(query);
+}
+
+static void
+dump_function(StringInfo str, PLpgSQL_function *node)
+{
+	int			i;
+	PLpgSQL_datum *d;
+
+	WRITE_NODE_TYPE("PLpgSQL_function");
+
+	appendStringInfoString(str, "\"datums\": ");
+	appendStringInfoChar(str, '[');
+	for (i = 0; i < node->ndatums; i++)
+	{
+	  appendStringInfoChar(str, '{');
+		d = node->datums[i];
+
+		switch (d->dtype)
+		{
+			case PLPGSQL_DTYPE_VAR:
+				dump_var(str, (PLpgSQL_var *) d);
+				break;
+			case PLPGSQL_DTYPE_ROW:
+				dump_row(str, (PLpgSQL_row *) d);
+				break;
+			case PLPGSQL_DTYPE_REC:
+				dump_record(str, (PLpgSQL_rec *) d);
+				break;
+			case PLPGSQL_DTYPE_RECFIELD:
+				dump_record_field(str, (PLpgSQL_recfield *) d);
+				break;
+			case PLPGSQL_DTYPE_ARRAYELEM:
+				dump_array_elem(str, (PLpgSQL_arrayelem *) d);
+				break;
+			default:
+				elog(WARNING, "could not dump unrecognized dtype: %d",
+					 (int) d->dtype);
+		}
+		removeTrailingDelimiter(str);
+		appendStringInfoString(str, "}}, ");
+	}
+	removeTrailingDelimiter(str);
+	appendStringInfoString(str, "], ");
+
+	WRITE_BLOCK_FIELD(action);
+}
+
+static void
+dump_var(StringInfo str, PLpgSQL_var *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_var");
+
+	WRITE_STRING_FIELD(refname);
+	WRITE_INT_FIELD(lineno);
+	WRITE_OBJ_FIELD(datatype, dump_type);
+	WRITE_BOOL_FIELD(isconst);
+	WRITE_BOOL_FIELD(notnull);
+	WRITE_EXPR_FIELD(default_val);
+	WRITE_EXPR_FIELD(cursor_explicit_expr);
+	WRITE_INT_FIELD(cursor_explicit_argrow);
+	WRITE_INT_FIELD(cursor_options);
+}
+
+static void
+dump_type(StringInfo str, PLpgSQL_type *node)
+{
+	WRITE_NODE_TYPE("PLpgSQL_type");
+
+	WRITE_STRING_FIELD(typname);
+}
+
+static void
+dump_row(StringInfo str, PLpgSQL_row *node)
+{
+	int i = 0;
+
+	WRITE_NODE_TYPE("PLpgSQL_row");
+
+	WRITE_STRING_FIELD(refname);
+	WRITE_INT_FIELD(lineno);
+
+	appendStringInfoString(str, "\"fields\": ");
+	appendStringInfoChar(str, '[');
+
+	for (i = 0; i < node->nfields; i++)
+	{
+		if (node->fieldnames[i]) {
+		  appendStringInfoChar(str, '{');
+			WRITE_STRING_VALUE(name, node->fieldnames[i]);
+			WRITE_INT_VALUE(varno, node->varnos[i]);
+			removeTrailingDelimiter(str);
+			appendStringInfoString(str, "}, ");
+		} else {
+			appendStringInfoString(str, "null, ");
+		}
+	}
+	removeTrailingDelimiter(str);
+
+	appendStringInfoString(str, "], ");
+}
+
+static void
+dump_record(StringInfo str, PLpgSQL_rec *node) {
+	WRITE_NODE_TYPE("PLpgSQL_rec");
+
+	WRITE_STRING_FIELD(refname);
+	WRITE_INT_FIELD(lineno);
+}
+
+static void
+dump_record_field(StringInfo str, PLpgSQL_recfield *node) {
+	WRITE_NODE_TYPE("PLpgSQL_recfield");
+
+	WRITE_STRING_FIELD(fieldname);
+	WRITE_INT_FIELD(recparentno);
+}
+
+static void
+dump_array_elem(StringInfo str, PLpgSQL_arrayelem *node) {
+	WRITE_NODE_TYPE("PLpgSQL_arrayelem");
+
+	WRITE_EXPR_FIELD(subscript);
+	WRITE_INT_FIELD(arrayparentno);
+}
+
+char *
+plpgsqlToJSON(PLpgSQL_function *func)
+{
+	StringInfoData str;
+
+	initStringInfo(&str);
+
+	appendStringInfoChar(&str, '{');
+
+  dump_function(&str, func);
+
+	removeTrailingDelimiter(&str);
+  appendStringInfoString(&str, "}}");
+
+  return str.data;
+}
diff --git a/foreign/libpg_query/src/pg_query_json_plpgsql.h b/foreign/libpg_query/src/pg_query_json_plpgsql.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/pg_query_json_plpgsql.h
@@ -0,0 +1,8 @@
+#ifndef PG_QUERY_JSON_PLPGSQL_H
+#define PG_QUERY_JSON_PLPGSQL_H
+
+#include "plpgsql.h"
+
+char* plpgsqlToJSON(PLpgSQL_function* func);
+
+#endif
diff --git a/foreign/libpg_query/src/pg_query_normalize.c b/foreign/libpg_query/src/pg_query_normalize.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/pg_query_normalize.c
@@ -0,0 +1,372 @@
+#include "pg_query.h"
+#include "pg_query_internal.h"
+
+#include "parser/parser.h"
+#include "parser/scanner.h"
+#include "parser/scansup.h"
+#include "mb/pg_wchar.h"
+#include "nodes/nodeFuncs.h"
+
+/*
+ * Struct for tracking locations/lengths of constants during normalization
+ */
+typedef struct pgssLocationLen
+{
+	int			location;		/* start offset in query text */
+	int			length;			/* length in bytes, or -1 to ignore */
+} pgssLocationLen;
+
+/*
+ * Working state for constant tree walker
+ */
+typedef struct pgssConstLocations
+{
+	/* Array of locations of constants that should be removed */
+	pgssLocationLen *clocations;
+
+	/* Allocated length of clocations array */
+	int			clocations_buf_size;
+
+	/* Current number of valid entries in clocations array */
+	int			clocations_count;
+} pgssConstLocations;
+
+/*
+ * comp_location: comparator for qsorting pgssLocationLen structs by location
+ */
+static int
+comp_location(const void *a, const void *b)
+{
+	int			l = ((const pgssLocationLen *) a)->location;
+	int			r = ((const pgssLocationLen *) b)->location;
+
+	if (l < r)
+		return -1;
+	else if (l > r)
+		return +1;
+	else
+		return 0;
+}
+
+/*
+ * Given a valid SQL string and an array of constant-location records,
+ * fill in the textual lengths of those constants.
+ *
+ * The constants may use any allowed constant syntax, such as float literals,
+ * bit-strings, single-quoted strings and dollar-quoted strings.  This is
+ * accomplished by using the public API for the core scanner.
+ *
+ * It is the caller's job to ensure that the string is a valid SQL statement
+ * with constants at the indicated locations.  Since in practice the string
+ * has already been parsed, and the locations that the caller provides will
+ * have originated from within the authoritative parser, this should not be
+ * a problem.
+ *
+ * Duplicate constant pointers are possible, and will have their lengths
+ * marked as '-1', so that they are later ignored.  (Actually, we assume the
+ * lengths were initialized as -1 to start with, and don't change them here.)
+ *
+ * N.B. There is an assumption that a '-' character at a Const location begins
+ * a negative numeric constant.  This precludes there ever being another
+ * reason for a constant to start with a '-'.
+ */
+static void
+fill_in_constant_lengths(pgssConstLocations *jstate, const char *query)
+{
+	pgssLocationLen *locs;
+	core_yyscan_t yyscanner;
+	core_yy_extra_type yyextra;
+	core_YYSTYPE yylval;
+	YYLTYPE		yylloc;
+	int			last_loc = -1;
+	int			i;
+
+	/*
+	 * Sort the records by location so that we can process them in order while
+	 * scanning the query text.
+	 */
+	if (jstate->clocations_count > 1)
+		qsort(jstate->clocations, jstate->clocations_count,
+			  sizeof(pgssLocationLen), comp_location);
+	locs = jstate->clocations;
+
+	/* initialize the flex scanner --- should match raw_parser() */
+	yyscanner = scanner_init(query,
+							 &yyextra,
+							 ScanKeywords,
+							 NumScanKeywords);
+
+	/* Search for each constant, in sequence */
+	for (i = 0; i < jstate->clocations_count; i++)
+	{
+		int			loc = locs[i].location;
+		int			tok;
+
+		Assert(loc >= 0);
+
+		if (loc <= last_loc)
+			continue;			/* Duplicate constant, ignore */
+
+		/* Lex tokens until we find the desired constant */
+		for (;;)
+		{
+			tok = core_yylex(&yylval, &yylloc, yyscanner);
+
+			/* We should not hit end-of-string, but if we do, behave sanely */
+			if (tok == 0)
+				break;			/* out of inner for-loop */
+
+			/*
+			 * We should find the token position exactly, but if we somehow
+			 * run past it, work with that.
+			 */
+			if (yylloc >= loc)
+			{
+				if (query[loc] == '-')
+				{
+					/*
+					 * It's a negative value - this is the one and only case
+					 * where we replace more than a single token.
+					 *
+					 * Do not compensate for the core system's special-case
+					 * adjustment of location to that of the leading '-'
+					 * operator in the event of a negative constant.  It is
+					 * also useful for our purposes to start from the minus
+					 * symbol.  In this way, queries like "select * from foo
+					 * where bar = 1" and "select * from foo where bar = -2"
+					 * will have identical normalized query strings.
+					 */
+					tok = core_yylex(&yylval, &yylloc, yyscanner);
+					if (tok == 0)
+						break;	/* out of inner for-loop */
+				}
+
+				/*
+				 * We now rely on the assumption that flex has placed a zero
+				 * byte after the text of the current token in scanbuf.
+				 */
+				locs[i].length = (int) strlen(yyextra.scanbuf + loc);
+
+				/* Quoted string with Unicode escapes
+				 *
+				 * The lexer consumes trailing whitespace in order to find UESCAPE, but if there
+				 * is no UESCAPE it has still consumed it - don't include it in constant length.
+				 */
+				if (locs[i].length > 4 && /* U&'' */
+					(yyextra.scanbuf[loc] == 'u' || yyextra.scanbuf[loc] == 'U') &&
+					 yyextra.scanbuf[loc + 1] == '&' && yyextra.scanbuf[loc + 2] == '\'')
+				{
+					int j = locs[i].length - 1; /* Skip the \0 */
+					for (; j >= 0 && scanner_isspace(yyextra.scanbuf[loc + j]); j--) {}
+					locs[i].length = j + 1; /* Count the \0 */
+				}
+
+				break;			/* out of inner for-loop */
+			}
+		}
+
+		/* If we hit end-of-string, give up, leaving remaining lengths -1 */
+		if (tok == 0)
+			break;
+
+		last_loc = loc;
+	}
+
+	scanner_finish(yyscanner);
+}
+
+/*
+ * Generate a normalized version of the query string that will be used to
+ * represent all similar queries.
+ *
+ * Note that the normalized representation may well vary depending on
+ * just which "equivalent" query is used to create the hashtable entry.
+ * We assume this is OK.
+ *
+ * *query_len_p contains the input string length, and is updated with
+ * the result string length (which cannot be longer) on exit.
+ *
+ * Returns a palloc'd string.
+ */
+static char *
+generate_normalized_query(pgssConstLocations *jstate, const char *query,
+						  int *query_len_p, int encoding)
+{
+	char	   *norm_query;
+	int			query_len = *query_len_p;
+	int			i,
+				len_to_wrt,		/* Length (in bytes) to write */
+				quer_loc = 0,	/* Source query byte location */
+				n_quer_loc = 0, /* Normalized query byte location */
+				last_off = 0,	/* Offset from start for previous tok */
+				last_tok_len = 0;		/* Length (in bytes) of that tok */
+
+	/*
+	 * Get constants' lengths (core system only gives us locations).  Note
+	 * this also ensures the items are sorted by location.
+	 */
+	fill_in_constant_lengths(jstate, query);
+
+	/* Allocate result buffer */
+	norm_query = palloc(query_len + 1);
+
+	for (i = 0; i < jstate->clocations_count; i++)
+	{
+		int			off,		/* Offset from start for cur tok */
+					tok_len;	/* Length (in bytes) of that tok */
+
+		off = jstate->clocations[i].location;
+		tok_len = jstate->clocations[i].length;
+
+		if (tok_len < 0)
+			continue;			/* ignore any duplicates */
+
+		/* Copy next chunk (what precedes the next constant) */
+		len_to_wrt = off - last_off;
+		len_to_wrt -= last_tok_len;
+
+		Assert(len_to_wrt >= 0);
+		memcpy(norm_query + n_quer_loc, query + quer_loc, len_to_wrt);
+		n_quer_loc += len_to_wrt;
+
+		/* And insert a '?' in place of the constant token */
+		norm_query[n_quer_loc++] = '?';
+
+		quer_loc = off + tok_len;
+		last_off = off;
+		last_tok_len = tok_len;
+	}
+
+	/*
+	 * We've copied up until the last ignorable constant.  Copy over the
+	 * remaining bytes of the original query string.
+	 */
+	len_to_wrt = query_len - quer_loc;
+
+	Assert(len_to_wrt >= 0);
+	memcpy(norm_query + n_quer_loc, query + quer_loc, len_to_wrt);
+	n_quer_loc += len_to_wrt;
+
+	Assert(n_quer_loc <= query_len);
+	norm_query[n_quer_loc] = '\0';
+
+	*query_len_p = n_quer_loc;
+	return norm_query;
+}
+
+static bool const_record_walker(Node *node, pgssConstLocations *jstate)
+{
+	bool result;
+
+	if (node == NULL) return false;
+
+	if ((IsA(node, A_Const) && ((A_Const *) node)->location >= 0) || (IsA(node, DefElem) && ((DefElem *) node)->location >= 0))
+	{
+		/* enlarge array if needed */
+		if (jstate->clocations_count >= jstate->clocations_buf_size)
+		{
+			jstate->clocations_buf_size *= 2;
+			jstate->clocations = (pgssLocationLen *)
+				repalloc(jstate->clocations,
+						 jstate->clocations_buf_size *
+						 sizeof(pgssLocationLen));
+		}
+		jstate->clocations[jstate->clocations_count].location = IsA(node, DefElem) ? ((DefElem *) node)->location : ((A_Const *) node)->location;
+		/* initialize lengths to -1 to simplify fill_in_constant_lengths */
+		jstate->clocations[jstate->clocations_count].length = -1;
+		jstate->clocations_count++;
+	}
+	else if (IsA(node, VariableSetStmt))
+	{
+		return const_record_walker((Node *) ((VariableSetStmt *) node)->args, jstate);
+	}
+	else if (IsA(node, CopyStmt))
+	{
+		return const_record_walker((Node *) ((CopyStmt *) node)->query, jstate);
+	}
+	else if (IsA(node, ExplainStmt))
+	{
+		return const_record_walker((Node *) ((ExplainStmt *) node)->query, jstate);
+	}
+	else if (IsA(node, AlterRoleStmt))
+	{
+		return const_record_walker((Node *) ((AlterRoleStmt *) node)->options, jstate);
+	}
+
+	PG_TRY();
+	{
+		result = raw_expression_tree_walker(node, const_record_walker, (void*) jstate);
+	}
+	PG_CATCH();
+	{
+		FlushErrorState();
+		result = false;
+	}
+	PG_END_TRY();
+
+	return result;
+}
+
+PgQueryNormalizeResult pg_query_normalize(const char* input)
+{
+	MemoryContext ctx = NULL;
+	PgQueryNormalizeResult result = {0};
+
+	ctx = pg_query_enter_memory_context("pg_query_normalize");
+
+	PG_TRY();
+	{
+		List *tree;
+		pgssConstLocations jstate;
+		int query_len;
+
+		/* Parse query */
+		tree = raw_parser(input);
+
+		/* Set up workspace for constant recording */
+		jstate.clocations_buf_size = 32;
+		jstate.clocations = (pgssLocationLen *)
+			palloc(jstate.clocations_buf_size * sizeof(pgssLocationLen));
+		jstate.clocations_count = 0;
+
+		/* Walk tree and record const locations */
+		const_record_walker((Node *) tree, &jstate);
+
+		/* Normalize query */
+		query_len = (int) strlen(input);
+		result.normalized_query = strdup(generate_normalized_query(&jstate, input, &query_len, PG_UTF8));
+	}
+	PG_CATCH();
+	{
+		ErrorData* error_data;
+		PgQueryError* error;
+
+		MemoryContextSwitchTo(ctx);
+		error_data = CopyErrorData();
+
+		error = malloc(sizeof(PgQueryError));
+		error->message   = strdup(error_data->message);
+		error->filename  = strdup(error_data->filename);
+		error->lineno    = error_data->lineno;
+		error->cursorpos = error_data->cursorpos;
+
+		result.error = error;
+		FlushErrorState();
+	}
+	PG_END_TRY();
+
+	pg_query_exit_memory_context(ctx);
+
+	return result;
+}
+
+void pg_query_free_normalize_result(PgQueryNormalizeResult result)
+{
+  if (result.error) {
+    free(result.error->message);
+    free(result.error->filename);
+    free(result.error);
+  }
+
+  free(result.normalized_query);
+}
diff --git a/foreign/libpg_query/src/pg_query_parse.c b/foreign/libpg_query/src/pg_query_parse.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/pg_query_parse.c
@@ -0,0 +1,124 @@
+#include "pg_query.h"
+#include "pg_query_internal.h"
+#include "pg_query_json.h"
+
+#include "parser/parser.h"
+#include "parser/scanner.h"
+#include "parser/scansup.h"
+
+#include <unistd.h>
+#include <fcntl.h>
+
+PgQueryInternalParsetreeAndError pg_query_raw_parse(const char* input)
+{
+	PgQueryInternalParsetreeAndError result = {0};
+	MemoryContext parse_context = CurrentMemoryContext;
+
+	char stderr_buffer[STDERR_BUFFER_LEN + 1] = {0};
+#ifndef DEBUG
+	int stderr_global;
+	int stderr_pipe[2];
+#endif
+
+#ifndef DEBUG
+	// Setup pipe for stderr redirection
+	if (pipe(stderr_pipe) != 0) {
+		PgQueryError* error = malloc(sizeof(PgQueryError));
+
+		error->message = strdup("Failed to open pipe, too many open file descriptors")
+
+		result.error = error;
+
+		return result;
+	}
+
+	fcntl(stderr_pipe[0], F_SETFL, fcntl(stderr_pipe[0], F_GETFL) | O_NONBLOCK);
+
+	// Redirect stderr to the pipe
+	stderr_global = dup(STDERR_FILENO);
+	dup2(stderr_pipe[1], STDERR_FILENO);
+	close(stderr_pipe[1]);
+#endif
+
+	PG_TRY();
+	{
+		result.tree = raw_parser(input);
+
+#ifndef DEBUG
+		// Save stderr for result
+		read(stderr_pipe[0], stderr_buffer, STDERR_BUFFER_LEN);
+#endif
+
+		result.stderr_buffer = strdup(stderr_buffer);
+	}
+	PG_CATCH();
+	{
+		ErrorData* error_data;
+		PgQueryError* error;
+
+		MemoryContextSwitchTo(parse_context);
+		error_data = CopyErrorData();
+
+		// Note: This is intentionally malloc so exiting the memory context doesn't free this
+		error = malloc(sizeof(PgQueryError));
+		error->message   = strdup(error_data->message);
+		error->filename  = strdup(error_data->filename);
+		error->funcname  = strdup(error_data->funcname);
+		error->context   = NULL;
+		error->lineno    = error_data->lineno;
+		error->cursorpos = error_data->cursorpos;
+
+		result.error = error;
+		FlushErrorState();
+	}
+	PG_END_TRY();
+
+#ifndef DEBUG
+	// Restore stderr, close pipe
+	dup2(stderr_global, STDERR_FILENO);
+	close(stderr_pipe[0]);
+	close(stderr_global);
+#endif
+
+	return result;
+}
+
+PgQueryParseResult pg_query_parse(const char* input)
+{
+	MemoryContext ctx = NULL;
+	PgQueryInternalParsetreeAndError parsetree_and_error;
+	PgQueryParseResult result = {0};
+
+	ctx = pg_query_enter_memory_context("pg_query_parse");
+
+	parsetree_and_error = pg_query_raw_parse(input);
+
+	// These are all malloc-ed and will survive exiting the memory context, the caller is responsible to free them now
+	result.stderr_buffer = parsetree_and_error.stderr_buffer;
+	result.error = parsetree_and_error.error;
+
+	if (parsetree_and_error.tree != NULL) {
+		char *tree_json;
+
+		tree_json = pg_query_nodes_to_json(parsetree_and_error.tree);
+
+		result.parse_tree = strdup(tree_json);
+		pfree(tree_json);
+	} else {
+		result.parse_tree = strdup("[]");
+	}
+
+	pg_query_exit_memory_context(ctx);
+
+	return result;
+}
+
+void pg_query_free_parse_result(PgQueryParseResult result)
+{
+  if (result.error) {
+		pg_query_free_error(result.error);
+  }
+
+  free(result.parse_tree);
+  free(result.stderr_buffer);
+}
diff --git a/foreign/libpg_query/src/pg_query_parse_plpgsql.c b/foreign/libpg_query/src/pg_query_parse_plpgsql.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/pg_query_parse_plpgsql.c
@@ -0,0 +1,450 @@
+#include "pg_query.h"
+#include "pg_query_internal.h"
+#include "pg_query_json_plpgsql.h"
+
+#include <assert.h>
+
+#include <catalog/pg_type.h>
+#include <catalog/pg_proc_fn.h>
+#include <nodes/parsenodes.h>
+#include <nodes/nodeFuncs.h>
+
+#define _GNU_SOURCE // Necessary to get asprintf (which is a GNU extension)
+#include <stdio.h>
+
+typedef struct {
+  PLpgSQL_function *func;
+  PgQueryError* error;
+} PgQueryInternalPlpgsqlFuncAndError;
+
+static PgQueryInternalPlpgsqlFuncAndError pg_query_raw_parse_plpgsql(CreateFunctionStmt* stmt);
+
+static int	datums_alloc;
+extern __thread int			plpgsql_nDatums;
+extern __thread PLpgSQL_datum **plpgsql_Datums;
+static int	datums_last = 0;
+
+static void add_dummy_return(PLpgSQL_function *function)
+{
+	/*
+	 * If the outer block has an EXCEPTION clause, we need to make a new outer
+	 * block, since the added RETURN shouldn't act like it is inside the
+	 * EXCEPTION clause.
+	 */
+	if (function->action->exceptions != NULL)
+	{
+		PLpgSQL_stmt_block *new;
+
+		new = palloc0(sizeof(PLpgSQL_stmt_block));
+		new->cmd_type = PLPGSQL_STMT_BLOCK;
+		new->body = list_make1(function->action);
+
+		function->action = new;
+	}
+	if (function->action->body == NIL ||
+		((PLpgSQL_stmt *) llast(function->action->body))->cmd_type != PLPGSQL_STMT_RETURN)
+	{
+		PLpgSQL_stmt_return *new;
+
+		new = palloc0(sizeof(PLpgSQL_stmt_return));
+		new->cmd_type = PLPGSQL_STMT_RETURN;
+		new->expr = NULL;
+		new->retvarno = function->out_param_varno;
+
+		function->action->body = lappend(function->action->body, new);
+	}
+}
+
+static void plpgsql_compile_error_callback(void *arg)
+{
+	if (arg)
+	{
+		/*
+		 * Try to convert syntax error position to reference text of original
+		 * CREATE FUNCTION or DO command.
+		 */
+		if (function_parse_error_transpose((const char *) arg))
+			return;
+
+		/*
+		 * Done if a syntax error position was reported; otherwise we have to
+		 * fall back to a "near line N" report.
+		 */
+	}
+
+	if (plpgsql_error_funcname)
+		errcontext("compilation of PL/pgSQL function \"%s\" near line %d",
+				   plpgsql_error_funcname, plpgsql_latest_lineno());
+}
+
+static PLpgSQL_function *compile_create_function_stmt(CreateFunctionStmt* stmt)
+{
+	char *func_name;
+    char *proc_source;
+	PLpgSQL_function *function;
+	ErrorContextCallback plerrcontext;
+	PLpgSQL_variable *var;
+	int			parse_rc;
+	MemoryContext func_cxt;
+	int			i;
+	PLpgSQL_rec *rec;
+    const ListCell *lc, *lc2, *lc3;
+    bool is_trigger = false;
+    bool is_setof = false;
+
+    assert(IsA(stmt, CreateFunctionStmt));
+
+    func_name = strVal(linitial(stmt->funcname));
+
+    foreach(lc, stmt->options)
+    {
+      DefElem* elem = (DefElem*) lfirst(lc);
+
+      if (strcmp(elem->defname, "as") == 0) {
+          const ListCell *lc2;
+
+          assert(IsA(elem->arg, List));
+
+          foreach(lc2, (List*) elem->arg)
+          {
+              proc_source = strVal(lfirst(lc2));
+          }
+      }
+    }
+
+    if (stmt->returnType != NULL) {
+        foreach(lc3, stmt->returnType->names)
+        {
+            char* val = strVal(lfirst(lc3));
+
+            if (strcmp(val, "trigger") == 0) {
+                is_trigger = true;
+            }
+        }
+
+        if (stmt->returnType->setof) {
+            is_setof = true;
+        }
+    }
+
+	/*
+	 * Setup the scanner input and error info.  We assume that this function
+	 * cannot be invoked recursively, so there's no need to save and restore
+	 * the static variables used here.
+	 */
+	plpgsql_scanner_init(proc_source);
+
+	plpgsql_error_funcname = func_name;
+
+	/*
+	 * Setup error traceback support for ereport()
+	 */
+	plerrcontext.callback = plpgsql_compile_error_callback;
+	plerrcontext.arg = proc_source;
+	plerrcontext.previous = error_context_stack;
+	error_context_stack = &plerrcontext;
+
+	/* Do extra syntax checking if check_function_bodies is on */
+	plpgsql_check_syntax = true;
+
+	/* Function struct does not live past current statement */
+	function = (PLpgSQL_function *) palloc0(sizeof(PLpgSQL_function));
+
+	plpgsql_curr_compile = function;
+
+	/*
+	 * All the rest of the compile-time storage (e.g. parse tree) is kept in
+	 * its own memory context, so it can be reclaimed easily.
+	 */
+	func_cxt = AllocSetContextCreate(CurrentMemoryContext,
+									 "PL/pgSQL function context",
+									 ALLOCSET_DEFAULT_MINSIZE,
+									 ALLOCSET_DEFAULT_INITSIZE,
+									 ALLOCSET_DEFAULT_MAXSIZE);
+	compile_tmp_cxt = MemoryContextSwitchTo(func_cxt);
+
+	function->fn_signature = pstrdup(func_name);
+	function->fn_is_trigger = PLPGSQL_NOT_TRIGGER;
+	function->fn_input_collation = InvalidOid;
+	function->fn_cxt = func_cxt;
+	function->out_param_varno = -1;		/* set up for no OUT param */
+	function->resolve_option = plpgsql_variable_conflict;
+	function->print_strict_params = plpgsql_print_strict_params;
+
+	/*
+	 * don't do extra validation for inline code as we don't want to add spam
+	 * at runtime
+	 */
+	function->extra_warnings = 0;
+	function->extra_errors = 0;
+
+	plpgsql_ns_init();
+	plpgsql_ns_push(func_name);
+	plpgsql_DumpExecTree = false;
+
+	datums_alloc = 128;
+	plpgsql_nDatums = 0;
+	plpgsql_Datums = palloc(sizeof(PLpgSQL_datum *) * datums_alloc);
+	datums_last = 0;
+
+	/* Set up as though in a function returning VOID */
+	function->fn_rettype = VOIDOID;
+	function->fn_retset = is_setof;
+	function->fn_retistuple = false;
+	/* a bit of hardwired knowledge about type VOID here */
+	function->fn_retbyval = true;
+	function->fn_rettyplen = sizeof(int32);
+
+	/*
+	 * Remember if function is STABLE/IMMUTABLE.  XXX would it be better to
+	 * set this TRUE inside a read-only transaction?  Not clear.
+	 */
+	function->fn_readonly = false;
+
+	/*
+	 * Create the magic FOUND variable.
+	 */
+	var = plpgsql_build_variable("found", 0,
+								 plpgsql_build_datatype(BOOLOID,
+														-1,
+														InvalidOid),
+								 true);
+	function->found_varno = var->dno;
+
+    if (is_trigger) {
+    	/* Add the record for referencing NEW */
+    	rec = plpgsql_build_record("new", 0, true);
+    	function->new_varno = rec->dno;
+
+    	/* Add the record for referencing OLD */
+    	rec = plpgsql_build_record("old", 0, true);
+    	function->old_varno = rec->dno;
+    }
+
+	/*
+	 * Now parse the function's text
+	 */
+	parse_rc = plpgsql_yyparse();
+	if (parse_rc != 0)
+		elog(ERROR, "plpgsql parser returned %d", parse_rc);
+	function->action = plpgsql_parse_result;
+
+	plpgsql_scanner_finish();
+
+	/*
+	 * If it returns VOID (always true at the moment), we allow control to
+	 * fall off the end without an explicit RETURN statement.
+	 */
+	if (function->fn_rettype == VOIDOID)
+		add_dummy_return(function);
+
+	/*
+	 * Complete the function's info
+	 */
+	function->fn_nargs = 0;
+	function->ndatums = plpgsql_nDatums;
+	function->datums = palloc(sizeof(PLpgSQL_datum *) * plpgsql_nDatums);
+	for (i = 0; i < plpgsql_nDatums; i++)
+		function->datums[i] = plpgsql_Datums[i];
+
+	/*
+	 * Pop the error context stack
+	 */
+	error_context_stack = plerrcontext.previous;
+	plpgsql_error_funcname = NULL;
+
+	plpgsql_check_syntax = false;
+
+	MemoryContextSwitchTo(compile_tmp_cxt);
+	compile_tmp_cxt = NULL;
+	return function;
+}
+
+PgQueryInternalPlpgsqlFuncAndError pg_query_raw_parse_plpgsql(CreateFunctionStmt* stmt)
+{
+	PgQueryInternalPlpgsqlFuncAndError result = {0};
+	MemoryContext parse_context = CurrentMemoryContext;
+
+	char stderr_buffer[STDERR_BUFFER_LEN + 1] = {0};
+#ifndef DEBUG
+	int stderr_global;
+	int stderr_pipe[2];
+#endif
+
+#ifndef DEBUG
+	// Setup pipe for stderr redirection
+	if (pipe(stderr_pipe) != 0) {
+		PgQueryError* error = malloc(sizeof(PgQueryError));
+
+		error->message = strdup("Failed to open pipe, too many open file descriptors")
+
+		result.error = error;
+
+		return result;
+	}
+
+	fcntl(stderr_pipe[0], F_SETFL, fcntl(stderr_pipe[0], F_GETFL) | O_NONBLOCK);
+
+	// Redirect stderr to the pipe
+	stderr_global = dup(STDERR_FILENO);
+	dup2(stderr_pipe[1], STDERR_FILENO);
+	close(stderr_pipe[1]);
+#endif
+
+	PG_TRY();
+	{
+    result.func = compile_create_function_stmt(stmt);
+
+#ifndef DEBUG
+		// Save stderr for result
+		read(stderr_pipe[0], stderr_buffer, STDERR_BUFFER_LEN);
+#endif
+
+        if (strlen(stderr_buffer) > 0) {
+            PgQueryError* error = malloc(sizeof(PgQueryError));
+    		error->message = strdup(stderr_buffer);
+            error->filename = "";
+    		error->funcname = "";
+    		error->context  = "";
+            result.error = error;
+        }
+	}
+	PG_CATCH();
+	{
+		ErrorData* error_data;
+		PgQueryError* error;
+
+		MemoryContextSwitchTo(parse_context);
+		error_data = CopyErrorData();
+
+		// Note: This is intentionally malloc so exiting the memory context doesn't free this
+		error = malloc(sizeof(PgQueryError));
+		error->message   = strdup(error_data->message);
+		error->filename  = strdup(error_data->filename);
+		error->funcname  = strdup(error_data->funcname);
+		error->context   = strdup(error_data->context);
+		error->lineno    = error_data->lineno;
+		error->cursorpos = error_data->cursorpos;
+
+		result.error = error;
+		FlushErrorState();
+	}
+	PG_END_TRY();
+
+#ifndef DEBUG
+	// Restore stderr, close pipe
+	dup2(stderr_global, STDERR_FILENO);
+	close(stderr_pipe[0]);
+	close(stderr_global);
+#endif
+
+	return result;
+}
+
+typedef struct createFunctionStmts
+{
+	CreateFunctionStmt **stmts;
+    int stmts_buf_size;
+    int stmts_count;
+} createFunctionStmts;
+
+static bool create_function_stmts_walker(Node *node, createFunctionStmts *state)
+{
+	bool result;
+
+	if (node == NULL) return false;
+
+	if (IsA(node, CreateFunctionStmt))
+	{
+		if (state->stmts_count >= state->stmts_buf_size)
+		{
+			state->stmts_buf_size *= 2;
+			state->stmts = (CreateFunctionStmt**) repalloc(state->stmts, state->stmts_buf_size * sizeof(CreateFunctionStmt*));
+		}
+		state->stmts[state->stmts_count] = (CreateFunctionStmt *) node;
+		state->stmts_count++;
+	}
+
+	PG_TRY();
+	{
+		result = raw_expression_tree_walker(node, create_function_stmts_walker, (void*) state);
+	}
+	PG_CATCH();
+	{
+		FlushErrorState();
+		result = false;
+	}
+	PG_END_TRY();
+
+	return result;
+}
+
+PgQueryPlpgsqlParseResult pg_query_parse_plpgsql(const char* input)
+{
+	MemoryContext ctx = NULL;
+	PgQueryPlpgsqlParseResult result = {0};
+    PgQueryInternalParsetreeAndError parse_result;
+    createFunctionStmts statements;
+    size_t i;
+
+	ctx = pg_query_enter_memory_context("pg_query_parse_plpgsql");
+
+    parse_result = pg_query_raw_parse(input);
+    result.error = parse_result.error;
+    if (result.error != NULL) {
+        pg_query_exit_memory_context(ctx);
+        return result;
+    }
+
+    statements.stmts_buf_size = 100;
+    statements.stmts = (CreateFunctionStmt**) palloc(statements.stmts_buf_size * sizeof(CreateFunctionStmt*));
+    statements.stmts_count = 0;
+
+    create_function_stmts_walker((Node*) parse_result.tree, &statements);
+
+    result.plpgsql_funcs = strdup("[\n");
+
+    for (i = 0; i < statements.stmts_count; i++) {
+	    PgQueryInternalPlpgsqlFuncAndError func_and_error;
+
+    	func_and_error = pg_query_raw_parse_plpgsql(statements.stmts[i]);
+
+        // These are all malloc-ed and will survive exiting the memory context, the caller is responsible to free them now
+        result.error = func_and_error.error;
+
+        if (result.error != NULL) {
+            pg_query_exit_memory_context(ctx);
+        	return result;
+        }
+
+    	if (func_and_error.func != NULL) {
+    		char *func_json;
+            char *new_out;
+
+    		func_json = plpgsqlToJSON(func_and_error.func);
+            plpgsql_free_function_memory(func_and_error.func);
+
+            asprintf(&new_out, "%s%s,\n", result.plpgsql_funcs, func_json);
+            free(result.plpgsql_funcs);
+            result.plpgsql_funcs = new_out;
+
+    		pfree(func_json);
+    	}
+    }
+
+    result.plpgsql_funcs[strlen(result.plpgsql_funcs) - 2] = '\n';
+    result.plpgsql_funcs[strlen(result.plpgsql_funcs) - 1] = ']';
+
+	pg_query_exit_memory_context(ctx);
+
+	return result;
+}
+
+void pg_query_free_plpgsql_parse_result(PgQueryPlpgsqlParseResult result)
+{
+  if (result.error) {
+		pg_query_free_error(result.error);
+  }
+
+  free(result.plpgsql_funcs);
+}
diff --git a/foreign/libpg_query/src/postgres/contrib_pgcrypto_sha1.c b/foreign/libpg_query/src/postgres/contrib_pgcrypto_sha1.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/contrib_pgcrypto_sha1.c
@@ -0,0 +1,352 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - sha1_result
+ * - sha1_pad
+ * - sha1_step
+ * - _K
+ * - sha1_init
+ * - sha1_loop
+ *--------------------------------------------------------------------
+ */
+
+/*	   $KAME: sha1.c,v 1.3 2000/02/22 14:01:18 itojun Exp $    */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *	  notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *	  notice, this list of conditions and the following disclaimer in the
+ *	  documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *	  may be used to endorse or promote products derived from this software
+ *	  without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * contrib/pgcrypto/sha1.c
+ */
+/*
+ * FIPS pub 180-1: Secure Hash Algorithm (SHA-1)
+ * based on: http://www.itl.nist.gov/fipspubs/fip180-1.htm
+ * implemented by Jun-ichiro itojun Itoh <itojun@itojun.org>
+ */
+
+#include "postgres.h"
+
+#include <sys/param.h>
+
+#include "sha1.h"
+
+/* constant table */
+static uint32 _K[] = {0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6};
+
+#define K(t)	_K[(t) / 20]
+
+#define F0(b, c, d) (((b) & (c)) | ((~(b)) & (d)))
+#define F1(b, c, d) (((b) ^ (c)) ^ (d))
+#define F2(b, c, d) (((b) & (c)) | ((b) & (d)) | ((c) & (d)))
+#define F3(b, c, d) (((b) ^ (c)) ^ (d))
+
+#define S(n, x)		(((x) << (n)) | ((x) >> (32 - (n))))
+
+#define H(n)	(ctxt->h.b32[(n)])
+#define COUNT	(ctxt->count)
+#define BCOUNT	(ctxt->c.b64[0] / 8)
+#define W(n)	(ctxt->m.b32[(n)])
+
+#define PUTBYTE(x) \
+do { \
+	ctxt->m.b8[(COUNT % 64)] = (x);		\
+	COUNT++;				\
+	COUNT %= 64;				\
+	ctxt->c.b64[0] += 8;			\
+	if (COUNT % 64 == 0)			\
+		sha1_step(ctxt);		\
+} while (0)
+
+#define PUTPAD(x) \
+do { \
+	ctxt->m.b8[(COUNT % 64)] = (x);		\
+	COUNT++;				\
+	COUNT %= 64;				\
+	if (COUNT % 64 == 0)			\
+		sha1_step(ctxt);		\
+} while (0)
+
+static void sha1_step(struct sha1_ctxt *);
+
+static void
+sha1_step(struct sha1_ctxt * ctxt)
+{
+	uint32		a,
+				b,
+				c,
+				d,
+				e;
+	size_t		t,
+				s;
+	uint32		tmp;
+
+#ifndef WORDS_BIGENDIAN
+	struct sha1_ctxt tctxt;
+
+	memmove(&tctxt.m.b8[0], &ctxt->m.b8[0], 64);
+	ctxt->m.b8[0] = tctxt.m.b8[3];
+	ctxt->m.b8[1] = tctxt.m.b8[2];
+	ctxt->m.b8[2] = tctxt.m.b8[1];
+	ctxt->m.b8[3] = tctxt.m.b8[0];
+	ctxt->m.b8[4] = tctxt.m.b8[7];
+	ctxt->m.b8[5] = tctxt.m.b8[6];
+	ctxt->m.b8[6] = tctxt.m.b8[5];
+	ctxt->m.b8[7] = tctxt.m.b8[4];
+	ctxt->m.b8[8] = tctxt.m.b8[11];
+	ctxt->m.b8[9] = tctxt.m.b8[10];
+	ctxt->m.b8[10] = tctxt.m.b8[9];
+	ctxt->m.b8[11] = tctxt.m.b8[8];
+	ctxt->m.b8[12] = tctxt.m.b8[15];
+	ctxt->m.b8[13] = tctxt.m.b8[14];
+	ctxt->m.b8[14] = tctxt.m.b8[13];
+	ctxt->m.b8[15] = tctxt.m.b8[12];
+	ctxt->m.b8[16] = tctxt.m.b8[19];
+	ctxt->m.b8[17] = tctxt.m.b8[18];
+	ctxt->m.b8[18] = tctxt.m.b8[17];
+	ctxt->m.b8[19] = tctxt.m.b8[16];
+	ctxt->m.b8[20] = tctxt.m.b8[23];
+	ctxt->m.b8[21] = tctxt.m.b8[22];
+	ctxt->m.b8[22] = tctxt.m.b8[21];
+	ctxt->m.b8[23] = tctxt.m.b8[20];
+	ctxt->m.b8[24] = tctxt.m.b8[27];
+	ctxt->m.b8[25] = tctxt.m.b8[26];
+	ctxt->m.b8[26] = tctxt.m.b8[25];
+	ctxt->m.b8[27] = tctxt.m.b8[24];
+	ctxt->m.b8[28] = tctxt.m.b8[31];
+	ctxt->m.b8[29] = tctxt.m.b8[30];
+	ctxt->m.b8[30] = tctxt.m.b8[29];
+	ctxt->m.b8[31] = tctxt.m.b8[28];
+	ctxt->m.b8[32] = tctxt.m.b8[35];
+	ctxt->m.b8[33] = tctxt.m.b8[34];
+	ctxt->m.b8[34] = tctxt.m.b8[33];
+	ctxt->m.b8[35] = tctxt.m.b8[32];
+	ctxt->m.b8[36] = tctxt.m.b8[39];
+	ctxt->m.b8[37] = tctxt.m.b8[38];
+	ctxt->m.b8[38] = tctxt.m.b8[37];
+	ctxt->m.b8[39] = tctxt.m.b8[36];
+	ctxt->m.b8[40] = tctxt.m.b8[43];
+	ctxt->m.b8[41] = tctxt.m.b8[42];
+	ctxt->m.b8[42] = tctxt.m.b8[41];
+	ctxt->m.b8[43] = tctxt.m.b8[40];
+	ctxt->m.b8[44] = tctxt.m.b8[47];
+	ctxt->m.b8[45] = tctxt.m.b8[46];
+	ctxt->m.b8[46] = tctxt.m.b8[45];
+	ctxt->m.b8[47] = tctxt.m.b8[44];
+	ctxt->m.b8[48] = tctxt.m.b8[51];
+	ctxt->m.b8[49] = tctxt.m.b8[50];
+	ctxt->m.b8[50] = tctxt.m.b8[49];
+	ctxt->m.b8[51] = tctxt.m.b8[48];
+	ctxt->m.b8[52] = tctxt.m.b8[55];
+	ctxt->m.b8[53] = tctxt.m.b8[54];
+	ctxt->m.b8[54] = tctxt.m.b8[53];
+	ctxt->m.b8[55] = tctxt.m.b8[52];
+	ctxt->m.b8[56] = tctxt.m.b8[59];
+	ctxt->m.b8[57] = tctxt.m.b8[58];
+	ctxt->m.b8[58] = tctxt.m.b8[57];
+	ctxt->m.b8[59] = tctxt.m.b8[56];
+	ctxt->m.b8[60] = tctxt.m.b8[63];
+	ctxt->m.b8[61] = tctxt.m.b8[62];
+	ctxt->m.b8[62] = tctxt.m.b8[61];
+	ctxt->m.b8[63] = tctxt.m.b8[60];
+#endif
+
+	a = H(0);
+	b = H(1);
+	c = H(2);
+	d = H(3);
+	e = H(4);
+
+	for (t = 0; t < 20; t++)
+	{
+		s = t & 0x0f;
+		if (t >= 16)
+			W(s) = S(1, W((s + 13) & 0x0f) ^ W((s + 8) & 0x0f) ^ W((s + 2) & 0x0f) ^ W(s));
+		tmp = S(5, a) + F0(b, c, d) + e + W(s) + K(t);
+		e = d;
+		d = c;
+		c = S(30, b);
+		b = a;
+		a = tmp;
+	}
+	for (t = 20; t < 40; t++)
+	{
+		s = t & 0x0f;
+		W(s) = S(1, W((s + 13) & 0x0f) ^ W((s + 8) & 0x0f) ^ W((s + 2) & 0x0f) ^ W(s));
+		tmp = S(5, a) + F1(b, c, d) + e + W(s) + K(t);
+		e = d;
+		d = c;
+		c = S(30, b);
+		b = a;
+		a = tmp;
+	}
+	for (t = 40; t < 60; t++)
+	{
+		s = t & 0x0f;
+		W(s) = S(1, W((s + 13) & 0x0f) ^ W((s + 8) & 0x0f) ^ W((s + 2) & 0x0f) ^ W(s));
+		tmp = S(5, a) + F2(b, c, d) + e + W(s) + K(t);
+		e = d;
+		d = c;
+		c = S(30, b);
+		b = a;
+		a = tmp;
+	}
+	for (t = 60; t < 80; t++)
+	{
+		s = t & 0x0f;
+		W(s) = S(1, W((s + 13) & 0x0f) ^ W((s + 8) & 0x0f) ^ W((s + 2) & 0x0f) ^ W(s));
+		tmp = S(5, a) + F3(b, c, d) + e + W(s) + K(t);
+		e = d;
+		d = c;
+		c = S(30, b);
+		b = a;
+		a = tmp;
+	}
+
+	H(0) = H(0) + a;
+	H(1) = H(1) + b;
+	H(2) = H(2) + c;
+	H(3) = H(3) + d;
+	H(4) = H(4) + e;
+
+	memset(&ctxt->m.b8[0], 0, 64);
+}
+
+/*------------------------------------------------------------*/
+
+void
+sha1_init(struct sha1_ctxt * ctxt)
+{
+	memset(ctxt, 0, sizeof(struct sha1_ctxt));
+	H(0) = 0x67452301;
+	H(1) = 0xefcdab89;
+	H(2) = 0x98badcfe;
+	H(3) = 0x10325476;
+	H(4) = 0xc3d2e1f0;
+}
+
+void
+sha1_pad(struct sha1_ctxt * ctxt)
+{
+	size_t		padlen;			/* pad length in bytes */
+	size_t		padstart;
+
+	PUTPAD(0x80);
+
+	padstart = COUNT % 64;
+	padlen = 64 - padstart;
+	if (padlen < 8)
+	{
+		memset(&ctxt->m.b8[padstart], 0, padlen);
+		COUNT += padlen;
+		COUNT %= 64;
+		sha1_step(ctxt);
+		padstart = COUNT % 64;	/* should be 0 */
+		padlen = 64 - padstart; /* should be 64 */
+	}
+	memset(&ctxt->m.b8[padstart], 0, padlen - 8);
+	COUNT += (padlen - 8);
+	COUNT %= 64;
+#ifdef WORDS_BIGENDIAN
+	PUTPAD(ctxt->c.b8[0]);
+	PUTPAD(ctxt->c.b8[1]);
+	PUTPAD(ctxt->c.b8[2]);
+	PUTPAD(ctxt->c.b8[3]);
+	PUTPAD(ctxt->c.b8[4]);
+	PUTPAD(ctxt->c.b8[5]);
+	PUTPAD(ctxt->c.b8[6]);
+	PUTPAD(ctxt->c.b8[7]);
+#else
+	PUTPAD(ctxt->c.b8[7]);
+	PUTPAD(ctxt->c.b8[6]);
+	PUTPAD(ctxt->c.b8[5]);
+	PUTPAD(ctxt->c.b8[4]);
+	PUTPAD(ctxt->c.b8[3]);
+	PUTPAD(ctxt->c.b8[2]);
+	PUTPAD(ctxt->c.b8[1]);
+	PUTPAD(ctxt->c.b8[0]);
+#endif
+}
+
+void
+sha1_loop(struct sha1_ctxt * ctxt, const uint8 *input0, size_t len)
+{
+	const uint8 *input;
+	size_t		gaplen;
+	size_t		gapstart;
+	size_t		off;
+	size_t		copysiz;
+
+	input = (const uint8 *) input0;
+	off = 0;
+
+	while (off < len)
+	{
+		gapstart = COUNT % 64;
+		gaplen = 64 - gapstart;
+
+		copysiz = (gaplen < len - off) ? gaplen : len - off;
+		memmove(&ctxt->m.b8[gapstart], &input[off], copysiz);
+		COUNT += copysiz;
+		COUNT %= 64;
+		ctxt->c.b64[0] += copysiz * 8;
+		if (COUNT % 64 == 0)
+			sha1_step(ctxt);
+		off += copysiz;
+	}
+}
+
+void
+sha1_result(struct sha1_ctxt * ctxt, uint8 *digest0)
+{
+	uint8	   *digest;
+
+	digest = (uint8 *) digest0;
+	sha1_pad(ctxt);
+#ifdef WORDS_BIGENDIAN
+	memmove(digest, &ctxt->h.b8[0], 20);
+#else
+	digest[0] = ctxt->h.b8[3];
+	digest[1] = ctxt->h.b8[2];
+	digest[2] = ctxt->h.b8[1];
+	digest[3] = ctxt->h.b8[0];
+	digest[4] = ctxt->h.b8[7];
+	digest[5] = ctxt->h.b8[6];
+	digest[6] = ctxt->h.b8[5];
+	digest[7] = ctxt->h.b8[4];
+	digest[8] = ctxt->h.b8[11];
+	digest[9] = ctxt->h.b8[10];
+	digest[10] = ctxt->h.b8[9];
+	digest[11] = ctxt->h.b8[8];
+	digest[12] = ctxt->h.b8[15];
+	digest[13] = ctxt->h.b8[14];
+	digest[14] = ctxt->h.b8[13];
+	digest[15] = ctxt->h.b8[12];
+	digest[16] = ctxt->h.b8[19];
+	digest[17] = ctxt->h.b8[18];
+	digest[18] = ctxt->h.b8[17];
+	digest[19] = ctxt->h.b8[16];
+#endif
+}
diff --git a/foreign/libpg_query/src/postgres/guc-file.c b/foreign/libpg_query/src/postgres/guc-file.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/guc-file.c
diff --git a/foreign/libpg_query/src/postgres/include/access/attnum.h b/foreign/libpg_query/src/postgres/include/access/attnum.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/attnum.h
@@ -0,0 +1,64 @@
+/*-------------------------------------------------------------------------
+ *
+ * attnum.h
+ *	  POSTGRES attribute number definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/attnum.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef ATTNUM_H
+#define ATTNUM_H
+
+
+/*
+ * user defined attribute numbers start at 1.   -ay 2/95
+ */
+typedef int16 AttrNumber;
+
+#define InvalidAttrNumber		0
+#define MaxAttrNumber			32767
+
+/* ----------------
+ *		support macros
+ * ----------------
+ */
+/*
+ * AttributeNumberIsValid
+ *		True iff the attribute number is valid.
+ */
+#define AttributeNumberIsValid(attributeNumber) \
+	((bool) ((attributeNumber) != InvalidAttrNumber))
+
+/*
+ * AttrNumberIsForUserDefinedAttr
+ *		True iff the attribute number corresponds to an user defined attribute.
+ */
+#define AttrNumberIsForUserDefinedAttr(attributeNumber) \
+	((bool) ((attributeNumber) > 0))
+
+/*
+ * AttrNumberGetAttrOffset
+ *		Returns the attribute offset for an attribute number.
+ *
+ * Note:
+ *		Assumes the attribute number is for a user defined attribute.
+ */
+#define AttrNumberGetAttrOffset(attNum) \
+( \
+	AssertMacro(AttrNumberIsForUserDefinedAttr(attNum)), \
+	((attNum) - 1) \
+)
+
+/*
+ * AttributeOffsetGetAttributeNumber
+ *		Returns the attribute number for an attribute offset.
+ */
+#define AttrOffsetGetAttrNumber(attributeOffset) \
+	 ((AttrNumber) (1 + (attributeOffset)))
+
+#endif   /* ATTNUM_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/commit_ts.h b/foreign/libpg_query/src/postgres/include/access/commit_ts.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/commit_ts.h
@@ -0,0 +1,69 @@
+/*
+ * commit_ts.h
+ *
+ * PostgreSQL commit timestamp manager
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/commit_ts.h
+ */
+#ifndef COMMIT_TS_H
+#define COMMIT_TS_H
+
+#include "access/xlog.h"
+#include "datatype/timestamp.h"
+#include "replication/origin.h"
+#include "utils/guc.h"
+
+
+extern PGDLLIMPORT bool track_commit_timestamp;
+
+extern bool check_track_commit_timestamp(bool *newval, void **extra,
+							 GucSource source);
+
+extern void TransactionTreeSetCommitTsData(TransactionId xid, int nsubxids,
+							   TransactionId *subxids, TimestampTz timestamp,
+							   RepOriginId nodeid, bool write_xlog);
+extern bool TransactionIdGetCommitTsData(TransactionId xid,
+							 TimestampTz *ts, RepOriginId *nodeid);
+extern TransactionId GetLatestCommitTsData(TimestampTz *ts,
+					  RepOriginId *nodeid);
+
+extern Size CommitTsShmemBuffers(void);
+extern Size CommitTsShmemSize(void);
+extern void CommitTsShmemInit(void);
+extern void BootStrapCommitTs(void);
+extern void StartupCommitTs(void);
+extern void CommitTsParameterChange(bool xlrecvalue, bool pgcontrolvalue);
+extern void CompleteCommitTsInitialization(void);
+extern void ShutdownCommitTs(void);
+extern void CheckPointCommitTs(void);
+extern void ExtendCommitTs(TransactionId newestXact);
+extern void TruncateCommitTs(TransactionId oldestXact);
+extern void SetCommitTsLimit(TransactionId oldestXact,
+				 TransactionId newestXact);
+extern void AdvanceOldestCommitTsXid(TransactionId oldestXact);
+
+/* XLOG stuff */
+#define COMMIT_TS_ZEROPAGE		0x00
+#define COMMIT_TS_TRUNCATE		0x10
+#define COMMIT_TS_SETTS			0x20
+
+typedef struct xl_commit_ts_set
+{
+	TimestampTz timestamp;
+	RepOriginId nodeid;
+	TransactionId mainxid;
+	/* subxact Xids follow */
+} xl_commit_ts_set;
+
+#define SizeOfCommitTsSet	(offsetof(xl_commit_ts_set, mainxid) + \
+							 sizeof(TransactionId))
+
+
+extern void commit_ts_redo(XLogReaderState *record);
+extern void commit_ts_desc(StringInfo buf, XLogReaderState *record);
+extern const char *commit_ts_identify(uint8 info);
+
+#endif   /* COMMIT_TS_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/genam.h b/foreign/libpg_query/src/postgres/include/access/genam.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/genam.h
@@ -0,0 +1,193 @@
+/*-------------------------------------------------------------------------
+ *
+ * genam.h
+ *	  POSTGRES generalized index access method definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/genam.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef GENAM_H
+#define GENAM_H
+
+#include "access/sdir.h"
+#include "access/skey.h"
+#include "nodes/tidbitmap.h"
+#include "storage/lock.h"
+#include "utils/relcache.h"
+#include "utils/snapshot.h"
+
+/*
+ * Struct for statistics returned by ambuild
+ */
+typedef struct IndexBuildResult
+{
+	double		heap_tuples;	/* # of tuples seen in parent table */
+	double		index_tuples;	/* # of tuples inserted into index */
+} IndexBuildResult;
+
+/*
+ * Struct for input arguments passed to ambulkdelete and amvacuumcleanup
+ *
+ * num_heap_tuples is accurate only when estimated_count is false;
+ * otherwise it's just an estimate (currently, the estimate is the
+ * prior value of the relation's pg_class.reltuples field).  It will
+ * always just be an estimate during ambulkdelete.
+ */
+typedef struct IndexVacuumInfo
+{
+	Relation	index;			/* the index being vacuumed */
+	bool		analyze_only;	/* ANALYZE (without any actual vacuum) */
+	bool		estimated_count;	/* num_heap_tuples is an estimate */
+	int			message_level;	/* ereport level for progress messages */
+	double		num_heap_tuples;	/* tuples remaining in heap */
+	BufferAccessStrategy strategy;		/* access strategy for reads */
+} IndexVacuumInfo;
+
+/*
+ * Struct for statistics returned by ambulkdelete and amvacuumcleanup
+ *
+ * This struct is normally allocated by the first ambulkdelete call and then
+ * passed along through subsequent ones until amvacuumcleanup; however,
+ * amvacuumcleanup must be prepared to allocate it in the case where no
+ * ambulkdelete calls were made (because no tuples needed deletion).
+ * Note that an index AM could choose to return a larger struct
+ * of which this is just the first field; this provides a way for ambulkdelete
+ * to communicate additional private data to amvacuumcleanup.
+ *
+ * Note: pages_removed is the amount by which the index physically shrank,
+ * if any (ie the change in its total size on disk).  pages_deleted and
+ * pages_free refer to free space within the index file.  Some index AMs
+ * may compute num_index_tuples by reference to num_heap_tuples, in which
+ * case they should copy the estimated_count field from IndexVacuumInfo.
+ */
+typedef struct IndexBulkDeleteResult
+{
+	BlockNumber num_pages;		/* pages remaining in index */
+	BlockNumber pages_removed;	/* # removed during vacuum operation */
+	bool		estimated_count;	/* num_index_tuples is an estimate */
+	double		num_index_tuples;		/* tuples remaining */
+	double		tuples_removed; /* # removed during vacuum operation */
+	BlockNumber pages_deleted;	/* # unused pages in index */
+	BlockNumber pages_free;		/* # pages available for reuse */
+} IndexBulkDeleteResult;
+
+/* Typedef for callback function to determine if a tuple is bulk-deletable */
+typedef bool (*IndexBulkDeleteCallback) (ItemPointer itemptr, void *state);
+
+/* struct definitions appear in relscan.h */
+typedef struct IndexScanDescData *IndexScanDesc;
+typedef struct SysScanDescData *SysScanDesc;
+
+/*
+ * Enumeration specifying the type of uniqueness check to perform in
+ * index_insert().
+ *
+ * UNIQUE_CHECK_YES is the traditional Postgres immediate check, possibly
+ * blocking to see if a conflicting transaction commits.
+ *
+ * For deferrable unique constraints, UNIQUE_CHECK_PARTIAL is specified at
+ * insertion time.  The index AM should test if the tuple is unique, but
+ * should not throw error, block, or prevent the insertion if the tuple
+ * appears not to be unique.  We'll recheck later when it is time for the
+ * constraint to be enforced.  The AM must return true if the tuple is
+ * known unique, false if it is possibly non-unique.  In the "true" case
+ * it is safe to omit the later recheck.
+ *
+ * When it is time to recheck the deferred constraint, a pseudo-insertion
+ * call is made with UNIQUE_CHECK_EXISTING.  The tuple is already in the
+ * index in this case, so it should not be inserted again.  Rather, just
+ * check for conflicting live tuples (possibly blocking).
+ */
+typedef enum IndexUniqueCheck
+{
+	UNIQUE_CHECK_NO,			/* Don't do any uniqueness checking */
+	UNIQUE_CHECK_YES,			/* Enforce uniqueness at insertion time */
+	UNIQUE_CHECK_PARTIAL,		/* Test uniqueness, but no error */
+	UNIQUE_CHECK_EXISTING		/* Check if existing tuple is unique */
+} IndexUniqueCheck;
+
+
+/*
+ * generalized index_ interface routines (in indexam.c)
+ */
+
+/*
+ * IndexScanIsValid
+ *		True iff the index scan is valid.
+ */
+#define IndexScanIsValid(scan) PointerIsValid(scan)
+
+extern Relation index_open(Oid relationId, LOCKMODE lockmode);
+extern void index_close(Relation relation, LOCKMODE lockmode);
+
+extern bool index_insert(Relation indexRelation,
+			 Datum *values, bool *isnull,
+			 ItemPointer heap_t_ctid,
+			 Relation heapRelation,
+			 IndexUniqueCheck checkUnique);
+
+extern IndexScanDesc index_beginscan(Relation heapRelation,
+				Relation indexRelation,
+				Snapshot snapshot,
+				int nkeys, int norderbys);
+extern IndexScanDesc index_beginscan_bitmap(Relation indexRelation,
+					   Snapshot snapshot,
+					   int nkeys);
+extern void index_rescan(IndexScanDesc scan,
+			 ScanKey keys, int nkeys,
+			 ScanKey orderbys, int norderbys);
+extern void index_endscan(IndexScanDesc scan);
+extern void index_markpos(IndexScanDesc scan);
+extern void index_restrpos(IndexScanDesc scan);
+extern ItemPointer index_getnext_tid(IndexScanDesc scan,
+				  ScanDirection direction);
+extern HeapTuple index_fetch_heap(IndexScanDesc scan);
+extern HeapTuple index_getnext(IndexScanDesc scan, ScanDirection direction);
+extern int64 index_getbitmap(IndexScanDesc scan, TIDBitmap *bitmap);
+
+extern IndexBulkDeleteResult *index_bulk_delete(IndexVacuumInfo *info,
+				  IndexBulkDeleteResult *stats,
+				  IndexBulkDeleteCallback callback,
+				  void *callback_state);
+extern IndexBulkDeleteResult *index_vacuum_cleanup(IndexVacuumInfo *info,
+					 IndexBulkDeleteResult *stats);
+extern bool index_can_return(Relation indexRelation, int attno);
+extern RegProcedure index_getprocid(Relation irel, AttrNumber attnum,
+				uint16 procnum);
+extern FmgrInfo *index_getprocinfo(Relation irel, AttrNumber attnum,
+				  uint16 procnum);
+
+/*
+ * index access method support routines (in genam.c)
+ */
+extern IndexScanDesc RelationGetIndexScan(Relation indexRelation,
+					 int nkeys, int norderbys);
+extern void IndexScanEnd(IndexScanDesc scan);
+extern char *BuildIndexValueDescription(Relation indexRelation,
+						   Datum *values, bool *isnull);
+
+/*
+ * heap-or-index access to system catalogs (in genam.c)
+ */
+extern SysScanDesc systable_beginscan(Relation heapRelation,
+				   Oid indexId,
+				   bool indexOK,
+				   Snapshot snapshot,
+				   int nkeys, ScanKey key);
+extern HeapTuple systable_getnext(SysScanDesc sysscan);
+extern bool systable_recheck_tuple(SysScanDesc sysscan, HeapTuple tup);
+extern void systable_endscan(SysScanDesc sysscan);
+extern SysScanDesc systable_beginscan_ordered(Relation heapRelation,
+						   Relation indexRelation,
+						   Snapshot snapshot,
+						   int nkeys, ScanKey key);
+extern HeapTuple systable_getnext_ordered(SysScanDesc sysscan,
+						 ScanDirection direction);
+extern void systable_endscan_ordered(SysScanDesc sysscan);
+
+#endif   /* GENAM_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/gin.h b/foreign/libpg_query/src/postgres/include/access/gin.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/gin.h
@@ -0,0 +1,83 @@
+/*--------------------------------------------------------------------------
+ * gin.h
+ *	  Public header file for Generalized Inverted Index access method.
+ *
+ *	Copyright (c) 2006-2015, PostgreSQL Global Development Group
+ *
+ *	src/include/access/gin.h
+ *--------------------------------------------------------------------------
+ */
+#ifndef GIN_H
+#define GIN_H
+
+#include "access/xlogreader.h"
+#include "lib/stringinfo.h"
+#include "storage/block.h"
+#include "utils/relcache.h"
+
+
+/*
+ * amproc indexes for inverted indexes.
+ */
+#define GIN_COMPARE_PROC			   1
+#define GIN_EXTRACTVALUE_PROC		   2
+#define GIN_EXTRACTQUERY_PROC		   3
+#define GIN_CONSISTENT_PROC			   4
+#define GIN_COMPARE_PARTIAL_PROC	   5
+#define GIN_TRICONSISTENT_PROC		   6
+#define GINNProcs					   6
+
+/*
+ * searchMode settings for extractQueryFn.
+ */
+#define GIN_SEARCH_MODE_DEFAULT			0
+#define GIN_SEARCH_MODE_INCLUDE_EMPTY	1
+#define GIN_SEARCH_MODE_ALL				2
+#define GIN_SEARCH_MODE_EVERYTHING		3		/* for internal use only */
+
+/*
+ * GinStatsData represents stats data for planner use
+ */
+typedef struct GinStatsData
+{
+	BlockNumber nPendingPages;
+	BlockNumber nTotalPages;
+	BlockNumber nEntryPages;
+	BlockNumber nDataPages;
+	int64		nEntries;
+	int32		ginVersion;
+} GinStatsData;
+
+/*
+ * A ternary value used by tri-consistent functions.
+ *
+ * For convenience, this is compatible with booleans. A boolean can be
+ * safely cast to a GinTernaryValue.
+ */
+typedef char GinTernaryValue;
+
+#define GIN_FALSE		0		/* item is not present / does not match */
+#define GIN_TRUE		1		/* item is present / matches */
+#define GIN_MAYBE		2		/* don't know if item is present / don't know
+								 * if matches */
+
+#define DatumGetGinTernaryValue(X) ((GinTernaryValue)(X))
+#define GinTernaryValueGetDatum(X) ((Datum)(X))
+#define PG_RETURN_GIN_TERNARY_VALUE(x) return GinTernaryValueGetDatum(x)
+
+/* GUC parameters */
+extern PGDLLIMPORT int GinFuzzySearchLimit;
+extern int	gin_pending_list_limit;
+
+/* ginutil.c */
+extern void ginGetStats(Relation index, GinStatsData *stats);
+extern void ginUpdateStats(Relation index, const GinStatsData *stats);
+
+/* ginxlog.c */
+extern void gin_redo(XLogReaderState *record);
+extern void gin_desc(StringInfo buf, XLogReaderState *record);
+extern const char *gin_identify(uint8 info);
+extern void gin_xlog_startup(void);
+extern void gin_xlog_cleanup(void);
+
+#endif   /* GIN_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/hash.h b/foreign/libpg_query/src/postgres/include/access/hash.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/hash.h
@@ -0,0 +1,363 @@
+/*-------------------------------------------------------------------------
+ *
+ * hash.h
+ *	  header file for postgres hash access method implementation
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/hash.h
+ *
+ * NOTES
+ *		modeled after Margo Seltzer's hash implementation for unix.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef HASH_H
+#define HASH_H
+
+#include "access/genam.h"
+#include "access/itup.h"
+#include "access/sdir.h"
+#include "access/xlogreader.h"
+#include "fmgr.h"
+#include "lib/stringinfo.h"
+#include "storage/bufmgr.h"
+#include "storage/lock.h"
+#include "utils/relcache.h"
+
+/*
+ * Mapping from hash bucket number to physical block number of bucket's
+ * starting page.  Beware of multiple evaluations of argument!
+ */
+typedef uint32 Bucket;
+
+#define BUCKET_TO_BLKNO(metap,B) \
+		((BlockNumber) ((B) + ((B) ? (metap)->hashm_spares[_hash_log2((B)+1)-1] : 0)) + 1)
+
+/*
+ * Special space for hash index pages.
+ *
+ * hasho_flag tells us which type of page we're looking at.  For
+ * example, knowing overflow pages from bucket pages is necessary
+ * information when you're deleting tuples from a page. If all the
+ * tuples are deleted from an overflow page, the overflow is made
+ * available to other buckets by calling _hash_freeovflpage(). If all
+ * the tuples are deleted from a bucket page, no additional action is
+ * necessary.
+ */
+#define LH_UNUSED_PAGE			(0)
+#define LH_OVERFLOW_PAGE		(1 << 0)
+#define LH_BUCKET_PAGE			(1 << 1)
+#define LH_BITMAP_PAGE			(1 << 2)
+#define LH_META_PAGE			(1 << 3)
+
+typedef struct HashPageOpaqueData
+{
+	BlockNumber hasho_prevblkno;	/* previous ovfl (or bucket) blkno */
+	BlockNumber hasho_nextblkno;	/* next ovfl blkno */
+	Bucket		hasho_bucket;	/* bucket number this pg belongs to */
+	uint16		hasho_flag;		/* page type code, see above */
+	uint16		hasho_page_id;	/* for identification of hash indexes */
+} HashPageOpaqueData;
+
+typedef HashPageOpaqueData *HashPageOpaque;
+
+/*
+ * The page ID is for the convenience of pg_filedump and similar utilities,
+ * which otherwise would have a hard time telling pages of different index
+ * types apart.  It should be the last 2 bytes on the page.  This is more or
+ * less "free" due to alignment considerations.
+ */
+#define HASHO_PAGE_ID		0xFF80
+
+/*
+ *	HashScanOpaqueData is private state for a hash index scan.
+ */
+typedef struct HashScanOpaqueData
+{
+	/* Hash value of the scan key, ie, the hash key we seek */
+	uint32		hashso_sk_hash;
+
+	/*
+	 * By definition, a hash scan should be examining only one bucket. We
+	 * record the bucket number here as soon as it is known.
+	 */
+	Bucket		hashso_bucket;
+	bool		hashso_bucket_valid;
+
+	/*
+	 * If we have a share lock on the bucket, we record it here.  When
+	 * hashso_bucket_blkno is zero, we have no such lock.
+	 */
+	BlockNumber hashso_bucket_blkno;
+
+	/*
+	 * We also want to remember which buffer we're currently examining in the
+	 * scan. We keep the buffer pinned (but not locked) across hashgettuple
+	 * calls, in order to avoid doing a ReadBuffer() for every tuple in the
+	 * index.
+	 */
+	Buffer		hashso_curbuf;
+
+	/* Current position of the scan, as an index TID */
+	ItemPointerData hashso_curpos;
+
+	/* Current position of the scan, as a heap TID */
+	ItemPointerData hashso_heappos;
+} HashScanOpaqueData;
+
+typedef HashScanOpaqueData *HashScanOpaque;
+
+/*
+ * Definitions for metapage.
+ */
+
+#define HASH_METAPAGE	0		/* metapage is always block 0 */
+
+#define HASH_MAGIC		0x6440640
+#define HASH_VERSION	2		/* 2 signifies only hash key value is stored */
+
+/*
+ * Spares[] holds the number of overflow pages currently allocated at or
+ * before a certain splitpoint. For example, if spares[3] = 7 then there are
+ * 7 ovflpages before splitpoint 3 (compare BUCKET_TO_BLKNO macro).  The
+ * value in spares[ovflpoint] increases as overflow pages are added at the
+ * end of the index.  Once ovflpoint increases (ie, we have actually allocated
+ * the bucket pages belonging to that splitpoint) the number of spares at the
+ * prior splitpoint cannot change anymore.
+ *
+ * ovflpages that have been recycled for reuse can be found by looking at
+ * bitmaps that are stored within ovflpages dedicated for the purpose.
+ * The blknos of these bitmap pages are kept in bitmaps[]; nmaps is the
+ * number of currently existing bitmaps.
+ *
+ * The limitation on the size of spares[] comes from the fact that there's
+ * no point in having more than 2^32 buckets with only uint32 hashcodes.
+ * There is no particular upper limit on the size of mapp[], other than
+ * needing to fit into the metapage.  (With 8K block size, 128 bitmaps
+ * limit us to 64 Gb of overflow space...)
+ */
+#define HASH_MAX_SPLITPOINTS		32
+#define HASH_MAX_BITMAPS			128
+
+typedef struct HashMetaPageData
+{
+	uint32		hashm_magic;	/* magic no. for hash tables */
+	uint32		hashm_version;	/* version ID */
+	double		hashm_ntuples;	/* number of tuples stored in the table */
+	uint16		hashm_ffactor;	/* target fill factor (tuples/bucket) */
+	uint16		hashm_bsize;	/* index page size (bytes) */
+	uint16		hashm_bmsize;	/* bitmap array size (bytes) - must be a power
+								 * of 2 */
+	uint16		hashm_bmshift;	/* log2(bitmap array size in BITS) */
+	uint32		hashm_maxbucket;	/* ID of maximum bucket in use */
+	uint32		hashm_highmask; /* mask to modulo into entire table */
+	uint32		hashm_lowmask;	/* mask to modulo into lower half of table */
+	uint32		hashm_ovflpoint;/* splitpoint from which ovflpgs being
+								 * allocated */
+	uint32		hashm_firstfree;	/* lowest-number free ovflpage (bit#) */
+	uint32		hashm_nmaps;	/* number of bitmap pages */
+	RegProcedure hashm_procid;	/* hash procedure id from pg_proc */
+	uint32		hashm_spares[HASH_MAX_SPLITPOINTS];		/* spare pages before
+														 * each splitpoint */
+	BlockNumber hashm_mapp[HASH_MAX_BITMAPS];	/* blknos of ovfl bitmaps */
+} HashMetaPageData;
+
+typedef HashMetaPageData *HashMetaPage;
+
+/*
+ * Maximum size of a hash index item (it's okay to have only one per page)
+ */
+#define HashMaxItemSize(page) \
+	MAXALIGN_DOWN(PageGetPageSize(page) - \
+				  SizeOfPageHeaderData - \
+				  sizeof(ItemIdData) - \
+				  MAXALIGN(sizeof(HashPageOpaqueData)))
+
+#define HASH_MIN_FILLFACTOR			10
+#define HASH_DEFAULT_FILLFACTOR		75
+
+/*
+ * Constants
+ */
+#define BYTE_TO_BIT				3		/* 2^3 bits/byte */
+#define ALL_SET					((uint32) ~0)
+
+/*
+ * Bitmap pages do not contain tuples.  They do contain the standard
+ * page headers and trailers; however, everything in between is a
+ * giant bit array.  The number of bits that fit on a page obviously
+ * depends on the page size and the header/trailer overhead.  We require
+ * the number of bits per page to be a power of 2.
+ */
+#define BMPGSZ_BYTE(metap)		((metap)->hashm_bmsize)
+#define BMPGSZ_BIT(metap)		((metap)->hashm_bmsize << BYTE_TO_BIT)
+#define BMPG_SHIFT(metap)		((metap)->hashm_bmshift)
+#define BMPG_MASK(metap)		(BMPGSZ_BIT(metap) - 1)
+
+#define HashPageGetBitmap(page) \
+	((uint32 *) PageGetContents(page))
+
+#define HashGetMaxBitmapSize(page) \
+	(PageGetPageSize((Page) page) - \
+	 (MAXALIGN(SizeOfPageHeaderData) + MAXALIGN(sizeof(HashPageOpaqueData))))
+
+#define HashPageGetMeta(page) \
+	((HashMetaPage) PageGetContents(page))
+
+/*
+ * The number of bits in an ovflpage bitmap word.
+ */
+#define BITS_PER_MAP	32		/* Number of bits in uint32 */
+
+/* Given the address of the beginning of a bit map, clear/set the nth bit */
+#define CLRBIT(A, N)	((A)[(N)/BITS_PER_MAP] &= ~(1<<((N)%BITS_PER_MAP)))
+#define SETBIT(A, N)	((A)[(N)/BITS_PER_MAP] |= (1<<((N)%BITS_PER_MAP)))
+#define ISSET(A, N)		((A)[(N)/BITS_PER_MAP] & (1<<((N)%BITS_PER_MAP)))
+
+/*
+ * page-level and high-level locking modes (see README)
+ */
+#define HASH_READ		BUFFER_LOCK_SHARE
+#define HASH_WRITE		BUFFER_LOCK_EXCLUSIVE
+#define HASH_NOLOCK		(-1)
+
+#define HASH_SHARE		ShareLock
+#define HASH_EXCLUSIVE	ExclusiveLock
+
+/*
+ *	Strategy number. There's only one valid strategy for hashing: equality.
+ */
+#define HTEqualStrategyNumber			1
+#define HTMaxStrategyNumber				1
+
+/*
+ *	When a new operator class is declared, we require that the user supply
+ *	us with an amproc procudure for hashing a key of the new type.
+ *	Since we only have one such proc in amproc, it's number 1.
+ */
+#define HASHPROC		1
+
+
+/* public routines */
+
+extern Datum hashbuild(PG_FUNCTION_ARGS);
+extern Datum hashbuildempty(PG_FUNCTION_ARGS);
+extern Datum hashinsert(PG_FUNCTION_ARGS);
+extern Datum hashbeginscan(PG_FUNCTION_ARGS);
+extern Datum hashgettuple(PG_FUNCTION_ARGS);
+extern Datum hashgetbitmap(PG_FUNCTION_ARGS);
+extern Datum hashrescan(PG_FUNCTION_ARGS);
+extern Datum hashendscan(PG_FUNCTION_ARGS);
+extern Datum hashmarkpos(PG_FUNCTION_ARGS);
+extern Datum hashrestrpos(PG_FUNCTION_ARGS);
+extern Datum hashbulkdelete(PG_FUNCTION_ARGS);
+extern Datum hashvacuumcleanup(PG_FUNCTION_ARGS);
+extern Datum hashoptions(PG_FUNCTION_ARGS);
+
+/*
+ * Datatype-specific hash functions in hashfunc.c.
+ *
+ * These support both hash indexes and hash joins.
+ *
+ * NOTE: some of these are also used by catcache operations, without
+ * any direct connection to hash indexes.  Also, the common hash_any
+ * routine is also used by dynahash tables.
+ */
+extern Datum hashchar(PG_FUNCTION_ARGS);
+extern Datum hashint2(PG_FUNCTION_ARGS);
+extern Datum hashint4(PG_FUNCTION_ARGS);
+extern Datum hashint8(PG_FUNCTION_ARGS);
+extern Datum hashoid(PG_FUNCTION_ARGS);
+extern Datum hashenum(PG_FUNCTION_ARGS);
+extern Datum hashfloat4(PG_FUNCTION_ARGS);
+extern Datum hashfloat8(PG_FUNCTION_ARGS);
+extern Datum hashoidvector(PG_FUNCTION_ARGS);
+extern Datum hashint2vector(PG_FUNCTION_ARGS);
+extern Datum hashname(PG_FUNCTION_ARGS);
+extern Datum hashtext(PG_FUNCTION_ARGS);
+extern Datum hashvarlena(PG_FUNCTION_ARGS);
+extern Datum hash_any(register const unsigned char *k, register int keylen);
+extern Datum hash_uint32(uint32 k);
+
+/* private routines */
+
+/* hashinsert.c */
+extern void _hash_doinsert(Relation rel, IndexTuple itup);
+extern OffsetNumber _hash_pgaddtup(Relation rel, Buffer buf,
+			   Size itemsize, IndexTuple itup);
+
+/* hashovfl.c */
+extern Buffer _hash_addovflpage(Relation rel, Buffer metabuf, Buffer buf);
+extern BlockNumber _hash_freeovflpage(Relation rel, Buffer ovflbuf,
+				   BufferAccessStrategy bstrategy);
+extern void _hash_initbitmap(Relation rel, HashMetaPage metap,
+				 BlockNumber blkno, ForkNumber forkNum);
+extern void _hash_squeezebucket(Relation rel,
+					Bucket bucket, BlockNumber bucket_blkno,
+					BufferAccessStrategy bstrategy);
+
+/* hashpage.c */
+extern void _hash_getlock(Relation rel, BlockNumber whichlock, int access);
+extern bool _hash_try_getlock(Relation rel, BlockNumber whichlock, int access);
+extern void _hash_droplock(Relation rel, BlockNumber whichlock, int access);
+extern Buffer _hash_getbuf(Relation rel, BlockNumber blkno,
+			 int access, int flags);
+extern Buffer _hash_getinitbuf(Relation rel, BlockNumber blkno);
+extern Buffer _hash_getnewbuf(Relation rel, BlockNumber blkno,
+				ForkNumber forkNum);
+extern Buffer _hash_getbuf_with_strategy(Relation rel, BlockNumber blkno,
+						   int access, int flags,
+						   BufferAccessStrategy bstrategy);
+extern void _hash_relbuf(Relation rel, Buffer buf);
+extern void _hash_dropbuf(Relation rel, Buffer buf);
+extern void _hash_wrtbuf(Relation rel, Buffer buf);
+extern void _hash_chgbufaccess(Relation rel, Buffer buf, int from_access,
+				   int to_access);
+extern uint32 _hash_metapinit(Relation rel, double num_tuples,
+				ForkNumber forkNum);
+extern void _hash_pageinit(Page page, Size size);
+extern void _hash_expandtable(Relation rel, Buffer metabuf);
+
+/* hashscan.c */
+extern void _hash_regscan(IndexScanDesc scan);
+extern void _hash_dropscan(IndexScanDesc scan);
+extern bool _hash_has_active_scan(Relation rel, Bucket bucket);
+extern void ReleaseResources_hash(void);
+
+/* hashsearch.c */
+extern bool _hash_next(IndexScanDesc scan, ScanDirection dir);
+extern bool _hash_first(IndexScanDesc scan, ScanDirection dir);
+extern bool _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir);
+
+/* hashsort.c */
+typedef struct HSpool HSpool;	/* opaque struct in hashsort.c */
+
+extern HSpool *_h_spoolinit(Relation heap, Relation index, uint32 num_buckets);
+extern void _h_spooldestroy(HSpool *hspool);
+extern void _h_spool(HSpool *hspool, ItemPointer self,
+		 Datum *values, bool *isnull);
+extern void _h_indexbuild(HSpool *hspool);
+
+/* hashutil.c */
+extern bool _hash_checkqual(IndexScanDesc scan, IndexTuple itup);
+extern uint32 _hash_datum2hashkey(Relation rel, Datum key);
+extern uint32 _hash_datum2hashkey_type(Relation rel, Datum key, Oid keytype);
+extern Bucket _hash_hashkey2bucket(uint32 hashkey, uint32 maxbucket,
+					 uint32 highmask, uint32 lowmask);
+extern uint32 _hash_log2(uint32 num);
+extern void _hash_checkpage(Relation rel, Buffer buf, int flags);
+extern uint32 _hash_get_indextuple_hashkey(IndexTuple itup);
+extern IndexTuple _hash_form_tuple(Relation index,
+				 Datum *values, bool *isnull);
+extern OffsetNumber _hash_binsearch(Page page, uint32 hash_value);
+extern OffsetNumber _hash_binsearch_last(Page page, uint32 hash_value);
+
+/* hash.c */
+extern void hash_redo(XLogReaderState *record);
+extern void hash_desc(StringInfo buf, XLogReaderState *record);
+extern const char *hash_identify(uint8 info);
+
+#endif   /* HASH_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/heapam.h b/foreign/libpg_query/src/postgres/include/access/heapam.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/heapam.h
@@ -0,0 +1,192 @@
+/*-------------------------------------------------------------------------
+ *
+ * heapam.h
+ *	  POSTGRES heap access method definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/heapam.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef HEAPAM_H
+#define HEAPAM_H
+
+#include "access/sdir.h"
+#include "access/skey.h"
+#include "nodes/lockoptions.h"
+#include "nodes/primnodes.h"
+#include "storage/bufpage.h"
+#include "storage/lock.h"
+#include "utils/relcache.h"
+#include "utils/snapshot.h"
+
+
+/* "options" flag bits for heap_insert */
+#define HEAP_INSERT_SKIP_WAL	0x0001
+#define HEAP_INSERT_SKIP_FSM	0x0002
+#define HEAP_INSERT_FROZEN		0x0004
+#define HEAP_INSERT_SPECULATIVE 0x0008
+
+typedef struct BulkInsertStateData *BulkInsertState;
+
+/*
+ * Possible lock modes for a tuple.
+ */
+typedef enum LockTupleMode
+{
+	/* SELECT FOR KEY SHARE */
+	LockTupleKeyShare,
+	/* SELECT FOR SHARE */
+	LockTupleShare,
+	/* SELECT FOR NO KEY UPDATE, and UPDATEs that don't modify key columns */
+	LockTupleNoKeyExclusive,
+	/* SELECT FOR UPDATE, UPDATEs that modify key columns, and DELETE */
+	LockTupleExclusive
+} LockTupleMode;
+
+#define MaxLockTupleMode	LockTupleExclusive
+
+/*
+ * When heap_update, heap_delete, or heap_lock_tuple fail because the target
+ * tuple is already outdated, they fill in this struct to provide information
+ * to the caller about what happened.
+ * ctid is the target's ctid link: it is the same as the target's TID if the
+ * target was deleted, or the location of the replacement tuple if the target
+ * was updated.
+ * xmax is the outdating transaction's XID.  If the caller wants to visit the
+ * replacement tuple, it must check that this matches before believing the
+ * replacement is really a match.
+ * cmax is the outdating command's CID, but only when the failure code is
+ * HeapTupleSelfUpdated (i.e., something in the current transaction outdated
+ * the tuple); otherwise cmax is zero.  (We make this restriction because
+ * HeapTupleHeaderGetCmax doesn't work for tuples outdated in other
+ * transactions.)
+ */
+typedef struct HeapUpdateFailureData
+{
+	ItemPointerData ctid;
+	TransactionId xmax;
+	CommandId	cmax;
+} HeapUpdateFailureData;
+
+
+/* ----------------
+ *		function prototypes for heap access method
+ *
+ * heap_create, heap_create_with_catalog, and heap_drop_with_catalog
+ * are declared in catalog/heap.h
+ * ----------------
+ */
+
+/* in heap/heapam.c */
+extern Relation relation_open(Oid relationId, LOCKMODE lockmode);
+extern Relation try_relation_open(Oid relationId, LOCKMODE lockmode);
+extern Relation relation_openrv(const RangeVar *relation, LOCKMODE lockmode);
+extern Relation relation_openrv_extended(const RangeVar *relation,
+						 LOCKMODE lockmode, bool missing_ok);
+extern void relation_close(Relation relation, LOCKMODE lockmode);
+
+extern Relation heap_open(Oid relationId, LOCKMODE lockmode);
+extern Relation heap_openrv(const RangeVar *relation, LOCKMODE lockmode);
+extern Relation heap_openrv_extended(const RangeVar *relation,
+					 LOCKMODE lockmode, bool missing_ok);
+
+#define heap_close(r,l)  relation_close(r,l)
+
+/* struct definition appears in relscan.h */
+typedef struct HeapScanDescData *HeapScanDesc;
+
+/*
+ * HeapScanIsValid
+ *		True iff the heap scan is valid.
+ */
+#define HeapScanIsValid(scan) PointerIsValid(scan)
+
+extern HeapScanDesc heap_beginscan(Relation relation, Snapshot snapshot,
+			   int nkeys, ScanKey key);
+extern HeapScanDesc heap_beginscan_catalog(Relation relation, int nkeys,
+					   ScanKey key);
+extern HeapScanDesc heap_beginscan_strat(Relation relation, Snapshot snapshot,
+					 int nkeys, ScanKey key,
+					 bool allow_strat, bool allow_sync);
+extern HeapScanDesc heap_beginscan_bm(Relation relation, Snapshot snapshot,
+				  int nkeys, ScanKey key);
+extern HeapScanDesc heap_beginscan_sampling(Relation relation,
+						Snapshot snapshot, int nkeys, ScanKey key,
+					 bool allow_strat, bool allow_sync, bool allow_pagemode);
+extern void heap_setscanlimits(HeapScanDesc scan, BlockNumber startBlk,
+				   BlockNumber endBlk);
+extern void heapgetpage(HeapScanDesc scan, BlockNumber page);
+extern void heap_rescan(HeapScanDesc scan, ScanKey key);
+extern void heap_rescan_set_params(HeapScanDesc scan, ScanKey key,
+					 bool allow_strat, bool allow_sync, bool allow_pagemode);
+extern void heap_endscan(HeapScanDesc scan);
+extern HeapTuple heap_getnext(HeapScanDesc scan, ScanDirection direction);
+
+extern bool heap_fetch(Relation relation, Snapshot snapshot,
+		   HeapTuple tuple, Buffer *userbuf, bool keep_buf,
+		   Relation stats_relation);
+extern bool heap_hot_search_buffer(ItemPointer tid, Relation relation,
+					   Buffer buffer, Snapshot snapshot, HeapTuple heapTuple,
+					   bool *all_dead, bool first_call);
+extern bool heap_hot_search(ItemPointer tid, Relation relation,
+				Snapshot snapshot, bool *all_dead);
+
+extern void heap_get_latest_tid(Relation relation, Snapshot snapshot,
+					ItemPointer tid);
+extern void setLastTid(const ItemPointer tid);
+
+extern BulkInsertState GetBulkInsertState(void);
+extern void FreeBulkInsertState(BulkInsertState);
+
+extern Oid heap_insert(Relation relation, HeapTuple tup, CommandId cid,
+			int options, BulkInsertState bistate);
+extern void heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
+				  CommandId cid, int options, BulkInsertState bistate);
+extern HTSU_Result heap_delete(Relation relation, ItemPointer tid,
+			CommandId cid, Snapshot crosscheck, bool wait,
+			HeapUpdateFailureData *hufd);
+extern void heap_finish_speculative(Relation relation, HeapTuple tuple);
+extern void heap_abort_speculative(Relation relation, HeapTuple tuple);
+extern HTSU_Result heap_update(Relation relation, ItemPointer otid,
+			HeapTuple newtup,
+			CommandId cid, Snapshot crosscheck, bool wait,
+			HeapUpdateFailureData *hufd, LockTupleMode *lockmode);
+extern HTSU_Result heap_lock_tuple(Relation relation, HeapTuple tuple,
+				CommandId cid, LockTupleMode mode, LockWaitPolicy wait_policy,
+				bool follow_update,
+				Buffer *buffer, HeapUpdateFailureData *hufd);
+extern void heap_inplace_update(Relation relation, HeapTuple tuple);
+extern bool heap_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
+				  TransactionId cutoff_multi);
+extern bool heap_tuple_needs_freeze(HeapTupleHeader tuple, TransactionId cutoff_xid,
+						MultiXactId cutoff_multi, Buffer buf);
+
+extern Oid	simple_heap_insert(Relation relation, HeapTuple tup);
+extern void simple_heap_delete(Relation relation, ItemPointer tid);
+extern void simple_heap_update(Relation relation, ItemPointer otid,
+				   HeapTuple tup);
+
+extern void heap_sync(Relation relation);
+
+/* in heap/pruneheap.c */
+extern void heap_page_prune_opt(Relation relation, Buffer buffer);
+extern int heap_page_prune(Relation relation, Buffer buffer,
+				TransactionId OldestXmin,
+				bool report_stats, TransactionId *latestRemovedXid);
+extern void heap_page_prune_execute(Buffer buffer,
+						OffsetNumber *redirected, int nredirected,
+						OffsetNumber *nowdead, int ndead,
+						OffsetNumber *nowunused, int nunused);
+extern void heap_get_root_tuples(Page page, OffsetNumber *root_offsets);
+
+/* in heap/syncscan.c */
+extern void ss_report_location(Relation rel, BlockNumber location);
+extern BlockNumber ss_get_location(Relation rel, BlockNumber relnblocks);
+extern void SyncScanShmemInit(void);
+extern Size SyncScanShmemSize(void);
+
+#endif   /* HEAPAM_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/htup.h b/foreign/libpg_query/src/postgres/include/access/htup.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/htup.h
@@ -0,0 +1,88 @@
+/*-------------------------------------------------------------------------
+ *
+ * htup.h
+ *	  POSTGRES heap tuple definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/htup.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef HTUP_H
+#define HTUP_H
+
+#include "storage/itemptr.h"
+
+/* typedefs and forward declarations for structs defined in htup_details.h */
+
+typedef struct HeapTupleHeaderData HeapTupleHeaderData;
+
+typedef HeapTupleHeaderData *HeapTupleHeader;
+
+typedef struct MinimalTupleData MinimalTupleData;
+
+typedef MinimalTupleData *MinimalTuple;
+
+
+/*
+ * HeapTupleData is an in-memory data structure that points to a tuple.
+ *
+ * There are several ways in which this data structure is used:
+ *
+ * * Pointer to a tuple in a disk buffer: t_data points directly into the
+ *	 buffer (which the code had better be holding a pin on, but this is not
+ *	 reflected in HeapTupleData itself).
+ *
+ * * Pointer to nothing: t_data is NULL.  This is used as a failure indication
+ *	 in some functions.
+ *
+ * * Part of a palloc'd tuple: the HeapTupleData itself and the tuple
+ *	 form a single palloc'd chunk.  t_data points to the memory location
+ *	 immediately following the HeapTupleData struct (at offset HEAPTUPLESIZE).
+ *	 This is the output format of heap_form_tuple and related routines.
+ *
+ * * Separately allocated tuple: t_data points to a palloc'd chunk that
+ *	 is not adjacent to the HeapTupleData.  (This case is deprecated since
+ *	 it's difficult to tell apart from case #1.  It should be used only in
+ *	 limited contexts where the code knows that case #1 will never apply.)
+ *
+ * * Separately allocated minimal tuple: t_data points MINIMAL_TUPLE_OFFSET
+ *	 bytes before the start of a MinimalTuple.  As with the previous case,
+ *	 this can't be told apart from case #1 by inspection; code setting up
+ *	 or destroying this representation has to know what it's doing.
+ *
+ * t_len should always be valid, except in the pointer-to-nothing case.
+ * t_self and t_tableOid should be valid if the HeapTupleData points to
+ * a disk buffer, or if it represents a copy of a tuple on disk.  They
+ * should be explicitly set invalid in manufactured tuples.
+ */
+typedef struct HeapTupleData
+{
+	uint32		t_len;			/* length of *t_data */
+	ItemPointerData t_self;		/* SelfItemPointer */
+	Oid			t_tableOid;		/* table the tuple came from */
+	HeapTupleHeader t_data;		/* -> tuple header and data */
+} HeapTupleData;
+
+typedef HeapTupleData *HeapTuple;
+
+#define HEAPTUPLESIZE	MAXALIGN(sizeof(HeapTupleData))
+
+/*
+ * Accessor macros to be used with HeapTuple pointers.
+ */
+#define HeapTupleIsValid(tuple) PointerIsValid(tuple)
+
+/* HeapTupleHeader functions implemented in utils/time/combocid.c */
+extern CommandId HeapTupleHeaderGetCmin(HeapTupleHeader tup);
+extern CommandId HeapTupleHeaderGetCmax(HeapTupleHeader tup);
+extern void HeapTupleHeaderAdjustCmax(HeapTupleHeader tup,
+						  CommandId *cmax, bool *iscombo);
+
+/* Prototype for HeapTupleHeader accessors in heapam.c */
+extern TransactionId HeapTupleGetUpdateXid(HeapTupleHeader tuple);
+
+#endif   /* HTUP_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/htup_details.h b/foreign/libpg_query/src/postgres/include/access/htup_details.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/htup_details.h
@@ -0,0 +1,804 @@
+/*-------------------------------------------------------------------------
+ *
+ * htup_details.h
+ *	  POSTGRES heap tuple header definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/htup_details.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef HTUP_DETAILS_H
+#define HTUP_DETAILS_H
+
+#include "access/htup.h"
+#include "access/tupdesc.h"
+#include "access/tupmacs.h"
+#include "access/transam.h"
+#include "storage/bufpage.h"
+
+/*
+ * MaxTupleAttributeNumber limits the number of (user) columns in a tuple.
+ * The key limit on this value is that the size of the fixed overhead for
+ * a tuple, plus the size of the null-values bitmap (at 1 bit per column),
+ * plus MAXALIGN alignment, must fit into t_hoff which is uint8.  On most
+ * machines the upper limit without making t_hoff wider would be a little
+ * over 1700.  We use round numbers here and for MaxHeapAttributeNumber
+ * so that alterations in HeapTupleHeaderData layout won't change the
+ * supported max number of columns.
+ */
+#define MaxTupleAttributeNumber 1664	/* 8 * 208 */
+
+/*
+ * MaxHeapAttributeNumber limits the number of (user) columns in a table.
+ * This should be somewhat less than MaxTupleAttributeNumber.  It must be
+ * at least one less, else we will fail to do UPDATEs on a maximal-width
+ * table (because UPDATE has to form working tuples that include CTID).
+ * In practice we want some additional daylight so that we can gracefully
+ * support operations that add hidden "resjunk" columns, for example
+ * SELECT * FROM wide_table ORDER BY foo, bar, baz.
+ * In any case, depending on column data types you will likely be running
+ * into the disk-block-based limit on overall tuple size if you have more
+ * than a thousand or so columns.  TOAST won't help.
+ */
+#define MaxHeapAttributeNumber	1600	/* 8 * 200 */
+
+/*
+ * Heap tuple header.  To avoid wasting space, the fields should be
+ * laid out in such a way as to avoid structure padding.
+ *
+ * Datums of composite types (row types) share the same general structure
+ * as on-disk tuples, so that the same routines can be used to build and
+ * examine them.  However the requirements are slightly different: a Datum
+ * does not need any transaction visibility information, and it does need
+ * a length word and some embedded type information.  We can achieve this
+ * by overlaying the xmin/cmin/xmax/cmax/xvac fields of a heap tuple
+ * with the fields needed in the Datum case.  Typically, all tuples built
+ * in-memory will be initialized with the Datum fields; but when a tuple is
+ * about to be inserted in a table, the transaction fields will be filled,
+ * overwriting the datum fields.
+ *
+ * The overall structure of a heap tuple looks like:
+ *			fixed fields (HeapTupleHeaderData struct)
+ *			nulls bitmap (if HEAP_HASNULL is set in t_infomask)
+ *			alignment padding (as needed to make user data MAXALIGN'd)
+ *			object ID (if HEAP_HASOID is set in t_infomask)
+ *			user data fields
+ *
+ * We store five "virtual" fields Xmin, Cmin, Xmax, Cmax, and Xvac in three
+ * physical fields.  Xmin and Xmax are always really stored, but Cmin, Cmax
+ * and Xvac share a field.  This works because we know that Cmin and Cmax
+ * are only interesting for the lifetime of the inserting and deleting
+ * transaction respectively.  If a tuple is inserted and deleted in the same
+ * transaction, we store a "combo" command id that can be mapped to the real
+ * cmin and cmax, but only by use of local state within the originating
+ * backend.  See combocid.c for more details.  Meanwhile, Xvac is only set by
+ * old-style VACUUM FULL, which does not have any command sub-structure and so
+ * does not need either Cmin or Cmax.  (This requires that old-style VACUUM
+ * FULL never try to move a tuple whose Cmin or Cmax is still interesting,
+ * ie, an insert-in-progress or delete-in-progress tuple.)
+ *
+ * A word about t_ctid: whenever a new tuple is stored on disk, its t_ctid
+ * is initialized with its own TID (location).  If the tuple is ever updated,
+ * its t_ctid is changed to point to the replacement version of the tuple.
+ * Thus, a tuple is the latest version of its row iff XMAX is invalid or
+ * t_ctid points to itself (in which case, if XMAX is valid, the tuple is
+ * either locked or deleted).  One can follow the chain of t_ctid links
+ * to find the newest version of the row.  Beware however that VACUUM might
+ * erase the pointed-to (newer) tuple before erasing the pointing (older)
+ * tuple.  Hence, when following a t_ctid link, it is necessary to check
+ * to see if the referenced slot is empty or contains an unrelated tuple.
+ * Check that the referenced tuple has XMIN equal to the referencing tuple's
+ * XMAX to verify that it is actually the descendant version and not an
+ * unrelated tuple stored into a slot recently freed by VACUUM.  If either
+ * check fails, one may assume that there is no live descendant version.
+ *
+ * t_ctid is sometimes used to store a speculative insertion token, instead
+ * of a real TID.  A speculative token is set on a tuple that's being
+ * inserted, until the inserter is sure that it wants to go ahead with the
+ * insertion.  Hence a token should only be seen on a tuple with an XMAX
+ * that's still in-progress, or invalid/aborted.  The token is replaced with
+ * the tuple's real TID when the insertion is confirmed.  One should never
+ * see a speculative insertion token while following a chain of t_ctid links,
+ * because they are not used on updates, only insertions.
+ *
+ * Following the fixed header fields, the nulls bitmap is stored (beginning
+ * at t_bits).  The bitmap is *not* stored if t_infomask shows that there
+ * are no nulls in the tuple.  If an OID field is present (as indicated by
+ * t_infomask), then it is stored just before the user data, which begins at
+ * the offset shown by t_hoff.  Note that t_hoff must be a multiple of
+ * MAXALIGN.
+ */
+
+typedef struct HeapTupleFields
+{
+	TransactionId t_xmin;		/* inserting xact ID */
+	TransactionId t_xmax;		/* deleting or locking xact ID */
+
+	union
+	{
+		CommandId	t_cid;		/* inserting or deleting command ID, or both */
+		TransactionId t_xvac;	/* old-style VACUUM FULL xact ID */
+	}			t_field3;
+} HeapTupleFields;
+
+typedef struct DatumTupleFields
+{
+	int32		datum_len_;		/* varlena header (do not touch directly!) */
+
+	int32		datum_typmod;	/* -1, or identifier of a record type */
+
+	Oid			datum_typeid;	/* composite type OID, or RECORDOID */
+
+	/*
+	 * Note: field ordering is chosen with thought that Oid might someday
+	 * widen to 64 bits.
+	 */
+} DatumTupleFields;
+
+struct HeapTupleHeaderData
+{
+	union
+	{
+		HeapTupleFields t_heap;
+		DatumTupleFields t_datum;
+	}			t_choice;
+
+	ItemPointerData t_ctid;		/* current TID of this or newer tuple (or a
+								 * speculative insertion token) */
+
+	/* Fields below here must match MinimalTupleData! */
+
+	uint16		t_infomask2;	/* number of attributes + various flags */
+
+	uint16		t_infomask;		/* various flag bits, see below */
+
+	uint8		t_hoff;			/* sizeof header incl. bitmap, padding */
+
+	/* ^ - 23 bytes - ^ */
+
+	bits8		t_bits[FLEXIBLE_ARRAY_MEMBER];	/* bitmap of NULLs */
+
+	/* MORE DATA FOLLOWS AT END OF STRUCT */
+};
+
+/* typedef appears in tupbasics.h */
+
+#define SizeofHeapTupleHeader offsetof(HeapTupleHeaderData, t_bits)
+
+/*
+ * information stored in t_infomask:
+ */
+#define HEAP_HASNULL			0x0001	/* has null attribute(s) */
+#define HEAP_HASVARWIDTH		0x0002	/* has variable-width attribute(s) */
+#define HEAP_HASEXTERNAL		0x0004	/* has external stored attribute(s) */
+#define HEAP_HASOID				0x0008	/* has an object-id field */
+#define HEAP_XMAX_KEYSHR_LOCK	0x0010	/* xmax is a key-shared locker */
+#define HEAP_COMBOCID			0x0020	/* t_cid is a combo cid */
+#define HEAP_XMAX_EXCL_LOCK		0x0040	/* xmax is exclusive locker */
+#define HEAP_XMAX_LOCK_ONLY		0x0080	/* xmax, if valid, is only a locker */
+
+ /* xmax is a shared locker */
+#define HEAP_XMAX_SHR_LOCK	(HEAP_XMAX_EXCL_LOCK | HEAP_XMAX_KEYSHR_LOCK)
+
+#define HEAP_LOCK_MASK	(HEAP_XMAX_SHR_LOCK | HEAP_XMAX_EXCL_LOCK | \
+						 HEAP_XMAX_KEYSHR_LOCK)
+#define HEAP_XMIN_COMMITTED		0x0100	/* t_xmin committed */
+#define HEAP_XMIN_INVALID		0x0200	/* t_xmin invalid/aborted */
+#define HEAP_XMIN_FROZEN		(HEAP_XMIN_COMMITTED|HEAP_XMIN_INVALID)
+#define HEAP_XMAX_COMMITTED		0x0400	/* t_xmax committed */
+#define HEAP_XMAX_INVALID		0x0800	/* t_xmax invalid/aborted */
+#define HEAP_XMAX_IS_MULTI		0x1000	/* t_xmax is a MultiXactId */
+#define HEAP_UPDATED			0x2000	/* this is UPDATEd version of row */
+#define HEAP_MOVED_OFF			0x4000	/* moved to another place by pre-9.0
+										 * VACUUM FULL; kept for binary
+										 * upgrade support */
+#define HEAP_MOVED_IN			0x8000	/* moved from another place by pre-9.0
+										 * VACUUM FULL; kept for binary
+										 * upgrade support */
+#define HEAP_MOVED (HEAP_MOVED_OFF | HEAP_MOVED_IN)
+
+#define HEAP_XACT_MASK			0xFFF0	/* visibility-related bits */
+
+/*
+ * A tuple is only locked (i.e. not updated by its Xmax) if the
+ * HEAP_XMAX_LOCK_ONLY bit is set; or, for pg_upgrade's sake, if the Xmax is
+ * not a multi and the EXCL_LOCK bit is set.
+ *
+ * See also HeapTupleHeaderIsOnlyLocked, which also checks for a possible
+ * aborted updater transaction.
+ *
+ * Beware of multiple evaluations of the argument.
+ */
+#define HEAP_XMAX_IS_LOCKED_ONLY(infomask) \
+	(((infomask) & HEAP_XMAX_LOCK_ONLY) || \
+	 (((infomask) & (HEAP_XMAX_IS_MULTI | HEAP_LOCK_MASK)) == HEAP_XMAX_EXCL_LOCK))
+
+/*
+ * Use these to test whether a particular lock is applied to a tuple
+ */
+#define HEAP_XMAX_IS_SHR_LOCKED(infomask) \
+	(((infomask) & HEAP_LOCK_MASK) == HEAP_XMAX_SHR_LOCK)
+#define HEAP_XMAX_IS_EXCL_LOCKED(infomask) \
+	(((infomask) & HEAP_LOCK_MASK) == HEAP_XMAX_EXCL_LOCK)
+#define HEAP_XMAX_IS_KEYSHR_LOCKED(infomask) \
+	(((infomask) & HEAP_LOCK_MASK) == HEAP_XMAX_KEYSHR_LOCK)
+
+/* turn these all off when Xmax is to change */
+#define HEAP_XMAX_BITS (HEAP_XMAX_COMMITTED | HEAP_XMAX_INVALID | \
+						HEAP_XMAX_IS_MULTI | HEAP_LOCK_MASK | HEAP_XMAX_LOCK_ONLY)
+
+/*
+ * information stored in t_infomask2:
+ */
+#define HEAP_NATTS_MASK			0x07FF	/* 11 bits for number of attributes */
+/* bits 0x1800 are available */
+#define HEAP_KEYS_UPDATED		0x2000	/* tuple was updated and key cols
+										 * modified, or tuple deleted */
+#define HEAP_HOT_UPDATED		0x4000	/* tuple was HOT-updated */
+#define HEAP_ONLY_TUPLE			0x8000	/* this is heap-only tuple */
+
+#define HEAP2_XACT_MASK			0xE000	/* visibility-related bits */
+
+/*
+ * HEAP_TUPLE_HAS_MATCH is a temporary flag used during hash joins.  It is
+ * only used in tuples that are in the hash table, and those don't need
+ * any visibility information, so we can overlay it on a visibility flag
+ * instead of using up a dedicated bit.
+ */
+#define HEAP_TUPLE_HAS_MATCH	HEAP_ONLY_TUPLE /* tuple has a join match */
+
+/*
+ * Special value used in t_ctid.ip_posid, to indicate that it holds a
+ * speculative insertion token rather than a real TID.  This must be higher
+ * than MaxOffsetNumber, so that it can be distinguished from a valid
+ * offset number in a regular item pointer.
+ */
+#define SpecTokenOffsetNumber		0xfffe
+
+/*
+ * HeapTupleHeader accessor macros
+ *
+ * Note: beware of multiple evaluations of "tup" argument.  But the Set
+ * macros evaluate their other argument only once.
+ */
+
+/*
+ * HeapTupleHeaderGetRawXmin returns the "raw" xmin field, which is the xid
+ * originally used to insert the tuple.  However, the tuple might actually
+ * be frozen (via HeapTupleHeaderSetXminFrozen) in which case the tuple's xmin
+ * is visible to every snapshot.  Prior to PostgreSQL 9.4, we actually changed
+ * the xmin to FrozenTransactionId, and that value may still be encountered
+ * on disk.
+ */
+#define HeapTupleHeaderGetRawXmin(tup) \
+( \
+	(tup)->t_choice.t_heap.t_xmin \
+)
+
+#define HeapTupleHeaderGetXmin(tup) \
+( \
+	HeapTupleHeaderXminFrozen(tup) ? \
+		FrozenTransactionId : HeapTupleHeaderGetRawXmin(tup) \
+)
+
+#define HeapTupleHeaderSetXmin(tup, xid) \
+( \
+	(tup)->t_choice.t_heap.t_xmin = (xid) \
+)
+
+#define HeapTupleHeaderXminCommitted(tup) \
+( \
+	(tup)->t_infomask & HEAP_XMIN_COMMITTED \
+)
+
+#define HeapTupleHeaderXminInvalid(tup) \
+( \
+	((tup)->t_infomask & (HEAP_XMIN_COMMITTED|HEAP_XMIN_INVALID)) == \
+		HEAP_XMIN_INVALID \
+)
+
+#define HeapTupleHeaderXminFrozen(tup) \
+( \
+	((tup)->t_infomask & (HEAP_XMIN_FROZEN)) == HEAP_XMIN_FROZEN \
+)
+
+#define HeapTupleHeaderSetXminCommitted(tup) \
+( \
+	AssertMacro(!HeapTupleHeaderXminInvalid(tup)), \
+	((tup)->t_infomask |= HEAP_XMIN_COMMITTED) \
+)
+
+#define HeapTupleHeaderSetXminInvalid(tup) \
+( \
+	AssertMacro(!HeapTupleHeaderXminCommitted(tup)), \
+	((tup)->t_infomask |= HEAP_XMIN_INVALID) \
+)
+
+#define HeapTupleHeaderSetXminFrozen(tup) \
+( \
+	AssertMacro(!HeapTupleHeaderXminInvalid(tup)), \
+	((tup)->t_infomask |= HEAP_XMIN_FROZEN) \
+)
+
+/*
+ * HeapTupleHeaderGetRawXmax gets you the raw Xmax field.  To find out the Xid
+ * that updated a tuple, you might need to resolve the MultiXactId if certain
+ * bits are set.  HeapTupleHeaderGetUpdateXid checks those bits and takes care
+ * to resolve the MultiXactId if necessary.  This might involve multixact I/O,
+ * so it should only be used if absolutely necessary.
+ */
+#define HeapTupleHeaderGetUpdateXid(tup) \
+( \
+	(!((tup)->t_infomask & HEAP_XMAX_INVALID) && \
+	 ((tup)->t_infomask & HEAP_XMAX_IS_MULTI) && \
+	 !((tup)->t_infomask & HEAP_XMAX_LOCK_ONLY)) ? \
+		HeapTupleGetUpdateXid(tup) \
+	: \
+		HeapTupleHeaderGetRawXmax(tup) \
+)
+
+#define HeapTupleHeaderGetRawXmax(tup) \
+( \
+	(tup)->t_choice.t_heap.t_xmax \
+)
+
+#define HeapTupleHeaderSetXmax(tup, xid) \
+( \
+	(tup)->t_choice.t_heap.t_xmax = (xid) \
+)
+
+/*
+ * HeapTupleHeaderGetRawCommandId will give you what's in the header whether
+ * it is useful or not.  Most code should use HeapTupleHeaderGetCmin or
+ * HeapTupleHeaderGetCmax instead, but note that those Assert that you can
+ * get a legitimate result, ie you are in the originating transaction!
+ */
+#define HeapTupleHeaderGetRawCommandId(tup) \
+( \
+	(tup)->t_choice.t_heap.t_field3.t_cid \
+)
+
+/* SetCmin is reasonably simple since we never need a combo CID */
+#define HeapTupleHeaderSetCmin(tup, cid) \
+do { \
+	Assert(!((tup)->t_infomask & HEAP_MOVED)); \
+	(tup)->t_choice.t_heap.t_field3.t_cid = (cid); \
+	(tup)->t_infomask &= ~HEAP_COMBOCID; \
+} while (0)
+
+/* SetCmax must be used after HeapTupleHeaderAdjustCmax; see combocid.c */
+#define HeapTupleHeaderSetCmax(tup, cid, iscombo) \
+do { \
+	Assert(!((tup)->t_infomask & HEAP_MOVED)); \
+	(tup)->t_choice.t_heap.t_field3.t_cid = (cid); \
+	if (iscombo) \
+		(tup)->t_infomask |= HEAP_COMBOCID; \
+	else \
+		(tup)->t_infomask &= ~HEAP_COMBOCID; \
+} while (0)
+
+#define HeapTupleHeaderGetXvac(tup) \
+( \
+	((tup)->t_infomask & HEAP_MOVED) ? \
+		(tup)->t_choice.t_heap.t_field3.t_xvac \
+	: \
+		InvalidTransactionId \
+)
+
+#define HeapTupleHeaderSetXvac(tup, xid) \
+do { \
+	Assert((tup)->t_infomask & HEAP_MOVED); \
+	(tup)->t_choice.t_heap.t_field3.t_xvac = (xid); \
+} while (0)
+
+#define HeapTupleHeaderIsSpeculative(tup) \
+( \
+	(tup)->t_ctid.ip_posid == SpecTokenOffsetNumber \
+)
+
+#define HeapTupleHeaderGetSpeculativeToken(tup) \
+( \
+	AssertMacro(HeapTupleHeaderIsSpeculative(tup)), \
+	ItemPointerGetBlockNumber(&(tup)->t_ctid) \
+)
+
+#define HeapTupleHeaderSetSpeculativeToken(tup, token)	\
+( \
+	ItemPointerSet(&(tup)->t_ctid, token, SpecTokenOffsetNumber) \
+)
+
+#define HeapTupleHeaderGetDatumLength(tup) \
+	VARSIZE(tup)
+
+#define HeapTupleHeaderSetDatumLength(tup, len) \
+	SET_VARSIZE(tup, len)
+
+#define HeapTupleHeaderGetTypeId(tup) \
+( \
+	(tup)->t_choice.t_datum.datum_typeid \
+)
+
+#define HeapTupleHeaderSetTypeId(tup, typeid) \
+( \
+	(tup)->t_choice.t_datum.datum_typeid = (typeid) \
+)
+
+#define HeapTupleHeaderGetTypMod(tup) \
+( \
+	(tup)->t_choice.t_datum.datum_typmod \
+)
+
+#define HeapTupleHeaderSetTypMod(tup, typmod) \
+( \
+	(tup)->t_choice.t_datum.datum_typmod = (typmod) \
+)
+
+#define HeapTupleHeaderGetOid(tup) \
+( \
+	((tup)->t_infomask & HEAP_HASOID) ? \
+		*((Oid *) ((char *)(tup) + (tup)->t_hoff - sizeof(Oid))) \
+	: \
+		InvalidOid \
+)
+
+#define HeapTupleHeaderSetOid(tup, oid) \
+do { \
+	Assert((tup)->t_infomask & HEAP_HASOID); \
+	*((Oid *) ((char *)(tup) + (tup)->t_hoff - sizeof(Oid))) = (oid); \
+} while (0)
+
+/*
+ * Note that we stop considering a tuple HOT-updated as soon as it is known
+ * aborted or the would-be updating transaction is known aborted.  For best
+ * efficiency, check tuple visibility before using this macro, so that the
+ * INVALID bits will be as up to date as possible.
+ */
+#define HeapTupleHeaderIsHotUpdated(tup) \
+( \
+	((tup)->t_infomask2 & HEAP_HOT_UPDATED) != 0 && \
+	((tup)->t_infomask & HEAP_XMAX_INVALID) == 0 && \
+	!HeapTupleHeaderXminInvalid(tup) \
+)
+
+#define HeapTupleHeaderSetHotUpdated(tup) \
+( \
+	(tup)->t_infomask2 |= HEAP_HOT_UPDATED \
+)
+
+#define HeapTupleHeaderClearHotUpdated(tup) \
+( \
+	(tup)->t_infomask2 &= ~HEAP_HOT_UPDATED \
+)
+
+#define HeapTupleHeaderIsHeapOnly(tup) \
+( \
+  (tup)->t_infomask2 & HEAP_ONLY_TUPLE \
+)
+
+#define HeapTupleHeaderSetHeapOnly(tup) \
+( \
+  (tup)->t_infomask2 |= HEAP_ONLY_TUPLE \
+)
+
+#define HeapTupleHeaderClearHeapOnly(tup) \
+( \
+  (tup)->t_infomask2 &= ~HEAP_ONLY_TUPLE \
+)
+
+#define HeapTupleHeaderHasMatch(tup) \
+( \
+  (tup)->t_infomask2 & HEAP_TUPLE_HAS_MATCH \
+)
+
+#define HeapTupleHeaderSetMatch(tup) \
+( \
+  (tup)->t_infomask2 |= HEAP_TUPLE_HAS_MATCH \
+)
+
+#define HeapTupleHeaderClearMatch(tup) \
+( \
+  (tup)->t_infomask2 &= ~HEAP_TUPLE_HAS_MATCH \
+)
+
+#define HeapTupleHeaderGetNatts(tup) \
+	((tup)->t_infomask2 & HEAP_NATTS_MASK)
+
+#define HeapTupleHeaderSetNatts(tup, natts) \
+( \
+	(tup)->t_infomask2 = ((tup)->t_infomask2 & ~HEAP_NATTS_MASK) | (natts) \
+)
+
+#define HeapTupleHeaderHasExternal(tup) \
+		(((tup)->t_infomask & HEAP_HASEXTERNAL) != 0)
+
+
+/*
+ * BITMAPLEN(NATTS) -
+ *		Computes size of null bitmap given number of data columns.
+ */
+#define BITMAPLEN(NATTS)	(((int)(NATTS) + 7) / 8)
+
+/*
+ * MaxHeapTupleSize is the maximum allowed size of a heap tuple, including
+ * header and MAXALIGN alignment padding.  Basically it's BLCKSZ minus the
+ * other stuff that has to be on a disk page.  Since heap pages use no
+ * "special space", there's no deduction for that.
+ *
+ * NOTE: we allow for the ItemId that must point to the tuple, ensuring that
+ * an otherwise-empty page can indeed hold a tuple of this size.  Because
+ * ItemIds and tuples have different alignment requirements, don't assume that
+ * you can, say, fit 2 tuples of size MaxHeapTupleSize/2 on the same page.
+ */
+#define MaxHeapTupleSize  (BLCKSZ - MAXALIGN(SizeOfPageHeaderData + sizeof(ItemIdData)))
+#define MinHeapTupleSize  MAXALIGN(SizeofHeapTupleHeader)
+
+/*
+ * MaxHeapTuplesPerPage is an upper bound on the number of tuples that can
+ * fit on one heap page.  (Note that indexes could have more, because they
+ * use a smaller tuple header.)  We arrive at the divisor because each tuple
+ * must be maxaligned, and it must have an associated item pointer.
+ *
+ * Note: with HOT, there could theoretically be more line pointers (not actual
+ * tuples) than this on a heap page.  However we constrain the number of line
+ * pointers to this anyway, to avoid excessive line-pointer bloat and not
+ * require increases in the size of work arrays.
+ */
+#define MaxHeapTuplesPerPage	\
+	((int) ((BLCKSZ - SizeOfPageHeaderData) / \
+			(MAXALIGN(SizeofHeapTupleHeader) + sizeof(ItemIdData))))
+
+/*
+ * MaxAttrSize is a somewhat arbitrary upper limit on the declared size of
+ * data fields of char(n) and similar types.  It need not have anything
+ * directly to do with the *actual* upper limit of varlena values, which
+ * is currently 1Gb (see TOAST structures in postgres.h).  I've set it
+ * at 10Mb which seems like a reasonable number --- tgl 8/6/00.
+ */
+#define MaxAttrSize		(10 * 1024 * 1024)
+
+
+/*
+ * MinimalTuple is an alternative representation that is used for transient
+ * tuples inside the executor, in places where transaction status information
+ * is not required, the tuple rowtype is known, and shaving off a few bytes
+ * is worthwhile because we need to store many tuples.  The representation
+ * is chosen so that tuple access routines can work with either full or
+ * minimal tuples via a HeapTupleData pointer structure.  The access routines
+ * see no difference, except that they must not access the transaction status
+ * or t_ctid fields because those aren't there.
+ *
+ * For the most part, MinimalTuples should be accessed via TupleTableSlot
+ * routines.  These routines will prevent access to the "system columns"
+ * and thereby prevent accidental use of the nonexistent fields.
+ *
+ * MinimalTupleData contains a length word, some padding, and fields matching
+ * HeapTupleHeaderData beginning with t_infomask2. The padding is chosen so
+ * that offsetof(t_infomask2) is the same modulo MAXIMUM_ALIGNOF in both
+ * structs.   This makes data alignment rules equivalent in both cases.
+ *
+ * When a minimal tuple is accessed via a HeapTupleData pointer, t_data is
+ * set to point MINIMAL_TUPLE_OFFSET bytes before the actual start of the
+ * minimal tuple --- that is, where a full tuple matching the minimal tuple's
+ * data would start.  This trick is what makes the structs seem equivalent.
+ *
+ * Note that t_hoff is computed the same as in a full tuple, hence it includes
+ * the MINIMAL_TUPLE_OFFSET distance.  t_len does not include that, however.
+ *
+ * MINIMAL_TUPLE_DATA_OFFSET is the offset to the first useful (non-pad) data
+ * other than the length word.  tuplesort.c and tuplestore.c use this to avoid
+ * writing the padding to disk.
+ */
+#define MINIMAL_TUPLE_OFFSET \
+	((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) / MAXIMUM_ALIGNOF * MAXIMUM_ALIGNOF)
+#define MINIMAL_TUPLE_PADDING \
+	((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) % MAXIMUM_ALIGNOF)
+#define MINIMAL_TUPLE_DATA_OFFSET \
+	offsetof(MinimalTupleData, t_infomask2)
+
+struct MinimalTupleData
+{
+	uint32		t_len;			/* actual length of minimal tuple */
+
+	char		mt_padding[MINIMAL_TUPLE_PADDING];
+
+	/* Fields below here must match HeapTupleHeaderData! */
+
+	uint16		t_infomask2;	/* number of attributes + various flags */
+
+	uint16		t_infomask;		/* various flag bits, see below */
+
+	uint8		t_hoff;			/* sizeof header incl. bitmap, padding */
+
+	/* ^ - 23 bytes - ^ */
+
+	bits8		t_bits[FLEXIBLE_ARRAY_MEMBER];	/* bitmap of NULLs */
+
+	/* MORE DATA FOLLOWS AT END OF STRUCT */
+};
+
+/* typedef appears in htup.h */
+
+#define SizeofMinimalTupleHeader offsetof(MinimalTupleData, t_bits)
+
+
+/*
+ * GETSTRUCT - given a HeapTuple pointer, return address of the user data
+ */
+#define GETSTRUCT(TUP) ((char *) ((TUP)->t_data) + (TUP)->t_data->t_hoff)
+
+/*
+ * Accessor macros to be used with HeapTuple pointers.
+ */
+
+#define HeapTupleHasNulls(tuple) \
+		(((tuple)->t_data->t_infomask & HEAP_HASNULL) != 0)
+
+#define HeapTupleNoNulls(tuple) \
+		(!((tuple)->t_data->t_infomask & HEAP_HASNULL))
+
+#define HeapTupleHasVarWidth(tuple) \
+		(((tuple)->t_data->t_infomask & HEAP_HASVARWIDTH) != 0)
+
+#define HeapTupleAllFixed(tuple) \
+		(!((tuple)->t_data->t_infomask & HEAP_HASVARWIDTH))
+
+#define HeapTupleHasExternal(tuple) \
+		(((tuple)->t_data->t_infomask & HEAP_HASEXTERNAL) != 0)
+
+#define HeapTupleIsHotUpdated(tuple) \
+		HeapTupleHeaderIsHotUpdated((tuple)->t_data)
+
+#define HeapTupleSetHotUpdated(tuple) \
+		HeapTupleHeaderSetHotUpdated((tuple)->t_data)
+
+#define HeapTupleClearHotUpdated(tuple) \
+		HeapTupleHeaderClearHotUpdated((tuple)->t_data)
+
+#define HeapTupleIsHeapOnly(tuple) \
+		HeapTupleHeaderIsHeapOnly((tuple)->t_data)
+
+#define HeapTupleSetHeapOnly(tuple) \
+		HeapTupleHeaderSetHeapOnly((tuple)->t_data)
+
+#define HeapTupleClearHeapOnly(tuple) \
+		HeapTupleHeaderClearHeapOnly((tuple)->t_data)
+
+#define HeapTupleGetOid(tuple) \
+		HeapTupleHeaderGetOid((tuple)->t_data)
+
+#define HeapTupleSetOid(tuple, oid) \
+		HeapTupleHeaderSetOid((tuple)->t_data, (oid))
+
+
+/* ----------------
+ *		fastgetattr
+ *
+ *		Fetch a user attribute's value as a Datum (might be either a
+ *		value, or a pointer into the data area of the tuple).
+ *
+ *		This must not be used when a system attribute might be requested.
+ *		Furthermore, the passed attnum MUST be valid.  Use heap_getattr()
+ *		instead, if in doubt.
+ *
+ *		This gets called many times, so we macro the cacheable and NULL
+ *		lookups, and call nocachegetattr() for the rest.
+ * ----------------
+ */
+
+#if !defined(DISABLE_COMPLEX_MACRO)
+
+#define fastgetattr(tup, attnum, tupleDesc, isnull)					\
+(																	\
+	AssertMacro((attnum) > 0),										\
+	(*(isnull) = false),											\
+	HeapTupleNoNulls(tup) ?											\
+	(																\
+		(tupleDesc)->attrs[(attnum)-1]->attcacheoff >= 0 ?			\
+		(															\
+			fetchatt((tupleDesc)->attrs[(attnum)-1],				\
+				(char *) (tup)->t_data + (tup)->t_data->t_hoff +	\
+					(tupleDesc)->attrs[(attnum)-1]->attcacheoff)	\
+		)															\
+		:															\
+			nocachegetattr((tup), (attnum), (tupleDesc))			\
+	)																\
+	:																\
+	(																\
+		att_isnull((attnum)-1, (tup)->t_data->t_bits) ?				\
+		(															\
+			(*(isnull) = true),										\
+			(Datum)NULL												\
+		)															\
+		:															\
+		(															\
+			nocachegetattr((tup), (attnum), (tupleDesc))			\
+		)															\
+	)																\
+)
+#else							/* defined(DISABLE_COMPLEX_MACRO) */
+
+extern Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
+			bool *isnull);
+#endif   /* defined(DISABLE_COMPLEX_MACRO) */
+
+
+/* ----------------
+ *		heap_getattr
+ *
+ *		Extract an attribute of a heap tuple and return it as a Datum.
+ *		This works for either system or user attributes.  The given attnum
+ *		is properly range-checked.
+ *
+ *		If the field in question has a NULL value, we return a zero Datum
+ *		and set *isnull == true.  Otherwise, we set *isnull == false.
+ *
+ *		<tup> is the pointer to the heap tuple.  <attnum> is the attribute
+ *		number of the column (field) caller wants.  <tupleDesc> is a
+ *		pointer to the structure describing the row and all its fields.
+ * ----------------
+ */
+#define heap_getattr(tup, attnum, tupleDesc, isnull) \
+	( \
+		((attnum) > 0) ? \
+		( \
+			((attnum) > (int) HeapTupleHeaderGetNatts((tup)->t_data)) ? \
+			( \
+				(*(isnull) = true), \
+				(Datum)NULL \
+			) \
+			: \
+				fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \
+		) \
+		: \
+			heap_getsysattr((tup), (attnum), (tupleDesc), (isnull)) \
+	)
+
+
+/* prototypes for functions in common/heaptuple.c */
+extern Size heap_compute_data_size(TupleDesc tupleDesc,
+					   Datum *values, bool *isnull);
+extern void heap_fill_tuple(TupleDesc tupleDesc,
+				Datum *values, bool *isnull,
+				char *data, Size data_size,
+				uint16 *infomask, bits8 *bit);
+extern bool heap_attisnull(HeapTuple tup, int attnum);
+extern Datum nocachegetattr(HeapTuple tup, int attnum,
+			   TupleDesc att);
+extern Datum heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
+				bool *isnull);
+extern HeapTuple heap_copytuple(HeapTuple tuple);
+extern void heap_copytuple_with_tuple(HeapTuple src, HeapTuple dest);
+extern Datum heap_copy_tuple_as_datum(HeapTuple tuple, TupleDesc tupleDesc);
+extern HeapTuple heap_form_tuple(TupleDesc tupleDescriptor,
+				Datum *values, bool *isnull);
+extern HeapTuple heap_modify_tuple(HeapTuple tuple,
+				  TupleDesc tupleDesc,
+				  Datum *replValues,
+				  bool *replIsnull,
+				  bool *doReplace);
+extern void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
+				  Datum *values, bool *isnull);
+
+/* these three are deprecated versions of the three above: */
+extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor,
+			   Datum *values, char *nulls);
+extern HeapTuple heap_modifytuple(HeapTuple tuple,
+				 TupleDesc tupleDesc,
+				 Datum *replValues,
+				 char *replNulls,
+				 char *replActions);
+extern void heap_deformtuple(HeapTuple tuple, TupleDesc tupleDesc,
+				 Datum *values, char *nulls);
+extern void heap_freetuple(HeapTuple htup);
+extern MinimalTuple heap_form_minimal_tuple(TupleDesc tupleDescriptor,
+						Datum *values, bool *isnull);
+extern void heap_free_minimal_tuple(MinimalTuple mtup);
+extern MinimalTuple heap_copy_minimal_tuple(MinimalTuple mtup);
+extern HeapTuple heap_tuple_from_minimal_tuple(MinimalTuple mtup);
+extern MinimalTuple minimal_tuple_from_heap_tuple(HeapTuple htup);
+
+#endif   /* HTUP_DETAILS_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/itup.h b/foreign/libpg_query/src/postgres/include/access/itup.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/itup.h
@@ -0,0 +1,151 @@
+/*-------------------------------------------------------------------------
+ *
+ * itup.h
+ *	  POSTGRES index tuple definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/itup.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef ITUP_H
+#define ITUP_H
+
+#include "access/tupdesc.h"
+#include "access/tupmacs.h"
+#include "storage/bufpage.h"
+#include "storage/itemptr.h"
+
+/*
+ * Index tuple header structure
+ *
+ * All index tuples start with IndexTupleData.  If the HasNulls bit is set,
+ * this is followed by an IndexAttributeBitMapData.  The index attribute
+ * values follow, beginning at a MAXALIGN boundary.
+ *
+ * Note that the space allocated for the bitmap does not vary with the number
+ * of attributes; that is because we don't have room to store the number of
+ * attributes in the header.  Given the MAXALIGN constraint there's no space
+ * savings to be had anyway, for usual values of INDEX_MAX_KEYS.
+ */
+
+typedef struct IndexTupleData
+{
+	ItemPointerData t_tid;		/* reference TID to heap tuple */
+
+	/* ---------------
+	 * t_info is laid out in the following fashion:
+	 *
+	 * 15th (high) bit: has nulls
+	 * 14th bit: has var-width attributes
+	 * 13th bit: unused
+	 * 12-0 bit: size of tuple
+	 * ---------------
+	 */
+
+	unsigned short t_info;		/* various info about tuple */
+
+} IndexTupleData;				/* MORE DATA FOLLOWS AT END OF STRUCT */
+
+typedef IndexTupleData *IndexTuple;
+
+typedef struct IndexAttributeBitMapData
+{
+	bits8		bits[(INDEX_MAX_KEYS + 8 - 1) / 8];
+}	IndexAttributeBitMapData;
+
+typedef IndexAttributeBitMapData *IndexAttributeBitMap;
+
+/*
+ * t_info manipulation macros
+ */
+#define INDEX_SIZE_MASK 0x1FFF
+/* bit 0x2000 is not used at present */
+#define INDEX_VAR_MASK	0x4000
+#define INDEX_NULL_MASK 0x8000
+
+#define IndexTupleSize(itup)		((Size) (((IndexTuple) (itup))->t_info & INDEX_SIZE_MASK))
+#define IndexTupleDSize(itup)		((Size) ((itup).t_info & INDEX_SIZE_MASK))
+#define IndexTupleHasNulls(itup)	((((IndexTuple) (itup))->t_info & INDEX_NULL_MASK))
+#define IndexTupleHasVarwidths(itup) ((((IndexTuple) (itup))->t_info & INDEX_VAR_MASK))
+
+
+/*
+ * Takes an infomask as argument (primarily because this needs to be usable
+ * at index_form_tuple time so enough space is allocated).
+ */
+#define IndexInfoFindDataOffset(t_info) \
+( \
+	(!((t_info) & INDEX_NULL_MASK)) ? \
+	( \
+		(Size)MAXALIGN(sizeof(IndexTupleData)) \
+	) \
+	: \
+	( \
+		(Size)MAXALIGN(sizeof(IndexTupleData) + sizeof(IndexAttributeBitMapData)) \
+	) \
+)
+
+/* ----------------
+ *		index_getattr
+ *
+ *		This gets called many times, so we macro the cacheable and NULL
+ *		lookups, and call nocache_index_getattr() for the rest.
+ *
+ * ----------------
+ */
+#define index_getattr(tup, attnum, tupleDesc, isnull) \
+( \
+	AssertMacro(PointerIsValid(isnull) && (attnum) > 0), \
+	*(isnull) = false, \
+	!IndexTupleHasNulls(tup) ? \
+	( \
+		(tupleDesc)->attrs[(attnum)-1]->attcacheoff >= 0 ? \
+		( \
+			fetchatt((tupleDesc)->attrs[(attnum)-1], \
+			(char *) (tup) + IndexInfoFindDataOffset((tup)->t_info) \
+			+ (tupleDesc)->attrs[(attnum)-1]->attcacheoff) \
+		) \
+		: \
+			nocache_index_getattr((tup), (attnum), (tupleDesc)) \
+	) \
+	: \
+	( \
+		(att_isnull((attnum)-1, (char *)(tup) + sizeof(IndexTupleData))) ? \
+		( \
+			*(isnull) = true, \
+			(Datum)NULL \
+		) \
+		: \
+		( \
+			nocache_index_getattr((tup), (attnum), (tupleDesc)) \
+		) \
+	) \
+)
+
+/*
+ * MaxIndexTuplesPerPage is an upper bound on the number of tuples that can
+ * fit on one index page.  An index tuple must have either data or a null
+ * bitmap, so we can safely assume it's at least 1 byte bigger than a bare
+ * IndexTupleData struct.  We arrive at the divisor because each tuple
+ * must be maxaligned, and it must have an associated item pointer.
+ */
+#define MinIndexTupleSize MAXALIGN(sizeof(IndexTupleData) + 1)
+#define MaxIndexTuplesPerPage	\
+	((int) ((BLCKSZ - SizeOfPageHeaderData) / \
+			(MAXALIGN(sizeof(IndexTupleData) + 1) + sizeof(ItemIdData))))
+
+
+/* routines in indextuple.c */
+extern IndexTuple index_form_tuple(TupleDesc tupleDescriptor,
+				 Datum *values, bool *isnull);
+extern Datum nocache_index_getattr(IndexTuple tup, int attnum,
+					  TupleDesc tupleDesc);
+extern void index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor,
+				   Datum *values, bool *isnull);
+extern IndexTuple CopyIndexTuple(IndexTuple source);
+
+#endif   /* ITUP_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/parallel.h b/foreign/libpg_query/src/postgres/include/access/parallel.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/parallel.h
@@ -0,0 +1,69 @@
+/*-------------------------------------------------------------------------
+ *
+ * parallel.h
+ *	  Infrastructure for launching parallel workers
+ *
+ * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/parallel.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef PARALLEL_H
+#define PARALLEL_H
+
+#include "access/xlogdefs.h"
+#include "lib/ilist.h"
+#include "postmaster/bgworker.h"
+#include "storage/shm_mq.h"
+#include "storage/shm_toc.h"
+#include "utils/elog.h"
+
+typedef void (*parallel_worker_main_type) (dsm_segment *seg, shm_toc *toc);
+
+typedef struct ParallelWorkerInfo
+{
+	BackgroundWorkerHandle *bgwhandle;
+	shm_mq_handle *error_mqh;
+	int32		pid;
+} ParallelWorkerInfo;
+
+typedef struct ParallelContext
+{
+	dlist_node	node;
+	SubTransactionId subid;
+	int			nworkers;
+	parallel_worker_main_type entrypoint;
+	char	   *library_name;
+	char	   *function_name;
+	ErrorContextCallback *error_context_stack;
+	shm_toc_estimator estimator;
+	dsm_segment *seg;
+	void	   *private_memory;
+	shm_toc    *toc;
+	ParallelWorkerInfo *worker;
+} ParallelContext;
+
+extern bool ParallelMessagePending;
+extern int	ParallelWorkerNumber;
+extern bool InitializingParallelWorker;
+
+#define		IsParallelWorker()		(ParallelWorkerNumber >= 0)
+
+extern ParallelContext *CreateParallelContext(parallel_worker_main_type entrypoint, int nworkers);
+extern ParallelContext *CreateParallelContextForExternalFunction(char *library_name, char *function_name, int nworkers);
+extern void InitializeParallelDSM(ParallelContext *);
+extern void LaunchParallelWorkers(ParallelContext *);
+extern void WaitForParallelWorkersToFinish(ParallelContext *);
+extern void DestroyParallelContext(ParallelContext *);
+extern bool ParallelContextActive(void);
+
+extern void HandleParallelMessageInterrupt(void);
+extern void HandleParallelMessages(void);
+extern void AtEOXact_Parallel(bool isCommit);
+extern void AtEOSubXact_Parallel(bool isCommit, SubTransactionId mySubId);
+extern void ParallelWorkerReportLastRecEnd(XLogRecPtr);
+
+#endif   /* PARALLEL_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/printtup.h b/foreign/libpg_query/src/postgres/include/access/printtup.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/printtup.h
@@ -0,0 +1,35 @@
+/*-------------------------------------------------------------------------
+ *
+ * printtup.h
+ *
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/printtup.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PRINTTUP_H
+#define PRINTTUP_H
+
+#include "utils/portal.h"
+
+extern DestReceiver *printtup_create_DR(CommandDest dest);
+
+extern void SetRemoteDestReceiverParams(DestReceiver *self, Portal portal);
+
+extern void SendRowDescriptionMessage(TupleDesc typeinfo, List *targetlist,
+						  int16 *formats);
+
+extern void debugStartup(DestReceiver *self, int operation,
+			 TupleDesc typeinfo);
+extern void debugtup(TupleTableSlot *slot, DestReceiver *self);
+
+/* XXX these are really in executor/spi.c */
+extern void spi_dest_startup(DestReceiver *self, int operation,
+				 TupleDesc typeinfo);
+extern void spi_printtup(TupleTableSlot *slot, DestReceiver *self);
+
+#endif   /* PRINTTUP_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/rmgr.h b/foreign/libpg_query/src/postgres/include/access/rmgr.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/rmgr.h
@@ -0,0 +1,35 @@
+/*
+ * rmgr.h
+ *
+ * Resource managers definition
+ *
+ * src/include/access/rmgr.h
+ */
+#ifndef RMGR_H
+#define RMGR_H
+
+typedef uint8 RmgrId;
+
+/*
+ * Built-in resource managers
+ *
+ * The actual numerical values for each rmgr ID are defined by the order
+ * of entries in rmgrlist.h.
+ *
+ * Note: RM_MAX_ID must fit in RmgrId; widening that type will affect the XLOG
+ * file format.
+ */
+#define PG_RMGR(symname,name,redo,desc,identify,startup,cleanup) \
+	symname,
+
+typedef enum RmgrIds
+{
+#include "access/rmgrlist.h"
+	RM_NEXT_ID
+} RmgrIds;
+
+#undef PG_RMGR
+
+#define RM_MAX_ID				(RM_NEXT_ID - 1)
+
+#endif   /* RMGR_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/rmgrlist.h b/foreign/libpg_query/src/postgres/include/access/rmgrlist.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/rmgrlist.h
@@ -0,0 +1,47 @@
+/*---------------------------------------------------------------------------
+ * rmgrlist.h
+ *
+ * The resource manager list is kept in its own source file for possible
+ * use by automatic tools.  The exact representation of a rmgr is determined
+ * by the PG_RMGR macro, which is not defined in this file; it can be
+ * defined by the caller for special purposes.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/rmgrlist.h
+ *---------------------------------------------------------------------------
+ */
+
+/* there is deliberately not an #ifndef RMGRLIST_H here */
+
+/*
+ * List of resource manager entries.  Note that order of entries defines the
+ * numerical values of each rmgr's ID, which is stored in WAL records.  New
+ * entries should be added at the end, to avoid changing IDs of existing
+ * entries.
+ *
+ * Changes to this list possibly need an XLOG_PAGE_MAGIC bump.
+ */
+
+/* symbol name, textual name, redo, desc, identify, startup, cleanup */
+PG_RMGR(RM_XLOG_ID, "XLOG", xlog_redo, xlog_desc, xlog_identify, NULL, NULL)
+PG_RMGR(RM_XACT_ID, "Transaction", xact_redo, xact_desc, xact_identify, NULL, NULL)
+PG_RMGR(RM_SMGR_ID, "Storage", smgr_redo, smgr_desc, smgr_identify, NULL, NULL)
+PG_RMGR(RM_CLOG_ID, "CLOG", clog_redo, clog_desc, clog_identify, NULL, NULL)
+PG_RMGR(RM_DBASE_ID, "Database", dbase_redo, dbase_desc, dbase_identify, NULL, NULL)
+PG_RMGR(RM_TBLSPC_ID, "Tablespace", tblspc_redo, tblspc_desc, tblspc_identify, NULL, NULL)
+PG_RMGR(RM_MULTIXACT_ID, "MultiXact", multixact_redo, multixact_desc, multixact_identify, NULL, NULL)
+PG_RMGR(RM_RELMAP_ID, "RelMap", relmap_redo, relmap_desc, relmap_identify, NULL, NULL)
+PG_RMGR(RM_STANDBY_ID, "Standby", standby_redo, standby_desc, standby_identify, NULL, NULL)
+PG_RMGR(RM_HEAP2_ID, "Heap2", heap2_redo, heap2_desc, heap2_identify, NULL, NULL)
+PG_RMGR(RM_HEAP_ID, "Heap", heap_redo, heap_desc, heap_identify, NULL, NULL)
+PG_RMGR(RM_BTREE_ID, "Btree", btree_redo, btree_desc, btree_identify, NULL, NULL)
+PG_RMGR(RM_HASH_ID, "Hash", hash_redo, hash_desc, hash_identify, NULL, NULL)
+PG_RMGR(RM_GIN_ID, "Gin", gin_redo, gin_desc, gin_identify, gin_xlog_startup, gin_xlog_cleanup)
+PG_RMGR(RM_GIST_ID, "Gist", gist_redo, gist_desc, gist_identify, gist_xlog_startup, gist_xlog_cleanup)
+PG_RMGR(RM_SEQ_ID, "Sequence", seq_redo, seq_desc, seq_identify, NULL, NULL)
+PG_RMGR(RM_SPGIST_ID, "SPGist", spg_redo, spg_desc, spg_identify, spg_xlog_startup, spg_xlog_cleanup)
+PG_RMGR(RM_BRIN_ID, "BRIN", brin_redo, brin_desc, brin_identify, NULL, NULL)
+PG_RMGR(RM_COMMIT_TS_ID, "CommitTs", commit_ts_redo, commit_ts_desc, commit_ts_identify, NULL, NULL)
+PG_RMGR(RM_REPLORIGIN_ID, "ReplicationOrigin", replorigin_redo, replorigin_desc, replorigin_identify, NULL, NULL)
diff --git a/foreign/libpg_query/src/postgres/include/access/sdir.h b/foreign/libpg_query/src/postgres/include/access/sdir.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/sdir.h
@@ -0,0 +1,58 @@
+/*-------------------------------------------------------------------------
+ *
+ * sdir.h
+ *	  POSTGRES scan direction definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/sdir.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef SDIR_H
+#define SDIR_H
+
+
+/*
+ * ScanDirection was an int8 for no apparent reason. I kept the original
+ * values because I'm not sure if I'll break anything otherwise.  -ay 2/95
+ */
+typedef enum ScanDirection
+{
+	BackwardScanDirection = -1,
+	NoMovementScanDirection = 0,
+	ForwardScanDirection = 1
+} ScanDirection;
+
+/*
+ * ScanDirectionIsValid
+ *		True iff scan direction is valid.
+ */
+#define ScanDirectionIsValid(direction) \
+	((bool) (BackwardScanDirection <= (direction) && \
+			 (direction) <= ForwardScanDirection))
+
+/*
+ * ScanDirectionIsBackward
+ *		True iff scan direction is backward.
+ */
+#define ScanDirectionIsBackward(direction) \
+	((bool) ((direction) == BackwardScanDirection))
+
+/*
+ * ScanDirectionIsNoMovement
+ *		True iff scan direction indicates no movement.
+ */
+#define ScanDirectionIsNoMovement(direction) \
+	((bool) ((direction) == NoMovementScanDirection))
+
+/*
+ * ScanDirectionIsForward
+ *		True iff scan direction is forward.
+ */
+#define ScanDirectionIsForward(direction) \
+	((bool) ((direction) == ForwardScanDirection))
+
+#endif   /* SDIR_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/skey.h b/foreign/libpg_query/src/postgres/include/access/skey.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/skey.h
@@ -0,0 +1,152 @@
+/*-------------------------------------------------------------------------
+ *
+ * skey.h
+ *	  POSTGRES scan key definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/skey.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef SKEY_H
+#define SKEY_H
+
+#include "access/attnum.h"
+#include "access/stratnum.h"
+#include "fmgr.h"
+
+
+/*
+ * A ScanKey represents the application of a comparison operator between
+ * a table or index column and a constant.  When it's part of an array of
+ * ScanKeys, the comparison conditions are implicitly ANDed.  The index
+ * column is the left argument of the operator, if it's a binary operator.
+ * (The data structure can support unary indexable operators too; in that
+ * case sk_argument would go unused.  This is not currently implemented.)
+ *
+ * For an index scan, sk_strategy and sk_subtype must be set correctly for
+ * the operator.  When using a ScanKey in a heap scan, these fields are not
+ * used and may be set to InvalidStrategy/InvalidOid.
+ *
+ * If the operator is collation-sensitive, sk_collation must be set
+ * correctly as well.
+ *
+ * A ScanKey can also represent a ScalarArrayOpExpr, that is a condition
+ * "column op ANY(ARRAY[...])".  This is signaled by the SK_SEARCHARRAY
+ * flag bit.  The sk_argument is not a value of the operator's right-hand
+ * argument type, but rather an array of such values, and the per-element
+ * comparisons are to be ORed together.
+ *
+ * A ScanKey can also represent a condition "column IS NULL" or "column
+ * IS NOT NULL"; these cases are signaled by the SK_SEARCHNULL and
+ * SK_SEARCHNOTNULL flag bits respectively.  The argument is always NULL,
+ * and the sk_strategy, sk_subtype, sk_collation, and sk_func fields are
+ * not used (unless set by the index AM).
+ *
+ * SK_SEARCHARRAY, SK_SEARCHNULL and SK_SEARCHNOTNULL are supported only
+ * for index scans, not heap scans; and not all index AMs support them,
+ * only those that set amsearcharray or amsearchnulls respectively.
+ *
+ * A ScanKey can also represent an ordering operator invocation, that is
+ * an ordering requirement "ORDER BY indexedcol op constant".  This looks
+ * the same as a comparison operator, except that the operator doesn't
+ * (usually) yield boolean.  We mark such ScanKeys with SK_ORDER_BY.
+ * SK_SEARCHARRAY, SK_SEARCHNULL, SK_SEARCHNOTNULL cannot be used here.
+ *
+ * Note: in some places, ScanKeys are used as a convenient representation
+ * for the invocation of an access method support procedure.  In this case
+ * sk_strategy/sk_subtype are not meaningful (but sk_collation can be); and
+ * sk_func may refer to a function that returns something other than boolean.
+ */
+typedef struct ScanKeyData
+{
+	int			sk_flags;		/* flags, see below */
+	AttrNumber	sk_attno;		/* table or index column number */
+	StrategyNumber sk_strategy; /* operator strategy number */
+	Oid			sk_subtype;		/* strategy subtype */
+	Oid			sk_collation;	/* collation to use, if needed */
+	FmgrInfo	sk_func;		/* lookup info for function to call */
+	Datum		sk_argument;	/* data to compare */
+} ScanKeyData;
+
+typedef ScanKeyData *ScanKey;
+
+/*
+ * About row comparisons:
+ *
+ * The ScanKey data structure also supports row comparisons, that is ordered
+ * tuple comparisons like (x, y) > (c1, c2), having the SQL-spec semantics
+ * "x > c1 OR (x = c1 AND y > c2)".  Note that this is currently only
+ * implemented for btree index searches, not for heapscans or any other index
+ * type.  A row comparison is represented by a "header" ScanKey entry plus
+ * a separate array of ScanKeys, one for each column of the row comparison.
+ * The header entry has these properties:
+ *		sk_flags = SK_ROW_HEADER
+ *		sk_attno = index column number for leading column of row comparison
+ *		sk_strategy = btree strategy code for semantics of row comparison
+ *				(ie, < <= > or >=)
+ *		sk_subtype, sk_collation, sk_func: not used
+ *		sk_argument: pointer to subsidiary ScanKey array
+ * If the header is part of a ScanKey array that's sorted by attno, it
+ * must be sorted according to the leading column number.
+ *
+ * The subsidiary ScanKey array appears in logical column order of the row
+ * comparison, which may be different from index column order.  The array
+ * elements are like a normal ScanKey array except that:
+ *		sk_flags must include SK_ROW_MEMBER, plus SK_ROW_END in the last
+ *				element (needed since row header does not include a count)
+ *		sk_func points to the btree comparison support function for the
+ *				opclass, NOT the operator's implementation function.
+ * sk_strategy must be the same in all elements of the subsidiary array,
+ * that is, the same as in the header entry.
+ * SK_SEARCHARRAY, SK_SEARCHNULL, SK_SEARCHNOTNULL cannot be used here.
+ */
+
+/*
+ * ScanKeyData sk_flags
+ *
+ * sk_flags bits 0-15 are reserved for system-wide use (symbols for those
+ * bits should be defined here).  Bits 16-31 are reserved for use within
+ * individual index access methods.
+ */
+#define SK_ISNULL			0x0001		/* sk_argument is NULL */
+#define SK_UNARY			0x0002		/* unary operator (not supported!) */
+#define SK_ROW_HEADER		0x0004		/* row comparison header (see above) */
+#define SK_ROW_MEMBER		0x0008		/* row comparison member (see above) */
+#define SK_ROW_END			0x0010		/* last row comparison member */
+#define SK_SEARCHARRAY		0x0020		/* scankey represents ScalarArrayOp */
+#define SK_SEARCHNULL		0x0040		/* scankey represents "col IS NULL" */
+#define SK_SEARCHNOTNULL	0x0080		/* scankey represents "col IS NOT
+										 * NULL" */
+#define SK_ORDER_BY			0x0100		/* scankey is for ORDER BY op */
+
+
+/*
+ * prototypes for functions in access/common/scankey.c
+ */
+extern void ScanKeyInit(ScanKey entry,
+			AttrNumber attributeNumber,
+			StrategyNumber strategy,
+			RegProcedure procedure,
+			Datum argument);
+extern void ScanKeyEntryInitialize(ScanKey entry,
+					   int flags,
+					   AttrNumber attributeNumber,
+					   StrategyNumber strategy,
+					   Oid subtype,
+					   Oid collation,
+					   RegProcedure procedure,
+					   Datum argument);
+extern void ScanKeyEntryInitializeWithInfo(ScanKey entry,
+							   int flags,
+							   AttrNumber attributeNumber,
+							   StrategyNumber strategy,
+							   Oid subtype,
+							   Oid collation,
+							   FmgrInfo *finfo,
+							   Datum argument);
+
+#endif   /* SKEY_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/stratnum.h b/foreign/libpg_query/src/postgres/include/access/stratnum.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/stratnum.h
@@ -0,0 +1,75 @@
+/*-------------------------------------------------------------------------
+ *
+ * stratnum.h
+ *	  POSTGRES strategy number definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/stratnum.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef STRATNUM_H
+#define STRATNUM_H
+
+/*
+ * Strategy numbers identify the semantics that particular operators have
+ * with respect to particular operator classes.  In some cases a strategy
+ * subtype (an OID) is used as further information.
+ */
+typedef uint16 StrategyNumber;
+
+#define InvalidStrategy ((StrategyNumber) 0)
+
+/*
+ * Strategy numbers for B-tree indexes.
+ */
+#define BTLessStrategyNumber			1
+#define BTLessEqualStrategyNumber		2
+#define BTEqualStrategyNumber			3
+#define BTGreaterEqualStrategyNumber	4
+#define BTGreaterStrategyNumber			5
+
+#define BTMaxStrategyNumber				5
+
+
+/*
+ * Strategy numbers common to (some) GiST, SP-GiST and BRIN opclasses.
+ *
+ * The first few of these come from the R-Tree indexing method (hence the
+ * names); the others have been added over time as they have been needed.
+ */
+#define RTLeftStrategyNumber			1		/* for << */
+#define RTOverLeftStrategyNumber		2		/* for &< */
+#define RTOverlapStrategyNumber			3		/* for && */
+#define RTOverRightStrategyNumber		4		/* for &> */
+#define RTRightStrategyNumber			5		/* for >> */
+#define RTSameStrategyNumber			6		/* for ~= */
+#define RTContainsStrategyNumber		7		/* for @> */
+#define RTContainedByStrategyNumber		8		/* for <@ */
+#define RTOverBelowStrategyNumber		9		/* for &<| */
+#define RTBelowStrategyNumber			10		/* for <<| */
+#define RTAboveStrategyNumber			11		/* for |>> */
+#define RTOverAboveStrategyNumber		12		/* for |&> */
+#define RTOldContainsStrategyNumber		13		/* for old spelling of @> */
+#define RTOldContainedByStrategyNumber	14		/* for old spelling of <@ */
+#define RTKNNSearchStrategyNumber		15		/* for <-> (distance) */
+#define RTContainsElemStrategyNumber	16		/* for range types @> elem */
+#define RTAdjacentStrategyNumber		17		/* for -|- */
+#define RTEqualStrategyNumber			18		/* for = */
+#define RTNotEqualStrategyNumber		19		/* for != */
+#define RTLessStrategyNumber			20		/* for < */
+#define RTLessEqualStrategyNumber		21		/* for <= */
+#define RTGreaterStrategyNumber			22		/* for > */
+#define RTGreaterEqualStrategyNumber	23		/* for >= */
+#define RTSubStrategyNumber				24		/* for inet >> */
+#define RTSubEqualStrategyNumber		25		/* for inet <<= */
+#define RTSuperStrategyNumber			26		/* for inet << */
+#define RTSuperEqualStrategyNumber		27		/* for inet >>= */
+
+#define RTMaxStrategyNumber				27
+
+
+#endif   /* STRATNUM_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/sysattr.h b/foreign/libpg_query/src/postgres/include/access/sysattr.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/sysattr.h
@@ -0,0 +1,30 @@
+/*-------------------------------------------------------------------------
+ *
+ * sysattr.h
+ *	  POSTGRES system attribute definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/sysattr.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef SYSATTR_H
+#define SYSATTR_H
+
+
+/*
+ * Attribute numbers for the system-defined attributes
+ */
+#define SelfItemPointerAttributeNumber			(-1)
+#define ObjectIdAttributeNumber					(-2)
+#define MinTransactionIdAttributeNumber			(-3)
+#define MinCommandIdAttributeNumber				(-4)
+#define MaxTransactionIdAttributeNumber			(-5)
+#define MaxCommandIdAttributeNumber				(-6)
+#define TableOidAttributeNumber					(-7)
+#define FirstLowInvalidHeapAttributeNumber		(-8)
+
+#endif   /* SYSATTR_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/transam.h b/foreign/libpg_query/src/postgres/include/access/transam.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/transam.h
@@ -0,0 +1,179 @@
+/*-------------------------------------------------------------------------
+ *
+ * transam.h
+ *	  postgres transaction access method support code
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/transam.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TRANSAM_H
+#define TRANSAM_H
+
+#include "access/xlogdefs.h"
+
+
+/* ----------------
+ *		Special transaction ID values
+ *
+ * BootstrapTransactionId is the XID for "bootstrap" operations, and
+ * FrozenTransactionId is used for very old tuples.  Both should
+ * always be considered valid.
+ *
+ * FirstNormalTransactionId is the first "normal" transaction id.
+ * Note: if you need to change it, you must change pg_class.h as well.
+ * ----------------
+ */
+#define InvalidTransactionId		((TransactionId) 0)
+#define BootstrapTransactionId		((TransactionId) 1)
+#define FrozenTransactionId			((TransactionId) 2)
+#define FirstNormalTransactionId	((TransactionId) 3)
+#define MaxTransactionId			((TransactionId) 0xFFFFFFFF)
+
+/* ----------------
+ *		transaction ID manipulation macros
+ * ----------------
+ */
+#define TransactionIdIsValid(xid)		((xid) != InvalidTransactionId)
+#define TransactionIdIsNormal(xid)		((xid) >= FirstNormalTransactionId)
+#define TransactionIdEquals(id1, id2)	((id1) == (id2))
+#define TransactionIdStore(xid, dest)	(*(dest) = (xid))
+#define StoreInvalidTransactionId(dest) (*(dest) = InvalidTransactionId)
+
+/* advance a transaction ID variable, handling wraparound correctly */
+#define TransactionIdAdvance(dest)	\
+	do { \
+		(dest)++; \
+		if ((dest) < FirstNormalTransactionId) \
+			(dest) = FirstNormalTransactionId; \
+	} while(0)
+
+/* back up a transaction ID variable, handling wraparound correctly */
+#define TransactionIdRetreat(dest)	\
+	do { \
+		(dest)--; \
+	} while ((dest) < FirstNormalTransactionId)
+
+/* compare two XIDs already known to be normal; this is a macro for speed */
+#define NormalTransactionIdPrecedes(id1, id2) \
+	(AssertMacro(TransactionIdIsNormal(id1) && TransactionIdIsNormal(id2)), \
+	(int32) ((id1) - (id2)) < 0)
+
+/* compare two XIDs already known to be normal; this is a macro for speed */
+#define NormalTransactionIdFollows(id1, id2) \
+	(AssertMacro(TransactionIdIsNormal(id1) && TransactionIdIsNormal(id2)), \
+	(int32) ((id1) - (id2)) > 0)
+
+/* ----------
+ *		Object ID (OID) zero is InvalidOid.
+ *
+ *		OIDs 1-9999 are reserved for manual assignment (see the files
+ *		in src/include/catalog/).
+ *
+ *		OIDS 10000-16383 are reserved for assignment during initdb
+ *		using the OID generator.  (We start the generator at 10000.)
+ *
+ *		OIDs beginning at 16384 are assigned from the OID generator
+ *		during normal multiuser operation.  (We force the generator up to
+ *		16384 as soon as we are in normal operation.)
+ *
+ * The choices of 10000 and 16384 are completely arbitrary, and can be moved
+ * if we run low on OIDs in either category.  Changing the macros below
+ * should be sufficient to do this.
+ *
+ * NOTE: if the OID generator wraps around, we skip over OIDs 0-16383
+ * and resume with 16384.  This minimizes the odds of OID conflict, by not
+ * reassigning OIDs that might have been assigned during initdb.
+ * ----------
+ */
+#define FirstBootstrapObjectId	10000
+#define FirstNormalObjectId		16384
+
+/*
+ * VariableCache is a data structure in shared memory that is used to track
+ * OID and XID assignment state.  For largely historical reasons, there is
+ * just one struct with different fields that are protected by different
+ * LWLocks.
+ *
+ * Note: xidWrapLimit and oldestXidDB are not "active" values, but are
+ * used just to generate useful messages when xidWarnLimit or xidStopLimit
+ * are exceeded.
+ */
+typedef struct VariableCacheData
+{
+	/*
+	 * These fields are protected by OidGenLock.
+	 */
+	Oid			nextOid;		/* next OID to assign */
+	uint32		oidCount;		/* OIDs available before must do XLOG work */
+
+	/*
+	 * These fields are protected by XidGenLock.
+	 */
+	TransactionId nextXid;		/* next XID to assign */
+
+	TransactionId oldestXid;	/* cluster-wide minimum datfrozenxid */
+	TransactionId xidVacLimit;	/* start forcing autovacuums here */
+	TransactionId xidWarnLimit; /* start complaining here */
+	TransactionId xidStopLimit; /* refuse to advance nextXid beyond here */
+	TransactionId xidWrapLimit; /* where the world ends */
+	Oid			oldestXidDB;	/* database with minimum datfrozenxid */
+
+	/*
+	 * These fields are protected by CommitTsLock
+	 */
+	TransactionId oldestCommitTsXid;
+	TransactionId newestCommitTsXid;
+
+	/*
+	 * These fields are protected by ProcArrayLock.
+	 */
+	TransactionId latestCompletedXid;	/* newest XID that has committed or
+										 * aborted */
+} VariableCacheData;
+
+typedef VariableCacheData *VariableCache;
+
+
+/* ----------------
+ *		extern declarations
+ * ----------------
+ */
+
+/* in transam/xact.c */
+extern bool TransactionStartedDuringRecovery(void);
+
+/* in transam/varsup.c */
+extern PGDLLIMPORT VariableCache ShmemVariableCache;
+
+/*
+ * prototypes for functions in transam/transam.c
+ */
+extern bool TransactionIdDidCommit(TransactionId transactionId);
+extern bool TransactionIdDidAbort(TransactionId transactionId);
+extern bool TransactionIdIsKnownCompleted(TransactionId transactionId);
+extern void TransactionIdAbort(TransactionId transactionId);
+extern void TransactionIdCommitTree(TransactionId xid, int nxids, TransactionId *xids);
+extern void TransactionIdAsyncCommitTree(TransactionId xid, int nxids, TransactionId *xids, XLogRecPtr lsn);
+extern void TransactionIdAbortTree(TransactionId xid, int nxids, TransactionId *xids);
+extern bool TransactionIdPrecedes(TransactionId id1, TransactionId id2);
+extern bool TransactionIdPrecedesOrEquals(TransactionId id1, TransactionId id2);
+extern bool TransactionIdFollows(TransactionId id1, TransactionId id2);
+extern bool TransactionIdFollowsOrEquals(TransactionId id1, TransactionId id2);
+extern TransactionId TransactionIdLatest(TransactionId mainxid,
+					int nxids, const TransactionId *xids);
+extern XLogRecPtr TransactionIdGetCommitLSN(TransactionId xid);
+
+/* in transam/varsup.c */
+extern TransactionId GetNewTransactionId(bool isSubXact);
+extern TransactionId ReadNewTransactionId(void);
+extern void SetTransactionIdLimit(TransactionId oldest_datfrozenxid,
+					  Oid oldest_datoid);
+extern bool ForceTransactionIdLimitUpdate(void);
+extern Oid	GetNewObjectId(void);
+
+#endif   /* TRAMSAM_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/tupdesc.h b/foreign/libpg_query/src/postgres/include/access/tupdesc.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/tupdesc.h
@@ -0,0 +1,130 @@
+/*-------------------------------------------------------------------------
+ *
+ * tupdesc.h
+ *	  POSTGRES tuple descriptor definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/tupdesc.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TUPDESC_H
+#define TUPDESC_H
+
+#include "access/attnum.h"
+#include "catalog/pg_attribute.h"
+#include "nodes/pg_list.h"
+
+
+typedef struct attrDefault
+{
+	AttrNumber	adnum;
+	char	   *adbin;			/* nodeToString representation of expr */
+} AttrDefault;
+
+typedef struct constrCheck
+{
+	char	   *ccname;
+	char	   *ccbin;			/* nodeToString representation of expr */
+	bool		ccvalid;
+	bool		ccnoinherit;	/* this is a non-inheritable constraint */
+} ConstrCheck;
+
+/* This structure contains constraints of a tuple */
+typedef struct tupleConstr
+{
+	AttrDefault *defval;		/* array */
+	ConstrCheck *check;			/* array */
+	uint16		num_defval;
+	uint16		num_check;
+	bool		has_not_null;
+} TupleConstr;
+
+/*
+ * This struct is passed around within the backend to describe the structure
+ * of tuples.  For tuples coming from on-disk relations, the information is
+ * collected from the pg_attribute, pg_attrdef, and pg_constraint catalogs.
+ * Transient row types (such as the result of a join query) have anonymous
+ * TupleDesc structs that generally omit any constraint info; therefore the
+ * structure is designed to let the constraints be omitted efficiently.
+ *
+ * Note that only user attributes, not system attributes, are mentioned in
+ * TupleDesc; with the exception that tdhasoid indicates if OID is present.
+ *
+ * If the tupdesc is known to correspond to a named rowtype (such as a table's
+ * rowtype) then tdtypeid identifies that type and tdtypmod is -1.  Otherwise
+ * tdtypeid is RECORDOID, and tdtypmod can be either -1 for a fully anonymous
+ * row type, or a value >= 0 to allow the rowtype to be looked up in the
+ * typcache.c type cache.
+ *
+ * Tuple descriptors that live in caches (relcache or typcache, at present)
+ * are reference-counted: they can be deleted when their reference count goes
+ * to zero.  Tuple descriptors created by the executor need no reference
+ * counting, however: they are simply created in the appropriate memory
+ * context and go away when the context is freed.  We set the tdrefcount
+ * field of such a descriptor to -1, while reference-counted descriptors
+ * always have tdrefcount >= 0.
+ */
+typedef struct tupleDesc
+{
+	int			natts;			/* number of attributes in the tuple */
+	Form_pg_attribute *attrs;
+	/* attrs[N] is a pointer to the description of Attribute Number N+1 */
+	TupleConstr *constr;		/* constraints, or NULL if none */
+	Oid			tdtypeid;		/* composite type ID for tuple type */
+	int32		tdtypmod;		/* typmod for tuple type */
+	bool		tdhasoid;		/* tuple has oid attribute in its header */
+	int			tdrefcount;		/* reference count, or -1 if not counting */
+}	*TupleDesc;
+
+
+extern TupleDesc CreateTemplateTupleDesc(int natts, bool hasoid);
+
+extern TupleDesc CreateTupleDesc(int natts, bool hasoid,
+				Form_pg_attribute *attrs);
+
+extern TupleDesc CreateTupleDescCopy(TupleDesc tupdesc);
+
+extern TupleDesc CreateTupleDescCopyConstr(TupleDesc tupdesc);
+
+extern void TupleDescCopyEntry(TupleDesc dst, AttrNumber dstAttno,
+				   TupleDesc src, AttrNumber srcAttno);
+
+extern void FreeTupleDesc(TupleDesc tupdesc);
+
+extern void IncrTupleDescRefCount(TupleDesc tupdesc);
+extern void DecrTupleDescRefCount(TupleDesc tupdesc);
+
+#define PinTupleDesc(tupdesc) \
+	do { \
+		if ((tupdesc)->tdrefcount >= 0) \
+			IncrTupleDescRefCount(tupdesc); \
+	} while (0)
+
+#define ReleaseTupleDesc(tupdesc) \
+	do { \
+		if ((tupdesc)->tdrefcount >= 0) \
+			DecrTupleDescRefCount(tupdesc); \
+	} while (0)
+
+extern bool equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2);
+
+extern void TupleDescInitEntry(TupleDesc desc,
+				   AttrNumber attributeNumber,
+				   const char *attributeName,
+				   Oid oidtypeid,
+				   int32 typmod,
+				   int attdim);
+
+extern void TupleDescInitEntryCollation(TupleDesc desc,
+							AttrNumber attributeNumber,
+							Oid collationid);
+
+extern TupleDesc BuildDescForRelation(List *schema);
+
+extern TupleDesc BuildDescFromLists(List *names, List *types, List *typmods, List *collations);
+
+#endif   /* TUPDESC_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/tupmacs.h b/foreign/libpg_query/src/postgres/include/access/tupmacs.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/tupmacs.h
@@ -0,0 +1,243 @@
+/*-------------------------------------------------------------------------
+ *
+ * tupmacs.h
+ *	  Tuple macros used by both index tuples and heap tuples.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/tupmacs.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TUPMACS_H
+#define TUPMACS_H
+
+
+/*
+ * check to see if the ATT'th bit of an array of 8-bit bytes is set.
+ */
+#define att_isnull(ATT, BITS) (!((BITS)[(ATT) >> 3] & (1 << ((ATT) & 0x07))))
+
+/*
+ * Given a Form_pg_attribute and a pointer into a tuple's data area,
+ * return the correct value or pointer.
+ *
+ * We return a Datum value in all cases.  If the attribute has "byval" false,
+ * we return the same pointer into the tuple data area that we're passed.
+ * Otherwise, we return the correct number of bytes fetched from the data
+ * area and extended to Datum form.
+ *
+ * On machines where Datum is 8 bytes, we support fetching 8-byte byval
+ * attributes; otherwise, only 1, 2, and 4-byte values are supported.
+ *
+ * Note that T must already be properly aligned for this to work correctly.
+ */
+#define fetchatt(A,T) fetch_att(T, (A)->attbyval, (A)->attlen)
+
+/*
+ * Same, but work from byval/len parameters rather than Form_pg_attribute.
+ */
+#if SIZEOF_DATUM == 8
+
+#define fetch_att(T,attbyval,attlen) \
+( \
+	(attbyval) ? \
+	( \
+		(attlen) == (int) sizeof(Datum) ? \
+			*((Datum *)(T)) \
+		: \
+	  ( \
+		(attlen) == (int) sizeof(int32) ? \
+			Int32GetDatum(*((int32 *)(T))) \
+		: \
+		( \
+			(attlen) == (int) sizeof(int16) ? \
+				Int16GetDatum(*((int16 *)(T))) \
+			: \
+			( \
+				AssertMacro((attlen) == 1), \
+				CharGetDatum(*((char *)(T))) \
+			) \
+		) \
+	  ) \
+	) \
+	: \
+	PointerGetDatum((char *) (T)) \
+)
+#else							/* SIZEOF_DATUM != 8 */
+
+#define fetch_att(T,attbyval,attlen) \
+( \
+	(attbyval) ? \
+	( \
+		(attlen) == (int) sizeof(int32) ? \
+			Int32GetDatum(*((int32 *)(T))) \
+		: \
+		( \
+			(attlen) == (int) sizeof(int16) ? \
+				Int16GetDatum(*((int16 *)(T))) \
+			: \
+			( \
+				AssertMacro((attlen) == 1), \
+				CharGetDatum(*((char *)(T))) \
+			) \
+		) \
+	) \
+	: \
+	PointerGetDatum((char *) (T)) \
+)
+#endif   /* SIZEOF_DATUM == 8 */
+
+/*
+ * att_align_datum aligns the given offset as needed for a datum of alignment
+ * requirement attalign and typlen attlen.  attdatum is the Datum variable
+ * we intend to pack into a tuple (it's only accessed if we are dealing with
+ * a varlena type).  Note that this assumes the Datum will be stored as-is;
+ * callers that are intending to convert non-short varlena datums to short
+ * format have to account for that themselves.
+ */
+#define att_align_datum(cur_offset, attalign, attlen, attdatum) \
+( \
+	((attlen) == -1 && VARATT_IS_SHORT(DatumGetPointer(attdatum))) ? \
+	(uintptr_t) (cur_offset) : \
+	att_align_nominal(cur_offset, attalign) \
+)
+
+/*
+ * att_align_pointer performs the same calculation as att_align_datum,
+ * but is used when walking a tuple.  attptr is the current actual data
+ * pointer; when accessing a varlena field we have to "peek" to see if we
+ * are looking at a pad byte or the first byte of a 1-byte-header datum.
+ * (A zero byte must be either a pad byte, or the first byte of a correctly
+ * aligned 4-byte length word; in either case we can align safely.  A non-zero
+ * byte must be either a 1-byte length word, or the first byte of a correctly
+ * aligned 4-byte length word; in either case we need not align.)
+ *
+ * Note: some callers pass a "char *" pointer for cur_offset.  This is
+ * a bit of a hack but should work all right as long as uintptr_t is the
+ * correct width.
+ */
+#define att_align_pointer(cur_offset, attalign, attlen, attptr) \
+( \
+	((attlen) == -1 && VARATT_NOT_PAD_BYTE(attptr)) ? \
+	(uintptr_t) (cur_offset) : \
+	att_align_nominal(cur_offset, attalign) \
+)
+
+/*
+ * att_align_nominal aligns the given offset as needed for a datum of alignment
+ * requirement attalign, ignoring any consideration of packed varlena datums.
+ * There are three main use cases for using this macro directly:
+ *	* we know that the att in question is not varlena (attlen != -1);
+ *	  in this case it is cheaper than the above macros and just as good.
+ *	* we need to estimate alignment padding cost abstractly, ie without
+ *	  reference to a real tuple.  We must assume the worst case that
+ *	  all varlenas are aligned.
+ *	* within arrays, we unconditionally align varlenas (XXX this should be
+ *	  revisited, probably).
+ *
+ * The attalign cases are tested in what is hopefully something like their
+ * frequency of occurrence.
+ */
+#define att_align_nominal(cur_offset, attalign) \
+( \
+	((attalign) == 'i') ? INTALIGN(cur_offset) : \
+	 (((attalign) == 'c') ? (uintptr_t) (cur_offset) : \
+	  (((attalign) == 'd') ? DOUBLEALIGN(cur_offset) : \
+	   ( \
+			AssertMacro((attalign) == 's'), \
+			SHORTALIGN(cur_offset) \
+	   ))) \
+)
+
+/*
+ * att_addlength_datum increments the given offset by the space needed for
+ * the given Datum variable.  attdatum is only accessed if we are dealing
+ * with a variable-length attribute.
+ */
+#define att_addlength_datum(cur_offset, attlen, attdatum) \
+	att_addlength_pointer(cur_offset, attlen, DatumGetPointer(attdatum))
+
+/*
+ * att_addlength_pointer performs the same calculation as att_addlength_datum,
+ * but is used when walking a tuple --- attptr is the pointer to the field
+ * within the tuple.
+ *
+ * Note: some callers pass a "char *" pointer for cur_offset.  This is
+ * actually perfectly OK, but probably should be cleaned up along with
+ * the same practice for att_align_pointer.
+ */
+#define att_addlength_pointer(cur_offset, attlen, attptr) \
+( \
+	((attlen) > 0) ? \
+	( \
+		(cur_offset) + (attlen) \
+	) \
+	: (((attlen) == -1) ? \
+	( \
+		(cur_offset) + VARSIZE_ANY(attptr) \
+	) \
+	: \
+	( \
+		AssertMacro((attlen) == -2), \
+		(cur_offset) + (strlen((char *) (attptr)) + 1) \
+	)) \
+)
+
+/*
+ * store_att_byval is a partial inverse of fetch_att: store a given Datum
+ * value into a tuple data area at the specified address.  However, it only
+ * handles the byval case, because in typical usage the caller needs to
+ * distinguish by-val and by-ref cases anyway, and so a do-it-all macro
+ * wouldn't be convenient.
+ */
+#if SIZEOF_DATUM == 8
+
+#define store_att_byval(T,newdatum,attlen) \
+	do { \
+		switch (attlen) \
+		{ \
+			case sizeof(char): \
+				*(char *) (T) = DatumGetChar(newdatum); \
+				break; \
+			case sizeof(int16): \
+				*(int16 *) (T) = DatumGetInt16(newdatum); \
+				break; \
+			case sizeof(int32): \
+				*(int32 *) (T) = DatumGetInt32(newdatum); \
+				break; \
+			case sizeof(Datum): \
+				*(Datum *) (T) = (newdatum); \
+				break; \
+			default: \
+				elog(ERROR, "unsupported byval length: %d", \
+					 (int) (attlen)); \
+				break; \
+		} \
+	} while (0)
+#else							/* SIZEOF_DATUM != 8 */
+
+#define store_att_byval(T,newdatum,attlen) \
+	do { \
+		switch (attlen) \
+		{ \
+			case sizeof(char): \
+				*(char *) (T) = DatumGetChar(newdatum); \
+				break; \
+			case sizeof(int16): \
+				*(int16 *) (T) = DatumGetInt16(newdatum); \
+				break; \
+			case sizeof(int32): \
+				*(int32 *) (T) = DatumGetInt32(newdatum); \
+				break; \
+			default: \
+				elog(ERROR, "unsupported byval length: %d", \
+					 (int) (attlen)); \
+				break; \
+		} \
+	} while (0)
+#endif   /* SIZEOF_DATUM == 8 */
+
+#endif
diff --git a/foreign/libpg_query/src/postgres/include/access/twophase.h b/foreign/libpg_query/src/postgres/include/access/twophase.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/twophase.h
@@ -0,0 +1,59 @@
+/*-------------------------------------------------------------------------
+ *
+ * twophase.h
+ *	  Two-phase-commit related declarations.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/twophase.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TWOPHASE_H
+#define TWOPHASE_H
+
+#include "access/xlogdefs.h"
+#include "datatype/timestamp.h"
+#include "storage/lock.h"
+
+/*
+ * GlobalTransactionData is defined in twophase.c; other places have no
+ * business knowing the internal definition.
+ */
+typedef struct GlobalTransactionData *GlobalTransaction;
+
+/* GUC variable */
+extern int	max_prepared_xacts;
+
+extern Size TwoPhaseShmemSize(void);
+extern void TwoPhaseShmemInit(void);
+
+extern void AtAbort_Twophase(void);
+extern void PostPrepare_Twophase(void);
+
+extern PGPROC *TwoPhaseGetDummyProc(TransactionId xid);
+extern BackendId TwoPhaseGetDummyBackendId(TransactionId xid);
+
+extern GlobalTransaction MarkAsPreparing(TransactionId xid, const char *gid,
+				TimestampTz prepared_at,
+				Oid owner, Oid databaseid);
+
+extern void StartPrepare(GlobalTransaction gxact);
+extern void EndPrepare(GlobalTransaction gxact);
+extern bool StandbyTransactionIdIsPrepared(TransactionId xid);
+
+extern TransactionId PrescanPreparedTransactions(TransactionId **xids_p,
+							int *nxids_p);
+extern void StandbyRecoverPreparedTransactions(bool overwriteOK);
+extern void RecoverPreparedTransactions(void);
+
+extern void RecreateTwoPhaseFile(TransactionId xid, void *content, int len);
+extern void RemoveTwoPhaseFile(TransactionId xid, bool giveWarning);
+
+extern void CheckPointTwoPhase(XLogRecPtr redo_horizon);
+
+extern void FinishPreparedTransaction(const char *gid, bool isCommit);
+
+#endif   /* TWOPHASE_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/xact.h b/foreign/libpg_query/src/postgres/include/access/xact.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/xact.h
@@ -0,0 +1,383 @@
+/*-------------------------------------------------------------------------
+ *
+ * xact.h
+ *	  postgres transaction system definitions
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/xact.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef XACT_H
+#define XACT_H
+
+#include "access/xlogreader.h"
+#include "lib/stringinfo.h"
+#include "nodes/pg_list.h"
+#include "storage/relfilenode.h"
+#include "storage/sinval.h"
+#include "utils/datetime.h"
+
+
+/*
+ * Xact isolation levels
+ */
+#define XACT_READ_UNCOMMITTED	0
+#define XACT_READ_COMMITTED		1
+#define XACT_REPEATABLE_READ	2
+#define XACT_SERIALIZABLE		3
+
+extern int	DefaultXactIsoLevel;
+extern PGDLLIMPORT int XactIsoLevel;
+
+/*
+ * We implement three isolation levels internally.
+ * The two stronger ones use one snapshot per database transaction;
+ * the others use one snapshot per statement.
+ * Serializable uses predicate locks in addition to snapshots.
+ * These macros should be used to check which isolation level is selected.
+ */
+#define IsolationUsesXactSnapshot() (XactIsoLevel >= XACT_REPEATABLE_READ)
+#define IsolationIsSerializable() (XactIsoLevel == XACT_SERIALIZABLE)
+
+/* Xact read-only state */
+extern bool DefaultXactReadOnly;
+extern bool XactReadOnly;
+
+/*
+ * Xact is deferrable -- only meaningful (currently) for read only
+ * SERIALIZABLE transactions
+ */
+extern bool DefaultXactDeferrable;
+extern bool XactDeferrable;
+
+typedef enum
+{
+	SYNCHRONOUS_COMMIT_OFF,		/* asynchronous commit */
+	SYNCHRONOUS_COMMIT_LOCAL_FLUSH,		/* wait for local flush only */
+	SYNCHRONOUS_COMMIT_REMOTE_WRITE,	/* wait for local flush and remote
+										 * write */
+	SYNCHRONOUS_COMMIT_REMOTE_FLUSH		/* wait for local and remote flush */
+}	SyncCommitLevel;
+
+/* Define the default setting for synchonous_commit */
+#define SYNCHRONOUS_COMMIT_ON	SYNCHRONOUS_COMMIT_REMOTE_FLUSH
+
+/* Synchronous commit level */
+extern int	synchronous_commit;
+
+/* Kluge for 2PC support */
+extern bool MyXactAccessedTempRel;
+
+/*
+ *	start- and end-of-transaction callbacks for dynamically loaded modules
+ */
+typedef enum
+{
+	XACT_EVENT_COMMIT,
+	XACT_EVENT_PARALLEL_COMMIT,
+	XACT_EVENT_ABORT,
+	XACT_EVENT_PARALLEL_ABORT,
+	XACT_EVENT_PREPARE,
+	XACT_EVENT_PRE_COMMIT,
+	XACT_EVENT_PARALLEL_PRE_COMMIT,
+	XACT_EVENT_PRE_PREPARE
+} XactEvent;
+
+typedef void (*XactCallback) (XactEvent event, void *arg);
+
+typedef enum
+{
+	SUBXACT_EVENT_START_SUB,
+	SUBXACT_EVENT_COMMIT_SUB,
+	SUBXACT_EVENT_ABORT_SUB,
+	SUBXACT_EVENT_PRE_COMMIT_SUB
+} SubXactEvent;
+
+typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid,
+									SubTransactionId parentSubid, void *arg);
+
+
+/* ----------------
+ *		transaction-related XLOG entries
+ * ----------------
+ */
+
+/*
+ * XLOG allows to store some information in high 4 bits of log record xl_info
+ * field. We use 3 for the opcode, and one about an optional flag variable.
+ */
+#define XLOG_XACT_COMMIT			0x00
+#define XLOG_XACT_PREPARE			0x10
+#define XLOG_XACT_ABORT				0x20
+#define XLOG_XACT_COMMIT_PREPARED	0x30
+#define XLOG_XACT_ABORT_PREPARED	0x40
+#define XLOG_XACT_ASSIGNMENT		0x50
+/* free opcode 0x60 */
+/* free opcode 0x70 */
+
+/* mask for filtering opcodes out of xl_info */
+#define XLOG_XACT_OPMASK			0x70
+
+/* does this record have a 'xinfo' field or not */
+#define XLOG_XACT_HAS_INFO			0x80
+
+/*
+ * The following flags, stored in xinfo, determine which information is
+ * contained in commit/abort records.
+ */
+#define XACT_XINFO_HAS_DBINFO			(1U << 0)
+#define XACT_XINFO_HAS_SUBXACTS			(1U << 1)
+#define XACT_XINFO_HAS_RELFILENODES		(1U << 2)
+#define XACT_XINFO_HAS_INVALS			(1U << 3)
+#define XACT_XINFO_HAS_TWOPHASE			(1U << 4)
+#define XACT_XINFO_HAS_ORIGIN			(1U << 5)
+
+/*
+ * Also stored in xinfo, these indicating a variety of additional actions that
+ * need to occur when emulating transaction effects during recovery.
+ *
+ * They are named XactCompletion... to differentiate them from
+ * EOXact... routines which run at the end of the original transaction
+ * completion.
+ */
+#define XACT_COMPLETION_UPDATE_RELCACHE_FILE	(1U << 30)
+#define XACT_COMPLETION_FORCE_SYNC_COMMIT		(1U << 31)
+
+/* Access macros for above flags */
+#define XactCompletionRelcacheInitFileInval(xinfo) \
+	(!!(xinfo & XACT_COMPLETION_UPDATE_RELCACHE_FILE))
+#define XactCompletionForceSyncCommit(xinfo) \
+	(!!(xinfo & XACT_COMPLETION_FORCE_SYNC_COMMIT))
+
+typedef struct xl_xact_assignment
+{
+	TransactionId xtop;			/* assigned XID's top-level XID */
+	int			nsubxacts;		/* number of subtransaction XIDs */
+	TransactionId xsub[FLEXIBLE_ARRAY_MEMBER];	/* assigned subxids */
+} xl_xact_assignment;
+
+#define MinSizeOfXactAssignment offsetof(xl_xact_assignment, xsub)
+
+/*
+ * Commit and abort records can contain a lot of information. But a large
+ * portion of the records won't need all possible pieces of information. So we
+ * only include what's needed.
+ *
+ * A minimal commit/abort record only consists of a xl_xact_commit/abort
+ * struct. The presence of additional information is indicated by bits set in
+ * 'xl_xact_xinfo->xinfo'. The presence of the xinfo field itself is signalled
+ * by a set XLOG_XACT_HAS_INFO bit in the xl_info field.
+ *
+ * NB: All the individual data chunks should be sized to multiples of
+ * sizeof(int) and only require int32 alignment. If they require bigger
+ * alignment, they need to be copied upon reading.
+ */
+
+/* sub-records for commit/abort */
+
+typedef struct xl_xact_xinfo
+{
+	/*
+	 * Even though we right now only require 1 byte of space in xinfo we use
+	 * four so following records don't have to care about alignment. Commit
+	 * records can be large, so copying large portions isn't attractive.
+	 */
+	uint32		xinfo;
+} xl_xact_xinfo;
+
+typedef struct xl_xact_dbinfo
+{
+	Oid			dbId;			/* MyDatabaseId */
+	Oid			tsId;			/* MyDatabaseTableSpace */
+} xl_xact_dbinfo;
+
+typedef struct xl_xact_subxacts
+{
+	int			nsubxacts;		/* number of subtransaction XIDs */
+	TransactionId subxacts[FLEXIBLE_ARRAY_MEMBER];
+} xl_xact_subxacts;
+#define MinSizeOfXactSubxacts offsetof(xl_xact_subxacts, subxacts)
+
+typedef struct xl_xact_relfilenodes
+{
+	int			nrels;			/* number of subtransaction XIDs */
+	RelFileNode xnodes[FLEXIBLE_ARRAY_MEMBER];
+} xl_xact_relfilenodes;
+#define MinSizeOfXactRelfilenodes offsetof(xl_xact_relfilenodes, xnodes)
+
+typedef struct xl_xact_invals
+{
+	int			nmsgs;			/* number of shared inval msgs */
+	SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER];
+} xl_xact_invals;
+#define MinSizeOfXactInvals offsetof(xl_xact_invals, msgs)
+
+typedef struct xl_xact_twophase
+{
+	TransactionId xid;
+} xl_xact_twophase;
+#define MinSizeOfXactInvals offsetof(xl_xact_invals, msgs)
+
+typedef struct xl_xact_origin
+{
+	XLogRecPtr	origin_lsn;
+	TimestampTz origin_timestamp;
+} xl_xact_origin;
+
+typedef struct xl_xact_commit
+{
+	TimestampTz xact_time;		/* time of commit */
+
+	/* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */
+	/* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */
+	/* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */
+	/* xl_xact_relfilenodes follows if XINFO_HAS_RELFILENODES */
+	/* xl_xact_invals follows if XINFO_HAS_INVALS */
+	/* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
+	/* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */
+} xl_xact_commit;
+#define MinSizeOfXactCommit (offsetof(xl_xact_commit, xact_time) + sizeof(TimestampTz))
+
+typedef struct xl_xact_abort
+{
+	TimestampTz xact_time;		/* time of abort */
+
+	/* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */
+	/* No db_info required */
+	/* xl_xact_subxacts follows if HAS_SUBXACT */
+	/* xl_xact_relfilenodes follows if HAS_RELFILENODES */
+	/* No invalidation messages needed. */
+	/* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
+} xl_xact_abort;
+#define MinSizeOfXactAbort sizeof(xl_xact_abort)
+
+/*
+ * Commit/Abort records in the above form are a bit verbose to parse, so
+ * there's a deconstructed versions generated by ParseCommit/AbortRecord() for
+ * easier consumption.
+ */
+typedef struct xl_xact_parsed_commit
+{
+	TimestampTz xact_time;
+
+	uint32		xinfo;
+
+	Oid			dbId;			/* MyDatabaseId */
+	Oid			tsId;			/* MyDatabaseTableSpace */
+
+	int			nsubxacts;
+	TransactionId *subxacts;
+
+	int			nrels;
+	RelFileNode *xnodes;
+
+	int			nmsgs;
+	SharedInvalidationMessage *msgs;
+
+	TransactionId twophase_xid; /* only for 2PC */
+
+	XLogRecPtr	origin_lsn;
+	TimestampTz origin_timestamp;
+} xl_xact_parsed_commit;
+
+typedef struct xl_xact_parsed_abort
+{
+	TimestampTz xact_time;
+	uint32		xinfo;
+
+	int			nsubxacts;
+	TransactionId *subxacts;
+
+	int			nrels;
+	RelFileNode *xnodes;
+
+	TransactionId twophase_xid; /* only for 2PC */
+} xl_xact_parsed_abort;
+
+
+/* ----------------
+ *		extern definitions
+ * ----------------
+ */
+extern bool IsTransactionState(void);
+extern bool IsAbortedTransactionBlockState(void);
+extern TransactionId GetTopTransactionId(void);
+extern TransactionId GetTopTransactionIdIfAny(void);
+extern TransactionId GetCurrentTransactionId(void);
+extern TransactionId GetCurrentTransactionIdIfAny(void);
+extern TransactionId GetStableLatestTransactionId(void);
+extern SubTransactionId GetCurrentSubTransactionId(void);
+extern void MarkCurrentTransactionIdLoggedIfAny(void);
+extern bool SubTransactionIsActive(SubTransactionId subxid);
+extern CommandId GetCurrentCommandId(bool used);
+extern TimestampTz GetCurrentTransactionStartTimestamp(void);
+extern TimestampTz GetCurrentStatementStartTimestamp(void);
+extern TimestampTz GetCurrentTransactionStopTimestamp(void);
+extern void SetCurrentStatementStartTimestamp(void);
+extern int	GetCurrentTransactionNestLevel(void);
+extern bool TransactionIdIsCurrentTransactionId(TransactionId xid);
+extern void CommandCounterIncrement(void);
+extern void ForceSyncCommit(void);
+extern void StartTransactionCommand(void);
+extern void CommitTransactionCommand(void);
+extern void AbortCurrentTransaction(void);
+extern void BeginTransactionBlock(void);
+extern bool EndTransactionBlock(void);
+extern bool PrepareTransactionBlock(char *gid);
+extern void UserAbortTransactionBlock(void);
+extern void ReleaseSavepoint(List *options);
+extern void DefineSavepoint(char *name);
+extern void RollbackToSavepoint(List *options);
+extern void BeginInternalSubTransaction(char *name);
+extern void ReleaseCurrentSubTransaction(void);
+extern void RollbackAndReleaseCurrentSubTransaction(void);
+extern bool IsSubTransaction(void);
+extern Size EstimateTransactionStateSpace(void);
+extern void SerializeTransactionState(Size maxsize, char *start_address);
+extern void StartParallelWorkerTransaction(char *tstatespace);
+extern void EndParallelWorkerTransaction(void);
+extern bool IsTransactionBlock(void);
+extern bool IsTransactionOrTransactionBlock(void);
+extern char TransactionBlockStatusCode(void);
+extern void AbortOutOfAnyTransaction(void);
+extern void PreventTransactionChain(bool isTopLevel, const char *stmtType);
+extern void RequireTransactionChain(bool isTopLevel, const char *stmtType);
+extern void WarnNoTransactionChain(bool isTopLevel, const char *stmtType);
+extern bool IsInTransactionChain(bool isTopLevel);
+extern void RegisterXactCallback(XactCallback callback, void *arg);
+extern void UnregisterXactCallback(XactCallback callback, void *arg);
+extern void RegisterSubXactCallback(SubXactCallback callback, void *arg);
+extern void UnregisterSubXactCallback(SubXactCallback callback, void *arg);
+
+extern int	xactGetCommittedChildren(TransactionId **ptr);
+
+extern XLogRecPtr XactLogCommitRecord(TimestampTz commit_time,
+					int nsubxacts, TransactionId *subxacts,
+					int nrels, RelFileNode *rels,
+					int nmsgs, SharedInvalidationMessage *msgs,
+					bool relcacheInval, bool forceSync,
+					TransactionId twophase_xid);
+
+extern XLogRecPtr XactLogAbortRecord(TimestampTz abort_time,
+				   int nsubxacts, TransactionId *subxacts,
+				   int nrels, RelFileNode *rels,
+				   TransactionId twophase_xid);
+extern void xact_redo(XLogReaderState *record);
+
+/* xactdesc.c */
+extern void xact_desc(StringInfo buf, XLogReaderState *record);
+extern const char *xact_identify(uint8 info);
+
+/* also in xactdesc.c, so they can be shared between front/backend code */
+extern void ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *parsed);
+extern void ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed);
+
+extern void EnterParallelMode(void);
+extern void ExitParallelMode(void);
+extern bool IsInParallelMode(void);
+
+#endif   /* XACT_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/xlog.h b/foreign/libpg_query/src/postgres/include/access/xlog.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/xlog.h
@@ -0,0 +1,291 @@
+/*
+ * xlog.h
+ *
+ * PostgreSQL transaction log manager
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/xlog.h
+ */
+#ifndef XLOG_H
+#define XLOG_H
+
+#include "access/rmgr.h"
+#include "access/xlogdefs.h"
+#include "access/xloginsert.h"
+#include "access/xlogreader.h"
+#include "datatype/timestamp.h"
+#include "lib/stringinfo.h"
+#include "nodes/pg_list.h"
+#include "storage/fd.h"
+
+
+/* Sync methods */
+#define SYNC_METHOD_FSYNC		0
+#define SYNC_METHOD_FDATASYNC	1
+#define SYNC_METHOD_OPEN		2		/* for O_SYNC */
+#define SYNC_METHOD_FSYNC_WRITETHROUGH	3
+#define SYNC_METHOD_OPEN_DSYNC	4		/* for O_DSYNC */
+extern int	sync_method;
+
+extern PGDLLIMPORT TimeLineID ThisTimeLineID;	/* current TLI */
+
+/*
+ * Prior to 8.4, all activity during recovery was carried out by the startup
+ * process. This local variable continues to be used in many parts of the
+ * code to indicate actions taken by RecoveryManagers. Other processes that
+ * potentially perform work during recovery should check RecoveryInProgress().
+ * See XLogCtl notes in xlog.c.
+ */
+extern bool InRecovery;
+
+/*
+ * Like InRecovery, standbyState is only valid in the startup process.
+ * In all other processes it will have the value STANDBY_DISABLED (so
+ * InHotStandby will read as FALSE).
+ *
+ * In DISABLED state, we're performing crash recovery or hot standby was
+ * disabled in postgresql.conf.
+ *
+ * In INITIALIZED state, we've run InitRecoveryTransactionEnvironment, but
+ * we haven't yet processed a RUNNING_XACTS or shutdown-checkpoint WAL record
+ * to initialize our master-transaction tracking system.
+ *
+ * When the transaction tracking is initialized, we enter the SNAPSHOT_PENDING
+ * state. The tracked information might still be incomplete, so we can't allow
+ * connections yet, but redo functions must update the in-memory state when
+ * appropriate.
+ *
+ * In SNAPSHOT_READY mode, we have full knowledge of transactions that are
+ * (or were) running in the master at the current WAL location. Snapshots
+ * can be taken, and read-only queries can be run.
+ */
+typedef enum
+{
+	STANDBY_DISABLED,
+	STANDBY_INITIALIZED,
+	STANDBY_SNAPSHOT_PENDING,
+	STANDBY_SNAPSHOT_READY
+} HotStandbyState;
+
+extern HotStandbyState standbyState;
+
+#define InHotStandby (standbyState >= STANDBY_SNAPSHOT_PENDING)
+
+/*
+ * Recovery target type.
+ * Only set during a Point in Time recovery, not when standby_mode = on
+ */
+typedef enum
+{
+	RECOVERY_TARGET_UNSET,
+	RECOVERY_TARGET_XID,
+	RECOVERY_TARGET_TIME,
+	RECOVERY_TARGET_NAME,
+	RECOVERY_TARGET_IMMEDIATE
+} RecoveryTargetType;
+
+extern XLogRecPtr XactLastRecEnd;
+extern PGDLLIMPORT XLogRecPtr XactLastCommitEnd;
+
+extern bool reachedConsistency;
+
+/* these variables are GUC parameters related to XLOG */
+extern int	min_wal_size;
+extern int	max_wal_size;
+extern int	wal_keep_segments;
+extern int	XLOGbuffers;
+extern int	XLogArchiveTimeout;
+extern int	wal_retrieve_retry_interval;
+extern char *XLogArchiveCommand;
+extern bool EnableHotStandby;
+extern bool fullPageWrites;
+extern bool wal_log_hints;
+extern bool wal_compression;
+extern bool log_checkpoints;
+
+extern int	CheckPointSegments;
+
+/* Archive modes */
+typedef enum ArchiveMode
+{
+	ARCHIVE_MODE_OFF = 0,		/* disabled */
+	ARCHIVE_MODE_ON,			/* enabled while server is running normally */
+	ARCHIVE_MODE_ALWAYS			/* enabled always (even during recovery) */
+} ArchiveMode;
+extern int	XLogArchiveMode;
+
+/* WAL levels */
+typedef enum WalLevel
+{
+	WAL_LEVEL_MINIMAL = 0,
+	WAL_LEVEL_ARCHIVE,
+	WAL_LEVEL_HOT_STANDBY,
+	WAL_LEVEL_LOGICAL
+} WalLevel;
+extern int	wal_level;
+
+/* Is WAL archiving enabled (always or only while server is running normally)? */
+#define XLogArchivingActive() \
+	(XLogArchiveMode > ARCHIVE_MODE_OFF && wal_level >= WAL_LEVEL_ARCHIVE)
+/* Is WAL archiving enabled always (even during recovery)? */
+#define XLogArchivingAlways() \
+	(XLogArchiveMode == ARCHIVE_MODE_ALWAYS && wal_level >= WAL_LEVEL_ARCHIVE)
+#define XLogArchiveCommandSet() (XLogArchiveCommand[0] != '\0')
+
+/*
+ * Is WAL-logging necessary for archival or log-shipping, or can we skip
+ * WAL-logging if we fsync() the data before committing instead?
+ */
+#define XLogIsNeeded() (wal_level >= WAL_LEVEL_ARCHIVE)
+
+/*
+ * Is a full-page image needed for hint bit updates?
+ *
+ * Normally, we don't WAL-log hint bit updates, but if checksums are enabled,
+ * we have to protect them against torn page writes.  When you only set
+ * individual bits on a page, it's still consistent no matter what combination
+ * of the bits make it to disk, but the checksum wouldn't match.  Also WAL-log
+ * them if forced by wal_log_hints=on.
+ */
+#define XLogHintBitIsNeeded() (DataChecksumsEnabled() || wal_log_hints)
+
+/* Do we need to WAL-log information required only for Hot Standby and logical replication? */
+#define XLogStandbyInfoActive() (wal_level >= WAL_LEVEL_HOT_STANDBY)
+
+/* Do we need to WAL-log information required only for logical replication? */
+#define XLogLogicalInfoActive() (wal_level >= WAL_LEVEL_LOGICAL)
+
+#ifdef WAL_DEBUG
+extern bool XLOG_DEBUG;
+#endif
+
+/*
+ * OR-able request flag bits for checkpoints.  The "cause" bits are used only
+ * for logging purposes.  Note: the flags must be defined so that it's
+ * sensible to OR together request flags arising from different requestors.
+ */
+
+/* These directly affect the behavior of CreateCheckPoint and subsidiaries */
+#define CHECKPOINT_IS_SHUTDOWN	0x0001	/* Checkpoint is for shutdown */
+#define CHECKPOINT_END_OF_RECOVERY	0x0002		/* Like shutdown checkpoint,
+												 * but issued at end of WAL
+												 * recovery */
+#define CHECKPOINT_IMMEDIATE	0x0004	/* Do it without delays */
+#define CHECKPOINT_FORCE		0x0008	/* Force even if no activity */
+#define CHECKPOINT_FLUSH_ALL	0x0010	/* Flush all pages, including those
+										 * belonging to unlogged tables */
+/* These are important to RequestCheckpoint */
+#define CHECKPOINT_WAIT			0x0020	/* Wait for completion */
+/* These indicate the cause of a checkpoint request */
+#define CHECKPOINT_CAUSE_XLOG	0x0040	/* XLOG consumption */
+#define CHECKPOINT_CAUSE_TIME	0x0080	/* Elapsed time */
+
+/* Checkpoint statistics */
+typedef struct CheckpointStatsData
+{
+	TimestampTz ckpt_start_t;	/* start of checkpoint */
+	TimestampTz ckpt_write_t;	/* start of flushing buffers */
+	TimestampTz ckpt_sync_t;	/* start of fsyncs */
+	TimestampTz ckpt_sync_end_t;	/* end of fsyncs */
+	TimestampTz ckpt_end_t;		/* end of checkpoint */
+
+	int			ckpt_bufs_written;		/* # of buffers written */
+
+	int			ckpt_segs_added;	/* # of new xlog segments created */
+	int			ckpt_segs_removed;		/* # of xlog segments deleted */
+	int			ckpt_segs_recycled;		/* # of xlog segments recycled */
+
+	int			ckpt_sync_rels; /* # of relations synced */
+	uint64		ckpt_longest_sync;		/* Longest sync for one relation */
+	uint64		ckpt_agg_sync_time;		/* The sum of all the individual sync
+										 * times, which is not necessarily the
+										 * same as the total elapsed time for
+										 * the entire sync phase. */
+} CheckpointStatsData;
+
+extern CheckpointStatsData CheckpointStats;
+
+struct XLogRecData;
+
+extern XLogRecPtr XLogInsertRecord(struct XLogRecData *rdata, XLogRecPtr fpw_lsn);
+extern void XLogFlush(XLogRecPtr RecPtr);
+extern bool XLogBackgroundFlush(void);
+extern bool XLogNeedsFlush(XLogRecPtr RecPtr);
+extern int	XLogFileInit(XLogSegNo segno, bool *use_existent, bool use_lock);
+extern int	XLogFileOpen(XLogSegNo segno);
+
+extern void CheckXLogRemoved(XLogSegNo segno, TimeLineID tli);
+extern XLogSegNo XLogGetLastRemovedSegno(void);
+extern void XLogSetAsyncXactLSN(XLogRecPtr record);
+extern void XLogSetReplicationSlotMinimumLSN(XLogRecPtr lsn);
+
+extern void xlog_redo(XLogReaderState *record);
+extern void xlog_desc(StringInfo buf, XLogReaderState *record);
+extern const char *xlog_identify(uint8 info);
+
+extern void issue_xlog_fsync(int fd, XLogSegNo segno);
+
+extern bool RecoveryInProgress(void);
+extern bool HotStandbyActive(void);
+extern bool HotStandbyActiveInReplay(void);
+extern bool XLogInsertAllowed(void);
+extern void GetXLogReceiptTime(TimestampTz *rtime, bool *fromStream);
+extern XLogRecPtr GetXLogReplayRecPtr(TimeLineID *replayTLI);
+extern XLogRecPtr GetXLogInsertRecPtr(void);
+extern XLogRecPtr GetXLogWriteRecPtr(void);
+extern bool RecoveryIsPaused(void);
+extern void SetRecoveryPause(bool recoveryPause);
+extern TimestampTz GetLatestXTime(void);
+extern TimestampTz GetCurrentChunkReplayStartTime(void);
+extern char *XLogFileNameP(TimeLineID tli, XLogSegNo segno);
+
+extern void UpdateControlFile(void);
+extern uint64 GetSystemIdentifier(void);
+extern bool DataChecksumsEnabled(void);
+extern XLogRecPtr GetFakeLSNForUnloggedRel(void);
+extern Size XLOGShmemSize(void);
+extern void XLOGShmemInit(void);
+extern void BootStrapXLOG(void);
+extern void StartupXLOG(void);
+extern void ShutdownXLOG(int code, Datum arg);
+extern void InitXLOGAccess(void);
+extern void CreateCheckPoint(int flags);
+extern bool CreateRestartPoint(int flags);
+extern void XLogPutNextOid(Oid nextOid);
+extern XLogRecPtr XLogRestorePoint(const char *rpName);
+extern void UpdateFullPageWrites(void);
+extern void GetFullPageWriteInfo(XLogRecPtr *RedoRecPtr_p, bool *doPageWrites_p);
+extern XLogRecPtr GetRedoRecPtr(void);
+extern XLogRecPtr GetInsertRecPtr(void);
+extern XLogRecPtr GetFlushRecPtr(void);
+extern void GetNextXidAndEpoch(TransactionId *xid, uint32 *epoch);
+extern void RemovePromoteSignalFiles(void);
+
+extern bool CheckPromoteSignal(void);
+extern void WakeupRecovery(void);
+extern void SetWalWriterSleeping(bool sleeping);
+
+extern void assign_max_wal_size(int newval, void *extra);
+extern void assign_checkpoint_completion_target(double newval, void *extra);
+
+/*
+ * Starting/stopping a base backup
+ */
+extern XLogRecPtr do_pg_start_backup(const char *backupidstr, bool fast,
+				   TimeLineID *starttli_p, char **labelfile, DIR *tblspcdir,
+				   List **tablespaces, char **tblspcmapfile, bool infotbssize,
+				   bool needtblspcmapfile);
+extern XLogRecPtr do_pg_stop_backup(char *labelfile, bool waitforarchive,
+				  TimeLineID *stoptli_p);
+extern void do_pg_abort_backup(void);
+
+/* File path names (all relative to $PGDATA) */
+#define BACKUP_LABEL_FILE		"backup_label"
+#define BACKUP_LABEL_OLD		"backup_label.old"
+
+#define TABLESPACE_MAP			"tablespace_map"
+#define TABLESPACE_MAP_OLD		"tablespace_map.old"
+
+#endif   /* XLOG_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/xlogdefs.h b/foreign/libpg_query/src/postgres/include/access/xlogdefs.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/xlogdefs.h
@@ -0,0 +1,102 @@
+/*
+ * xlogdefs.h
+ *
+ * Postgres transaction log manager record pointer and
+ * timeline number definitions
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/xlogdefs.h
+ */
+#ifndef XLOG_DEFS_H
+#define XLOG_DEFS_H
+
+#include <fcntl.h>				/* need open() flags */
+
+/*
+ * Pointer to a location in the XLOG.  These pointers are 64 bits wide,
+ * because we don't want them ever to overflow.
+ */
+typedef uint64 XLogRecPtr;
+
+/*
+ * Zero is used indicate an invalid pointer. Bootstrap skips the first possible
+ * WAL segment, initializing the first WAL page at XLOG_SEG_SIZE, so no XLOG
+ * record can begin at zero.
+ */
+#define InvalidXLogRecPtr	0
+#define XLogRecPtrIsInvalid(r)	((r) == InvalidXLogRecPtr)
+
+/*
+ * XLogSegNo - physical log file sequence number.
+ */
+typedef uint64 XLogSegNo;
+
+/*
+ * TimeLineID (TLI) - identifies different database histories to prevent
+ * confusion after restoring a prior state of a database installation.
+ * TLI does not change in a normal stop/restart of the database (including
+ * crash-and-recover cases); but we must assign a new TLI after doing
+ * a recovery to a prior state, a/k/a point-in-time recovery.  This makes
+ * the new WAL logfile sequence we generate distinguishable from the
+ * sequence that was generated in the previous incarnation.
+ */
+typedef uint32 TimeLineID;
+
+/*
+ * Replication origin id - this is located in this file to avoid having to
+ * include origin.h in a bunch of xlog related places.
+ */
+typedef uint16 RepOriginId;
+
+/*
+ *	Because O_DIRECT bypasses the kernel buffers, and because we never
+ *	read those buffers except during crash recovery or if wal_level != minimal,
+ *	it is a win to use it in all cases where we sync on each write().  We could
+ *	allow O_DIRECT with fsync(), but it is unclear if fsync() could process
+ *	writes not buffered in the kernel.  Also, O_DIRECT is never enough to force
+ *	data to the drives, it merely tries to bypass the kernel cache, so we still
+ *	need O_SYNC/O_DSYNC.
+ */
+#ifdef O_DIRECT
+#define PG_O_DIRECT				O_DIRECT
+#else
+#define PG_O_DIRECT				0
+#endif
+
+/*
+ * This chunk of hackery attempts to determine which file sync methods
+ * are available on the current platform, and to choose an appropriate
+ * default method.  We assume that fsync() is always available, and that
+ * configure determined whether fdatasync() is.
+ */
+#if defined(O_SYNC)
+#define OPEN_SYNC_FLAG		O_SYNC
+#elif defined(O_FSYNC)
+#define OPEN_SYNC_FLAG		O_FSYNC
+#endif
+
+#if defined(O_DSYNC)
+#if defined(OPEN_SYNC_FLAG)
+/* O_DSYNC is distinct? */
+#if O_DSYNC != OPEN_SYNC_FLAG
+#define OPEN_DATASYNC_FLAG		O_DSYNC
+#endif
+#else							/* !defined(OPEN_SYNC_FLAG) */
+/* Win32 only has O_DSYNC */
+#define OPEN_DATASYNC_FLAG		O_DSYNC
+#endif
+#endif
+
+#if defined(PLATFORM_DEFAULT_SYNC_METHOD)
+#define DEFAULT_SYNC_METHOD		PLATFORM_DEFAULT_SYNC_METHOD
+#elif defined(OPEN_DATASYNC_FLAG)
+#define DEFAULT_SYNC_METHOD		SYNC_METHOD_OPEN_DSYNC
+#elif defined(HAVE_FDATASYNC)
+#define DEFAULT_SYNC_METHOD		SYNC_METHOD_FDATASYNC
+#else
+#define DEFAULT_SYNC_METHOD		SYNC_METHOD_FSYNC
+#endif
+
+#endif   /* XLOG_DEFS_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/xloginsert.h b/foreign/libpg_query/src/postgres/include/access/xloginsert.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/xloginsert.h
@@ -0,0 +1,62 @@
+/*
+ * xloginsert.h
+ *
+ * Functions for generating WAL records
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/xloginsert.h
+ */
+#ifndef XLOGINSERT_H
+#define XLOGINSERT_H
+
+#include "access/rmgr.h"
+#include "access/xlogdefs.h"
+#include "storage/block.h"
+#include "storage/buf.h"
+#include "storage/relfilenode.h"
+
+/*
+ * The minimum size of the WAL construction working area. If you need to
+ * register more than XLR_NORMAL_MAX_BLOCK_ID block references or have more
+ * than XLR_NORMAL_RDATAS data chunks in a single WAL record, you must call
+ * XLogEnsureRecordSpace() first to allocate more working memory.
+ */
+#define XLR_NORMAL_MAX_BLOCK_ID		4
+#define XLR_NORMAL_RDATAS			20
+
+/* flags for XLogRegisterBuffer */
+#define REGBUF_FORCE_IMAGE	0x01	/* force a full-page image */
+#define REGBUF_NO_IMAGE		0x02	/* don't take a full-page image */
+#define REGBUF_WILL_INIT	(0x04 | 0x02)		/* page will be re-initialized
+												 * at replay (implies
+												 * NO_IMAGE) */
+#define REGBUF_STANDARD		0x08/* page follows "standard" page layout, (data
+								 * between pd_lower and pd_upper will be
+								 * skipped) */
+#define REGBUF_KEEP_DATA	0x10/* include data even if a full-page image is
+								 * taken */
+
+/* prototypes for public functions in xloginsert.c: */
+extern void XLogBeginInsert(void);
+extern void XLogIncludeOrigin(void);
+extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info);
+extern void XLogEnsureRecordSpace(int nbuffers, int ndatas);
+extern void XLogRegisterData(char *data, int len);
+extern void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags);
+extern void XLogRegisterBlock(uint8 block_id, RelFileNode *rnode,
+				  ForkNumber forknum, BlockNumber blknum, char *page,
+				  uint8 flags);
+extern void XLogRegisterBufData(uint8 block_id, char *data, int len);
+extern void XLogResetInsertion(void);
+extern bool XLogCheckBufferNeedsBackup(Buffer buffer);
+
+extern XLogRecPtr log_newpage(RelFileNode *rnode, ForkNumber forkNum,
+			BlockNumber blk, char *page, bool page_std);
+extern XLogRecPtr log_newpage_buffer(Buffer buffer, bool page_std);
+extern XLogRecPtr XLogSaveBufferForHint(Buffer buffer, bool buffer_std);
+
+extern void InitXLogInsert(void);
+
+#endif   /* XLOGINSERT_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/xlogreader.h b/foreign/libpg_query/src/postgres/include/access/xlogreader.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/xlogreader.h
@@ -0,0 +1,206 @@
+/*-------------------------------------------------------------------------
+ *
+ * xlogreader.h
+ *		Definitions for the generic XLog reading facility
+ *
+ * Portions Copyright (c) 2013-2015, PostgreSQL Global Development Group
+ *
+ * IDENTIFICATION
+ *		src/include/access/xlogreader.h
+ *
+ * NOTES
+ *		See the definition of the XLogReaderState struct for instructions on
+ *		how to use the XLogReader infrastructure.
+ *
+ *		The basic idea is to allocate an XLogReaderState via
+ *		XLogReaderAllocate(), and call XLogReadRecord() until it returns NULL.
+ *
+ *		After reading a record with XLogReadRecord(), it's decomposed into
+ *		the per-block and main data parts, and the parts can be accessed
+ *		with the XLogRec* macros and functions. You can also decode a
+ *		record that's already constructed in memory, without reading from
+ *		disk, by calling the DecodeXLogRecord() function.
+ *-------------------------------------------------------------------------
+ */
+#ifndef XLOGREADER_H
+#define XLOGREADER_H
+
+#include "access/xlogrecord.h"
+
+typedef struct XLogReaderState XLogReaderState;
+
+/* Function type definition for the read_page callback */
+typedef int (*XLogPageReadCB) (XLogReaderState *xlogreader,
+										   XLogRecPtr targetPagePtr,
+										   int reqLen,
+										   XLogRecPtr targetRecPtr,
+										   char *readBuf,
+										   TimeLineID *pageTLI);
+
+typedef struct
+{
+	/* Is this block ref in use? */
+	bool		in_use;
+
+	/* Identify the block this refers to */
+	RelFileNode rnode;
+	ForkNumber	forknum;
+	BlockNumber blkno;
+
+	/* copy of the fork_flags field from the XLogRecordBlockHeader */
+	uint8		flags;
+
+	/* Information on full-page image, if any */
+	bool		has_image;
+	char	   *bkp_image;
+	uint16		hole_offset;
+	uint16		hole_length;
+	uint16		bimg_len;
+	uint8		bimg_info;
+
+	/* Buffer holding the rmgr-specific data associated with this block */
+	bool		has_data;
+	char	   *data;
+	uint16		data_len;
+	uint16		data_bufsz;
+} DecodedBkpBlock;
+
+struct XLogReaderState
+{
+	/* ----------------------------------------
+	 * Public parameters
+	 * ----------------------------------------
+	 */
+
+	/*
+	 * Data input callback (mandatory).
+	 *
+	 * This callback shall read at least reqLen valid bytes of the xlog page
+	 * starting at targetPagePtr, and store them in readBuf.  The callback
+	 * shall return the number of bytes read (never more than XLOG_BLCKSZ), or
+	 * -1 on failure.  The callback shall sleep, if necessary, to wait for the
+	 * requested bytes to become available.  The callback will not be invoked
+	 * again for the same page unless more than the returned number of bytes
+	 * are needed.
+	 *
+	 * targetRecPtr is the position of the WAL record we're reading.  Usually
+	 * it is equal to targetPagePtr + reqLen, but sometimes xlogreader needs
+	 * to read and verify the page or segment header, before it reads the
+	 * actual WAL record it's interested in.  In that case, targetRecPtr can
+	 * be used to determine which timeline to read the page from.
+	 *
+	 * The callback shall set *pageTLI to the TLI of the file the page was
+	 * read from.  It is currently used only for error reporting purposes, to
+	 * reconstruct the name of the WAL file where an error occurred.
+	 */
+	XLogPageReadCB read_page;
+
+	/*
+	 * System identifier of the xlog files we're about to read.  Set to zero
+	 * (the default value) if unknown or unimportant.
+	 */
+	uint64		system_identifier;
+
+	/*
+	 * Opaque data for callbacks to use.  Not used by XLogReader.
+	 */
+	void	   *private_data;
+
+	/*
+	 * Start and end point of last record read.  EndRecPtr is also used as the
+	 * position to read next, if XLogReadRecord receives an invalid recptr.
+	 */
+	XLogRecPtr	ReadRecPtr;		/* start of last record read */
+	XLogRecPtr	EndRecPtr;		/* end+1 of last record read */
+
+
+	/* ----------------------------------------
+	 * Decoded representation of current record
+	 *
+	 * Use XLogRecGet* functions to investigate the record; these fields
+	 * should not be accessed directly.
+	 * ----------------------------------------
+	 */
+	XLogRecord *decoded_record; /* currently decoded record */
+
+	char	   *main_data;		/* record's main data portion */
+	uint32		main_data_len;	/* main data portion's length */
+	uint32		main_data_bufsz;	/* allocated size of the buffer */
+
+	RepOriginId record_origin;
+
+	/* information about blocks referenced by the record. */
+	DecodedBkpBlock blocks[XLR_MAX_BLOCK_ID + 1];
+
+	int			max_block_id;	/* highest block_id in use (-1 if none) */
+
+	/* ----------------------------------------
+	 * private/internal state
+	 * ----------------------------------------
+	 */
+
+	/* Buffer for currently read page (XLOG_BLCKSZ bytes) */
+	char	   *readBuf;
+
+	/* last read segment, segment offset, read length, TLI */
+	XLogSegNo	readSegNo;
+	uint32		readOff;
+	uint32		readLen;
+	TimeLineID	readPageTLI;
+
+	/* beginning of last page read, and its TLI  */
+	XLogRecPtr	latestPagePtr;
+	TimeLineID	latestPageTLI;
+
+	/* beginning of the WAL record being read. */
+	XLogRecPtr	currRecPtr;
+
+	/* Buffer for current ReadRecord result (expandable) */
+	char	   *readRecordBuf;
+	uint32		readRecordBufSize;
+
+	/* Buffer to hold error message */
+	char	   *errormsg_buf;
+};
+
+/* Get a new XLogReader */
+extern XLogReaderState *XLogReaderAllocate(XLogPageReadCB pagereadfunc,
+				   void *private_data);
+
+/* Free an XLogReader */
+extern void XLogReaderFree(XLogReaderState *state);
+
+/* Read the next XLog record. Returns NULL on end-of-WAL or failure */
+extern struct XLogRecord *XLogReadRecord(XLogReaderState *state,
+			   XLogRecPtr recptr, char **errormsg);
+
+#ifdef FRONTEND
+extern XLogRecPtr XLogFindNextRecord(XLogReaderState *state, XLogRecPtr RecPtr);
+#endif   /* FRONTEND */
+
+/* Functions for decoding an XLogRecord */
+
+extern bool DecodeXLogRecord(XLogReaderState *state, XLogRecord *record,
+				 char **errmsg);
+
+#define XLogRecGetTotalLen(decoder) ((decoder)->decoded_record->xl_tot_len)
+#define XLogRecGetPrev(decoder) ((decoder)->decoded_record->xl_prev)
+#define XLogRecGetInfo(decoder) ((decoder)->decoded_record->xl_info)
+#define XLogRecGetRmid(decoder) ((decoder)->decoded_record->xl_rmid)
+#define XLogRecGetXid(decoder) ((decoder)->decoded_record->xl_xid)
+#define XLogRecGetOrigin(decoder) ((decoder)->record_origin)
+#define XLogRecGetData(decoder) ((decoder)->main_data)
+#define XLogRecGetDataLen(decoder) ((decoder)->main_data_len)
+#define XLogRecHasAnyBlockRefs(decoder) ((decoder)->max_block_id >= 0)
+#define XLogRecHasBlockRef(decoder, block_id) \
+	((decoder)->blocks[block_id].in_use)
+#define XLogRecHasBlockImage(decoder, block_id) \
+	((decoder)->blocks[block_id].has_image)
+
+extern bool RestoreBlockImage(XLogReaderState *recoder, uint8 block_id, char *dst);
+extern char *XLogRecGetBlockData(XLogReaderState *record, uint8 block_id, Size *len);
+extern bool XLogRecGetBlockTag(XLogReaderState *record, uint8 block_id,
+				   RelFileNode *rnode, ForkNumber *forknum,
+				   BlockNumber *blknum);
+
+#endif   /* XLOGREADER_H */
diff --git a/foreign/libpg_query/src/postgres/include/access/xlogrecord.h b/foreign/libpg_query/src/postgres/include/access/xlogrecord.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/access/xlogrecord.h
@@ -0,0 +1,217 @@
+/*
+ * xlogrecord.h
+ *
+ * Definitions for the WAL record format.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/xlogrecord.h
+ */
+#ifndef XLOGRECORD_H
+#define XLOGRECORD_H
+
+#include "access/rmgr.h"
+#include "access/xlogdefs.h"
+#include "port/pg_crc32c.h"
+#include "storage/block.h"
+#include "storage/relfilenode.h"
+
+/*
+ * The overall layout of an XLOG record is:
+ *		Fixed-size header (XLogRecord struct)
+ *		XLogRecordBlockHeader struct
+ *		XLogRecordBlockHeader struct
+ *		...
+ *		XLogRecordDataHeader[Short|Long] struct
+ *		block data
+ *		block data
+ *		...
+ *		main data
+ *
+ * There can be zero or more XLogRecordBlockHeaders, and 0 or more bytes of
+ * rmgr-specific data not associated with a block.  XLogRecord structs
+ * always start on MAXALIGN boundaries in the WAL files, but the rest of
+ * the fields are not aligned.
+ *
+ * The XLogRecordBlockHeader, XLogRecordDataHeaderShort and
+ * XLogRecordDataHeaderLong structs all begin with a single 'id' byte. It's
+ * used to distinguish between block references, and the main data structs.
+ */
+typedef struct XLogRecord
+{
+	uint32		xl_tot_len;		/* total len of entire record */
+	TransactionId xl_xid;		/* xact id */
+	XLogRecPtr	xl_prev;		/* ptr to previous record in log */
+	uint8		xl_info;		/* flag bits, see below */
+	RmgrId		xl_rmid;		/* resource manager for this record */
+	/* 2 bytes of padding here, initialize to zero */
+	pg_crc32c	xl_crc;			/* CRC for this record */
+
+	/* XLogRecordBlockHeaders and XLogRecordDataHeader follow, no padding */
+
+} XLogRecord;
+
+#define SizeOfXLogRecord	(offsetof(XLogRecord, xl_crc) + sizeof(pg_crc32c))
+
+/*
+ * The high 4 bits in xl_info may be used freely by rmgr. The
+ * XLR_SPECIAL_REL_UPDATE bit can be passed by XLogInsert caller. The rest
+ * are set internally by XLogInsert.
+ */
+#define XLR_INFO_MASK			0x0F
+#define XLR_RMGR_INFO_MASK		0xF0
+
+/*
+ * If a WAL record modifies any relation files, in ways not covered by the
+ * usual block references, this flag is set. This is not used for anything
+ * by PostgreSQL itself, but it allows external tools that read WAL and keep
+ * track of modified blocks to recognize such special record types.
+ */
+#define XLR_SPECIAL_REL_UPDATE	0x01
+
+/*
+ * Header info for block data appended to an XLOG record.
+ *
+ * 'data_length' is the length of the rmgr-specific payload data associated
+ * with this block. It does not include the possible full page image, nor
+ * XLogRecordBlockHeader struct itself.
+ *
+ * Note that we don't attempt to align the XLogRecordBlockHeader struct!
+ * So, the struct must be copied to aligned local storage before use.
+ */
+typedef struct XLogRecordBlockHeader
+{
+	uint8		id;				/* block reference ID */
+	uint8		fork_flags;		/* fork within the relation, and flags */
+	uint16		data_length;	/* number of payload bytes (not including page
+								 * image) */
+
+	/* If BKPBLOCK_HAS_IMAGE, an XLogRecordBlockImageHeader struct follows */
+	/* If BKPBLOCK_SAME_REL is not set, a RelFileNode follows */
+	/* BlockNumber follows */
+} XLogRecordBlockHeader;
+
+#define SizeOfXLogRecordBlockHeader (offsetof(XLogRecordBlockHeader, data_length) + sizeof(uint16))
+
+/*
+ * Additional header information when a full-page image is included
+ * (i.e. when BKPBLOCK_HAS_IMAGE is set).
+ *
+ * As a trivial form of data compression, the XLOG code is aware that
+ * PG data pages usually contain an unused "hole" in the middle, which
+ * contains only zero bytes.  If the length of "hole" > 0 then we have removed
+ * such a "hole" from the stored data (and it's not counted in the
+ * XLOG record's CRC, either).  Hence, the amount of block data actually
+ * present is BLCKSZ - the length of "hole" bytes.
+ *
+ * When wal_compression is enabled, a full page image which "hole" was
+ * removed is additionally compressed using PGLZ compression algorithm.
+ * This can reduce the WAL volume, but at some extra cost of CPU spent
+ * on the compression during WAL logging. In this case, since the "hole"
+ * length cannot be calculated by subtracting the number of page image bytes
+ * from BLCKSZ, basically it needs to be stored as an extra information.
+ * But when no "hole" exists, we can assume that the "hole" length is zero
+ * and no such an extra information needs to be stored. Note that
+ * the original version of page image is stored in WAL instead of the
+ * compressed one if the number of bytes saved by compression is less than
+ * the length of extra information. Hence, when a page image is successfully
+ * compressed, the amount of block data actually present is less than
+ * BLCKSZ - the length of "hole" bytes - the length of extra information.
+ */
+typedef struct XLogRecordBlockImageHeader
+{
+	uint16		length;			/* number of page image bytes */
+	uint16		hole_offset;	/* number of bytes before "hole" */
+	uint8		bimg_info;		/* flag bits, see below */
+
+	/*
+	 * If BKPIMAGE_HAS_HOLE and BKPIMAGE_IS_COMPRESSED, an
+	 * XLogRecordBlockCompressHeader struct follows.
+	 */
+} XLogRecordBlockImageHeader;
+
+#define SizeOfXLogRecordBlockImageHeader	\
+	(offsetof(XLogRecordBlockImageHeader, bimg_info) + sizeof(uint8))
+
+/* Information stored in bimg_info */
+#define BKPIMAGE_HAS_HOLE		0x01	/* page image has "hole" */
+#define BKPIMAGE_IS_COMPRESSED		0x02		/* page image is compressed */
+
+/*
+ * Extra header information used when page image has "hole" and
+ * is compressed.
+ */
+typedef struct XLogRecordBlockCompressHeader
+{
+	uint16		hole_length;	/* number of bytes in "hole" */
+} XLogRecordBlockCompressHeader;
+
+#define SizeOfXLogRecordBlockCompressHeader \
+	sizeof(XLogRecordBlockCompressHeader)
+
+/*
+ * Maximum size of the header for a block reference. This is used to size a
+ * temporary buffer for constructing the header.
+ */
+#define MaxSizeOfXLogRecordBlockHeader \
+	(SizeOfXLogRecordBlockHeader + \
+	 SizeOfXLogRecordBlockImageHeader + \
+	 SizeOfXLogRecordBlockCompressHeader + \
+	 sizeof(RelFileNode) + \
+	 sizeof(BlockNumber))
+
+/*
+ * The fork number fits in the lower 4 bits in the fork_flags field. The upper
+ * bits are used for flags.
+ */
+#define BKPBLOCK_FORK_MASK	0x0F
+#define BKPBLOCK_FLAG_MASK	0xF0
+#define BKPBLOCK_HAS_IMAGE	0x10	/* block data is an XLogRecordBlockImage */
+#define BKPBLOCK_HAS_DATA	0x20
+#define BKPBLOCK_WILL_INIT	0x40	/* redo will re-init the page */
+#define BKPBLOCK_SAME_REL	0x80	/* RelFileNode omitted, same as previous */
+
+/*
+ * XLogRecordDataHeaderShort/Long are used for the "main data" portion of
+ * the record. If the length of the data is less than 256 bytes, the short
+ * form is used, with a single byte to hold the length. Otherwise the long
+ * form is used.
+ *
+ * (These structs are currently not used in the code, they are here just for
+ * documentation purposes).
+ */
+typedef struct XLogRecordDataHeaderShort
+{
+	uint8		id;				/* XLR_BLOCK_ID_DATA_SHORT */
+	uint8		data_length;	/* number of payload bytes */
+}	XLogRecordDataHeaderShort;
+
+#define SizeOfXLogRecordDataHeaderShort (sizeof(uint8) * 2)
+
+typedef struct XLogRecordDataHeaderLong
+{
+	uint8		id;				/* XLR_BLOCK_ID_DATA_LONG */
+	/* followed by uint32 data_length, unaligned */
+}	XLogRecordDataHeaderLong;
+
+#define SizeOfXLogRecordDataHeaderLong (sizeof(uint8) + sizeof(uint32))
+
+/*
+ * Block IDs used to distinguish different kinds of record fragments. Block
+ * references are numbered from 0 to XLR_MAX_BLOCK_ID. A rmgr is free to use
+ * any ID number in that range (although you should stick to small numbers,
+ * because the WAL machinery is optimized for that case). A couple of ID
+ * numbers are reserved to denote the "main" data portion of the record.
+ *
+ * The maximum is currently set at 32, quite arbitrarily. Most records only
+ * need a handful of block references, but there are a few exceptions that
+ * need more.
+ */
+#define XLR_MAX_BLOCK_ID			32
+
+#define XLR_BLOCK_ID_DATA_SHORT		255
+#define XLR_BLOCK_ID_DATA_LONG		254
+#define XLR_BLOCK_ID_ORIGIN			253
+
+#endif   /* XLOGRECORD_H */
diff --git a/foreign/libpg_query/src/postgres/include/bootstrap/bootstrap.h b/foreign/libpg_query/src/postgres/include/bootstrap/bootstrap.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/bootstrap/bootstrap.h
@@ -0,0 +1,66 @@
+/*-------------------------------------------------------------------------
+ *
+ * bootstrap.h
+ *	  include file for the bootstrapping code
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/bootstrap/bootstrap.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef BOOTSTRAP_H
+#define BOOTSTRAP_H
+
+#include "nodes/execnodes.h"
+
+
+/*
+ * MAXATTR is the maximum number of attributes in a relation supported
+ * at bootstrap time (i.e., the max possible in a system table).
+ */
+#define MAXATTR 40
+
+#define BOOTCOL_NULL_AUTO			1
+#define BOOTCOL_NULL_FORCE_NULL		2
+#define BOOTCOL_NULL_FORCE_NOT_NULL 3
+
+extern Relation boot_reldesc;
+extern Form_pg_attribute attrtypes[MAXATTR];
+extern int	numattr;
+
+
+extern void AuxiliaryProcessMain(int argc, char *argv[]) pg_attribute_noreturn();
+
+extern void err_out(void);
+
+extern void closerel(char *name);
+extern void boot_openrel(char *name);
+
+extern void DefineAttr(char *name, char *type, int attnum, int nullness);
+extern void InsertOneTuple(Oid objectid);
+extern void InsertOneValue(char *value, int i);
+extern void InsertOneNull(int i);
+
+extern char *MapArrayTypeName(const char *s);
+
+extern void index_register(Oid heap, Oid ind, IndexInfo *indexInfo);
+extern void build_indices(void);
+
+extern void boot_get_type_io_data(Oid typid,
+					  int16 *typlen,
+					  bool *typbyval,
+					  char *typalign,
+					  char *typdelim,
+					  Oid *typioparam,
+					  Oid *typinput,
+					  Oid *typoutput);
+
+extern int	boot_yyparse(void);
+
+extern int	boot_yylex(void);
+extern void boot_yyerror(const char *str) pg_attribute_noreturn();
+
+#endif   /* BOOTSTRAP_H */
diff --git a/foreign/libpg_query/src/postgres/include/c.h b/foreign/libpg_query/src/postgres/include/c.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/c.h
@@ -0,0 +1,1116 @@
+/*-------------------------------------------------------------------------
+ *
+ * c.h
+ *	  Fundamental C definitions.  This is included by every .c file in
+ *	  PostgreSQL (via either postgres.h or postgres_fe.h, as appropriate).
+ *
+ *	  Note that the definitions here are not intended to be exposed to clients
+ *	  of the frontend interface libraries --- so we don't worry much about
+ *	  polluting the namespace with lots of stuff...
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/c.h
+ *
+ *-------------------------------------------------------------------------
+ */
+/*
+ *----------------------------------------------------------------
+ *	 TABLE OF CONTENTS
+ *
+ *		When adding stuff to this file, please try to put stuff
+ *		into the relevant section, or add new sections as appropriate.
+ *
+ *	  section	description
+ *	  -------	------------------------------------------------
+ *		0)		pg_config.h and standard system headers
+ *		1)		hacks to cope with non-ANSI C compilers
+ *		2)		bool, true, false, TRUE, FALSE, NULL
+ *		3)		standard system types
+ *		4)		IsValid macros for system types
+ *		5)		offsetof, lengthof, endof, alignment
+ *		6)		assertions
+ *		7)		widely useful macros
+ *		8)		random stuff
+ *		9)		system-specific hacks
+ *
+ * NOTE: since this file is included by both frontend and backend modules, it's
+ * almost certainly wrong to put an "extern" declaration here.  typedefs and
+ * macros are the kind of thing that might go here.
+ *
+ *----------------------------------------------------------------
+ */
+#ifndef C_H
+#define C_H
+
+#include "postgres_ext.h"
+
+/* Must undef pg_config_ext.h symbols before including pg_config.h */
+#undef PG_INT64_TYPE
+
+#include "pg_config.h"
+#include "pg_config_manual.h"	/* must be after pg_config.h */
+
+/*
+ * We always rely on the WIN32 macro being set by our build system,
+ * but _WIN32 is the compiler pre-defined macro. So make sure we define
+ * WIN32 whenever _WIN32 is set, to facilitate standalone building.
+ */
+#if defined(_WIN32) && !defined(WIN32)
+#define WIN32
+#endif
+
+#if !defined(WIN32) && !defined(__CYGWIN__)		/* win32 includes further down */
+#include "pg_config_os.h"		/* must be before any system header files */
+#endif
+
+#if _MSC_VER >= 1400 || defined(HAVE_CRTDEFS_H)
+#define errcode __msvc_errcode
+#include <crtdefs.h>
+#undef errcode
+#endif
+
+/*
+ * We have to include stdlib.h here because it defines many of these macros
+ * on some platforms, and we only want our definitions used if stdlib.h doesn't
+ * have its own.  The same goes for stddef and stdarg if present.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stddef.h>
+#include <stdarg.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <sys/types.h>
+
+#include <errno.h>
+#if defined(WIN32) || defined(__CYGWIN__)
+#include <fcntl.h>				/* ensure O_BINARY is available */
+#endif
+
+#if defined(WIN32) || defined(__CYGWIN__)
+/* We have to redefine some system functions after they are included above. */
+#include "pg_config_os.h"
+#endif
+
+/* Must be before gettext() games below */
+#include <locale.h>
+
+#define _(x) gettext(x)
+
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#else
+#define gettext(x) (x)
+#define dgettext(d,x) (x)
+#define ngettext(s,p,n) ((n) == 1 ? (s) : (p))
+#define dngettext(d,s,p,n) ((n) == 1 ? (s) : (p))
+#endif
+
+/*
+ *	Use this to mark string constants as needing translation at some later
+ *	time, rather than immediately.  This is useful for cases where you need
+ *	access to the original string and translated string, and for cases where
+ *	immediate translation is not possible, like when initializing global
+ *	variables.
+ *		http://www.gnu.org/software/autoconf/manual/gettext/Special-cases.html
+ */
+#define gettext_noop(x) (x)
+
+
+/* ----------------------------------------------------------------
+ *				Section 1: hacks to cope with non-ANSI C compilers
+ *
+ * type prefixes (const, signed, volatile, inline) are handled in pg_config.h.
+ * ----------------------------------------------------------------
+ */
+
+/*
+ * CppAsString
+ *		Convert the argument to a string, using the C preprocessor.
+ * CppConcat
+ *		Concatenate two arguments together, using the C preprocessor.
+ *
+ * Note: There used to be support here for pre-ANSI C compilers that didn't
+ * support # and ##.  Nowadays, these macros are just for clarity and/or
+ * backward compatibility with existing PostgreSQL code.
+ */
+#define CppAsString(identifier) #identifier
+#define CppConcat(x, y)			x##y
+
+/*
+ * dummyret is used to set return values in macros that use ?: to make
+ * assignments.  gcc wants these to be void, other compilers like char
+ */
+#ifdef __GNUC__					/* GNU cc */
+#define dummyret	void
+#else
+#define dummyret	char
+#endif
+
+/* ----------------------------------------------------------------
+ *				Section 2:	bool, true, false, TRUE, FALSE, NULL
+ * ----------------------------------------------------------------
+ */
+
+/*
+ * bool
+ *		Boolean value, either true or false.
+ *
+ * XXX for C++ compilers, we assume the compiler has a compatible
+ * built-in definition of bool.
+ */
+
+#ifndef __cplusplus
+
+#ifndef bool
+typedef char bool;
+#endif
+
+#ifndef true
+#define true	((bool) 1)
+#endif
+
+#ifndef false
+#define false	((bool) 0)
+#endif
+#endif   /* not C++ */
+
+typedef bool *BoolPtr;
+
+#ifndef TRUE
+#define TRUE	1
+#endif
+
+#ifndef FALSE
+#define FALSE	0
+#endif
+
+/*
+ * NULL
+ *		Null pointer.
+ */
+#ifndef NULL
+#define NULL	((void *) 0)
+#endif
+
+
+/* ----------------------------------------------------------------
+ *				Section 3:	standard system types
+ * ----------------------------------------------------------------
+ */
+
+/*
+ * Pointer
+ *		Variable holding address of any memory resident object.
+ *
+ *		XXX Pointer arithmetic is done with this, so it can't be void *
+ *		under "true" ANSI compilers.
+ */
+typedef char *Pointer;
+
+/*
+ * intN
+ *		Signed integer, EXACTLY N BITS IN SIZE,
+ *		used for numerical computations and the
+ *		frontend/backend protocol.
+ */
+#ifndef HAVE_INT8
+typedef signed char int8;		/* == 8 bits */
+typedef signed short int16;		/* == 16 bits */
+typedef signed int int32;		/* == 32 bits */
+#endif   /* not HAVE_INT8 */
+
+/*
+ * uintN
+ *		Unsigned integer, EXACTLY N BITS IN SIZE,
+ *		used for numerical computations and the
+ *		frontend/backend protocol.
+ */
+#ifndef HAVE_UINT8
+typedef unsigned char uint8;	/* == 8 bits */
+typedef unsigned short uint16;	/* == 16 bits */
+typedef unsigned int uint32;	/* == 32 bits */
+#endif   /* not HAVE_UINT8 */
+
+/*
+ * bitsN
+ *		Unit of bitwise operation, AT LEAST N BITS IN SIZE.
+ */
+typedef uint8 bits8;			/* >= 8 bits */
+typedef uint16 bits16;			/* >= 16 bits */
+typedef uint32 bits32;			/* >= 32 bits */
+
+/*
+ * 64-bit integers
+ */
+#ifdef HAVE_LONG_INT_64
+/* Plain "long int" fits, use it */
+
+#ifndef HAVE_INT64
+typedef long int int64;
+#endif
+#ifndef HAVE_UINT64
+typedef unsigned long int uint64;
+#endif
+#elif defined(HAVE_LONG_LONG_INT_64)
+/* We have working support for "long long int", use that */
+
+#ifndef HAVE_INT64
+typedef long long int int64;
+#endif
+#ifndef HAVE_UINT64
+typedef unsigned long long int uint64;
+#endif
+#else
+/* neither HAVE_LONG_INT_64 nor HAVE_LONG_LONG_INT_64 */
+#error must have a working 64-bit integer datatype
+#endif
+
+/* Decide if we need to decorate 64-bit constants */
+#ifdef HAVE_LL_CONSTANTS
+#define INT64CONST(x)  ((int64) x##LL)
+#define UINT64CONST(x) ((uint64) x##ULL)
+#else
+#define INT64CONST(x)  ((int64) x)
+#define UINT64CONST(x) ((uint64) x)
+#endif
+
+/* snprintf format strings to use for 64-bit integers */
+#define INT64_FORMAT "%" INT64_MODIFIER "d"
+#define UINT64_FORMAT "%" INT64_MODIFIER "u"
+
+/*
+ * 128-bit signed and unsigned integers
+ *		There currently is only a limited support for the type. E.g. 128bit
+ *		literals and snprintf are not supported; but math is.
+ */
+#if defined(PG_INT128_TYPE)
+#define HAVE_INT128
+typedef PG_INT128_TYPE int128;
+typedef unsigned PG_INT128_TYPE uint128;
+#endif
+
+/*
+ * stdint.h limits aren't guaranteed to be present and aren't guaranteed to
+ * have compatible types with our fixed width types. So just define our own.
+ */
+#define PG_INT8_MIN		(-0x7F-1)
+#define PG_INT8_MAX		(0x7F)
+#define PG_UINT8_MAX	(0xFF)
+#define PG_INT16_MIN	(-0x7FFF-1)
+#define PG_INT16_MAX	(0x7FFF)
+#define PG_UINT16_MAX	(0xFFFF)
+#define PG_INT32_MIN	(-0x7FFFFFFF-1)
+#define PG_INT32_MAX	(0x7FFFFFFF)
+#define PG_UINT32_MAX	(0xFFFFFFFF)
+#define PG_INT64_MIN	(-INT64CONST(0x7FFFFFFFFFFFFFFF) - 1)
+#define PG_INT64_MAX	INT64CONST(0x7FFFFFFFFFFFFFFF)
+#define PG_UINT64_MAX	UINT64CONST(0xFFFFFFFFFFFFFFFF)
+
+/* Select timestamp representation (float8 or int64) */
+#ifdef USE_INTEGER_DATETIMES
+#define HAVE_INT64_TIMESTAMP
+#endif
+
+/* sig_atomic_t is required by ANSI C, but may be missing on old platforms */
+#ifndef HAVE_SIG_ATOMIC_T
+typedef int sig_atomic_t;
+#endif
+
+/*
+ * Size
+ *		Size of any memory resident object, as returned by sizeof.
+ */
+typedef size_t Size;
+
+/*
+ * Index
+ *		Index into any memory resident array.
+ *
+ * Note:
+ *		Indices are non negative.
+ */
+typedef unsigned int Index;
+
+/*
+ * Offset
+ *		Offset into any memory resident array.
+ *
+ * Note:
+ *		This differs from an Index in that an Index is always
+ *		non negative, whereas Offset may be negative.
+ */
+typedef signed int Offset;
+
+/*
+ * Common Postgres datatype names (as used in the catalogs)
+ */
+typedef float float4;
+typedef double float8;
+
+/*
+ * Oid, RegProcedure, TransactionId, SubTransactionId, MultiXactId,
+ * CommandId
+ */
+
+/* typedef Oid is in postgres_ext.h */
+
+/*
+ * regproc is the type name used in the include/catalog headers, but
+ * RegProcedure is the preferred name in C code.
+ */
+typedef Oid regproc;
+typedef regproc RegProcedure;
+
+typedef uint32 TransactionId;
+
+typedef uint32 LocalTransactionId;
+
+typedef uint32 SubTransactionId;
+
+#define InvalidSubTransactionId		((SubTransactionId) 0)
+#define TopSubTransactionId			((SubTransactionId) 1)
+
+/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */
+typedef TransactionId MultiXactId;
+
+typedef uint32 MultiXactOffset;
+
+typedef uint32 CommandId;
+
+#define FirstCommandId	((CommandId) 0)
+#define InvalidCommandId	(~(CommandId)0)
+
+/*
+ * Array indexing support
+ */
+#define MAXDIM 6
+typedef struct
+{
+	int			indx[MAXDIM];
+} IntArray;
+
+/* ----------------
+ *		Variable-length datatypes all share the 'struct varlena' header.
+ *
+ * NOTE: for TOASTable types, this is an oversimplification, since the value
+ * may be compressed or moved out-of-line.  However datatype-specific routines
+ * are mostly content to deal with de-TOASTed values only, and of course
+ * client-side routines should never see a TOASTed value.  But even in a
+ * de-TOASTed value, beware of touching vl_len_ directly, as its representation
+ * is no longer convenient.  It's recommended that code always use the VARDATA,
+ * VARSIZE, and SET_VARSIZE macros instead of relying on direct mentions of
+ * the struct fields.  See postgres.h for details of the TOASTed form.
+ * ----------------
+ */
+struct varlena
+{
+	char		vl_len_[4];		/* Do not touch this field directly! */
+	char		vl_dat[FLEXIBLE_ARRAY_MEMBER];	/* Data content is here */
+};
+
+#define VARHDRSZ		((int32) sizeof(int32))
+
+/*
+ * These widely-used datatypes are just a varlena header and the data bytes.
+ * There is no terminating null or anything like that --- the data length is
+ * always VARSIZE(ptr) - VARHDRSZ.
+ */
+typedef struct varlena bytea;
+typedef struct varlena text;
+typedef struct varlena BpChar;	/* blank-padded char, ie SQL char(n) */
+typedef struct varlena VarChar; /* var-length char, ie SQL varchar(n) */
+
+/*
+ * Specialized array types.  These are physically laid out just the same
+ * as regular arrays (so that the regular array subscripting code works
+ * with them).  They exist as distinct types mostly for historical reasons:
+ * they have nonstandard I/O behavior which we don't want to change for fear
+ * of breaking applications that look at the system catalogs.  There is also
+ * an implementation issue for oidvector: it's part of the primary key for
+ * pg_proc, and we can't use the normal btree array support routines for that
+ * without circularity.
+ */
+typedef struct
+{
+	int32		vl_len_;		/* these fields must match ArrayType! */
+	int			ndim;			/* always 1 for int2vector */
+	int32		dataoffset;		/* always 0 for int2vector */
+	Oid			elemtype;
+	int			dim1;
+	int			lbound1;
+	int16		values[FLEXIBLE_ARRAY_MEMBER];
+} int2vector;
+
+typedef struct
+{
+	int32		vl_len_;		/* these fields must match ArrayType! */
+	int			ndim;			/* always 1 for oidvector */
+	int32		dataoffset;		/* always 0 for oidvector */
+	Oid			elemtype;
+	int			dim1;
+	int			lbound1;
+	Oid			values[FLEXIBLE_ARRAY_MEMBER];
+} oidvector;
+
+/*
+ * Representation of a Name: effectively just a C string, but null-padded to
+ * exactly NAMEDATALEN bytes.  The use of a struct is historical.
+ */
+typedef struct nameData
+{
+	char		data[NAMEDATALEN];
+} NameData;
+typedef NameData *Name;
+
+#define NameStr(name)	((name).data)
+
+/*
+ * Support macros for escaping strings.  escape_backslash should be TRUE
+ * if generating a non-standard-conforming string.  Prefixing a string
+ * with ESCAPE_STRING_SYNTAX guarantees it is non-standard-conforming.
+ * Beware of multiple evaluation of the "ch" argument!
+ */
+#define SQL_STR_DOUBLE(ch, escape_backslash)	\
+	((ch) == '\'' || ((ch) == '\\' && (escape_backslash)))
+
+#define ESCAPE_STRING_SYNTAX	'E'
+
+/* ----------------------------------------------------------------
+ *				Section 4:	IsValid macros for system types
+ * ----------------------------------------------------------------
+ */
+/*
+ * BoolIsValid
+ *		True iff bool is valid.
+ */
+#define BoolIsValid(boolean)	((boolean) == false || (boolean) == true)
+
+/*
+ * PointerIsValid
+ *		True iff pointer is valid.
+ */
+#define PointerIsValid(pointer) ((const void*)(pointer) != NULL)
+
+/*
+ * PointerIsAligned
+ *		True iff pointer is properly aligned to point to the given type.
+ */
+#define PointerIsAligned(pointer, type) \
+		(((uintptr_t)(pointer) % (sizeof (type))) == 0)
+
+#define OidIsValid(objectId)  ((bool) ((objectId) != InvalidOid))
+
+#define RegProcedureIsValid(p)	OidIsValid(p)
+
+
+/* ----------------------------------------------------------------
+ *				Section 5:	offsetof, lengthof, endof, alignment
+ * ----------------------------------------------------------------
+ */
+/*
+ * offsetof
+ *		Offset of a structure/union field within that structure/union.
+ *
+ *		XXX This is supposed to be part of stddef.h, but isn't on
+ *		some systems (like SunOS 4).
+ */
+#ifndef offsetof
+#define offsetof(type, field)	((long) &((type *)0)->field)
+#endif   /* offsetof */
+
+/*
+ * lengthof
+ *		Number of elements in an array.
+ */
+#define lengthof(array) (sizeof (array) / sizeof ((array)[0]))
+
+/*
+ * endof
+ *		Address of the element one past the last in an array.
+ */
+#define endof(array)	(&(array)[lengthof(array)])
+
+/* ----------------
+ * Alignment macros: align a length or address appropriately for a given type.
+ * The fooALIGN() macros round up to a multiple of the required alignment,
+ * while the fooALIGN_DOWN() macros round down.  The latter are more useful
+ * for problems like "how many X-sized structures will fit in a page?".
+ *
+ * NOTE: TYPEALIGN[_DOWN] will not work if ALIGNVAL is not a power of 2.
+ * That case seems extremely unlikely to be needed in practice, however.
+ * ----------------
+ */
+
+#define TYPEALIGN(ALIGNVAL,LEN)  \
+	(((uintptr_t) (LEN) + ((ALIGNVAL) - 1)) & ~((uintptr_t) ((ALIGNVAL) - 1)))
+
+#define SHORTALIGN(LEN)			TYPEALIGN(ALIGNOF_SHORT, (LEN))
+#define INTALIGN(LEN)			TYPEALIGN(ALIGNOF_INT, (LEN))
+#define LONGALIGN(LEN)			TYPEALIGN(ALIGNOF_LONG, (LEN))
+#define DOUBLEALIGN(LEN)		TYPEALIGN(ALIGNOF_DOUBLE, (LEN))
+#define MAXALIGN(LEN)			TYPEALIGN(MAXIMUM_ALIGNOF, (LEN))
+/* MAXALIGN covers only built-in types, not buffers */
+#define BUFFERALIGN(LEN)		TYPEALIGN(ALIGNOF_BUFFER, (LEN))
+#define CACHELINEALIGN(LEN)		TYPEALIGN(PG_CACHE_LINE_SIZE, (LEN))
+
+#define TYPEALIGN_DOWN(ALIGNVAL,LEN)  \
+	(((uintptr_t) (LEN)) & ~((uintptr_t) ((ALIGNVAL) - 1)))
+
+#define SHORTALIGN_DOWN(LEN)	TYPEALIGN_DOWN(ALIGNOF_SHORT, (LEN))
+#define INTALIGN_DOWN(LEN)		TYPEALIGN_DOWN(ALIGNOF_INT, (LEN))
+#define LONGALIGN_DOWN(LEN)		TYPEALIGN_DOWN(ALIGNOF_LONG, (LEN))
+#define DOUBLEALIGN_DOWN(LEN)	TYPEALIGN_DOWN(ALIGNOF_DOUBLE, (LEN))
+#define MAXALIGN_DOWN(LEN)		TYPEALIGN_DOWN(MAXIMUM_ALIGNOF, (LEN))
+
+/*
+ * The above macros will not work with types wider than uintptr_t, like with
+ * uint64 on 32-bit platforms.  That's not problem for the usual use where a
+ * pointer or a length is aligned, but for the odd case that you need to
+ * align something (potentially) wider, use TYPEALIGN64.
+ */
+#define TYPEALIGN64(ALIGNVAL,LEN)  \
+	(((uint64) (LEN) + ((ALIGNVAL) - 1)) & ~((uint64) ((ALIGNVAL) - 1)))
+
+/* we don't currently need wider versions of the other ALIGN macros */
+#define MAXALIGN64(LEN)			TYPEALIGN64(MAXIMUM_ALIGNOF, (LEN))
+
+/* ----------------
+ * Attribute macros
+ *
+ * GCC: https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
+ * GCC: https://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html
+ * Sunpro: https://docs.oracle.com/cd/E18659_01/html/821-1384/gjzke.html
+ * XLC: http://www-01.ibm.com/support/knowledgecenter/SSGH2K_11.1.0/com.ibm.xlc111.aix.doc/language_ref/function_attributes.html
+ * XLC: http://www-01.ibm.com/support/knowledgecenter/SSGH2K_11.1.0/com.ibm.xlc111.aix.doc/language_ref/type_attrib.html
+ * ----------------
+ */
+
+/* only GCC supports the unused attribute */
+#ifdef __GNUC__
+#define pg_attribute_unused() __attribute__((unused))
+#else
+#define pg_attribute_unused()
+#endif
+
+/* GCC and XLC support format attributes */
+#if defined(__GNUC__) || defined(__IBMC__)
+#define pg_attribute_format_arg(a) __attribute__((format_arg(a)))
+#define pg_attribute_printf(f,a) __attribute__((format(PG_PRINTF_ATTRIBUTE, f, a)))
+#else
+#define pg_attribute_format_arg(a)
+#define pg_attribute_printf(f,a)
+#endif
+
+/* GCC, Sunpro and XLC support aligned, packed and noreturn */
+#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__IBMC__)
+#define pg_attribute_aligned(a) __attribute__((aligned(a)))
+#define pg_attribute_noreturn() __attribute__((noreturn))
+#define pg_attribute_packed() __attribute__((packed))
+#define HAVE_PG_ATTRIBUTE_NORETURN 1
+#else
+/*
+ * NB: aligned and packed are not given default definitions because they
+ * affect code functionality; they *must* be implemented by the compiler
+ * if they are to be used.
+ */
+#define pg_attribute_noreturn()
+#endif
+
+/* ----------------------------------------------------------------
+ *				Section 6:	assertions
+ * ----------------------------------------------------------------
+ */
+
+/*
+ * USE_ASSERT_CHECKING, if defined, turns on all the assertions.
+ * - plai  9/5/90
+ *
+ * It should _NOT_ be defined in releases or in benchmark copies
+ */
+
+/*
+ * Assert() can be used in both frontend and backend code. In frontend code it
+ * just calls the standard assert, if it's available. If use of assertions is
+ * not configured, it does nothing.
+ */
+#ifndef USE_ASSERT_CHECKING
+
+#define Assert(condition)	((void)true)
+#define AssertMacro(condition)	((void)true)
+#define AssertArg(condition)	((void)true)
+#define AssertState(condition)	((void)true)
+#define AssertPointerAlignment(ptr, bndr)	((void)true)
+#define Trap(condition, errorType)	((void)true)
+#define TrapMacro(condition, errorType) (true)
+
+#elif defined(FRONTEND)
+
+#include <assert.h>
+#define Assert(p) assert(p)
+#define AssertMacro(p)	((void) assert(p))
+#define AssertArg(condition) assert(condition)
+#define AssertState(condition) assert(condition)
+#define AssertPointerAlignment(ptr, bndr)	((void)true)
+#else							/* USE_ASSERT_CHECKING && !FRONTEND */
+
+/*
+ * Trap
+ *		Generates an exception if the given condition is true.
+ */
+#define Trap(condition, errorType) \
+	do { \
+		if (condition) \
+			ExceptionalCondition(CppAsString(condition), (errorType), \
+								 __FILE__, __LINE__); \
+	} while (0)
+
+/*
+ *	TrapMacro is the same as Trap but it's intended for use in macros:
+ *
+ *		#define foo(x) (AssertMacro(x != 0), bar(x))
+ *
+ *	Isn't CPP fun?
+ */
+#define TrapMacro(condition, errorType) \
+	((bool) (! (condition) || \
+			 (ExceptionalCondition(CppAsString(condition), (errorType), \
+								   __FILE__, __LINE__), 0)))
+
+#define Assert(condition) \
+		Trap(!(condition), "FailedAssertion")
+
+#define AssertMacro(condition) \
+		((void) TrapMacro(!(condition), "FailedAssertion"))
+
+#define AssertArg(condition) \
+		Trap(!(condition), "BadArgument")
+
+#define AssertState(condition) \
+		Trap(!(condition), "BadState")
+
+/*
+ * Check that `ptr' is `bndr' aligned.
+ */
+#define AssertPointerAlignment(ptr, bndr) \
+	Trap(TYPEALIGN(bndr, (uintptr_t)(ptr)) != (uintptr_t)(ptr), \
+		 "UnalignedPointer")
+
+#endif   /* USE_ASSERT_CHECKING && !FRONTEND */
+
+/*
+ * Macros to support compile-time assertion checks.
+ *
+ * If the "condition" (a compile-time-constant expression) evaluates to false,
+ * throw a compile error using the "errmessage" (a string literal).
+ *
+ * gcc 4.6 and up supports _Static_assert(), but there are bizarre syntactic
+ * placement restrictions.  These macros make it safe to use as a statement
+ * or in an expression, respectively.
+ *
+ * Otherwise we fall back on a kluge that assumes the compiler will complain
+ * about a negative width for a struct bit-field.  This will not include a
+ * helpful error message, but it beats not getting an error at all.
+ */
+#ifdef HAVE__STATIC_ASSERT
+#define StaticAssertStmt(condition, errmessage) \
+	do { _Static_assert(condition, errmessage); } while(0)
+#define StaticAssertExpr(condition, errmessage) \
+	({ StaticAssertStmt(condition, errmessage); true; })
+#else							/* !HAVE__STATIC_ASSERT */
+#define StaticAssertStmt(condition, errmessage) \
+	((void) sizeof(struct { int static_assert_failure : (condition) ? 1 : -1; }))
+#define StaticAssertExpr(condition, errmessage) \
+	StaticAssertStmt(condition, errmessage)
+#endif   /* HAVE__STATIC_ASSERT */
+
+
+/*
+ * Compile-time checks that a variable (or expression) has the specified type.
+ *
+ * AssertVariableIsOfType() can be used as a statement.
+ * AssertVariableIsOfTypeMacro() is intended for use in macros, eg
+ *		#define foo(x) (AssertVariableIsOfTypeMacro(x, int), bar(x))
+ *
+ * If we don't have __builtin_types_compatible_p, we can still assert that
+ * the types have the same size.  This is far from ideal (especially on 32-bit
+ * platforms) but it provides at least some coverage.
+ */
+#ifdef HAVE__BUILTIN_TYPES_COMPATIBLE_P
+#define AssertVariableIsOfType(varname, typename) \
+	StaticAssertStmt(__builtin_types_compatible_p(__typeof__(varname), typename), \
+	CppAsString(varname) " does not have type " CppAsString(typename))
+#define AssertVariableIsOfTypeMacro(varname, typename) \
+	((void) StaticAssertExpr(__builtin_types_compatible_p(__typeof__(varname), typename), \
+	 CppAsString(varname) " does not have type " CppAsString(typename)))
+#else							/* !HAVE__BUILTIN_TYPES_COMPATIBLE_P */
+#define AssertVariableIsOfType(varname, typename) \
+	StaticAssertStmt(sizeof(varname) == sizeof(typename), \
+	CppAsString(varname) " does not have type " CppAsString(typename))
+#define AssertVariableIsOfTypeMacro(varname, typename) \
+	((void) StaticAssertExpr(sizeof(varname) == sizeof(typename),		\
+	 CppAsString(varname) " does not have type " CppAsString(typename)))
+#endif   /* HAVE__BUILTIN_TYPES_COMPATIBLE_P */
+
+
+/* ----------------------------------------------------------------
+ *				Section 7:	widely useful macros
+ * ----------------------------------------------------------------
+ */
+/*
+ * Max
+ *		Return the maximum of two numbers.
+ */
+#define Max(x, y)		((x) > (y) ? (x) : (y))
+
+/*
+ * Min
+ *		Return the minimum of two numbers.
+ */
+#define Min(x, y)		((x) < (y) ? (x) : (y))
+
+/*
+ * Abs
+ *		Return the absolute value of the argument.
+ */
+#define Abs(x)			((x) >= 0 ? (x) : -(x))
+
+/*
+ * StrNCpy
+ *	Like standard library function strncpy(), except that result string
+ *	is guaranteed to be null-terminated --- that is, at most N-1 bytes
+ *	of the source string will be kept.
+ *	Also, the macro returns no result (too hard to do that without
+ *	evaluating the arguments multiple times, which seems worse).
+ *
+ *	BTW: when you need to copy a non-null-terminated string (like a text
+ *	datum) and add a null, do not do it with StrNCpy(..., len+1).  That
+ *	might seem to work, but it fetches one byte more than there is in the
+ *	text object.  One fine day you'll have a SIGSEGV because there isn't
+ *	another byte before the end of memory.  Don't laugh, we've had real
+ *	live bug reports from real live users over exactly this mistake.
+ *	Do it honestly with "memcpy(dst,src,len); dst[len] = '\0';", instead.
+ */
+#define StrNCpy(dst,src,len) \
+	do \
+	{ \
+		char * _dst = (dst); \
+		Size _len = (len); \
+\
+		if (_len > 0) \
+		{ \
+			strncpy(_dst, (src), _len); \
+			_dst[_len-1] = '\0'; \
+		} \
+	} while (0)
+
+
+/* Get a bit mask of the bits set in non-long aligned addresses */
+#define LONG_ALIGN_MASK (sizeof(long) - 1)
+
+/*
+ * MemSet
+ *	Exactly the same as standard library function memset(), but considerably
+ *	faster for zeroing small word-aligned structures (such as parsetree nodes).
+ *	This has to be a macro because the main point is to avoid function-call
+ *	overhead.   However, we have also found that the loop is faster than
+ *	native libc memset() on some platforms, even those with assembler
+ *	memset() functions.  More research needs to be done, perhaps with
+ *	MEMSET_LOOP_LIMIT tests in configure.
+ */
+#define MemSet(start, val, len) \
+	do \
+	{ \
+		/* must be void* because we don't know if it is integer aligned yet */ \
+		void   *_vstart = (void *) (start); \
+		int		_val = (val); \
+		Size	_len = (len); \
+\
+		if ((((uintptr_t) _vstart) & LONG_ALIGN_MASK) == 0 && \
+			(_len & LONG_ALIGN_MASK) == 0 && \
+			_val == 0 && \
+			_len <= MEMSET_LOOP_LIMIT && \
+			/* \
+			 *	If MEMSET_LOOP_LIMIT == 0, optimizer should find \
+			 *	the whole "if" false at compile time. \
+			 */ \
+			MEMSET_LOOP_LIMIT != 0) \
+		{ \
+			long *_start = (long *) _vstart; \
+			long *_stop = (long *) ((char *) _start + _len); \
+			while (_start < _stop) \
+				*_start++ = 0; \
+		} \
+		else \
+			memset(_vstart, _val, _len); \
+	} while (0)
+
+/*
+ * MemSetAligned is the same as MemSet except it omits the test to see if
+ * "start" is word-aligned.  This is okay to use if the caller knows a-priori
+ * that the pointer is suitably aligned (typically, because he just got it
+ * from palloc(), which always delivers a max-aligned pointer).
+ */
+#define MemSetAligned(start, val, len) \
+	do \
+	{ \
+		long   *_start = (long *) (start); \
+		int		_val = (val); \
+		Size	_len = (len); \
+\
+		if ((_len & LONG_ALIGN_MASK) == 0 && \
+			_val == 0 && \
+			_len <= MEMSET_LOOP_LIMIT && \
+			MEMSET_LOOP_LIMIT != 0) \
+		{ \
+			long *_stop = (long *) ((char *) _start + _len); \
+			while (_start < _stop) \
+				*_start++ = 0; \
+		} \
+		else \
+			memset(_start, _val, _len); \
+	} while (0)
+
+
+/*
+ * MemSetTest/MemSetLoop are a variant version that allow all the tests in
+ * MemSet to be done at compile time in cases where "val" and "len" are
+ * constants *and* we know the "start" pointer must be word-aligned.
+ * If MemSetTest succeeds, then it is okay to use MemSetLoop, otherwise use
+ * MemSetAligned.  Beware of multiple evaluations of the arguments when using
+ * this approach.
+ */
+#define MemSetTest(val, len) \
+	( ((len) & LONG_ALIGN_MASK) == 0 && \
+	(len) <= MEMSET_LOOP_LIMIT && \
+	MEMSET_LOOP_LIMIT != 0 && \
+	(val) == 0 )
+
+#define MemSetLoop(start, val, len) \
+	do \
+	{ \
+		long * _start = (long *) (start); \
+		long * _stop = (long *) ((char *) _start + (Size) (len)); \
+	\
+		while (_start < _stop) \
+			*_start++ = 0; \
+	} while (0)
+
+
+/*
+ * Mark a point as unreachable in a portable fashion.  This should preferably
+ * be something that the compiler understands, to aid code generation.
+ * In assert-enabled builds, we prefer abort() for debugging reasons.
+ */
+#if defined(HAVE__BUILTIN_UNREACHABLE) && !defined(USE_ASSERT_CHECKING)
+#define pg_unreachable() __builtin_unreachable()
+#elif defined(_MSC_VER) && !defined(USE_ASSERT_CHECKING)
+#define pg_unreachable() __assume(0)
+#else
+#define pg_unreachable() abort()
+#endif
+
+
+/*
+ * Function inlining support -- Allow modules to define functions that may be
+ * inlined, if the compiler supports it.
+ *
+ * The function bodies must be defined in the module header prefixed by
+ * STATIC_IF_INLINE, protected by a cpp symbol that the module's .c file must
+ * define.  If the compiler doesn't support inline functions, the function
+ * definitions are pulled in by the .c file as regular (not inline) symbols.
+ *
+ * The header must also declare the functions' prototypes, protected by
+ * !PG_USE_INLINE.
+ */
+
+/* declarations which are only visible when not inlining and in the .c file */
+#ifdef PG_USE_INLINE
+#define STATIC_IF_INLINE static inline
+#else
+#define STATIC_IF_INLINE
+#endif   /* PG_USE_INLINE */
+
+/* declarations which are marked inline when inlining, extern otherwise */
+#ifdef PG_USE_INLINE
+#define STATIC_IF_INLINE_DECLARE static inline
+#else
+#define STATIC_IF_INLINE_DECLARE extern
+#endif   /* PG_USE_INLINE */
+
+
+/* ----------------------------------------------------------------
+ *				Section 8:	random stuff
+ * ----------------------------------------------------------------
+ */
+
+/* msb for char */
+#define HIGHBIT					(0x80)
+#define IS_HIGHBIT_SET(ch)		((unsigned char)(ch) & HIGHBIT)
+
+#define STATUS_OK				(0)
+#define STATUS_ERROR			(-1)
+#define STATUS_EOF				(-2)
+#define STATUS_FOUND			(1)
+#define STATUS_WAITING			(2)
+
+
+/*
+ * Append PG_USED_FOR_ASSERTS_ONLY to definitions of variables that are only
+ * used in assert-enabled builds, to avoid compiler warnings about unused
+ * variables in assert-disabled builds.
+ */
+#ifdef USE_ASSERT_CHECKING
+#define PG_USED_FOR_ASSERTS_ONLY
+#else
+#define PG_USED_FOR_ASSERTS_ONLY pg_attribute_unused()
+#endif
+
+
+/* gettext domain name mangling */
+
+/*
+ * To better support parallel installations of major PostgeSQL
+ * versions as well as parallel installations of major library soname
+ * versions, we mangle the gettext domain name by appending those
+ * version numbers.  The coding rule ought to be that wherever the
+ * domain name is mentioned as a literal, it must be wrapped into
+ * PG_TEXTDOMAIN().  The macros below do not work on non-literals; but
+ * that is somewhat intentional because it avoids having to worry
+ * about multiple states of premangling and postmangling as the values
+ * are being passed around.
+ *
+ * Make sure this matches the installation rules in nls-global.mk.
+ */
+
+/* need a second indirection because we want to stringize the macro value, not the name */
+#define CppAsString2(x) CppAsString(x)
+
+#ifdef SO_MAJOR_VERSION
+#define PG_TEXTDOMAIN(domain) (domain CppAsString2(SO_MAJOR_VERSION) "-" PG_MAJORVERSION)
+#else
+#define PG_TEXTDOMAIN(domain) (domain "-" PG_MAJORVERSION)
+#endif
+
+
+/* ----------------------------------------------------------------
+ *				Section 9: system-specific hacks
+ *
+ *		This should be limited to things that absolutely have to be
+ *		included in every source file.  The port-specific header file
+ *		is usually a better place for this sort of thing.
+ * ----------------------------------------------------------------
+ */
+
+/*
+ *	NOTE:  this is also used for opening text files.
+ *	WIN32 treats Control-Z as EOF in files opened in text mode.
+ *	Therefore, we open files in binary mode on Win32 so we can read
+ *	literal control-Z.  The other affect is that we see CRLF, but
+ *	that is OK because we can already handle those cleanly.
+ */
+#if defined(WIN32) || defined(__CYGWIN__)
+#define PG_BINARY	O_BINARY
+#define PG_BINARY_A "ab"
+#define PG_BINARY_R "rb"
+#define PG_BINARY_W "wb"
+#else
+#define PG_BINARY	0
+#define PG_BINARY_A "a"
+#define PG_BINARY_R "r"
+#define PG_BINARY_W "w"
+#endif
+
+/*
+ * Provide prototypes for routines not present in a particular machine's
+ * standard C library.
+ */
+
+#if !HAVE_DECL_SNPRINTF
+extern int	snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3, 4);
+#endif
+
+#if !HAVE_DECL_VSNPRINTF
+extern int	vsnprintf(char *str, size_t count, const char *fmt, va_list args);
+#endif
+
+#if !defined(HAVE_MEMMOVE) && !defined(memmove)
+#define memmove(d, s, c)		bcopy(s, d, c)
+#endif
+
+/* no special DLL markers on most ports */
+#ifndef PGDLLIMPORT
+#define PGDLLIMPORT
+#endif
+#ifndef PGDLLEXPORT
+#define PGDLLEXPORT
+#endif
+
+/*
+ * The following is used as the arg list for signal handlers.  Any ports
+ * that take something other than an int argument should override this in
+ * their pg_config_os.h file.  Note that variable names are required
+ * because it is used in both the prototypes as well as the definitions.
+ * Note also the long name.  We expect that this won't collide with
+ * other names causing compiler warnings.
+ */
+
+#ifndef SIGNAL_ARGS
+#define SIGNAL_ARGS  int postgres_signal_arg
+#endif
+
+/*
+ * When there is no sigsetjmp, its functionality is provided by plain
+ * setjmp. Incidentally, nothing provides setjmp's functionality in
+ * that case.
+ */
+#ifndef HAVE_SIGSETJMP
+#define sigjmp_buf jmp_buf
+#define sigsetjmp(x,y) setjmp(x)
+#define siglongjmp longjmp
+#endif
+
+#if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC
+extern int	fdatasync(int fildes);
+#endif
+
+/* If strtoq() exists, rename it to the more standard strtoll() */
+#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ)
+#define strtoll strtoq
+#define HAVE_STRTOLL 1
+#endif
+
+/* If strtouq() exists, rename it to the more standard strtoull() */
+#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOULL) && defined(HAVE_STRTOUQ)
+#define strtoull strtouq
+#define HAVE_STRTOULL 1
+#endif
+
+/*
+ * We assume if we have these two functions, we have their friends too, and
+ * can use the wide-character functions.
+ */
+#if defined(HAVE_WCSTOMBS) && defined(HAVE_TOWLOWER)
+#define USE_WIDE_UPPER_LOWER
+#endif
+
+/* EXEC_BACKEND defines */
+#ifdef EXEC_BACKEND
+#define NON_EXEC_STATIC
+#else
+#define NON_EXEC_STATIC static
+#endif
+
+/* /port compatibility functions */
+#include "port.h"
+
+#endif   /* C_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/dependency.h b/foreign/libpg_query/src/postgres/include/catalog/dependency.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/dependency.h
@@ -0,0 +1,269 @@
+/*-------------------------------------------------------------------------
+ *
+ * dependency.h
+ *	  Routines to support inter-object dependencies.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/dependency.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef DEPENDENCY_H
+#define DEPENDENCY_H
+
+#include "catalog/objectaddress.h"
+
+
+/*
+ * Precise semantics of a dependency relationship are specified by the
+ * DependencyType code (which is stored in a "char" field in pg_depend,
+ * so we assign ASCII-code values to the enumeration members).
+ *
+ * In all cases, a dependency relationship indicates that the referenced
+ * object may not be dropped without also dropping the dependent object.
+ * However, there are several subflavors:
+ *
+ * DEPENDENCY_NORMAL ('n'): normal relationship between separately-created
+ * objects.  The dependent object may be dropped without affecting the
+ * referenced object.  The referenced object may only be dropped by
+ * specifying CASCADE, in which case the dependent object is dropped too.
+ * Example: a table column has a normal dependency on its datatype.
+ *
+ * DEPENDENCY_AUTO ('a'): the dependent object can be dropped separately
+ * from the referenced object, and should be automatically dropped
+ * (regardless of RESTRICT or CASCADE mode) if the referenced object
+ * is dropped.
+ * Example: a named constraint on a table is made auto-dependent on
+ * the table, so that it will go away if the table is dropped.
+ *
+ * DEPENDENCY_INTERNAL ('i'): the dependent object was created as part
+ * of creation of the referenced object, and is really just a part of
+ * its internal implementation.  A DROP of the dependent object will be
+ * disallowed outright (we'll tell the user to issue a DROP against the
+ * referenced object, instead).  A DROP of the referenced object will be
+ * propagated through to drop the dependent object whether CASCADE is
+ * specified or not.
+ * Example: a trigger that's created to enforce a foreign-key constraint
+ * is made internally dependent on the constraint's pg_constraint entry.
+ *
+ * DEPENDENCY_EXTENSION ('e'): the dependent object is a member of the
+ * extension that is the referenced object.  The dependent object can be
+ * dropped only via DROP EXTENSION on the referenced object.  Functionally
+ * this dependency type acts the same as an internal dependency, but it's
+ * kept separate for clarity and to simplify pg_dump.
+ *
+ * DEPENDENCY_PIN ('p'): there is no dependent object; this type of entry
+ * is a signal that the system itself depends on the referenced object,
+ * and so that object must never be deleted.  Entries of this type are
+ * created only during initdb.  The fields for the dependent object
+ * contain zeroes.
+ *
+ * Other dependency flavors may be needed in future.
+ */
+
+typedef enum DependencyType
+{
+	DEPENDENCY_NORMAL = 'n',
+	DEPENDENCY_AUTO = 'a',
+	DEPENDENCY_INTERNAL = 'i',
+	DEPENDENCY_EXTENSION = 'e',
+	DEPENDENCY_PIN = 'p'
+} DependencyType;
+
+/*
+ * There is also a SharedDependencyType enum type that determines the exact
+ * semantics of an entry in pg_shdepend.  Just like regular dependency entries,
+ * any pg_shdepend entry means that the referenced object cannot be dropped
+ * unless the dependent object is dropped at the same time.  There are some
+ * additional rules however:
+ *
+ * (a) For a SHARED_DEPENDENCY_PIN entry, there is no dependent object --
+ * rather, the referenced object is an essential part of the system.  This
+ * applies to the initdb-created superuser.  Entries of this type are only
+ * created by initdb; objects in this category don't need further pg_shdepend
+ * entries if more objects come to depend on them.
+ *
+ * (b) a SHARED_DEPENDENCY_OWNER entry means that the referenced object is
+ * the role owning the dependent object.  The referenced object must be
+ * a pg_authid entry.
+ *
+ * (c) a SHARED_DEPENDENCY_ACL entry means that the referenced object is
+ * a role mentioned in the ACL field of the dependent object.  The referenced
+ * object must be a pg_authid entry.  (SHARED_DEPENDENCY_ACL entries are not
+ * created for the owner of an object; hence two objects may be linked by
+ * one or the other, but not both, of these dependency types.)
+ *
+ * (d) a SHARED_DEPENDENCY_POLICY entry means that the referenced object is
+ * a role mentioned in a policy object.  The referenced object must be a
+ * pg_authid entry.
+ *
+ * SHARED_DEPENDENCY_INVALID is a value used as a parameter in internal
+ * routines, and is not valid in the catalog itself.
+ */
+typedef enum SharedDependencyType
+{
+	SHARED_DEPENDENCY_PIN = 'p',
+	SHARED_DEPENDENCY_OWNER = 'o',
+	SHARED_DEPENDENCY_ACL = 'a',
+	SHARED_DEPENDENCY_POLICY = 'r',
+	SHARED_DEPENDENCY_INVALID = 0
+} SharedDependencyType;
+
+/* expansible list of ObjectAddresses (private in dependency.c) */
+typedef struct ObjectAddresses ObjectAddresses;
+
+/*
+ * This enum covers all system catalogs whose OIDs can appear in
+ * pg_depend.classId or pg_shdepend.classId.  Keep object_classes[] in sync.
+ */
+typedef enum ObjectClass
+{
+	OCLASS_CLASS,				/* pg_class */
+	OCLASS_PROC,				/* pg_proc */
+	OCLASS_TYPE,				/* pg_type */
+	OCLASS_CAST,				/* pg_cast */
+	OCLASS_COLLATION,			/* pg_collation */
+	OCLASS_CONSTRAINT,			/* pg_constraint */
+	OCLASS_CONVERSION,			/* pg_conversion */
+	OCLASS_DEFAULT,				/* pg_attrdef */
+	OCLASS_LANGUAGE,			/* pg_language */
+	OCLASS_LARGEOBJECT,			/* pg_largeobject */
+	OCLASS_OPERATOR,			/* pg_operator */
+	OCLASS_OPCLASS,				/* pg_opclass */
+	OCLASS_OPFAMILY,			/* pg_opfamily */
+	OCLASS_AMOP,				/* pg_amop */
+	OCLASS_AMPROC,				/* pg_amproc */
+	OCLASS_REWRITE,				/* pg_rewrite */
+	OCLASS_TRIGGER,				/* pg_trigger */
+	OCLASS_SCHEMA,				/* pg_namespace */
+	OCLASS_TSPARSER,			/* pg_ts_parser */
+	OCLASS_TSDICT,				/* pg_ts_dict */
+	OCLASS_TSTEMPLATE,			/* pg_ts_template */
+	OCLASS_TSCONFIG,			/* pg_ts_config */
+	OCLASS_ROLE,				/* pg_authid */
+	OCLASS_DATABASE,			/* pg_database */
+	OCLASS_TBLSPACE,			/* pg_tablespace */
+	OCLASS_FDW,					/* pg_foreign_data_wrapper */
+	OCLASS_FOREIGN_SERVER,		/* pg_foreign_server */
+	OCLASS_USER_MAPPING,		/* pg_user_mapping */
+	OCLASS_DEFACL,				/* pg_default_acl */
+	OCLASS_EXTENSION,			/* pg_extension */
+	OCLASS_EVENT_TRIGGER,		/* pg_event_trigger */
+	OCLASS_POLICY,				/* pg_policy */
+	OCLASS_TRANSFORM			/* pg_transform */
+} ObjectClass;
+
+#define LAST_OCLASS		OCLASS_TRANSFORM
+
+
+/* in dependency.c */
+
+#define PERFORM_DELETION_INTERNAL			0x0001
+#define PERFORM_DELETION_CONCURRENTLY		0x0002
+
+extern void performDeletion(const ObjectAddress *object,
+				DropBehavior behavior, int flags);
+
+extern void performMultipleDeletions(const ObjectAddresses *objects,
+						 DropBehavior behavior, int flags);
+
+extern void deleteWhatDependsOn(const ObjectAddress *object,
+					bool showNotices);
+
+extern void recordDependencyOnExpr(const ObjectAddress *depender,
+					   Node *expr, List *rtable,
+					   DependencyType behavior);
+
+extern void recordDependencyOnSingleRelExpr(const ObjectAddress *depender,
+								Node *expr, Oid relId,
+								DependencyType behavior,
+								DependencyType self_behavior);
+
+extern ObjectClass getObjectClass(const ObjectAddress *object);
+
+extern ObjectAddresses *new_object_addresses(void);
+
+extern void add_exact_object_address(const ObjectAddress *object,
+						 ObjectAddresses *addrs);
+
+extern bool object_address_present(const ObjectAddress *object,
+					   const ObjectAddresses *addrs);
+
+extern void record_object_address_dependencies(const ObjectAddress *depender,
+								   ObjectAddresses *referenced,
+								   DependencyType behavior);
+
+extern void free_object_addresses(ObjectAddresses *addrs);
+
+/* in pg_depend.c */
+
+extern void recordDependencyOn(const ObjectAddress *depender,
+				   const ObjectAddress *referenced,
+				   DependencyType behavior);
+
+extern void recordMultipleDependencies(const ObjectAddress *depender,
+						   const ObjectAddress *referenced,
+						   int nreferenced,
+						   DependencyType behavior);
+
+extern void recordDependencyOnCurrentExtension(const ObjectAddress *object,
+								   bool isReplace);
+
+extern long deleteDependencyRecordsFor(Oid classId, Oid objectId,
+						   bool skipExtensionDeps);
+
+extern long deleteDependencyRecordsForClass(Oid classId, Oid objectId,
+								Oid refclassId, char deptype);
+
+extern long changeDependencyFor(Oid classId, Oid objectId,
+					Oid refClassId, Oid oldRefObjectId,
+					Oid newRefObjectId);
+
+extern Oid	getExtensionOfObject(Oid classId, Oid objectId);
+
+extern bool sequenceIsOwned(Oid seqId, Oid *tableId, int32 *colId);
+
+extern void markSequenceUnowned(Oid seqId);
+
+extern List *getOwnedSequences(Oid relid);
+
+extern Oid	get_constraint_index(Oid constraintId);
+
+extern Oid	get_index_constraint(Oid indexId);
+
+/* in pg_shdepend.c */
+
+extern void recordSharedDependencyOn(ObjectAddress *depender,
+						 ObjectAddress *referenced,
+						 SharedDependencyType deptype);
+
+extern void deleteSharedDependencyRecordsFor(Oid classId, Oid objectId,
+								 int32 objectSubId);
+
+extern void recordDependencyOnOwner(Oid classId, Oid objectId, Oid owner);
+
+extern void changeDependencyOnOwner(Oid classId, Oid objectId,
+						Oid newOwnerId);
+
+extern void updateAclDependencies(Oid classId, Oid objectId, int32 objectSubId,
+					  Oid ownerId,
+					  int noldmembers, Oid *oldmembers,
+					  int nnewmembers, Oid *newmembers);
+
+extern bool checkSharedDependencies(Oid classId, Oid objectId,
+						char **detail_msg, char **detail_log_msg);
+
+extern void shdepLockAndCheckObject(Oid classId, Oid objectId);
+
+extern void copyTemplateDependencies(Oid templateDbId, Oid newDbId);
+
+extern void dropDatabaseDependencies(Oid databaseId);
+
+extern void shdepDropOwned(List *relids, DropBehavior behavior);
+
+extern void shdepReassignOwned(List *relids, Oid newrole);
+
+#endif   /* DEPENDENCY_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/genbki.h b/foreign/libpg_query/src/postgres/include/catalog/genbki.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/genbki.h
@@ -0,0 +1,50 @@
+/*-------------------------------------------------------------------------
+ *
+ * genbki.h
+ *	  Required include file for all POSTGRES catalog header files
+ *
+ * genbki.h defines CATALOG(), DATA(), BKI_BOOTSTRAP and related macros
+ * so that the catalog header files can be read by the C compiler.
+ * (These same words are recognized by genbki.pl to build the BKI
+ * bootstrap file from these header files.)
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/genbki.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef GENBKI_H
+#define GENBKI_H
+
+/* Introduces a catalog's structure definition */
+#define CATALOG(name,oid)	typedef struct CppConcat(FormData_,name)
+
+/* Options that may appear after CATALOG (on the same line) */
+#define BKI_BOOTSTRAP
+#define BKI_SHARED_RELATION
+#define BKI_WITHOUT_OIDS
+#define BKI_ROWTYPE_OID(oid)
+#define BKI_SCHEMA_MACRO
+#define BKI_FORCE_NULL
+#define BKI_FORCE_NOT_NULL
+
+/*
+ * This is never defined; it's here only for documentation.
+ *
+ * Variable-length catalog fields (except possibly the first not nullable one)
+ * should not be visible in C structures, so they are made invisible by #ifdefs
+ * of an undefined symbol.  See also MARKNOTNULL in bootstrap.c for how this is
+ * handled.
+ */
+#undef CATALOG_VARLEN
+
+/* Declarations that provide the initial content of a catalog */
+/* In C, these need to expand into some harmless, repeatable declaration */
+#define DATA(x)   extern int no_such_variable
+#define DESCR(x)  extern int no_such_variable
+#define SHDESCR(x) extern int no_such_variable
+
+#endif   /* GENBKI_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/index.h b/foreign/libpg_query/src/postgres/include/catalog/index.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/index.h
@@ -0,0 +1,134 @@
+/*-------------------------------------------------------------------------
+ *
+ * index.h
+ *	  prototypes for catalog/index.c.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/index.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef INDEX_H
+#define INDEX_H
+
+#include "catalog/objectaddress.h"
+#include "nodes/execnodes.h"
+
+
+#define DEFAULT_INDEX_TYPE	"btree"
+
+/* Typedef for callback function for IndexBuildHeapScan */
+typedef void (*IndexBuildCallback) (Relation index,
+												HeapTuple htup,
+												Datum *values,
+												bool *isnull,
+												bool tupleIsAlive,
+												void *state);
+
+/* Action code for index_set_state_flags */
+typedef enum
+{
+	INDEX_CREATE_SET_READY,
+	INDEX_CREATE_SET_VALID,
+	INDEX_DROP_CLEAR_VALID,
+	INDEX_DROP_SET_DEAD
+} IndexStateFlagsAction;
+
+
+extern void index_check_primary_key(Relation heapRel,
+						IndexInfo *indexInfo,
+						bool is_alter_table);
+
+extern Oid index_create(Relation heapRelation,
+			 const char *indexRelationName,
+			 Oid indexRelationId,
+			 Oid relFileNode,
+			 IndexInfo *indexInfo,
+			 List *indexColNames,
+			 Oid accessMethodObjectId,
+			 Oid tableSpaceId,
+			 Oid *collationObjectId,
+			 Oid *classObjectId,
+			 int16 *coloptions,
+			 Datum reloptions,
+			 bool isprimary,
+			 bool isconstraint,
+			 bool deferrable,
+			 bool initdeferred,
+			 bool allow_system_table_mods,
+			 bool skip_build,
+			 bool concurrent,
+			 bool is_internal,
+			 bool if_not_exists);
+
+extern ObjectAddress index_constraint_create(Relation heapRelation,
+						Oid indexRelationId,
+						IndexInfo *indexInfo,
+						const char *constraintName,
+						char constraintType,
+						bool deferrable,
+						bool initdeferred,
+						bool mark_as_primary,
+						bool update_pgindex,
+						bool remove_old_dependencies,
+						bool allow_system_table_mods,
+						bool is_internal);
+
+extern void index_drop(Oid indexId, bool concurrent);
+
+extern IndexInfo *BuildIndexInfo(Relation index);
+
+extern void BuildSpeculativeIndexInfo(Relation index, IndexInfo *ii);
+
+extern void FormIndexDatum(IndexInfo *indexInfo,
+			   TupleTableSlot *slot,
+			   EState *estate,
+			   Datum *values,
+			   bool *isnull);
+
+extern void index_build(Relation heapRelation,
+			Relation indexRelation,
+			IndexInfo *indexInfo,
+			bool isprimary,
+			bool isreindex);
+
+extern double IndexBuildHeapScan(Relation heapRelation,
+				   Relation indexRelation,
+				   IndexInfo *indexInfo,
+				   bool allow_sync,
+				   IndexBuildCallback callback,
+				   void *callback_state);
+extern double IndexBuildHeapRangeScan(Relation heapRelation,
+						Relation indexRelation,
+						IndexInfo *indexInfo,
+						bool allow_sync,
+						bool anyvisible,
+						BlockNumber start_blockno,
+						BlockNumber end_blockno,
+						IndexBuildCallback callback,
+						void *callback_state);
+
+extern void validate_index(Oid heapId, Oid indexId, Snapshot snapshot);
+
+extern void index_set_state_flags(Oid indexId, IndexStateFlagsAction action);
+
+extern void reindex_index(Oid indexId, bool skip_constraint_checks,
+			  char relpersistence, int options);
+
+/* Flag bits for reindex_relation(): */
+#define REINDEX_REL_PROCESS_TOAST			0x01
+#define REINDEX_REL_SUPPRESS_INDEX_USE		0x02
+#define REINDEX_REL_CHECK_CONSTRAINTS		0x04
+#define REINDEX_REL_FORCE_INDEXES_UNLOGGED	0x08
+#define REINDEX_REL_FORCE_INDEXES_PERMANENT 0x10
+
+extern bool reindex_relation(Oid relid, int flags, int options);
+
+extern bool ReindexIsProcessingHeap(Oid heapOid);
+extern bool ReindexIsProcessingIndex(Oid indexOid);
+extern Oid	IndexGetRelation(Oid indexId, bool missing_ok);
+
+#endif   /* INDEX_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/indexing.h b/foreign/libpg_query/src/postgres/include/catalog/indexing.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/indexing.h
@@ -0,0 +1,322 @@
+/*-------------------------------------------------------------------------
+ *
+ * indexing.h
+ *	  This file provides some definitions to support indexing
+ *	  on system catalogs
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/indexing.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef INDEXING_H
+#define INDEXING_H
+
+#include "access/htup.h"
+#include "utils/relcache.h"
+
+/*
+ * The state object used by CatalogOpenIndexes and friends is actually the
+ * same as the executor's ResultRelInfo, but we give it another type name
+ * to decouple callers from that fact.
+ */
+typedef struct ResultRelInfo *CatalogIndexState;
+
+/*
+ * indexing.c prototypes
+ */
+extern CatalogIndexState CatalogOpenIndexes(Relation heapRel);
+extern void CatalogCloseIndexes(CatalogIndexState indstate);
+extern void CatalogIndexInsert(CatalogIndexState indstate,
+				   HeapTuple heapTuple);
+extern void CatalogUpdateIndexes(Relation heapRel, HeapTuple heapTuple);
+
+
+/*
+ * These macros are just to keep the C compiler from spitting up on the
+ * upcoming commands for genbki.pl.
+ */
+#define DECLARE_INDEX(name,oid,decl) extern int no_such_variable
+#define DECLARE_UNIQUE_INDEX(name,oid,decl) extern int no_such_variable
+#define BUILD_INDICES
+
+
+/*
+ * What follows are lines processed by genbki.pl to create the statements
+ * the bootstrap parser will turn into DefineIndex calls.
+ *
+ * The keyword is DECLARE_INDEX or DECLARE_UNIQUE_INDEX.  The first two
+ * arguments are the index name and OID, the rest is much like a standard
+ * 'create index' SQL command.
+ *
+ * For each index, we also provide a #define for its OID.  References to
+ * the index in the C code should always use these #defines, not the actual
+ * index name (much less the numeric OID).
+ */
+
+DECLARE_UNIQUE_INDEX(pg_aggregate_fnoid_index, 2650, on pg_aggregate using btree(aggfnoid oid_ops));
+#define AggregateFnoidIndexId  2650
+
+DECLARE_UNIQUE_INDEX(pg_am_name_index, 2651, on pg_am using btree(amname name_ops));
+#define AmNameIndexId  2651
+DECLARE_UNIQUE_INDEX(pg_am_oid_index, 2652, on pg_am using btree(oid oid_ops));
+#define AmOidIndexId  2652
+
+DECLARE_UNIQUE_INDEX(pg_amop_fam_strat_index, 2653, on pg_amop using btree(amopfamily oid_ops, amoplefttype oid_ops, amoprighttype oid_ops, amopstrategy int2_ops));
+#define AccessMethodStrategyIndexId  2653
+DECLARE_UNIQUE_INDEX(pg_amop_opr_fam_index, 2654, on pg_amop using btree(amopopr oid_ops, amoppurpose char_ops, amopfamily oid_ops));
+#define AccessMethodOperatorIndexId  2654
+DECLARE_UNIQUE_INDEX(pg_amop_oid_index, 2756, on pg_amop using btree(oid oid_ops));
+#define AccessMethodOperatorOidIndexId	2756
+
+DECLARE_UNIQUE_INDEX(pg_amproc_fam_proc_index, 2655, on pg_amproc using btree(amprocfamily oid_ops, amproclefttype oid_ops, amprocrighttype oid_ops, amprocnum int2_ops));
+#define AccessMethodProcedureIndexId  2655
+DECLARE_UNIQUE_INDEX(pg_amproc_oid_index, 2757, on pg_amproc using btree(oid oid_ops));
+#define AccessMethodProcedureOidIndexId  2757
+
+DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index, 2656, on pg_attrdef using btree(adrelid oid_ops, adnum int2_ops));
+#define AttrDefaultIndexId	2656
+DECLARE_UNIQUE_INDEX(pg_attrdef_oid_index, 2657, on pg_attrdef using btree(oid oid_ops));
+#define AttrDefaultOidIndexId  2657
+
+DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnam_index, 2658, on pg_attribute using btree(attrelid oid_ops, attname name_ops));
+#define AttributeRelidNameIndexId  2658
+DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnum_index, 2659, on pg_attribute using btree(attrelid oid_ops, attnum int2_ops));
+#define AttributeRelidNumIndexId  2659
+
+DECLARE_UNIQUE_INDEX(pg_authid_rolname_index, 2676, on pg_authid using btree(rolname name_ops));
+#define AuthIdRolnameIndexId	2676
+DECLARE_UNIQUE_INDEX(pg_authid_oid_index, 2677, on pg_authid using btree(oid oid_ops));
+#define AuthIdOidIndexId	2677
+
+DECLARE_UNIQUE_INDEX(pg_auth_members_role_member_index, 2694, on pg_auth_members using btree(roleid oid_ops, member oid_ops));
+#define AuthMemRoleMemIndexId	2694
+DECLARE_UNIQUE_INDEX(pg_auth_members_member_role_index, 2695, on pg_auth_members using btree(member oid_ops, roleid oid_ops));
+#define AuthMemMemRoleIndexId	2695
+
+DECLARE_UNIQUE_INDEX(pg_cast_oid_index, 2660, on pg_cast using btree(oid oid_ops));
+#define CastOidIndexId	2660
+DECLARE_UNIQUE_INDEX(pg_cast_source_target_index, 2661, on pg_cast using btree(castsource oid_ops, casttarget oid_ops));
+#define CastSourceTargetIndexId  2661
+
+DECLARE_UNIQUE_INDEX(pg_class_oid_index, 2662, on pg_class using btree(oid oid_ops));
+#define ClassOidIndexId  2662
+DECLARE_UNIQUE_INDEX(pg_class_relname_nsp_index, 2663, on pg_class using btree(relname name_ops, relnamespace oid_ops));
+#define ClassNameNspIndexId  2663
+DECLARE_INDEX(pg_class_tblspc_relfilenode_index, 3455, on pg_class using btree(reltablespace oid_ops, relfilenode oid_ops));
+#define ClassTblspcRelfilenodeIndexId  3455
+
+DECLARE_UNIQUE_INDEX(pg_collation_name_enc_nsp_index, 3164, on pg_collation using btree(collname name_ops, collencoding int4_ops, collnamespace oid_ops));
+#define CollationNameEncNspIndexId 3164
+DECLARE_UNIQUE_INDEX(pg_collation_oid_index, 3085, on pg_collation using btree(oid oid_ops));
+#define CollationOidIndexId  3085
+
+DECLARE_INDEX(pg_constraint_conname_nsp_index, 2664, on pg_constraint using btree(conname name_ops, connamespace oid_ops));
+#define ConstraintNameNspIndexId  2664
+DECLARE_INDEX(pg_constraint_conrelid_index, 2665, on pg_constraint using btree(conrelid oid_ops));
+#define ConstraintRelidIndexId	2665
+DECLARE_INDEX(pg_constraint_contypid_index, 2666, on pg_constraint using btree(contypid oid_ops));
+#define ConstraintTypidIndexId	2666
+DECLARE_UNIQUE_INDEX(pg_constraint_oid_index, 2667, on pg_constraint using btree(oid oid_ops));
+#define ConstraintOidIndexId  2667
+
+DECLARE_UNIQUE_INDEX(pg_conversion_default_index, 2668, on pg_conversion using btree(connamespace oid_ops, conforencoding int4_ops, contoencoding int4_ops, oid oid_ops));
+#define ConversionDefaultIndexId  2668
+DECLARE_UNIQUE_INDEX(pg_conversion_name_nsp_index, 2669, on pg_conversion using btree(conname name_ops, connamespace oid_ops));
+#define ConversionNameNspIndexId  2669
+DECLARE_UNIQUE_INDEX(pg_conversion_oid_index, 2670, on pg_conversion using btree(oid oid_ops));
+#define ConversionOidIndexId  2670
+
+DECLARE_UNIQUE_INDEX(pg_database_datname_index, 2671, on pg_database using btree(datname name_ops));
+#define DatabaseNameIndexId  2671
+DECLARE_UNIQUE_INDEX(pg_database_oid_index, 2672, on pg_database using btree(oid oid_ops));
+#define DatabaseOidIndexId	2672
+
+DECLARE_INDEX(pg_depend_depender_index, 2673, on pg_depend using btree(classid oid_ops, objid oid_ops, objsubid int4_ops));
+#define DependDependerIndexId  2673
+DECLARE_INDEX(pg_depend_reference_index, 2674, on pg_depend using btree(refclassid oid_ops, refobjid oid_ops, refobjsubid int4_ops));
+#define DependReferenceIndexId	2674
+
+DECLARE_UNIQUE_INDEX(pg_description_o_c_o_index, 2675, on pg_description using btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops));
+#define DescriptionObjIndexId  2675
+DECLARE_UNIQUE_INDEX(pg_shdescription_o_c_index, 2397, on pg_shdescription using btree(objoid oid_ops, classoid oid_ops));
+#define SharedDescriptionObjIndexId 2397
+
+DECLARE_UNIQUE_INDEX(pg_enum_oid_index, 3502, on pg_enum using btree(oid oid_ops));
+#define EnumOidIndexId	3502
+DECLARE_UNIQUE_INDEX(pg_enum_typid_label_index, 3503, on pg_enum using btree(enumtypid oid_ops, enumlabel name_ops));
+#define EnumTypIdLabelIndexId 3503
+DECLARE_UNIQUE_INDEX(pg_enum_typid_sortorder_index, 3534, on pg_enum using btree(enumtypid oid_ops, enumsortorder float4_ops));
+#define EnumTypIdSortOrderIndexId 3534
+
+DECLARE_INDEX(pg_index_indrelid_index, 2678, on pg_index using btree(indrelid oid_ops));
+#define IndexIndrelidIndexId  2678
+DECLARE_UNIQUE_INDEX(pg_index_indexrelid_index, 2679, on pg_index using btree(indexrelid oid_ops));
+#define IndexRelidIndexId  2679
+
+DECLARE_UNIQUE_INDEX(pg_inherits_relid_seqno_index, 2680, on pg_inherits using btree(inhrelid oid_ops, inhseqno int4_ops));
+#define InheritsRelidSeqnoIndexId  2680
+DECLARE_INDEX(pg_inherits_parent_index, 2187, on pg_inherits using btree(inhparent oid_ops));
+#define InheritsParentIndexId  2187
+
+DECLARE_UNIQUE_INDEX(pg_language_name_index, 2681, on pg_language using btree(lanname name_ops));
+#define LanguageNameIndexId  2681
+DECLARE_UNIQUE_INDEX(pg_language_oid_index, 2682, on pg_language using btree(oid oid_ops));
+#define LanguageOidIndexId	2682
+
+DECLARE_UNIQUE_INDEX(pg_largeobject_loid_pn_index, 2683, on pg_largeobject using btree(loid oid_ops, pageno int4_ops));
+#define LargeObjectLOidPNIndexId  2683
+
+DECLARE_UNIQUE_INDEX(pg_largeobject_metadata_oid_index, 2996, on pg_largeobject_metadata using btree(oid oid_ops));
+#define LargeObjectMetadataOidIndexId	2996
+
+DECLARE_UNIQUE_INDEX(pg_namespace_nspname_index, 2684, on pg_namespace using btree(nspname name_ops));
+#define NamespaceNameIndexId  2684
+DECLARE_UNIQUE_INDEX(pg_namespace_oid_index, 2685, on pg_namespace using btree(oid oid_ops));
+#define NamespaceOidIndexId  2685
+
+DECLARE_UNIQUE_INDEX(pg_opclass_am_name_nsp_index, 2686, on pg_opclass using btree(opcmethod oid_ops, opcname name_ops, opcnamespace oid_ops));
+#define OpclassAmNameNspIndexId  2686
+DECLARE_UNIQUE_INDEX(pg_opclass_oid_index, 2687, on pg_opclass using btree(oid oid_ops));
+#define OpclassOidIndexId  2687
+
+DECLARE_UNIQUE_INDEX(pg_operator_oid_index, 2688, on pg_operator using btree(oid oid_ops));
+#define OperatorOidIndexId	2688
+DECLARE_UNIQUE_INDEX(pg_operator_oprname_l_r_n_index, 2689, on pg_operator using btree(oprname name_ops, oprleft oid_ops, oprright oid_ops, oprnamespace oid_ops));
+#define OperatorNameNspIndexId	2689
+
+DECLARE_UNIQUE_INDEX(pg_opfamily_am_name_nsp_index, 2754, on pg_opfamily using btree(opfmethod oid_ops, opfname name_ops, opfnamespace oid_ops));
+#define OpfamilyAmNameNspIndexId  2754
+DECLARE_UNIQUE_INDEX(pg_opfamily_oid_index, 2755, on pg_opfamily using btree(oid oid_ops));
+#define OpfamilyOidIndexId	2755
+
+DECLARE_UNIQUE_INDEX(pg_pltemplate_name_index, 1137, on pg_pltemplate using btree(tmplname name_ops));
+#define PLTemplateNameIndexId  1137
+
+DECLARE_UNIQUE_INDEX(pg_proc_oid_index, 2690, on pg_proc using btree(oid oid_ops));
+#define ProcedureOidIndexId  2690
+DECLARE_UNIQUE_INDEX(pg_proc_proname_args_nsp_index, 2691, on pg_proc using btree(proname name_ops, proargtypes oidvector_ops, pronamespace oid_ops));
+#define ProcedureNameArgsNspIndexId  2691
+
+DECLARE_UNIQUE_INDEX(pg_rewrite_oid_index, 2692, on pg_rewrite using btree(oid oid_ops));
+#define RewriteOidIndexId  2692
+DECLARE_UNIQUE_INDEX(pg_rewrite_rel_rulename_index, 2693, on pg_rewrite using btree(ev_class oid_ops, rulename name_ops));
+#define RewriteRelRulenameIndexId  2693
+
+DECLARE_INDEX(pg_shdepend_depender_index, 1232, on pg_shdepend using btree(dbid oid_ops, classid oid_ops, objid oid_ops, objsubid int4_ops));
+#define SharedDependDependerIndexId		1232
+DECLARE_INDEX(pg_shdepend_reference_index, 1233, on pg_shdepend using btree(refclassid oid_ops, refobjid oid_ops));
+#define SharedDependReferenceIndexId	1233
+
+DECLARE_UNIQUE_INDEX(pg_statistic_relid_att_inh_index, 2696, on pg_statistic using btree(starelid oid_ops, staattnum int2_ops, stainherit bool_ops));
+#define StatisticRelidAttnumInhIndexId	2696
+
+DECLARE_UNIQUE_INDEX(pg_tablespace_oid_index, 2697, on pg_tablespace using btree(oid oid_ops));
+#define TablespaceOidIndexId  2697
+DECLARE_UNIQUE_INDEX(pg_tablespace_spcname_index, 2698, on pg_tablespace using btree(spcname name_ops));
+#define TablespaceNameIndexId  2698
+
+DECLARE_UNIQUE_INDEX(pg_transform_oid_index, 3574, on pg_transform using btree(oid oid_ops));
+#define TransformOidIndexId 3574
+DECLARE_UNIQUE_INDEX(pg_transform_type_lang_index, 3575, on pg_transform using btree(trftype oid_ops, trflang oid_ops));
+#define TransformTypeLangIndexId  3575
+
+DECLARE_INDEX(pg_trigger_tgconstraint_index, 2699, on pg_trigger using btree(tgconstraint oid_ops));
+#define TriggerConstraintIndexId  2699
+DECLARE_UNIQUE_INDEX(pg_trigger_tgrelid_tgname_index, 2701, on pg_trigger using btree(tgrelid oid_ops, tgname name_ops));
+#define TriggerRelidNameIndexId  2701
+DECLARE_UNIQUE_INDEX(pg_trigger_oid_index, 2702, on pg_trigger using btree(oid oid_ops));
+#define TriggerOidIndexId  2702
+
+DECLARE_UNIQUE_INDEX(pg_event_trigger_evtname_index, 3467, on pg_event_trigger using btree(evtname name_ops));
+#define EventTriggerNameIndexId  3467
+DECLARE_UNIQUE_INDEX(pg_event_trigger_oid_index, 3468, on pg_event_trigger using btree(oid oid_ops));
+#define EventTriggerOidIndexId	3468
+
+DECLARE_UNIQUE_INDEX(pg_ts_config_cfgname_index, 3608, on pg_ts_config using btree(cfgname name_ops, cfgnamespace oid_ops));
+#define TSConfigNameNspIndexId	3608
+DECLARE_UNIQUE_INDEX(pg_ts_config_oid_index, 3712, on pg_ts_config using btree(oid oid_ops));
+#define TSConfigOidIndexId	3712
+
+DECLARE_UNIQUE_INDEX(pg_ts_config_map_index, 3609, on pg_ts_config_map using btree(mapcfg oid_ops, maptokentype int4_ops, mapseqno int4_ops));
+#define TSConfigMapIndexId	3609
+
+DECLARE_UNIQUE_INDEX(pg_ts_dict_dictname_index, 3604, on pg_ts_dict using btree(dictname name_ops, dictnamespace oid_ops));
+#define TSDictionaryNameNspIndexId	3604
+DECLARE_UNIQUE_INDEX(pg_ts_dict_oid_index, 3605, on pg_ts_dict using btree(oid oid_ops));
+#define TSDictionaryOidIndexId	3605
+
+DECLARE_UNIQUE_INDEX(pg_ts_parser_prsname_index, 3606, on pg_ts_parser using btree(prsname name_ops, prsnamespace oid_ops));
+#define TSParserNameNspIndexId	3606
+DECLARE_UNIQUE_INDEX(pg_ts_parser_oid_index, 3607, on pg_ts_parser using btree(oid oid_ops));
+#define TSParserOidIndexId	3607
+
+DECLARE_UNIQUE_INDEX(pg_ts_template_tmplname_index, 3766, on pg_ts_template using btree(tmplname name_ops, tmplnamespace oid_ops));
+#define TSTemplateNameNspIndexId	3766
+DECLARE_UNIQUE_INDEX(pg_ts_template_oid_index, 3767, on pg_ts_template using btree(oid oid_ops));
+#define TSTemplateOidIndexId	3767
+
+DECLARE_UNIQUE_INDEX(pg_type_oid_index, 2703, on pg_type using btree(oid oid_ops));
+#define TypeOidIndexId	2703
+DECLARE_UNIQUE_INDEX(pg_type_typname_nsp_index, 2704, on pg_type using btree(typname name_ops, typnamespace oid_ops));
+#define TypeNameNspIndexId	2704
+
+DECLARE_UNIQUE_INDEX(pg_foreign_data_wrapper_oid_index, 112, on pg_foreign_data_wrapper using btree(oid oid_ops));
+#define ForeignDataWrapperOidIndexId	112
+DECLARE_UNIQUE_INDEX(pg_foreign_data_wrapper_name_index, 548, on pg_foreign_data_wrapper using btree(fdwname name_ops));
+#define ForeignDataWrapperNameIndexId	548
+
+DECLARE_UNIQUE_INDEX(pg_foreign_server_oid_index, 113, on pg_foreign_server using btree(oid oid_ops));
+#define ForeignServerOidIndexId 113
+DECLARE_UNIQUE_INDEX(pg_foreign_server_name_index, 549, on pg_foreign_server using btree(srvname name_ops));
+#define ForeignServerNameIndexId	549
+
+DECLARE_UNIQUE_INDEX(pg_user_mapping_oid_index, 174, on pg_user_mapping using btree(oid oid_ops));
+#define UserMappingOidIndexId	174
+DECLARE_UNIQUE_INDEX(pg_user_mapping_user_server_index, 175, on pg_user_mapping using btree(umuser oid_ops, umserver oid_ops));
+#define UserMappingUserServerIndexId	175
+
+DECLARE_UNIQUE_INDEX(pg_foreign_table_relid_index, 3119, on pg_foreign_table using btree(ftrelid oid_ops));
+#define ForeignTableRelidIndexId 3119
+
+DECLARE_UNIQUE_INDEX(pg_default_acl_role_nsp_obj_index, 827, on pg_default_acl using btree(defaclrole oid_ops, defaclnamespace oid_ops, defaclobjtype char_ops));
+#define DefaultAclRoleNspObjIndexId 827
+DECLARE_UNIQUE_INDEX(pg_default_acl_oid_index, 828, on pg_default_acl using btree(oid oid_ops));
+#define DefaultAclOidIndexId	828
+
+DECLARE_UNIQUE_INDEX(pg_db_role_setting_databaseid_rol_index, 2965, on pg_db_role_setting using btree(setdatabase oid_ops, setrole oid_ops));
+#define DbRoleSettingDatidRolidIndexId	2965
+
+DECLARE_UNIQUE_INDEX(pg_seclabel_object_index, 3597, on pg_seclabel using btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops, provider text_pattern_ops));
+#define SecLabelObjectIndexId				3597
+
+DECLARE_UNIQUE_INDEX(pg_shseclabel_object_index, 3593, on pg_shseclabel using btree(objoid oid_ops, classoid oid_ops, provider text_pattern_ops));
+#define SharedSecLabelObjectIndexId			3593
+
+DECLARE_UNIQUE_INDEX(pg_extension_oid_index, 3080, on pg_extension using btree(oid oid_ops));
+#define ExtensionOidIndexId 3080
+DECLARE_UNIQUE_INDEX(pg_extension_name_index, 3081, on pg_extension using btree(extname name_ops));
+#define ExtensionNameIndexId 3081
+
+DECLARE_UNIQUE_INDEX(pg_range_rngtypid_index, 3542, on pg_range using btree(rngtypid oid_ops));
+#define RangeTypidIndexId					3542
+
+DECLARE_UNIQUE_INDEX(pg_policy_oid_index, 3257, on pg_policy using btree(oid oid_ops));
+#define PolicyOidIndexId				3257
+
+DECLARE_UNIQUE_INDEX(pg_policy_polrelid_polname_index, 3258, on pg_policy using btree(polrelid oid_ops, polname name_ops));
+#define PolicyPolrelidPolnameIndexId				3258
+
+DECLARE_UNIQUE_INDEX(pg_replication_origin_roiident_index, 6001, on pg_replication_origin using btree(roident oid_ops));
+#define ReplicationOriginIdentIndex 6001
+
+DECLARE_UNIQUE_INDEX(pg_replication_origin_roname_index, 6002, on pg_replication_origin using btree(roname text_pattern_ops));
+#define ReplicationOriginNameIndex 6002
+
+/* last step of initialization script: build the indexes declared above */
+BUILD_INDICES
+
+#endif   /* INDEXING_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/namespace.h b/foreign/libpg_query/src/postgres/include/catalog/namespace.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/namespace.h
@@ -0,0 +1,153 @@
+/*-------------------------------------------------------------------------
+ *
+ * namespace.h
+ *	  prototypes for functions in backend/catalog/namespace.c
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/namespace.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef NAMESPACE_H
+#define NAMESPACE_H
+
+#include "nodes/primnodes.h"
+#include "storage/lock.h"
+
+
+/*
+ *	This structure holds a list of possible functions or operators
+ *	found by namespace lookup.  Each function/operator is identified
+ *	by OID and by argument types; the list must be pruned by type
+ *	resolution rules that are embodied in the parser, not here.
+ *	See FuncnameGetCandidates's comments for more info.
+ */
+typedef struct _FuncCandidateList
+{
+	struct _FuncCandidateList *next;
+	int			pathpos;		/* for internal use of namespace lookup */
+	Oid			oid;			/* the function or operator's OID */
+	int			nargs;			/* number of arg types returned */
+	int			nvargs;			/* number of args to become variadic array */
+	int			ndargs;			/* number of defaulted args */
+	int		   *argnumbers;		/* args' positional indexes, if named call */
+	Oid			args[FLEXIBLE_ARRAY_MEMBER];	/* arg types */
+}	*FuncCandidateList;
+
+/*
+ *	Structure for xxxOverrideSearchPath functions
+ */
+typedef struct OverrideSearchPath
+{
+	List	   *schemas;		/* OIDs of explicitly named schemas */
+	bool		addCatalog;		/* implicitly prepend pg_catalog? */
+	bool		addTemp;		/* implicitly prepend temp schema? */
+} OverrideSearchPath;
+
+typedef void (*RangeVarGetRelidCallback) (const RangeVar *relation, Oid relId,
+										   Oid oldRelId, void *callback_arg);
+
+#define RangeVarGetRelid(relation, lockmode, missing_ok) \
+	RangeVarGetRelidExtended(relation, lockmode, missing_ok, false, NULL, NULL)
+
+extern Oid RangeVarGetRelidExtended(const RangeVar *relation,
+						 LOCKMODE lockmode, bool missing_ok, bool nowait,
+						 RangeVarGetRelidCallback callback,
+						 void *callback_arg);
+extern Oid	RangeVarGetCreationNamespace(const RangeVar *newRelation);
+extern Oid RangeVarGetAndCheckCreationNamespace(RangeVar *newRelation,
+									 LOCKMODE lockmode,
+									 Oid *existing_relation_id);
+extern void RangeVarAdjustRelationPersistence(RangeVar *newRelation, Oid nspid);
+extern Oid	RelnameGetRelid(const char *relname);
+extern bool RelationIsVisible(Oid relid);
+
+extern Oid	TypenameGetTypid(const char *typname);
+extern bool TypeIsVisible(Oid typid);
+
+extern FuncCandidateList FuncnameGetCandidates(List *names,
+					  int nargs, List *argnames,
+					  bool expand_variadic,
+					  bool expand_defaults,
+					  bool missing_ok);
+extern bool FunctionIsVisible(Oid funcid);
+
+extern Oid	OpernameGetOprid(List *names, Oid oprleft, Oid oprright);
+extern FuncCandidateList OpernameGetCandidates(List *names, char oprkind,
+					  bool missing_schema_ok);
+extern bool OperatorIsVisible(Oid oprid);
+
+extern Oid	OpclassnameGetOpcid(Oid amid, const char *opcname);
+extern bool OpclassIsVisible(Oid opcid);
+
+extern Oid	OpfamilynameGetOpfid(Oid amid, const char *opfname);
+extern bool OpfamilyIsVisible(Oid opfid);
+
+extern Oid	CollationGetCollid(const char *collname);
+extern bool CollationIsVisible(Oid collid);
+
+extern Oid	ConversionGetConid(const char *conname);
+extern bool ConversionIsVisible(Oid conid);
+
+extern Oid	get_ts_parser_oid(List *names, bool missing_ok);
+extern bool TSParserIsVisible(Oid prsId);
+
+extern Oid	get_ts_dict_oid(List *names, bool missing_ok);
+extern bool TSDictionaryIsVisible(Oid dictId);
+
+extern Oid	get_ts_template_oid(List *names, bool missing_ok);
+extern bool TSTemplateIsVisible(Oid tmplId);
+
+extern Oid	get_ts_config_oid(List *names, bool missing_ok);
+extern bool TSConfigIsVisible(Oid cfgid);
+
+extern void DeconstructQualifiedName(List *names,
+						 char **nspname_p,
+						 char **objname_p);
+extern Oid	LookupNamespaceNoError(const char *nspname);
+extern Oid	LookupExplicitNamespace(const char *nspname, bool missing_ok);
+extern Oid	get_namespace_oid(const char *nspname, bool missing_ok);
+
+extern Oid	LookupCreationNamespace(const char *nspname);
+extern void CheckSetNamespace(Oid oldNspOid, Oid nspOid, Oid classid,
+				  Oid objid);
+extern Oid	QualifiedNameGetCreationNamespace(List *names, char **objname_p);
+extern RangeVar *makeRangeVarFromNameList(List *names);
+extern char *NameListToString(List *names);
+extern char *NameListToQuotedString(List *names);
+
+extern bool isTempNamespace(Oid namespaceId);
+extern bool isTempToastNamespace(Oid namespaceId);
+extern bool isTempOrTempToastNamespace(Oid namespaceId);
+extern bool isAnyTempNamespace(Oid namespaceId);
+extern bool isOtherTempNamespace(Oid namespaceId);
+extern int	GetTempNamespaceBackendId(Oid namespaceId);
+extern Oid	GetTempToastNamespace(void);
+extern void ResetTempTableNamespace(void);
+
+extern OverrideSearchPath *GetOverrideSearchPath(MemoryContext context);
+extern OverrideSearchPath *CopyOverrideSearchPath(OverrideSearchPath *path);
+extern bool OverrideSearchPathMatchesCurrent(OverrideSearchPath *path);
+extern void PushOverrideSearchPath(OverrideSearchPath *newpath);
+extern void PopOverrideSearchPath(void);
+
+extern Oid	get_collation_oid(List *collname, bool missing_ok);
+extern Oid	get_conversion_oid(List *conname, bool missing_ok);
+extern Oid	FindDefaultConversionProc(int32 for_encoding, int32 to_encoding);
+
+/* initialization & transaction cleanup code */
+extern void InitializeSearchPath(void);
+extern void AtEOXact_Namespace(bool isCommit, bool parallel);
+extern void AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid,
+					  SubTransactionId parentSubid);
+
+/* stuff for search_path GUC variable */
+extern char *namespace_search_path;
+
+extern List *fetch_search_path(bool includeImplicit);
+extern int	fetch_search_path_array(Oid *sarray, int sarray_len);
+
+#endif   /* NAMESPACE_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/objectaccess.h b/foreign/libpg_query/src/postgres/include/catalog/objectaccess.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/objectaccess.h
@@ -0,0 +1,185 @@
+/*
+ * objectaccess.h
+ *
+ *		Object access hooks.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ */
+
+#ifndef OBJECTACCESS_H
+#define OBJECTACCESS_H
+
+/*
+ * Object access hooks are intended to be called just before or just after
+ * performing certain actions on a SQL object.  This is intended as
+ * infrastructure for security or logging plugins.
+ *
+ * OAT_POST_CREATE should be invoked just after the object is created.
+ * Typically, this is done after inserting the primary catalog records and
+ * associated dependencies.
+ *
+ * OAT_DROP should be invoked just before deletion of objects; typically
+ * deleteOneObject(). Its arguments are packed within ObjectAccessDrop.
+ *
+ * OAT_POST_ALTER should be invoked just after the object is altered,
+ * but before the command counter is incremented.  An extension using the
+ * hook can use a current MVCC snapshot to get the old version of the tuple,
+ * and can use SnapshotSelf to get the new version of the tuple.
+ *
+ * OAT_NAMESPACE_SEARCH should be invoked prior to object name lookup under
+ * a particular namespace. This event is equivalent to usage permission
+ * on a schema under the default access control mechanism.
+ *
+ * OAT_FUNCTION_EXECUTE should be invoked prior to function execution.
+ * This event is almost equivalent to execute permission on functions,
+ * except for the case when execute permission is checked during object
+ * creation or altering, because OAT_POST_CREATE or OAT_POST_ALTER are
+ * sufficient for extensions to track these kind of checks.
+ *
+ * Other types may be added in the future.
+ */
+typedef enum ObjectAccessType
+{
+	OAT_POST_CREATE,
+	OAT_DROP,
+	OAT_POST_ALTER,
+	OAT_NAMESPACE_SEARCH,
+	OAT_FUNCTION_EXECUTE
+} ObjectAccessType;
+
+/*
+ * Arguments of OAT_POST_CREATE event
+ */
+typedef struct
+{
+	/*
+	 * This flag informs extensions whether the context of this creation is
+	 * invoked by user's operations, or not. E.g, it shall be dealt as
+	 * internal stuff on toast tables or indexes due to type changes.
+	 */
+	bool		is_internal;
+} ObjectAccessPostCreate;
+
+/*
+ * Arguments of OAT_DROP event
+ */
+typedef struct
+{
+	/*
+	 * Flags to inform extensions the context of this deletion. Also see
+	 * PERFORM_DELETION_* in dependency.h
+	 */
+	int			dropflags;
+} ObjectAccessDrop;
+
+/*
+ * Arguments of OAT_POST_ALTER event
+ */
+typedef struct
+{
+	/*
+	 * This identifier is used when system catalog takes two IDs to identify a
+	 * particular tuple of the catalog. It is only used when the caller want
+	 * to identify an entry of pg_inherits, pg_db_role_setting or
+	 * pg_user_mapping. Elsewhere, InvalidOid should be set.
+	 */
+	Oid			auxiliary_id;
+
+	/*
+	 * If this flag is set, the user hasn't requested that the object be
+	 * altered, but we're doing it anyway for some internal reason.
+	 * Permissions-checking hooks may want to skip checks if, say, we're alter
+	 * the constraints of a temporary heap during CLUSTER.
+	 */
+	bool		is_internal;
+} ObjectAccessPostAlter;
+
+/*
+ * Arguments of OAT_NAMESPACE_SEARCH
+ */
+typedef struct
+{
+	/*
+	 * If true, hook should report an error when permission to search this
+	 * schema is denied.
+	 */
+	bool		ereport_on_violation;
+
+	/*
+	 * This is, in essence, an out parameter.  Core code should initialize
+	 * this to true, and any extension that wants to deny access should reset
+	 * it to false.  But an extension should be careful never to store a true
+	 * value here, so that in case there are multiple extensions access is
+	 * only allowed if all extensions agree.
+	 */
+	bool		result;
+} ObjectAccessNamespaceSearch;
+
+/* Plugin provides a hook function matching this signature. */
+typedef void (*object_access_hook_type) (ObjectAccessType access,
+													 Oid classId,
+													 Oid objectId,
+													 int subId,
+													 void *arg);
+
+/* Plugin sets this variable to a suitable hook function. */
+extern PGDLLIMPORT object_access_hook_type object_access_hook;
+
+/* Core code uses these functions to call the hook (see macros below). */
+extern void RunObjectPostCreateHook(Oid classId, Oid objectId, int subId,
+						bool is_internal);
+extern void RunObjectDropHook(Oid classId, Oid objectId, int subId,
+				  int dropflags);
+extern void RunObjectPostAlterHook(Oid classId, Oid objectId, int subId,
+					   Oid auxiliaryId, bool is_internal);
+extern bool RunNamespaceSearchHook(Oid objectId, bool ereport_on_volation);
+extern void RunFunctionExecuteHook(Oid objectId);
+
+/*
+ * The following macros are wrappers around the functions above; these should
+ * normally be used to invoke the hook in lieu of calling the above functions
+ * directly.
+ */
+
+#define InvokeObjectPostCreateHook(classId,objectId,subId)			\
+	InvokeObjectPostCreateHookArg((classId),(objectId),(subId),false)
+#define InvokeObjectPostCreateHookArg(classId,objectId,subId,is_internal) \
+	do {															\
+		if (object_access_hook)										\
+			RunObjectPostCreateHook((classId),(objectId),(subId),	\
+									(is_internal));					\
+	} while(0)
+
+#define InvokeObjectDropHook(classId,objectId,subId)				\
+	InvokeObjectDropHookArg((classId),(objectId),(subId),0)
+#define InvokeObjectDropHookArg(classId,objectId,subId,dropflags)	\
+	do {															\
+		if (object_access_hook)										\
+			RunObjectDropHook((classId),(objectId),(subId),			\
+							  (dropflags));							\
+	} while(0)
+
+#define InvokeObjectPostAlterHook(classId,objectId,subId)			\
+	InvokeObjectPostAlterHookArg((classId),(objectId),(subId),		\
+								 InvalidOid,false)
+#define InvokeObjectPostAlterHookArg(classId,objectId,subId,		\
+									 auxiliaryId,is_internal)		\
+	do {															\
+		if (object_access_hook)										\
+			RunObjectPostAlterHook((classId),(objectId),(subId),	\
+								   (auxiliaryId),(is_internal));	\
+	} while(0)
+
+#define InvokeNamespaceSearchHook(objectId, ereport_on_violation)	\
+	(!object_access_hook											\
+	 ? true															\
+	 : RunNamespaceSearchHook((objectId), (ereport_on_violation)))
+
+#define InvokeFunctionExecuteHook(objectId)		\
+	do {										\
+		if (object_access_hook)					\
+			RunFunctionExecuteHook(objectId);	\
+	} while(0)
+
+#endif   /* OBJECTACCESS_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/objectaddress.h b/foreign/libpg_query/src/postgres/include/catalog/objectaddress.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/objectaddress.h
@@ -0,0 +1,77 @@
+/*-------------------------------------------------------------------------
+ *
+ * objectaddress.h
+ *	  functions for working with object addresses
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/objectaddress.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef OBJECTADDRESS_H
+#define OBJECTADDRESS_H
+
+#include "nodes/pg_list.h"
+#include "storage/lock.h"
+#include "utils/acl.h"
+#include "utils/relcache.h"
+
+/*
+ * An ObjectAddress represents a database object of any type.
+ */
+typedef struct ObjectAddress
+{
+	Oid			classId;		/* Class Id from pg_class */
+	Oid			objectId;		/* OID of the object */
+	int32		objectSubId;	/* Subitem within object (eg column), or 0 */
+} ObjectAddress;
+
+extern const ObjectAddress InvalidObjectAddress;
+
+#define ObjectAddressSubSet(addr, class_id, object_id, object_sub_id) \
+	do { \
+		(addr).classId = (class_id); \
+		(addr).objectId = (object_id); \
+		(addr).objectSubId = (object_sub_id); \
+	} while (0)
+
+#define ObjectAddressSet(addr, class_id, object_id) \
+	ObjectAddressSubSet(addr, class_id, object_id, 0)
+
+extern ObjectAddress get_object_address(ObjectType objtype, List *objname,
+				   List *objargs, Relation *relp,
+				   LOCKMODE lockmode, bool missing_ok);
+
+extern void check_object_ownership(Oid roleid,
+					   ObjectType objtype, ObjectAddress address,
+					   List *objname, List *objargs, Relation relation);
+
+extern Oid	get_object_namespace(const ObjectAddress *address);
+
+extern bool is_objectclass_supported(Oid class_id);
+extern Oid	get_object_oid_index(Oid class_id);
+extern int	get_object_catcache_oid(Oid class_id);
+extern int	get_object_catcache_name(Oid class_id);
+extern AttrNumber get_object_attnum_name(Oid class_id);
+extern AttrNumber get_object_attnum_namespace(Oid class_id);
+extern AttrNumber get_object_attnum_owner(Oid class_id);
+extern AttrNumber get_object_attnum_acl(Oid class_id);
+extern AclObjectKind get_object_aclkind(Oid class_id);
+extern bool get_object_namensp_unique(Oid class_id);
+
+extern HeapTuple get_catalog_object_by_oid(Relation catalog,
+						  Oid objectId);
+
+extern char *getObjectDescription(const ObjectAddress *object);
+extern char *getObjectDescriptionOids(Oid classid, Oid objid);
+
+extern int	read_objtype_from_string(const char *objtype);
+extern char *getObjectTypeDescription(const ObjectAddress *object);
+extern char *getObjectIdentity(const ObjectAddress *address);
+extern char *getObjectIdentityParts(const ObjectAddress *address,
+					   List **objname, List **objargs);
+extern ArrayType *strlist_to_textarray(List *list);
+
+#endif   /* OBJECTADDRESS_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_aggregate.h b/foreign/libpg_query/src/postgres/include/catalog/pg_aggregate.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_aggregate.h
@@ -0,0 +1,338 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_aggregate.h
+ *	  definition of the system "aggregate" relation (pg_aggregate)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_aggregate.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_AGGREGATE_H
+#define PG_AGGREGATE_H
+
+#include "catalog/genbki.h"
+#include "catalog/objectaddress.h"
+#include "nodes/pg_list.h"
+
+/* ----------------------------------------------------------------
+ *		pg_aggregate definition.
+ *
+ *		cpp turns this into typedef struct FormData_pg_aggregate
+ *
+ *	aggfnoid			pg_proc OID of the aggregate itself
+ *	aggkind				aggregate kind, see AGGKIND_ categories below
+ *	aggnumdirectargs	number of arguments that are "direct" arguments
+ *	aggtransfn			transition function
+ *	aggfinalfn			final function (0 if none)
+ *	aggmtransfn			forward function for moving-aggregate mode (0 if none)
+ *	aggminvtransfn		inverse function for moving-aggregate mode (0 if none)
+ *	aggmfinalfn			final function for moving-aggregate mode (0 if none)
+ *	aggfinalextra		true to pass extra dummy arguments to aggfinalfn
+ *	aggmfinalextra		true to pass extra dummy arguments to aggmfinalfn
+ *	aggsortop			associated sort operator (0 if none)
+ *	aggtranstype		type of aggregate's transition (state) data
+ *	aggtransspace		estimated size of state data (0 for default estimate)
+ *	aggmtranstype		type of moving-aggregate state data (0 if none)
+ *	aggmtransspace		estimated size of moving-agg state (0 for default est)
+ *	agginitval			initial value for transition state (can be NULL)
+ *	aggminitval			initial value for moving-agg state (can be NULL)
+ * ----------------------------------------------------------------
+ */
+#define AggregateRelationId  2600
+
+CATALOG(pg_aggregate,2600) BKI_WITHOUT_OIDS
+{
+	regproc		aggfnoid;
+	char		aggkind;
+	int16		aggnumdirectargs;
+	regproc		aggtransfn;
+	regproc		aggfinalfn;
+	regproc		aggmtransfn;
+	regproc		aggminvtransfn;
+	regproc		aggmfinalfn;
+	bool		aggfinalextra;
+	bool		aggmfinalextra;
+	Oid			aggsortop;
+	Oid			aggtranstype;
+	int32		aggtransspace;
+	Oid			aggmtranstype;
+	int32		aggmtransspace;
+
+#ifdef CATALOG_VARLEN			/* variable-length fields start here */
+	text		agginitval;
+	text		aggminitval;
+#endif
+} FormData_pg_aggregate;
+
+/* ----------------
+ *		Form_pg_aggregate corresponds to a pointer to a tuple with
+ *		the format of pg_aggregate relation.
+ * ----------------
+ */
+typedef FormData_pg_aggregate *Form_pg_aggregate;
+
+/* ----------------
+ *		compiler constants for pg_aggregate
+ * ----------------
+ */
+
+#define Natts_pg_aggregate					17
+#define Anum_pg_aggregate_aggfnoid			1
+#define Anum_pg_aggregate_aggkind			2
+#define Anum_pg_aggregate_aggnumdirectargs	3
+#define Anum_pg_aggregate_aggtransfn		4
+#define Anum_pg_aggregate_aggfinalfn		5
+#define Anum_pg_aggregate_aggmtransfn		6
+#define Anum_pg_aggregate_aggminvtransfn	7
+#define Anum_pg_aggregate_aggmfinalfn		8
+#define Anum_pg_aggregate_aggfinalextra		9
+#define Anum_pg_aggregate_aggmfinalextra	10
+#define Anum_pg_aggregate_aggsortop			11
+#define Anum_pg_aggregate_aggtranstype		12
+#define Anum_pg_aggregate_aggtransspace		13
+#define Anum_pg_aggregate_aggmtranstype		14
+#define Anum_pg_aggregate_aggmtransspace	15
+#define Anum_pg_aggregate_agginitval		16
+#define Anum_pg_aggregate_aggminitval		17
+
+/*
+ * Symbolic values for aggkind column.  We distinguish normal aggregates
+ * from ordered-set aggregates (which have two sets of arguments, namely
+ * direct and aggregated arguments) and from hypothetical-set aggregates
+ * (which are a subclass of ordered-set aggregates in which the last
+ * direct arguments have to match up in number and datatypes with the
+ * aggregated arguments).
+ */
+#define AGGKIND_NORMAL			'n'
+#define AGGKIND_ORDERED_SET		'o'
+#define AGGKIND_HYPOTHETICAL	'h'
+
+/* Use this macro to test for "ordered-set agg including hypothetical case" */
+#define AGGKIND_IS_ORDERED_SET(kind)  ((kind) != AGGKIND_NORMAL)
+
+
+/* ----------------
+ * initial contents of pg_aggregate
+ * ---------------
+ */
+
+/* avg */
+DATA(insert ( 2100	n 0 int8_avg_accum	numeric_poly_avg		int8_avg_accum	int8_avg_accum_inv	numeric_poly_avg	f f 0	2281	48	2281	48	_null_ _null_ ));
+DATA(insert ( 2101	n 0 int4_avg_accum	int8_avg		int4_avg_accum	int4_avg_accum_inv	int8_avg					f f 0	1016	0	1016	0	"{0,0}" "{0,0}" ));
+DATA(insert ( 2102	n 0 int2_avg_accum	int8_avg		int2_avg_accum	int2_avg_accum_inv	int8_avg					f f 0	1016	0	1016	0	"{0,0}" "{0,0}" ));
+DATA(insert ( 2103	n 0 numeric_avg_accum numeric_avg	numeric_avg_accum numeric_accum_inv numeric_avg					f f 0	2281	128 2281	128 _null_ _null_ ));
+DATA(insert ( 2104	n 0 float4_accum	float8_avg		-				-				-								f f 0	1022	0	0		0	"{0,0,0}" _null_ ));
+DATA(insert ( 2105	n 0 float8_accum	float8_avg		-				-				-								f f 0	1022	0	0		0	"{0,0,0}" _null_ ));
+DATA(insert ( 2106	n 0 interval_accum	interval_avg	interval_accum	interval_accum_inv interval_avg					f f 0	1187	0	1187	0	"{0 second,0 second}" "{0 second,0 second}" ));
+
+/* sum */
+DATA(insert ( 2107	n 0 int8_avg_accum	numeric_poly_sum		int8_avg_accum	int8_avg_accum_inv numeric_poly_sum f f 0	2281	48	2281	48	_null_ _null_ ));
+DATA(insert ( 2108	n 0 int4_sum		-				int4_avg_accum	int4_avg_accum_inv int2int4_sum					f f 0	20		0	1016	0	_null_ "{0,0}" ));
+DATA(insert ( 2109	n 0 int2_sum		-				int2_avg_accum	int2_avg_accum_inv int2int4_sum					f f 0	20		0	1016	0	_null_ "{0,0}" ));
+DATA(insert ( 2110	n 0 float4pl		-				-				-				-								f f 0	700		0	0		0	_null_ _null_ ));
+DATA(insert ( 2111	n 0 float8pl		-				-				-				-								f f 0	701		0	0		0	_null_ _null_ ));
+DATA(insert ( 2112	n 0 cash_pl			-				cash_pl			cash_mi			-								f f 0	790		0	790		0	_null_ _null_ ));
+DATA(insert ( 2113	n 0 interval_pl		-				interval_pl		interval_mi		-								f f 0	1186	0	1186	0	_null_ _null_ ));
+DATA(insert ( 2114	n 0 numeric_avg_accum	numeric_sum numeric_avg_accum numeric_accum_inv numeric_sum					f f 0	2281	128 2281	128 _null_ _null_ ));
+
+/* max */
+DATA(insert ( 2115	n 0 int8larger		-				-				-				-				f f 413		20		0	0		0	_null_ _null_ ));
+DATA(insert ( 2116	n 0 int4larger		-				-				-				-				f f 521		23		0	0		0	_null_ _null_ ));
+DATA(insert ( 2117	n 0 int2larger		-				-				-				-				f f 520		21		0	0		0	_null_ _null_ ));
+DATA(insert ( 2118	n 0 oidlarger		-				-				-				-				f f 610		26		0	0		0	_null_ _null_ ));
+DATA(insert ( 2119	n 0 float4larger	-				-				-				-				f f 623		700		0	0		0	_null_ _null_ ));
+DATA(insert ( 2120	n 0 float8larger	-				-				-				-				f f 674		701		0	0		0	_null_ _null_ ));
+DATA(insert ( 2121	n 0 int4larger		-				-				-				-				f f 563		702		0	0		0	_null_ _null_ ));
+DATA(insert ( 2122	n 0 date_larger		-				-				-				-				f f 1097	1082	0	0		0	_null_ _null_ ));
+DATA(insert ( 2123	n 0 time_larger		-				-				-				-				f f 1112	1083	0	0		0	_null_ _null_ ));
+DATA(insert ( 2124	n 0 timetz_larger	-				-				-				-				f f 1554	1266	0	0		0	_null_ _null_ ));
+DATA(insert ( 2125	n 0 cashlarger		-				-				-				-				f f 903		790		0	0		0	_null_ _null_ ));
+DATA(insert ( 2126	n 0 timestamp_larger	-			-				-				-				f f 2064	1114	0	0		0	_null_ _null_ ));
+DATA(insert ( 2127	n 0 timestamptz_larger	-			-				-				-				f f 1324	1184	0	0		0	_null_ _null_ ));
+DATA(insert ( 2128	n 0 interval_larger -				-				-				-				f f 1334	1186	0	0		0	_null_ _null_ ));
+DATA(insert ( 2129	n 0 text_larger		-				-				-				-				f f 666		25		0	0		0	_null_ _null_ ));
+DATA(insert ( 2130	n 0 numeric_larger	-				-				-				-				f f 1756	1700	0	0		0	_null_ _null_ ));
+DATA(insert ( 2050	n 0 array_larger	-				-				-				-				f f 1073	2277	0	0		0	_null_ _null_ ));
+DATA(insert ( 2244	n 0 bpchar_larger	-				-				-				-				f f 1060	1042	0	0		0	_null_ _null_ ));
+DATA(insert ( 2797	n 0 tidlarger		-				-				-				-				f f 2800	27		0	0		0	_null_ _null_ ));
+DATA(insert ( 3526	n 0 enum_larger		-				-				-				-				f f 3519	3500	0	0		0	_null_ _null_ ));
+DATA(insert ( 3564	n 0 network_larger	-				-				-				-				f f 1205	869		0	0		0	_null_ _null_ ));
+
+/* min */
+DATA(insert ( 2131	n 0 int8smaller		-				-				-				-				f f 412		20		0	0		0	_null_ _null_ ));
+DATA(insert ( 2132	n 0 int4smaller		-				-				-				-				f f 97		23		0	0		0	_null_ _null_ ));
+DATA(insert ( 2133	n 0 int2smaller		-				-				-				-				f f 95		21		0	0		0	_null_ _null_ ));
+DATA(insert ( 2134	n 0 oidsmaller		-				-				-				-				f f 609		26		0	0		0	_null_ _null_ ));
+DATA(insert ( 2135	n 0 float4smaller	-				-				-				-				f f 622		700		0	0		0	_null_ _null_ ));
+DATA(insert ( 2136	n 0 float8smaller	-				-				-				-				f f 672		701		0	0		0	_null_ _null_ ));
+DATA(insert ( 2137	n 0 int4smaller		-				-				-				-				f f 562		702		0	0		0	_null_ _null_ ));
+DATA(insert ( 2138	n 0 date_smaller	-				-				-				-				f f 1095	1082	0	0		0	_null_ _null_ ));
+DATA(insert ( 2139	n 0 time_smaller	-				-				-				-				f f 1110	1083	0	0		0	_null_ _null_ ));
+DATA(insert ( 2140	n 0 timetz_smaller	-				-				-				-				f f 1552	1266	0	0		0	_null_ _null_ ));
+DATA(insert ( 2141	n 0 cashsmaller		-				-				-				-				f f 902		790		0	0		0	_null_ _null_ ));
+DATA(insert ( 2142	n 0 timestamp_smaller	-			-				-				-				f f 2062	1114	0	0		0	_null_ _null_ ));
+DATA(insert ( 2143	n 0 timestamptz_smaller -			-				-				-				f f 1322	1184	0	0		0	_null_ _null_ ));
+DATA(insert ( 2144	n 0 interval_smaller	-			-				-				-				f f 1332	1186	0	0		0	_null_ _null_ ));
+DATA(insert ( 2145	n 0 text_smaller	-				-				-				-				f f 664		25		0	0		0	_null_ _null_ ));
+DATA(insert ( 2146	n 0 numeric_smaller -				-				-				-				f f 1754	1700	0	0		0	_null_ _null_ ));
+DATA(insert ( 2051	n 0 array_smaller	-				-				-				-				f f 1072	2277	0	0		0	_null_ _null_ ));
+DATA(insert ( 2245	n 0 bpchar_smaller	-				-				-				-				f f 1058	1042	0	0		0	_null_ _null_ ));
+DATA(insert ( 2798	n 0 tidsmaller		-				-				-				-				f f 2799	27		0	0		0	_null_ _null_ ));
+DATA(insert ( 3527	n 0 enum_smaller	-				-				-				-				f f 3518	3500	0	0		0	_null_ _null_ ));
+DATA(insert ( 3565	n 0 network_smaller -				-				-				-				f f 1203	869		0	0		0	_null_ _null_ ));
+
+/* count */
+DATA(insert ( 2147	n 0 int8inc_any		-				int8inc_any		int8dec_any		-				f f 0		20		0	20		0	"0" "0" ));
+DATA(insert ( 2803	n 0 int8inc			-				int8inc			int8dec			-				f f 0		20		0	20		0	"0" "0" ));
+
+/* var_pop */
+DATA(insert ( 2718	n 0 int8_accum	numeric_var_pop		int8_accum		int8_accum_inv	numeric_var_pop					f f 0	2281	128 2281	128 _null_ _null_ ));
+DATA(insert ( 2719	n 0 int4_accum	numeric_poly_var_pop		int4_accum		int4_accum_inv	numeric_poly_var_pop	f f 0	2281	48	2281	48	_null_ _null_ ));
+DATA(insert ( 2720	n 0 int2_accum	numeric_poly_var_pop		int2_accum		int2_accum_inv	numeric_poly_var_pop	f f 0	2281	48	2281	48	_null_ _null_ ));
+DATA(insert ( 2721	n 0 float4_accum	float8_var_pop	-				-				-								f f 0	1022	0	0		0	"{0,0,0}" _null_ ));
+DATA(insert ( 2722	n 0 float8_accum	float8_var_pop	-				-				-								f f 0	1022	0	0		0	"{0,0,0}" _null_ ));
+DATA(insert ( 2723	n 0 numeric_accum	numeric_var_pop numeric_accum numeric_accum_inv numeric_var_pop					f f 0	2281	128 2281	128 _null_ _null_ ));
+
+/* var_samp */
+DATA(insert ( 2641	n 0 int8_accum	numeric_var_samp	int8_accum		int8_accum_inv	numeric_var_samp				f f 0	2281	128 2281	128 _null_ _null_ ));
+DATA(insert ( 2642	n 0 int4_accum	numeric_poly_var_samp		int4_accum		int4_accum_inv	numeric_poly_var_samp	f f 0	2281	48	2281	48	_null_ _null_ ));
+DATA(insert ( 2643	n 0 int2_accum	numeric_poly_var_samp		int2_accum		int2_accum_inv	numeric_poly_var_samp	f f 0	2281	48	2281	48	_null_ _null_ ));
+DATA(insert ( 2644	n 0 float4_accum	float8_var_samp -				-				-								f f 0	1022	0	0		0	"{0,0,0}" _null_ ));
+DATA(insert ( 2645	n 0 float8_accum	float8_var_samp -				-				-								f f 0	1022	0	0		0	"{0,0,0}" _null_ ));
+DATA(insert ( 2646	n 0 numeric_accum	numeric_var_samp numeric_accum numeric_accum_inv numeric_var_samp				f f 0	2281	128 2281	128 _null_ _null_ ));
+
+/* variance: historical Postgres syntax for var_samp */
+DATA(insert ( 2148	n 0 int8_accum	numeric_var_samp	int8_accum		int8_accum_inv	numeric_var_samp				f f 0	2281	128 2281	128 _null_ _null_ ));
+DATA(insert ( 2149	n 0 int4_accum	numeric_poly_var_samp		int4_accum		int4_accum_inv	numeric_poly_var_samp	f f 0	2281	48	2281	48	_null_ _null_ ));
+DATA(insert ( 2150	n 0 int2_accum	numeric_poly_var_samp		int2_accum		int2_accum_inv	numeric_poly_var_samp	f f 0	2281	48	2281	48	_null_ _null_ ));
+DATA(insert ( 2151	n 0 float4_accum	float8_var_samp -				-				-								f f 0	1022	0	0		0	"{0,0,0}" _null_ ));
+DATA(insert ( 2152	n 0 float8_accum	float8_var_samp -				-				-								f f 0	1022	0	0		0	"{0,0,0}" _null_ ));
+DATA(insert ( 2153	n 0 numeric_accum	numeric_var_samp numeric_accum numeric_accum_inv numeric_var_samp				f f 0	2281	128 2281	128 _null_ _null_ ));
+
+/* stddev_pop */
+DATA(insert ( 2724	n 0 int8_accum	numeric_stddev_pop	int8_accum	int8_accum_inv	numeric_stddev_pop					f f 0	2281	128 2281	128 _null_ _null_ ));
+DATA(insert ( 2725	n 0 int4_accum	numeric_poly_stddev_pop int4_accum	int4_accum_inv	numeric_poly_stddev_pop f f 0	2281	48	2281	48	_null_ _null_ ));
+DATA(insert ( 2726	n 0 int2_accum	numeric_poly_stddev_pop int2_accum	int2_accum_inv	numeric_poly_stddev_pop f f 0	2281	48	2281	48	_null_ _null_ ));
+DATA(insert ( 2727	n 0 float4_accum	float8_stddev_pop	-				-				-							f f 0	1022	0	0		0	"{0,0,0}" _null_ ));
+DATA(insert ( 2728	n 0 float8_accum	float8_stddev_pop	-				-				-							f f 0	1022	0	0		0	"{0,0,0}" _null_ ));
+DATA(insert ( 2729	n 0 numeric_accum	numeric_stddev_pop numeric_accum numeric_accum_inv numeric_stddev_pop			f f 0	2281	128 2281	128 _null_ _null_ ));
+
+/* stddev_samp */
+DATA(insert ( 2712	n 0 int8_accum	numeric_stddev_samp		int8_accum	int8_accum_inv	numeric_stddev_samp				f f 0	2281	128 2281	128 _null_ _null_ ));
+DATA(insert ( 2713	n 0 int4_accum	numeric_poly_stddev_samp	int4_accum	int4_accum_inv	numeric_poly_stddev_samp	f f 0	2281	48	2281	48	_null_ _null_ ));
+DATA(insert ( 2714	n 0 int2_accum	numeric_poly_stddev_samp	int2_accum	int2_accum_inv	numeric_poly_stddev_samp	f f 0	2281	48	2281	48	_null_ _null_ ));
+DATA(insert ( 2715	n 0 float4_accum	float8_stddev_samp	-				-				-							f f 0	1022	0	0		0	"{0,0,0}" _null_ ));
+DATA(insert ( 2716	n 0 float8_accum	float8_stddev_samp	-				-				-							f f 0	1022	0	0		0	"{0,0,0}" _null_ ));
+DATA(insert ( 2717	n 0 numeric_accum	numeric_stddev_samp numeric_accum numeric_accum_inv numeric_stddev_samp			f f 0	2281	128 2281	128 _null_ _null_ ));
+
+/* stddev: historical Postgres syntax for stddev_samp */
+DATA(insert ( 2154	n 0 int8_accum	numeric_stddev_samp		int8_accum	int8_accum_inv	numeric_stddev_samp				f f 0	2281	128 2281	128 _null_ _null_ ));
+DATA(insert ( 2155	n 0 int4_accum	numeric_poly_stddev_samp	int4_accum	int4_accum_inv	numeric_poly_stddev_samp	f f 0	2281	48	2281	48	_null_ _null_ ));
+DATA(insert ( 2156	n 0 int2_accum	numeric_poly_stddev_samp	int2_accum	int2_accum_inv	numeric_poly_stddev_samp	f f 0	2281	48	2281	48	_null_ _null_ ));
+DATA(insert ( 2157	n 0 float4_accum	float8_stddev_samp	-				-				-							f f 0	1022	0	0		0	"{0,0,0}" _null_ ));
+DATA(insert ( 2158	n 0 float8_accum	float8_stddev_samp	-				-				-							f f 0	1022	0	0		0	"{0,0,0}" _null_ ));
+DATA(insert ( 2159	n 0 numeric_accum	numeric_stddev_samp numeric_accum numeric_accum_inv numeric_stddev_samp			f f 0	2281	128 2281	128 _null_ _null_ ));
+
+/* SQL2003 binary regression aggregates */
+DATA(insert ( 2818	n 0 int8inc_float8_float8	-					-				-				-				f f 0	20		0	0		0	"0" _null_ ));
+DATA(insert ( 2819	n 0 float8_regr_accum	float8_regr_sxx			-				-				-				f f 0	1022	0	0		0	"{0,0,0,0,0,0}" _null_ ));
+DATA(insert ( 2820	n 0 float8_regr_accum	float8_regr_syy			-				-				-				f f 0	1022	0	0		0	"{0,0,0,0,0,0}" _null_ ));
+DATA(insert ( 2821	n 0 float8_regr_accum	float8_regr_sxy			-				-				-				f f 0	1022	0	0		0	"{0,0,0,0,0,0}" _null_ ));
+DATA(insert ( 2822	n 0 float8_regr_accum	float8_regr_avgx		-				-				-				f f 0	1022	0	0		0	"{0,0,0,0,0,0}" _null_ ));
+DATA(insert ( 2823	n 0 float8_regr_accum	float8_regr_avgy		-				-				-				f f 0	1022	0	0		0	"{0,0,0,0,0,0}" _null_ ));
+DATA(insert ( 2824	n 0 float8_regr_accum	float8_regr_r2			-				-				-				f f 0	1022	0	0		0	"{0,0,0,0,0,0}" _null_ ));
+DATA(insert ( 2825	n 0 float8_regr_accum	float8_regr_slope		-				-				-				f f 0	1022	0	0		0	"{0,0,0,0,0,0}" _null_ ));
+DATA(insert ( 2826	n 0 float8_regr_accum	float8_regr_intercept	-				-				-				f f 0	1022	0	0		0	"{0,0,0,0,0,0}" _null_ ));
+DATA(insert ( 2827	n 0 float8_regr_accum	float8_covar_pop		-				-				-				f f 0	1022	0	0		0	"{0,0,0,0,0,0}" _null_ ));
+DATA(insert ( 2828	n 0 float8_regr_accum	float8_covar_samp		-				-				-				f f 0	1022	0	0		0	"{0,0,0,0,0,0}" _null_ ));
+DATA(insert ( 2829	n 0 float8_regr_accum	float8_corr				-				-				-				f f 0	1022	0	0		0	"{0,0,0,0,0,0}" _null_ ));
+
+/* boolean-and and boolean-or */
+DATA(insert ( 2517	n 0 booland_statefunc	-			bool_accum		bool_accum_inv	bool_alltrue	f f 58	16		0	2281	16	_null_ _null_ ));
+DATA(insert ( 2518	n 0 boolor_statefunc	-			bool_accum		bool_accum_inv	bool_anytrue	f f 59	16		0	2281	16	_null_ _null_ ));
+DATA(insert ( 2519	n 0 booland_statefunc	-			bool_accum		bool_accum_inv	bool_alltrue	f f 58	16		0	2281	16	_null_ _null_ ));
+
+/* bitwise integer */
+DATA(insert ( 2236	n 0 int2and		-					-				-				-				f f 0	21		0	0		0	_null_ _null_ ));
+DATA(insert ( 2237	n 0 int2or		-					-				-				-				f f 0	21		0	0		0	_null_ _null_ ));
+DATA(insert ( 2238	n 0 int4and		-					-				-				-				f f 0	23		0	0		0	_null_ _null_ ));
+DATA(insert ( 2239	n 0 int4or		-					-				-				-				f f 0	23		0	0		0	_null_ _null_ ));
+DATA(insert ( 2240	n 0 int8and		-					-				-				-				f f 0	20		0	0		0	_null_ _null_ ));
+DATA(insert ( 2241	n 0 int8or		-					-				-				-				f f 0	20		0	0		0	_null_ _null_ ));
+DATA(insert ( 2242	n 0 bitand		-					-				-				-				f f 0	1560	0	0		0	_null_ _null_ ));
+DATA(insert ( 2243	n 0 bitor		-					-				-				-				f f 0	1560	0	0		0	_null_ _null_ ));
+
+/* xml */
+DATA(insert ( 2901	n 0 xmlconcat2	-					-				-				-				f f 0	142		0	0		0	_null_ _null_ ));
+
+/* array */
+DATA(insert ( 2335	n 0 array_agg_transfn	array_agg_finalfn	-				-				-				t f 0	2281	0	0		0	_null_ _null_ ));
+DATA(insert ( 4053	n 0 array_agg_array_transfn array_agg_array_finalfn -		-				-				t f 0	2281	0	0		0	_null_ _null_ ));
+
+/* text */
+DATA(insert ( 3538	n 0 string_agg_transfn	string_agg_finalfn	-				-				-				f f 0	2281	0	0		0	_null_ _null_ ));
+
+/* bytea */
+DATA(insert ( 3545	n 0 bytea_string_agg_transfn	bytea_string_agg_finalfn	-				-				-		f f 0	2281	0	0		0	_null_ _null_ ));
+
+/* json */
+DATA(insert ( 3175	n 0 json_agg_transfn	json_agg_finalfn			-				-				-				f f 0	2281	0	0		0	_null_ _null_ ));
+DATA(insert ( 3197	n 0 json_object_agg_transfn json_object_agg_finalfn -				-				-				f f 0	2281	0	0		0	_null_ _null_ ));
+
+/* jsonb */
+DATA(insert ( 3267	n 0 jsonb_agg_transfn	jsonb_agg_finalfn			-				-				-				f f 0	2281	0	0		0	_null_ _null_ ));
+DATA(insert ( 3270	n 0 jsonb_object_agg_transfn jsonb_object_agg_finalfn -				-				-				f f 0	2281	0	0		0	_null_ _null_ ));
+
+/* ordered-set and hypothetical-set aggregates */
+DATA(insert ( 3972	o 1 ordered_set_transition			percentile_disc_final					-		-		-		t f 0	2281	0	0		0	_null_ _null_ ));
+DATA(insert ( 3974	o 1 ordered_set_transition			percentile_cont_float8_final			-		-		-		f f 0	2281	0	0		0	_null_ _null_ ));
+DATA(insert ( 3976	o 1 ordered_set_transition			percentile_cont_interval_final			-		-		-		f f 0	2281	0	0		0	_null_ _null_ ));
+DATA(insert ( 3978	o 1 ordered_set_transition			percentile_disc_multi_final				-		-		-		t f 0	2281	0	0		0	_null_ _null_ ));
+DATA(insert ( 3980	o 1 ordered_set_transition			percentile_cont_float8_multi_final		-		-		-		f f 0	2281	0	0		0	_null_ _null_ ));
+DATA(insert ( 3982	o 1 ordered_set_transition			percentile_cont_interval_multi_final	-		-		-		f f 0	2281	0	0		0	_null_ _null_ ));
+DATA(insert ( 3984	o 0 ordered_set_transition			mode_final								-		-		-		t f 0	2281	0	0		0	_null_ _null_ ));
+DATA(insert ( 3986	h 1 ordered_set_transition_multi	rank_final								-		-		-		t f 0	2281	0	0		0	_null_ _null_ ));
+DATA(insert ( 3988	h 1 ordered_set_transition_multi	percent_rank_final						-		-		-		t f 0	2281	0	0		0	_null_ _null_ ));
+DATA(insert ( 3990	h 1 ordered_set_transition_multi	cume_dist_final							-		-		-		t f 0	2281	0	0		0	_null_ _null_ ));
+DATA(insert ( 3992	h 1 ordered_set_transition_multi	dense_rank_final						-		-		-		t f 0	2281	0	0		0	_null_ _null_ ));
+
+
+/*
+ * prototypes for functions in pg_aggregate.c
+ */
+extern ObjectAddress AggregateCreate(const char *aggName,
+				Oid aggNamespace,
+				char aggKind,
+				int numArgs,
+				int numDirectArgs,
+				oidvector *parameterTypes,
+				Datum allParameterTypes,
+				Datum parameterModes,
+				Datum parameterNames,
+				List *parameterDefaults,
+				Oid variadicArgType,
+				List *aggtransfnName,
+				List *aggfinalfnName,
+				List *aggmtransfnName,
+				List *aggminvtransfnName,
+				List *aggmfinalfnName,
+				bool finalfnExtraArgs,
+				bool mfinalfnExtraArgs,
+				List *aggsortopName,
+				Oid aggTransType,
+				int32 aggTransSpace,
+				Oid aggmTransType,
+				int32 aggmTransSpace,
+				const char *agginitval,
+				const char *aggminitval);
+
+#endif   /* PG_AGGREGATE_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_am.h b/foreign/libpg_query/src/postgres/include/catalog/pg_am.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_am.h
@@ -0,0 +1,139 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_am.h
+ *	  definition of the system "access method" relation (pg_am)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_am.h
+ *
+ * NOTES
+ *		the genbki.pl script reads this file and generates .bki
+ *		information from the DATA() statements.
+ *
+ *		XXX do NOT break up DATA() statements into multiple lines!
+ *			the scripts are not as smart as you might think...
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_AM_H
+#define PG_AM_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_am definition.  cpp turns this into
+ *		typedef struct FormData_pg_am
+ * ----------------
+ */
+#define AccessMethodRelationId	2601
+
+CATALOG(pg_am,2601)
+{
+	NameData	amname;			/* access method name */
+	int16		amstrategies;	/* total number of strategies (operators) by
+								 * which we can traverse/search this AM. Zero
+								 * if AM does not have a fixed set of strategy
+								 * assignments. */
+	int16		amsupport;		/* total number of support functions that this
+								 * AM uses */
+	bool		amcanorder;		/* does AM support order by column value? */
+	bool		amcanorderbyop; /* does AM support order by operator result? */
+	bool		amcanbackward;	/* does AM support backward scan? */
+	bool		amcanunique;	/* does AM support UNIQUE indexes? */
+	bool		amcanmulticol;	/* does AM support multi-column indexes? */
+	bool		amoptionalkey;	/* can query omit key for the first column? */
+	bool		amsearcharray;	/* can AM handle ScalarArrayOpExpr quals? */
+	bool		amsearchnulls;	/* can AM search for NULL/NOT NULL entries? */
+	bool		amstorage;		/* can storage type differ from column type? */
+	bool		amclusterable;	/* does AM support cluster command? */
+	bool		ampredlocks;	/* does AM handle predicate locks? */
+	Oid			amkeytype;		/* type of data in index, or InvalidOid */
+	regproc		aminsert;		/* "insert this tuple" function */
+	regproc		ambeginscan;	/* "prepare for index scan" function */
+	regproc		amgettuple;		/* "next valid tuple" function, or 0 */
+	regproc		amgetbitmap;	/* "fetch all valid tuples" function, or 0 */
+	regproc		amrescan;		/* "(re)start index scan" function */
+	regproc		amendscan;		/* "end index scan" function */
+	regproc		ammarkpos;		/* "mark current scan position" function */
+	regproc		amrestrpos;		/* "restore marked scan position" function */
+	regproc		ambuild;		/* "build new index" function */
+	regproc		ambuildempty;	/* "build empty index" function */
+	regproc		ambulkdelete;	/* bulk-delete function */
+	regproc		amvacuumcleanup;	/* post-VACUUM cleanup function */
+	regproc		amcanreturn;	/* can indexscan return IndexTuples? */
+	regproc		amcostestimate; /* estimate cost of an indexscan */
+	regproc		amoptions;		/* parse AM-specific parameters */
+} FormData_pg_am;
+
+/* ----------------
+ *		Form_pg_am corresponds to a pointer to a tuple with
+ *		the format of pg_am relation.
+ * ----------------
+ */
+typedef FormData_pg_am *Form_pg_am;
+
+/* ----------------
+ *		compiler constants for pg_am
+ * ----------------
+ */
+#define Natts_pg_am						30
+#define Anum_pg_am_amname				1
+#define Anum_pg_am_amstrategies			2
+#define Anum_pg_am_amsupport			3
+#define Anum_pg_am_amcanorder			4
+#define Anum_pg_am_amcanorderbyop		5
+#define Anum_pg_am_amcanbackward		6
+#define Anum_pg_am_amcanunique			7
+#define Anum_pg_am_amcanmulticol		8
+#define Anum_pg_am_amoptionalkey		9
+#define Anum_pg_am_amsearcharray		10
+#define Anum_pg_am_amsearchnulls		11
+#define Anum_pg_am_amstorage			12
+#define Anum_pg_am_amclusterable		13
+#define Anum_pg_am_ampredlocks			14
+#define Anum_pg_am_amkeytype			15
+#define Anum_pg_am_aminsert				16
+#define Anum_pg_am_ambeginscan			17
+#define Anum_pg_am_amgettuple			18
+#define Anum_pg_am_amgetbitmap			19
+#define Anum_pg_am_amrescan				20
+#define Anum_pg_am_amendscan			21
+#define Anum_pg_am_ammarkpos			22
+#define Anum_pg_am_amrestrpos			23
+#define Anum_pg_am_ambuild				24
+#define Anum_pg_am_ambuildempty			25
+#define Anum_pg_am_ambulkdelete			26
+#define Anum_pg_am_amvacuumcleanup		27
+#define Anum_pg_am_amcanreturn			28
+#define Anum_pg_am_amcostestimate		29
+#define Anum_pg_am_amoptions			30
+
+/* ----------------
+ *		initial contents of pg_am
+ * ----------------
+ */
+
+DATA(insert OID = 403 (  btree		5 2 t f t t t t t t f t t 0 btinsert btbeginscan btgettuple btgetbitmap btrescan btendscan btmarkpos btrestrpos btbuild btbuildempty btbulkdelete btvacuumcleanup btcanreturn btcostestimate btoptions ));
+DESCR("b-tree index access method");
+#define BTREE_AM_OID 403
+DATA(insert OID = 405 (  hash		1 1 f f t f f f f f f f f 23 hashinsert hashbeginscan hashgettuple hashgetbitmap hashrescan hashendscan hashmarkpos hashrestrpos hashbuild hashbuildempty hashbulkdelete hashvacuumcleanup - hashcostestimate hashoptions ));
+DESCR("hash index access method");
+#define HASH_AM_OID 405
+DATA(insert OID = 783 (  gist		0 9 f t f f t t f t t t f 0 gistinsert gistbeginscan gistgettuple gistgetbitmap gistrescan gistendscan gistmarkpos gistrestrpos gistbuild gistbuildempty gistbulkdelete gistvacuumcleanup gistcanreturn gistcostestimate gistoptions ));
+DESCR("GiST index access method");
+#define GIST_AM_OID 783
+DATA(insert OID = 2742 (  gin		0 6 f f f f t t f f t f f 0 gininsert ginbeginscan - gingetbitmap ginrescan ginendscan ginmarkpos ginrestrpos ginbuild ginbuildempty ginbulkdelete ginvacuumcleanup - gincostestimate ginoptions ));
+DESCR("GIN index access method");
+#define GIN_AM_OID 2742
+DATA(insert OID = 4000 (  spgist	0 5 f f f f f t f t f f f 0 spginsert spgbeginscan spggettuple spggetbitmap spgrescan spgendscan spgmarkpos spgrestrpos spgbuild spgbuildempty spgbulkdelete spgvacuumcleanup spgcanreturn spgcostestimate spgoptions ));
+DESCR("SP-GiST index access method");
+#define SPGIST_AM_OID 4000
+DATA(insert OID = 3580 (  brin	   0 15 f f f f t t f t t f f 0 brininsert brinbeginscan - bringetbitmap brinrescan brinendscan brinmarkpos brinrestrpos brinbuild brinbuildempty brinbulkdelete brinvacuumcleanup - brincostestimate brinoptions ));
+DESCR("block range index (BRIN) access method");
+#define BRIN_AM_OID 3580
+
+#endif   /* PG_AM_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_attribute.h b/foreign/libpg_query/src/postgres/include/catalog/pg_attribute.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_attribute.h
@@ -0,0 +1,223 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_attribute.h
+ *	  definition of the system "attribute" relation (pg_attribute)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_attribute.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_ATTRIBUTE_H
+#define PG_ATTRIBUTE_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_attribute definition.  cpp turns this into
+ *		typedef struct FormData_pg_attribute
+ *
+ *		If you change the following, make sure you change the structs for
+ *		system attributes in catalog/heap.c also.
+ *		You may need to change catalog/genbki.pl as well.
+ * ----------------
+ */
+#define AttributeRelationId  1249
+#define AttributeRelation_Rowtype_Id  75
+
+CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BKI_SCHEMA_MACRO
+{
+	Oid			attrelid;		/* OID of relation containing this attribute */
+	NameData	attname;		/* name of attribute */
+
+	/*
+	 * atttypid is the OID of the instance in Catalog Class pg_type that
+	 * defines the data type of this attribute (e.g. int4).  Information in
+	 * that instance is redundant with the attlen, attbyval, and attalign
+	 * attributes of this instance, so they had better match or Postgres will
+	 * fail.
+	 */
+	Oid			atttypid;
+
+	/*
+	 * attstattarget is the target number of statistics datapoints to collect
+	 * during VACUUM ANALYZE of this column.  A zero here indicates that we do
+	 * not wish to collect any stats about this column. A "-1" here indicates
+	 * that no value has been explicitly set for this column, so ANALYZE
+	 * should use the default setting.
+	 */
+	int32		attstattarget;
+
+	/*
+	 * attlen is a copy of the typlen field from pg_type for this attribute.
+	 * See atttypid comments above.
+	 */
+	int16		attlen;
+
+	/*
+	 * attnum is the "attribute number" for the attribute:	A value that
+	 * uniquely identifies this attribute within its class. For user
+	 * attributes, Attribute numbers are greater than 0 and not greater than
+	 * the number of attributes in the class. I.e. if the Class pg_class says
+	 * that Class XYZ has 10 attributes, then the user attribute numbers in
+	 * Class pg_attribute must be 1-10.
+	 *
+	 * System attributes have attribute numbers less than 0 that are unique
+	 * within the class, but not constrained to any particular range.
+	 *
+	 * Note that (attnum - 1) is often used as the index to an array.
+	 */
+	int16		attnum;
+
+	/*
+	 * attndims is the declared number of dimensions, if an array type,
+	 * otherwise zero.
+	 */
+	int32		attndims;
+
+	/*
+	 * fastgetattr() uses attcacheoff to cache byte offsets of attributes in
+	 * heap tuples.  The value actually stored in pg_attribute (-1) indicates
+	 * no cached value.  But when we copy these tuples into a tuple
+	 * descriptor, we may then update attcacheoff in the copies. This speeds
+	 * up the attribute walking process.
+	 */
+	int32		attcacheoff;
+
+	/*
+	 * atttypmod records type-specific data supplied at table creation time
+	 * (for example, the max length of a varchar field).  It is passed to
+	 * type-specific input and output functions as the third argument. The
+	 * value will generally be -1 for types that do not need typmod.
+	 */
+	int32		atttypmod;
+
+	/*
+	 * attbyval is a copy of the typbyval field from pg_type for this
+	 * attribute.  See atttypid comments above.
+	 */
+	bool		attbyval;
+
+	/*----------
+	 * attstorage tells for VARLENA attributes, what the heap access
+	 * methods can do to it if a given tuple doesn't fit into a page.
+	 * Possible values are
+	 *		'p': Value must be stored plain always
+	 *		'e': Value can be stored in "secondary" relation (if relation
+	 *			 has one, see pg_class.reltoastrelid)
+	 *		'm': Value can be stored compressed inline
+	 *		'x': Value can be stored compressed inline or in "secondary"
+	 * Note that 'm' fields can also be moved out to secondary storage,
+	 * but only as a last resort ('e' and 'x' fields are moved first).
+	 *----------
+	 */
+	char		attstorage;
+
+	/*
+	 * attalign is a copy of the typalign field from pg_type for this
+	 * attribute.  See atttypid comments above.
+	 */
+	char		attalign;
+
+	/* This flag represents the "NOT NULL" constraint */
+	bool		attnotnull;
+
+	/* Has DEFAULT value or not */
+	bool		atthasdef;
+
+	/* Is dropped (ie, logically invisible) or not */
+	bool		attisdropped;
+
+	/*
+	 * This flag specifies whether this column has ever had a local
+	 * definition.  It is set for normal non-inherited columns, but also for
+	 * columns that are inherited from parents if also explicitly listed in
+	 * CREATE TABLE INHERITS.  It is also set when inheritance is removed from
+	 * a table with ALTER TABLE NO INHERIT.  If the flag is set, the column is
+	 * not dropped by a parent's DROP COLUMN even if this causes the column's
+	 * attinhcount to become zero.
+	 */
+	bool		attislocal;
+
+	/* Number of times inherited from direct parent relation(s) */
+	int32		attinhcount;
+
+	/* attribute's collation */
+	Oid			attcollation;
+
+#ifdef CATALOG_VARLEN			/* variable-length fields start here */
+	/* NOTE: The following fields are not present in tuple descriptors. */
+
+	/* Column-level access permissions */
+	aclitem		attacl[1];
+
+	/* Column-level options */
+	text		attoptions[1];
+
+	/* Column-level FDW options */
+	text		attfdwoptions[1];
+#endif
+} FormData_pg_attribute;
+
+/*
+ * ATTRIBUTE_FIXED_PART_SIZE is the size of the fixed-layout,
+ * guaranteed-not-null part of a pg_attribute row.  This is in fact as much
+ * of the row as gets copied into tuple descriptors, so don't expect you
+ * can access fields beyond attcollation except in a real tuple!
+ */
+#define ATTRIBUTE_FIXED_PART_SIZE \
+	(offsetof(FormData_pg_attribute,attcollation) + sizeof(Oid))
+
+/* ----------------
+ *		Form_pg_attribute corresponds to a pointer to a tuple with
+ *		the format of pg_attribute relation.
+ * ----------------
+ */
+typedef FormData_pg_attribute *Form_pg_attribute;
+
+/* ----------------
+ *		compiler constants for pg_attribute
+ * ----------------
+ */
+
+#define Natts_pg_attribute				21
+#define Anum_pg_attribute_attrelid		1
+#define Anum_pg_attribute_attname		2
+#define Anum_pg_attribute_atttypid		3
+#define Anum_pg_attribute_attstattarget 4
+#define Anum_pg_attribute_attlen		5
+#define Anum_pg_attribute_attnum		6
+#define Anum_pg_attribute_attndims		7
+#define Anum_pg_attribute_attcacheoff	8
+#define Anum_pg_attribute_atttypmod		9
+#define Anum_pg_attribute_attbyval		10
+#define Anum_pg_attribute_attstorage	11
+#define Anum_pg_attribute_attalign		12
+#define Anum_pg_attribute_attnotnull	13
+#define Anum_pg_attribute_atthasdef		14
+#define Anum_pg_attribute_attisdropped	15
+#define Anum_pg_attribute_attislocal	16
+#define Anum_pg_attribute_attinhcount	17
+#define Anum_pg_attribute_attcollation	18
+#define Anum_pg_attribute_attacl		19
+#define Anum_pg_attribute_attoptions	20
+#define Anum_pg_attribute_attfdwoptions 21
+
+
+/* ----------------
+ *		initial contents of pg_attribute
+ *
+ * The initial contents of pg_attribute are generated at compile time by
+ * genbki.pl.  Only "bootstrapped" relations need be included.
+ * ----------------
+ */
+
+#endif   /* PG_ATTRIBUTE_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_authid.h b/foreign/libpg_query/src/postgres/include/catalog/pg_authid.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_authid.h
@@ -0,0 +1,102 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_authid.h
+ *	  definition of the system "authorization identifier" relation (pg_authid)
+ *	  along with the relation's initial contents.
+ *
+ *	  pg_shadow and pg_group are now publicly accessible views on pg_authid.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_authid.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_AUTHID_H
+#define PG_AUTHID_H
+
+#include "catalog/genbki.h"
+
+/*
+ * The CATALOG definition has to refer to the type of rolvaliduntil as
+ * "timestamptz" (lower case) so that bootstrap mode recognizes it.  But
+ * the C header files define this type as TimestampTz.  Since the field is
+ * potentially-null and therefore can't be accessed directly from C code,
+ * there is no particular need for the C struct definition to show the
+ * field type as TimestampTz --- instead we just make it int.
+ */
+#define timestamptz int
+
+
+/* ----------------
+ *		pg_authid definition.  cpp turns this into
+ *		typedef struct FormData_pg_authid
+ * ----------------
+ */
+#define AuthIdRelationId	1260
+#define AuthIdRelation_Rowtype_Id	2842
+
+CATALOG(pg_authid,1260) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2842) BKI_SCHEMA_MACRO
+{
+	NameData	rolname;		/* name of role */
+	bool		rolsuper;		/* read this field via superuser() only! */
+	bool		rolinherit;		/* inherit privileges from other roles? */
+	bool		rolcreaterole;	/* allowed to create more roles? */
+	bool		rolcreatedb;	/* allowed to create databases? */
+	bool		rolcanlogin;	/* allowed to log in as session user? */
+	bool		rolreplication; /* role used for streaming replication */
+	bool		rolbypassrls;	/* bypasses row level security? */
+	int32		rolconnlimit;	/* max connections allowed (-1=no limit) */
+
+	/* remaining fields may be null; use heap_getattr to read them! */
+#ifdef CATALOG_VARLEN			/* variable-length fields start here */
+	text		rolpassword;	/* password, if any */
+	timestamptz rolvaliduntil;	/* password expiration time, if any */
+#endif
+} FormData_pg_authid;
+
+#undef timestamptz
+
+
+/* ----------------
+ *		Form_pg_authid corresponds to a pointer to a tuple with
+ *		the format of pg_authid relation.
+ * ----------------
+ */
+typedef FormData_pg_authid *Form_pg_authid;
+
+/* ----------------
+ *		compiler constants for pg_authid
+ * ----------------
+ */
+#define Natts_pg_authid					11
+#define Anum_pg_authid_rolname			1
+#define Anum_pg_authid_rolsuper			2
+#define Anum_pg_authid_rolinherit		3
+#define Anum_pg_authid_rolcreaterole	4
+#define Anum_pg_authid_rolcreatedb		5
+#define Anum_pg_authid_rolcanlogin		6
+#define Anum_pg_authid_rolreplication	7
+#define Anum_pg_authid_rolbypassrls		8
+#define Anum_pg_authid_rolconnlimit		9
+#define Anum_pg_authid_rolpassword		10
+#define Anum_pg_authid_rolvaliduntil	11
+
+/* ----------------
+ *		initial contents of pg_authid
+ *
+ * The uppercase quantities will be replaced at initdb time with
+ * user choices.
+ * ----------------
+ */
+DATA(insert OID = 10 ( "POSTGRES" t t t t t t t -1 _null_ _null_));
+
+#define BOOTSTRAP_SUPERUSERID 10
+
+#endif   /* PG_AUTHID_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_class.h b/foreign/libpg_query/src/postgres/include/catalog/pg_class.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_class.h
@@ -0,0 +1,180 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_class.h
+ *	  definition of the system "relation" relation (pg_class)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_class.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_CLASS_H
+#define PG_CLASS_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_class definition.  cpp turns this into
+ *		typedef struct FormData_pg_class
+ * ----------------
+ */
+#define RelationRelationId	1259
+#define RelationRelation_Rowtype_Id  83
+
+CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83) BKI_SCHEMA_MACRO
+{
+	NameData	relname;		/* class name */
+	Oid			relnamespace;	/* OID of namespace containing this class */
+	Oid			reltype;		/* OID of entry in pg_type for table's
+								 * implicit row type */
+	Oid			reloftype;		/* OID of entry in pg_type for underlying
+								 * composite type */
+	Oid			relowner;		/* class owner */
+	Oid			relam;			/* index access method; 0 if not an index */
+	Oid			relfilenode;	/* identifier of physical storage file */
+
+	/* relfilenode == 0 means it is a "mapped" relation, see relmapper.c */
+	Oid			reltablespace;	/* identifier of table space for relation */
+	int32		relpages;		/* # of blocks (not always up-to-date) */
+	float4		reltuples;		/* # of tuples (not always up-to-date) */
+	int32		relallvisible;	/* # of all-visible blocks (not always
+								 * up-to-date) */
+	Oid			reltoastrelid;	/* OID of toast table; 0 if none */
+	bool		relhasindex;	/* T if has (or has had) any indexes */
+	bool		relisshared;	/* T if shared across databases */
+	char		relpersistence; /* see RELPERSISTENCE_xxx constants below */
+	char		relkind;		/* see RELKIND_xxx constants below */
+	int16		relnatts;		/* number of user attributes */
+
+	/*
+	 * Class pg_attribute must contain exactly "relnatts" user attributes
+	 * (with attnums ranging from 1 to relnatts) for this class.  It may also
+	 * contain entries with negative attnums for system attributes.
+	 */
+	int16		relchecks;		/* # of CHECK constraints for class */
+	bool		relhasoids;		/* T if we generate OIDs for rows of rel */
+	bool		relhaspkey;		/* has (or has had) PRIMARY KEY index */
+	bool		relhasrules;	/* has (or has had) any rules */
+	bool		relhastriggers; /* has (or has had) any TRIGGERs */
+	bool		relhassubclass; /* has (or has had) derived classes */
+	bool		relrowsecurity; /* row security is enabled or not */
+	bool		relforcerowsecurity; /* row security forced for owners or not */
+	bool		relispopulated; /* matview currently holds query results */
+	char		relreplident;	/* see REPLICA_IDENTITY_xxx constants  */
+	TransactionId relfrozenxid; /* all Xids < this are frozen in this rel */
+	TransactionId relminmxid;	/* all multixacts in this rel are >= this.
+								 * this is really a MultiXactId */
+
+#ifdef CATALOG_VARLEN			/* variable-length fields start here */
+	/* NOTE: These fields are not present in a relcache entry's rd_rel field. */
+	aclitem		relacl[1];		/* access permissions */
+	text		reloptions[1];	/* access-method-specific options */
+#endif
+} FormData_pg_class;
+
+/* Size of fixed part of pg_class tuples, not counting var-length fields */
+#define CLASS_TUPLE_SIZE \
+	 (offsetof(FormData_pg_class,relminmxid) + sizeof(TransactionId))
+
+/* ----------------
+ *		Form_pg_class corresponds to a pointer to a tuple with
+ *		the format of pg_class relation.
+ * ----------------
+ */
+typedef FormData_pg_class *Form_pg_class;
+
+/* ----------------
+ *		compiler constants for pg_class
+ * ----------------
+ */
+
+#define Natts_pg_class						31
+#define Anum_pg_class_relname				1
+#define Anum_pg_class_relnamespace			2
+#define Anum_pg_class_reltype				3
+#define Anum_pg_class_reloftype				4
+#define Anum_pg_class_relowner				5
+#define Anum_pg_class_relam					6
+#define Anum_pg_class_relfilenode			7
+#define Anum_pg_class_reltablespace			8
+#define Anum_pg_class_relpages				9
+#define Anum_pg_class_reltuples				10
+#define Anum_pg_class_relallvisible			11
+#define Anum_pg_class_reltoastrelid			12
+#define Anum_pg_class_relhasindex			13
+#define Anum_pg_class_relisshared			14
+#define Anum_pg_class_relpersistence		15
+#define Anum_pg_class_relkind				16
+#define Anum_pg_class_relnatts				17
+#define Anum_pg_class_relchecks				18
+#define Anum_pg_class_relhasoids			19
+#define Anum_pg_class_relhaspkey			20
+#define Anum_pg_class_relhasrules			21
+#define Anum_pg_class_relhastriggers		22
+#define Anum_pg_class_relhassubclass		23
+#define Anum_pg_class_relrowsecurity		24
+#define Anum_pg_class_relforcerowsecurity	25
+#define Anum_pg_class_relispopulated		26
+#define Anum_pg_class_relreplident			27
+#define Anum_pg_class_relfrozenxid			28
+#define Anum_pg_class_relminmxid			29
+#define Anum_pg_class_relacl				30
+#define Anum_pg_class_reloptions			31
+
+/* ----------------
+ *		initial contents of pg_class
+ *
+ * NOTE: only "bootstrapped" relations need to be declared here.  Be sure that
+ * the OIDs listed here match those given in their CATALOG macros, and that
+ * the relnatts values are correct.
+ * ----------------
+ */
+
+/*
+ * Note: "3" in the relfrozenxid column stands for FirstNormalTransactionId;
+ * similarly, "1" in relminmxid stands for FirstMultiXactId
+ */
+DATA(insert OID = 1247 (  pg_type		PGNSP 71 0 PGUID 0 0 0 0 0 0 0 f f p r 30 0 t f f f f f f t n 3 1 _null_ _null_ ));
+DESCR("");
+DATA(insert OID = 1249 (  pg_attribute	PGNSP 75 0 PGUID 0 0 0 0 0 0 0 f f p r 21 0 f f f f f f f t n 3 1 _null_ _null_ ));
+DESCR("");
+DATA(insert OID = 1255 (  pg_proc		PGNSP 81 0 PGUID 0 0 0 0 0 0 0 f f p r 28 0 t f f f f f f t n 3 1 _null_ _null_ ));
+DESCR("");
+DATA(insert OID = 1259 (  pg_class		PGNSP 83 0 PGUID 0 0 0 0 0 0 0 f f p r 31 0 t f f f f f f t n 3 1 _null_ _null_ ));
+DESCR("");
+
+
+#define		  RELKIND_RELATION		  'r'		/* ordinary table */
+#define		  RELKIND_INDEX			  'i'		/* secondary index */
+#define		  RELKIND_SEQUENCE		  'S'		/* sequence object */
+#define		  RELKIND_TOASTVALUE	  't'		/* for out-of-line values */
+#define		  RELKIND_VIEW			  'v'		/* view */
+#define		  RELKIND_COMPOSITE_TYPE  'c'		/* composite type */
+#define		  RELKIND_FOREIGN_TABLE   'f'		/* foreign table */
+#define		  RELKIND_MATVIEW		  'm'		/* materialized view */
+
+#define		  RELPERSISTENCE_PERMANENT	'p'		/* regular table */
+#define		  RELPERSISTENCE_UNLOGGED	'u'		/* unlogged permanent table */
+#define		  RELPERSISTENCE_TEMP		't'		/* temporary table */
+
+/* default selection for replica identity (primary key or nothing) */
+#define		  REPLICA_IDENTITY_DEFAULT	'd'
+/* no replica identity is logged for this relation */
+#define		  REPLICA_IDENTITY_NOTHING	'n'
+/* all columns are logged as replica identity */
+#define		  REPLICA_IDENTITY_FULL		'f'
+/*
+ * an explicitly chosen candidate key's columns are used as identity;
+ * will still be set if the index has been dropped, in that case it
+ * has the same meaning as 'd'
+ */
+#define		  REPLICA_IDENTITY_INDEX	'i'
+#endif   /* PG_CLASS_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_collation.h b/foreign/libpg_query/src/postgres/include/catalog/pg_collation.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_collation.h
@@ -0,0 +1,76 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_collation.h
+ *	  definition of the system "collation" relation (pg_collation)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ *		src/include/catalog/pg_collation.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_COLLATION_H
+#define PG_COLLATION_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_collation definition.  cpp turns this into
+ *		typedef struct FormData_pg_collation
+ * ----------------
+ */
+#define CollationRelationId  3456
+
+CATALOG(pg_collation,3456)
+{
+	NameData	collname;		/* collation name */
+	Oid			collnamespace;	/* OID of namespace containing collation */
+	Oid			collowner;		/* owner of collation */
+	int32		collencoding;	/* encoding for this collation; -1 = "all" */
+	NameData	collcollate;	/* LC_COLLATE setting */
+	NameData	collctype;		/* LC_CTYPE setting */
+} FormData_pg_collation;
+
+/* ----------------
+ *		Form_pg_collation corresponds to a pointer to a row with
+ *		the format of pg_collation relation.
+ * ----------------
+ */
+typedef FormData_pg_collation *Form_pg_collation;
+
+/* ----------------
+ *		compiler constants for pg_collation
+ * ----------------
+ */
+#define Natts_pg_collation				6
+#define Anum_pg_collation_collname		1
+#define Anum_pg_collation_collnamespace 2
+#define Anum_pg_collation_collowner		3
+#define Anum_pg_collation_collencoding	4
+#define Anum_pg_collation_collcollate	5
+#define Anum_pg_collation_collctype		6
+
+/* ----------------
+ *		initial contents of pg_collation
+ * ----------------
+ */
+
+DATA(insert OID = 100 ( default		PGNSP PGUID -1 "" "" ));
+DESCR("database's default collation");
+#define DEFAULT_COLLATION_OID	100
+DATA(insert OID = 950 ( C			PGNSP PGUID -1 "C" "C" ));
+DESCR("standard C collation");
+#define C_COLLATION_OID			950
+DATA(insert OID = 951 ( POSIX		PGNSP PGUID -1 "POSIX" "POSIX" ));
+DESCR("standard POSIX collation");
+#define POSIX_COLLATION_OID		951
+
+#endif   /* PG_COLLATION_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_constraint.h b/foreign/libpg_query/src/postgres/include/catalog/pg_constraint.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_constraint.h
@@ -0,0 +1,258 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_constraint.h
+ *	  definition of the system "constraint" relation (pg_constraint)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_constraint.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_CONSTRAINT_H
+#define PG_CONSTRAINT_H
+
+#include "catalog/genbki.h"
+#include "catalog/dependency.h"
+#include "nodes/pg_list.h"
+
+/* ----------------
+ *		pg_constraint definition.  cpp turns this into
+ *		typedef struct FormData_pg_constraint
+ * ----------------
+ */
+#define ConstraintRelationId  2606
+
+CATALOG(pg_constraint,2606)
+{
+	/*
+	 * conname + connamespace is deliberately not unique; we allow, for
+	 * example, the same name to be used for constraints of different
+	 * relations.  This is partly for backwards compatibility with past
+	 * Postgres practice, and partly because we don't want to have to obtain a
+	 * global lock to generate a globally unique name for a nameless
+	 * constraint.  We associate a namespace with constraint names only for
+	 * SQL-spec compatibility.
+	 */
+	NameData	conname;		/* name of this constraint */
+	Oid			connamespace;	/* OID of namespace containing constraint */
+	char		contype;		/* constraint type; see codes below */
+	bool		condeferrable;	/* deferrable constraint? */
+	bool		condeferred;	/* deferred by default? */
+	bool		convalidated;	/* constraint has been validated? */
+
+	/*
+	 * conrelid and conkey are only meaningful if the constraint applies to a
+	 * specific relation (this excludes domain constraints and assertions).
+	 * Otherwise conrelid is 0 and conkey is NULL.
+	 */
+	Oid			conrelid;		/* relation this constraint constrains */
+
+	/*
+	 * contypid links to the pg_type row for a domain if this is a domain
+	 * constraint.  Otherwise it's 0.
+	 *
+	 * For SQL-style global ASSERTIONs, both conrelid and contypid would be
+	 * zero. This is not presently supported, however.
+	 */
+	Oid			contypid;		/* domain this constraint constrains */
+
+	/*
+	 * conindid links to the index supporting the constraint, if any;
+	 * otherwise it's 0.  This is used for unique, primary-key, and exclusion
+	 * constraints, and less obviously for foreign-key constraints (where the
+	 * index is a unique index on the referenced relation's referenced
+	 * columns).  Notice that the index is on conrelid in the first case but
+	 * confrelid in the second.
+	 */
+	Oid			conindid;		/* index supporting this constraint */
+
+	/*
+	 * These fields, plus confkey, are only meaningful for a foreign-key
+	 * constraint.  Otherwise confrelid is 0 and the char fields are spaces.
+	 */
+	Oid			confrelid;		/* relation referenced by foreign key */
+	char		confupdtype;	/* foreign key's ON UPDATE action */
+	char		confdeltype;	/* foreign key's ON DELETE action */
+	char		confmatchtype;	/* foreign key's match type */
+
+	/* Has a local definition (hence, do not drop when coninhcount is 0) */
+	bool		conislocal;
+
+	/* Number of times inherited from direct parent relation(s) */
+	int32		coninhcount;
+
+	/* Has a local definition and cannot be inherited */
+	bool		connoinherit;
+
+#ifdef CATALOG_VARLEN			/* variable-length fields start here */
+
+	/*
+	 * Columns of conrelid that the constraint applies to, if known (this is
+	 * NULL for trigger constraints)
+	 */
+	int16		conkey[1];
+
+	/*
+	 * If a foreign key, the referenced columns of confrelid
+	 */
+	int16		confkey[1];
+
+	/*
+	 * If a foreign key, the OIDs of the PK = FK equality operators for each
+	 * column of the constraint
+	 */
+	Oid			conpfeqop[1];
+
+	/*
+	 * If a foreign key, the OIDs of the PK = PK equality operators for each
+	 * column of the constraint (i.e., equality for the referenced columns)
+	 */
+	Oid			conppeqop[1];
+
+	/*
+	 * If a foreign key, the OIDs of the FK = FK equality operators for each
+	 * column of the constraint (i.e., equality for the referencing columns)
+	 */
+	Oid			conffeqop[1];
+
+	/*
+	 * If an exclusion constraint, the OIDs of the exclusion operators for
+	 * each column of the constraint
+	 */
+	Oid			conexclop[1];
+
+	/*
+	 * If a check constraint, nodeToString representation of expression
+	 */
+	pg_node_tree conbin;
+
+	/*
+	 * If a check constraint, source-text representation of expression
+	 */
+	text		consrc;
+#endif
+} FormData_pg_constraint;
+
+/* ----------------
+ *		Form_pg_constraint corresponds to a pointer to a tuple with
+ *		the format of pg_constraint relation.
+ * ----------------
+ */
+typedef FormData_pg_constraint *Form_pg_constraint;
+
+/* ----------------
+ *		compiler constants for pg_constraint
+ * ----------------
+ */
+#define Natts_pg_constraint					24
+#define Anum_pg_constraint_conname			1
+#define Anum_pg_constraint_connamespace		2
+#define Anum_pg_constraint_contype			3
+#define Anum_pg_constraint_condeferrable	4
+#define Anum_pg_constraint_condeferred		5
+#define Anum_pg_constraint_convalidated		6
+#define Anum_pg_constraint_conrelid			7
+#define Anum_pg_constraint_contypid			8
+#define Anum_pg_constraint_conindid			9
+#define Anum_pg_constraint_confrelid		10
+#define Anum_pg_constraint_confupdtype		11
+#define Anum_pg_constraint_confdeltype		12
+#define Anum_pg_constraint_confmatchtype	13
+#define Anum_pg_constraint_conislocal		14
+#define Anum_pg_constraint_coninhcount		15
+#define Anum_pg_constraint_connoinherit		16
+#define Anum_pg_constraint_conkey			17
+#define Anum_pg_constraint_confkey			18
+#define Anum_pg_constraint_conpfeqop		19
+#define Anum_pg_constraint_conppeqop		20
+#define Anum_pg_constraint_conffeqop		21
+#define Anum_pg_constraint_conexclop		22
+#define Anum_pg_constraint_conbin			23
+#define Anum_pg_constraint_consrc			24
+
+
+/* Valid values for contype */
+#define CONSTRAINT_CHECK			'c'
+#define CONSTRAINT_FOREIGN			'f'
+#define CONSTRAINT_PRIMARY			'p'
+#define CONSTRAINT_UNIQUE			'u'
+#define CONSTRAINT_TRIGGER			't'
+#define CONSTRAINT_EXCLUSION		'x'
+
+/*
+ * Valid values for confupdtype and confdeltype are the FKCONSTR_ACTION_xxx
+ * constants defined in parsenodes.h.  Valid values for confmatchtype are
+ * the FKCONSTR_MATCH_xxx constants defined in parsenodes.h.
+ */
+
+/*
+ * Identify constraint type for lookup purposes
+ */
+typedef enum ConstraintCategory
+{
+	CONSTRAINT_RELATION,
+	CONSTRAINT_DOMAIN,
+	CONSTRAINT_ASSERTION		/* for future expansion */
+} ConstraintCategory;
+
+/*
+ * prototypes for functions in pg_constraint.c
+ */
+extern Oid CreateConstraintEntry(const char *constraintName,
+					  Oid constraintNamespace,
+					  char constraintType,
+					  bool isDeferrable,
+					  bool isDeferred,
+					  bool isValidated,
+					  Oid relId,
+					  const int16 *constraintKey,
+					  int constraintNKeys,
+					  Oid domainId,
+					  Oid indexRelId,
+					  Oid foreignRelId,
+					  const int16 *foreignKey,
+					  const Oid *pfEqOp,
+					  const Oid *ppEqOp,
+					  const Oid *ffEqOp,
+					  int foreignNKeys,
+					  char foreignUpdateType,
+					  char foreignDeleteType,
+					  char foreignMatchType,
+					  const Oid *exclOp,
+					  Node *conExpr,
+					  const char *conBin,
+					  const char *conSrc,
+					  bool conIsLocal,
+					  int conInhCount,
+					  bool conNoInherit,
+					  bool is_internal);
+
+extern void RemoveConstraintById(Oid conId);
+extern void RenameConstraintById(Oid conId, const char *newname);
+extern void SetValidatedConstraintById(Oid conId);
+
+extern bool ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId,
+					 Oid objNamespace, const char *conname);
+extern char *ChooseConstraintName(const char *name1, const char *name2,
+					 const char *label, Oid namespaceid,
+					 List *others);
+
+extern void AlterConstraintNamespaces(Oid ownerId, Oid oldNspId,
+					  Oid newNspId, bool isType, ObjectAddresses *objsMoved);
+extern Oid	get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok);
+extern Oid	get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok);
+
+extern bool check_functional_grouping(Oid relid,
+						  Index varno, Index varlevelsup,
+						  List *grouping_columns,
+						  List **constraintDeps);
+
+#endif   /* PG_CONSTRAINT_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_control.h b/foreign/libpg_query/src/postgres/include/catalog/pg_control.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_control.h
@@ -0,0 +1,241 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_control.h
+ *	  The system control file "pg_control" is not a heap relation.
+ *	  However, we define it here so that the format is documented.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_control.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_CONTROL_H
+#define PG_CONTROL_H
+
+#include "access/xlogdefs.h"
+#include "pgtime.h"				/* for pg_time_t */
+#include "port/pg_crc32c.h"
+
+
+/* Version identifier for this pg_control format */
+#define PG_CONTROL_VERSION	942
+
+/*
+ * Body of CheckPoint XLOG records.  This is declared here because we keep
+ * a copy of the latest one in pg_control for possible disaster recovery.
+ * Changing this struct requires a PG_CONTROL_VERSION bump.
+ */
+typedef struct CheckPoint
+{
+	XLogRecPtr	redo;			/* next RecPtr available when we began to
+								 * create CheckPoint (i.e. REDO start point) */
+	TimeLineID	ThisTimeLineID; /* current TLI */
+	TimeLineID	PrevTimeLineID; /* previous TLI, if this record begins a new
+								 * timeline (equals ThisTimeLineID otherwise) */
+	bool		fullPageWrites; /* current full_page_writes */
+	uint32		nextXidEpoch;	/* higher-order bits of nextXid */
+	TransactionId nextXid;		/* next free XID */
+	Oid			nextOid;		/* next free OID */
+	MultiXactId nextMulti;		/* next free MultiXactId */
+	MultiXactOffset nextMultiOffset;	/* next free MultiXact offset */
+	TransactionId oldestXid;	/* cluster-wide minimum datfrozenxid */
+	Oid			oldestXidDB;	/* database with minimum datfrozenxid */
+	MultiXactId oldestMulti;	/* cluster-wide minimum datminmxid */
+	Oid			oldestMultiDB;	/* database with minimum datminmxid */
+	pg_time_t	time;			/* time stamp of checkpoint */
+	TransactionId oldestCommitTsXid;	/* oldest Xid with valid commit
+										 * timestamp */
+	TransactionId newestCommitTsXid;	/* newest Xid with valid commit
+										 * timestamp */
+
+	/*
+	 * Oldest XID still running. This is only needed to initialize hot standby
+	 * mode from an online checkpoint, so we only bother calculating this for
+	 * online checkpoints and only when wal_level is hot_standby. Otherwise
+	 * it's set to InvalidTransactionId.
+	 */
+	TransactionId oldestActiveXid;
+} CheckPoint;
+
+/* XLOG info values for XLOG rmgr */
+#define XLOG_CHECKPOINT_SHUTDOWN		0x00
+#define XLOG_CHECKPOINT_ONLINE			0x10
+#define XLOG_NOOP						0x20
+#define XLOG_NEXTOID					0x30
+#define XLOG_SWITCH						0x40
+#define XLOG_BACKUP_END					0x50
+#define XLOG_PARAMETER_CHANGE			0x60
+#define XLOG_RESTORE_POINT				0x70
+#define XLOG_FPW_CHANGE					0x80
+#define XLOG_END_OF_RECOVERY			0x90
+#define XLOG_FPI_FOR_HINT				0xA0
+#define XLOG_FPI						0xB0
+
+
+/*
+ * System status indicator.  Note this is stored in pg_control; if you change
+ * it, you must bump PG_CONTROL_VERSION
+ */
+typedef enum DBState
+{
+	DB_STARTUP = 0,
+	DB_SHUTDOWNED,
+	DB_SHUTDOWNED_IN_RECOVERY,
+	DB_SHUTDOWNING,
+	DB_IN_CRASH_RECOVERY,
+	DB_IN_ARCHIVE_RECOVERY,
+	DB_IN_PRODUCTION
+} DBState;
+
+/*
+ * Contents of pg_control.
+ *
+ * NOTE: try to keep this under 512 bytes so that it will fit on one physical
+ * sector of typical disk drives.  This reduces the odds of corruption due to
+ * power failure midway through a write.
+ */
+
+typedef struct ControlFileData
+{
+	/*
+	 * Unique system identifier --- to ensure we match up xlog files with the
+	 * installation that produced them.
+	 */
+	uint64		system_identifier;
+
+	/*
+	 * Version identifier information.  Keep these fields at the same offset,
+	 * especially pg_control_version; they won't be real useful if they move
+	 * around.  (For historical reasons they must be 8 bytes into the file
+	 * rather than immediately at the front.)
+	 *
+	 * pg_control_version identifies the format of pg_control itself.
+	 * catalog_version_no identifies the format of the system catalogs.
+	 *
+	 * There are additional version identifiers in individual files; for
+	 * example, WAL logs contain per-page magic numbers that can serve as
+	 * version cues for the WAL log.
+	 */
+	uint32		pg_control_version;		/* PG_CONTROL_VERSION */
+	uint32		catalog_version_no;		/* see catversion.h */
+
+	/*
+	 * System status data
+	 */
+	DBState		state;			/* see enum above */
+	pg_time_t	time;			/* time stamp of last pg_control update */
+	XLogRecPtr	checkPoint;		/* last check point record ptr */
+	XLogRecPtr	prevCheckPoint; /* previous check point record ptr */
+
+	CheckPoint	checkPointCopy; /* copy of last check point record */
+
+	XLogRecPtr	unloggedLSN;	/* current fake LSN value, for unlogged rels */
+
+	/*
+	 * These two values determine the minimum point we must recover up to
+	 * before starting up:
+	 *
+	 * minRecoveryPoint is updated to the latest replayed LSN whenever we
+	 * flush a data change during archive recovery. That guards against
+	 * starting archive recovery, aborting it, and restarting with an earlier
+	 * stop location. If we've already flushed data changes from WAL record X
+	 * to disk, we mustn't start up until we reach X again. Zero when not
+	 * doing archive recovery.
+	 *
+	 * backupStartPoint is the redo pointer of the backup start checkpoint, if
+	 * we are recovering from an online backup and haven't reached the end of
+	 * backup yet. It is reset to zero when the end of backup is reached, and
+	 * we mustn't start up before that. A boolean would suffice otherwise, but
+	 * we use the redo pointer as a cross-check when we see an end-of-backup
+	 * record, to make sure the end-of-backup record corresponds the base
+	 * backup we're recovering from.
+	 *
+	 * backupEndPoint is the backup end location, if we are recovering from an
+	 * online backup which was taken from the standby and haven't reached the
+	 * end of backup yet. It is initialized to the minimum recovery point in
+	 * pg_control which was backed up last. It is reset to zero when the end
+	 * of backup is reached, and we mustn't start up before that.
+	 *
+	 * If backupEndRequired is true, we know for sure that we're restoring
+	 * from a backup, and must see a backup-end record before we can safely
+	 * start up. If it's false, but backupStartPoint is set, a backup_label
+	 * file was found at startup but it may have been a leftover from a stray
+	 * pg_start_backup() call, not accompanied by pg_stop_backup().
+	 */
+	XLogRecPtr	minRecoveryPoint;
+	TimeLineID	minRecoveryPointTLI;
+	XLogRecPtr	backupStartPoint;
+	XLogRecPtr	backupEndPoint;
+	bool		backupEndRequired;
+
+	/*
+	 * Parameter settings that determine if the WAL can be used for archival
+	 * or hot standby.
+	 */
+	int			wal_level;
+	bool		wal_log_hints;
+	int			MaxConnections;
+	int			max_worker_processes;
+	int			max_prepared_xacts;
+	int			max_locks_per_xact;
+	bool		track_commit_timestamp;
+
+	/*
+	 * This data is used to check for hardware-architecture compatibility of
+	 * the database and the backend executable.  We need not check endianness
+	 * explicitly, since the pg_control version will surely look wrong to a
+	 * machine of different endianness, but we do need to worry about MAXALIGN
+	 * and floating-point format.  (Note: storage layout nominally also
+	 * depends on SHORTALIGN and INTALIGN, but in practice these are the same
+	 * on all architectures of interest.)
+	 *
+	 * Testing just one double value is not a very bulletproof test for
+	 * floating-point compatibility, but it will catch most cases.
+	 */
+	uint32		maxAlign;		/* alignment requirement for tuples */
+	double		floatFormat;	/* constant 1234567.0 */
+#define FLOATFORMAT_VALUE	1234567.0
+
+	/*
+	 * This data is used to make sure that configuration of this database is
+	 * compatible with the backend executable.
+	 */
+	uint32		blcksz;			/* data block size for this DB */
+	uint32		relseg_size;	/* blocks per segment of large relation */
+
+	uint32		xlog_blcksz;	/* block size within WAL files */
+	uint32		xlog_seg_size;	/* size of each WAL segment */
+
+	uint32		nameDataLen;	/* catalog name field width */
+	uint32		indexMaxKeys;	/* max number of columns in an index */
+
+	uint32		toast_max_chunk_size;	/* chunk size in TOAST tables */
+	uint32		loblksize;		/* chunk size in pg_largeobject */
+
+	/* flag indicating internal format of timestamp, interval, time */
+	bool		enableIntTimes; /* int64 storage enabled? */
+
+	/* flags indicating pass-by-value status of various types */
+	bool		float4ByVal;	/* float4 pass-by-value? */
+	bool		float8ByVal;	/* float8, int8, etc pass-by-value? */
+
+	/* Are data pages protected by checksums? Zero if no checksum version */
+	uint32		data_checksum_version;
+
+	/* CRC of all above ... MUST BE LAST! */
+	pg_crc32c	crc;
+} ControlFileData;
+
+/*
+ * Physical size of the pg_control file.  Note that this is considerably
+ * bigger than the actually used size (ie, sizeof(ControlFileData)).
+ * The idea is to keep the physical size constant independent of format
+ * changes, so that ReadControlFile will deliver a suitable wrong-version
+ * message instead of a read error if it's looking at an incompatible file.
+ */
+#define PG_CONTROL_SIZE		8192
+
+#endif   /* PG_CONTROL_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_conversion.h b/foreign/libpg_query/src/postgres/include/catalog/pg_conversion.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_conversion.h
@@ -0,0 +1,77 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_conversion.h
+ *	  definition of the system "conversion" relation (pg_conversion)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_conversion.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_CONVERSION_H
+#define PG_CONVERSION_H
+
+#include "catalog/genbki.h"
+
+/* ----------------------------------------------------------------
+ *		pg_conversion definition.
+ *
+ *		cpp turns this into typedef struct FormData_pg_namespace
+ *
+ *	conname				name of the conversion
+ *	connamespace		name space which the conversion belongs to
+ *	conowner			owner of the conversion
+ *	conforencoding		FOR encoding id
+ *	contoencoding		TO encoding id
+ *	conproc				OID of the conversion proc
+ *	condefault			TRUE if this is a default conversion
+ * ----------------------------------------------------------------
+ */
+#define ConversionRelationId  2607
+
+CATALOG(pg_conversion,2607)
+{
+	NameData	conname;
+	Oid			connamespace;
+	Oid			conowner;
+	int32		conforencoding;
+	int32		contoencoding;
+	regproc		conproc;
+	bool		condefault;
+} FormData_pg_conversion;
+
+/* ----------------
+ *		Form_pg_conversion corresponds to a pointer to a tuple with
+ *		the format of pg_conversion relation.
+ * ----------------
+ */
+typedef FormData_pg_conversion *Form_pg_conversion;
+
+/* ----------------
+ *		compiler constants for pg_conversion
+ * ----------------
+ */
+
+#define Natts_pg_conversion				7
+#define Anum_pg_conversion_conname		1
+#define Anum_pg_conversion_connamespace 2
+#define Anum_pg_conversion_conowner		3
+#define Anum_pg_conversion_conforencoding		4
+#define Anum_pg_conversion_contoencoding		5
+#define Anum_pg_conversion_conproc		6
+#define Anum_pg_conversion_condefault	7
+
+/* ----------------
+ * initial contents of pg_conversion
+ * ---------------
+ */
+
+#endif   /* PG_CONVERSION_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_conversion_fn.h b/foreign/libpg_query/src/postgres/include/catalog/pg_conversion_fn.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_conversion_fn.h
@@ -0,0 +1,27 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_conversion_fn.h
+ *	 prototypes for functions in catalog/pg_conversion.c
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_conversion_fn.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_CONVERSION_FN_H
+#define PG_CONVERSION_FN_H
+
+
+#include "catalog/objectaddress.h"
+
+extern ObjectAddress ConversionCreate(const char *conname, Oid connamespace,
+				 Oid conowner,
+				 int32 conforencoding, int32 contoencoding,
+				 Oid conproc, bool def);
+extern void RemoveConversionById(Oid conversionOid);
+extern Oid	FindDefaultConversion(Oid connamespace, int32 for_encoding, int32 to_encoding);
+
+#endif   /* PG_CONVERSION_FN_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_depend.h b/foreign/libpg_query/src/postgres/include/catalog/pg_depend.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_depend.h
@@ -0,0 +1,90 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_depend.h
+ *	  definition of the system "dependency" relation (pg_depend)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_depend.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_DEPEND_H
+#define PG_DEPEND_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_depend definition.  cpp turns this into
+ *		typedef struct FormData_pg_depend
+ * ----------------
+ */
+#define DependRelationId  2608
+
+CATALOG(pg_depend,2608) BKI_WITHOUT_OIDS
+{
+	/*
+	 * Identification of the dependent (referencing) object.
+	 *
+	 * These fields are all zeroes for a DEPENDENCY_PIN entry.
+	 */
+	Oid			classid;		/* OID of table containing object */
+	Oid			objid;			/* OID of object itself */
+	int32		objsubid;		/* column number, or 0 if not used */
+
+	/*
+	 * Identification of the independent (referenced) object.
+	 */
+	Oid			refclassid;		/* OID of table containing object */
+	Oid			refobjid;		/* OID of object itself */
+	int32		refobjsubid;	/* column number, or 0 if not used */
+
+	/*
+	 * Precise semantics of the relationship are specified by the deptype
+	 * field.  See DependencyType in catalog/dependency.h.
+	 */
+	char		deptype;		/* see codes in dependency.h */
+} FormData_pg_depend;
+
+/* ----------------
+ *		Form_pg_depend corresponds to a pointer to a row with
+ *		the format of pg_depend relation.
+ * ----------------
+ */
+typedef FormData_pg_depend *Form_pg_depend;
+
+/* ----------------
+ *		compiler constants for pg_depend
+ * ----------------
+ */
+#define Natts_pg_depend				7
+#define Anum_pg_depend_classid		1
+#define Anum_pg_depend_objid		2
+#define Anum_pg_depend_objsubid		3
+#define Anum_pg_depend_refclassid	4
+#define Anum_pg_depend_refobjid		5
+#define Anum_pg_depend_refobjsubid	6
+#define Anum_pg_depend_deptype		7
+
+
+/*
+ * pg_depend has no preloaded contents; system-defined dependencies are
+ * loaded into it during a late stage of the initdb process.
+ *
+ * NOTE: we do not represent all possible dependency pairs in pg_depend;
+ * for example, there's not much value in creating an explicit dependency
+ * from an attribute to its relation.  Usually we make a dependency for
+ * cases where the relationship is conditional rather than essential
+ * (for example, not all triggers are dependent on constraints, but all
+ * attributes are dependent on relations) or where the dependency is not
+ * convenient to find from the contents of other catalogs.
+ */
+
+#endif   /* PG_DEPEND_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_event_trigger.h b/foreign/libpg_query/src/postgres/include/catalog/pg_event_trigger.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_event_trigger.h
@@ -0,0 +1,64 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_event_trigger.h
+ *	  definition of the system "event trigger" relation (pg_event_trigger)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_event_trigger.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_EVENT_TRIGGER_H
+#define PG_EVENT_TRIGGER_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_event_trigger definition.    cpp turns this into
+ *		typedef struct FormData_pg_event_trigger
+ * ----------------
+ */
+#define EventTriggerRelationId	3466
+
+CATALOG(pg_event_trigger,3466)
+{
+	NameData	evtname;		/* trigger's name */
+	NameData	evtevent;		/* trigger's event */
+	Oid			evtowner;		/* trigger's owner */
+	Oid			evtfoid;		/* OID of function to be called */
+	char		evtenabled;		/* trigger's firing configuration WRT
+								 * session_replication_role */
+
+#ifdef CATALOG_VARLEN
+	text		evttags[1];		/* command TAGs this event trigger targets */
+#endif
+} FormData_pg_event_trigger;
+
+/* ----------------
+ *		Form_pg_event_trigger corresponds to a pointer to a tuple with
+ *		the format of pg_event_trigger relation.
+ * ----------------
+ */
+typedef FormData_pg_event_trigger *Form_pg_event_trigger;
+
+/* ----------------
+ *		compiler constants for pg_event_trigger
+ * ----------------
+ */
+#define Natts_pg_event_trigger					6
+#define Anum_pg_event_trigger_evtname			1
+#define Anum_pg_event_trigger_evtevent			2
+#define Anum_pg_event_trigger_evtowner			3
+#define Anum_pg_event_trigger_evtfoid			4
+#define Anum_pg_event_trigger_evtenabled		5
+#define Anum_pg_event_trigger_evttags			6
+
+#endif   /* PG_EVENT_TRIGGER_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_index.h b/foreign/libpg_query/src/postgres/include/catalog/pg_index.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_index.h
@@ -0,0 +1,111 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_index.h
+ *	  definition of the system "index" relation (pg_index)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_index.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_INDEX_H
+#define PG_INDEX_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_index definition.  cpp turns this into
+ *		typedef struct FormData_pg_index.
+ * ----------------
+ */
+#define IndexRelationId  2610
+
+CATALOG(pg_index,2610) BKI_WITHOUT_OIDS BKI_SCHEMA_MACRO
+{
+	Oid			indexrelid;		/* OID of the index */
+	Oid			indrelid;		/* OID of the relation it indexes */
+	int16		indnatts;		/* number of columns in index */
+	bool		indisunique;	/* is this a unique index? */
+	bool		indisprimary;	/* is this index for primary key? */
+	bool		indisexclusion; /* is this index for exclusion constraint? */
+	bool		indimmediate;	/* is uniqueness enforced immediately? */
+	bool		indisclustered; /* is this the index last clustered by? */
+	bool		indisvalid;		/* is this index valid for use by queries? */
+	bool		indcheckxmin;	/* must we wait for xmin to be old? */
+	bool		indisready;		/* is this index ready for inserts? */
+	bool		indislive;		/* is this index alive at all? */
+	bool		indisreplident; /* is this index the identity for replication? */
+
+	/* variable-length fields start here, but we allow direct access to indkey */
+	int2vector	indkey;			/* column numbers of indexed cols, or 0 */
+
+#ifdef CATALOG_VARLEN
+	oidvector	indcollation;	/* collation identifiers */
+	oidvector	indclass;		/* opclass identifiers */
+	int2vector	indoption;		/* per-column flags (AM-specific meanings) */
+	pg_node_tree indexprs;		/* expression trees for index attributes that
+								 * are not simple column references; one for
+								 * each zero entry in indkey[] */
+	pg_node_tree indpred;		/* expression tree for predicate, if a partial
+								 * index; else NULL */
+#endif
+} FormData_pg_index;
+
+/* ----------------
+ *		Form_pg_index corresponds to a pointer to a tuple with
+ *		the format of pg_index relation.
+ * ----------------
+ */
+typedef FormData_pg_index *Form_pg_index;
+
+/* ----------------
+ *		compiler constants for pg_index
+ * ----------------
+ */
+#define Natts_pg_index					19
+#define Anum_pg_index_indexrelid		1
+#define Anum_pg_index_indrelid			2
+#define Anum_pg_index_indnatts			3
+#define Anum_pg_index_indisunique		4
+#define Anum_pg_index_indisprimary		5
+#define Anum_pg_index_indisexclusion	6
+#define Anum_pg_index_indimmediate		7
+#define Anum_pg_index_indisclustered	8
+#define Anum_pg_index_indisvalid		9
+#define Anum_pg_index_indcheckxmin		10
+#define Anum_pg_index_indisready		11
+#define Anum_pg_index_indislive			12
+#define Anum_pg_index_indisreplident	13
+#define Anum_pg_index_indkey			14
+#define Anum_pg_index_indcollation		15
+#define Anum_pg_index_indclass			16
+#define Anum_pg_index_indoption			17
+#define Anum_pg_index_indexprs			18
+#define Anum_pg_index_indpred			19
+
+/*
+ * Index AMs that support ordered scans must support these two indoption
+ * bits.  Otherwise, the content of the per-column indoption fields is
+ * open for future definition.
+ */
+#define INDOPTION_DESC			0x0001	/* values are in reverse order */
+#define INDOPTION_NULLS_FIRST	0x0002	/* NULLs are first instead of last */
+
+/*
+ * Use of these macros is recommended over direct examination of the state
+ * flag columns where possible; this allows source code compatibility with
+ * the hacky representation used in 9.2.
+ */
+#define IndexIsValid(indexForm) ((indexForm)->indisvalid)
+#define IndexIsReady(indexForm) ((indexForm)->indisready)
+#define IndexIsLive(indexForm)	((indexForm)->indislive)
+
+#endif   /* PG_INDEX_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_language.h b/foreign/libpg_query/src/postgres/include/catalog/pg_language.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_language.h
@@ -0,0 +1,82 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_language.h
+ *	  definition of the system "language" relation (pg_language)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_language.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_LANGUAGE_H
+#define PG_LANGUAGE_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_language definition.  cpp turns this into
+ *		typedef struct FormData_pg_language
+ * ----------------
+ */
+#define LanguageRelationId	2612
+
+CATALOG(pg_language,2612)
+{
+	NameData	lanname;		/* Language name */
+	Oid			lanowner;		/* Language's owner */
+	bool		lanispl;		/* Is a procedural language */
+	bool		lanpltrusted;	/* PL is trusted */
+	Oid			lanplcallfoid;	/* Call handler for PL */
+	Oid			laninline;		/* Optional anonymous-block handler function */
+	Oid			lanvalidator;	/* Optional validation function */
+
+#ifdef CATALOG_VARLEN			/* variable-length fields start here */
+	aclitem		lanacl[1];		/* Access privileges */
+#endif
+} FormData_pg_language;
+
+/* ----------------
+ *		Form_pg_language corresponds to a pointer to a tuple with
+ *		the format of pg_language relation.
+ * ----------------
+ */
+typedef FormData_pg_language *Form_pg_language;
+
+/* ----------------
+ *		compiler constants for pg_language
+ * ----------------
+ */
+#define Natts_pg_language				8
+#define Anum_pg_language_lanname		1
+#define Anum_pg_language_lanowner		2
+#define Anum_pg_language_lanispl		3
+#define Anum_pg_language_lanpltrusted	4
+#define Anum_pg_language_lanplcallfoid	5
+#define Anum_pg_language_laninline		6
+#define Anum_pg_language_lanvalidator	7
+#define Anum_pg_language_lanacl			8
+
+/* ----------------
+ *		initial contents of pg_language
+ * ----------------
+ */
+
+DATA(insert OID = 12 ( "internal"	PGUID f f 0 0 2246 _null_ ));
+DESCR("built-in functions");
+#define INTERNALlanguageId 12
+DATA(insert OID = 13 ( "c"			PGUID f f 0 0 2247 _null_ ));
+DESCR("dynamically-loaded C functions");
+#define ClanguageId 13
+DATA(insert OID = 14 ( "sql"		PGUID f t 0 0 2248 _null_ ));
+DESCR("SQL-language functions");
+#define SQLlanguageId 14
+
+#endif   /* PG_LANGUAGE_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_namespace.h b/foreign/libpg_query/src/postgres/include/catalog/pg_namespace.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_namespace.h
@@ -0,0 +1,85 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_namespace.h
+ *	  definition of the system "namespace" relation (pg_namespace)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_namespace.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_NAMESPACE_H
+#define PG_NAMESPACE_H
+
+#include "catalog/genbki.h"
+
+/* ----------------------------------------------------------------
+ *		pg_namespace definition.
+ *
+ *		cpp turns this into typedef struct FormData_pg_namespace
+ *
+ *	nspname				name of the namespace
+ *	nspowner			owner (creator) of the namespace
+ *	nspacl				access privilege list
+ * ----------------------------------------------------------------
+ */
+#define NamespaceRelationId  2615
+
+CATALOG(pg_namespace,2615)
+{
+	NameData	nspname;
+	Oid			nspowner;
+
+#ifdef CATALOG_VARLEN			/* variable-length fields start here */
+	aclitem		nspacl[1];
+#endif
+} FormData_pg_namespace;
+
+/* ----------------
+ *		Form_pg_namespace corresponds to a pointer to a tuple with
+ *		the format of pg_namespace relation.
+ * ----------------
+ */
+typedef FormData_pg_namespace *Form_pg_namespace;
+
+/* ----------------
+ *		compiler constants for pg_namespace
+ * ----------------
+ */
+
+#define Natts_pg_namespace				3
+#define Anum_pg_namespace_nspname		1
+#define Anum_pg_namespace_nspowner		2
+#define Anum_pg_namespace_nspacl		3
+
+
+/* ----------------
+ * initial contents of pg_namespace
+ * ---------------
+ */
+
+DATA(insert OID = 11 ( "pg_catalog" PGUID _null_ ));
+DESCR("system catalog schema");
+#define PG_CATALOG_NAMESPACE 11
+DATA(insert OID = 99 ( "pg_toast" PGUID _null_ ));
+DESCR("reserved schema for TOAST tables");
+#define PG_TOAST_NAMESPACE 99
+DATA(insert OID = 2200 ( "public" PGUID _null_ ));
+DESCR("standard public schema");
+#define PG_PUBLIC_NAMESPACE 2200
+
+
+/*
+ * prototypes for functions in pg_namespace.c
+ */
+extern Oid	NamespaceCreate(const char *nspName, Oid ownerId, bool isTemp);
+
+#endif   /* PG_NAMESPACE_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_opclass.h b/foreign/libpg_query/src/postgres/include/catalog/pg_opclass.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_opclass.h
@@ -0,0 +1,275 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_opclass.h
+ *	  definition of the system "opclass" relation (pg_opclass)
+ *	  along with the relation's initial contents.
+ *
+ * The primary key for this table is <opcmethod, opcname, opcnamespace> ---
+ * that is, there is a row for each valid combination of opclass name and
+ * index access method type.  This row specifies the expected input data type
+ * for the opclass (the type of the heap column, or the expression output type
+ * in the case of an index expression).  Note that types binary-coercible to
+ * the specified type will be accepted too.
+ *
+ * For a given <opcmethod, opcintype> pair, there can be at most one row that
+ * has opcdefault = true; this row is the default opclass for such data in
+ * such an index.  (This is not currently enforced by an index, because we
+ * don't support partial indexes on system catalogs.)
+ *
+ * Normally opckeytype = InvalidOid (zero), indicating that the data stored
+ * in the index is the same as the data in the indexed column.  If opckeytype
+ * is nonzero then it indicates that a conversion step is needed to produce
+ * the stored index data, which will be of type opckeytype (which might be
+ * the same or different from the input datatype).  Performing such a
+ * conversion is the responsibility of the index access method --- not all
+ * AMs support this.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_opclass.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_OPCLASS_H
+#define PG_OPCLASS_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_opclass definition.  cpp turns this into
+ *		typedef struct FormData_pg_opclass
+ * ----------------
+ */
+#define OperatorClassRelationId  2616
+
+CATALOG(pg_opclass,2616)
+{
+	Oid			opcmethod;		/* index access method opclass is for */
+	NameData	opcname;		/* name of this opclass */
+	Oid			opcnamespace;	/* namespace of this opclass */
+	Oid			opcowner;		/* opclass owner */
+	Oid			opcfamily;		/* containing operator family */
+	Oid			opcintype;		/* type of data indexed by opclass */
+	bool		opcdefault;		/* T if opclass is default for opcintype */
+	Oid			opckeytype;		/* type of data in index, or InvalidOid */
+} FormData_pg_opclass;
+
+/* ----------------
+ *		Form_pg_opclass corresponds to a pointer to a tuple with
+ *		the format of pg_opclass relation.
+ * ----------------
+ */
+typedef FormData_pg_opclass *Form_pg_opclass;
+
+/* ----------------
+ *		compiler constants for pg_opclass
+ * ----------------
+ */
+#define Natts_pg_opclass				8
+#define Anum_pg_opclass_opcmethod		1
+#define Anum_pg_opclass_opcname			2
+#define Anum_pg_opclass_opcnamespace	3
+#define Anum_pg_opclass_opcowner		4
+#define Anum_pg_opclass_opcfamily		5
+#define Anum_pg_opclass_opcintype		6
+#define Anum_pg_opclass_opcdefault		7
+#define Anum_pg_opclass_opckeytype		8
+
+/* ----------------
+ *		initial contents of pg_opclass
+ *
+ * Note: we hard-wire an OID only for a few entries that have to be explicitly
+ * referenced in the C code or in built-in catalog entries.  The rest get OIDs
+ * assigned on-the-fly during initdb.
+ * ----------------
+ */
+
+DATA(insert (	403		abstime_ops			PGNSP PGUID  421  702 t 0 ));
+DATA(insert (	403		array_ops			PGNSP PGUID  397 2277 t 0 ));
+DATA(insert (	405		array_ops			PGNSP PGUID  627 2277 t 0 ));
+DATA(insert (	403		bit_ops				PGNSP PGUID  423 1560 t 0 ));
+DATA(insert (	403		bool_ops			PGNSP PGUID  424   16 t 0 ));
+DATA(insert (	403		bpchar_ops			PGNSP PGUID  426 1042 t 0 ));
+DATA(insert (	405		bpchar_ops			PGNSP PGUID  427 1042 t 0 ));
+DATA(insert (	403		bytea_ops			PGNSP PGUID  428   17 t 0 ));
+DATA(insert (	403		char_ops			PGNSP PGUID  429   18 t 0 ));
+DATA(insert (	405		char_ops			PGNSP PGUID  431   18 t 0 ));
+DATA(insert (	403		cidr_ops			PGNSP PGUID 1974  869 f 0 ));
+DATA(insert (	405		cidr_ops			PGNSP PGUID 1975  869 f 0 ));
+DATA(insert OID = 3122 ( 403	date_ops	PGNSP PGUID  434 1082 t 0 ));
+#define DATE_BTREE_OPS_OID 3122
+DATA(insert (	405		date_ops			PGNSP PGUID  435 1082 t 0 ));
+DATA(insert (	403		float4_ops			PGNSP PGUID 1970  700 t 0 ));
+DATA(insert (	405		float4_ops			PGNSP PGUID 1971  700 t 0 ));
+DATA(insert OID = 3123 ( 403	float8_ops	PGNSP PGUID 1970  701 t 0 ));
+#define FLOAT8_BTREE_OPS_OID 3123
+DATA(insert (	405		float8_ops			PGNSP PGUID 1971  701 t 0 ));
+DATA(insert (	403		inet_ops			PGNSP PGUID 1974  869 t 0 ));
+DATA(insert (	405		inet_ops			PGNSP PGUID 1975  869 t 0 ));
+DATA(insert (	783		inet_ops			PGNSP PGUID 3550  869 f 0 ));
+DATA(insert OID = 1979 ( 403	int2_ops	PGNSP PGUID 1976   21 t 0 ));
+#define INT2_BTREE_OPS_OID 1979
+DATA(insert (	405		int2_ops			PGNSP PGUID 1977   21 t 0 ));
+DATA(insert OID = 1978 ( 403	int4_ops	PGNSP PGUID 1976   23 t 0 ));
+#define INT4_BTREE_OPS_OID 1978
+DATA(insert (	405		int4_ops			PGNSP PGUID 1977   23 t 0 ));
+DATA(insert OID = 3124 ( 403	int8_ops	PGNSP PGUID 1976   20 t 0 ));
+#define INT8_BTREE_OPS_OID 3124
+DATA(insert (	405		int8_ops			PGNSP PGUID 1977   20 t 0 ));
+DATA(insert (	403		interval_ops		PGNSP PGUID 1982 1186 t 0 ));
+DATA(insert (	405		interval_ops		PGNSP PGUID 1983 1186 t 0 ));
+DATA(insert (	403		macaddr_ops			PGNSP PGUID 1984  829 t 0 ));
+DATA(insert (	405		macaddr_ops			PGNSP PGUID 1985  829 t 0 ));
+/*
+ * Here's an ugly little hack to save space in the system catalog indexes.
+ * btree doesn't ordinarily allow a storage type different from input type;
+ * but cstring and name are the same thing except for trailing padding,
+ * and we can safely omit that within an index entry.  So we declare the
+ * btree opclass for name as using cstring storage type.
+ */
+DATA(insert (	403		name_ops			PGNSP PGUID 1986   19 t 2275 ));
+DATA(insert (	405		name_ops			PGNSP PGUID 1987   19 t 0 ));
+DATA(insert OID = 3125 ( 403	numeric_ops PGNSP PGUID 1988 1700 t 0 ));
+#define NUMERIC_BTREE_OPS_OID 3125
+DATA(insert (	405		numeric_ops			PGNSP PGUID 1998 1700 t 0 ));
+DATA(insert OID = 1981 ( 403	oid_ops		PGNSP PGUID 1989   26 t 0 ));
+#define OID_BTREE_OPS_OID 1981
+DATA(insert (	405		oid_ops				PGNSP PGUID 1990   26 t 0 ));
+DATA(insert (	403		oidvector_ops		PGNSP PGUID 1991   30 t 0 ));
+DATA(insert (	405		oidvector_ops		PGNSP PGUID 1992   30 t 0 ));
+DATA(insert (	403		record_ops			PGNSP PGUID 2994 2249 t 0 ));
+DATA(insert (	403		record_image_ops	PGNSP PGUID 3194 2249 f 0 ));
+DATA(insert OID = 3126 ( 403	text_ops	PGNSP PGUID 1994   25 t 0 ));
+#define TEXT_BTREE_OPS_OID 3126
+DATA(insert (	405		text_ops			PGNSP PGUID 1995   25 t 0 ));
+DATA(insert (	403		time_ops			PGNSP PGUID 1996 1083 t 0 ));
+DATA(insert (	405		time_ops			PGNSP PGUID 1997 1083 t 0 ));
+DATA(insert OID = 3127 ( 403	timestamptz_ops PGNSP PGUID  434 1184 t 0 ));
+#define TIMESTAMPTZ_BTREE_OPS_OID 3127
+DATA(insert (	405		timestamptz_ops		PGNSP PGUID 1999 1184 t 0 ));
+DATA(insert (	403		timetz_ops			PGNSP PGUID 2000 1266 t 0 ));
+DATA(insert (	405		timetz_ops			PGNSP PGUID 2001 1266 t 0 ));
+DATA(insert (	403		varbit_ops			PGNSP PGUID 2002 1562 t 0 ));
+DATA(insert (	403		varchar_ops			PGNSP PGUID 1994   25 f 0 ));
+DATA(insert (	405		varchar_ops			PGNSP PGUID 1995   25 f 0 ));
+DATA(insert OID = 3128 ( 403	timestamp_ops	PGNSP PGUID  434 1114 t 0 ));
+#define TIMESTAMP_BTREE_OPS_OID 3128
+DATA(insert (	405		timestamp_ops		PGNSP PGUID 2040 1114 t 0 ));
+DATA(insert (	403		text_pattern_ops	PGNSP PGUID 2095   25 f 0 ));
+DATA(insert (	403		varchar_pattern_ops PGNSP PGUID 2095   25 f 0 ));
+DATA(insert (	403		bpchar_pattern_ops	PGNSP PGUID 2097 1042 f 0 ));
+DATA(insert (	403		money_ops			PGNSP PGUID 2099  790 t 0 ));
+DATA(insert (	405		bool_ops			PGNSP PGUID 2222   16 t 0 ));
+DATA(insert (	405		bytea_ops			PGNSP PGUID 2223   17 t 0 ));
+DATA(insert (	405		int2vector_ops		PGNSP PGUID 2224   22 t 0 ));
+DATA(insert (	403		tid_ops				PGNSP PGUID 2789   27 t 0 ));
+DATA(insert (	405		xid_ops				PGNSP PGUID 2225   28 t 0 ));
+DATA(insert (	405		cid_ops				PGNSP PGUID 2226   29 t 0 ));
+DATA(insert (	405		abstime_ops			PGNSP PGUID 2227  702 t 0 ));
+DATA(insert (	405		reltime_ops			PGNSP PGUID 2228  703 t 0 ));
+DATA(insert (	405		text_pattern_ops	PGNSP PGUID 2229   25 f 0 ));
+DATA(insert (	405		varchar_pattern_ops PGNSP PGUID 2229   25 f 0 ));
+DATA(insert (	405		bpchar_pattern_ops	PGNSP PGUID 2231 1042 f 0 ));
+DATA(insert (	403		reltime_ops			PGNSP PGUID 2233  703 t 0 ));
+DATA(insert (	403		tinterval_ops		PGNSP PGUID 2234  704 t 0 ));
+DATA(insert (	405		aclitem_ops			PGNSP PGUID 2235 1033 t 0 ));
+DATA(insert (	783		box_ops				PGNSP PGUID 2593  603 t 0 ));
+DATA(insert (	783		point_ops			PGNSP PGUID 1029  600 t 603 ));
+DATA(insert (	783		poly_ops			PGNSP PGUID 2594  604 t 603 ));
+DATA(insert (	783		circle_ops			PGNSP PGUID 2595  718 t 603 ));
+DATA(insert (	2742	_int4_ops			PGNSP PGUID 2745  1007 t 23 ));
+DATA(insert (	2742	_text_ops			PGNSP PGUID 2745  1009 t 25 ));
+DATA(insert (	2742	_abstime_ops		PGNSP PGUID 2745  1023 t 702 ));
+DATA(insert (	2742	_bit_ops			PGNSP PGUID 2745  1561 t 1560 ));
+DATA(insert (	2742	_bool_ops			PGNSP PGUID 2745  1000 t 16 ));
+DATA(insert (	2742	_bpchar_ops			PGNSP PGUID 2745  1014 t 1042 ));
+DATA(insert (	2742	_bytea_ops			PGNSP PGUID 2745  1001 t 17 ));
+DATA(insert (	2742	_char_ops			PGNSP PGUID 2745  1002 t 18 ));
+DATA(insert (	2742	_cidr_ops			PGNSP PGUID 2745  651 t 650 ));
+DATA(insert (	2742	_date_ops			PGNSP PGUID 2745  1182 t 1082 ));
+DATA(insert (	2742	_float4_ops			PGNSP PGUID 2745  1021 t 700 ));
+DATA(insert (	2742	_float8_ops			PGNSP PGUID 2745  1022 t 701 ));
+DATA(insert (	2742	_inet_ops			PGNSP PGUID 2745  1041 t 869 ));
+DATA(insert (	2742	_int2_ops			PGNSP PGUID 2745  1005 t 21 ));
+DATA(insert (	2742	_int8_ops			PGNSP PGUID 2745  1016 t 20 ));
+DATA(insert (	2742	_interval_ops		PGNSP PGUID 2745  1187 t 1186 ));
+DATA(insert (	2742	_macaddr_ops		PGNSP PGUID 2745  1040 t 829 ));
+DATA(insert (	2742	_name_ops			PGNSP PGUID 2745  1003 t 19 ));
+DATA(insert (	2742	_numeric_ops		PGNSP PGUID 2745  1231 t 1700 ));
+DATA(insert (	2742	_oid_ops			PGNSP PGUID 2745  1028 t 26 ));
+DATA(insert (	2742	_oidvector_ops		PGNSP PGUID 2745  1013 t 30 ));
+DATA(insert (	2742	_time_ops			PGNSP PGUID 2745  1183 t 1083 ));
+DATA(insert (	2742	_timestamptz_ops	PGNSP PGUID 2745  1185 t 1184 ));
+DATA(insert (	2742	_timetz_ops			PGNSP PGUID 2745  1270 t 1266 ));
+DATA(insert (	2742	_varbit_ops			PGNSP PGUID 2745  1563 t 1562 ));
+DATA(insert (	2742	_varchar_ops		PGNSP PGUID 2745  1015 t 1043 ));
+DATA(insert (	2742	_timestamp_ops		PGNSP PGUID 2745  1115 t 1114 ));
+DATA(insert (	2742	_money_ops			PGNSP PGUID 2745  791 t 790 ));
+DATA(insert (	2742	_reltime_ops		PGNSP PGUID 2745  1024 t 703 ));
+DATA(insert (	2742	_tinterval_ops		PGNSP PGUID 2745  1025 t 704 ));
+DATA(insert (	403		uuid_ops			PGNSP PGUID 2968  2950 t 0 ));
+DATA(insert (	405		uuid_ops			PGNSP PGUID 2969  2950 t 0 ));
+DATA(insert (	403		pg_lsn_ops			PGNSP PGUID 3253  3220 t 0 ));
+DATA(insert (	405		pg_lsn_ops			PGNSP PGUID 3254  3220 t 0 ));
+DATA(insert (	403		enum_ops			PGNSP PGUID 3522  3500 t 0 ));
+DATA(insert (	405		enum_ops			PGNSP PGUID 3523  3500 t 0 ));
+DATA(insert (	403		tsvector_ops		PGNSP PGUID 3626  3614 t 0 ));
+DATA(insert (	783		tsvector_ops		PGNSP PGUID 3655  3614 t 3642 ));
+DATA(insert (	2742	tsvector_ops		PGNSP PGUID 3659  3614 t 25 ));
+DATA(insert (	403		tsquery_ops			PGNSP PGUID 3683  3615 t 0 ));
+DATA(insert (	783		tsquery_ops			PGNSP PGUID 3702  3615 t 20 ));
+DATA(insert (	403		range_ops			PGNSP PGUID 3901  3831 t 0 ));
+DATA(insert (	405		range_ops			PGNSP PGUID 3903  3831 t 0 ));
+DATA(insert (	783		range_ops			PGNSP PGUID 3919  3831 t 0 ));
+DATA(insert (	4000	range_ops			PGNSP PGUID 3474  3831 t 0 ));
+DATA(insert (	4000	quad_point_ops		PGNSP PGUID 4015  600 t 0 ));
+DATA(insert (	4000	kd_point_ops		PGNSP PGUID 4016  600 f 0 ));
+DATA(insert (	4000	text_ops			PGNSP PGUID 4017  25 t 0 ));
+DATA(insert (	403		jsonb_ops			PGNSP PGUID 4033  3802 t 0 ));
+DATA(insert (	405		jsonb_ops			PGNSP PGUID 4034  3802 t 0 ));
+DATA(insert (	2742	jsonb_ops			PGNSP PGUID 4036  3802 t 25 ));
+DATA(insert (	2742	jsonb_path_ops		PGNSP PGUID 4037  3802 f 23 ));
+
+/* BRIN operator classes */
+/* no brin opclass for bool */
+DATA(insert (	3580	bytea_minmax_ops		PGNSP PGUID 4064	17 t 17 ));
+DATA(insert (	3580	char_minmax_ops			PGNSP PGUID 4062	18 t 18 ));
+DATA(insert (	3580	name_minmax_ops			PGNSP PGUID 4065	19 t 19 ));
+DATA(insert (	3580	int8_minmax_ops			PGNSP PGUID 4054	20 t 20 ));
+DATA(insert (	3580	int2_minmax_ops			PGNSP PGUID 4054	21 t 21 ));
+DATA(insert (	3580	int4_minmax_ops			PGNSP PGUID 4054	23 t 23 ));
+DATA(insert (	3580	text_minmax_ops			PGNSP PGUID 4056	25 t 25 ));
+DATA(insert (	3580	oid_minmax_ops			PGNSP PGUID 4068	26 t 26 ));
+DATA(insert (	3580	tid_minmax_ops			PGNSP PGUID 4069	27 t 27 ));
+DATA(insert (	3580	float4_minmax_ops		PGNSP PGUID 4070   700 t 700 ));
+DATA(insert (	3580	float8_minmax_ops		PGNSP PGUID 4070   701 t 701 ));
+DATA(insert (	3580	abstime_minmax_ops		PGNSP PGUID 4072   702 t 702 ));
+DATA(insert (	3580	reltime_minmax_ops		PGNSP PGUID 4073   703 t 703 ));
+DATA(insert (	3580	macaddr_minmax_ops		PGNSP PGUID 4074   829 t 829 ));
+DATA(insert (	3580	inet_minmax_ops			PGNSP PGUID 4075   869 f 869 ));
+DATA(insert (	3580	inet_inclusion_ops		PGNSP PGUID 4102   869 t 869 ));
+DATA(insert (	3580	bpchar_minmax_ops		PGNSP PGUID 4076  1042 t 1042 ));
+DATA(insert (	3580	time_minmax_ops			PGNSP PGUID 4077  1083 t 1083 ));
+DATA(insert (	3580	date_minmax_ops			PGNSP PGUID 4059  1082 t 1082 ));
+DATA(insert (	3580	timestamp_minmax_ops	PGNSP PGUID 4059  1114 t 1114 ));
+DATA(insert (	3580	timestamptz_minmax_ops	PGNSP PGUID 4059  1184 t 1184 ));
+DATA(insert (	3580	interval_minmax_ops		PGNSP PGUID 4078  1186 t 1186 ));
+DATA(insert (	3580	timetz_minmax_ops		PGNSP PGUID 4058  1266 t 1266 ));
+DATA(insert (	3580	bit_minmax_ops			PGNSP PGUID 4079  1560 t 1560 ));
+DATA(insert (	3580	varbit_minmax_ops		PGNSP PGUID 4080  1562 t 1562 ));
+DATA(insert (	3580	numeric_minmax_ops		PGNSP PGUID 4055  1700 t 1700 ));
+/* no brin opclass for record, anyarray */
+DATA(insert (	3580	uuid_minmax_ops			PGNSP PGUID 4081  2950 t 2950 ));
+DATA(insert (	3580	range_inclusion_ops		PGNSP PGUID 4103  3831 t 3831 ));
+DATA(insert (	3580	pg_lsn_minmax_ops		PGNSP PGUID 4082  3220 t 3220 ));
+/* no brin opclass for enum, tsvector, tsquery, jsonb */
+DATA(insert (	3580	box_inclusion_ops		PGNSP PGUID 4104   603 t 603 ));
+/* no brin opclass for the geometric types except box */
+
+#endif   /* PG_OPCLASS_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_operator.h b/foreign/libpg_query/src/postgres/include/catalog/pg_operator.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_operator.h
@@ -0,0 +1,1823 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_operator.h
+ *	  definition of the system "operator" relation (pg_operator)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_operator.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *	  XXX do NOT break up DATA() statements into multiple lines!
+ *		  the scripts are not as smart as you might think...
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_OPERATOR_H
+#define PG_OPERATOR_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_operator definition.  cpp turns this into
+ *		typedef struct FormData_pg_operator
+ * ----------------
+ */
+#define OperatorRelationId	2617
+
+CATALOG(pg_operator,2617)
+{
+	NameData	oprname;		/* name of operator */
+	Oid			oprnamespace;	/* OID of namespace containing this oper */
+	Oid			oprowner;		/* operator owner */
+	char		oprkind;		/* 'l', 'r', or 'b' */
+	bool		oprcanmerge;	/* can be used in merge join? */
+	bool		oprcanhash;		/* can be used in hash join? */
+	Oid			oprleft;		/* left arg type, or 0 if 'l' oprkind */
+	Oid			oprright;		/* right arg type, or 0 if 'r' oprkind */
+	Oid			oprresult;		/* result datatype */
+	Oid			oprcom;			/* OID of commutator oper, or 0 if none */
+	Oid			oprnegate;		/* OID of negator oper, or 0 if none */
+	regproc		oprcode;		/* OID of underlying function */
+	regproc		oprrest;		/* OID of restriction estimator, or 0 */
+	regproc		oprjoin;		/* OID of join estimator, or 0 */
+} FormData_pg_operator;
+
+/* ----------------
+ *		Form_pg_operator corresponds to a pointer to a tuple with
+ *		the format of pg_operator relation.
+ * ----------------
+ */
+typedef FormData_pg_operator *Form_pg_operator;
+
+/* ----------------
+ *		compiler constants for pg_operator
+ * ----------------
+ */
+
+#define Natts_pg_operator				14
+#define Anum_pg_operator_oprname		1
+#define Anum_pg_operator_oprnamespace	2
+#define Anum_pg_operator_oprowner		3
+#define Anum_pg_operator_oprkind		4
+#define Anum_pg_operator_oprcanmerge	5
+#define Anum_pg_operator_oprcanhash		6
+#define Anum_pg_operator_oprleft		7
+#define Anum_pg_operator_oprright		8
+#define Anum_pg_operator_oprresult		9
+#define Anum_pg_operator_oprcom			10
+#define Anum_pg_operator_oprnegate		11
+#define Anum_pg_operator_oprcode		12
+#define Anum_pg_operator_oprrest		13
+#define Anum_pg_operator_oprjoin		14
+
+/* ----------------
+ *		initial contents of pg_operator
+ * ----------------
+ */
+
+/*
+ * Note: every entry in pg_operator.h is expected to have a DESCR() comment.
+ * If the operator is a deprecated equivalent of some other entry, be sure
+ * to comment it as such so that initdb doesn't think it's a preferred name
+ * for the underlying function.
+ */
+
+DATA(insert OID =  15 ( "="		   PGNSP PGUID b t t	23	20	16 416	36 int48eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID =  36 ( "<>"	   PGNSP PGUID b f f	23	20	16 417	15 int48ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID =  37 ( "<"		   PGNSP PGUID b f f	23	20	16 419	82 int48lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID =  76 ( ">"		   PGNSP PGUID b f f	23	20	16 418	80 int48gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID =  80 ( "<="	   PGNSP PGUID b f f	23	20	16 430	76 int48le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID =  82 ( ">="	   PGNSP PGUID b f f	23	20	16 420	37 int48ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+DATA(insert OID =  58 ( "<"		   PGNSP PGUID b f f	16	16	16	59	1695 boollt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID =  59 ( ">"		   PGNSP PGUID b f f	16	16	16	58	1694 boolgt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID =  85 ( "<>"	   PGNSP PGUID b f f	16	16	16	85	91 boolne neqsel neqjoinsel ));
+DESCR("not equal");
+#define BooleanNotEqualOperator   85
+DATA(insert OID =  91 ( "="		   PGNSP PGUID b t t	16	16	16	91	85 booleq eqsel eqjoinsel ));
+DESCR("equal");
+#define BooleanEqualOperator   91
+DATA(insert OID = 1694 (  "<="	   PGNSP PGUID b f f	16	16	16 1695 59 boolle scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1695 (  ">="	   PGNSP PGUID b f f	16	16	16 1694 58 boolge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+DATA(insert OID =  92 ( "="		   PGNSP PGUID b t t	18	18	16	92 630 chareq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID =  93 ( "="		   PGNSP PGUID b t t	19	19	16	93 643 nameeq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID =  94 ( "="		   PGNSP PGUID b t t	21	21	16	94 519 int2eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID =  95 ( "<"		   PGNSP PGUID b f f	21	21	16 520 524 int2lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID =  96 ( "="		   PGNSP PGUID b t t	23	23	16	96 518 int4eq eqsel eqjoinsel ));
+DESCR("equal");
+#define Int4EqualOperator	96
+DATA(insert OID =  97 ( "<"		   PGNSP PGUID b f f	23	23	16 521 525 int4lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+#define Int4LessOperator	97
+DATA(insert OID =  98 ( "="		   PGNSP PGUID b t t	25	25	16	98 531 texteq eqsel eqjoinsel ));
+DESCR("equal");
+#define TextEqualOperator	98
+
+DATA(insert OID = 349 (  "||"	   PGNSP PGUID b f f 2277 2283 2277 0 0 array_append   -	   -	 ));
+DESCR("append element onto end of array");
+DATA(insert OID = 374 (  "||"	   PGNSP PGUID b f f 2283 2277 2277 0 0 array_prepend  -	   -	 ));
+DESCR("prepend element onto front of array");
+DATA(insert OID = 375 (  "||"	   PGNSP PGUID b f f 2277 2277 2277 0 0 array_cat	   -	   -	 ));
+DESCR("concatenate");
+
+DATA(insert OID = 352 (  "="	   PGNSP PGUID b f t	28	28	16 352	 0 xideq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 353 (  "="	   PGNSP PGUID b f f	28	23	16	 0	 0 xideqint4 eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 388 (  "!"	   PGNSP PGUID r f f	20	 0	1700  0  0 numeric_fac - - ));
+DESCR("factorial");
+DATA(insert OID = 389 (  "!!"	   PGNSP PGUID l f f	 0	20	1700  0  0 numeric_fac - - ));
+DESCR("deprecated, use ! instead");
+DATA(insert OID = 385 (  "="	   PGNSP PGUID b f t	29	29	16 385	 0 cideq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 386 (  "="	   PGNSP PGUID b f t	22	22	16 386	 0 int2vectoreq eqsel eqjoinsel ));
+DESCR("equal");
+
+DATA(insert OID = 387 (  "="	   PGNSP PGUID b t f	27	27	16 387 402 tideq eqsel eqjoinsel ));
+DESCR("equal");
+#define TIDEqualOperator   387
+DATA(insert OID = 402 (  "<>"	   PGNSP PGUID b f f	27	27	16 402 387 tidne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 2799 (  "<"	   PGNSP PGUID b f f	27	27	16 2800 2802 tidlt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+#define TIDLessOperator    2799
+DATA(insert OID = 2800 (  ">"	   PGNSP PGUID b f f	27	27	16 2799 2801 tidgt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 2801 (  "<="	   PGNSP PGUID b f f	27	27	16 2802 2800 tidle scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 2802 (  ">="	   PGNSP PGUID b f f	27	27	16 2801 2799 tidge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+DATA(insert OID = 410 ( "="		   PGNSP PGUID b t t	20	20	16 410 411 int8eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 411 ( "<>"	   PGNSP PGUID b f f	20	20	16 411 410 int8ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 412 ( "<"		   PGNSP PGUID b f f	20	20	16 413 415 int8lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+#define Int8LessOperator	412
+DATA(insert OID = 413 ( ">"		   PGNSP PGUID b f f	20	20	16 412 414 int8gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 414 ( "<="	   PGNSP PGUID b f f	20	20	16 415 413 int8le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 415 ( ">="	   PGNSP PGUID b f f	20	20	16 414 412 int8ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+DATA(insert OID = 416 ( "="		   PGNSP PGUID b t t	20	23	16	15 417 int84eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 417 ( "<>"	   PGNSP PGUID b f f	20	23	16	36 416 int84ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 418 ( "<"		   PGNSP PGUID b f f	20	23	16	76 430 int84lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 419 ( ">"		   PGNSP PGUID b f f	20	23	16	37 420 int84gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 420 ( "<="	   PGNSP PGUID b f f	20	23	16	82 419 int84le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 430 ( ">="	   PGNSP PGUID b f f	20	23	16	80 418 int84ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 439 (  "%"	   PGNSP PGUID b f f	20	20	20	 0	 0 int8mod - - ));
+DESCR("modulus");
+DATA(insert OID = 473 (  "@"	   PGNSP PGUID l f f	 0	20	20	 0	 0 int8abs - - ));
+DESCR("absolute value");
+
+DATA(insert OID = 484 (  "-"	   PGNSP PGUID l f f	 0	20	20	 0	 0 int8um - - ));
+DESCR("negate");
+DATA(insert OID = 485 (  "<<"	   PGNSP PGUID b f f 604 604	16	 0	 0 poly_left positionsel positionjoinsel ));
+DESCR("is left of");
+DATA(insert OID = 486 (  "&<"	   PGNSP PGUID b f f 604 604	16	 0	 0 poly_overleft positionsel positionjoinsel ));
+DESCR("overlaps or is left of");
+DATA(insert OID = 487 (  "&>"	   PGNSP PGUID b f f 604 604	16	 0	 0 poly_overright positionsel positionjoinsel ));
+DESCR("overlaps or is right of");
+DATA(insert OID = 488 (  ">>"	   PGNSP PGUID b f f 604 604	16	 0	 0 poly_right positionsel positionjoinsel ));
+DESCR("is right of");
+DATA(insert OID = 489 (  "<@"	   PGNSP PGUID b f f 604 604	16 490	 0 poly_contained contsel contjoinsel ));
+DESCR("is contained by");
+DATA(insert OID = 490 (  "@>"	   PGNSP PGUID b f f 604 604	16 489	 0 poly_contain contsel contjoinsel ));
+DESCR("contains");
+DATA(insert OID = 491 (  "~="	   PGNSP PGUID b f f 604 604	16 491	 0 poly_same eqsel eqjoinsel ));
+DESCR("same as");
+DATA(insert OID = 492 (  "&&"	   PGNSP PGUID b f f 604 604	16 492	 0 poly_overlap areasel areajoinsel ));
+DESCR("overlaps");
+DATA(insert OID = 493 (  "<<"	   PGNSP PGUID b f f 603 603	16	 0	 0 box_left positionsel positionjoinsel ));
+DESCR("is left of");
+DATA(insert OID = 494 (  "&<"	   PGNSP PGUID b f f 603 603	16	 0	 0 box_overleft positionsel positionjoinsel ));
+DESCR("overlaps or is left of");
+DATA(insert OID = 495 (  "&>"	   PGNSP PGUID b f f 603 603	16	 0	 0 box_overright positionsel positionjoinsel ));
+DESCR("overlaps or is right of");
+DATA(insert OID = 496 (  ">>"	   PGNSP PGUID b f f 603 603	16	 0	 0 box_right positionsel positionjoinsel ));
+DESCR("is right of");
+DATA(insert OID = 497 (  "<@"	   PGNSP PGUID b f f 603 603	16 498	 0 box_contained contsel contjoinsel ));
+DESCR("is contained by");
+DATA(insert OID = 498 (  "@>"	   PGNSP PGUID b f f 603 603	16 497	 0 box_contain contsel contjoinsel ));
+DESCR("contains");
+DATA(insert OID = 499 (  "~="	   PGNSP PGUID b f f 603 603	16 499	 0 box_same eqsel eqjoinsel ));
+DESCR("same as");
+DATA(insert OID = 500 (  "&&"	   PGNSP PGUID b f f 603 603	16 500	 0 box_overlap areasel areajoinsel ));
+DESCR("overlaps");
+DATA(insert OID = 501 (  ">="	   PGNSP PGUID b f f 603 603	16 505 504 box_ge areasel areajoinsel ));
+DESCR("greater than or equal by area");
+DATA(insert OID = 502 (  ">"	   PGNSP PGUID b f f 603 603	16 504 505 box_gt areasel areajoinsel ));
+DESCR("greater than by area");
+DATA(insert OID = 503 (  "="	   PGNSP PGUID b f f 603 603	16 503	 0 box_eq eqsel eqjoinsel ));
+DESCR("equal by area");
+DATA(insert OID = 504 (  "<"	   PGNSP PGUID b f f 603 603	16 502 501 box_lt areasel areajoinsel ));
+DESCR("less than by area");
+DATA(insert OID = 505 (  "<="	   PGNSP PGUID b f f 603 603	16 501 502 box_le areasel areajoinsel ));
+DESCR("less than or equal by area");
+DATA(insert OID = 506 (  ">^"	   PGNSP PGUID b f f 600 600	16	 0	 0 point_above positionsel positionjoinsel ));
+DESCR("is above");
+DATA(insert OID = 507 (  "<<"	   PGNSP PGUID b f f 600 600	16	 0	 0 point_left positionsel positionjoinsel ));
+DESCR("is left of");
+DATA(insert OID = 508 (  ">>"	   PGNSP PGUID b f f 600 600	16	 0	 0 point_right positionsel positionjoinsel ));
+DESCR("is right of");
+DATA(insert OID = 509 (  "<^"	   PGNSP PGUID b f f 600 600	16	 0	 0 point_below positionsel positionjoinsel ));
+DESCR("is below");
+DATA(insert OID = 510 (  "~="	   PGNSP PGUID b f f 600 600	16 510 713 point_eq eqsel eqjoinsel ));
+DESCR("same as");
+DATA(insert OID = 511 (  "<@"	   PGNSP PGUID b f f 600 603	16 433	 0 on_pb contsel contjoinsel ));
+DESCR("point inside box");
+DATA(insert OID = 433 (  "@>"	   PGNSP PGUID b f f 603 600	16 511	 0 box_contain_pt contsel contjoinsel ));
+DESCR("contains");
+DATA(insert OID = 512 (  "<@"	   PGNSP PGUID b f f 600 602	16 755	 0 on_ppath - - ));
+DESCR("point within closed path, or point on open path");
+DATA(insert OID = 513 (  "@@"	   PGNSP PGUID l f f	 0 603 600	 0	 0 box_center - - ));
+DESCR("center of");
+DATA(insert OID = 514 (  "*"	   PGNSP PGUID b f f	23	23	23 514	 0 int4mul - - ));
+DESCR("multiply");
+DATA(insert OID = 517 (  "<->"	   PGNSP PGUID b f f 600 600 701 517	 0 point_distance - - ));
+DESCR("distance between");
+DATA(insert OID = 518 (  "<>"	   PGNSP PGUID b f f	23	23	16 518	96 int4ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 519 (  "<>"	   PGNSP PGUID b f f	21	21	16 519	94 int2ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 520 (  ">"	   PGNSP PGUID b f f	21	21	16	95 522 int2gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 521 (  ">"	   PGNSP PGUID b f f	23	23	16	97 523 int4gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 522 (  "<="	   PGNSP PGUID b f f	21	21	16 524 520 int2le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 523 (  "<="	   PGNSP PGUID b f f	23	23	16 525 521 int4le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 524 (  ">="	   PGNSP PGUID b f f	21	21	16 522	95 int2ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 525 (  ">="	   PGNSP PGUID b f f	23	23	16 523	97 int4ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 526 (  "*"	   PGNSP PGUID b f f	21	21	21 526	 0 int2mul - - ));
+DESCR("multiply");
+DATA(insert OID = 527 (  "/"	   PGNSP PGUID b f f	21	21	21	 0	 0 int2div - - ));
+DESCR("divide");
+DATA(insert OID = 528 (  "/"	   PGNSP PGUID b f f	23	23	23	 0	 0 int4div - - ));
+DESCR("divide");
+DATA(insert OID = 529 (  "%"	   PGNSP PGUID b f f	21	21	21	 0	 0 int2mod - - ));
+DESCR("modulus");
+DATA(insert OID = 530 (  "%"	   PGNSP PGUID b f f	23	23	23	 0	 0 int4mod - - ));
+DESCR("modulus");
+DATA(insert OID = 531 (  "<>"	   PGNSP PGUID b f f	25	25	16 531	98 textne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 532 (  "="	   PGNSP PGUID b t t	21	23	16 533 538 int24eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 533 (  "="	   PGNSP PGUID b t t	23	21	16 532 539 int42eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 534 (  "<"	   PGNSP PGUID b f f	21	23	16 537 542 int24lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 535 (  "<"	   PGNSP PGUID b f f	23	21	16 536 543 int42lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 536 (  ">"	   PGNSP PGUID b f f	21	23	16 535 540 int24gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 537 (  ">"	   PGNSP PGUID b f f	23	21	16 534 541 int42gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 538 (  "<>"	   PGNSP PGUID b f f	21	23	16 539 532 int24ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 539 (  "<>"	   PGNSP PGUID b f f	23	21	16 538 533 int42ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 540 (  "<="	   PGNSP PGUID b f f	21	23	16 543 536 int24le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 541 (  "<="	   PGNSP PGUID b f f	23	21	16 542 537 int42le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 542 (  ">="	   PGNSP PGUID b f f	21	23	16 541 534 int24ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 543 (  ">="	   PGNSP PGUID b f f	23	21	16 540 535 int42ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 544 (  "*"	   PGNSP PGUID b f f	21	23	23 545	 0 int24mul - - ));
+DESCR("multiply");
+DATA(insert OID = 545 (  "*"	   PGNSP PGUID b f f	23	21	23 544	 0 int42mul - - ));
+DESCR("multiply");
+DATA(insert OID = 546 (  "/"	   PGNSP PGUID b f f	21	23	23	 0	 0 int24div - - ));
+DESCR("divide");
+DATA(insert OID = 547 (  "/"	   PGNSP PGUID b f f	23	21	23	 0	 0 int42div - - ));
+DESCR("divide");
+DATA(insert OID = 550 (  "+"	   PGNSP PGUID b f f	21	21	21 550	 0 int2pl - - ));
+DESCR("add");
+DATA(insert OID = 551 (  "+"	   PGNSP PGUID b f f	23	23	23 551	 0 int4pl - - ));
+DESCR("add");
+DATA(insert OID = 552 (  "+"	   PGNSP PGUID b f f	21	23	23 553	 0 int24pl - - ));
+DESCR("add");
+DATA(insert OID = 553 (  "+"	   PGNSP PGUID b f f	23	21	23 552	 0 int42pl - - ));
+DESCR("add");
+DATA(insert OID = 554 (  "-"	   PGNSP PGUID b f f	21	21	21	 0	 0 int2mi - - ));
+DESCR("subtract");
+DATA(insert OID = 555 (  "-"	   PGNSP PGUID b f f	23	23	23	 0	 0 int4mi - - ));
+DESCR("subtract");
+DATA(insert OID = 556 (  "-"	   PGNSP PGUID b f f	21	23	23	 0	 0 int24mi - - ));
+DESCR("subtract");
+DATA(insert OID = 557 (  "-"	   PGNSP PGUID b f f	23	21	23	 0	 0 int42mi - - ));
+DESCR("subtract");
+DATA(insert OID = 558 (  "-"	   PGNSP PGUID l f f	 0	23	23	 0	 0 int4um - - ));
+DESCR("negate");
+DATA(insert OID = 559 (  "-"	   PGNSP PGUID l f f	 0	21	21	 0	 0 int2um - - ));
+DESCR("negate");
+DATA(insert OID = 560 (  "="	   PGNSP PGUID b t t 702 702	16 560 561 abstimeeq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 561 (  "<>"	   PGNSP PGUID b f f 702 702	16 561 560 abstimene neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 562 (  "<"	   PGNSP PGUID b f f 702 702	16 563 565 abstimelt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 563 (  ">"	   PGNSP PGUID b f f 702 702	16 562 564 abstimegt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 564 (  "<="	   PGNSP PGUID b f f 702 702	16 565 563 abstimele scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 565 (  ">="	   PGNSP PGUID b f f 702 702	16 564 562 abstimege scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 566 (  "="	   PGNSP PGUID b t t 703 703	16 566 567 reltimeeq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 567 (  "<>"	   PGNSP PGUID b f f 703 703	16 567 566 reltimene neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 568 (  "<"	   PGNSP PGUID b f f 703 703	16 569 571 reltimelt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 569 (  ">"	   PGNSP PGUID b f f 703 703	16 568 570 reltimegt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 570 (  "<="	   PGNSP PGUID b f f 703 703	16 571 569 reltimele scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 571 (  ">="	   PGNSP PGUID b f f 703 703	16 570 568 reltimege scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 572 (  "~="	   PGNSP PGUID b f f 704 704	16 572	 0 tintervalsame eqsel eqjoinsel ));
+DESCR("same as");
+DATA(insert OID = 573 (  "<<"	   PGNSP PGUID b f f 704 704	16	 0	 0 tintervalct - - ));
+DESCR("contains");
+DATA(insert OID = 574 (  "&&"	   PGNSP PGUID b f f 704 704	16 574	 0 tintervalov - - ));
+DESCR("overlaps");
+DATA(insert OID = 575 (  "#="	   PGNSP PGUID b f f 704 703	16	 0 576 tintervalleneq - - ));
+DESCR("equal by length");
+DATA(insert OID = 576 (  "#<>"	   PGNSP PGUID b f f 704 703	16	 0 575 tintervallenne - - ));
+DESCR("not equal by length");
+DATA(insert OID = 577 (  "#<"	   PGNSP PGUID b f f 704 703	16	 0 580 tintervallenlt - - ));
+DESCR("less than by length");
+DATA(insert OID = 578 (  "#>"	   PGNSP PGUID b f f 704 703	16	 0 579 tintervallengt - - ));
+DESCR("greater than by length");
+DATA(insert OID = 579 (  "#<="	   PGNSP PGUID b f f 704 703	16	 0 578 tintervallenle - - ));
+DESCR("less than or equal by length");
+DATA(insert OID = 580 (  "#>="	   PGNSP PGUID b f f 704 703	16	 0 577 tintervallenge - - ));
+DESCR("greater than or equal by length");
+DATA(insert OID = 581 (  "+"	   PGNSP PGUID b f f 702 703 702	 0	 0 timepl - - ));
+DESCR("add");
+DATA(insert OID = 582 (  "-"	   PGNSP PGUID b f f 702 703 702	 0	 0 timemi - - ));
+DESCR("subtract");
+DATA(insert OID = 583 (  "<?>"	   PGNSP PGUID b f f 702 704	16	 0	 0 intinterval - - ));
+DESCR("is contained by");
+DATA(insert OID = 584 (  "-"	   PGNSP PGUID l f f	 0 700 700	 0	 0 float4um - - ));
+DESCR("negate");
+DATA(insert OID = 585 (  "-"	   PGNSP PGUID l f f	 0 701 701	 0	 0 float8um - - ));
+DESCR("negate");
+DATA(insert OID = 586 (  "+"	   PGNSP PGUID b f f 700 700 700 586	 0 float4pl - - ));
+DESCR("add");
+DATA(insert OID = 587 (  "-"	   PGNSP PGUID b f f 700 700 700	 0	 0 float4mi - - ));
+DESCR("subtract");
+DATA(insert OID = 588 (  "/"	   PGNSP PGUID b f f 700 700 700	 0	 0 float4div - - ));
+DESCR("divide");
+DATA(insert OID = 589 (  "*"	   PGNSP PGUID b f f 700 700 700 589	 0 float4mul - - ));
+DESCR("multiply");
+DATA(insert OID = 590 (  "@"	   PGNSP PGUID l f f	 0 700 700	 0	 0 float4abs - - ));
+DESCR("absolute value");
+DATA(insert OID = 591 (  "+"	   PGNSP PGUID b f f 701 701 701 591	 0 float8pl - - ));
+DESCR("add");
+DATA(insert OID = 592 (  "-"	   PGNSP PGUID b f f 701 701 701	 0	 0 float8mi - - ));
+DESCR("subtract");
+DATA(insert OID = 593 (  "/"	   PGNSP PGUID b f f 701 701 701	 0	 0 float8div - - ));
+DESCR("divide");
+DATA(insert OID = 594 (  "*"	   PGNSP PGUID b f f 701 701 701 594	 0 float8mul - - ));
+DESCR("multiply");
+DATA(insert OID = 595 (  "@"	   PGNSP PGUID l f f	 0 701 701	 0	 0 float8abs - - ));
+DESCR("absolute value");
+DATA(insert OID = 596 (  "|/"	   PGNSP PGUID l f f	 0 701 701	 0	 0 dsqrt - - ));
+DESCR("square root");
+DATA(insert OID = 597 (  "||/"	   PGNSP PGUID l f f	 0 701 701	 0	 0 dcbrt - - ));
+DESCR("cube root");
+DATA(insert OID = 1284 (  "|"	   PGNSP PGUID l f f	 0 704 702	 0	 0 tintervalstart - - ));
+DESCR("start of interval");
+DATA(insert OID = 606 (  "<#>"	   PGNSP PGUID b f f 702 702 704	 0	 0 mktinterval - - ));
+DESCR("convert to tinterval");
+
+DATA(insert OID = 607 (  "="	   PGNSP PGUID b t t	26	26	16 607 608 oideq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 608 (  "<>"	   PGNSP PGUID b f f	26	26	16 608 607 oidne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 609 (  "<"	   PGNSP PGUID b f f	26	26	16 610 612 oidlt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 610 (  ">"	   PGNSP PGUID b f f	26	26	16 609 611 oidgt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 611 (  "<="	   PGNSP PGUID b f f	26	26	16 612 610 oidle scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 612 (  ">="	   PGNSP PGUID b f f	26	26	16 611 609 oidge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+DATA(insert OID = 644 (  "<>"	   PGNSP PGUID b f f	30	30	16 644 649 oidvectorne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 645 (  "<"	   PGNSP PGUID b f f	30	30	16 646 648 oidvectorlt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 646 (  ">"	   PGNSP PGUID b f f	30	30	16 645 647 oidvectorgt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 647 (  "<="	   PGNSP PGUID b f f	30	30	16 648 646 oidvectorle scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 648 (  ">="	   PGNSP PGUID b f f	30	30	16 647 645 oidvectorge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 649 (  "="	   PGNSP PGUID b t t	30	30	16 649 644 oidvectoreq eqsel eqjoinsel ));
+DESCR("equal");
+
+DATA(insert OID = 613 (  "<->"	   PGNSP PGUID b f f 600 628 701	 0	 0 dist_pl - - ));
+DESCR("distance between");
+DATA(insert OID = 614 (  "<->"	   PGNSP PGUID b f f 600 601 701	 0	 0 dist_ps - - ));
+DESCR("distance between");
+DATA(insert OID = 615 (  "<->"	   PGNSP PGUID b f f 600 603 701	 0	 0 dist_pb - - ));
+DESCR("distance between");
+DATA(insert OID = 616 (  "<->"	   PGNSP PGUID b f f 601 628 701	 0	 0 dist_sl - - ));
+DESCR("distance between");
+DATA(insert OID = 617 (  "<->"	   PGNSP PGUID b f f 601 603 701	 0	 0 dist_sb - - ));
+DESCR("distance between");
+DATA(insert OID = 618 (  "<->"	   PGNSP PGUID b f f 600 602 701	 0	 0 dist_ppath - - ));
+DESCR("distance between");
+
+DATA(insert OID = 620 (  "="	   PGNSP PGUID b t t	700  700	16 620 621 float4eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 621 (  "<>"	   PGNSP PGUID b f f	700  700	16 621 620 float4ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 622 (  "<"	   PGNSP PGUID b f f	700  700	16 623 625 float4lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 623 (  ">"	   PGNSP PGUID b f f	700  700	16 622 624 float4gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 624 (  "<="	   PGNSP PGUID b f f	700  700	16 625 623 float4le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 625 (  ">="	   PGNSP PGUID b f f	700  700	16 624 622 float4ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 630 (  "<>"	   PGNSP PGUID b f f	18	18		16 630	92	charne neqsel neqjoinsel ));
+DESCR("not equal");
+
+DATA(insert OID = 631 (  "<"	   PGNSP PGUID b f f	18	18	16 633 634 charlt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 632 (  "<="	   PGNSP PGUID b f f	18	18	16 634 633 charle scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 633 (  ">"	   PGNSP PGUID b f f	18	18	16 631 632 chargt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 634 (  ">="	   PGNSP PGUID b f f	18	18	16 632 631 charge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+DATA(insert OID = 639 (  "~"	   PGNSP PGUID b f f	19	25	16 0 640 nameregexeq regexeqsel regexeqjoinsel ));
+DESCR("matches regular expression, case-sensitive");
+#define OID_NAME_REGEXEQ_OP		639
+DATA(insert OID = 640 (  "!~"	   PGNSP PGUID b f f	19	25	16 0 639 nameregexne regexnesel regexnejoinsel ));
+DESCR("does not match regular expression, case-sensitive");
+DATA(insert OID = 641 (  "~"	   PGNSP PGUID b f f	25	25	16 0 642 textregexeq regexeqsel regexeqjoinsel ));
+DESCR("matches regular expression, case-sensitive");
+#define OID_TEXT_REGEXEQ_OP		641
+DATA(insert OID = 642 (  "!~"	   PGNSP PGUID b f f	25	25	16 0 641 textregexne regexnesel regexnejoinsel ));
+DESCR("does not match regular expression, case-sensitive");
+DATA(insert OID = 643 (  "<>"	   PGNSP PGUID b f f	19	19	16 643 93 namene neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 654 (  "||"	   PGNSP PGUID b f f	25	25	25	 0 0 textcat - - ));
+DESCR("concatenate");
+
+DATA(insert OID = 660 (  "<"	   PGNSP PGUID b f f	19	19	16 662 663 namelt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 661 (  "<="	   PGNSP PGUID b f f	19	19	16 663 662 namele scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 662 (  ">"	   PGNSP PGUID b f f	19	19	16 660 661 namegt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 663 (  ">="	   PGNSP PGUID b f f	19	19	16 661 660 namege scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 664 (  "<"	   PGNSP PGUID b f f	25	25	16 666 667 text_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 665 (  "<="	   PGNSP PGUID b f f	25	25	16 667 666 text_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 666 (  ">"	   PGNSP PGUID b f f	25	25	16 664 665 text_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 667 (  ">="	   PGNSP PGUID b f f	25	25	16 665 664 text_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+DATA(insert OID = 670 (  "="	   PGNSP PGUID b t t	701  701	16 670 671 float8eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 671 (  "<>"	   PGNSP PGUID b f f	701  701	16 671 670 float8ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 672 (  "<"	   PGNSP PGUID b f f	701  701	16 674 675 float8lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+#define Float8LessOperator	672
+DATA(insert OID = 673 (  "<="	   PGNSP PGUID b f f	701  701	16 675 674 float8le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 674 (  ">"	   PGNSP PGUID b f f	701  701	16 672 673 float8gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 675 (  ">="	   PGNSP PGUID b f f	701  701	16 673 672 float8ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+DATA(insert OID = 682 (  "@"	   PGNSP PGUID l f f	 0	21	21	 0	 0 int2abs - - ));
+DESCR("absolute value");
+DATA(insert OID = 684 (  "+"	   PGNSP PGUID b f f	20	20	20 684	 0 int8pl - - ));
+DESCR("add");
+DATA(insert OID = 685 (  "-"	   PGNSP PGUID b f f	20	20	20	 0	 0 int8mi - - ));
+DESCR("subtract");
+DATA(insert OID = 686 (  "*"	   PGNSP PGUID b f f	20	20	20 686	 0 int8mul - - ));
+DESCR("multiply");
+DATA(insert OID = 687 (  "/"	   PGNSP PGUID b f f	20	20	20	 0	 0 int8div - - ));
+DESCR("divide");
+
+DATA(insert OID = 688 (  "+"	   PGNSP PGUID b f f	20	23	20 692	 0 int84pl - - ));
+DESCR("add");
+DATA(insert OID = 689 (  "-"	   PGNSP PGUID b f f	20	23	20	 0	 0 int84mi - - ));
+DESCR("subtract");
+DATA(insert OID = 690 (  "*"	   PGNSP PGUID b f f	20	23	20 694	 0 int84mul - - ));
+DESCR("multiply");
+DATA(insert OID = 691 (  "/"	   PGNSP PGUID b f f	20	23	20	 0	 0 int84div - - ));
+DESCR("divide");
+DATA(insert OID = 692 (  "+"	   PGNSP PGUID b f f	23	20	20 688	 0 int48pl - - ));
+DESCR("add");
+DATA(insert OID = 693 (  "-"	   PGNSP PGUID b f f	23	20	20	 0	 0 int48mi - - ));
+DESCR("subtract");
+DATA(insert OID = 694 (  "*"	   PGNSP PGUID b f f	23	20	20 690	 0 int48mul - - ));
+DESCR("multiply");
+DATA(insert OID = 695 (  "/"	   PGNSP PGUID b f f	23	20	20	 0	 0 int48div - - ));
+DESCR("divide");
+
+DATA(insert OID = 818 (  "+"	   PGNSP PGUID b f f	20	21	20 822	 0 int82pl - - ));
+DESCR("add");
+DATA(insert OID = 819 (  "-"	   PGNSP PGUID b f f	20	21	20	 0	 0 int82mi - - ));
+DESCR("subtract");
+DATA(insert OID = 820 (  "*"	   PGNSP PGUID b f f	20	21	20 824	 0 int82mul - - ));
+DESCR("multiply");
+DATA(insert OID = 821 (  "/"	   PGNSP PGUID b f f	20	21	20	 0	 0 int82div - - ));
+DESCR("divide");
+DATA(insert OID = 822 (  "+"	   PGNSP PGUID b f f	21	20	20 818	 0 int28pl - - ));
+DESCR("add");
+DATA(insert OID = 823 (  "-"	   PGNSP PGUID b f f	21	20	20	 0	 0 int28mi - - ));
+DESCR("subtract");
+DATA(insert OID = 824 (  "*"	   PGNSP PGUID b f f	21	20	20 820	 0 int28mul - - ));
+DESCR("multiply");
+DATA(insert OID = 825 (  "/"	   PGNSP PGUID b f f	21	20	20	 0	 0 int28div - - ));
+DESCR("divide");
+
+DATA(insert OID = 706 (  "<->"	   PGNSP PGUID b f f 603 603 701 706	 0 box_distance - - ));
+DESCR("distance between");
+DATA(insert OID = 707 (  "<->"	   PGNSP PGUID b f f 602 602 701 707	 0 path_distance - - ));
+DESCR("distance between");
+DATA(insert OID = 708 (  "<->"	   PGNSP PGUID b f f 628 628 701 708	 0 line_distance - - ));
+DESCR("distance between");
+DATA(insert OID = 709 (  "<->"	   PGNSP PGUID b f f 601 601 701 709	 0 lseg_distance - - ));
+DESCR("distance between");
+DATA(insert OID = 712 (  "<->"	   PGNSP PGUID b f f 604 604 701 712	 0 poly_distance - - ));
+DESCR("distance between");
+
+DATA(insert OID = 713 (  "<>"	   PGNSP PGUID b f f 600 600	16 713 510 point_ne neqsel neqjoinsel ));
+DESCR("not equal");
+
+/* add translation/rotation/scaling operators for geometric types. - thomas 97/05/10 */
+DATA(insert OID = 731 (  "+"	   PGNSP PGUID b f f	600  600	600  731  0 point_add - - ));
+DESCR("add points (translate)");
+DATA(insert OID = 732 (  "-"	   PGNSP PGUID b f f	600  600	600    0  0 point_sub - - ));
+DESCR("subtract points (translate)");
+DATA(insert OID = 733 (  "*"	   PGNSP PGUID b f f	600  600	600  733  0 point_mul - - ));
+DESCR("multiply points (scale/rotate)");
+DATA(insert OID = 734 (  "/"	   PGNSP PGUID b f f	600  600	600    0  0 point_div - - ));
+DESCR("divide points (scale/rotate)");
+DATA(insert OID = 735 (  "+"	   PGNSP PGUID b f f	602  602	602  735  0 path_add - - ));
+DESCR("concatenate");
+DATA(insert OID = 736 (  "+"	   PGNSP PGUID b f f	602  600	602    0  0 path_add_pt - - ));
+DESCR("add (translate path)");
+DATA(insert OID = 737 (  "-"	   PGNSP PGUID b f f	602  600	602    0  0 path_sub_pt - - ));
+DESCR("subtract (translate path)");
+DATA(insert OID = 738 (  "*"	   PGNSP PGUID b f f	602  600	602    0  0 path_mul_pt - - ));
+DESCR("multiply (rotate/scale path)");
+DATA(insert OID = 739 (  "/"	   PGNSP PGUID b f f	602  600	602    0  0 path_div_pt - - ));
+DESCR("divide (rotate/scale path)");
+DATA(insert OID = 755 (  "@>"	   PGNSP PGUID b f f	602  600	 16  512  0 path_contain_pt - - ));
+DESCR("contains");
+DATA(insert OID = 756 (  "<@"	   PGNSP PGUID b f f	600  604	 16  757  0 pt_contained_poly contsel contjoinsel ));
+DESCR("is contained by");
+DATA(insert OID = 757 (  "@>"	   PGNSP PGUID b f f	604  600	 16  756  0 poly_contain_pt contsel contjoinsel ));
+DESCR("contains");
+DATA(insert OID = 758 (  "<@"	   PGNSP PGUID b f f	600  718	 16  759  0 pt_contained_circle contsel contjoinsel ));
+DESCR("is contained by");
+DATA(insert OID = 759 (  "@>"	   PGNSP PGUID b f f	718  600	 16  758  0 circle_contain_pt contsel contjoinsel ));
+DESCR("contains");
+
+DATA(insert OID = 773 (  "@"	   PGNSP PGUID l f f	 0	23	23	 0	 0 int4abs - - ));
+DESCR("absolute value");
+
+/* additional operators for geometric types - thomas 1997-07-09 */
+DATA(insert OID =  792 (  "="	   PGNSP PGUID b f f	602  602	 16  792  0 path_n_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID =  793 (  "<"	   PGNSP PGUID b f f	602  602	 16  794  0 path_n_lt - - ));
+DESCR("less than");
+DATA(insert OID =  794 (  ">"	   PGNSP PGUID b f f	602  602	 16  793  0 path_n_gt - - ));
+DESCR("greater than");
+DATA(insert OID =  795 (  "<="	   PGNSP PGUID b f f	602  602	 16  796  0 path_n_le - - ));
+DESCR("less than or equal");
+DATA(insert OID =  796 (  ">="	   PGNSP PGUID b f f	602  602	 16  795  0 path_n_ge - - ));
+DESCR("greater than or equal");
+DATA(insert OID =  797 (  "#"	   PGNSP PGUID l f f	0	 602	 23    0  0 path_npoints - - ));
+DESCR("number of points");
+DATA(insert OID =  798 (  "?#"	   PGNSP PGUID b f f	602  602	 16    0  0 path_inter - - ));
+DESCR("intersect");
+DATA(insert OID =  799 (  "@-@"    PGNSP PGUID l f f	0	 602	701    0  0 path_length - - ));
+DESCR("sum of path segment lengths");
+DATA(insert OID =  800 (  ">^"	   PGNSP PGUID b f f	603  603	 16    0  0 box_above_eq positionsel positionjoinsel ));
+DESCR("is above (allows touching)");
+DATA(insert OID =  801 (  "<^"	   PGNSP PGUID b f f	603  603	 16    0  0 box_below_eq positionsel positionjoinsel ));
+DESCR("is below (allows touching)");
+DATA(insert OID =  802 (  "?#"	   PGNSP PGUID b f f	603  603	 16    0  0 box_overlap areasel areajoinsel ));
+DESCR("deprecated, use && instead");
+DATA(insert OID =  803 (  "#"	   PGNSP PGUID b f f	603  603	603    0  0 box_intersect - - ));
+DESCR("box intersection");
+DATA(insert OID =  804 (  "+"	   PGNSP PGUID b f f	603  600	603    0  0 box_add - - ));
+DESCR("add point to box (translate)");
+DATA(insert OID =  805 (  "-"	   PGNSP PGUID b f f	603  600	603    0  0 box_sub - - ));
+DESCR("subtract point from box (translate)");
+DATA(insert OID =  806 (  "*"	   PGNSP PGUID b f f	603  600	603    0  0 box_mul - - ));
+DESCR("multiply box by point (scale)");
+DATA(insert OID =  807 (  "/"	   PGNSP PGUID b f f	603  600	603    0  0 box_div - - ));
+DESCR("divide box by point (scale)");
+DATA(insert OID =  808 (  "?-"	   PGNSP PGUID b f f	600  600	 16  808  0 point_horiz - - ));
+DESCR("horizontally aligned");
+DATA(insert OID =  809 (  "?|"	   PGNSP PGUID b f f	600  600	 16  809  0 point_vert - - ));
+DESCR("vertically aligned");
+
+DATA(insert OID = 811 (  "="	   PGNSP PGUID b t f 704 704	16 811 812 tintervaleq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 812 (  "<>"	   PGNSP PGUID b f f 704 704	16 812 811 tintervalne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 813 (  "<"	   PGNSP PGUID b f f 704 704	16 814 816 tintervallt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 814 (  ">"	   PGNSP PGUID b f f 704 704	16 813 815 tintervalgt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 815 (  "<="	   PGNSP PGUID b f f 704 704	16 816 814 tintervalle scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 816 (  ">="	   PGNSP PGUID b f f 704 704	16 815 813 tintervalge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+DATA(insert OID = 843 (  "*"	   PGNSP PGUID b f f	790  700	790 845   0 cash_mul_flt4 - - ));
+DESCR("multiply");
+DATA(insert OID = 844 (  "/"	   PGNSP PGUID b f f	790  700	790   0   0 cash_div_flt4 - - ));
+DESCR("divide");
+DATA(insert OID = 845 (  "*"	   PGNSP PGUID b f f	700  790	790 843   0 flt4_mul_cash - - ));
+DESCR("multiply");
+
+DATA(insert OID = 900 (  "="	   PGNSP PGUID b t f	790  790	16 900 901 cash_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 901 (  "<>"	   PGNSP PGUID b f f	790  790	16 901 900 cash_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 902 (  "<"	   PGNSP PGUID b f f	790  790	16 903 905 cash_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 903 (  ">"	   PGNSP PGUID b f f	790  790	16 902 904 cash_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 904 (  "<="	   PGNSP PGUID b f f	790  790	16 905 903 cash_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 905 (  ">="	   PGNSP PGUID b f f	790  790	16 904 902 cash_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 906 (  "+"	   PGNSP PGUID b f f	790  790	790 906   0 cash_pl - - ));
+DESCR("add");
+DATA(insert OID = 907 (  "-"	   PGNSP PGUID b f f	790  790	790   0   0 cash_mi - - ));
+DESCR("subtract");
+DATA(insert OID = 908 (  "*"	   PGNSP PGUID b f f	790  701	790 916   0 cash_mul_flt8 - - ));
+DESCR("multiply");
+DATA(insert OID = 909 (  "/"	   PGNSP PGUID b f f	790  701	790   0   0 cash_div_flt8 - - ));
+DESCR("divide");
+DATA(insert OID = 912 (  "*"	   PGNSP PGUID b f f	790  23		790 917   0 cash_mul_int4 - - ));
+DESCR("multiply");
+DATA(insert OID = 913 (  "/"	   PGNSP PGUID b f f	790  23		790   0   0 cash_div_int4 - - ));
+DESCR("divide");
+DATA(insert OID = 914 (  "*"	   PGNSP PGUID b f f	790  21		790 918   0 cash_mul_int2 - - ));
+DESCR("multiply");
+DATA(insert OID = 915 (  "/"	   PGNSP PGUID b f f	790  21		790   0   0 cash_div_int2 - - ));
+DESCR("divide");
+DATA(insert OID = 916 (  "*"	   PGNSP PGUID b f f	701  790	790 908   0 flt8_mul_cash - - ));
+DESCR("multiply");
+DATA(insert OID = 917 (  "*"	   PGNSP PGUID b f f	23	790		790 912   0 int4_mul_cash - - ));
+DESCR("multiply");
+DATA(insert OID = 918 (  "*"	   PGNSP PGUID b f f	21	790		790 914   0 int2_mul_cash - - ));
+DESCR("multiply");
+DATA(insert OID = 3825 ( "/"	   PGNSP PGUID b f f	790 790		701   0   0 cash_div_cash - - ));
+DESCR("divide");
+
+DATA(insert OID = 965 (  "^"	   PGNSP PGUID b f f	701  701	701 0 0 dpow - - ));
+DESCR("exponentiation");
+DATA(insert OID = 966 (  "+"	   PGNSP PGUID b f f 1034 1033 1034 0 0 aclinsert - - ));
+DESCR("add/update ACL item");
+DATA(insert OID = 967 (  "-"	   PGNSP PGUID b f f 1034 1033 1034 0 0 aclremove - - ));
+DESCR("remove ACL item");
+DATA(insert OID = 968 (  "@>"	   PGNSP PGUID b f f 1034 1033	 16 0 0 aclcontains - - ));
+DESCR("contains");
+DATA(insert OID = 974 (  "="	   PGNSP PGUID b f t 1033 1033	 16 974 0 aclitemeq eqsel eqjoinsel ));
+DESCR("equal");
+
+/* additional geometric operators - thomas 1997-07-09 */
+DATA(insert OID =  969 (  "@@"	   PGNSP PGUID l f f	0  601	600    0  0 lseg_center - - ));
+DESCR("center of");
+DATA(insert OID =  970 (  "@@"	   PGNSP PGUID l f f	0  602	600    0  0 path_center - - ));
+DESCR("center of");
+DATA(insert OID =  971 (  "@@"	   PGNSP PGUID l f f	0  604	600    0  0 poly_center - - ));
+DESCR("center of");
+
+DATA(insert OID = 1054 ( "="	   PGNSP PGUID b t t 1042 1042	 16 1054 1057 bpchareq eqsel eqjoinsel ));
+DESCR("equal");
+
+DATA(insert OID = 1055 ( "~"	   PGNSP PGUID b f f 1042 25	 16    0 1056 bpcharregexeq regexeqsel regexeqjoinsel ));
+DESCR("matches regular expression, case-sensitive");
+#define OID_BPCHAR_REGEXEQ_OP		1055
+DATA(insert OID = 1056 ( "!~"	   PGNSP PGUID b f f 1042 25	 16    0 1055 bpcharregexne regexnesel regexnejoinsel ));
+DESCR("does not match regular expression, case-sensitive");
+DATA(insert OID = 1057 ( "<>"	   PGNSP PGUID b f f 1042 1042	 16 1057 1054 bpcharne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1058 ( "<"	   PGNSP PGUID b f f 1042 1042	 16 1060 1061 bpcharlt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 1059 ( "<="	   PGNSP PGUID b f f 1042 1042	 16 1061 1060 bpcharle scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1060 ( ">"	   PGNSP PGUID b f f 1042 1042	 16 1058 1059 bpchargt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 1061 ( ">="	   PGNSP PGUID b f f 1042 1042	 16 1059 1058 bpcharge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+/* generic array comparison operators */
+DATA(insert OID = 1070 (  "="	   PGNSP PGUID b t t 2277 2277 16 1070 1071 array_eq eqsel eqjoinsel ));
+DESCR("equal");
+#define ARRAY_EQ_OP 1070
+DATA(insert OID = 1071 (  "<>"	   PGNSP PGUID b f f 2277 2277 16 1071 1070 array_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1072 (  "<"	   PGNSP PGUID b f f 2277 2277 16 1073 1075 array_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+#define ARRAY_LT_OP 1072
+DATA(insert OID = 1073 (  ">"	   PGNSP PGUID b f f 2277 2277 16 1072 1074 array_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+#define ARRAY_GT_OP 1073
+DATA(insert OID = 1074 (  "<="	   PGNSP PGUID b f f 2277 2277 16 1075 1073 array_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1075 (  ">="	   PGNSP PGUID b f f 2277 2277 16 1074 1072 array_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+/* date operators */
+DATA(insert OID = 1076 ( "+"	   PGNSP PGUID b f f	1082	1186 1114 2551 0 date_pl_interval - - ));
+DESCR("add");
+DATA(insert OID = 1077 ( "-"	   PGNSP PGUID b f f	1082	1186 1114 0 0 date_mi_interval - - ));
+DESCR("subtract");
+DATA(insert OID = 1093 ( "="	   PGNSP PGUID b t t	1082	1082   16 1093 1094 date_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1094 ( "<>"	   PGNSP PGUID b f f	1082	1082   16 1094 1093 date_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1095 ( "<"	   PGNSP PGUID b f f	1082	1082   16 1097 1098 date_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 1096 ( "<="	   PGNSP PGUID b f f	1082	1082   16 1098 1097 date_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1097 ( ">"	   PGNSP PGUID b f f	1082	1082   16 1095 1096 date_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 1098 ( ">="	   PGNSP PGUID b f f	1082	1082   16 1096 1095 date_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 1099 ( "-"	   PGNSP PGUID b f f	1082	1082   23 0 0 date_mi - - ));
+DESCR("subtract");
+DATA(insert OID = 1100 ( "+"	   PGNSP PGUID b f f	1082	  23 1082 2555 0 date_pli - - ));
+DESCR("add");
+DATA(insert OID = 1101 ( "-"	   PGNSP PGUID b f f	1082	  23 1082 0 0 date_mii - - ));
+DESCR("subtract");
+
+/* time operators */
+DATA(insert OID = 1108 ( "="	   PGNSP PGUID b t t	1083	1083  16 1108 1109 time_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1109 ( "<>"	   PGNSP PGUID b f f	1083	1083  16 1109 1108 time_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1110 ( "<"	   PGNSP PGUID b f f	1083	1083  16 1112 1113 time_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 1111 ( "<="	   PGNSP PGUID b f f	1083	1083  16 1113 1112 time_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1112 ( ">"	   PGNSP PGUID b f f	1083	1083  16 1110 1111 time_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 1113 ( ">="	   PGNSP PGUID b f f	1083	1083  16 1111 1110 time_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+/* timetz operators */
+DATA(insert OID = 1550 ( "="	   PGNSP PGUID b t t	1266 1266	16 1550 1551 timetz_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1551 ( "<>"	   PGNSP PGUID b f f	1266 1266	16 1551 1550 timetz_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1552 ( "<"	   PGNSP PGUID b f f	1266 1266	16 1554 1555 timetz_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 1553 ( "<="	   PGNSP PGUID b f f	1266 1266	16 1555 1554 timetz_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1554 ( ">"	   PGNSP PGUID b f f	1266 1266	16 1552 1553 timetz_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 1555 ( ">="	   PGNSP PGUID b f f	1266 1266	16 1553 1552 timetz_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+/* float48 operators */
+DATA(insert OID = 1116 (  "+"		PGNSP PGUID b f f 700 701 701 1126	 0 float48pl - - ));
+DESCR("add");
+DATA(insert OID = 1117 (  "-"		PGNSP PGUID b f f 700 701 701  0	 0 float48mi - - ));
+DESCR("subtract");
+DATA(insert OID = 1118 (  "/"		PGNSP PGUID b f f 700 701 701  0	 0 float48div - - ));
+DESCR("divide");
+DATA(insert OID = 1119 (  "*"		PGNSP PGUID b f f 700 701 701 1129	 0 float48mul - - ));
+DESCR("multiply");
+DATA(insert OID = 1120 (  "="		PGNSP PGUID b t t  700	701  16 1130 1121 float48eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1121 (  "<>"		PGNSP PGUID b f f  700	701  16 1131 1120 float48ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1122 (  "<"		PGNSP PGUID b f f  700	701  16 1133 1125 float48lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 1123 (  ">"		PGNSP PGUID b f f  700	701  16 1132 1124 float48gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 1124 (  "<="		PGNSP PGUID b f f  700	701  16 1135 1123 float48le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1125 (  ">="		PGNSP PGUID b f f  700	701  16 1134 1122 float48ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+/* float84 operators */
+DATA(insert OID = 1126 (  "+"		PGNSP PGUID b f f 701 700 701 1116	 0 float84pl - - ));
+DESCR("add");
+DATA(insert OID = 1127 (  "-"		PGNSP PGUID b f f 701 700 701  0	 0 float84mi - - ));
+DESCR("subtract");
+DATA(insert OID = 1128 (  "/"		PGNSP PGUID b f f 701 700 701  0	 0 float84div - - ));
+DESCR("divide");
+DATA(insert OID = 1129 (  "*"		PGNSP PGUID b f f 701 700 701 1119	 0 float84mul - - ));
+DESCR("multiply");
+DATA(insert OID = 1130 (  "="		PGNSP PGUID b t t  701	700  16 1120 1131 float84eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1131 (  "<>"		PGNSP PGUID b f f  701	700  16 1121 1130 float84ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1132 (  "<"		PGNSP PGUID b f f  701	700  16 1123 1135 float84lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 1133 (  ">"		PGNSP PGUID b f f  701	700  16 1122 1134 float84gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 1134 (  "<="		PGNSP PGUID b f f  701	700  16 1125 1133 float84le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1135 (  ">="		PGNSP PGUID b f f  701	700  16 1124 1132 float84ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+
+/* LIKE hacks by Keith Parks. */
+DATA(insert OID = 1207 (  "~~"	  PGNSP PGUID b f f  19 25	16 0 1208 namelike likesel likejoinsel ));
+DESCR("matches LIKE expression");
+#define OID_NAME_LIKE_OP		1207
+DATA(insert OID = 1208 (  "!~~"   PGNSP PGUID b f f  19 25	16 0 1207 namenlike nlikesel nlikejoinsel ));
+DESCR("does not match LIKE expression");
+DATA(insert OID = 1209 (  "~~"	  PGNSP PGUID b f f  25 25	16 0 1210 textlike likesel likejoinsel ));
+DESCR("matches LIKE expression");
+#define OID_TEXT_LIKE_OP		1209
+DATA(insert OID = 1210 (  "!~~"   PGNSP PGUID b f f  25 25	16 0 1209 textnlike nlikesel nlikejoinsel ));
+DESCR("does not match LIKE expression");
+DATA(insert OID = 1211 (  "~~"	  PGNSP PGUID b f f  1042 25	16 0 1212 bpcharlike likesel likejoinsel ));
+DESCR("matches LIKE expression");
+#define OID_BPCHAR_LIKE_OP		1211
+DATA(insert OID = 1212 (  "!~~"   PGNSP PGUID b f f  1042 25	16 0 1211 bpcharnlike nlikesel nlikejoinsel ));
+DESCR("does not match LIKE expression");
+
+/* case-insensitive regex hacks */
+DATA(insert OID = 1226 (  "~*"		 PGNSP PGUID b f f	19	25	16 0 1227 nameicregexeq icregexeqsel icregexeqjoinsel ));
+DESCR("matches regular expression, case-insensitive");
+#define OID_NAME_ICREGEXEQ_OP		1226
+DATA(insert OID = 1227 (  "!~*"		 PGNSP PGUID b f f	19	25	16 0 1226 nameicregexne icregexnesel icregexnejoinsel ));
+DESCR("does not match regular expression, case-insensitive");
+DATA(insert OID = 1228 (  "~*"		 PGNSP PGUID b f f	25	25	16 0 1229 texticregexeq icregexeqsel icregexeqjoinsel ));
+DESCR("matches regular expression, case-insensitive");
+#define OID_TEXT_ICREGEXEQ_OP		1228
+DATA(insert OID = 1229 (  "!~*"		 PGNSP PGUID b f f	25	25	16 0 1228 texticregexne icregexnesel icregexnejoinsel ));
+DESCR("does not match regular expression, case-insensitive");
+DATA(insert OID = 1234 (  "~*"		PGNSP PGUID b f f  1042  25  16 0 1235 bpcharicregexeq icregexeqsel icregexeqjoinsel ));
+DESCR("matches regular expression, case-insensitive");
+#define OID_BPCHAR_ICREGEXEQ_OP		1234
+DATA(insert OID = 1235 ( "!~*"		PGNSP PGUID b f f  1042  25  16 0 1234 bpcharicregexne icregexnesel icregexnejoinsel ));
+DESCR("does not match regular expression, case-insensitive");
+
+/* timestamptz operators */
+DATA(insert OID = 1320 (  "="	   PGNSP PGUID b t t 1184 1184	 16 1320 1321 timestamptz_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1321 (  "<>"	   PGNSP PGUID b f f 1184 1184	 16 1321 1320 timestamptz_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1322 (  "<"	   PGNSP PGUID b f f 1184 1184	 16 1324 1325 timestamptz_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 1323 (  "<="	   PGNSP PGUID b f f 1184 1184	 16 1325 1324 timestamptz_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1324 (  ">"	   PGNSP PGUID b f f 1184 1184	 16 1322 1323 timestamptz_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 1325 (  ">="	   PGNSP PGUID b f f 1184 1184	 16 1323 1322 timestamptz_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 1327 (  "+"	   PGNSP PGUID b f f 1184 1186 1184  2554 0 timestamptz_pl_interval - - ));
+DESCR("add");
+DATA(insert OID = 1328 (  "-"	   PGNSP PGUID b f f 1184 1184 1186  0	0 timestamptz_mi - - ));
+DESCR("subtract");
+DATA(insert OID = 1329 (  "-"	   PGNSP PGUID b f f 1184 1186 1184  0	0 timestamptz_mi_interval - - ));
+DESCR("subtract");
+
+/* interval operators */
+DATA(insert OID = 1330 (  "="	   PGNSP PGUID b t t 1186 1186	 16 1330 1331 interval_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1331 (  "<>"	   PGNSP PGUID b f f 1186 1186	 16 1331 1330 interval_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1332 (  "<"	   PGNSP PGUID b f f 1186 1186	 16 1334 1335 interval_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 1333 (  "<="	   PGNSP PGUID b f f 1186 1186	 16 1335 1334 interval_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1334 (  ">"	   PGNSP PGUID b f f 1186 1186	 16 1332 1333 interval_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 1335 (  ">="	   PGNSP PGUID b f f 1186 1186	 16 1333 1332 interval_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+DATA(insert OID = 1336 (  "-"	   PGNSP PGUID l f f	0 1186 1186    0	0 interval_um - - ));
+DESCR("negate");
+DATA(insert OID = 1337 (  "+"	   PGNSP PGUID b f f 1186 1186 1186 1337	0 interval_pl - - ));
+DESCR("add");
+DATA(insert OID = 1338 (  "-"	   PGNSP PGUID b f f 1186 1186 1186    0	0 interval_mi - - ));
+DESCR("subtract");
+
+DATA(insert OID = 1360 (  "+"	   PGNSP PGUID b f f 1082 1083 1114 1363 0 datetime_pl - - ));
+DESCR("convert date and time to timestamp");
+DATA(insert OID = 1361 (  "+"	   PGNSP PGUID b f f 1082 1266 1184 1366 0 datetimetz_pl - - ));
+DESCR("convert date and time with time zone to timestamp with time zone");
+DATA(insert OID = 1363 (  "+"	   PGNSP PGUID b f f 1083 1082 1114 1360 0 timedate_pl - - ));
+DESCR("convert time and date to timestamp");
+DATA(insert OID = 1366 (  "+"	   PGNSP PGUID b f f 1266 1082 1184 1361 0 timetzdate_pl - - ));
+DESCR("convert time with time zone and date to timestamp with time zone");
+
+DATA(insert OID = 1399 (  "-"	   PGNSP PGUID b f f 1083 1083 1186  0	0 time_mi_time - - ));
+DESCR("subtract");
+
+/* additional geometric operators - thomas 97/04/18 */
+DATA(insert OID = 1420 (  "@@"	  PGNSP PGUID l f f  0	718 600   0    0 circle_center - - ));
+DESCR("center of");
+DATA(insert OID = 1500 (  "="	  PGNSP PGUID b f f  718	718 16 1500 1501 circle_eq eqsel eqjoinsel ));
+DESCR("equal by area");
+DATA(insert OID = 1501 (  "<>"	  PGNSP PGUID b f f  718	718 16 1501 1500 circle_ne neqsel neqjoinsel ));
+DESCR("not equal by area");
+DATA(insert OID = 1502 (  "<"	  PGNSP PGUID b f f  718	718 16 1503 1505 circle_lt areasel areajoinsel ));
+DESCR("less than by area");
+DATA(insert OID = 1503 (  ">"	  PGNSP PGUID b f f  718	718 16 1502 1504 circle_gt areasel areajoinsel ));
+DESCR("greater than by area");
+DATA(insert OID = 1504 (  "<="	  PGNSP PGUID b f f  718	718 16 1505 1503 circle_le areasel areajoinsel ));
+DESCR("less than or equal by area");
+DATA(insert OID = 1505 (  ">="	  PGNSP PGUID b f f  718	718 16 1504 1502 circle_ge areasel areajoinsel ));
+DESCR("greater than or equal by area");
+
+DATA(insert OID = 1506 (  "<<"	  PGNSP PGUID b f f  718	718 16	  0    0 circle_left positionsel positionjoinsel ));
+DESCR("is left of");
+DATA(insert OID = 1507 (  "&<"	  PGNSP PGUID b f f  718	718 16	  0    0 circle_overleft positionsel positionjoinsel ));
+DESCR("overlaps or is left of");
+DATA(insert OID = 1508 (  "&>"	  PGNSP PGUID b f f  718	718 16	  0    0 circle_overright positionsel positionjoinsel ));
+DESCR("overlaps or is right of");
+DATA(insert OID = 1509 (  ">>"	  PGNSP PGUID b f f  718	718 16	  0    0 circle_right positionsel positionjoinsel ));
+DESCR("is right of");
+DATA(insert OID = 1510 (  "<@"	  PGNSP PGUID b f f  718	718 16 1511    0 circle_contained contsel contjoinsel ));
+DESCR("is contained by");
+DATA(insert OID = 1511 (  "@>"	  PGNSP PGUID b f f  718	718 16 1510    0 circle_contain contsel contjoinsel ));
+DESCR("contains");
+DATA(insert OID = 1512 (  "~="	  PGNSP PGUID b f f  718	718 16 1512    0 circle_same eqsel eqjoinsel ));
+DESCR("same as");
+DATA(insert OID = 1513 (  "&&"	  PGNSP PGUID b f f  718	718 16 1513    0 circle_overlap areasel areajoinsel ));
+DESCR("overlaps");
+DATA(insert OID = 1514 (  "|>>"   PGNSP PGUID b f f  718	718 16	  0    0 circle_above positionsel positionjoinsel ));
+DESCR("is above");
+DATA(insert OID = 1515 (  "<<|"   PGNSP PGUID b f f  718	718 16	  0    0 circle_below positionsel positionjoinsel ));
+DESCR("is below");
+
+DATA(insert OID = 1516 (  "+"	  PGNSP PGUID b f f  718	600  718	  0    0 circle_add_pt - - ));
+DESCR("add");
+DATA(insert OID = 1517 (  "-"	  PGNSP PGUID b f f  718	600  718	  0    0 circle_sub_pt - - ));
+DESCR("subtract");
+DATA(insert OID = 1518 (  "*"	  PGNSP PGUID b f f  718	600  718	  0    0 circle_mul_pt - - ));
+DESCR("multiply");
+DATA(insert OID = 1519 (  "/"	  PGNSP PGUID b f f  718	600  718	  0    0 circle_div_pt - - ));
+DESCR("divide");
+
+DATA(insert OID = 1520 (  "<->"   PGNSP PGUID b f f  718	718  701   1520    0 circle_distance - - ));
+DESCR("distance between");
+DATA(insert OID = 1521 (  "#"	  PGNSP PGUID l f f  0		604   23	  0    0 poly_npoints - - ));
+DESCR("number of points");
+DATA(insert OID = 1522 (  "<->"   PGNSP PGUID b f f  600	718  701   3291    0 dist_pc - - ));
+DESCR("distance between");
+DATA(insert OID = 3291 (  "<->"   PGNSP PGUID b f f  718	600  701   1522    0 dist_cpoint - - ));
+DESCR("distance between");
+DATA(insert OID = 3276 (  "<->"   PGNSP PGUID b f f  600	604  701   3289    0 dist_ppoly - - ));
+DESCR("distance between");
+DATA(insert OID = 3289 (  "<->"   PGNSP PGUID b f f  604	600  701   3276    0 dist_polyp - - ));
+DESCR("distance between");
+DATA(insert OID = 1523 (  "<->"   PGNSP PGUID b f f  718	604  701	  0    0 dist_cpoly - - ));
+DESCR("distance between");
+
+/* additional geometric operators - thomas 1997-07-09 */
+DATA(insert OID = 1524 (  "<->"   PGNSP PGUID b f f  628	603  701	  0  0 dist_lb - - ));
+DESCR("distance between");
+
+DATA(insert OID = 1525 (  "?#"	  PGNSP PGUID b f f  601	601 16 1525  0 lseg_intersect - - ));
+DESCR("intersect");
+DATA(insert OID = 1526 (  "?||"   PGNSP PGUID b f f  601	601 16 1526  0 lseg_parallel - - ));
+DESCR("parallel");
+DATA(insert OID = 1527 (  "?-|"   PGNSP PGUID b f f  601	601 16 1527  0 lseg_perp - - ));
+DESCR("perpendicular");
+DATA(insert OID = 1528 (  "?-"	  PGNSP PGUID l f f  0	601 16	  0  0 lseg_horizontal - - ));
+DESCR("horizontal");
+DATA(insert OID = 1529 (  "?|"	  PGNSP PGUID l f f  0	601 16	  0  0 lseg_vertical - - ));
+DESCR("vertical");
+DATA(insert OID = 1535 (  "="	  PGNSP PGUID b f f  601	601 16 1535 1586 lseg_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1536 (  "#"	  PGNSP PGUID b f f  601	601  600 1536  0 lseg_interpt - - ));
+DESCR("intersection point");
+DATA(insert OID = 1537 (  "?#"	  PGNSP PGUID b f f  601	628 16	  0  0 inter_sl - - ));
+DESCR("intersect");
+DATA(insert OID = 1538 (  "?#"	  PGNSP PGUID b f f  601	603 16	  0  0 inter_sb - - ));
+DESCR("intersect");
+DATA(insert OID = 1539 (  "?#"	  PGNSP PGUID b f f  628	603 16	  0  0 inter_lb - - ));
+DESCR("intersect");
+
+DATA(insert OID = 1546 (  "<@"	  PGNSP PGUID b f f  600	628 16	  0  0 on_pl - - ));
+DESCR("point on line");
+DATA(insert OID = 1547 (  "<@"	  PGNSP PGUID b f f  600	601 16	  0  0 on_ps - - ));
+DESCR("is contained by");
+DATA(insert OID = 1548 (  "<@"	  PGNSP PGUID b f f  601	628 16	  0  0 on_sl - - ));
+DESCR("lseg on line");
+DATA(insert OID = 1549 (  "<@"	  PGNSP PGUID b f f  601	603 16	  0  0 on_sb - - ));
+DESCR("is contained by");
+
+DATA(insert OID = 1557 (  "##"	  PGNSP PGUID b f f  600	628  600	  0  0 close_pl - - ));
+DESCR("closest point to A on B");
+DATA(insert OID = 1558 (  "##"	  PGNSP PGUID b f f  600	601  600	  0  0 close_ps - - ));
+DESCR("closest point to A on B");
+DATA(insert OID = 1559 (  "##"	  PGNSP PGUID b f f  600	603  600	  0  0 close_pb - - ));
+DESCR("closest point to A on B");
+
+DATA(insert OID = 1566 (  "##"	  PGNSP PGUID b f f  601	628  600	  0  0 close_sl - - ));
+DESCR("closest point to A on B");
+DATA(insert OID = 1567 (  "##"	  PGNSP PGUID b f f  601	603  600	  0  0 close_sb - - ));
+DESCR("closest point to A on B");
+DATA(insert OID = 1568 (  "##"	  PGNSP PGUID b f f  628	603  600	  0  0 close_lb - - ));
+DESCR("closest point to A on B");
+DATA(insert OID = 1577 (  "##"	  PGNSP PGUID b f f  628	601  600	  0  0 close_ls - - ));
+DESCR("closest point to A on B");
+DATA(insert OID = 1578 (  "##"	  PGNSP PGUID b f f  601	601  600	  0  0 close_lseg - - ));
+DESCR("closest point to A on B");
+DATA(insert OID = 1583 (  "*"	  PGNSP PGUID b f f 1186	701 1186	1584 0 interval_mul - - ));
+DESCR("multiply");
+DATA(insert OID = 1584 (  "*"	  PGNSP PGUID b f f  701 1186 1186	1583 0 mul_d_interval - - ));
+DESCR("multiply");
+DATA(insert OID = 1585 (  "/"	  PGNSP PGUID b f f 1186	701 1186	  0  0 interval_div - - ));
+DESCR("divide");
+
+DATA(insert OID = 1586 (  "<>"	  PGNSP PGUID b f f  601	601 16 1586 1535 lseg_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1587 (  "<"	  PGNSP PGUID b f f  601	601 16 1589 1590 lseg_lt - - ));
+DESCR("less than by length");
+DATA(insert OID = 1588 (  "<="	  PGNSP PGUID b f f  601	601 16 1590 1589 lseg_le - - ));
+DESCR("less than or equal by length");
+DATA(insert OID = 1589 (  ">"	  PGNSP PGUID b f f  601	601 16 1587 1588 lseg_gt - - ));
+DESCR("greater than by length");
+DATA(insert OID = 1590 (  ">="	  PGNSP PGUID b f f  601	601 16 1588 1587 lseg_ge - - ));
+DESCR("greater than or equal by length");
+
+DATA(insert OID = 1591 (  "@-@"   PGNSP PGUID l f f 0  601	701    0  0 lseg_length - - ));
+DESCR("distance between endpoints");
+
+DATA(insert OID = 1611 (  "?#"	  PGNSP PGUID b f f  628	628 16 1611  0 line_intersect - - ));
+DESCR("intersect");
+DATA(insert OID = 1612 (  "?||"   PGNSP PGUID b f f  628	628 16 1612  0 line_parallel - - ));
+DESCR("parallel");
+DATA(insert OID = 1613 (  "?-|"   PGNSP PGUID b f f  628	628 16 1613  0 line_perp - - ));
+DESCR("perpendicular");
+DATA(insert OID = 1614 (  "?-"	  PGNSP PGUID l f f  0	628 16	  0  0 line_horizontal - - ));
+DESCR("horizontal");
+DATA(insert OID = 1615 (  "?|"	  PGNSP PGUID l f f  0	628 16	  0  0 line_vertical - - ));
+DESCR("vertical");
+DATA(insert OID = 1616 (  "="	  PGNSP PGUID b f f  628	628 16 1616  0 line_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1617 (  "#"	  PGNSP PGUID b f f  628	628  600 1617  0 line_interpt - - ));
+DESCR("intersection point");
+
+/* MAC type */
+DATA(insert OID = 1220 (  "="	   PGNSP PGUID b t t 829 829	 16 1220 1221 macaddr_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1221 (  "<>"	   PGNSP PGUID b f f 829 829	 16 1221 1220 macaddr_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1222 (  "<"	   PGNSP PGUID b f f 829 829	 16 1224 1225 macaddr_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 1223 (  "<="	   PGNSP PGUID b f f 829 829	 16 1225 1224 macaddr_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1224 (  ">"	   PGNSP PGUID b f f 829 829	 16 1222 1223 macaddr_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 1225 (  ">="	   PGNSP PGUID b f f 829 829	 16 1223 1222 macaddr_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+DATA(insert OID = 3147 (  "~"	   PGNSP PGUID l f f	  0 829 829 0 0 macaddr_not - - ));
+DESCR("bitwise not");
+DATA(insert OID = 3148 (  "&"	   PGNSP PGUID b f f	829 829 829 0 0 macaddr_and - - ));
+DESCR("bitwise and");
+DATA(insert OID = 3149 (  "|"	   PGNSP PGUID b f f	829 829 829 0 0 macaddr_or - - ));
+DESCR("bitwise or");
+
+/* INET type (these also support CIDR via implicit cast) */
+DATA(insert OID = 1201 (  "="	   PGNSP PGUID b t t 869 869	 16 1201 1202 network_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1202 (  "<>"	   PGNSP PGUID b f f 869 869	 16 1202 1201 network_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1203 (  "<"	   PGNSP PGUID b f f 869 869	 16 1205 1206 network_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 1204 (  "<="	   PGNSP PGUID b f f 869 869	 16 1206 1205 network_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1205 (  ">"	   PGNSP PGUID b f f 869 869	 16 1203 1204 network_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 1206 (  ">="	   PGNSP PGUID b f f 869 869	 16 1204 1203 network_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 931  (  "<<"	   PGNSP PGUID b f f 869 869	 16 933		0 network_sub networksel networkjoinsel ));
+DESCR("is subnet");
+#define OID_INET_SUB_OP			931
+DATA(insert OID = 932  (  "<<="    PGNSP PGUID b f f 869 869	 16 934		0 network_subeq networksel networkjoinsel ));
+DESCR("is subnet or equal");
+#define OID_INET_SUBEQ_OP		932
+DATA(insert OID = 933  (  ">>"	   PGNSP PGUID b f f 869 869	 16 931		0 network_sup networksel networkjoinsel ));
+DESCR("is supernet");
+#define OID_INET_SUP_OP			933
+DATA(insert OID = 934  (  ">>="    PGNSP PGUID b f f 869 869	 16 932		0 network_supeq networksel networkjoinsel ));
+DESCR("is supernet or equal");
+#define OID_INET_SUPEQ_OP		934
+DATA(insert OID = 3552	(  "&&"    PGNSP PGUID b f f 869 869	 16 3552	0 network_overlap networksel networkjoinsel ));
+DESCR("overlaps (is subnet or supernet)");
+#define OID_INET_OVERLAP_OP		3552
+
+DATA(insert OID = 2634 (  "~"	   PGNSP PGUID l f f	  0 869 869 0 0 inetnot - - ));
+DESCR("bitwise not");
+DATA(insert OID = 2635 (  "&"	   PGNSP PGUID b f f	869 869 869 0 0 inetand - - ));
+DESCR("bitwise and");
+DATA(insert OID = 2636 (  "|"	   PGNSP PGUID b f f	869 869 869 0 0 inetor - - ));
+DESCR("bitwise or");
+DATA(insert OID = 2637 (  "+"	   PGNSP PGUID b f f	869  20 869 2638 0 inetpl - - ));
+DESCR("add");
+DATA(insert OID = 2638 (  "+"	   PGNSP PGUID b f f	 20 869 869 2637 0 int8pl_inet - - ));
+DESCR("add");
+DATA(insert OID = 2639 (  "-"	   PGNSP PGUID b f f	869  20 869 0 0 inetmi_int8 - - ));
+DESCR("subtract");
+DATA(insert OID = 2640 (  "-"	   PGNSP PGUID b f f	869 869  20 0 0 inetmi - - ));
+DESCR("subtract");
+
+/* case-insensitive LIKE hacks */
+DATA(insert OID = 1625 (  "~~*"   PGNSP PGUID b f f  19 25	16 0 1626 nameiclike iclikesel iclikejoinsel ));
+DESCR("matches LIKE expression, case-insensitive");
+#define OID_NAME_ICLIKE_OP		1625
+DATA(insert OID = 1626 (  "!~~*"  PGNSP PGUID b f f  19 25	16 0 1625 nameicnlike icnlikesel icnlikejoinsel ));
+DESCR("does not match LIKE expression, case-insensitive");
+DATA(insert OID = 1627 (  "~~*"   PGNSP PGUID b f f  25 25	16 0 1628 texticlike iclikesel iclikejoinsel ));
+DESCR("matches LIKE expression, case-insensitive");
+#define OID_TEXT_ICLIKE_OP		1627
+DATA(insert OID = 1628 (  "!~~*"  PGNSP PGUID b f f  25 25	16 0 1627 texticnlike icnlikesel icnlikejoinsel ));
+DESCR("does not match LIKE expression, case-insensitive");
+DATA(insert OID = 1629 (  "~~*"   PGNSP PGUID b f f  1042 25	16 0 1630 bpchariclike iclikesel iclikejoinsel ));
+DESCR("matches LIKE expression, case-insensitive");
+#define OID_BPCHAR_ICLIKE_OP	1629
+DATA(insert OID = 1630 (  "!~~*"  PGNSP PGUID b f f  1042 25	16 0 1629 bpcharicnlike icnlikesel icnlikejoinsel ));
+DESCR("does not match LIKE expression, case-insensitive");
+
+/* NUMERIC type - OID's 1700-1799 */
+DATA(insert OID = 1751 (  "-"	   PGNSP PGUID l f f	0 1700 1700    0	0 numeric_uminus - - ));
+DESCR("negate");
+DATA(insert OID = 1752 (  "="	   PGNSP PGUID b t t 1700 1700	 16 1752 1753 numeric_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1753 (  "<>"	   PGNSP PGUID b f f 1700 1700	 16 1753 1752 numeric_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1754 (  "<"	   PGNSP PGUID b f f 1700 1700	 16 1756 1757 numeric_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 1755 (  "<="	   PGNSP PGUID b f f 1700 1700	 16 1757 1756 numeric_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1756 (  ">"	   PGNSP PGUID b f f 1700 1700	 16 1754 1755 numeric_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 1757 (  ">="	   PGNSP PGUID b f f 1700 1700	 16 1755 1754 numeric_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 1758 (  "+"	   PGNSP PGUID b f f 1700 1700 1700 1758	0 numeric_add - - ));
+DESCR("add");
+DATA(insert OID = 1759 (  "-"	   PGNSP PGUID b f f 1700 1700 1700    0	0 numeric_sub - - ));
+DESCR("subtract");
+DATA(insert OID = 1760 (  "*"	   PGNSP PGUID b f f 1700 1700 1700 1760	0 numeric_mul - - ));
+DESCR("multiply");
+DATA(insert OID = 1761 (  "/"	   PGNSP PGUID b f f 1700 1700 1700    0	0 numeric_div - - ));
+DESCR("divide");
+DATA(insert OID = 1762 (  "%"	   PGNSP PGUID b f f 1700 1700 1700    0	0 numeric_mod - - ));
+DESCR("modulus");
+DATA(insert OID = 1038 (  "^"	   PGNSP PGUID b f f 1700 1700 1700    0	0 numeric_power - - ));
+DESCR("exponentiation");
+DATA(insert OID = 1763 (  "@"	   PGNSP PGUID l f f	0 1700 1700    0	0 numeric_abs - - ));
+DESCR("absolute value");
+
+DATA(insert OID = 1784 (  "="	  PGNSP PGUID b t f 1560 1560 16 1784 1785 biteq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1785 (  "<>"	  PGNSP PGUID b f f 1560 1560 16 1785 1784 bitne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1786 (  "<"	  PGNSP PGUID b f f 1560 1560 16 1787 1789 bitlt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 1787 (  ">"	  PGNSP PGUID b f f 1560 1560 16 1786 1788 bitgt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 1788 (  "<="	  PGNSP PGUID b f f 1560 1560 16 1789 1787 bitle scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1789 (  ">="	  PGNSP PGUID b f f 1560 1560 16 1788 1786 bitge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 1791 (  "&"	  PGNSP PGUID b f f 1560 1560 1560 1791  0 bitand - - ));
+DESCR("bitwise and");
+DATA(insert OID = 1792 (  "|"	  PGNSP PGUID b f f 1560 1560 1560 1792  0 bitor - - ));
+DESCR("bitwise or");
+DATA(insert OID = 1793 (  "#"	  PGNSP PGUID b f f 1560 1560 1560 1793  0 bitxor - - ));
+DESCR("bitwise exclusive or");
+DATA(insert OID = 1794 (  "~"	  PGNSP PGUID l f f    0 1560 1560	  0  0 bitnot - - ));
+DESCR("bitwise not");
+DATA(insert OID = 1795 (  "<<"	  PGNSP PGUID b f f 1560   23 1560	  0  0 bitshiftleft - - ));
+DESCR("bitwise shift left");
+DATA(insert OID = 1796 (  ">>"	  PGNSP PGUID b f f 1560   23 1560	  0  0 bitshiftright - - ));
+DESCR("bitwise shift right");
+DATA(insert OID = 1797 (  "||"	  PGNSP PGUID b f f 1562 1562 1562	  0  0 bitcat - - ));
+DESCR("concatenate");
+
+DATA(insert OID = 1800 (  "+"	   PGNSP PGUID b f f 1083 1186 1083  1849 0 time_pl_interval - - ));
+DESCR("add");
+DATA(insert OID = 1801 (  "-"	   PGNSP PGUID b f f 1083 1186 1083  0	0 time_mi_interval - - ));
+DESCR("subtract");
+DATA(insert OID = 1802 (  "+"	   PGNSP PGUID b f f 1266 1186 1266  2552 0 timetz_pl_interval - - ));
+DESCR("add");
+DATA(insert OID = 1803 (  "-"	   PGNSP PGUID b f f 1266 1186 1266  0	0 timetz_mi_interval - - ));
+DESCR("subtract");
+
+DATA(insert OID = 1804 (  "="	  PGNSP PGUID b t f 1562 1562 16 1804 1805 varbiteq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1805 (  "<>"	  PGNSP PGUID b f f 1562 1562 16 1805 1804 varbitne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1806 (  "<"	  PGNSP PGUID b f f 1562 1562 16 1807 1809 varbitlt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 1807 (  ">"	  PGNSP PGUID b f f 1562 1562 16 1806 1808 varbitgt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 1808 (  "<="	  PGNSP PGUID b f f 1562 1562 16 1809 1807 varbitle scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1809 (  ">="	  PGNSP PGUID b f f 1562 1562 16 1808 1806 varbitge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+DATA(insert OID = 1849 (  "+"	   PGNSP PGUID b f f 1186 1083 1083  1800 0 interval_pl_time - - ));
+DESCR("add");
+
+DATA(insert OID = 1862 ( "="	   PGNSP PGUID b t t	21	20	16 1868  1863 int28eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1863 ( "<>"	   PGNSP PGUID b f f	21	20	16 1869  1862 int28ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1864 ( "<"	   PGNSP PGUID b f f	21	20	16 1871  1867 int28lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 1865 ( ">"	   PGNSP PGUID b f f	21	20	16 1870  1866 int28gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 1866 ( "<="	   PGNSP PGUID b f f	21	20	16 1873  1865 int28le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1867 ( ">="	   PGNSP PGUID b f f	21	20	16 1872  1864 int28ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+DATA(insert OID = 1868 ( "="	   PGNSP PGUID b t t	20	21	16	1862 1869 int82eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1869 ( "<>"	   PGNSP PGUID b f f	20	21	16	1863 1868 int82ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1870 ( "<"	   PGNSP PGUID b f f	20	21	16	1865 1873 int82lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 1871 ( ">"	   PGNSP PGUID b f f	20	21	16	1864 1872 int82gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 1872 ( "<="	   PGNSP PGUID b f f	20	21	16	1867 1871 int82le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1873 ( ">="	   PGNSP PGUID b f f	20	21	16	1866 1870 int82ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+DATA(insert OID = 1874 ( "&"	   PGNSP PGUID b f f	21	21	21	1874  0 int2and - - ));
+DESCR("bitwise and");
+DATA(insert OID = 1875 ( "|"	   PGNSP PGUID b f f	21	21	21	1875  0 int2or - - ));
+DESCR("bitwise or");
+DATA(insert OID = 1876 ( "#"	   PGNSP PGUID b f f	21	21	21	1876  0 int2xor - - ));
+DESCR("bitwise exclusive or");
+DATA(insert OID = 1877 ( "~"	   PGNSP PGUID l f f	 0	21	21	 0	  0 int2not - - ));
+DESCR("bitwise not");
+DATA(insert OID = 1878 ( "<<"	   PGNSP PGUID b f f	21	23	21	 0	  0 int2shl - - ));
+DESCR("bitwise shift left");
+DATA(insert OID = 1879 ( ">>"	   PGNSP PGUID b f f	21	23	21	 0	  0 int2shr - - ));
+DESCR("bitwise shift right");
+
+DATA(insert OID = 1880 ( "&"	   PGNSP PGUID b f f	23	23	23	1880  0 int4and - - ));
+DESCR("bitwise and");
+DATA(insert OID = 1881 ( "|"	   PGNSP PGUID b f f	23	23	23	1881  0 int4or - - ));
+DESCR("bitwise or");
+DATA(insert OID = 1882 ( "#"	   PGNSP PGUID b f f	23	23	23	1882  0 int4xor - - ));
+DESCR("bitwise exclusive or");
+DATA(insert OID = 1883 ( "~"	   PGNSP PGUID l f f	 0	23	23	 0	  0 int4not - - ));
+DESCR("bitwise not");
+DATA(insert OID = 1884 ( "<<"	   PGNSP PGUID b f f	23	23	23	 0	  0 int4shl - - ));
+DESCR("bitwise shift left");
+DATA(insert OID = 1885 ( ">>"	   PGNSP PGUID b f f	23	23	23	 0	  0 int4shr - - ));
+DESCR("bitwise shift right");
+
+DATA(insert OID = 1886 ( "&"	   PGNSP PGUID b f f	20	20	20	1886  0 int8and - - ));
+DESCR("bitwise and");
+DATA(insert OID = 1887 ( "|"	   PGNSP PGUID b f f	20	20	20	1887  0 int8or - - ));
+DESCR("bitwise or");
+DATA(insert OID = 1888 ( "#"	   PGNSP PGUID b f f	20	20	20	1888  0 int8xor - - ));
+DESCR("bitwise exclusive or");
+DATA(insert OID = 1889 ( "~"	   PGNSP PGUID l f f	 0	20	20	 0	  0 int8not - - ));
+DESCR("bitwise not");
+DATA(insert OID = 1890 ( "<<"	   PGNSP PGUID b f f	20	23	20	 0	  0 int8shl - - ));
+DESCR("bitwise shift left");
+DATA(insert OID = 1891 ( ">>"	   PGNSP PGUID b f f	20	23	20	 0	  0 int8shr - - ));
+DESCR("bitwise shift right");
+
+DATA(insert OID = 1916 (  "+"	   PGNSP PGUID l f f	 0	20	20	0	0 int8up - - ));
+DESCR("unary plus");
+DATA(insert OID = 1917 (  "+"	   PGNSP PGUID l f f	 0	21	21	0	0 int2up - - ));
+DESCR("unary plus");
+DATA(insert OID = 1918 (  "+"	   PGNSP PGUID l f f	 0	23	23	0	0 int4up - - ));
+DESCR("unary plus");
+DATA(insert OID = 1919 (  "+"	   PGNSP PGUID l f f	 0	700 700 0	0 float4up - - ));
+DESCR("unary plus");
+DATA(insert OID = 1920 (  "+"	   PGNSP PGUID l f f	 0	701 701 0	0 float8up - - ));
+DESCR("unary plus");
+DATA(insert OID = 1921 (  "+"	   PGNSP PGUID l f f	 0 1700 1700	0	0 numeric_uplus - - ));
+DESCR("unary plus");
+
+/* bytea operators */
+DATA(insert OID = 1955 ( "="	   PGNSP PGUID b t t 17 17	16 1955 1956 byteaeq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 1956 ( "<>"	   PGNSP PGUID b f f 17 17	16 1956 1955 byteane neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 1957 ( "<"	   PGNSP PGUID b f f 17 17	16 1959 1960 bytealt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 1958 ( "<="	   PGNSP PGUID b f f 17 17	16 1960 1959 byteale scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 1959 ( ">"	   PGNSP PGUID b f f 17 17	16 1957 1958 byteagt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 1960 ( ">="	   PGNSP PGUID b f f 17 17	16 1958 1957 byteage scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+DATA(insert OID = 2016 (  "~~"	   PGNSP PGUID b f f 17 17	16 0	2017 bytealike likesel likejoinsel ));
+DESCR("matches LIKE expression");
+#define OID_BYTEA_LIKE_OP		2016
+DATA(insert OID = 2017 (  "!~~"    PGNSP PGUID b f f 17 17	16 0	2016 byteanlike nlikesel nlikejoinsel ));
+DESCR("does not match LIKE expression");
+DATA(insert OID = 2018 (  "||"	   PGNSP PGUID b f f 17 17	17 0	0	 byteacat - - ));
+DESCR("concatenate");
+
+/* timestamp operators */
+DATA(insert OID = 2060 (  "="	   PGNSP PGUID b t t 1114 1114	 16 2060 2061 timestamp_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 2061 (  "<>"	   PGNSP PGUID b f f 1114 1114	 16 2061 2060 timestamp_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 2062 (  "<"	   PGNSP PGUID b f f 1114 1114	 16 2064 2065 timestamp_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 2063 (  "<="	   PGNSP PGUID b f f 1114 1114	 16 2065 2064 timestamp_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 2064 (  ">"	   PGNSP PGUID b f f 1114 1114	 16 2062 2063 timestamp_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 2065 (  ">="	   PGNSP PGUID b f f 1114 1114	 16 2063 2062 timestamp_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 2066 (  "+"	   PGNSP PGUID b f f 1114 1186 1114  2553 0 timestamp_pl_interval - - ));
+DESCR("add");
+DATA(insert OID = 2067 (  "-"	   PGNSP PGUID b f f 1114 1114 1186  0	0 timestamp_mi - - ));
+DESCR("subtract");
+DATA(insert OID = 2068 (  "-"	   PGNSP PGUID b f f 1114 1186 1114  0	0 timestamp_mi_interval - - ));
+DESCR("subtract");
+
+/* character-by-character (not collation order) comparison operators for character types */
+
+DATA(insert OID = 2314 ( "~<~"	PGNSP PGUID b f f 25 25 16 2318 2317 text_pattern_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 2315 ( "~<=~" PGNSP PGUID b f f 25 25 16 2317 2318 text_pattern_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 2317 ( "~>=~" PGNSP PGUID b f f 25 25 16 2315 2314 text_pattern_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 2318 ( "~>~"	PGNSP PGUID b f f 25 25 16 2314 2315 text_pattern_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+
+DATA(insert OID = 2326 ( "~<~"	PGNSP PGUID b f f 1042 1042 16 2330 2329 bpchar_pattern_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 2327 ( "~<=~" PGNSP PGUID b f f 1042 1042 16 2329 2330 bpchar_pattern_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 2329 ( "~>=~" PGNSP PGUID b f f 1042 1042 16 2327 2326 bpchar_pattern_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 2330 ( "~>~"	PGNSP PGUID b f f 1042 1042 16 2326 2327 bpchar_pattern_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+
+/* crosstype operations for date vs. timestamp and timestamptz */
+
+DATA(insert OID = 2345 ( "<"	   PGNSP PGUID b f f	1082	1114   16 2375 2348 date_lt_timestamp scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 2346 ( "<="	   PGNSP PGUID b f f	1082	1114   16 2374 2349 date_le_timestamp scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 2347 ( "="	   PGNSP PGUID b t f	1082	1114   16 2373 2350 date_eq_timestamp eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 2348 ( ">="	   PGNSP PGUID b f f	1082	1114   16 2372 2345 date_ge_timestamp scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 2349 ( ">"	   PGNSP PGUID b f f	1082	1114   16 2371 2346 date_gt_timestamp scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 2350 ( "<>"	   PGNSP PGUID b f f	1082	1114   16 2376 2347 date_ne_timestamp neqsel neqjoinsel ));
+DESCR("not equal");
+
+DATA(insert OID = 2358 ( "<"	   PGNSP PGUID b f f	1082	1184   16 2388 2361 date_lt_timestamptz scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 2359 ( "<="	   PGNSP PGUID b f f	1082	1184   16 2387 2362 date_le_timestamptz scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 2360 ( "="	   PGNSP PGUID b t f	1082	1184   16 2386 2363 date_eq_timestamptz eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 2361 ( ">="	   PGNSP PGUID b f f	1082	1184   16 2385 2358 date_ge_timestamptz scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 2362 ( ">"	   PGNSP PGUID b f f	1082	1184   16 2384 2359 date_gt_timestamptz scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 2363 ( "<>"	   PGNSP PGUID b f f	1082	1184   16 2389 2360 date_ne_timestamptz neqsel neqjoinsel ));
+DESCR("not equal");
+
+DATA(insert OID = 2371 ( "<"	   PGNSP PGUID b f f	1114	1082   16 2349 2374 timestamp_lt_date scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 2372 ( "<="	   PGNSP PGUID b f f	1114	1082   16 2348 2375 timestamp_le_date scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 2373 ( "="	   PGNSP PGUID b t f	1114	1082   16 2347 2376 timestamp_eq_date eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 2374 ( ">="	   PGNSP PGUID b f f	1114	1082   16 2346 2371 timestamp_ge_date scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 2375 ( ">"	   PGNSP PGUID b f f	1114	1082   16 2345 2372 timestamp_gt_date scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 2376 ( "<>"	   PGNSP PGUID b f f	1114	1082   16 2350 2373 timestamp_ne_date neqsel neqjoinsel ));
+DESCR("not equal");
+
+DATA(insert OID = 2384 ( "<"	   PGNSP PGUID b f f	1184	1082   16 2362 2387 timestamptz_lt_date scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 2385 ( "<="	   PGNSP PGUID b f f	1184	1082   16 2361 2388 timestamptz_le_date scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 2386 ( "="	   PGNSP PGUID b t f	1184	1082   16 2360 2389 timestamptz_eq_date eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 2387 ( ">="	   PGNSP PGUID b f f	1184	1082   16 2359 2384 timestamptz_ge_date scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 2388 ( ">"	   PGNSP PGUID b f f	1184	1082   16 2358 2385 timestamptz_gt_date scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 2389 ( "<>"	   PGNSP PGUID b f f	1184	1082   16 2363 2386 timestamptz_ne_date neqsel neqjoinsel ));
+DESCR("not equal");
+
+/* crosstype operations for timestamp vs. timestamptz */
+
+DATA(insert OID = 2534 ( "<"	   PGNSP PGUID b f f	1114	1184   16 2544 2537 timestamp_lt_timestamptz scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 2535 ( "<="	   PGNSP PGUID b f f	1114	1184   16 2543 2538 timestamp_le_timestamptz scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 2536 ( "="	   PGNSP PGUID b t f	1114	1184   16 2542 2539 timestamp_eq_timestamptz eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 2537 ( ">="	   PGNSP PGUID b f f	1114	1184   16 2541 2534 timestamp_ge_timestamptz scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 2538 ( ">"	   PGNSP PGUID b f f	1114	1184   16 2540 2535 timestamp_gt_timestamptz scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 2539 ( "<>"	   PGNSP PGUID b f f	1114	1184   16 2545 2536 timestamp_ne_timestamptz neqsel neqjoinsel ));
+DESCR("not equal");
+
+DATA(insert OID = 2540 ( "<"	   PGNSP PGUID b f f	1184	1114   16 2538 2543 timestamptz_lt_timestamp scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 2541 ( "<="	   PGNSP PGUID b f f	1184	1114   16 2537 2544 timestamptz_le_timestamp scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 2542 ( "="	   PGNSP PGUID b t f	1184	1114   16 2536 2545 timestamptz_eq_timestamp eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 2543 ( ">="	   PGNSP PGUID b f f	1184	1114   16 2535 2540 timestamptz_ge_timestamp scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 2544 ( ">"	   PGNSP PGUID b f f	1184	1114   16 2534 2541 timestamptz_gt_timestamp scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 2545 ( "<>"	   PGNSP PGUID b f f	1184	1114   16 2539 2542 timestamptz_ne_timestamp neqsel neqjoinsel ));
+DESCR("not equal");
+
+/* formerly-missing interval + datetime operators */
+DATA(insert OID = 2551 (  "+"	   PGNSP PGUID b f f	1186 1082 1114 1076 0 interval_pl_date - - ));
+DESCR("add");
+DATA(insert OID = 2552 (  "+"	   PGNSP PGUID b f f	1186 1266 1266 1802 0 interval_pl_timetz - - ));
+DESCR("add");
+DATA(insert OID = 2553 (  "+"	   PGNSP PGUID b f f	1186 1114 1114 2066 0 interval_pl_timestamp - - ));
+DESCR("add");
+DATA(insert OID = 2554 (  "+"	   PGNSP PGUID b f f	1186 1184 1184 1327 0 interval_pl_timestamptz - - ));
+DESCR("add");
+DATA(insert OID = 2555 (  "+"	   PGNSP PGUID b f f	23	 1082 1082 1100 0 integer_pl_date - - ));
+DESCR("add");
+
+/* new operators for Y-direction rtree opfamilies */
+DATA(insert OID = 2570 (  "<<|"    PGNSP PGUID b f f 603 603	16	 0	 0 box_below positionsel positionjoinsel ));
+DESCR("is below");
+DATA(insert OID = 2571 (  "&<|"    PGNSP PGUID b f f 603 603	16	 0	 0 box_overbelow positionsel positionjoinsel ));
+DESCR("overlaps or is below");
+DATA(insert OID = 2572 (  "|&>"    PGNSP PGUID b f f 603 603	16	 0	 0 box_overabove positionsel positionjoinsel ));
+DESCR("overlaps or is above");
+DATA(insert OID = 2573 (  "|>>"    PGNSP PGUID b f f 603 603	16	 0	 0 box_above positionsel positionjoinsel ));
+DESCR("is above");
+DATA(insert OID = 2574 (  "<<|"    PGNSP PGUID b f f 604 604	16	 0	 0 poly_below positionsel positionjoinsel ));
+DESCR("is below");
+DATA(insert OID = 2575 (  "&<|"    PGNSP PGUID b f f 604 604	16	 0	 0 poly_overbelow positionsel positionjoinsel ));
+DESCR("overlaps or is below");
+DATA(insert OID = 2576 (  "|&>"    PGNSP PGUID b f f 604 604	16	 0	 0 poly_overabove positionsel positionjoinsel ));
+DESCR("overlaps or is above");
+DATA(insert OID = 2577 (  "|>>"    PGNSP PGUID b f f 604 604	16	 0	 0 poly_above positionsel positionjoinsel ));
+DESCR("is above");
+DATA(insert OID = 2589 (  "&<|"    PGNSP PGUID b f f 718 718	16	 0	 0 circle_overbelow positionsel positionjoinsel ));
+DESCR("overlaps or is below");
+DATA(insert OID = 2590 (  "|&>"    PGNSP PGUID b f f 718 718	16	 0	 0 circle_overabove positionsel positionjoinsel ));
+DESCR("overlaps or is above");
+
+/* overlap/contains/contained for arrays */
+DATA(insert OID = 2750 (  "&&"	   PGNSP PGUID b f f 2277 2277	16 2750  0 arrayoverlap arraycontsel arraycontjoinsel ));
+DESCR("overlaps");
+#define OID_ARRAY_OVERLAP_OP	2750
+DATA(insert OID = 2751 (  "@>"	   PGNSP PGUID b f f 2277 2277	16 2752  0 arraycontains arraycontsel arraycontjoinsel ));
+DESCR("contains");
+#define OID_ARRAY_CONTAINS_OP	2751
+DATA(insert OID = 2752 (  "<@"	   PGNSP PGUID b f f 2277 2277	16 2751  0 arraycontained arraycontsel arraycontjoinsel ));
+DESCR("is contained by");
+#define OID_ARRAY_CONTAINED_OP	2752
+
+/* capturing operators to preserve pre-8.3 behavior of text concatenation */
+DATA(insert OID = 2779 (  "||"	   PGNSP PGUID b f f 25 2776	25	 0 0 textanycat - - ));
+DESCR("concatenate");
+DATA(insert OID = 2780 (  "||"	   PGNSP PGUID b f f 2776 25	25	 0 0 anytextcat - - ));
+DESCR("concatenate");
+
+/* obsolete names for contains/contained-by operators; remove these someday */
+DATA(insert OID = 2860 (  "@"	   PGNSP PGUID b f f 604 604	16 2861  0 poly_contained contsel contjoinsel ));
+DESCR("deprecated, use <@ instead");
+DATA(insert OID = 2861 (  "~"	   PGNSP PGUID b f f 604 604	16 2860  0 poly_contain contsel contjoinsel ));
+DESCR("deprecated, use @> instead");
+DATA(insert OID = 2862 (  "@"	   PGNSP PGUID b f f 603 603	16 2863  0 box_contained contsel contjoinsel ));
+DESCR("deprecated, use <@ instead");
+DATA(insert OID = 2863 (  "~"	   PGNSP PGUID b f f 603 603	16 2862  0 box_contain contsel contjoinsel ));
+DESCR("deprecated, use @> instead");
+DATA(insert OID = 2864 (  "@"	   PGNSP PGUID b f f 718 718	16 2865  0 circle_contained contsel contjoinsel ));
+DESCR("deprecated, use <@ instead");
+DATA(insert OID = 2865 (  "~"	   PGNSP PGUID b f f 718 718	16 2864  0 circle_contain contsel contjoinsel ));
+DESCR("deprecated, use @> instead");
+DATA(insert OID = 2866 (  "@"	   PGNSP PGUID b f f 600 603	16	 0	 0 on_pb - - ));
+DESCR("deprecated, use <@ instead");
+DATA(insert OID = 2867 (  "@"	   PGNSP PGUID b f f 600 602	16 2868  0 on_ppath - - ));
+DESCR("deprecated, use <@ instead");
+DATA(insert OID = 2868 (  "~"	   PGNSP PGUID b f f 602 600	 16  2867  0 path_contain_pt - - ));
+DESCR("deprecated, use @> instead");
+DATA(insert OID = 2869 (  "@"	   PGNSP PGUID b f f 600 604	 16  2870  0 pt_contained_poly - - ));
+DESCR("deprecated, use <@ instead");
+DATA(insert OID = 2870 (  "~"	   PGNSP PGUID b f f 604 600	 16  2869  0 poly_contain_pt - - ));
+DESCR("deprecated, use @> instead");
+DATA(insert OID = 2871 (  "@"	   PGNSP PGUID b f f 600 718	 16  2872  0 pt_contained_circle - - ));
+DESCR("deprecated, use <@ instead");
+DATA(insert OID = 2872 (  "~"	   PGNSP PGUID b f f 718 600	 16  2871  0 circle_contain_pt - - ));
+DESCR("deprecated, use @> instead");
+DATA(insert OID = 2873 (  "@"	   PGNSP PGUID b f f 600 628 16   0  0 on_pl - - ));
+DESCR("deprecated, use <@ instead");
+DATA(insert OID = 2874 (  "@"	   PGNSP PGUID b f f 600 601 16   0  0 on_ps - - ));
+DESCR("deprecated, use <@ instead");
+DATA(insert OID = 2875 (  "@"	   PGNSP PGUID b f f 601 628 16   0  0 on_sl - - ));
+DESCR("deprecated, use <@ instead");
+DATA(insert OID = 2876 (  "@"	   PGNSP PGUID b f f 601 603 16   0  0 on_sb - - ));
+DESCR("deprecated, use <@ instead");
+DATA(insert OID = 2877 (  "~"	   PGNSP PGUID b f f 1034 1033	 16 0 0 aclcontains - - ));
+DESCR("deprecated, use @> instead");
+
+/* uuid operators */
+DATA(insert OID = 2972 (  "="	   PGNSP PGUID b t t 2950 2950 16 2972 2973 uuid_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 2973 (  "<>"	   PGNSP PGUID b f f 2950 2950 16 2973 2972 uuid_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 2974 (  "<"	   PGNSP PGUID b f f 2950 2950 16 2975 2977 uuid_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 2975 (  ">"	   PGNSP PGUID b f f 2950 2950 16 2974 2976 uuid_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 2976 (  "<="	   PGNSP PGUID b f f 2950 2950 16 2977 2975 uuid_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 2977 (  ">="	   PGNSP PGUID b f f 2950 2950 16 2976 2974 uuid_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+/* pg_lsn operators */
+DATA(insert OID = 3222 (  "="	   PGNSP PGUID b t t 3220 3220 16 3222 3223 pg_lsn_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 3223 (  "<>"	   PGNSP PGUID b f f 3220 3220 16 3223 3222 pg_lsn_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 3224 (  "<"	   PGNSP PGUID b f f 3220 3220 16 3225 3227 pg_lsn_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 3225 (  ">"	   PGNSP PGUID b f f 3220 3220 16 3224 3226 pg_lsn_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 3226 (  "<="	   PGNSP PGUID b f f 3220 3220 16 3227 3225 pg_lsn_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 3227 (  ">="	   PGNSP PGUID b f f 3220 3220 16 3226 3224 pg_lsn_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 3228 (  "-"	   PGNSP PGUID b f f 3220 3220 1700    0	0 pg_lsn_mi - - ));
+DESCR("minus");
+
+/* enum operators */
+DATA(insert OID = 3516 (  "="	   PGNSP PGUID b t t 3500 3500 16 3516 3517 enum_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 3517 (  "<>"	   PGNSP PGUID b f f 3500 3500 16 3517 3516 enum_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 3518 (  "<"	   PGNSP PGUID b f f 3500 3500 16 3519 3521 enum_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 3519 (  ">"	   PGNSP PGUID b f f 3500 3500 16 3518 3520 enum_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 3520 (  "<="	   PGNSP PGUID b f f 3500 3500 16 3521 3519 enum_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 3521 (  ">="	   PGNSP PGUID b f f 3500 3500 16 3520 3518 enum_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+/*
+ * tsearch operations
+ */
+DATA(insert OID = 3627 (  "<"	   PGNSP PGUID b f f 3614	 3614	 16 3632 3631	 tsvector_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 3628 (  "<="	   PGNSP PGUID b f f 3614	 3614	 16 3631 3632	 tsvector_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 3629 (  "="	   PGNSP PGUID b t f 3614	 3614	 16 3629 3630	 tsvector_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 3630 (  "<>"	   PGNSP PGUID b f f 3614	 3614	 16 3630 3629	 tsvector_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 3631 (  ">="	   PGNSP PGUID b f f 3614	 3614	 16 3628 3627	 tsvector_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 3632 (  ">"	   PGNSP PGUID b f f 3614	 3614	 16 3627 3628	 tsvector_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 3633 (  "||"	   PGNSP PGUID b f f 3614	 3614	 3614  0	0	 tsvector_concat   -	-	  ));
+DESCR("concatenate");
+DATA(insert OID = 3636 (  "@@"	   PGNSP PGUID b f f 3614	 3615	 16 3637	0	 ts_match_vq   tsmatchsel tsmatchjoinsel ));
+DESCR("text search match");
+DATA(insert OID = 3637 (  "@@"	   PGNSP PGUID b f f 3615	 3614	 16 3636	0	 ts_match_qv   tsmatchsel tsmatchjoinsel ));
+DESCR("text search match");
+DATA(insert OID = 3660 (  "@@@"    PGNSP PGUID b f f 3614	 3615	 16 3661	0	 ts_match_vq   tsmatchsel tsmatchjoinsel ));
+DESCR("deprecated, use @@ instead");
+DATA(insert OID = 3661 (  "@@@"    PGNSP PGUID b f f 3615	 3614	 16 3660	0	 ts_match_qv   tsmatchsel tsmatchjoinsel ));
+DESCR("deprecated, use @@ instead");
+DATA(insert OID = 3674 (  "<"	   PGNSP PGUID b f f 3615	 3615	 16 3679 3678	 tsquery_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 3675 (  "<="	   PGNSP PGUID b f f 3615	 3615	 16 3678 3679	 tsquery_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 3676 (  "="	   PGNSP PGUID b t f 3615	 3615	 16 3676 3677	 tsquery_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 3677 (  "<>"	   PGNSP PGUID b f f 3615	 3615	 16 3677 3676	 tsquery_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 3678 (  ">="	   PGNSP PGUID b f f 3615	 3615	 16 3675 3674	 tsquery_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 3679 (  ">"	   PGNSP PGUID b f f 3615	 3615	 16 3674 3675	 tsquery_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 3680 (  "&&"	   PGNSP PGUID b f f 3615	 3615	 3615  0	0	 tsquery_and   -	-	  ));
+DESCR("AND-concatenate");
+DATA(insert OID = 3681 (  "||"	   PGNSP PGUID b f f 3615	 3615	 3615  0	0	 tsquery_or   -		-	  ));
+DESCR("OR-concatenate");
+DATA(insert OID = 3682 (  "!!"	   PGNSP PGUID l f f 0		 3615	 3615  0	0	 tsquery_not   -	-	  ));
+DESCR("NOT tsquery");
+DATA(insert OID = 3693 (  "@>"	   PGNSP PGUID b f f 3615	 3615	 16 3694	0	 tsq_mcontains	contsel    contjoinsel	 ));
+DESCR("contains");
+DATA(insert OID = 3694 (  "<@"	   PGNSP PGUID b f f 3615	 3615	 16 3693	0	 tsq_mcontained contsel    contjoinsel	 ));
+DESCR("is contained by");
+DATA(insert OID = 3762 (  "@@"	   PGNSP PGUID b f f 25		 25		 16    0	0	 ts_match_tt	contsel    contjoinsel	 ));
+DESCR("text search match");
+DATA(insert OID = 3763 (  "@@"	   PGNSP PGUID b f f 25		 3615	 16    0	0	 ts_match_tq	contsel    contjoinsel	 ));
+DESCR("text search match");
+
+/* generic record comparison operators */
+DATA(insert OID = 2988 (  "="	   PGNSP PGUID b t f 2249 2249 16 2988 2989 record_eq eqsel eqjoinsel ));
+DESCR("equal");
+#define RECORD_EQ_OP 2988
+DATA(insert OID = 2989 (  "<>"	   PGNSP PGUID b f f 2249 2249 16 2989 2988 record_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 2990 (  "<"	   PGNSP PGUID b f f 2249 2249 16 2991 2993 record_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+#define RECORD_LT_OP 2990
+DATA(insert OID = 2991 (  ">"	   PGNSP PGUID b f f 2249 2249 16 2990 2992 record_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+#define RECORD_GT_OP 2991
+DATA(insert OID = 2992 (  "<="	   PGNSP PGUID b f f 2249 2249 16 2993 2991 record_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 2993 (  ">="	   PGNSP PGUID b f f 2249 2249 16 2992 2990 record_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+/* byte-oriented tests for identical rows and fast sorting */
+DATA(insert OID = 3188 (  "*="	   PGNSP PGUID b t f 2249 2249 16 3188 3189 record_image_eq eqsel eqjoinsel ));
+DESCR("identical");
+DATA(insert OID = 3189 (  "*<>"   PGNSP PGUID b f f 2249 2249 16 3189 3188 record_image_ne neqsel neqjoinsel ));
+DESCR("not identical");
+DATA(insert OID = 3190 (  "*<"	   PGNSP PGUID b f f 2249 2249 16 3191 3193 record_image_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 3191 (  "*>"	   PGNSP PGUID b f f 2249 2249 16 3190 3192 record_image_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 3192 (  "*<="   PGNSP PGUID b f f 2249 2249 16 3193 3191 record_image_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 3193 (  "*>="   PGNSP PGUID b f f 2249 2249 16 3192 3190 record_image_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+
+/* generic range type operators */
+DATA(insert OID = 3882 (  "="	   PGNSP PGUID b t t 3831 3831 16 3882 3883 range_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 3883 (  "<>"	   PGNSP PGUID b f f 3831 3831 16 3883 3882 range_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 3884 (  "<"	   PGNSP PGUID b f f 3831 3831 16 3887 3886 range_lt rangesel scalarltjoinsel ));
+DESCR("less than");
+#define OID_RANGE_LESS_OP 3884
+DATA(insert OID = 3885 (  "<="	   PGNSP PGUID b f f 3831 3831 16 3886 3887 range_le rangesel scalarltjoinsel ));
+DESCR("less than or equal");
+#define OID_RANGE_LESS_EQUAL_OP 3885
+DATA(insert OID = 3886 (  ">="	   PGNSP PGUID b f f 3831 3831 16 3885 3884 range_ge rangesel scalargtjoinsel ));
+DESCR("greater than or equal");
+#define OID_RANGE_GREATER_EQUAL_OP 3886
+DATA(insert OID = 3887 (  ">"	   PGNSP PGUID b f f 3831 3831 16 3884 3885 range_gt rangesel scalargtjoinsel ));
+DESCR("greater than");
+#define OID_RANGE_GREATER_OP 3887
+DATA(insert OID = 3888 (  "&&"	   PGNSP PGUID b f f 3831 3831 16 3888 0 range_overlaps rangesel areajoinsel ));
+DESCR("overlaps");
+#define OID_RANGE_OVERLAP_OP 3888
+DATA(insert OID = 3889 (  "@>"	   PGNSP PGUID b f f 3831 2283 16 3891 0 range_contains_elem rangesel contjoinsel ));
+DESCR("contains");
+#define OID_RANGE_CONTAINS_ELEM_OP 3889
+DATA(insert OID = 3890 (  "@>"	   PGNSP PGUID b f f 3831 3831 16 3892 0 range_contains rangesel contjoinsel ));
+DESCR("contains");
+#define OID_RANGE_CONTAINS_OP 3890
+DATA(insert OID = 3891 (  "<@"	   PGNSP PGUID b f f 2283 3831 16 3889 0 elem_contained_by_range rangesel contjoinsel ));
+DESCR("is contained by");
+#define OID_RANGE_ELEM_CONTAINED_OP 3891
+DATA(insert OID = 3892 (  "<@"	   PGNSP PGUID b f f 3831 3831 16 3890 0 range_contained_by rangesel contjoinsel ));
+DESCR("is contained by");
+#define OID_RANGE_CONTAINED_OP 3892
+DATA(insert OID = 3893 (  "<<"	   PGNSP PGUID b f f 3831 3831 16 3894 0 range_before rangesel scalarltjoinsel ));
+DESCR("is left of");
+#define OID_RANGE_LEFT_OP 3893
+DATA(insert OID = 3894 (  ">>"	   PGNSP PGUID b f f 3831 3831 16 3893 0 range_after rangesel scalargtjoinsel ));
+DESCR("is right of");
+#define OID_RANGE_RIGHT_OP 3894
+DATA(insert OID = 3895 (  "&<"	   PGNSP PGUID b f f 3831 3831 16 0 0 range_overleft rangesel scalarltjoinsel ));
+DESCR("overlaps or is left of");
+#define OID_RANGE_OVERLAPS_LEFT_OP 3895
+DATA(insert OID = 3896 (  "&>"	   PGNSP PGUID b f f 3831 3831 16 0 0 range_overright rangesel scalargtjoinsel ));
+DESCR("overlaps or is right of");
+#define OID_RANGE_OVERLAPS_RIGHT_OP 3896
+DATA(insert OID = 3897 (  "-|-"    PGNSP PGUID b f f 3831 3831 16 3897 0 range_adjacent contsel contjoinsel ));
+DESCR("is adjacent to");
+DATA(insert OID = 3898 (  "+"	   PGNSP PGUID b f f 3831 3831 3831 3898 0 range_union - - ));
+DESCR("range union");
+DATA(insert OID = 3899 (  "-"	   PGNSP PGUID b f f 3831 3831 3831 0 0 range_minus - - ));
+DESCR("range difference");
+DATA(insert OID = 3900 (  "*"	   PGNSP PGUID b f f 3831 3831 3831 3900 0 range_intersect - - ));
+DESCR("range intersection");
+DATA(insert OID = 3962 (  "->"	   PGNSP PGUID b f f 114 25 114 0 0 json_object_field - - ));
+DESCR("get json object field");
+DATA(insert OID = 3963 (  "->>"    PGNSP PGUID b f f 114 25 25 0 0 json_object_field_text - - ));
+DESCR("get json object field as text");
+DATA(insert OID = 3964 (  "->"	   PGNSP PGUID b f f 114 23 114 0 0 json_array_element - - ));
+DESCR("get json array element");
+DATA(insert OID = 3965 (  "->>"    PGNSP PGUID b f f 114 23 25 0 0 json_array_element_text - - ));
+DESCR("get json array element as text");
+DATA(insert OID = 3966 (  "#>"	   PGNSP PGUID b f f 114 1009 114 0 0 json_extract_path - - ));
+DESCR("get value from json with path elements");
+DATA(insert OID = 3967 (  "#>>"    PGNSP PGUID b f f 114 1009 25 0 0 json_extract_path_text - - ));
+DESCR("get value from json as text with path elements");
+DATA(insert OID = 3211 (  "->"	   PGNSP PGUID b f f 3802 25 3802 0 0 jsonb_object_field - - ));
+DESCR("get jsonb object field");
+DATA(insert OID = 3477 (  "->>"    PGNSP PGUID b f f 3802 25 25 0 0 jsonb_object_field_text - - ));
+DESCR("get jsonb object field as text");
+DATA(insert OID = 3212 (  "->"	   PGNSP PGUID b f f 3802 23 3802 0 0 jsonb_array_element - - ));
+DESCR("get jsonb array element");
+DATA(insert OID = 3481 (  "->>"    PGNSP PGUID b f f 3802 23 25 0 0 jsonb_array_element_text - - ));
+DESCR("get jsonb array element as text");
+DATA(insert OID = 3213 (  "#>"	   PGNSP PGUID b f f 3802 1009 3802 0 0 jsonb_extract_path - - ));
+DESCR("get value from jsonb with path elements");
+DATA(insert OID = 3206 (  "#>>"    PGNSP PGUID b f f 3802 1009 25 0 0 jsonb_extract_path_text - - ));
+DESCR("get value from jsonb as text with path elements");
+DATA(insert OID = 3240 (  "="	 PGNSP PGUID b t t 3802 3802  16 3240 3241 jsonb_eq eqsel eqjoinsel ));
+DESCR("equal");
+DATA(insert OID = 3241 (  "<>"	 PGNSP PGUID b f f 3802 3802  16 3241 3240 jsonb_ne neqsel neqjoinsel ));
+DESCR("not equal");
+DATA(insert OID = 3242 (  "<"		PGNSP PGUID b f f 3802 3802 16 3243 3245 jsonb_lt scalarltsel scalarltjoinsel ));
+DESCR("less than");
+DATA(insert OID = 3243 (  ">"		PGNSP PGUID b f f 3802 3802 16 3242 3244 jsonb_gt scalargtsel scalargtjoinsel ));
+DESCR("greater than");
+DATA(insert OID = 3244 (  "<="	PGNSP PGUID b f f 3802 3802 16 3245 3243 jsonb_le scalarltsel scalarltjoinsel ));
+DESCR("less than or equal");
+DATA(insert OID = 3245 (  ">="	PGNSP PGUID b f f 3802 3802 16 3244 3242 jsonb_ge scalargtsel scalargtjoinsel ));
+DESCR("greater than or equal");
+DATA(insert OID = 3246 (  "@>"	   PGNSP PGUID b f f 3802 3802 16 3250 0 jsonb_contains contsel contjoinsel ));
+DESCR("contains");
+DATA(insert OID = 3247 (  "?"	   PGNSP PGUID b f f 3802 25 16 0 0 jsonb_exists contsel contjoinsel ));
+DESCR("key exists");
+DATA(insert OID = 3248 (  "?|"	   PGNSP PGUID b f f 3802 1009 16 0 0 jsonb_exists_any contsel contjoinsel ));
+DESCR("any key exists");
+DATA(insert OID = 3249 (  "?&"	   PGNSP PGUID b f f 3802 1009 16 0 0 jsonb_exists_all contsel contjoinsel ));
+DESCR("all keys exist");
+DATA(insert OID = 3250 (  "<@"	   PGNSP PGUID b f f 3802 3802 16 3246 0 jsonb_contained contsel contjoinsel ));
+DESCR("is contained by");
+DATA(insert OID = 3284 (  "||"	   PGNSP PGUID b f f 3802 3802 3802 0 0 jsonb_concat - - ));
+DESCR("concatenate");
+DATA(insert OID = 3285 (  "-"	   PGNSP PGUID b f f 3802 25 3802 0 0 3302 - - ));
+DESCR("delete object field");
+DATA(insert OID = 3286 (  "-"	   PGNSP PGUID b f f 3802 23 3802 0 0 3303 - - ));
+DESCR("delete array element");
+DATA(insert OID = 3287 (  "#-"	   PGNSP PGUID b f f 3802 1009 3802 0 0 jsonb_delete_path - - ));
+DESCR("delete path");
+
+#endif   /* PG_OPERATOR_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_opfamily.h b/foreign/libpg_query/src/postgres/include/catalog/pg_opfamily.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_opfamily.h
@@ -0,0 +1,186 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_opfamily.h
+ *	  definition of the system "opfamily" relation (pg_opfamily)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_opfamily.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_OPFAMILY_H
+#define PG_OPFAMILY_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_opfamily definition. cpp turns this into
+ *		typedef struct FormData_pg_opfamily
+ * ----------------
+ */
+#define OperatorFamilyRelationId  2753
+
+CATALOG(pg_opfamily,2753)
+{
+	Oid			opfmethod;		/* index access method opfamily is for */
+	NameData	opfname;		/* name of this opfamily */
+	Oid			opfnamespace;	/* namespace of this opfamily */
+	Oid			opfowner;		/* opfamily owner */
+} FormData_pg_opfamily;
+
+/* ----------------
+ *		Form_pg_opfamily corresponds to a pointer to a tuple with
+ *		the format of pg_opfamily relation.
+ * ----------------
+ */
+typedef FormData_pg_opfamily *Form_pg_opfamily;
+
+/* ----------------
+ *		compiler constants for pg_opfamily
+ * ----------------
+ */
+#define Natts_pg_opfamily				4
+#define Anum_pg_opfamily_opfmethod		1
+#define Anum_pg_opfamily_opfname		2
+#define Anum_pg_opfamily_opfnamespace	3
+#define Anum_pg_opfamily_opfowner		4
+
+/* ----------------
+ *		initial contents of pg_opfamily
+ * ----------------
+ */
+
+DATA(insert OID =  421 (	403		abstime_ops		PGNSP PGUID ));
+DATA(insert OID =  397 (	403		array_ops		PGNSP PGUID ));
+DATA(insert OID =  627 (	405		array_ops		PGNSP PGUID ));
+DATA(insert OID =  423 (	403		bit_ops			PGNSP PGUID ));
+DATA(insert OID =  424 (	403		bool_ops		PGNSP PGUID ));
+#define BOOL_BTREE_FAM_OID 424
+DATA(insert OID =  426 (	403		bpchar_ops		PGNSP PGUID ));
+#define BPCHAR_BTREE_FAM_OID 426
+DATA(insert OID =  427 (	405		bpchar_ops		PGNSP PGUID ));
+DATA(insert OID =  428 (	403		bytea_ops		PGNSP PGUID ));
+#define BYTEA_BTREE_FAM_OID 428
+DATA(insert OID =  429 (	403		char_ops		PGNSP PGUID ));
+DATA(insert OID =  431 (	405		char_ops		PGNSP PGUID ));
+DATA(insert OID =  434 (	403		datetime_ops	PGNSP PGUID ));
+DATA(insert OID =  435 (	405		date_ops		PGNSP PGUID ));
+DATA(insert OID = 1970 (	403		float_ops		PGNSP PGUID ));
+DATA(insert OID = 1971 (	405		float_ops		PGNSP PGUID ));
+DATA(insert OID = 1974 (	403		network_ops		PGNSP PGUID ));
+#define NETWORK_BTREE_FAM_OID 1974
+DATA(insert OID = 1975 (	405		network_ops		PGNSP PGUID ));
+DATA(insert OID = 3550 (	783		network_ops		PGNSP PGUID ));
+DATA(insert OID = 1976 (	403		integer_ops		PGNSP PGUID ));
+#define INTEGER_BTREE_FAM_OID 1976
+DATA(insert OID = 1977 (	405		integer_ops		PGNSP PGUID ));
+DATA(insert OID = 1982 (	403		interval_ops	PGNSP PGUID ));
+DATA(insert OID = 1983 (	405		interval_ops	PGNSP PGUID ));
+DATA(insert OID = 1984 (	403		macaddr_ops		PGNSP PGUID ));
+DATA(insert OID = 1985 (	405		macaddr_ops		PGNSP PGUID ));
+DATA(insert OID = 1986 (	403		name_ops		PGNSP PGUID ));
+#define NAME_BTREE_FAM_OID 1986
+DATA(insert OID = 1987 (	405		name_ops		PGNSP PGUID ));
+DATA(insert OID = 1988 (	403		numeric_ops		PGNSP PGUID ));
+DATA(insert OID = 1998 (	405		numeric_ops		PGNSP PGUID ));
+DATA(insert OID = 1989 (	403		oid_ops			PGNSP PGUID ));
+#define OID_BTREE_FAM_OID 1989
+DATA(insert OID = 1990 (	405		oid_ops			PGNSP PGUID ));
+DATA(insert OID = 1991 (	403		oidvector_ops	PGNSP PGUID ));
+DATA(insert OID = 1992 (	405		oidvector_ops	PGNSP PGUID ));
+DATA(insert OID = 2994 (	403		record_ops		PGNSP PGUID ));
+DATA(insert OID = 3194 (	403		record_image_ops	PGNSP PGUID ));
+DATA(insert OID = 1994 (	403		text_ops		PGNSP PGUID ));
+#define TEXT_BTREE_FAM_OID 1994
+DATA(insert OID = 1995 (	405		text_ops		PGNSP PGUID ));
+DATA(insert OID = 1996 (	403		time_ops		PGNSP PGUID ));
+DATA(insert OID = 1997 (	405		time_ops		PGNSP PGUID ));
+DATA(insert OID = 1999 (	405		timestamptz_ops PGNSP PGUID ));
+DATA(insert OID = 2000 (	403		timetz_ops		PGNSP PGUID ));
+DATA(insert OID = 2001 (	405		timetz_ops		PGNSP PGUID ));
+DATA(insert OID = 2002 (	403		varbit_ops		PGNSP PGUID ));
+DATA(insert OID = 2040 (	405		timestamp_ops	PGNSP PGUID ));
+DATA(insert OID = 2095 (	403		text_pattern_ops	PGNSP PGUID ));
+#define TEXT_PATTERN_BTREE_FAM_OID 2095
+DATA(insert OID = 2097 (	403		bpchar_pattern_ops	PGNSP PGUID ));
+#define BPCHAR_PATTERN_BTREE_FAM_OID 2097
+DATA(insert OID = 2099 (	403		money_ops		PGNSP PGUID ));
+DATA(insert OID = 2222 (	405		bool_ops		PGNSP PGUID ));
+#define BOOL_HASH_FAM_OID 2222
+DATA(insert OID = 2223 (	405		bytea_ops		PGNSP PGUID ));
+DATA(insert OID = 2224 (	405		int2vector_ops	PGNSP PGUID ));
+DATA(insert OID = 2789 (	403		tid_ops			PGNSP PGUID ));
+DATA(insert OID = 2225 (	405		xid_ops			PGNSP PGUID ));
+DATA(insert OID = 2226 (	405		cid_ops			PGNSP PGUID ));
+DATA(insert OID = 2227 (	405		abstime_ops		PGNSP PGUID ));
+DATA(insert OID = 2228 (	405		reltime_ops		PGNSP PGUID ));
+DATA(insert OID = 2229 (	405		text_pattern_ops	PGNSP PGUID ));
+DATA(insert OID = 2231 (	405		bpchar_pattern_ops	PGNSP PGUID ));
+DATA(insert OID = 2233 (	403		reltime_ops		PGNSP PGUID ));
+DATA(insert OID = 2234 (	403		tinterval_ops	PGNSP PGUID ));
+DATA(insert OID = 2235 (	405		aclitem_ops		PGNSP PGUID ));
+DATA(insert OID = 2593 (	783		box_ops			PGNSP PGUID ));
+DATA(insert OID = 2594 (	783		poly_ops		PGNSP PGUID ));
+DATA(insert OID = 2595 (	783		circle_ops		PGNSP PGUID ));
+DATA(insert OID = 1029 (	783		point_ops		PGNSP PGUID ));
+DATA(insert OID = 2745 (	2742	array_ops		PGNSP PGUID ));
+DATA(insert OID = 2968 (	403		uuid_ops		PGNSP PGUID ));
+DATA(insert OID = 2969 (	405		uuid_ops		PGNSP PGUID ));
+DATA(insert OID = 3253 (	403		pg_lsn_ops		PGNSP PGUID ));
+DATA(insert OID = 3254 (	405		pg_lsn_ops		PGNSP PGUID ));
+DATA(insert OID = 3522 (	403		enum_ops		PGNSP PGUID ));
+DATA(insert OID = 3523 (	405		enum_ops		PGNSP PGUID ));
+DATA(insert OID = 3626 (	403		tsvector_ops	PGNSP PGUID ));
+DATA(insert OID = 3655 (	783		tsvector_ops	PGNSP PGUID ));
+DATA(insert OID = 3659 (	2742	tsvector_ops	PGNSP PGUID ));
+DATA(insert OID = 3683 (	403		tsquery_ops		PGNSP PGUID ));
+DATA(insert OID = 3702 (	783		tsquery_ops		PGNSP PGUID ));
+DATA(insert OID = 3901 (	403		range_ops		PGNSP PGUID ));
+DATA(insert OID = 3903 (	405		range_ops		PGNSP PGUID ));
+DATA(insert OID = 3919 (	783		range_ops		PGNSP PGUID ));
+DATA(insert OID = 3474 (	4000	range_ops		PGNSP PGUID ));
+DATA(insert OID = 4015 (	4000	quad_point_ops	PGNSP PGUID ));
+DATA(insert OID = 4016 (	4000	kd_point_ops	PGNSP PGUID ));
+DATA(insert OID = 4017 (	4000	text_ops		PGNSP PGUID ));
+#define TEXT_SPGIST_FAM_OID 4017
+DATA(insert OID = 4033 (	403		jsonb_ops		PGNSP PGUID ));
+DATA(insert OID = 4034 (	405		jsonb_ops		PGNSP PGUID ));
+DATA(insert OID = 4035 (	783		jsonb_ops		PGNSP PGUID ));
+DATA(insert OID = 4036 (	2742	jsonb_ops		PGNSP PGUID ));
+DATA(insert OID = 4037 (	2742	jsonb_path_ops	PGNSP PGUID ));
+
+DATA(insert OID = 4054 (	3580	integer_minmax_ops		PGNSP PGUID ));
+DATA(insert OID = 4055 (	3580	numeric_minmax_ops		PGNSP PGUID ));
+DATA(insert OID = 4056 (	3580	text_minmax_ops			PGNSP PGUID ));
+DATA(insert OID = 4058 (	3580	timetz_minmax_ops		PGNSP PGUID ));
+DATA(insert OID = 4059 (	3580	datetime_minmax_ops		PGNSP PGUID ));
+DATA(insert OID = 4062 (	3580	char_minmax_ops			PGNSP PGUID ));
+DATA(insert OID = 4064 (	3580	bytea_minmax_ops		PGNSP PGUID ));
+DATA(insert OID = 4065 (	3580	name_minmax_ops			PGNSP PGUID ));
+DATA(insert OID = 4068 (	3580	oid_minmax_ops			PGNSP PGUID ));
+DATA(insert OID = 4069 (	3580	tid_minmax_ops			PGNSP PGUID ));
+DATA(insert OID = 4070 (	3580	float_minmax_ops		PGNSP PGUID ));
+DATA(insert OID = 4072 (	3580	abstime_minmax_ops		PGNSP PGUID ));
+DATA(insert OID = 4073 (	3580	reltime_minmax_ops		PGNSP PGUID ));
+DATA(insert OID = 4074 (	3580	macaddr_minmax_ops		PGNSP PGUID ));
+DATA(insert OID = 4075 (	3580	network_minmax_ops		PGNSP PGUID ));
+DATA(insert OID = 4102 (	3580	network_inclusion_ops	PGNSP PGUID ));
+DATA(insert OID = 4076 (	3580	bpchar_minmax_ops		PGNSP PGUID ));
+DATA(insert OID = 4077 (	3580	time_minmax_ops			PGNSP PGUID ));
+DATA(insert OID = 4078 (	3580	interval_minmax_ops		PGNSP PGUID ));
+DATA(insert OID = 4079 (	3580	bit_minmax_ops			PGNSP PGUID ));
+DATA(insert OID = 4080 (	3580	varbit_minmax_ops		PGNSP PGUID ));
+DATA(insert OID = 4081 (	3580	uuid_minmax_ops			PGNSP PGUID ));
+DATA(insert OID = 4103 (	3580	range_inclusion_ops		PGNSP PGUID ));
+DATA(insert OID = 4082 (	3580	pg_lsn_minmax_ops		PGNSP PGUID ));
+DATA(insert OID = 4104 (	3580	box_inclusion_ops		PGNSP PGUID ));
+
+#endif   /* PG_OPFAMILY_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_proc.h b/foreign/libpg_query/src/postgres/include/catalog/pg_proc.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_proc.h
@@ -0,0 +1,5357 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_proc.h
+ *	  definition of the system "procedure" relation (pg_proc)
+ *	  along with the relation's initial contents.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_proc.h
+ *
+ * NOTES
+ *	  The script catalog/genbki.pl reads this file and generates .bki
+ *	  information from the DATA() statements.  utils/Gen_fmgrtab.pl
+ *	  generates fmgroids.h and fmgrtab.c the same way.
+ *
+ *	  XXX do NOT break up DATA() statements into multiple lines!
+ *		  the scripts are not as smart as you might think...
+ *	  XXX (eg. #if 0 #endif won't do what you think)
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_PROC_H
+#define PG_PROC_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_proc definition.  cpp turns this into
+ *		typedef struct FormData_pg_proc
+ * ----------------
+ */
+#define ProcedureRelationId  1255
+#define ProcedureRelation_Rowtype_Id  81
+
+CATALOG(pg_proc,1255) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81) BKI_SCHEMA_MACRO
+{
+	NameData	proname;		/* procedure name */
+	Oid			pronamespace;	/* OID of namespace containing this proc */
+	Oid			proowner;		/* procedure owner */
+	Oid			prolang;		/* OID of pg_language entry */
+	float4		procost;		/* estimated execution cost */
+	float4		prorows;		/* estimated # of rows out (if proretset) */
+	Oid			provariadic;	/* element type of variadic array, or 0 */
+	regproc		protransform;	/* transforms calls to it during planning */
+	bool		proisagg;		/* is it an aggregate? */
+	bool		proiswindow;	/* is it a window function? */
+	bool		prosecdef;		/* security definer */
+	bool		proleakproof;	/* is it a leak-proof function? */
+	bool		proisstrict;	/* strict with respect to NULLs? */
+	bool		proretset;		/* returns a set? */
+	char		provolatile;	/* see PROVOLATILE_ categories below */
+	int16		pronargs;		/* number of arguments */
+	int16		pronargdefaults;	/* number of arguments with defaults */
+	Oid			prorettype;		/* OID of result type */
+
+	/*
+	 * variable-length fields start here, but we allow direct access to
+	 * proargtypes
+	 */
+	oidvector	proargtypes;	/* parameter types (excludes OUT params) */
+
+#ifdef CATALOG_VARLEN
+	Oid			proallargtypes[1];		/* all param types (NULL if IN only) */
+	char		proargmodes[1]; /* parameter modes (NULL if IN only) */
+	text		proargnames[1]; /* parameter names (NULL if no names) */
+	pg_node_tree proargdefaults;/* list of expression trees for argument
+								 * defaults (NULL if none) */
+	Oid			protrftypes[1]; /* types for which to apply transforms */
+	text prosrc BKI_FORCE_NOT_NULL;		/* procedure source text */
+	text		probin;			/* secondary procedure info (can be NULL) */
+	text		proconfig[1];	/* procedure-local GUC settings */
+	aclitem		proacl[1];		/* access permissions */
+#endif
+} FormData_pg_proc;
+
+/* ----------------
+ *		Form_pg_proc corresponds to a pointer to a tuple with
+ *		the format of pg_proc relation.
+ * ----------------
+ */
+typedef FormData_pg_proc *Form_pg_proc;
+
+/* ----------------
+ *		compiler constants for pg_proc
+ * ----------------
+ */
+#define Natts_pg_proc					28
+#define Anum_pg_proc_proname			1
+#define Anum_pg_proc_pronamespace		2
+#define Anum_pg_proc_proowner			3
+#define Anum_pg_proc_prolang			4
+#define Anum_pg_proc_procost			5
+#define Anum_pg_proc_prorows			6
+#define Anum_pg_proc_provariadic		7
+#define Anum_pg_proc_protransform		8
+#define Anum_pg_proc_proisagg			9
+#define Anum_pg_proc_proiswindow		10
+#define Anum_pg_proc_prosecdef			11
+#define Anum_pg_proc_proleakproof		12
+#define Anum_pg_proc_proisstrict		13
+#define Anum_pg_proc_proretset			14
+#define Anum_pg_proc_provolatile		15
+#define Anum_pg_proc_pronargs			16
+#define Anum_pg_proc_pronargdefaults	17
+#define Anum_pg_proc_prorettype			18
+#define Anum_pg_proc_proargtypes		19
+#define Anum_pg_proc_proallargtypes		20
+#define Anum_pg_proc_proargmodes		21
+#define Anum_pg_proc_proargnames		22
+#define Anum_pg_proc_proargdefaults		23
+#define Anum_pg_proc_protrftypes		24
+#define Anum_pg_proc_prosrc				25
+#define Anum_pg_proc_probin				26
+#define Anum_pg_proc_proconfig			27
+#define Anum_pg_proc_proacl				28
+
+/* ----------------
+ *		initial contents of pg_proc
+ * ----------------
+ */
+
+/*
+ * Note: every entry in pg_proc.h is expected to have a DESCR() comment,
+ * except for functions that implement pg_operator.h operators and don't
+ * have a good reason to be called directly rather than via the operator.
+ * (If you do expect such a function to be used directly, you should
+ * duplicate the operator's comment.)  initdb will supply suitable default
+ * comments for functions referenced by pg_operator.
+ *
+ * Try to follow the style of existing functions' comments.
+ * Some recommended conventions:
+ *		"I/O" for typinput, typoutput, typreceive, typsend functions
+ *		"I/O typmod" for typmodin, typmodout functions
+ *		"aggregate transition function" for aggtransfn functions, unless
+ *					they are reasonably useful in their own right
+ *		"aggregate final function" for aggfinalfn functions (likewise)
+ *		"convert srctypename to desttypename" for cast functions
+ *		"less-equal-greater" for B-tree comparison functions
+ */
+
+/* keep the following ordered by OID so that later changes can be made easier */
+
+/* OIDS 1 - 99 */
+
+DATA(insert OID = 1242 (  boolin		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "2275" _null_ _null_ _null_ _null_ _null_ boolin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1243 (  boolout		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "16" _null_ _null_ _null_ _null_ _null_ boolout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1244 (  byteain		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2275" _null_ _null_ _null_ _null_ _null_ byteain _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  31 (  byteaout		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "17" _null_ _null_ _null_ _null_ _null_ byteaout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1245 (  charin		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 18 "2275" _null_ _null_ _null_ _null_ _null_ charin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  33 (  charout		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "18" _null_ _null_ _null_ _null_ _null_ charout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  34 (  namein			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 19 "2275" _null_ _null_ _null_ _null_ _null_ namein _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  35 (  nameout		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "19" _null_ _null_ _null_ _null_ _null_ nameout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  38 (  int2in			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "2275" _null_ _null_ _null_ _null_ _null_ int2in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  39 (  int2out		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "21" _null_ _null_ _null_ _null_ _null_ int2out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  40 (  int2vectorin	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 22 "2275" _null_ _null_ _null_ _null_ _null_ int2vectorin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  41 (  int2vectorout	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "22" _null_ _null_ _null_ _null_ _null_ int2vectorout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  42 (  int4in			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "2275" _null_ _null_ _null_ _null_ _null_ int4in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  43 (  int4out		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ _null_ int4out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  44 (  regprocin		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 24 "2275" _null_ _null_ _null_ _null_ _null_ regprocin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  45 (  regprocout		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "24" _null_ _null_ _null_ _null_ _null_ regprocout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3494 (  to_regproc		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 24 "2275" _null_ _null_ _null_ _null_ _null_ to_regproc _null_ _null_ _null_ ));
+DESCR("convert proname to regproc");
+DATA(insert OID = 3479 (  to_regprocedure	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2202 "2275" _null_ _null_ _null_ _null_ _null_ to_regprocedure _null_ _null_ _null_ ));
+DESCR("convert proname to regprocedure");
+DATA(insert OID =  46 (  textin			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "2275" _null_ _null_ _null_ _null_ _null_ textin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  47 (  textout		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "25" _null_ _null_ _null_ _null_ _null_ textout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  48 (  tidin			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 27 "2275" _null_ _null_ _null_ _null_ _null_ tidin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  49 (  tidout			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "27" _null_ _null_ _null_ _null_ _null_ tidout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  50 (  xidin			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 28 "2275" _null_ _null_ _null_ _null_ _null_ xidin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  51 (  xidout			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "28" _null_ _null_ _null_ _null_ _null_ xidout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  52 (  cidin			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 29 "2275" _null_ _null_ _null_ _null_ _null_ cidin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  53 (  cidout			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "29" _null_ _null_ _null_ _null_ _null_ cidout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  54 (  oidvectorin	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 30 "2275" _null_ _null_ _null_ _null_ _null_ oidvectorin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  55 (  oidvectorout	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "30" _null_ _null_ _null_ _null_ _null_ oidvectorout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  56 (  boollt			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ _null_ boollt _null_ _null_ _null_ ));
+DATA(insert OID =  57 (  boolgt			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ _null_ boolgt _null_ _null_ _null_ ));
+DATA(insert OID =  60 (  booleq			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ _null_ booleq _null_ _null_ _null_ ));
+DATA(insert OID =  61 (  chareq			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "18 18" _null_ _null_ _null_ _null_ _null_ chareq _null_ _null_ _null_ ));
+DATA(insert OID =  62 (  nameeq			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "19 19" _null_ _null_ _null_ _null_ _null_ nameeq _null_ _null_ _null_ ));
+DATA(insert OID =  63 (  int2eq			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 21" _null_ _null_ _null_ _null_ _null_ int2eq _null_ _null_ _null_ ));
+DATA(insert OID =  64 (  int2lt			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 21" _null_ _null_ _null_ _null_ _null_ int2lt _null_ _null_ _null_ ));
+DATA(insert OID =  65 (  int4eq			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 23" _null_ _null_ _null_ _null_ _null_ int4eq _null_ _null_ _null_ ));
+DATA(insert OID =  66 (  int4lt			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 23" _null_ _null_ _null_ _null_ _null_ int4lt _null_ _null_ _null_ ));
+DATA(insert OID =  67 (  texteq			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ texteq _null_ _null_ _null_ ));
+DATA(insert OID =  68 (  xideq			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "28 28" _null_ _null_ _null_ _null_ _null_ xideq _null_ _null_ _null_ ));
+DATA(insert OID =  69 (  cideq			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "29 29" _null_ _null_ _null_ _null_ _null_ cideq _null_ _null_ _null_ ));
+DATA(insert OID =  70 (  charne			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "18 18" _null_ _null_ _null_ _null_ _null_ charne _null_ _null_ _null_ ));
+DATA(insert OID = 1246 (  charlt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "18 18" _null_ _null_ _null_ _null_ _null_ charlt _null_ _null_ _null_ ));
+DATA(insert OID =  72 (  charle			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "18 18" _null_ _null_ _null_ _null_ _null_ charle _null_ _null_ _null_ ));
+DATA(insert OID =  73 (  chargt			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "18 18" _null_ _null_ _null_ _null_ _null_ chargt _null_ _null_ _null_ ));
+DATA(insert OID =  74 (  charge			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "18 18" _null_ _null_ _null_ _null_ _null_ charge _null_ _null_ _null_ ));
+DATA(insert OID =  77 (  int4			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23	"18" _null_ _null_ _null_ _null_ _null_ chartoi4 _null_ _null_ _null_ ));
+DESCR("convert char to int4");
+DATA(insert OID =  78 (  char			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 18	"23" _null_ _null_ _null_ _null_ _null_ i4tochar _null_ _null_ _null_ ));
+DESCR("convert int4 to char");
+
+DATA(insert OID =  79 (  nameregexeq	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ _null_ nameregexeq _null_ _null_ _null_ ));
+DATA(insert OID = 1252 (  nameregexne	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ _null_ nameregexne _null_ _null_ _null_ ));
+DATA(insert OID = 1254 (  textregexeq	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ textregexeq _null_ _null_ _null_ ));
+DATA(insert OID = 1256 (  textregexne	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ textregexne _null_ _null_ _null_ ));
+DATA(insert OID = 1257 (  textlen		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ _null_ textlen _null_ _null_ _null_ ));
+DESCR("length");
+DATA(insert OID = 1258 (  textcat		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ _null_ textcat _null_ _null_ _null_ ));
+
+DATA(insert OID =  84 (  boolne			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ _null_ boolne _null_ _null_ _null_ ));
+DATA(insert OID =  89 (  version		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 25 "" _null_ _null_ _null_ _null_ _null_ pgsql_version _null_ _null_ _null_ ));
+DESCR("PostgreSQL version string");
+
+DATA(insert OID = 86  (  pg_ddl_command_in		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 32 "2275" _null_ _null_ _null_ _null_ _null_ pg_ddl_command_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 87  (  pg_ddl_command_out		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "32" _null_ _null_ _null_ _null_ _null_ pg_ddl_command_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 88  (  pg_ddl_command_recv	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 32 "2281" _null_ _null_ _null_ _null_ _null_ pg_ddl_command_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 90  (  pg_ddl_command_send	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "32" _null_ _null_ _null_ _null_ _null_ pg_ddl_command_send _null_ _null_ _null_ ));
+DESCR("I/O");
+
+/* OIDS 100 - 199 */
+
+DATA(insert OID = 101 (  eqsel			   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_	eqsel _null_ _null_ _null_ ));
+DESCR("restriction selectivity of = and related operators");
+DATA(insert OID = 102 (  neqsel			   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_	neqsel _null_ _null_ _null_ ));
+DESCR("restriction selectivity of <> and related operators");
+DATA(insert OID = 103 (  scalarltsel	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_	scalarltsel _null_ _null_ _null_ ));
+DESCR("restriction selectivity of < and related operators on scalar datatypes");
+DATA(insert OID = 104 (  scalargtsel	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_	scalargtsel _null_ _null_ _null_ ));
+DESCR("restriction selectivity of > and related operators on scalar datatypes");
+DATA(insert OID = 105 (  eqjoinsel		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ _null_	eqjoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity of = and related operators");
+DATA(insert OID = 106 (  neqjoinsel		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ _null_	neqjoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity of <> and related operators");
+DATA(insert OID = 107 (  scalarltjoinsel   PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ _null_	scalarltjoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity of < and related operators on scalar datatypes");
+DATA(insert OID = 108 (  scalargtjoinsel   PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ _null_	scalargtjoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity of > and related operators on scalar datatypes");
+
+DATA(insert OID =  109 (  unknownin		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 705 "2275" _null_ _null_ _null_ _null_ _null_ unknownin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  110 (  unknownout	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "705" _null_ _null_ _null_ _null_ _null_	unknownout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 111 (  numeric_fac	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "20" _null_ _null_ _null_ _null_ _null_	numeric_fac _null_ _null_ _null_ ));
+
+DATA(insert OID = 115 (  box_above_eq	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_above_eq _null_ _null_ _null_ ));
+DATA(insert OID = 116 (  box_below_eq	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_below_eq _null_ _null_ _null_ ));
+
+DATA(insert OID = 117 (  point_in		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "2275" _null_ _null_ _null_ _null_ _null_	point_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 118 (  point_out		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "600" _null_ _null_ _null_ _null_ _null_	point_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 119 (  lseg_in		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 601 "2275" _null_ _null_ _null_ _null_ _null_	lseg_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 120 (  lseg_out		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "601" _null_ _null_ _null_ _null_ _null_	lseg_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 121 (  path_in		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 602 "2275" _null_ _null_ _null_ _null_ _null_	path_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 122 (  path_out		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "602" _null_ _null_ _null_ _null_ _null_	path_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 123 (  box_in			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 603 "2275" _null_ _null_ _null_ _null_ _null_	box_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 124 (  box_out		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "603" _null_ _null_ _null_ _null_ _null_	box_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 125 (  box_overlap	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_overlap _null_ _null_ _null_ ));
+DATA(insert OID = 126 (  box_ge			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_ge _null_ _null_ _null_ ));
+DATA(insert OID = 127 (  box_gt			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_gt _null_ _null_ _null_ ));
+DATA(insert OID = 128 (  box_eq			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_eq _null_ _null_ _null_ ));
+DATA(insert OID = 129 (  box_lt			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_lt _null_ _null_ _null_ ));
+DATA(insert OID = 130 (  box_le			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_le _null_ _null_ _null_ ));
+DATA(insert OID = 131 (  point_above	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ _null_ point_above _null_ _null_ _null_ ));
+DATA(insert OID = 132 (  point_left		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ _null_ point_left _null_ _null_ _null_ ));
+DATA(insert OID = 133 (  point_right	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ _null_ point_right _null_ _null_ _null_ ));
+DATA(insert OID = 134 (  point_below	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ _null_ point_below _null_ _null_ _null_ ));
+DATA(insert OID = 135 (  point_eq		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ _null_ point_eq _null_ _null_ _null_ ));
+DATA(insert OID = 136 (  on_pb			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 603" _null_ _null_ _null_ _null_ _null_ on_pb _null_ _null_ _null_ ));
+DATA(insert OID = 137 (  on_ppath		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 602" _null_ _null_ _null_ _null_ _null_ on_ppath _null_ _null_ _null_ ));
+DATA(insert OID = 138 (  box_center		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "603" _null_ _null_ _null_ _null_ _null_	box_center _null_ _null_ _null_ ));
+DATA(insert OID = 139 (  areasel		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_	areasel _null_ _null_ _null_ ));
+DESCR("restriction selectivity for area-comparison operators");
+DATA(insert OID = 140 (  areajoinsel	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ _null_	areajoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity for area-comparison operators");
+DATA(insert OID = 141 (  int4mul		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ _null_ int4mul _null_ _null_ _null_ ));
+DATA(insert OID = 144 (  int4ne			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 23" _null_ _null_ _null_ _null_ _null_ int4ne _null_ _null_ _null_ ));
+DATA(insert OID = 145 (  int2ne			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 21" _null_ _null_ _null_ _null_ _null_ int2ne _null_ _null_ _null_ ));
+DATA(insert OID = 146 (  int2gt			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 21" _null_ _null_ _null_ _null_ _null_ int2gt _null_ _null_ _null_ ));
+DATA(insert OID = 147 (  int4gt			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 23" _null_ _null_ _null_ _null_ _null_ int4gt _null_ _null_ _null_ ));
+DATA(insert OID = 148 (  int2le			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 21" _null_ _null_ _null_ _null_ _null_ int2le _null_ _null_ _null_ ));
+DATA(insert OID = 149 (  int4le			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 23" _null_ _null_ _null_ _null_ _null_ int4le _null_ _null_ _null_ ));
+DATA(insert OID = 150 (  int4ge			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 23" _null_ _null_ _null_ _null_ _null_ int4ge _null_ _null_ _null_ ));
+DATA(insert OID = 151 (  int2ge			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 21" _null_ _null_ _null_ _null_ _null_ int2ge _null_ _null_ _null_ ));
+DATA(insert OID = 152 (  int2mul		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ _null_ int2mul _null_ _null_ _null_ ));
+DATA(insert OID = 153 (  int2div		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ _null_ int2div _null_ _null_ _null_ ));
+DATA(insert OID = 154 (  int4div		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ _null_ int4div _null_ _null_ _null_ ));
+DATA(insert OID = 155 (  int2mod		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ _null_ int2mod _null_ _null_ _null_ ));
+DATA(insert OID = 156 (  int4mod		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ _null_ int4mod _null_ _null_ _null_ ));
+DATA(insert OID = 157 (  textne			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ textne _null_ _null_ _null_ ));
+DATA(insert OID = 158 (  int24eq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 23" _null_ _null_ _null_ _null_ _null_ int24eq _null_ _null_ _null_ ));
+DATA(insert OID = 159 (  int42eq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 21" _null_ _null_ _null_ _null_ _null_ int42eq _null_ _null_ _null_ ));
+DATA(insert OID = 160 (  int24lt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 23" _null_ _null_ _null_ _null_ _null_ int24lt _null_ _null_ _null_ ));
+DATA(insert OID = 161 (  int42lt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 21" _null_ _null_ _null_ _null_ _null_ int42lt _null_ _null_ _null_ ));
+DATA(insert OID = 162 (  int24gt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 23" _null_ _null_ _null_ _null_ _null_ int24gt _null_ _null_ _null_ ));
+DATA(insert OID = 163 (  int42gt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 21" _null_ _null_ _null_ _null_ _null_ int42gt _null_ _null_ _null_ ));
+DATA(insert OID = 164 (  int24ne		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 23" _null_ _null_ _null_ _null_ _null_ int24ne _null_ _null_ _null_ ));
+DATA(insert OID = 165 (  int42ne		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 21" _null_ _null_ _null_ _null_ _null_ int42ne _null_ _null_ _null_ ));
+DATA(insert OID = 166 (  int24le		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 23" _null_ _null_ _null_ _null_ _null_ int24le _null_ _null_ _null_ ));
+DATA(insert OID = 167 (  int42le		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 21" _null_ _null_ _null_ _null_ _null_ int42le _null_ _null_ _null_ ));
+DATA(insert OID = 168 (  int24ge		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 23" _null_ _null_ _null_ _null_ _null_ int24ge _null_ _null_ _null_ ));
+DATA(insert OID = 169 (  int42ge		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 21" _null_ _null_ _null_ _null_ _null_ int42ge _null_ _null_ _null_ ));
+DATA(insert OID = 170 (  int24mul		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "21 23" _null_ _null_ _null_ _null_ _null_ int24mul _null_ _null_ _null_ ));
+DATA(insert OID = 171 (  int42mul		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 21" _null_ _null_ _null_ _null_ _null_ int42mul _null_ _null_ _null_ ));
+DATA(insert OID = 172 (  int24div		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "21 23" _null_ _null_ _null_ _null_ _null_ int24div _null_ _null_ _null_ ));
+DATA(insert OID = 173 (  int42div		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 21" _null_ _null_ _null_ _null_ _null_ int42div _null_ _null_ _null_ ));
+DATA(insert OID = 176 (  int2pl			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ _null_ int2pl _null_ _null_ _null_ ));
+DATA(insert OID = 177 (  int4pl			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ _null_ int4pl _null_ _null_ _null_ ));
+DATA(insert OID = 178 (  int24pl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "21 23" _null_ _null_ _null_ _null_ _null_ int24pl _null_ _null_ _null_ ));
+DATA(insert OID = 179 (  int42pl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 21" _null_ _null_ _null_ _null_ _null_ int42pl _null_ _null_ _null_ ));
+DATA(insert OID = 180 (  int2mi			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ _null_ int2mi _null_ _null_ _null_ ));
+DATA(insert OID = 181 (  int4mi			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ _null_ int4mi _null_ _null_ _null_ ));
+DATA(insert OID = 182 (  int24mi		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "21 23" _null_ _null_ _null_ _null_ _null_ int24mi _null_ _null_ _null_ ));
+DATA(insert OID = 183 (  int42mi		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 21" _null_ _null_ _null_ _null_ _null_ int42mi _null_ _null_ _null_ ));
+DATA(insert OID = 184 (  oideq			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "26 26" _null_ _null_ _null_ _null_ _null_ oideq _null_ _null_ _null_ ));
+DATA(insert OID = 185 (  oidne			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "26 26" _null_ _null_ _null_ _null_ _null_ oidne _null_ _null_ _null_ ));
+DATA(insert OID = 186 (  box_same		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_same _null_ _null_ _null_ ));
+DATA(insert OID = 187 (  box_contain	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_contain _null_ _null_ _null_ ));
+DATA(insert OID = 188 (  box_left		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_left _null_ _null_ _null_ ));
+DATA(insert OID = 189 (  box_overleft	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_overleft _null_ _null_ _null_ ));
+DATA(insert OID = 190 (  box_overright	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_overright _null_ _null_ _null_ ));
+DATA(insert OID = 191 (  box_right		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_right _null_ _null_ _null_ ));
+DATA(insert OID = 192 (  box_contained	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_contained _null_ _null_ _null_ ));
+DATA(insert OID = 193 (  box_contain_pt    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 600" _null_ _null_ _null_ _null_ _null_ box_contain_pt _null_ _null_ _null_ ));
+
+DATA(insert OID = 195 (  pg_node_tree_in	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 194 "2275" _null_ _null_ _null_ _null_ _null_ pg_node_tree_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 196 (  pg_node_tree_out	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "194" _null_ _null_ _null_ _null_ _null_ pg_node_tree_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 197 (  pg_node_tree_recv	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 194 "2281" _null_ _null_ _null_ _null_ _null_ pg_node_tree_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 198 (  pg_node_tree_send	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "194" _null_ _null_ _null_ _null_ _null_	pg_node_tree_send _null_ _null_ _null_ ));
+DESCR("I/O");
+
+/* OIDS 200 - 299 */
+
+DATA(insert OID = 200 (  float4in		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "2275" _null_ _null_ _null_ _null_ _null_	float4in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 201 (  float4out		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "700" _null_ _null_ _null_ _null_ _null_	float4out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 202 (  float4mul		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 700 "700 700" _null_ _null_ _null_ _null_ _null_	float4mul _null_ _null_ _null_ ));
+DATA(insert OID = 203 (  float4div		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 700 "700 700" _null_ _null_ _null_ _null_ _null_	float4div _null_ _null_ _null_ ));
+DATA(insert OID = 204 (  float4pl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 700 "700 700" _null_ _null_ _null_ _null_ _null_	float4pl _null_ _null_ _null_ ));
+DATA(insert OID = 205 (  float4mi		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 700 "700 700" _null_ _null_ _null_ _null_ _null_	float4mi _null_ _null_ _null_ ));
+DATA(insert OID = 206 (  float4um		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "700" _null_ _null_ _null_ _null_ _null_	float4um _null_ _null_ _null_ ));
+DATA(insert OID = 207 (  float4abs		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "700" _null_ _null_ _null_ _null_ _null_	float4abs _null_ _null_ _null_ ));
+DATA(insert OID = 208 (  float4_accum	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1022 "1022 700" _null_ _null_ _null_ _null_ _null_ float4_accum _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 209 (  float4larger	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 700 "700 700" _null_ _null_ _null_ _null_ _null_	float4larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 211 (  float4smaller	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 700 "700 700" _null_ _null_ _null_ _null_ _null_	float4smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+
+DATA(insert OID = 212 (  int4um			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ int4um _null_ _null_ _null_ ));
+DATA(insert OID = 213 (  int2um			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ _null_ int2um _null_ _null_ _null_ ));
+
+DATA(insert OID = 214 (  float8in		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "2275" _null_ _null_ _null_ _null_ _null_	float8in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 215 (  float8out		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "701" _null_ _null_ _null_ _null_ _null_	float8out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 216 (  float8mul		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	float8mul _null_ _null_ _null_ ));
+DATA(insert OID = 217 (  float8div		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	float8div _null_ _null_ _null_ ));
+DATA(insert OID = 218 (  float8pl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	float8pl _null_ _null_ _null_ ));
+DATA(insert OID = 219 (  float8mi		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	float8mi _null_ _null_ _null_ ));
+DATA(insert OID = 220 (  float8um		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	float8um _null_ _null_ _null_ ));
+DATA(insert OID = 221 (  float8abs		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	float8abs _null_ _null_ _null_ ));
+DATA(insert OID = 222 (  float8_accum	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1022 "1022 701" _null_ _null_ _null_ _null_ _null_ float8_accum _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 223 (  float8larger	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	float8larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 224 (  float8smaller	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	float8smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+
+DATA(insert OID = 225 (  lseg_center	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "601" _null_ _null_ _null_ _null_ _null_	lseg_center _null_ _null_ _null_ ));
+DATA(insert OID = 226 (  path_center	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "602" _null_ _null_ _null_ _null_ _null_	path_center _null_ _null_ _null_ ));
+DATA(insert OID = 227 (  poly_center	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "604" _null_ _null_ _null_ _null_ _null_	poly_center _null_ _null_ _null_ ));
+
+DATA(insert OID = 228 (  dround			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	dround _null_ _null_ _null_ ));
+DESCR("round to nearest integer");
+DATA(insert OID = 229 (  dtrunc			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	dtrunc _null_ _null_ _null_ ));
+DESCR("truncate to integer");
+DATA(insert OID = 2308 ( ceil			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	dceil _null_ _null_ _null_ ));
+DESCR("smallest integer >= value");
+DATA(insert OID = 2320 ( ceiling		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	dceil _null_ _null_ _null_ ));
+DESCR("smallest integer >= value");
+DATA(insert OID = 2309 ( floor			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	dfloor _null_ _null_ _null_ ));
+DESCR("largest integer <= value");
+DATA(insert OID = 2310 ( sign			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	dsign _null_ _null_ _null_ ));
+DESCR("sign of value");
+DATA(insert OID = 230 (  dsqrt			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	dsqrt _null_ _null_ _null_ ));
+DATA(insert OID = 231 (  dcbrt			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	dcbrt _null_ _null_ _null_ ));
+DATA(insert OID = 232 (  dpow			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	dpow _null_ _null_ _null_ ));
+DATA(insert OID = 233 (  dexp			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	dexp _null_ _null_ _null_ ));
+DESCR("natural exponential (e^x)");
+DATA(insert OID = 234 (  dlog1			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	dlog1 _null_ _null_ _null_ ));
+DESCR("natural logarithm");
+DATA(insert OID = 235 (  float8			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "21" _null_ _null_ _null_ _null_ _null_ i2tod _null_ _null_ _null_ ));
+DESCR("convert int2 to float8");
+DATA(insert OID = 236 (  float4			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "21" _null_ _null_ _null_ _null_ _null_ i2tof _null_ _null_ _null_ ));
+DESCR("convert int2 to float4");
+DATA(insert OID = 237 (  int2			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "701" _null_ _null_ _null_ _null_ _null_ dtoi2 _null_ _null_ _null_ ));
+DESCR("convert float8 to int2");
+DATA(insert OID = 238 (  int2			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "700" _null_ _null_ _null_ _null_ _null_ ftoi2 _null_ _null_ _null_ ));
+DESCR("convert float4 to int2");
+DATA(insert OID = 239 (  line_distance	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "628 628" _null_ _null_ _null_ _null_ _null_	line_distance _null_ _null_ _null_ ));
+
+DATA(insert OID = 240 (  abstimein		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 702 "2275" _null_ _null_ _null_ _null_ _null_	abstimein _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 241 (  abstimeout		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "702" _null_ _null_ _null_ _null_ _null_	abstimeout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 242 (  reltimein		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 703 "2275" _null_ _null_ _null_ _null_ _null_	reltimein _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 243 (  reltimeout		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "703" _null_ _null_ _null_ _null_ _null_	reltimeout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 244 (  timepl			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 702 "702 703" _null_ _null_ _null_ _null_ _null_	timepl _null_ _null_ _null_ ));
+DATA(insert OID = 245 (  timemi			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 702 "702 703" _null_ _null_ _null_ _null_ _null_	timemi _null_ _null_ _null_ ));
+DATA(insert OID = 246 (  tintervalin	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 704 "2275" _null_ _null_ _null_ _null_ _null_	tintervalin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 247 (  tintervalout	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "704" _null_ _null_ _null_ _null_ _null_	tintervalout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 248 (  intinterval	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "702 704" _null_ _null_ _null_ _null_ _null_ intinterval _null_ _null_ _null_ ));
+DATA(insert OID = 249 (  tintervalrel	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 703 "704" _null_ _null_ _null_ _null_ _null_	tintervalrel _null_ _null_ _null_ ));
+DESCR("tinterval to reltime");
+DATA(insert OID = 250 (  timenow		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 702 "" _null_ _null_ _null_ _null_ _null_	timenow _null_ _null_ _null_ ));
+DESCR("current date and time (abstime)");
+DATA(insert OID = 251 (  abstimeeq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "702 702" _null_ _null_ _null_ _null_ _null_ abstimeeq _null_ _null_ _null_ ));
+DATA(insert OID = 252 (  abstimene		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "702 702" _null_ _null_ _null_ _null_ _null_ abstimene _null_ _null_ _null_ ));
+DATA(insert OID = 253 (  abstimelt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "702 702" _null_ _null_ _null_ _null_ _null_ abstimelt _null_ _null_ _null_ ));
+DATA(insert OID = 254 (  abstimegt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "702 702" _null_ _null_ _null_ _null_ _null_ abstimegt _null_ _null_ _null_ ));
+DATA(insert OID = 255 (  abstimele		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "702 702" _null_ _null_ _null_ _null_ _null_ abstimele _null_ _null_ _null_ ));
+DATA(insert OID = 256 (  abstimege		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "702 702" _null_ _null_ _null_ _null_ _null_ abstimege _null_ _null_ _null_ ));
+DATA(insert OID = 257 (  reltimeeq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "703 703" _null_ _null_ _null_ _null_ _null_ reltimeeq _null_ _null_ _null_ ));
+DATA(insert OID = 258 (  reltimene		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "703 703" _null_ _null_ _null_ _null_ _null_ reltimene _null_ _null_ _null_ ));
+DATA(insert OID = 259 (  reltimelt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "703 703" _null_ _null_ _null_ _null_ _null_ reltimelt _null_ _null_ _null_ ));
+DATA(insert OID = 260 (  reltimegt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "703 703" _null_ _null_ _null_ _null_ _null_ reltimegt _null_ _null_ _null_ ));
+DATA(insert OID = 261 (  reltimele		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "703 703" _null_ _null_ _null_ _null_ _null_ reltimele _null_ _null_ _null_ ));
+DATA(insert OID = 262 (  reltimege		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "703 703" _null_ _null_ _null_ _null_ _null_ reltimege _null_ _null_ _null_ ));
+DATA(insert OID = 263 (  tintervalsame	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ _null_ tintervalsame _null_ _null_ _null_ ));
+DATA(insert OID = 264 (  tintervalct	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ _null_ tintervalct _null_ _null_ _null_ ));
+DATA(insert OID = 265 (  tintervalov	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ _null_ tintervalov _null_ _null_ _null_ ));
+DATA(insert OID = 266 (  tintervalleneq    PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 703" _null_ _null_ _null_ _null_ _null_ tintervalleneq _null_ _null_ _null_ ));
+DATA(insert OID = 267 (  tintervallenne    PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 703" _null_ _null_ _null_ _null_ _null_ tintervallenne _null_ _null_ _null_ ));
+DATA(insert OID = 268 (  tintervallenlt    PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 703" _null_ _null_ _null_ _null_ _null_ tintervallenlt _null_ _null_ _null_ ));
+DATA(insert OID = 269 (  tintervallengt    PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 703" _null_ _null_ _null_ _null_ _null_ tintervallengt _null_ _null_ _null_ ));
+DATA(insert OID = 270 (  tintervallenle    PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 703" _null_ _null_ _null_ _null_ _null_ tintervallenle _null_ _null_ _null_ ));
+DATA(insert OID = 271 (  tintervallenge    PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 703" _null_ _null_ _null_ _null_ _null_ tintervallenge _null_ _null_ _null_ ));
+DATA(insert OID = 272 (  tintervalstart    PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 702 "704" _null_ _null_ _null_ _null_ _null_	tintervalstart _null_ _null_ _null_ ));
+DATA(insert OID = 273 (  tintervalend	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 702 "704" _null_ _null_ _null_ _null_ _null_	tintervalend _null_ _null_ _null_ ));
+DESCR("end of interval");
+DATA(insert OID = 274 (  timeofday		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ _null_ timeofday _null_ _null_ _null_ ));
+DESCR("current date and time - increments during transactions");
+DATA(insert OID = 275 (  isfinite		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "702" _null_ _null_ _null_ _null_ _null_ abstime_finite _null_ _null_ _null_ ));
+DESCR("finite abstime?");
+
+DATA(insert OID = 277 (  inter_sl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 628" _null_ _null_ _null_ _null_ _null_ inter_sl _null_ _null_ _null_ ));
+DATA(insert OID = 278 (  inter_lb		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "628 603" _null_ _null_ _null_ _null_ _null_ inter_lb _null_ _null_ _null_ ));
+
+DATA(insert OID = 279 (  float48mul		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "700 701" _null_ _null_ _null_ _null_ _null_	float48mul _null_ _null_ _null_ ));
+DATA(insert OID = 280 (  float48div		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "700 701" _null_ _null_ _null_ _null_ _null_	float48div _null_ _null_ _null_ ));
+DATA(insert OID = 281 (  float48pl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "700 701" _null_ _null_ _null_ _null_ _null_	float48pl _null_ _null_ _null_ ));
+DATA(insert OID = 282 (  float48mi		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "700 701" _null_ _null_ _null_ _null_ _null_	float48mi _null_ _null_ _null_ ));
+DATA(insert OID = 283 (  float84mul		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 700" _null_ _null_ _null_ _null_ _null_	float84mul _null_ _null_ _null_ ));
+DATA(insert OID = 284 (  float84div		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 700" _null_ _null_ _null_ _null_ _null_	float84div _null_ _null_ _null_ ));
+DATA(insert OID = 285 (  float84pl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 700" _null_ _null_ _null_ _null_ _null_	float84pl _null_ _null_ _null_ ));
+DATA(insert OID = 286 (  float84mi		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 700" _null_ _null_ _null_ _null_ _null_	float84mi _null_ _null_ _null_ ));
+
+DATA(insert OID = 287 (  float4eq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 700" _null_ _null_ _null_ _null_ _null_ float4eq _null_ _null_ _null_ ));
+DATA(insert OID = 288 (  float4ne		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 700" _null_ _null_ _null_ _null_ _null_ float4ne _null_ _null_ _null_ ));
+DATA(insert OID = 289 (  float4lt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 700" _null_ _null_ _null_ _null_ _null_ float4lt _null_ _null_ _null_ ));
+DATA(insert OID = 290 (  float4le		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 700" _null_ _null_ _null_ _null_ _null_ float4le _null_ _null_ _null_ ));
+DATA(insert OID = 291 (  float4gt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 700" _null_ _null_ _null_ _null_ _null_ float4gt _null_ _null_ _null_ ));
+DATA(insert OID = 292 (  float4ge		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 700" _null_ _null_ _null_ _null_ _null_ float4ge _null_ _null_ _null_ ));
+
+DATA(insert OID = 293 (  float8eq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 701" _null_ _null_ _null_ _null_ _null_ float8eq _null_ _null_ _null_ ));
+DATA(insert OID = 294 (  float8ne		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 701" _null_ _null_ _null_ _null_ _null_ float8ne _null_ _null_ _null_ ));
+DATA(insert OID = 295 (  float8lt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 701" _null_ _null_ _null_ _null_ _null_ float8lt _null_ _null_ _null_ ));
+DATA(insert OID = 296 (  float8le		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 701" _null_ _null_ _null_ _null_ _null_ float8le _null_ _null_ _null_ ));
+DATA(insert OID = 297 (  float8gt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 701" _null_ _null_ _null_ _null_ _null_ float8gt _null_ _null_ _null_ ));
+DATA(insert OID = 298 (  float8ge		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 701" _null_ _null_ _null_ _null_ _null_ float8ge _null_ _null_ _null_ ));
+
+DATA(insert OID = 299 (  float48eq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 701" _null_ _null_ _null_ _null_ _null_ float48eq _null_ _null_ _null_ ));
+
+/* OIDS 300 - 399 */
+
+DATA(insert OID = 300 (  float48ne		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 701" _null_ _null_ _null_ _null_ _null_ float48ne _null_ _null_ _null_ ));
+DATA(insert OID = 301 (  float48lt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 701" _null_ _null_ _null_ _null_ _null_ float48lt _null_ _null_ _null_ ));
+DATA(insert OID = 302 (  float48le		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 701" _null_ _null_ _null_ _null_ _null_ float48le _null_ _null_ _null_ ));
+DATA(insert OID = 303 (  float48gt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 701" _null_ _null_ _null_ _null_ _null_ float48gt _null_ _null_ _null_ ));
+DATA(insert OID = 304 (  float48ge		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 701" _null_ _null_ _null_ _null_ _null_ float48ge _null_ _null_ _null_ ));
+DATA(insert OID = 305 (  float84eq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 700" _null_ _null_ _null_ _null_ _null_ float84eq _null_ _null_ _null_ ));
+DATA(insert OID = 306 (  float84ne		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 700" _null_ _null_ _null_ _null_ _null_ float84ne _null_ _null_ _null_ ));
+DATA(insert OID = 307 (  float84lt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 700" _null_ _null_ _null_ _null_ _null_ float84lt _null_ _null_ _null_ ));
+DATA(insert OID = 308 (  float84le		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 700" _null_ _null_ _null_ _null_ _null_ float84le _null_ _null_ _null_ ));
+DATA(insert OID = 309 (  float84gt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 700" _null_ _null_ _null_ _null_ _null_ float84gt _null_ _null_ _null_ ));
+DATA(insert OID = 310 (  float84ge		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 700" _null_ _null_ _null_ _null_ _null_ float84ge _null_ _null_ _null_ ));
+DATA(insert OID = 320 ( width_bucket	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 23 "701 701 701 23" _null_ _null_ _null_ _null_ _null_ width_bucket_float8 _null_ _null_ _null_ ));
+DESCR("bucket number of operand in equal-width histogram");
+
+DATA(insert OID = 311 (  float8			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "700" _null_ _null_ _null_ _null_ _null_	ftod _null_ _null_ _null_ ));
+DESCR("convert float4 to float8");
+DATA(insert OID = 312 (  float4			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "701" _null_ _null_ _null_ _null_ _null_	dtof _null_ _null_ _null_ ));
+DESCR("convert float8 to float4");
+DATA(insert OID = 313 (  int4			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23	"21" _null_ _null_ _null_ _null_ _null_ i2toi4 _null_ _null_ _null_ ));
+DESCR("convert int2 to int4");
+DATA(insert OID = 314 (  int2			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21	"23" _null_ _null_ _null_ _null_ _null_ i4toi2 _null_ _null_ _null_ ));
+DESCR("convert int4 to int2");
+DATA(insert OID = 315 (  int2vectoreq	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "22 22" _null_ _null_ _null_ _null_ _null_ int2vectoreq _null_ _null_ _null_ ));
+DATA(insert OID = 316 (  float8			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701  "23" _null_ _null_ _null_ _null_ _null_	i4tod _null_ _null_ _null_ ));
+DESCR("convert int4 to float8");
+DATA(insert OID = 317 (  int4			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "701" _null_ _null_ _null_ _null_ _null_ dtoi4 _null_ _null_ _null_ ));
+DESCR("convert float8 to int4");
+DATA(insert OID = 318 (  float4			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700  "23" _null_ _null_ _null_ _null_ _null_	i4tof _null_ _null_ _null_ ));
+DESCR("convert int4 to float4");
+DATA(insert OID = 319 (  int4			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1  0 23 "700" _null_ _null_ _null_ _null_ _null_	ftoi4 _null_ _null_ _null_ ));
+DESCR("convert float4 to int4");
+
+DATA(insert OID = 330 (  btgettuple		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ _null_	btgettuple _null_ _null_ _null_ ));
+DESCR("btree(internal)");
+DATA(insert OID = 636 (  btgetbitmap	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ _null_	btgetbitmap _null_ _null_ _null_ ));
+DESCR("btree(internal)");
+DATA(insert OID = 331 (  btinsert		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 6 0 16 "2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_	btinsert _null_ _null_ _null_ ));
+DESCR("btree(internal)");
+DATA(insert OID = 333 (  btbeginscan	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_	btbeginscan _null_ _null_ _null_ ));
+DESCR("btree(internal)");
+DATA(insert OID = 334 (  btrescan		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 5 0 2278 "2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ btrescan _null_ _null_ _null_ ));
+DESCR("btree(internal)");
+DATA(insert OID = 335 (  btendscan		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ btendscan _null_ _null_ _null_ ));
+DESCR("btree(internal)");
+DATA(insert OID = 336 (  btmarkpos		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ btmarkpos _null_ _null_ _null_ ));
+DESCR("btree(internal)");
+DATA(insert OID = 337 (  btrestrpos		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ btrestrpos _null_ _null_ _null_ ));
+DESCR("btree(internal)");
+DATA(insert OID = 338 (  btbuild		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ btbuild _null_ _null_ _null_ ));
+DESCR("btree(internal)");
+DATA(insert OID = 328 (  btbuildempty	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ btbuildempty _null_ _null_ _null_ ));
+DESCR("btree(internal)");
+DATA(insert OID = 332 (  btbulkdelete	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ btbulkdelete _null_ _null_ _null_ ));
+DESCR("btree(internal)");
+DATA(insert OID = 972 (  btvacuumcleanup   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ btvacuumcleanup _null_ _null_ _null_ ));
+DESCR("btree(internal)");
+DATA(insert OID = 276 (  btcanreturn	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "2281 23" _null_ _null_ _null_ _null_ _null_ btcanreturn _null_ _null_ _null_ ));
+DESCR("btree(internal)");
+DATA(insert OID = 1268 (  btcostestimate   PGNSP PGUID 12 1 0 0 0 f f f f t f v 7 0 2278 "2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ btcostestimate _null_ _null_ _null_ ));
+DESCR("btree(internal)");
+DATA(insert OID = 2785 (  btoptions		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 17 "1009 16" _null_ _null_ _null_ _null_  _null_ btoptions _null_ _null_ _null_ ));
+DESCR("btree(internal)");
+
+DATA(insert OID = 3789 (  bringetbitmap    PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ _null_	bringetbitmap _null_ _null_ _null_ ));
+DESCR("brin(internal)");
+DATA(insert OID = 3790 (  brininsert		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 6 0 16 "2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_	brininsert _null_ _null_ _null_ ));
+DESCR("brin(internal)");
+DATA(insert OID = 3791 (  brinbeginscan    PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_	brinbeginscan _null_ _null_ _null_ ));
+DESCR("brin(internal)");
+DATA(insert OID = 3792 (  brinrescan		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 5 0 2278 "2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ brinrescan _null_ _null_ _null_ ));
+DESCR("brin(internal)");
+DATA(insert OID = 3793 (  brinendscan		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ brinendscan _null_ _null_ _null_ ));
+DESCR("brin(internal)");
+DATA(insert OID = 3794 (  brinmarkpos		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ brinmarkpos _null_ _null_ _null_ ));
+DESCR("brin(internal)");
+DATA(insert OID = 3795 (  brinrestrpos		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ brinrestrpos _null_ _null_ _null_ ));
+DESCR("brin(internal)");
+DATA(insert OID = 3796 (  brinbuild		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ brinbuild _null_ _null_ _null_ ));
+DESCR("brin(internal)");
+DATA(insert OID = 3797 (  brinbuildempty	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ brinbuildempty _null_ _null_ _null_ ));
+DESCR("brin(internal)");
+DATA(insert OID = 3798 (  brinbulkdelete	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ brinbulkdelete _null_ _null_ _null_ ));
+DESCR("brin(internal)");
+DATA(insert OID = 3799 (  brinvacuumcleanup   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ brinvacuumcleanup _null_ _null_ _null_ ));
+DESCR("brin(internal)");
+DATA(insert OID = 3800 (  brincostestimate	 PGNSP PGUID 12 1 0 0 0 f f f f t f v 7 0 2278 "2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ brincostestimate _null_ _null_ _null_ ));
+DESCR("brin(internal)");
+DATA(insert OID = 3801 (  brinoptions		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 17 "1009 16" _null_ _null_ _null_ _null_ _null_ brinoptions _null_ _null_ _null_ ));
+DESCR("brin(internal)");
+DATA(insert OID = 3952 (  brin_summarize_new_values PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 23 "2205" _null_ _null_ _null_ _null_ _null_ brin_summarize_new_values _null_ _null_ _null_ ));
+DESCR("brin: standalone scan new table pages");
+
+DATA(insert OID = 339 (  poly_same		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ _null_ poly_same _null_ _null_ _null_ ));
+DATA(insert OID = 340 (  poly_contain	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ _null_ poly_contain _null_ _null_ _null_ ));
+DATA(insert OID = 341 (  poly_left		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ _null_ poly_left _null_ _null_ _null_ ));
+DATA(insert OID = 342 (  poly_overleft	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ _null_ poly_overleft _null_ _null_ _null_ ));
+DATA(insert OID = 343 (  poly_overright    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ _null_ poly_overright _null_ _null_ _null_ ));
+DATA(insert OID = 344 (  poly_right		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ _null_ poly_right _null_ _null_ _null_ ));
+DATA(insert OID = 345 (  poly_contained    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ _null_ poly_contained _null_ _null_ _null_ ));
+DATA(insert OID = 346 (  poly_overlap	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ _null_ poly_overlap _null_ _null_ _null_ ));
+DATA(insert OID = 347 (  poly_in		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 604 "2275" _null_ _null_ _null_ _null_ _null_	poly_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 348 (  poly_out		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "604" _null_ _null_ _null_ _null_ _null_	poly_out _null_ _null_ _null_ ));
+DESCR("I/O");
+
+DATA(insert OID = 350 (  btint2cmp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "21 21" _null_ _null_ _null_ _null_ _null_ btint2cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 3129 ( btint2sortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ btint2sortsupport _null_ _null_ _null_ ));
+DESCR("sort support");
+DATA(insert OID = 351 (  btint4cmp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ _null_ btint4cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 3130 ( btint4sortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ btint4sortsupport _null_ _null_ _null_ ));
+DESCR("sort support");
+DATA(insert OID = 842 (  btint8cmp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "20 20" _null_ _null_ _null_ _null_ _null_ btint8cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 3131 ( btint8sortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ btint8sortsupport _null_ _null_ _null_ ));
+DESCR("sort support");
+DATA(insert OID = 354 (  btfloat4cmp	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "700 700" _null_ _null_ _null_ _null_ _null_ btfloat4cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 3132 ( btfloat4sortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ btfloat4sortsupport _null_ _null_ _null_ ));
+DESCR("sort support");
+DATA(insert OID = 355 (  btfloat8cmp	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "701 701" _null_ _null_ _null_ _null_ _null_ btfloat8cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 3133 ( btfloat8sortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ btfloat8sortsupport _null_ _null_ _null_ ));
+DESCR("sort support");
+DATA(insert OID = 356 (  btoidcmp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "26 26" _null_ _null_ _null_ _null_ _null_ btoidcmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 3134 ( btoidsortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ btoidsortsupport _null_ _null_ _null_ ));
+DESCR("sort support");
+DATA(insert OID = 404 (  btoidvectorcmp    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "30 30" _null_ _null_ _null_ _null_ _null_ btoidvectorcmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 357 (  btabstimecmp	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "702 702" _null_ _null_ _null_ _null_ _null_ btabstimecmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 358 (  btcharcmp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "18 18" _null_ _null_ _null_ _null_ _null_ btcharcmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 359 (  btnamecmp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "19 19" _null_ _null_ _null_ _null_ _null_ btnamecmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 3135 ( btnamesortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ btnamesortsupport _null_ _null_ _null_ ));
+DESCR("sort support");
+DATA(insert OID = 360 (  bttextcmp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ _null_ bttextcmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 3255 ( bttextsortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ bttextsortsupport _null_ _null_ _null_ ));
+DESCR("sort support");
+DATA(insert OID = 377 (  cash_cmp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "790 790" _null_ _null_ _null_ _null_ _null_ cash_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 380 (  btreltimecmp	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "703 703" _null_ _null_ _null_ _null_ _null_ btreltimecmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 381 (  bttintervalcmp    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "704 704" _null_ _null_ _null_ _null_ _null_ bttintervalcmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 382 (  btarraycmp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2277 2277" _null_ _null_ _null_ _null_ _null_ btarraycmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+DATA(insert OID = 361 (  lseg_distance	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "601 601" _null_ _null_ _null_ _null_ _null_	lseg_distance _null_ _null_ _null_ ));
+DATA(insert OID = 362 (  lseg_interpt	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "601 601" _null_ _null_ _null_ _null_ _null_	lseg_interpt _null_ _null_ _null_ ));
+DATA(insert OID = 363 (  dist_ps		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "600 601" _null_ _null_ _null_ _null_ _null_	dist_ps _null_ _null_ _null_ ));
+DATA(insert OID = 364 (  dist_pb		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "600 603" _null_ _null_ _null_ _null_ _null_	dist_pb _null_ _null_ _null_ ));
+DATA(insert OID = 365 (  dist_sb		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "601 603" _null_ _null_ _null_ _null_ _null_	dist_sb _null_ _null_ _null_ ));
+DATA(insert OID = 366 (  close_ps		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "600 601" _null_ _null_ _null_ _null_ _null_	close_ps _null_ _null_ _null_ ));
+DATA(insert OID = 367 (  close_pb		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "600 603" _null_ _null_ _null_ _null_ _null_	close_pb _null_ _null_ _null_ ));
+DATA(insert OID = 368 (  close_sb		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "601 603" _null_ _null_ _null_ _null_ _null_	close_sb _null_ _null_ _null_ ));
+DATA(insert OID = 369 (  on_ps			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 601" _null_ _null_ _null_ _null_ _null_ on_ps _null_ _null_ _null_ ));
+DATA(insert OID = 370 (  path_distance	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "602 602" _null_ _null_ _null_ _null_ _null_	path_distance _null_ _null_ _null_ ));
+DATA(insert OID = 371 (  dist_ppath		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "600 602" _null_ _null_ _null_ _null_ _null_	dist_ppath _null_ _null_ _null_ ));
+DATA(insert OID = 372 (  on_sb			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 603" _null_ _null_ _null_ _null_ _null_ on_sb _null_ _null_ _null_ ));
+DATA(insert OID = 373 (  inter_sb		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 603" _null_ _null_ _null_ _null_ _null_ inter_sb _null_ _null_ _null_ ));
+
+/* OIDS 400 - 499 */
+
+DATA(insert OID =  401 (  text			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "1042" _null_ _null_ _null_ _null_ _null_	rtrim1 _null_ _null_ _null_ ));
+DESCR("convert char(n) to text");
+DATA(insert OID =  406 (  text			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "19" _null_ _null_ _null_ _null_ _null_ name_text _null_ _null_ _null_ ));
+DESCR("convert name to text");
+DATA(insert OID =  407 (  name			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 19 "25" _null_ _null_ _null_ _null_ _null_ text_name _null_ _null_ _null_ ));
+DESCR("convert text to name");
+DATA(insert OID =  408 (  bpchar		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1042 "19" _null_ _null_ _null_ _null_ _null_ name_bpchar _null_ _null_ _null_ ));
+DESCR("convert name to char(n)");
+DATA(insert OID =  409 (  name			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 19 "1042" _null_ _null_ _null_ _null_ _null_	bpchar_name _null_ _null_ _null_ ));
+DESCR("convert char(n) to name");
+
+DATA(insert OID = 440 (  hashgettuple	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ _null_	hashgettuple _null_ _null_ _null_ ));
+DESCR("hash(internal)");
+DATA(insert OID = 637 (  hashgetbitmap	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ _null_	hashgetbitmap _null_ _null_ _null_ ));
+DESCR("hash(internal)");
+DATA(insert OID = 441 (  hashinsert		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 6 0 16 "2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_	hashinsert _null_ _null_ _null_ ));
+DESCR("hash(internal)");
+DATA(insert OID = 443 (  hashbeginscan	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_	hashbeginscan _null_ _null_ _null_ ));
+DESCR("hash(internal)");
+DATA(insert OID = 444 (  hashrescan		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 5 0 2278 "2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ hashrescan _null_ _null_ _null_ ));
+DESCR("hash(internal)");
+DATA(insert OID = 445 (  hashendscan	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ hashendscan _null_ _null_ _null_ ));
+DESCR("hash(internal)");
+DATA(insert OID = 446 (  hashmarkpos	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ hashmarkpos _null_ _null_ _null_ ));
+DESCR("hash(internal)");
+DATA(insert OID = 447 (  hashrestrpos	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ hashrestrpos _null_ _null_ _null_ ));
+DESCR("hash(internal)");
+DATA(insert OID = 448 (  hashbuild		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ hashbuild _null_ _null_ _null_ ));
+DESCR("hash(internal)");
+DATA(insert OID = 327 (  hashbuildempty    PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ hashbuildempty _null_ _null_ _null_ ));
+DESCR("hash(internal)");
+DATA(insert OID = 442 (  hashbulkdelete    PGNSP PGUID 12 1 0 0 0 f f f f t f v 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ hashbulkdelete _null_ _null_ _null_ ));
+DESCR("hash(internal)");
+DATA(insert OID = 425 (  hashvacuumcleanup PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ hashvacuumcleanup _null_ _null_ _null_ ));
+DESCR("hash(internal)");
+DATA(insert OID = 438 (  hashcostestimate  PGNSP PGUID 12 1 0 0 0 f f f f t f v 7 0 2278 "2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ hashcostestimate _null_ _null_ _null_ ));
+DESCR("hash(internal)");
+DATA(insert OID = 2786 (  hashoptions	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 17 "1009 16" _null_ _null_ _null_ _null_  _null_ hashoptions _null_ _null_ _null_ ));
+DESCR("hash(internal)");
+
+DATA(insert OID = 449 (  hashint2		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "21" _null_ _null_ _null_ _null_ _null_ hashint2 _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 450 (  hashint4		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ hashint4 _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 949 (  hashint8		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "20" _null_ _null_ _null_ _null_ _null_ hashint8 _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 451 (  hashfloat4		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "700" _null_ _null_ _null_ _null_ _null_ hashfloat4 _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 452 (  hashfloat8		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "701" _null_ _null_ _null_ _null_ _null_ hashfloat8 _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 453 (  hashoid		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "26" _null_ _null_ _null_ _null_ _null_ hashoid _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 454 (  hashchar		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "18" _null_ _null_ _null_ _null_ _null_ hashchar _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 455 (  hashname		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "19" _null_ _null_ _null_ _null_ _null_ hashname _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 400 (  hashtext		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ _null_ hashtext _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 456 (  hashvarlena	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "2281" _null_ _null_ _null_ _null_ _null_ hashvarlena _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 457 (  hashoidvector	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "30" _null_ _null_ _null_ _null_ _null_ hashoidvector _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 329 (  hash_aclitem	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1033" _null_ _null_ _null_ _null_ _null_	hash_aclitem _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 398 (  hashint2vector    PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "22" _null_ _null_ _null_ _null_ _null_ hashint2vector _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 399 (  hashmacaddr	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "829" _null_ _null_ _null_ _null_ _null_ hashmacaddr _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 422 (  hashinet		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "869" _null_ _null_ _null_ _null_ _null_ hashinet _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 432 (  hash_numeric	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1700" _null_ _null_ _null_ _null_ _null_ hash_numeric _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 458 (  text_larger	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ _null_ text_larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 459 (  text_smaller	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ _null_ text_smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+
+DATA(insert OID = 460 (  int8in			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "2275" _null_ _null_ _null_ _null_ _null_ int8in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 461 (  int8out		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "20" _null_ _null_ _null_ _null_ _null_ int8out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 462 (  int8um			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ _null_ int8um _null_ _null_ _null_ ));
+DATA(insert OID = 463 (  int8pl			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ _null_ int8pl _null_ _null_ _null_ ));
+DATA(insert OID = 464 (  int8mi			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ _null_ int8mi _null_ _null_ _null_ ));
+DATA(insert OID = 465 (  int8mul		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ _null_ int8mul _null_ _null_ _null_ ));
+DATA(insert OID = 466 (  int8div		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ _null_ int8div _null_ _null_ _null_ ));
+DATA(insert OID = 467 (  int8eq			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 20" _null_ _null_ _null_ _null_ _null_ int8eq _null_ _null_ _null_ ));
+DATA(insert OID = 468 (  int8ne			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 20" _null_ _null_ _null_ _null_ _null_ int8ne _null_ _null_ _null_ ));
+DATA(insert OID = 469 (  int8lt			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 20" _null_ _null_ _null_ _null_ _null_ int8lt _null_ _null_ _null_ ));
+DATA(insert OID = 470 (  int8gt			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 20" _null_ _null_ _null_ _null_ _null_ int8gt _null_ _null_ _null_ ));
+DATA(insert OID = 471 (  int8le			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 20" _null_ _null_ _null_ _null_ _null_ int8le _null_ _null_ _null_ ));
+DATA(insert OID = 472 (  int8ge			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 20" _null_ _null_ _null_ _null_ _null_ int8ge _null_ _null_ _null_ ));
+
+DATA(insert OID = 474 (  int84eq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 23" _null_ _null_ _null_ _null_ _null_ int84eq _null_ _null_ _null_ ));
+DATA(insert OID = 475 (  int84ne		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 23" _null_ _null_ _null_ _null_ _null_ int84ne _null_ _null_ _null_ ));
+DATA(insert OID = 476 (  int84lt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 23" _null_ _null_ _null_ _null_ _null_ int84lt _null_ _null_ _null_ ));
+DATA(insert OID = 477 (  int84gt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 23" _null_ _null_ _null_ _null_ _null_ int84gt _null_ _null_ _null_ ));
+DATA(insert OID = 478 (  int84le		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 23" _null_ _null_ _null_ _null_ _null_ int84le _null_ _null_ _null_ ));
+DATA(insert OID = 479 (  int84ge		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 23" _null_ _null_ _null_ _null_ _null_ int84ge _null_ _null_ _null_ ));
+
+DATA(insert OID = 480 (  int4			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "20" _null_ _null_ _null_ _null_ _null_ int84 _null_ _null_ _null_ ));
+DESCR("convert int8 to int4");
+DATA(insert OID = 481 (  int8			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "23" _null_ _null_ _null_ _null_ _null_ int48 _null_ _null_ _null_ ));
+DESCR("convert int4 to int8");
+DATA(insert OID = 482 (  float8			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "20" _null_ _null_ _null_ _null_ _null_ i8tod _null_ _null_ _null_ ));
+DESCR("convert int8 to float8");
+DATA(insert OID = 483 (  int8			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "701" _null_ _null_ _null_ _null_ _null_ dtoi8 _null_ _null_ _null_ ));
+DESCR("convert float8 to int8");
+
+/* OIDS 500 - 599 */
+
+/* OIDS 600 - 699 */
+
+DATA(insert OID = 626 (  hash_array		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "2277" _null_ _null_ _null_ _null_ _null_ hash_array _null_ _null_ _null_ ));
+DESCR("hash");
+
+DATA(insert OID = 652 (  float4			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "20" _null_ _null_ _null_ _null_ _null_ i8tof _null_ _null_ _null_ ));
+DESCR("convert int8 to float4");
+DATA(insert OID = 653 (  int8			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "700" _null_ _null_ _null_ _null_ _null_ ftoi8 _null_ _null_ _null_ ));
+DESCR("convert float4 to int8");
+
+DATA(insert OID = 714 (  int2			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "20" _null_ _null_ _null_ _null_ _null_ int82 _null_ _null_ _null_ ));
+DESCR("convert int8 to int2");
+DATA(insert OID = 754 (  int8			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "21" _null_ _null_ _null_ _null_ _null_ int28 _null_ _null_ _null_ ));
+DESCR("convert int2 to int8");
+
+DATA(insert OID = 655 (  namelt			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "19 19" _null_ _null_ _null_ _null_ _null_ namelt _null_ _null_ _null_ ));
+DATA(insert OID = 656 (  namele			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "19 19" _null_ _null_ _null_ _null_ _null_ namele _null_ _null_ _null_ ));
+DATA(insert OID = 657 (  namegt			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "19 19" _null_ _null_ _null_ _null_ _null_ namegt _null_ _null_ _null_ ));
+DATA(insert OID = 658 (  namege			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "19 19" _null_ _null_ _null_ _null_ _null_ namege _null_ _null_ _null_ ));
+DATA(insert OID = 659 (  namene			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "19 19" _null_ _null_ _null_ _null_ _null_ namene _null_ _null_ _null_ ));
+
+DATA(insert OID = 668 (  bpchar			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1042 "1042 23 16" _null_ _null_ _null_ _null_ _null_ bpchar _null_ _null_ _null_ ));
+DESCR("adjust char() to typmod length");
+DATA(insert OID = 3097 ( varchar_transform PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ varchar_transform _null_ _null_ _null_ ));
+DESCR("transform a varchar length coercion");
+DATA(insert OID = 669 (  varchar		   PGNSP PGUID 12 1 0 0 varchar_transform f f f f t f i 3 0 1043 "1043 23 16" _null_ _null_ _null_ _null_ _null_ varchar _null_ _null_ _null_ ));
+DESCR("adjust varchar() to typmod length");
+
+DATA(insert OID = 676 (  mktinterval	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 704 "702 702" _null_ _null_ _null_ _null_ _null_ mktinterval _null_ _null_ _null_ ));
+
+DATA(insert OID = 619 (  oidvectorne	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "30 30" _null_ _null_ _null_ _null_ _null_ oidvectorne _null_ _null_ _null_ ));
+DATA(insert OID = 677 (  oidvectorlt	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "30 30" _null_ _null_ _null_ _null_ _null_ oidvectorlt _null_ _null_ _null_ ));
+DATA(insert OID = 678 (  oidvectorle	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "30 30" _null_ _null_ _null_ _null_ _null_ oidvectorle _null_ _null_ _null_ ));
+DATA(insert OID = 679 (  oidvectoreq	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "30 30" _null_ _null_ _null_ _null_ _null_ oidvectoreq _null_ _null_ _null_ ));
+DATA(insert OID = 680 (  oidvectorge	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "30 30" _null_ _null_ _null_ _null_ _null_ oidvectorge _null_ _null_ _null_ ));
+DATA(insert OID = 681 (  oidvectorgt	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "30 30" _null_ _null_ _null_ _null_ _null_ oidvectorgt _null_ _null_ _null_ ));
+
+/* OIDS 700 - 799 */
+DATA(insert OID = 710 (  getpgusername	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ _null_ current_user _null_ _null_ _null_ ));
+DESCR("deprecated, use current_user instead");
+DATA(insert OID = 716 (  oidlt			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "26 26" _null_ _null_ _null_ _null_ _null_ oidlt _null_ _null_ _null_ ));
+DATA(insert OID = 717 (  oidle			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "26 26" _null_ _null_ _null_ _null_ _null_ oidle _null_ _null_ _null_ ));
+
+DATA(insert OID = 720 (  octet_length	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "17" _null_ _null_ _null_ _null_ _null_ byteaoctetlen _null_ _null_ _null_ ));
+DESCR("octet length");
+DATA(insert OID = 721 (  get_byte		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "17 23" _null_ _null_ _null_ _null_ _null_ byteaGetByte _null_ _null_ _null_ ));
+DESCR("get byte");
+DATA(insert OID = 722 (  set_byte		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 17 "17 23 23" _null_ _null_ _null_ _null_ _null_	byteaSetByte _null_ _null_ _null_ ));
+DESCR("set byte");
+DATA(insert OID = 723 (  get_bit		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "17 23" _null_ _null_ _null_ _null_ _null_ byteaGetBit _null_ _null_ _null_ ));
+DESCR("get bit");
+DATA(insert OID = 724 (  set_bit		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 17 "17 23 23" _null_ _null_ _null_ _null_ _null_	byteaSetBit _null_ _null_ _null_ ));
+DESCR("set bit");
+DATA(insert OID = 749 (  overlay		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 17 "17 17 23 23" _null_ _null_ _null_ _null_ _null_ byteaoverlay _null_ _null_ _null_ ));
+DESCR("substitute portion of string");
+DATA(insert OID = 752 (  overlay		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 17 "17 17 23" _null_ _null_ _null_ _null_ _null_	byteaoverlay_no_len _null_ _null_ _null_ ));
+DESCR("substitute portion of string");
+
+DATA(insert OID = 725 (  dist_pl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "600 628" _null_ _null_ _null_ _null_ _null_	dist_pl _null_ _null_ _null_ ));
+DATA(insert OID = 726 (  dist_lb		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "628 603" _null_ _null_ _null_ _null_ _null_	dist_lb _null_ _null_ _null_ ));
+DATA(insert OID = 727 (  dist_sl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "601 628" _null_ _null_ _null_ _null_ _null_	dist_sl _null_ _null_ _null_ ));
+DATA(insert OID = 728 (  dist_cpoly		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "718 604" _null_ _null_ _null_ _null_ _null_	dist_cpoly _null_ _null_ _null_ ));
+DATA(insert OID = 729 (  poly_distance	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "604 604" _null_ _null_ _null_ _null_ _null_	poly_distance _null_ _null_ _null_ ));
+DATA(insert OID = 3275 (  dist_ppoly	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "600 604" _null_ _null_ _null_ _null_ _null_	dist_ppoly _null_ _null_ _null_ ));
+DATA(insert OID = 3292 (  dist_polyp	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "604 600" _null_ _null_ _null_ _null_ _null_	dist_polyp _null_ _null_ _null_ ));
+DATA(insert OID = 3290 (  dist_cpoint	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "718 600" _null_ _null_ _null_ _null_ _null_	dist_cpoint _null_ _null_ _null_ ));
+
+DATA(insert OID = 740 (  text_lt		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ text_lt _null_ _null_ _null_ ));
+DATA(insert OID = 741 (  text_le		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ text_le _null_ _null_ _null_ ));
+DATA(insert OID = 742 (  text_gt		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ text_gt _null_ _null_ _null_ ));
+DATA(insert OID = 743 (  text_ge		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ text_ge _null_ _null_ _null_ ));
+
+DATA(insert OID = 745 (  current_user	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ _null_ current_user _null_ _null_ _null_ ));
+DESCR("current user name");
+DATA(insert OID = 746 (  session_user	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ _null_ session_user _null_ _null_ _null_ ));
+DESCR("session user name");
+
+DATA(insert OID = 744 (  array_eq		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ _null_ array_eq _null_ _null_ _null_ ));
+DATA(insert OID = 390 (  array_ne		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ _null_ array_ne _null_ _null_ _null_ ));
+DATA(insert OID = 391 (  array_lt		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ _null_ array_lt _null_ _null_ _null_ ));
+DATA(insert OID = 392 (  array_gt		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ _null_ array_gt _null_ _null_ _null_ ));
+DATA(insert OID = 393 (  array_le		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ _null_ array_le _null_ _null_ _null_ ));
+DATA(insert OID = 396 (  array_ge		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ _null_ array_ge _null_ _null_ _null_ ));
+DATA(insert OID = 747 (  array_dims		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "2277" _null_ _null_ _null_ _null_ _null_ array_dims _null_ _null_ _null_ ));
+DESCR("array dimensions");
+DATA(insert OID = 748 (  array_ndims	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "2277" _null_ _null_ _null_ _null_ _null_ array_ndims _null_ _null_ _null_ ));
+DESCR("number of array dimensions");
+DATA(insert OID = 750 (  array_in		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 2277 "2275 26 23" _null_ _null_ _null_ _null_ _null_	array_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 751 (  array_out		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2277" _null_ _null_ _null_ _null_ _null_ array_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2091 (  array_lower	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2277 23" _null_ _null_ _null_ _null_ _null_ array_lower _null_ _null_ _null_ ));
+DESCR("array lower dimension");
+DATA(insert OID = 2092 (  array_upper	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2277 23" _null_ _null_ _null_ _null_ _null_ array_upper _null_ _null_ _null_ ));
+DESCR("array upper dimension");
+DATA(insert OID = 2176 (  array_length	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2277 23" _null_ _null_ _null_ _null_ _null_ array_length _null_ _null_ _null_ ));
+DESCR("array length");
+DATA(insert OID = 3179 (  cardinality	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "2277" _null_ _null_ _null_ _null_ _null_ array_cardinality _null_ _null_ _null_ ));
+DESCR("array cardinality");
+DATA(insert OID = 378 (  array_append	   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2277 "2277 2283" _null_ _null_ _null_ _null_ _null_ array_append _null_ _null_ _null_ ));
+DESCR("append element onto end of array");
+DATA(insert OID = 379 (  array_prepend	   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2277 "2283 2277" _null_ _null_ _null_ _null_ _null_ array_prepend _null_ _null_ _null_ ));
+DESCR("prepend element onto front of array");
+DATA(insert OID = 383 (  array_cat		   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2277 "2277 2277" _null_ _null_ _null_ _null_ _null_ array_cat _null_ _null_ _null_ ));
+DATA(insert OID = 394 (  string_to_array   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 1009 "25 25" _null_ _null_ _null_ _null_ _null_ text_to_array _null_ _null_ _null_ ));
+DESCR("split delimited text into text[]");
+DATA(insert OID = 395 (  array_to_string   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "2277 25" _null_ _null_ _null_ _null_ _null_ array_to_text _null_ _null_ _null_ ));
+DESCR("concatenate array elements, using delimiter, into text");
+DATA(insert OID = 376 (  string_to_array   PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 1009 "25 25 25" _null_ _null_ _null_ _null_ _null_ text_to_array_null _null_ _null_ _null_ ));
+DESCR("split delimited text into text[], with null string");
+DATA(insert OID = 384 (  array_to_string   PGNSP PGUID 12 1 0 0 0 f f f f f f s 3 0 25 "2277 25 25" _null_ _null_ _null_ _null_ _null_ array_to_text_null _null_ _null_ _null_ ));
+DESCR("concatenate array elements, using delimiter and null string, into text");
+DATA(insert OID = 515 (  array_larger	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2277 "2277 2277" _null_ _null_ _null_ _null_ _null_ array_larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 516 (  array_smaller	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2277 "2277 2277" _null_ _null_ _null_ _null_ _null_ array_smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+DATA(insert OID = 3277 (  array_position		   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 23 "2277 2283" _null_ _null_ _null_ _null_ _null_ array_position _null_ _null_ _null_ ));
+DESCR("returns an offset of value in array");
+DATA(insert OID = 3278 (  array_position		   PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 23 "2277 2283 23" _null_ _null_ _null_ _null_ _null_ array_position_start _null_ _null_ _null_ ));
+DESCR("returns an offset of value in array with start index");
+DATA(insert OID = 3279 (  array_positions		   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 1007 "2277 2283" _null_ _null_ _null_ _null_ _null_ array_positions _null_ _null_ _null_ ));
+DESCR("returns an array of offsets of some value in array");
+DATA(insert OID = 1191 (  generate_subscripts PGNSP PGUID 12 1 1000 0 0 f f f f t t i 3 0 23 "2277 23 16" _null_ _null_ _null_ _null_ _null_ generate_subscripts _null_ _null_ _null_ ));
+DESCR("array subscripts generator");
+DATA(insert OID = 1192 (  generate_subscripts PGNSP PGUID 12 1 1000 0 0 f f f f t t i 2 0 23 "2277 23" _null_ _null_ _null_ _null_ _null_ generate_subscripts_nodir _null_ _null_ _null_ ));
+DESCR("array subscripts generator");
+DATA(insert OID = 1193 (  array_fill PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2277 "2283 1007" _null_ _null_ _null_ _null_ _null_ array_fill _null_ _null_ _null_ ));
+DESCR("array constructor with value");
+DATA(insert OID = 1286 (  array_fill PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 2277 "2283 1007 1007" _null_ _null_ _null_ _null_ _null_ array_fill_with_lower_bounds _null_ _null_ _null_ ));
+DESCR("array constructor with value");
+DATA(insert OID = 2331 (  unnest		   PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 2283 "2277" _null_ _null_ _null_ _null_ _null_ array_unnest _null_ _null_ _null_ ));
+DESCR("expand array to set of rows");
+DATA(insert OID = 3167 (  array_remove	   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2277 "2277 2283" _null_ _null_ _null_ _null_ _null_ array_remove _null_ _null_ _null_ ));
+DESCR("remove any occurrences of an element from an array");
+DATA(insert OID = 3168 (  array_replace    PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 2277 "2277 2283 2283" _null_ _null_ _null_ _null_ _null_ array_replace _null_ _null_ _null_ ));
+DESCR("replace any occurrences of an element in an array");
+DATA(insert OID = 2333 (  array_agg_transfn   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 2776" _null_ _null_ _null_ _null_ _null_ array_agg_transfn _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 2334 (  array_agg_finalfn   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2277 "2281 2776" _null_ _null_ _null_ _null_ _null_ array_agg_finalfn _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2335 (  array_agg		   PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 2277 "2776" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("concatenate aggregate input into an array");
+DATA(insert OID = 4051 (  array_agg_array_transfn	PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 2277" _null_ _null_ _null_ _null_ _null_ array_agg_array_transfn _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 4052 (  array_agg_array_finalfn	PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2277 "2281 2277" _null_ _null_ _null_ _null_ _null_ array_agg_array_finalfn _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 4053 (  array_agg		   PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 2277 "2277" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("concatenate aggregate input into an array");
+DATA(insert OID = 3218 ( width_bucket	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2283 2277" _null_ _null_ _null_ _null_ _null_ width_bucket_array _null_ _null_ _null_ ));
+DESCR("bucket number of operand given a sorted array of bucket lower bounds");
+DATA(insert OID = 3816 (  array_typanalyze PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "2281" _null_ _null_ _null_ _null_ _null_ array_typanalyze _null_ _null_ _null_ ));
+DESCR("array typanalyze");
+DATA(insert OID = 3817 (  arraycontsel	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_ arraycontsel _null_ _null_ _null_ ));
+DESCR("restriction selectivity for array-containment operators");
+DATA(insert OID = 3818 (  arraycontjoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ _null_ arraycontjoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity for array-containment operators");
+
+DATA(insert OID = 760 (  smgrin			   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 210 "2275" _null_ _null_ _null_ _null_ _null_	smgrin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 761 (  smgrout		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "210" _null_ _null_ _null_ _null_ _null_	smgrout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 762 (  smgreq			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "210 210" _null_ _null_ _null_ _null_ _null_ smgreq _null_ _null_ _null_ ));
+DESCR("storage manager");
+DATA(insert OID = 763 (  smgrne			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "210 210" _null_ _null_ _null_ _null_ _null_ smgrne _null_ _null_ _null_ ));
+DESCR("storage manager");
+
+DATA(insert OID = 764 (  lo_import		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 26 "25" _null_ _null_ _null_ _null_ _null_ lo_import _null_ _null_ _null_ ));
+DESCR("large object import");
+DATA(insert OID = 767 (  lo_import		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 26 "25 26" _null_ _null_ _null_ _null_ _null_	lo_import_with_oid _null_ _null_ _null_ ));
+DESCR("large object import");
+DATA(insert OID = 765 (  lo_export		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 23 "26 25" _null_ _null_ _null_ _null_ _null_ lo_export _null_ _null_ _null_ ));
+DESCR("large object export");
+
+DATA(insert OID = 766 (  int4inc		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ int4inc _null_ _null_ _null_ ));
+DESCR("increment");
+DATA(insert OID = 768 (  int4larger		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ _null_ int4larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 769 (  int4smaller	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ _null_ int4smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+DATA(insert OID = 770 (  int2larger		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ _null_ int2larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 771 (  int2smaller	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ _null_ int2smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+
+DATA(insert OID = 774 (  gistgettuple	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ _null_	gistgettuple _null_ _null_ _null_ ));
+DESCR("gist(internal)");
+DATA(insert OID = 638 (  gistgetbitmap	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ _null_	gistgetbitmap _null_ _null_ _null_ ));
+DESCR("gist(internal)");
+DATA(insert OID = 775 (  gistinsert		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 6 0 16 "2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_	gistinsert _null_ _null_ _null_ ));
+DESCR("gist(internal)");
+DATA(insert OID = 777 (  gistbeginscan	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_	gistbeginscan _null_ _null_ _null_ ));
+DESCR("gist(internal)");
+DATA(insert OID = 778 (  gistrescan		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 5 0 2278 "2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gistrescan _null_ _null_ _null_ ));
+DESCR("gist(internal)");
+DATA(insert OID = 779 (  gistendscan	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ gistendscan _null_ _null_ _null_ ));
+DESCR("gist(internal)");
+DATA(insert OID = 780 (  gistmarkpos	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ gistmarkpos _null_ _null_ _null_ ));
+DESCR("gist(internal)");
+DATA(insert OID = 781 (  gistrestrpos	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ gistrestrpos _null_ _null_ _null_ ));
+DESCR("gist(internal)");
+DATA(insert OID = 782 (  gistbuild		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gistbuild _null_ _null_ _null_ ));
+DESCR("gist(internal)");
+DATA(insert OID = 326 (  gistbuildempty    PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ gistbuildempty _null_ _null_ _null_ ));
+DESCR("gist(internal)");
+DATA(insert OID = 776 (  gistbulkdelete    PGNSP PGUID 12 1 0 0 0 f f f f t f v 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gistbulkdelete _null_ _null_ _null_ ));
+DESCR("gist(internal)");
+DATA(insert OID = 2561 (  gistvacuumcleanup   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ gistvacuumcleanup _null_ _null_ _null_ ));
+DESCR("gist(internal)");
+DATA(insert OID = 3280 (  gistcanreturn    PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "2281 23" _null_ _null_ _null_ _null_ _null_ gistcanreturn _null_ _null_ _null_ ));
+DESCR("gist(internal)");
+DATA(insert OID = 772 (  gistcostestimate  PGNSP PGUID 12 1 0 0 0 f f f f t f v 7 0 2278 "2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gistcostestimate _null_ _null_ _null_ ));
+DESCR("gist(internal)");
+DATA(insert OID = 2787 (  gistoptions	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 17 "1009 16" _null_ _null_ _null_ _null_  _null_ gistoptions _null_ _null_ _null_ ));
+DESCR("gist(internal)");
+
+DATA(insert OID = 784 (  tintervaleq	   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ _null_ tintervaleq _null_ _null_ _null_ ));
+DATA(insert OID = 785 (  tintervalne	   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ _null_ tintervalne _null_ _null_ _null_ ));
+DATA(insert OID = 786 (  tintervallt	   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ _null_ tintervallt _null_ _null_ _null_ ));
+DATA(insert OID = 787 (  tintervalgt	   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ _null_ tintervalgt _null_ _null_ _null_ ));
+DATA(insert OID = 788 (  tintervalle	   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ _null_ tintervalle _null_ _null_ _null_ ));
+DATA(insert OID = 789 (  tintervalge	   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ _null_ tintervalge _null_ _null_ _null_ ));
+
+/* OIDS 800 - 899 */
+
+DATA(insert OID =  846 (  cash_mul_flt4    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 700" _null_ _null_ _null_ _null_ _null_	cash_mul_flt4 _null_ _null_ _null_ ));
+DATA(insert OID =  847 (  cash_div_flt4    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 700" _null_ _null_ _null_ _null_ _null_	cash_div_flt4 _null_ _null_ _null_ ));
+DATA(insert OID =  848 (  flt4_mul_cash    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "700 790" _null_ _null_ _null_ _null_ _null_	flt4_mul_cash _null_ _null_ _null_ ));
+
+DATA(insert OID =  849 (  position		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ _null_ textpos _null_ _null_ _null_ ));
+DESCR("position of substring");
+DATA(insert OID =  850 (  textlike		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ textlike _null_ _null_ _null_ ));
+DATA(insert OID =  851 (  textnlike		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ textnlike _null_ _null_ _null_ ));
+
+DATA(insert OID =  852 (  int48eq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 20" _null_ _null_ _null_ _null_ _null_ int48eq _null_ _null_ _null_ ));
+DATA(insert OID =  853 (  int48ne		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 20" _null_ _null_ _null_ _null_ _null_ int48ne _null_ _null_ _null_ ));
+DATA(insert OID =  854 (  int48lt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 20" _null_ _null_ _null_ _null_ _null_ int48lt _null_ _null_ _null_ ));
+DATA(insert OID =  855 (  int48gt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 20" _null_ _null_ _null_ _null_ _null_ int48gt _null_ _null_ _null_ ));
+DATA(insert OID =  856 (  int48le		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 20" _null_ _null_ _null_ _null_ _null_ int48le _null_ _null_ _null_ ));
+DATA(insert OID =  857 (  int48ge		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 20" _null_ _null_ _null_ _null_ _null_ int48ge _null_ _null_ _null_ ));
+
+DATA(insert OID =  858 (  namelike		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ _null_ namelike _null_ _null_ _null_ ));
+DATA(insert OID =  859 (  namenlike		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ _null_ namenlike _null_ _null_ _null_ ));
+
+DATA(insert OID =  860 (  bpchar		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1042 "18" _null_ _null_ _null_ _null_ _null_	char_bpchar _null_ _null_ _null_ ));
+DESCR("convert char to char(n)");
+
+DATA(insert OID = 861 ( current_database	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ _null_ current_database _null_ _null_ _null_ ));
+DESCR("name of the current database");
+DATA(insert OID = 817 (  current_query		  PGNSP PGUID 12 1 0 0 0 f f f f f f v 0 0 25 "" _null_ _null_ _null_ _null_  _null_ current_query _null_ _null_ _null_ ));
+DESCR("get the currently executing query");
+
+DATA(insert OID =  862 (  int4_mul_cash		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "23 790" _null_ _null_ _null_ _null_ _null_ int4_mul_cash _null_ _null_ _null_ ));
+DATA(insert OID =  863 (  int2_mul_cash		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "21 790" _null_ _null_ _null_ _null_ _null_ int2_mul_cash _null_ _null_ _null_ ));
+DATA(insert OID =  864 (  cash_mul_int4		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 23" _null_ _null_ _null_ _null_ _null_ cash_mul_int4 _null_ _null_ _null_ ));
+DATA(insert OID =  865 (  cash_div_int4		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 23" _null_ _null_ _null_ _null_ _null_ cash_div_int4 _null_ _null_ _null_ ));
+DATA(insert OID =  866 (  cash_mul_int2		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 21" _null_ _null_ _null_ _null_ _null_ cash_mul_int2 _null_ _null_ _null_ ));
+DATA(insert OID =  867 (  cash_div_int2		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 21" _null_ _null_ _null_ _null_ _null_ cash_div_int2 _null_ _null_ _null_ ));
+
+DATA(insert OID =  886 (  cash_in		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 790 "2275" _null_ _null_ _null_ _null_ _null_	cash_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  887 (  cash_out		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "790" _null_ _null_ _null_ _null_ _null_	cash_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  888 (  cash_eq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "790 790" _null_ _null_ _null_ _null_ _null_ cash_eq _null_ _null_ _null_ ));
+DATA(insert OID =  889 (  cash_ne		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "790 790" _null_ _null_ _null_ _null_ _null_ cash_ne _null_ _null_ _null_ ));
+DATA(insert OID =  890 (  cash_lt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "790 790" _null_ _null_ _null_ _null_ _null_ cash_lt _null_ _null_ _null_ ));
+DATA(insert OID =  891 (  cash_le		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "790 790" _null_ _null_ _null_ _null_ _null_ cash_le _null_ _null_ _null_ ));
+DATA(insert OID =  892 (  cash_gt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "790 790" _null_ _null_ _null_ _null_ _null_ cash_gt _null_ _null_ _null_ ));
+DATA(insert OID =  893 (  cash_ge		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "790 790" _null_ _null_ _null_ _null_ _null_ cash_ge _null_ _null_ _null_ ));
+DATA(insert OID =  894 (  cash_pl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 790" _null_ _null_ _null_ _null_ _null_	cash_pl _null_ _null_ _null_ ));
+DATA(insert OID =  895 (  cash_mi		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 790" _null_ _null_ _null_ _null_ _null_	cash_mi _null_ _null_ _null_ ));
+DATA(insert OID =  896 (  cash_mul_flt8    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 701" _null_ _null_ _null_ _null_ _null_	cash_mul_flt8 _null_ _null_ _null_ ));
+DATA(insert OID =  897 (  cash_div_flt8    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 701" _null_ _null_ _null_ _null_ _null_	cash_div_flt8 _null_ _null_ _null_ ));
+DATA(insert OID =  898 (  cashlarger	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 790" _null_ _null_ _null_ _null_ _null_	cashlarger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID =  899 (  cashsmaller	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 790" _null_ _null_ _null_ _null_ _null_	cashsmaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+DATA(insert OID =  919 (  flt8_mul_cash    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "701 790" _null_ _null_ _null_ _null_ _null_	flt8_mul_cash _null_ _null_ _null_ ));
+DATA(insert OID =  935 (  cash_words	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "790" _null_ _null_ _null_ _null_ _null_ cash_words _null_ _null_ _null_ ));
+DESCR("output money amount as words");
+DATA(insert OID = 3822 (  cash_div_cash    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "790 790" _null_ _null_ _null_ _null_ _null_	cash_div_cash _null_ _null_ _null_ ));
+DATA(insert OID = 3823 (  numeric		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1700 "790" _null_ _null_ _null_ _null_ _null_	cash_numeric _null_ _null_ _null_ ));
+DESCR("convert money to numeric");
+DATA(insert OID = 3824 (  money			   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 790 "1700" _null_ _null_ _null_ _null_ _null_	numeric_cash _null_ _null_ _null_ ));
+DESCR("convert numeric to money");
+DATA(insert OID = 3811 (  money			   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 790 "23" _null_ _null_ _null_ _null_ _null_ int4_cash _null_ _null_ _null_ ));
+DESCR("convert int4 to money");
+DATA(insert OID = 3812 (  money			   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 790 "20" _null_ _null_ _null_ _null_ _null_ int8_cash _null_ _null_ _null_ ));
+DESCR("convert int8 to money");
+
+/* OIDS 900 - 999 */
+
+DATA(insert OID = 940 (  mod			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ _null_ int2mod _null_ _null_ _null_ ));
+DESCR("modulus");
+DATA(insert OID = 941 (  mod			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ _null_ int4mod _null_ _null_ _null_ ));
+DESCR("modulus");
+
+DATA(insert OID = 945 (  int8mod		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ _null_ int8mod _null_ _null_ _null_ ));
+DATA(insert OID = 947 (  mod			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ _null_ int8mod _null_ _null_ _null_ ));
+DESCR("modulus");
+
+DATA(insert OID = 944 (  char			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 18 "25" _null_ _null_ _null_ _null_ _null_ text_char _null_ _null_ _null_ ));
+DESCR("convert text to char");
+DATA(insert OID = 946 (  text			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "18" _null_ _null_ _null_ _null_ _null_ char_text _null_ _null_ _null_ ));
+DESCR("convert char to text");
+
+DATA(insert OID = 952 (  lo_open		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 23 "26 23" _null_ _null_ _null_ _null_ _null_ lo_open _null_ _null_ _null_ ));
+DESCR("large object open");
+DATA(insert OID = 953 (  lo_close		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ lo_close _null_ _null_ _null_ ));
+DESCR("large object close");
+DATA(insert OID = 954 (  loread			   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 17 "23 23" _null_ _null_ _null_ _null_ _null_ loread _null_ _null_ _null_ ));
+DESCR("large object read");
+DATA(insert OID = 955 (  lowrite		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 23 "23 17" _null_ _null_ _null_ _null_ _null_ lowrite _null_ _null_ _null_ ));
+DESCR("large object write");
+DATA(insert OID = 956 (  lo_lseek		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 23 "23 23 23" _null_ _null_ _null_ _null_ _null_	lo_lseek _null_ _null_ _null_ ));
+DESCR("large object seek");
+DATA(insert OID = 3170 (  lo_lseek64	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 20 "23 20 23" _null_ _null_ _null_ _null_ _null_	lo_lseek64 _null_ _null_ _null_ ));
+DESCR("large object seek (64 bit)");
+DATA(insert OID = 957 (  lo_creat		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 26 "23" _null_ _null_ _null_ _null_ _null_ lo_creat _null_ _null_ _null_ ));
+DESCR("large object create");
+DATA(insert OID = 715 (  lo_create		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 26 "26" _null_ _null_ _null_ _null_ _null_ lo_create _null_ _null_ _null_ ));
+DESCR("large object create");
+DATA(insert OID = 958 (  lo_tell		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ lo_tell _null_ _null_ _null_ ));
+DESCR("large object position");
+DATA(insert OID = 3171 (  lo_tell64		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "23" _null_ _null_ _null_ _null_ _null_ lo_tell64 _null_ _null_ _null_ ));
+DESCR("large object position (64 bit)");
+DATA(insert OID = 1004 (  lo_truncate	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 23 "23 23" _null_ _null_ _null_ _null_ _null_ lo_truncate _null_ _null_ _null_ ));
+DESCR("truncate large object");
+DATA(insert OID = 3172 (  lo_truncate64    PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 23 "23 20" _null_ _null_ _null_ _null_ _null_ lo_truncate64 _null_ _null_ _null_ ));
+DESCR("truncate large object (64 bit)");
+
+DATA(insert OID = 3457 (  lo_from_bytea    PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 26 "26 17" _null_ _null_ _null_ _null_ _null_ lo_from_bytea _null_ _null_ _null_ ));
+DESCR("create new large object with given content");
+DATA(insert OID = 3458 (  lo_get		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 17 "26" _null_ _null_ _null_ _null_ _null_ lo_get _null_ _null_ _null_ ));
+DESCR("read entire large object");
+DATA(insert OID = 3459 (  lo_get		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 17 "26 20 23" _null_ _null_ _null_ _null_ _null_ lo_get_fragment _null_ _null_ _null_ ));
+DESCR("read large object from offset for length");
+DATA(insert OID = 3460 (  lo_put		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2278 "26 20 17" _null_ _null_ _null_ _null_ _null_ lo_put _null_ _null_ _null_ ));
+DESCR("write data at offset");
+
+DATA(insert OID = 959 (  on_pl			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 628" _null_ _null_ _null_ _null_ _null_ on_pl _null_ _null_ _null_ ));
+DATA(insert OID = 960 (  on_sl			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 628" _null_ _null_ _null_ _null_ _null_ on_sl _null_ _null_ _null_ ));
+DATA(insert OID = 961 (  close_pl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "600 628" _null_ _null_ _null_ _null_ _null_	close_pl _null_ _null_ _null_ ));
+DATA(insert OID = 962 (  close_sl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "601 628" _null_ _null_ _null_ _null_ _null_	close_sl _null_ _null_ _null_ ));
+DATA(insert OID = 963 (  close_lb		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "628 603" _null_ _null_ _null_ _null_ _null_	close_lb _null_ _null_ _null_ ));
+
+DATA(insert OID = 964 (  lo_unlink		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 23 "26" _null_ _null_ _null_ _null_ _null_ lo_unlink _null_ _null_ _null_ ));
+DESCR("large object unlink (delete)");
+
+DATA(insert OID = 973 (  path_inter		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "602 602" _null_ _null_ _null_ _null_ _null_ path_inter _null_ _null_ _null_ ));
+DATA(insert OID = 975 (  area			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "603" _null_ _null_ _null_ _null_ _null_	box_area _null_ _null_ _null_ ));
+DESCR("box area");
+DATA(insert OID = 976 (  width			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "603" _null_ _null_ _null_ _null_ _null_	box_width _null_ _null_ _null_ ));
+DESCR("box width");
+DATA(insert OID = 977 (  height			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "603" _null_ _null_ _null_ _null_ _null_	box_height _null_ _null_ _null_ ));
+DESCR("box height");
+DATA(insert OID = 978 (  box_distance	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "603 603" _null_ _null_ _null_ _null_ _null_	box_distance _null_ _null_ _null_ ));
+DATA(insert OID = 979 (  area			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "602" _null_ _null_ _null_ _null_ _null_	path_area _null_ _null_ _null_ ));
+DESCR("area of a closed path");
+DATA(insert OID = 980 (  box_intersect	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 603 "603 603" _null_ _null_ _null_ _null_ _null_	box_intersect _null_ _null_ _null_ ));
+DATA(insert OID = 4067 ( bound_box		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 603 "603 603" _null_ _null_ _null_ _null_ _null_	boxes_bound_box _null_ _null_ _null_ ));
+DESCR("bounding box of two boxes");
+DATA(insert OID = 981 (  diagonal		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 601 "603" _null_ _null_ _null_ _null_ _null_	box_diagonal _null_ _null_ _null_ ));
+DESCR("box diagonal");
+DATA(insert OID = 982 (  path_n_lt		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "602 602" _null_ _null_ _null_ _null_ _null_ path_n_lt _null_ _null_ _null_ ));
+DATA(insert OID = 983 (  path_n_gt		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "602 602" _null_ _null_ _null_ _null_ _null_ path_n_gt _null_ _null_ _null_ ));
+DATA(insert OID = 984 (  path_n_eq		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "602 602" _null_ _null_ _null_ _null_ _null_ path_n_eq _null_ _null_ _null_ ));
+DATA(insert OID = 985 (  path_n_le		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "602 602" _null_ _null_ _null_ _null_ _null_ path_n_le _null_ _null_ _null_ ));
+DATA(insert OID = 986 (  path_n_ge		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "602 602" _null_ _null_ _null_ _null_ _null_ path_n_ge _null_ _null_ _null_ ));
+DATA(insert OID = 987 (  path_length	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "602" _null_ _null_ _null_ _null_ _null_	path_length _null_ _null_ _null_ ));
+DATA(insert OID = 988 (  point_ne		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ _null_ point_ne _null_ _null_ _null_ ));
+DATA(insert OID = 989 (  point_vert		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ _null_ point_vert _null_ _null_ _null_ ));
+DATA(insert OID = 990 (  point_horiz	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ _null_ point_horiz _null_ _null_ _null_ ));
+DATA(insert OID = 991 (  point_distance    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "600 600" _null_ _null_ _null_ _null_ _null_	point_distance _null_ _null_ _null_ ));
+DATA(insert OID = 992 (  slope			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "600 600" _null_ _null_ _null_ _null_ _null_	point_slope _null_ _null_ _null_ ));
+DESCR("slope between points");
+DATA(insert OID = 993 (  lseg			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 601 "600 600" _null_ _null_ _null_ _null_ _null_	lseg_construct _null_ _null_ _null_ ));
+DESCR("convert points to line segment");
+DATA(insert OID = 994 (  lseg_intersect    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_ _null_ lseg_intersect _null_ _null_ _null_ ));
+DATA(insert OID = 995 (  lseg_parallel	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_ _null_ lseg_parallel _null_ _null_ _null_ ));
+DATA(insert OID = 996 (  lseg_perp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_ _null_ lseg_perp _null_ _null_ _null_ ));
+DATA(insert OID = 997 (  lseg_vertical	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "601" _null_ _null_ _null_ _null_ _null_ lseg_vertical _null_ _null_ _null_ ));
+DATA(insert OID = 998 (  lseg_horizontal   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "601" _null_ _null_ _null_ _null_ _null_ lseg_horizontal _null_ _null_ _null_ ));
+DATA(insert OID = 999 (  lseg_eq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_ _null_ lseg_eq _null_ _null_ _null_ ));
+
+/* OIDS 1000 - 1999 */
+
+DATA(insert OID = 3994 (  timestamp_izone_transform PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ timestamp_izone_transform _null_ _null_ _null_ ));
+DESCR("transform a time zone adjustment");
+DATA(insert OID = 1026 (  timezone		   PGNSP PGUID 12 1 0 0 timestamp_izone_transform f f f f t f i 2 0 1114 "1186 1184" _null_ _null_ _null_ _null_ _null_ timestamptz_izone _null_ _null_ _null_ ));
+DESCR("adjust timestamp to new time zone");
+
+DATA(insert OID = 1031 (  aclitemin		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1033 "2275" _null_ _null_ _null_ _null_ _null_ aclitemin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1032 (  aclitemout	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "1033" _null_ _null_ _null_ _null_ _null_ aclitemout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1035 (  aclinsert		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1034 "1034 1033" _null_ _null_ _null_ _null_ _null_ aclinsert _null_ _null_ _null_ ));
+DESCR("add/update ACL item");
+DATA(insert OID = 1036 (  aclremove		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1034 "1034 1033" _null_ _null_ _null_ _null_ _null_ aclremove _null_ _null_ _null_ ));
+DESCR("remove ACL item");
+DATA(insert OID = 1037 (  aclcontains	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1034 1033" _null_ _null_ _null_ _null_ _null_ aclcontains _null_ _null_ _null_ ));
+DESCR("contains");
+DATA(insert OID = 1062 (  aclitemeq		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1033 1033" _null_ _null_ _null_ _null_ _null_ aclitem_eq _null_ _null_ _null_ ));
+DATA(insert OID = 1365 (  makeaclitem	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 1033 "26 26 25 16" _null_ _null_ _null_ _null_ _null_ makeaclitem _null_ _null_ _null_ ));
+DESCR("make ACL item");
+DATA(insert OID = 3943 (  acldefault	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1034 "18 26" _null_ _null_ _null_ _null_  _null_ acldefault_sql _null_ _null_ _null_ ));
+DESCR("TODO");
+DATA(insert OID = 1689 (  aclexplode	PGNSP PGUID 12 1 10 0 0 f f f f t t s 1 0 2249 "1034" "{1034,26,26,25,16}" "{i,o,o,o,o}" "{acl,grantor,grantee,privilege_type,is_grantable}" _null_ _null_ aclexplode _null_ _null_ _null_ ));
+DESCR("convert ACL item array to table, for use by information schema");
+DATA(insert OID = 1044 (  bpcharin		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1042 "2275 26 23" _null_ _null_ _null_ _null_ _null_ bpcharin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1045 (  bpcharout		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "1042" _null_ _null_ _null_ _null_ _null_ bpcharout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2913 (  bpchartypmodin   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ _null_	bpchartypmodin _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 2914 (  bpchartypmodout  PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ _null_	bpchartypmodout _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 1046 (  varcharin		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1043 "2275 26 23" _null_ _null_ _null_ _null_ _null_ varcharin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1047 (  varcharout	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "1043" _null_ _null_ _null_ _null_ _null_ varcharout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2915 (  varchartypmodin  PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ _null_	varchartypmodin _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 2916 (  varchartypmodout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ _null_	varchartypmodout _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 1048 (  bpchareq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ _null_ bpchareq _null_ _null_ _null_ ));
+DATA(insert OID = 1049 (  bpcharlt		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ _null_ bpcharlt _null_ _null_ _null_ ));
+DATA(insert OID = 1050 (  bpcharle		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ _null_ bpcharle _null_ _null_ _null_ ));
+DATA(insert OID = 1051 (  bpchargt		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ _null_ bpchargt _null_ _null_ _null_ ));
+DATA(insert OID = 1052 (  bpcharge		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ _null_ bpcharge _null_ _null_ _null_ ));
+DATA(insert OID = 1053 (  bpcharne		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ _null_ bpcharne _null_ _null_ _null_ ));
+DATA(insert OID = 1063 (  bpchar_larger    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1042 "1042 1042" _null_ _null_ _null_ _null_ _null_ bpchar_larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 1064 (  bpchar_smaller   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1042 "1042 1042" _null_ _null_ _null_ _null_ _null_ bpchar_smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+DATA(insert OID = 1078 (  bpcharcmp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1042 1042" _null_ _null_ _null_ _null_ _null_ bpcharcmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 1080 (  hashbpchar	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ _null_	hashbpchar _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 1081 (  format_type	   PGNSP PGUID 12 1 0 0 0 f f f f f f s 2 0 25 "26 23" _null_ _null_ _null_ _null_ _null_ format_type _null_ _null_ _null_ ));
+DESCR("format a type oid and atttypmod to canonical SQL");
+DATA(insert OID = 1084 (  date_in		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1082 "2275" _null_ _null_ _null_ _null_ _null_ date_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1085 (  date_out		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "1082" _null_ _null_ _null_ _null_ _null_ date_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1086 (  date_eq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1082 1082" _null_ _null_ _null_ _null_ _null_ date_eq _null_ _null_ _null_ ));
+DATA(insert OID = 1087 (  date_lt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1082 1082" _null_ _null_ _null_ _null_ _null_ date_lt _null_ _null_ _null_ ));
+DATA(insert OID = 1088 (  date_le		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1082 1082" _null_ _null_ _null_ _null_ _null_ date_le _null_ _null_ _null_ ));
+DATA(insert OID = 1089 (  date_gt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1082 1082" _null_ _null_ _null_ _null_ _null_ date_gt _null_ _null_ _null_ ));
+DATA(insert OID = 1090 (  date_ge		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1082 1082" _null_ _null_ _null_ _null_ _null_ date_ge _null_ _null_ _null_ ));
+DATA(insert OID = 1091 (  date_ne		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1082 1082" _null_ _null_ _null_ _null_ _null_ date_ne _null_ _null_ _null_ ));
+DATA(insert OID = 1092 (  date_cmp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1082 1082" _null_ _null_ _null_ _null_ _null_ date_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 3136 (  date_sortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ date_sortsupport _null_ _null_ _null_ ));
+DESCR("sort support");
+
+/* OIDS 1100 - 1199 */
+
+DATA(insert OID = 1102 (  time_lt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1083 1083" _null_ _null_ _null_ _null_ _null_ time_lt _null_ _null_ _null_ ));
+DATA(insert OID = 1103 (  time_le		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1083 1083" _null_ _null_ _null_ _null_ _null_ time_le _null_ _null_ _null_ ));
+DATA(insert OID = 1104 (  time_gt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1083 1083" _null_ _null_ _null_ _null_ _null_ time_gt _null_ _null_ _null_ ));
+DATA(insert OID = 1105 (  time_ge		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1083 1083" _null_ _null_ _null_ _null_ _null_ time_ge _null_ _null_ _null_ ));
+DATA(insert OID = 1106 (  time_ne		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1083 1083" _null_ _null_ _null_ _null_ _null_ time_ne _null_ _null_ _null_ ));
+DATA(insert OID = 1107 (  time_cmp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1083 1083" _null_ _null_ _null_ _null_ _null_ time_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 1138 (  date_larger	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1082 "1082 1082" _null_ _null_ _null_ _null_ _null_ date_larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 1139 (  date_smaller	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1082 "1082 1082" _null_ _null_ _null_ _null_ _null_ date_smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+DATA(insert OID = 1140 (  date_mi		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1082 1082" _null_ _null_ _null_ _null_ _null_ date_mi _null_ _null_ _null_ ));
+DATA(insert OID = 1141 (  date_pli		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1082 "1082 23" _null_ _null_ _null_ _null_ _null_ date_pli _null_ _null_ _null_ ));
+DATA(insert OID = 1142 (  date_mii		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1082 "1082 23" _null_ _null_ _null_ _null_ _null_ date_mii _null_ _null_ _null_ ));
+DATA(insert OID = 1143 (  time_in		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 1083 "2275 26 23" _null_ _null_ _null_ _null_ _null_ time_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1144 (  time_out		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "1083" _null_ _null_ _null_ _null_ _null_ time_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2909 (  timetypmodin		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ _null_	timetypmodin _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 2910 (  timetypmodout		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ _null_	timetypmodout _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 1145 (  time_eq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1083 1083" _null_ _null_ _null_ _null_ _null_ time_eq _null_ _null_ _null_ ));
+
+DATA(insert OID = 1146 (  circle_add_pt    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 718 "718 600" _null_ _null_ _null_ _null_ _null_	circle_add_pt _null_ _null_ _null_ ));
+DATA(insert OID = 1147 (  circle_sub_pt    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 718 "718 600" _null_ _null_ _null_ _null_ _null_	circle_sub_pt _null_ _null_ _null_ ));
+DATA(insert OID = 1148 (  circle_mul_pt    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 718 "718 600" _null_ _null_ _null_ _null_ _null_	circle_mul_pt _null_ _null_ _null_ ));
+DATA(insert OID = 1149 (  circle_div_pt    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 718 "718 600" _null_ _null_ _null_ _null_ _null_	circle_div_pt _null_ _null_ _null_ ));
+
+DATA(insert OID = 1150 (  timestamptz_in   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 1184 "2275 26 23" _null_ _null_ _null_ _null_ _null_ timestamptz_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1151 (  timestamptz_out  PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "1184" _null_ _null_ _null_ _null_ _null_ timestamptz_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2907 (  timestamptztypmodin		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ _null_	timestamptztypmodin _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 2908 (  timestamptztypmodout		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ _null_	timestamptztypmodout _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 1152 (  timestamptz_eq   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1184 1184" _null_ _null_ _null_ _null_ _null_ timestamp_eq _null_ _null_ _null_ ));
+DATA(insert OID = 1153 (  timestamptz_ne   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1184 1184" _null_ _null_ _null_ _null_ _null_ timestamp_ne _null_ _null_ _null_ ));
+DATA(insert OID = 1154 (  timestamptz_lt   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1184 1184" _null_ _null_ _null_ _null_ _null_ timestamp_lt _null_ _null_ _null_ ));
+DATA(insert OID = 1155 (  timestamptz_le   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1184 1184" _null_ _null_ _null_ _null_ _null_ timestamp_le _null_ _null_ _null_ ));
+DATA(insert OID = 1156 (  timestamptz_ge   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1184 1184" _null_ _null_ _null_ _null_ _null_ timestamp_ge _null_ _null_ _null_ ));
+DATA(insert OID = 1157 (  timestamptz_gt   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1184 1184" _null_ _null_ _null_ _null_ _null_ timestamp_gt _null_ _null_ _null_ ));
+DATA(insert OID = 1158 (  to_timestamp	   PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 1184 "701" _null_ _null_ _null_ _null_ _null_ "select (''epoch''::pg_catalog.timestamptz + $1 * ''1 second''::pg_catalog.interval)" _null_ _null_ _null_ ));
+DESCR("convert UNIX epoch to timestamptz");
+DATA(insert OID = 3995 (  timestamp_zone_transform PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ timestamp_zone_transform _null_ _null_ _null_ ));
+DESCR("transform a time zone adjustment");
+DATA(insert OID = 1159 (  timezone		   PGNSP PGUID 12 1 0 0 timestamp_zone_transform f f f f t f i 2 0 1114 "25 1184" _null_ _null_ _null_ _null_ _null_	timestamptz_zone _null_ _null_ _null_ ));
+DESCR("adjust timestamp to new time zone");
+
+DATA(insert OID = 1160 (  interval_in	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 1186 "2275 26 23" _null_ _null_ _null_ _null_ _null_ interval_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1161 (  interval_out	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "1186" _null_ _null_ _null_ _null_ _null_ interval_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2903 (  intervaltypmodin		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ _null_	intervaltypmodin _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 2904 (  intervaltypmodout		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ _null_	intervaltypmodout _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 1162 (  interval_eq	   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1186 1186" _null_ _null_ _null_ _null_ _null_ interval_eq _null_ _null_ _null_ ));
+DATA(insert OID = 1163 (  interval_ne	   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1186 1186" _null_ _null_ _null_ _null_ _null_ interval_ne _null_ _null_ _null_ ));
+DATA(insert OID = 1164 (  interval_lt	   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1186 1186" _null_ _null_ _null_ _null_ _null_ interval_lt _null_ _null_ _null_ ));
+DATA(insert OID = 1165 (  interval_le	   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1186 1186" _null_ _null_ _null_ _null_ _null_ interval_le _null_ _null_ _null_ ));
+DATA(insert OID = 1166 (  interval_ge	   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1186 1186" _null_ _null_ _null_ _null_ _null_ interval_ge _null_ _null_ _null_ ));
+DATA(insert OID = 1167 (  interval_gt	   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1186 1186" _null_ _null_ _null_ _null_ _null_ interval_gt _null_ _null_ _null_ ));
+DATA(insert OID = 1168 (  interval_um	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ _null_ interval_um _null_ _null_ _null_ ));
+DATA(insert OID = 1169 (  interval_pl	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1186 1186" _null_ _null_ _null_ _null_ _null_ interval_pl _null_ _null_ _null_ ));
+DATA(insert OID = 1170 (  interval_mi	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1186 1186" _null_ _null_ _null_ _null_ _null_ interval_mi _null_ _null_ _null_ ));
+DATA(insert OID = 1171 (  date_part		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 701 "25 1184" _null_ _null_ _null_ _null_ _null_ timestamptz_part _null_ _null_ _null_ ));
+DESCR("extract field from timestamp with time zone");
+DATA(insert OID = 1172 (  date_part		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "25 1186" _null_ _null_ _null_ _null_ _null_ interval_part _null_ _null_ _null_ ));
+DESCR("extract field from interval");
+DATA(insert OID = 1173 (  timestamptz	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1184 "702" _null_ _null_ _null_ _null_ _null_ abstime_timestamptz _null_ _null_ _null_ ));
+DESCR("convert abstime to timestamp with time zone");
+DATA(insert OID = 1174 (  timestamptz	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "1082" _null_ _null_ _null_ _null_ _null_ date_timestamptz _null_ _null_ _null_ ));
+DESCR("convert date to timestamp with time zone");
+DATA(insert OID = 2711 (  justify_interval PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ _null_ interval_justify_interval _null_ _null_ _null_ ));
+DESCR("promote groups of 24 hours to numbers of days and promote groups of 30 days to numbers of months");
+DATA(insert OID = 1175 (  justify_hours    PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ _null_ interval_justify_hours _null_ _null_ _null_ ));
+DESCR("promote groups of 24 hours to numbers of days");
+DATA(insert OID = 1295 (  justify_days	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ _null_ interval_justify_days _null_ _null_ _null_ ));
+DESCR("promote groups of 30 days to numbers of months");
+DATA(insert OID = 1176 (  timestamptz	   PGNSP PGUID 14 1 0 0 0 f f f f t f s 2 0 1184 "1082 1083" _null_ _null_ _null_ _null_ _null_ "select cast(($1 + $2) as timestamp with time zone)" _null_ _null_ _null_ ));
+DESCR("convert date and time to timestamp with time zone");
+DATA(insert OID = 1177 (  interval		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1186 "703" _null_ _null_ _null_ _null_ _null_ reltime_interval _null_ _null_ _null_ ));
+DESCR("convert reltime to interval");
+DATA(insert OID = 1178 (  date			   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1082 "1184" _null_ _null_ _null_ _null_ _null_ timestamptz_date _null_ _null_ _null_ ));
+DESCR("convert timestamp with time zone to date");
+DATA(insert OID = 1179 (  date			   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1082 "702" _null_ _null_ _null_ _null_ _null_ abstime_date _null_ _null_ _null_ ));
+DESCR("convert abstime to date");
+DATA(insert OID = 1180 (  abstime		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 702 "1184" _null_ _null_ _null_ _null_ _null_	timestamptz_abstime _null_ _null_ _null_ ));
+DESCR("convert timestamp with time zone to abstime");
+DATA(insert OID = 1181 (  age			   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 23 "28" _null_ _null_ _null_ _null_ _null_ xid_age _null_ _null_ _null_ ));
+DESCR("age of a transaction ID, in transactions before current transaction");
+DATA(insert OID = 3939 (  mxid_age		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 23 "28" _null_ _null_ _null_ _null_ _null_ mxid_age _null_ _null_ _null_ ));
+DESCR("age of a multi-transaction ID, in multi-transactions before current multi-transaction");
+
+DATA(insert OID = 1188 (  timestamptz_mi   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1184 1184" _null_ _null_ _null_ _null_ _null_ timestamp_mi _null_ _null_ _null_ ));
+DATA(insert OID = 1189 (  timestamptz_pl_interval PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 1184 "1184 1186" _null_ _null_ _null_ _null_ _null_ timestamptz_pl_interval _null_ _null_ _null_ ));
+DATA(insert OID = 1190 (  timestamptz_mi_interval PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 1184 "1184 1186" _null_ _null_ _null_ _null_ _null_ timestamptz_mi_interval _null_ _null_ _null_ ));
+DATA(insert OID = 1194 (  reltime			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 703 "1186" _null_ _null_ _null_ _null_ _null_ interval_reltime _null_ _null_ _null_ ));
+DESCR("convert interval to reltime");
+DATA(insert OID = 1195 (  timestamptz_smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1184 "1184 1184" _null_ _null_ _null_ _null_ _null_ timestamp_smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+DATA(insert OID = 1196 (  timestamptz_larger  PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1184 "1184 1184" _null_ _null_ _null_ _null_ _null_ timestamp_larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 1197 (  interval_smaller	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1186 1186" _null_ _null_ _null_ _null_ _null_	interval_smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+DATA(insert OID = 1198 (  interval_larger	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1186 1186" _null_ _null_ _null_ _null_ _null_	interval_larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 1199 (  age				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1184 1184" _null_ _null_ _null_ _null_ _null_	timestamptz_age _null_ _null_ _null_ ));
+DESCR("date difference preserving months and years");
+
+/* OIDS 1200 - 1299 */
+
+DATA(insert OID = 3918 (  interval_transform PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ interval_transform _null_ _null_ _null_ ));
+DESCR("transform an interval length coercion");
+DATA(insert OID = 1200 (  interval			PGNSP PGUID 12 1 0 0 interval_transform f f f f t f i 2 0 1186 "1186 23" _null_ _null_ _null_ _null_ _null_ interval_scale _null_ _null_ _null_ ));
+DESCR("adjust interval precision");
+
+DATA(insert OID = 1215 (  obj_description	PGNSP PGUID 14 100 0 0 0 f f f f t f s 2 0 25 "26 19" _null_ _null_ _null_ _null_ _null_ "select description from pg_catalog.pg_description where objoid = $1 and classoid = (select oid from pg_catalog.pg_class where relname = $2 and relnamespace = PGNSP) and objsubid = 0" _null_ _null_ _null_ ));
+DESCR("get description for object id and catalog name");
+DATA(insert OID = 1216 (  col_description	PGNSP PGUID 14 100 0 0 0 f f f f t f s 2 0 25 "26 23" _null_ _null_ _null_ _null_ _null_ "select description from pg_catalog.pg_description where objoid = $1 and classoid = ''pg_catalog.pg_class''::pg_catalog.regclass and objsubid = $2" _null_ _null_ _null_ ));
+DESCR("get description for table column");
+DATA(insert OID = 1993 ( shobj_description	PGNSP PGUID 14 100 0 0 0 f f f f t f s 2 0 25 "26 19" _null_ _null_ _null_ _null_ _null_ "select description from pg_catalog.pg_shdescription where objoid = $1 and classoid = (select oid from pg_catalog.pg_class where relname = $2 and relnamespace = PGNSP)" _null_ _null_ _null_ ));
+DESCR("get description for object id and shared catalog name");
+
+DATA(insert OID = 1217 (  date_trunc	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 1184 "25 1184" _null_ _null_ _null_ _null_ _null_ timestamptz_trunc _null_ _null_ _null_ ));
+DESCR("truncate timestamp with time zone to specified units");
+DATA(insert OID = 1218 (  date_trunc	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "25 1186" _null_ _null_ _null_ _null_ _null_ interval_trunc _null_ _null_ _null_ ));
+DESCR("truncate interval to specified units");
+
+DATA(insert OID = 1219 (  int8inc		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ _null_ int8inc _null_ _null_ _null_ ));
+DESCR("increment");
+DATA(insert OID = 3546 (  int8dec		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ _null_ int8dec _null_ _null_ _null_ ));
+DESCR("decrement");
+DATA(insert OID = 2804 (  int8inc_any	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 2276" _null_ _null_ _null_ _null_ _null_ int8inc_any _null_ _null_ _null_ ));
+DESCR("increment, ignores second argument");
+DATA(insert OID = 3547 (  int8dec_any	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 2276" _null_ _null_ _null_ _null_ _null_ int8dec_any _null_ _null_ _null_ ));
+DESCR("decrement, ignores second argument");
+DATA(insert OID = 1230 (  int8abs		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ _null_ int8abs _null_ _null_ _null_ ));
+
+DATA(insert OID = 1236 (  int8larger	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ _null_ int8larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 1237 (  int8smaller	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ _null_ int8smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+
+DATA(insert OID = 1238 (  texticregexeq    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ texticregexeq _null_ _null_ _null_ ));
+DATA(insert OID = 1239 (  texticregexne    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ texticregexne _null_ _null_ _null_ ));
+DATA(insert OID = 1240 (  nameicregexeq    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ _null_ nameicregexeq _null_ _null_ _null_ ));
+DATA(insert OID = 1241 (  nameicregexne    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ _null_ nameicregexne _null_ _null_ _null_ ));
+
+DATA(insert OID = 1251 (  int4abs		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ int4abs _null_ _null_ _null_ ));
+DATA(insert OID = 1253 (  int2abs		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ _null_ int2abs _null_ _null_ _null_ ));
+
+DATA(insert OID = 1271 (  overlaps		   PGNSP PGUID 12 1 0 0 0 f f f f f f i 4 0 16 "1266 1266 1266 1266" _null_ _null_ _null_ _null_ _null_ overlaps_timetz _null_ _null_ _null_ ));
+DESCR("intervals overlap?");
+DATA(insert OID = 1272 (  datetime_pl	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1082 1083" _null_ _null_ _null_ _null_ _null_ datetime_timestamp _null_ _null_ _null_ ));
+DATA(insert OID = 1273 (  date_part		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "25 1266" _null_ _null_ _null_ _null_ _null_ timetz_part _null_ _null_ _null_ ));
+DESCR("extract field from time with time zone");
+DATA(insert OID = 1274 (  int84pl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 23" _null_ _null_ _null_ _null_ _null_ int84pl _null_ _null_ _null_ ));
+DATA(insert OID = 1275 (  int84mi		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 23" _null_ _null_ _null_ _null_ _null_ int84mi _null_ _null_ _null_ ));
+DATA(insert OID = 1276 (  int84mul		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 23" _null_ _null_ _null_ _null_ _null_ int84mul _null_ _null_ _null_ ));
+DATA(insert OID = 1277 (  int84div		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 23" _null_ _null_ _null_ _null_ _null_ int84div _null_ _null_ _null_ ));
+DATA(insert OID = 1278 (  int48pl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "23 20" _null_ _null_ _null_ _null_ _null_ int48pl _null_ _null_ _null_ ));
+DATA(insert OID = 1279 (  int48mi		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "23 20" _null_ _null_ _null_ _null_ _null_ int48mi _null_ _null_ _null_ ));
+DATA(insert OID = 1280 (  int48mul		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "23 20" _null_ _null_ _null_ _null_ _null_ int48mul _null_ _null_ _null_ ));
+DATA(insert OID = 1281 (  int48div		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "23 20" _null_ _null_ _null_ _null_ _null_ int48div _null_ _null_ _null_ ));
+
+DATA(insert OID =  837 (  int82pl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 21" _null_ _null_ _null_ _null_ _null_ int82pl _null_ _null_ _null_ ));
+DATA(insert OID =  838 (  int82mi		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 21" _null_ _null_ _null_ _null_ _null_ int82mi _null_ _null_ _null_ ));
+DATA(insert OID =  839 (  int82mul		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 21" _null_ _null_ _null_ _null_ _null_ int82mul _null_ _null_ _null_ ));
+DATA(insert OID =  840 (  int82div		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 21" _null_ _null_ _null_ _null_ _null_ int82div _null_ _null_ _null_ ));
+DATA(insert OID =  841 (  int28pl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "21 20" _null_ _null_ _null_ _null_ _null_ int28pl _null_ _null_ _null_ ));
+DATA(insert OID =  942 (  int28mi		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "21 20" _null_ _null_ _null_ _null_ _null_ int28mi _null_ _null_ _null_ ));
+DATA(insert OID =  943 (  int28mul		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "21 20" _null_ _null_ _null_ _null_ _null_ int28mul _null_ _null_ _null_ ));
+DATA(insert OID =  948 (  int28div		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "21 20" _null_ _null_ _null_ _null_ _null_ int28div _null_ _null_ _null_ ));
+
+DATA(insert OID = 1287 (  oid			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 26 "20" _null_ _null_ _null_ _null_ _null_ i8tooid _null_ _null_ _null_ ));
+DESCR("convert int8 to oid");
+DATA(insert OID = 1288 (  int8			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ oidtoi8 _null_ _null_ _null_ ));
+DESCR("convert oid to int8");
+
+DATA(insert OID = 1291 (  suppress_redundant_updates_trigger	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ suppress_redundant_updates_trigger _null_ _null_ _null_ ));
+DESCR("trigger to suppress updates when new and old records match");
+
+DATA(insert OID = 1292 ( tideq			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "27 27" _null_ _null_ _null_ _null_ _null_ tideq _null_ _null_ _null_ ));
+DATA(insert OID = 1293 ( currtid		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 27 "26 27" _null_ _null_ _null_ _null_ _null_ currtid_byreloid _null_ _null_ _null_ ));
+DESCR("latest tid of a tuple");
+DATA(insert OID = 1294 ( currtid2		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 27 "25 27" _null_ _null_ _null_ _null_ _null_ currtid_byrelname _null_ _null_ _null_ ));
+DESCR("latest tid of a tuple");
+DATA(insert OID = 1265 ( tidne			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "27 27" _null_ _null_ _null_ _null_ _null_ tidne _null_ _null_ _null_ ));
+DATA(insert OID = 2790 ( tidgt			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "27 27" _null_ _null_ _null_ _null_ _null_ tidgt _null_ _null_ _null_ ));
+DATA(insert OID = 2791 ( tidlt			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "27 27" _null_ _null_ _null_ _null_ _null_ tidlt _null_ _null_ _null_ ));
+DATA(insert OID = 2792 ( tidge			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "27 27" _null_ _null_ _null_ _null_ _null_ tidge _null_ _null_ _null_ ));
+DATA(insert OID = 2793 ( tidle			   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "27 27" _null_ _null_ _null_ _null_ _null_ tidle _null_ _null_ _null_ ));
+DATA(insert OID = 2794 ( bttidcmp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "27 27" _null_ _null_ _null_ _null_ _null_ bttidcmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 2795 ( tidlarger		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 27 "27 27" _null_ _null_ _null_ _null_ _null_ tidlarger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 2796 ( tidsmaller		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 27 "27 27" _null_ _null_ _null_ _null_ _null_ tidsmaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+
+DATA(insert OID = 1296 (  timedate_pl	   PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 1114 "1083 1082" _null_ _null_ _null_ _null_ _null_ "select ($2 + $1)" _null_ _null_ _null_ ));
+DATA(insert OID = 1297 (  datetimetz_pl    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1184 "1082 1266" _null_ _null_ _null_ _null_ _null_ datetimetz_timestamptz _null_ _null_ _null_ ));
+DATA(insert OID = 1298 (  timetzdate_pl    PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 1184 "1266 1082" _null_ _null_ _null_ _null_ _null_ "select ($2 + $1)" _null_ _null_ _null_ ));
+DATA(insert OID = 1299 (  now			   PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ _null_ now _null_ _null_ _null_ ));
+DESCR("current transaction time");
+DATA(insert OID = 2647 (  transaction_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ _null_ now _null_ _null_ _null_ ));
+DESCR("current transaction time");
+DATA(insert OID = 2648 (  statement_timestamp	PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ _null_ statement_timestamp _null_ _null_ _null_ ));
+DESCR("current statement time");
+DATA(insert OID = 2649 (  clock_timestamp	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 1184 "" _null_ _null_ _null_ _null_ _null_ clock_timestamp _null_ _null_ _null_ ));
+DESCR("current clock time");
+
+/* OIDS 1300 - 1399 */
+
+DATA(insert OID = 1300 (  positionsel		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_	positionsel _null_ _null_ _null_ ));
+DESCR("restriction selectivity for position-comparison operators");
+DATA(insert OID = 1301 (  positionjoinsel	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ _null_	positionjoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity for position-comparison operators");
+DATA(insert OID = 1302 (  contsel		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_	contsel _null_ _null_ _null_ ));
+DESCR("restriction selectivity for containment comparison operators");
+DATA(insert OID = 1303 (  contjoinsel	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ _null_	contjoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity for containment comparison operators");
+
+DATA(insert OID = 1304 ( overlaps			 PGNSP PGUID 12 1 0 0 0 f f f f f f i 4 0 16 "1184 1184 1184 1184" _null_ _null_ _null_ _null_ _null_ overlaps_timestamp _null_ _null_ _null_ ));
+DESCR("intervals overlap?");
+DATA(insert OID = 1305 ( overlaps			 PGNSP PGUID 14 1 0 0 0 f f f f f f s 4 0 16 "1184 1186 1184 1186" _null_ _null_ _null_ _null_ _null_ "select ($1, ($1 + $2)) overlaps ($3, ($3 + $4))" _null_ _null_ _null_ ));
+DESCR("intervals overlap?");
+DATA(insert OID = 1306 ( overlaps			 PGNSP PGUID 14 1 0 0 0 f f f f f f s 4 0 16 "1184 1184 1184 1186" _null_ _null_ _null_ _null_ _null_ "select ($1, $2) overlaps ($3, ($3 + $4))" _null_ _null_ _null_ ));
+DESCR("intervals overlap?");
+DATA(insert OID = 1307 ( overlaps			 PGNSP PGUID 14 1 0 0 0 f f f f f f s 4 0 16 "1184 1186 1184 1184" _null_ _null_ _null_ _null_ _null_ "select ($1, ($1 + $2)) overlaps ($3, $4)" _null_ _null_ _null_ ));
+DESCR("intervals overlap?");
+
+DATA(insert OID = 1308 ( overlaps			 PGNSP PGUID 12 1 0 0 0 f f f f f f i 4 0 16 "1083 1083 1083 1083" _null_ _null_ _null_ _null_ _null_ overlaps_time _null_ _null_ _null_ ));
+DESCR("intervals overlap?");
+DATA(insert OID = 1309 ( overlaps			 PGNSP PGUID 14 1 0 0 0 f f f f f f i 4 0 16 "1083 1186 1083 1186" _null_ _null_ _null_ _null_ _null_ "select ($1, ($1 + $2)) overlaps ($3, ($3 + $4))" _null_ _null_ _null_ ));
+DESCR("intervals overlap?");
+DATA(insert OID = 1310 ( overlaps			 PGNSP PGUID 14 1 0 0 0 f f f f f f i 4 0 16 "1083 1083 1083 1186" _null_ _null_ _null_ _null_ _null_ "select ($1, $2) overlaps ($3, ($3 + $4))" _null_ _null_ _null_ ));
+DESCR("intervals overlap?");
+DATA(insert OID = 1311 ( overlaps			 PGNSP PGUID 14 1 0 0 0 f f f f f f i 4 0 16 "1083 1186 1083 1083" _null_ _null_ _null_ _null_ _null_ "select ($1, ($1 + $2)) overlaps ($3, $4)" _null_ _null_ _null_ ));
+DESCR("intervals overlap?");
+
+DATA(insert OID = 1312 (  timestamp_in		 PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 1114 "2275 26 23" _null_ _null_ _null_ _null_ _null_ timestamp_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1313 (  timestamp_out		 PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "1114" _null_ _null_ _null_ _null_ _null_ timestamp_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2905 (  timestamptypmodin		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ _null_	timestamptypmodin _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 2906 (  timestamptypmodout	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ _null_	timestamptypmodout _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 1314 (  timestamptz_cmp	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1184 1184" _null_ _null_ _null_ _null_ _null_ timestamp_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 1315 (  interval_cmp		 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1186 1186" _null_ _null_ _null_ _null_ _null_ interval_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 1316 (  time				 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1083 "1114" _null_ _null_ _null_ _null_ _null_	timestamp_time _null_ _null_ _null_ ));
+DESCR("convert timestamp to time");
+
+DATA(insert OID = 1317 (  length			 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ _null_	textlen _null_ _null_ _null_ ));
+DESCR("length");
+DATA(insert OID = 1318 (  length			 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ _null_ bpcharlen _null_ _null_ _null_ ));
+DESCR("character length");
+
+DATA(insert OID = 1319 (  xideqint4			 PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "28 23" _null_ _null_ _null_ _null_ _null_ xideq _null_ _null_ _null_ ));
+
+DATA(insert OID = 1326 (  interval_div		 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1186 701" _null_ _null_ _null_ _null_ _null_	interval_div _null_ _null_ _null_ ));
+
+DATA(insert OID = 1339 (  dlog10			 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ dlog10 _null_ _null_ _null_ ));
+DESCR("base 10 logarithm");
+DATA(insert OID = 1340 (  log				 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ dlog10 _null_ _null_ _null_ ));
+DESCR("base 10 logarithm");
+DATA(insert OID = 1341 (  ln				 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ dlog1 _null_ _null_ _null_ ));
+DESCR("natural logarithm");
+DATA(insert OID = 1342 (  round				 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ dround _null_ _null_ _null_ ));
+DESCR("round to nearest integer");
+DATA(insert OID = 1343 (  trunc				 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ dtrunc _null_ _null_ _null_ ));
+DESCR("truncate to integer");
+DATA(insert OID = 1344 (  sqrt				 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ dsqrt _null_ _null_ _null_ ));
+DESCR("square root");
+DATA(insert OID = 1345 (  cbrt				 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ dcbrt _null_ _null_ _null_ ));
+DESCR("cube root");
+DATA(insert OID = 1346 (  pow				 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_ dpow _null_ _null_ _null_ ));
+DESCR("exponentiation");
+DATA(insert OID = 1368 (  power				 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_ dpow _null_ _null_ _null_ ));
+DESCR("exponentiation");
+DATA(insert OID = 1347 (  exp				 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ dexp _null_ _null_ _null_ ));
+DESCR("natural exponential (e^x)");
+
+/*
+ * This form of obj_description is now deprecated, since it will fail if
+ * OIDs are not unique across system catalogs.  Use the other form instead.
+ */
+DATA(insert OID = 1348 (  obj_description	 PGNSP PGUID 14 100 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ _null_ "select description from pg_catalog.pg_description where objoid = $1 and objsubid = 0" _null_ _null_ _null_ ));
+DESCR("deprecated, use two-argument form instead");
+DATA(insert OID = 1349 (  oidvectortypes	 PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "30" _null_ _null_ _null_ _null_ _null_	oidvectortypes _null_ _null_ _null_ ));
+DESCR("print type names of oidvector field");
+
+
+DATA(insert OID = 1350 (  timetz_in		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 1266 "2275 26 23" _null_ _null_ _null_ _null_ _null_ timetz_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1351 (  timetz_out	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "1266" _null_ _null_ _null_ _null_ _null_ timetz_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2911 (  timetztypmodin	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ _null_	timetztypmodin _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 2912 (  timetztypmodout	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ _null_	timetztypmodout _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 1352 (  timetz_eq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1266 1266" _null_ _null_ _null_ _null_ _null_ timetz_eq _null_ _null_ _null_ ));
+DATA(insert OID = 1353 (  timetz_ne		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1266 1266" _null_ _null_ _null_ _null_ _null_ timetz_ne _null_ _null_ _null_ ));
+DATA(insert OID = 1354 (  timetz_lt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1266 1266" _null_ _null_ _null_ _null_ _null_ timetz_lt _null_ _null_ _null_ ));
+DATA(insert OID = 1355 (  timetz_le		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1266 1266" _null_ _null_ _null_ _null_ _null_ timetz_le _null_ _null_ _null_ ));
+DATA(insert OID = 1356 (  timetz_ge		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1266 1266" _null_ _null_ _null_ _null_ _null_ timetz_ge _null_ _null_ _null_ ));
+DATA(insert OID = 1357 (  timetz_gt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1266 1266" _null_ _null_ _null_ _null_ _null_ timetz_gt _null_ _null_ _null_ ));
+DATA(insert OID = 1358 (  timetz_cmp	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1266 1266" _null_ _null_ _null_ _null_ _null_ timetz_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 1359 (  timestamptz	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1184 "1082 1266" _null_ _null_ _null_ _null_ _null_ datetimetz_timestamptz _null_ _null_ _null_ ));
+DESCR("convert date and time with time zone to timestamp with time zone");
+
+DATA(insert OID = 1364 (  time			   PGNSP PGUID 14 1 0 0 0 f f f f t f s 1 0 1083 "702" _null_ _null_ _null_ _null_ _null_ "select cast(cast($1 as timestamp without time zone) as pg_catalog.time)" _null_ _null_ _null_ ));
+DESCR("convert abstime to time");
+
+DATA(insert OID = 1367 (  character_length	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ _null_	bpcharlen _null_ _null_ _null_ ));
+DESCR("character length");
+DATA(insert OID = 1369 (  character_length	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ _null_ textlen _null_ _null_ _null_ ));
+DESCR("character length");
+
+DATA(insert OID = 1370 (  interval			 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1186 "1083" _null_ _null_ _null_ _null_ _null_	time_interval _null_ _null_ _null_ ));
+DESCR("convert time to interval");
+DATA(insert OID = 1372 (  char_length		 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ _null_ bpcharlen _null_ _null_ _null_ ));
+DESCR("character length");
+DATA(insert OID = 1374 (  octet_length			 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ _null_	textoctetlen _null_ _null_ _null_ ));
+DESCR("octet length");
+DATA(insert OID = 1375 (  octet_length			 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ _null_ bpcharoctetlen _null_ _null_ _null_ ));
+DESCR("octet length");
+
+DATA(insert OID = 1377 (  time_larger	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1083 "1083 1083" _null_ _null_ _null_ _null_ _null_ time_larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 1378 (  time_smaller	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1083 "1083 1083" _null_ _null_ _null_ _null_ _null_ time_smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+DATA(insert OID = 1379 (  timetz_larger    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1266 "1266 1266" _null_ _null_ _null_ _null_ _null_ timetz_larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 1380 (  timetz_smaller   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1266 "1266 1266" _null_ _null_ _null_ _null_ _null_ timetz_smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+
+DATA(insert OID = 1381 (  char_length	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ _null_ textlen _null_ _null_ _null_ ));
+DESCR("character length");
+
+DATA(insert OID = 1382 (  date_part    PGNSP PGUID 14 1 0 0 0 f f f f t f s 2 0 701 "25 702" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.date_part($1, cast($2 as timestamp with time zone))" _null_ _null_ _null_ ));
+DESCR("extract field from abstime");
+DATA(insert OID = 1383 (  date_part    PGNSP PGUID 14 1 0 0 0 f f f f t f s 2 0 701 "25 703" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.date_part($1, cast($2 as pg_catalog.interval))" _null_ _null_ _null_ ));
+DESCR("extract field from reltime");
+DATA(insert OID = 1384 (  date_part    PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 701 "25 1082" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.date_part($1, cast($2 as timestamp without time zone))" _null_ _null_ _null_ ));
+DESCR("extract field from date");
+DATA(insert OID = 1385 (  date_part    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "25 1083" _null_ _null_ _null_ _null_  _null_ time_part _null_ _null_ _null_ ));
+DESCR("extract field from time");
+DATA(insert OID = 1386 (  age		   PGNSP PGUID 14 1 0 0 0 f f f f t f s 1 0 1186 "1184" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.age(cast(current_date as timestamp with time zone), $1)" _null_ _null_ _null_ ));
+DESCR("date difference from today preserving months and years");
+
+DATA(insert OID = 1388 (  timetz	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1266 "1184" _null_ _null_ _null_ _null_ _null_ timestamptz_timetz _null_ _null_ _null_ ));
+DESCR("convert timestamp with time zone to time with time zone");
+
+DATA(insert OID = 1373 (  isfinite	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "1082" _null_ _null_ _null_ _null_ _null_	date_finite _null_ _null_ _null_ ));
+DESCR("finite date?");
+DATA(insert OID = 1389 (  isfinite	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "1184" _null_ _null_ _null_ _null_ _null_	timestamp_finite _null_ _null_ _null_ ));
+DESCR("finite timestamp?");
+DATA(insert OID = 1390 (  isfinite	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "1186" _null_ _null_ _null_ _null_ _null_	interval_finite _null_ _null_ _null_ ));
+DESCR("finite interval?");
+
+
+DATA(insert OID = 1376 (  factorial		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "20" _null_ _null_ _null_ _null_ _null_	numeric_fac _null_ _null_ _null_ ));
+DESCR("factorial");
+DATA(insert OID = 1394 (  abs			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "700" _null_ _null_ _null_ _null_ _null_	float4abs _null_ _null_ _null_ ));
+DESCR("absolute value");
+DATA(insert OID = 1395 (  abs			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	float8abs _null_ _null_ _null_ ));
+DESCR("absolute value");
+DATA(insert OID = 1396 (  abs			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ _null_ int8abs _null_ _null_ _null_ ));
+DESCR("absolute value");
+DATA(insert OID = 1397 (  abs			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ int4abs _null_ _null_ _null_ ));
+DESCR("absolute value");
+DATA(insert OID = 1398 (  abs			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ _null_ int2abs _null_ _null_ _null_ ));
+DESCR("absolute value");
+
+/* OIDS 1400 - 1499 */
+
+DATA(insert OID = 1400 (  name		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 19 "1043" _null_ _null_ _null_ _null_ _null_	text_name _null_ _null_ _null_ ));
+DESCR("convert varchar to name");
+DATA(insert OID = 1401 (  varchar	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1043 "19" _null_ _null_ _null_ _null_ _null_	name_text _null_ _null_ _null_ ));
+DESCR("convert name to varchar");
+
+DATA(insert OID = 1402 (  current_schema	PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ _null_ current_schema _null_ _null_ _null_ ));
+DESCR("current schema name");
+DATA(insert OID = 1403 (  current_schemas	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1003 "16" _null_ _null_ _null_ _null_ _null_	current_schemas _null_ _null_ _null_ ));
+DESCR("current schema search list");
+
+DATA(insert OID = 1404 (  overlay			PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 25 "25 25 23 23" _null_ _null_ _null_ _null_ _null_	textoverlay _null_ _null_ _null_ ));
+DESCR("substitute portion of string");
+DATA(insert OID = 1405 (  overlay			PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 25 23" _null_ _null_ _null_ _null_ _null_	textoverlay_no_len _null_ _null_ _null_ ));
+DESCR("substitute portion of string");
+
+DATA(insert OID = 1406 (  isvertical		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_  _null_ point_vert _null_ _null_ _null_ ));
+DESCR("vertically aligned");
+DATA(insert OID = 1407 (  ishorizontal		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_  _null_ point_horiz _null_ _null_ _null_ ));
+DESCR("horizontally aligned");
+DATA(insert OID = 1408 (  isparallel		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_  _null_ lseg_parallel _null_ _null_ _null_ ));
+DESCR("parallel");
+DATA(insert OID = 1409 (  isperp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_  _null_ lseg_perp _null_ _null_ _null_ ));
+DESCR("perpendicular");
+DATA(insert OID = 1410 (  isvertical		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "601" _null_ _null_ _null_ _null_  _null_ lseg_vertical _null_ _null_ _null_ ));
+DESCR("vertical");
+DATA(insert OID = 1411 (  ishorizontal		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "601" _null_ _null_ _null_ _null_  _null_ lseg_horizontal _null_ _null_ _null_ ));
+DESCR("horizontal");
+DATA(insert OID = 1412 (  isparallel		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "628 628" _null_ _null_ _null_ _null_  _null_ line_parallel _null_ _null_ _null_ ));
+DESCR("parallel");
+DATA(insert OID = 1413 (  isperp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "628 628" _null_ _null_ _null_ _null_  _null_ line_perp _null_ _null_ _null_ ));
+DESCR("perpendicular");
+DATA(insert OID = 1414 (  isvertical		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "628" _null_ _null_ _null_ _null_  _null_ line_vertical _null_ _null_ _null_ ));
+DESCR("vertical");
+DATA(insert OID = 1415 (  ishorizontal		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "628" _null_ _null_ _null_ _null_  _null_ line_horizontal _null_ _null_ _null_ ));
+DESCR("horizontal");
+DATA(insert OID = 1416 (  point				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "718" _null_ _null_ _null_ _null_ _null_ circle_center _null_ _null_ _null_ ));
+DESCR("center of");
+
+DATA(insert OID = 1419 (  time				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1083 "1186" _null_ _null_ _null_ _null_ _null_ interval_time _null_ _null_ _null_ ));
+DESCR("convert interval to time");
+
+DATA(insert OID = 1421 (  box				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 603 "600 600" _null_ _null_ _null_ _null_ _null_ points_box _null_ _null_ _null_ ));
+DESCR("convert points to box");
+DATA(insert OID = 1422 (  box_add			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 603 "603 600" _null_ _null_ _null_ _null_ _null_ box_add _null_ _null_ _null_ ));
+DATA(insert OID = 1423 (  box_sub			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 603 "603 600" _null_ _null_ _null_ _null_ _null_ box_sub _null_ _null_ _null_ ));
+DATA(insert OID = 1424 (  box_mul			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 603 "603 600" _null_ _null_ _null_ _null_ _null_ box_mul _null_ _null_ _null_ ));
+DATA(insert OID = 1425 (  box_div			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 603 "603 600" _null_ _null_ _null_ _null_ _null_ box_div _null_ _null_ _null_ ));
+DATA(insert OID = 1426 (  path_contain_pt	PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 16 "602 600" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.on_ppath($2, $1)" _null_ _null_ _null_ ));
+DATA(insert OID = 1428 (  poly_contain_pt	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 600" _null_ _null_ _null_ _null_  _null_ poly_contain_pt _null_ _null_ _null_ ));
+DATA(insert OID = 1429 (  pt_contained_poly PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 604" _null_ _null_ _null_ _null_  _null_ pt_contained_poly _null_ _null_ _null_ ));
+
+DATA(insert OID = 1430 (  isclosed			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "602" _null_ _null_ _null_ _null_  _null_ path_isclosed _null_ _null_ _null_ ));
+DESCR("path closed?");
+DATA(insert OID = 1431 (  isopen			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "602" _null_ _null_ _null_ _null_  _null_ path_isopen _null_ _null_ _null_ ));
+DESCR("path open?");
+DATA(insert OID = 1432 (  path_npoints		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "602" _null_ _null_ _null_ _null_  _null_ path_npoints _null_ _null_ _null_ ));
+
+/* pclose and popen might better be named close and open, but that crashes initdb.
+ * - thomas 97/04/20
+ */
+
+DATA(insert OID = 1433 (  pclose			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 602 "602" _null_ _null_ _null_ _null_ _null_ path_close _null_ _null_ _null_ ));
+DESCR("close path");
+DATA(insert OID = 1434 (  popen				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 602 "602" _null_ _null_ _null_ _null_ _null_ path_open _null_ _null_ _null_ ));
+DESCR("open path");
+DATA(insert OID = 1435 (  path_add			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 602 "602 602" _null_ _null_ _null_ _null_ _null_ path_add _null_ _null_ _null_ ));
+DATA(insert OID = 1436 (  path_add_pt		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 602 "602 600" _null_ _null_ _null_ _null_ _null_ path_add_pt _null_ _null_ _null_ ));
+DATA(insert OID = 1437 (  path_sub_pt		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 602 "602 600" _null_ _null_ _null_ _null_ _null_ path_sub_pt _null_ _null_ _null_ ));
+DATA(insert OID = 1438 (  path_mul_pt		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 602 "602 600" _null_ _null_ _null_ _null_ _null_ path_mul_pt _null_ _null_ _null_ ));
+DATA(insert OID = 1439 (  path_div_pt		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 602 "602 600" _null_ _null_ _null_ _null_ _null_ path_div_pt _null_ _null_ _null_ ));
+
+DATA(insert OID = 1440 (  point				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "701 701" _null_ _null_ _null_ _null_ _null_ construct_point _null_ _null_ _null_ ));
+DESCR("convert x, y to point");
+DATA(insert OID = 1441 (  point_add			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "600 600" _null_ _null_ _null_ _null_ _null_ point_add _null_ _null_ _null_ ));
+DATA(insert OID = 1442 (  point_sub			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "600 600" _null_ _null_ _null_ _null_ _null_ point_sub _null_ _null_ _null_ ));
+DATA(insert OID = 1443 (  point_mul			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "600 600" _null_ _null_ _null_ _null_ _null_ point_mul _null_ _null_ _null_ ));
+DATA(insert OID = 1444 (  point_div			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "600 600" _null_ _null_ _null_ _null_ _null_ point_div _null_ _null_ _null_ ));
+
+DATA(insert OID = 1445 (  poly_npoints		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "604" _null_ _null_ _null_ _null_  _null_ poly_npoints _null_ _null_ _null_ ));
+DATA(insert OID = 1446 (  box				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 603 "604" _null_ _null_ _null_ _null_ _null_ poly_box _null_ _null_ _null_ ));
+DESCR("convert polygon to bounding box");
+DATA(insert OID = 1447 (  path				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 602 "604" _null_ _null_ _null_ _null_ _null_ poly_path _null_ _null_ _null_ ));
+DESCR("convert polygon to path");
+DATA(insert OID = 1448 (  polygon			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 604 "603" _null_ _null_ _null_ _null_ _null_ box_poly _null_ _null_ _null_ ));
+DESCR("convert box to polygon");
+DATA(insert OID = 1449 (  polygon			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 604 "602" _null_ _null_ _null_ _null_ _null_ path_poly _null_ _null_ _null_ ));
+DESCR("convert path to polygon");
+
+DATA(insert OID = 1450 (  circle_in			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 718 "2275" _null_ _null_ _null_ _null_ _null_ circle_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1451 (  circle_out		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "718" _null_ _null_ _null_ _null_ _null_ circle_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1452 (  circle_same		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_same _null_ _null_ _null_ ));
+DATA(insert OID = 1453 (  circle_contain	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_contain _null_ _null_ _null_ ));
+DATA(insert OID = 1454 (  circle_left		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_left _null_ _null_ _null_ ));
+DATA(insert OID = 1455 (  circle_overleft	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_overleft _null_ _null_ _null_ ));
+DATA(insert OID = 1456 (  circle_overright	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_overright _null_ _null_ _null_ ));
+DATA(insert OID = 1457 (  circle_right		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_right _null_ _null_ _null_ ));
+DATA(insert OID = 1458 (  circle_contained	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_contained _null_ _null_ _null_ ));
+DATA(insert OID = 1459 (  circle_overlap	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_overlap _null_ _null_ _null_ ));
+DATA(insert OID = 1460 (  circle_below		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_below _null_ _null_ _null_ ));
+DATA(insert OID = 1461 (  circle_above		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_above _null_ _null_ _null_ ));
+DATA(insert OID = 1462 (  circle_eq			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_eq _null_ _null_ _null_ ));
+DATA(insert OID = 1463 (  circle_ne			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_ne _null_ _null_ _null_ ));
+DATA(insert OID = 1464 (  circle_lt			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_lt _null_ _null_ _null_ ));
+DATA(insert OID = 1465 (  circle_gt			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_gt _null_ _null_ _null_ ));
+DATA(insert OID = 1466 (  circle_le			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_le _null_ _null_ _null_ ));
+DATA(insert OID = 1467 (  circle_ge			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_ge _null_ _null_ _null_ ));
+DATA(insert OID = 1468 (  area				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "718" _null_ _null_ _null_ _null_ _null_ circle_area _null_ _null_ _null_ ));
+DESCR("area of circle");
+DATA(insert OID = 1469 (  diameter			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "718" _null_ _null_ _null_ _null_ _null_ circle_diameter _null_ _null_ _null_ ));
+DESCR("diameter of circle");
+DATA(insert OID = 1470 (  radius			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "718" _null_ _null_ _null_ _null_ _null_ circle_radius _null_ _null_ _null_ ));
+DESCR("radius of circle");
+DATA(insert OID = 1471 (  circle_distance	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "718 718" _null_ _null_ _null_ _null_ _null_ circle_distance _null_ _null_ _null_ ));
+DATA(insert OID = 1472 (  circle_center		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "718" _null_ _null_ _null_ _null_ _null_ circle_center _null_ _null_ _null_ ));
+DATA(insert OID = 1473 (  circle			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 718 "600 701" _null_ _null_ _null_ _null_ _null_ cr_circle _null_ _null_ _null_ ));
+DESCR("convert point and radius to circle");
+DATA(insert OID = 1474 (  circle			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 718 "604" _null_ _null_ _null_ _null_ _null_ poly_circle _null_ _null_ _null_ ));
+DESCR("convert polygon to circle");
+DATA(insert OID = 1475 (  polygon			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 604 "23 718" _null_ _null_ _null_ _null_ _null_	circle_poly _null_ _null_ _null_ ));
+DESCR("convert vertex count and circle to polygon");
+DATA(insert OID = 1476 (  dist_pc			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "600 718" _null_ _null_ _null_ _null_ _null_ dist_pc _null_ _null_ _null_ ));
+DATA(insert OID = 1477 (  circle_contain_pt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 600" _null_ _null_ _null_ _null_  _null_ circle_contain_pt _null_ _null_ _null_ ));
+DATA(insert OID = 1478 (  pt_contained_circle	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 718" _null_ _null_ _null_ _null_  _null_ pt_contained_circle _null_ _null_ _null_ ));
+DATA(insert OID = 4091 (  box				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 603 "600" _null_ _null_ _null_ _null_ _null_ point_box _null_ _null_ _null_ ));
+DESCR("convert point to empty box");
+DATA(insert OID = 1479 (  circle			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 718 "603" _null_ _null_ _null_ _null_ _null_ box_circle _null_ _null_ _null_ ));
+DESCR("convert box to circle");
+DATA(insert OID = 1480 (  box				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 603 "718" _null_ _null_ _null_ _null_ _null_ circle_box _null_ _null_ _null_ ));
+DESCR("convert circle to box");
+DATA(insert OID = 1481 (  tinterval			 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 704 "702 702" _null_ _null_ _null_ _null_ _null_ mktinterval _null_ _null_ _null_ ));
+DESCR("convert to tinterval");
+
+DATA(insert OID = 1482 (  lseg_ne			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_  _null_ lseg_ne _null_ _null_ _null_ ));
+DATA(insert OID = 1483 (  lseg_lt			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_  _null_ lseg_lt _null_ _null_ _null_ ));
+DATA(insert OID = 1484 (  lseg_le			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_  _null_ lseg_le _null_ _null_ _null_ ));
+DATA(insert OID = 1485 (  lseg_gt			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_  _null_ lseg_gt _null_ _null_ _null_ ));
+DATA(insert OID = 1486 (  lseg_ge			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_  _null_ lseg_ge _null_ _null_ _null_ ));
+DATA(insert OID = 1487 (  lseg_length		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "601" _null_ _null_ _null_ _null_ _null_ lseg_length _null_ _null_ _null_ ));
+DATA(insert OID = 1488 (  close_ls			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "628 601" _null_ _null_ _null_ _null_ _null_ close_ls _null_ _null_ _null_ ));
+DATA(insert OID = 1489 (  close_lseg		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "601 601" _null_ _null_ _null_ _null_ _null_ close_lseg _null_ _null_ _null_ ));
+
+DATA(insert OID = 1490 (  line_in			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 628 "2275" _null_ _null_ _null_ _null_ _null_ line_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1491 (  line_out			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "628" _null_ _null_ _null_ _null_ _null_ line_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1492 (  line_eq			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "628 628" _null_ _null_ _null_ _null_ _null_ line_eq _null_ _null_ _null_ ));
+DATA(insert OID = 1493 (  line				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 628 "600 600" _null_ _null_ _null_ _null_ _null_ line_construct_pp _null_ _null_ _null_ ));
+DESCR("construct line from points");
+DATA(insert OID = 1494 (  line_interpt		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "628 628" _null_ _null_ _null_ _null_ _null_ line_interpt _null_ _null_ _null_ ));
+DATA(insert OID = 1495 (  line_intersect	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "628 628" _null_ _null_ _null_ _null_  _null_ line_intersect _null_ _null_ _null_ ));
+DATA(insert OID = 1496 (  line_parallel		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "628 628" _null_ _null_ _null_ _null_  _null_ line_parallel _null_ _null_ _null_ ));
+DATA(insert OID = 1497 (  line_perp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "628 628" _null_ _null_ _null_ _null_  _null_ line_perp _null_ _null_ _null_ ));
+DATA(insert OID = 1498 (  line_vertical		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "628" _null_ _null_ _null_ _null_  _null_ line_vertical _null_ _null_ _null_ ));
+DATA(insert OID = 1499 (  line_horizontal	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "628" _null_ _null_ _null_ _null_  _null_ line_horizontal _null_ _null_ _null_ ));
+
+/* OIDS 1500 - 1599 */
+
+DATA(insert OID = 1530 (  length			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "601" _null_ _null_ _null_ _null_ _null_ lseg_length _null_ _null_ _null_ ));
+DESCR("distance between endpoints");
+DATA(insert OID = 1531 (  length			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "602" _null_ _null_ _null_ _null_ _null_ path_length _null_ _null_ _null_ ));
+DESCR("sum of path segments");
+
+
+DATA(insert OID = 1532 (  point				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "601" _null_ _null_ _null_ _null_ _null_ lseg_center _null_ _null_ _null_ ));
+DESCR("center of");
+DATA(insert OID = 1533 (  point				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "602" _null_ _null_ _null_ _null_ _null_ path_center _null_ _null_ _null_ ));
+DESCR("center of");
+DATA(insert OID = 1534 (  point				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "603" _null_ _null_ _null_ _null_ _null_ box_center _null_ _null_ _null_ ));
+DESCR("center of");
+DATA(insert OID = 1540 (  point				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "604" _null_ _null_ _null_ _null_ _null_ poly_center _null_ _null_ _null_ ));
+DESCR("center of");
+DATA(insert OID = 1541 (  lseg				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 601 "603" _null_ _null_ _null_ _null_ _null_ box_diagonal _null_ _null_ _null_ ));
+DESCR("diagonal of");
+DATA(insert OID = 1542 (  center			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "603" _null_ _null_ _null_ _null_ _null_ box_center _null_ _null_ _null_ ));
+DESCR("center of");
+DATA(insert OID = 1543 (  center			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "718" _null_ _null_ _null_ _null_ _null_ circle_center _null_ _null_ _null_ ));
+DESCR("center of");
+DATA(insert OID = 1544 (  polygon			PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 604 "718" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.polygon(12, $1)" _null_ _null_ _null_ ));
+DESCR("convert circle to 12-vertex polygon");
+DATA(insert OID = 1545 (  npoints			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "602" _null_ _null_ _null_ _null_  _null_ path_npoints _null_ _null_ _null_ ));
+DESCR("number of points");
+DATA(insert OID = 1556 (  npoints			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "604" _null_ _null_ _null_ _null_  _null_ poly_npoints _null_ _null_ _null_ ));
+DESCR("number of points");
+
+DATA(insert OID = 1564 (  bit_in			PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1560 "2275 26 23" _null_ _null_ _null_ _null_ _null_ bit_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1565 (  bit_out			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "1560" _null_ _null_ _null_ _null_ _null_ bit_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2919 (  bittypmodin		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ _null_	bittypmodin _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 2920 (  bittypmodout		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ _null_	bittypmodout _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+
+DATA(insert OID = 1569 (  like				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ textlike _null_ _null_ _null_ ));
+DESCR("matches LIKE expression");
+DATA(insert OID = 1570 (  notlike			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ textnlike _null_ _null_ _null_ ));
+DESCR("does not match LIKE expression");
+DATA(insert OID = 1571 (  like				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ _null_ namelike _null_ _null_ _null_ ));
+DESCR("matches LIKE expression");
+DATA(insert OID = 1572 (  notlike			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ _null_ namenlike _null_ _null_ _null_ ));
+DESCR("does not match LIKE expression");
+
+
+/* SEQUENCE functions */
+DATA(insert OID = 1574 (  nextval			PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "2205" _null_ _null_ _null_ _null_ _null_	nextval_oid _null_ _null_ _null_ ));
+DESCR("sequence next value");
+DATA(insert OID = 1575 (  currval			PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "2205" _null_ _null_ _null_ _null_ _null_	currval_oid _null_ _null_ _null_ ));
+DESCR("sequence current value");
+DATA(insert OID = 1576 (  setval			PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 20 "2205 20" _null_ _null_ _null_ _null_  _null_ setval_oid _null_ _null_ _null_ ));
+DESCR("set sequence value");
+DATA(insert OID = 1765 (  setval			PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 20 "2205 20 16" _null_ _null_ _null_ _null_ _null_ setval3_oid _null_ _null_ _null_ ));
+DESCR("set sequence value and is_called status");
+DATA(insert OID = 3078 (  pg_sequence_parameters	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2249 "26" "{26,20,20,20,20,16}" "{i,o,o,o,o,o}" "{sequence_oid,start_value,minimum_value,maximum_value,increment,cycle_option}" _null_ _null_ pg_sequence_parameters _null_ _null_ _null_));
+DESCR("sequence parameters, for use by information schema");
+
+DATA(insert OID = 1579 (  varbit_in			PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1562 "2275 26 23" _null_ _null_ _null_ _null_ _null_ varbit_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1580 (  varbit_out		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "1562" _null_ _null_ _null_ _null_ _null_ varbit_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2902 (  varbittypmodin	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ _null_	varbittypmodin _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 2921 (  varbittypmodout	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ _null_	varbittypmodout _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+
+DATA(insert OID = 1581 (  biteq				PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ _null_ biteq _null_ _null_ _null_ ));
+DATA(insert OID = 1582 (  bitne				PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ _null_ bitne _null_ _null_ _null_ ));
+DATA(insert OID = 1592 (  bitge				PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ _null_ bitge _null_ _null_ _null_ ));
+DATA(insert OID = 1593 (  bitgt				PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ _null_ bitgt _null_ _null_ _null_ ));
+DATA(insert OID = 1594 (  bitle				PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ _null_ bitle _null_ _null_ _null_ ));
+DATA(insert OID = 1595 (  bitlt				PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ _null_ bitlt _null_ _null_ _null_ ));
+DATA(insert OID = 1596 (  bitcmp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1560 1560" _null_ _null_ _null_ _null_ _null_ bitcmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+DATA(insert OID = 1598 (  random			PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 701 "" _null_ _null_ _null_ _null_ _null_ drandom _null_ _null_ _null_ ));
+DESCR("random value");
+DATA(insert OID = 1599 (  setseed			PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "701" _null_ _null_ _null_ _null_ _null_ setseed _null_ _null_ _null_ ));
+DESCR("set random seed");
+
+/* OIDS 1600 - 1699 */
+
+DATA(insert OID = 1600 (  asin				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ dasin _null_ _null_ _null_ ));
+DESCR("arcsine");
+DATA(insert OID = 1601 (  acos				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ dacos _null_ _null_ _null_ ));
+DESCR("arccosine");
+DATA(insert OID = 1602 (  atan				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ datan _null_ _null_ _null_ ));
+DESCR("arctangent");
+DATA(insert OID = 1603 (  atan2				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_ datan2 _null_ _null_ _null_ ));
+DESCR("arctangent, two arguments");
+DATA(insert OID = 1604 (  sin				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ dsin _null_ _null_ _null_ ));
+DESCR("sine");
+DATA(insert OID = 1605 (  cos				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ dcos _null_ _null_ _null_ ));
+DESCR("cosine");
+DATA(insert OID = 1606 (  tan				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ dtan _null_ _null_ _null_ ));
+DESCR("tangent");
+DATA(insert OID = 1607 (  cot				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ dcot _null_ _null_ _null_ ));
+DESCR("cotangent");
+DATA(insert OID = 1608 (  degrees			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ degrees _null_ _null_ _null_ ));
+DESCR("radians to degrees");
+DATA(insert OID = 1609 (  radians			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ radians _null_ _null_ _null_ ));
+DESCR("degrees to radians");
+DATA(insert OID = 1610 (  pi				PGNSP PGUID 12 1 0 0 0 f f f f t f i 0 0 701 "" _null_ _null_ _null_ _null_ _null_ dpi _null_ _null_ _null_ ));
+DESCR("PI");
+
+DATA(insert OID = 1618 (  interval_mul		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1186 701" _null_ _null_ _null_ _null_ _null_ interval_mul _null_ _null_ _null_ ));
+
+DATA(insert OID = 1620 (  ascii				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ _null_ ascii _null_ _null_ _null_ ));
+DESCR("convert first char to int4");
+DATA(insert OID = 1621 (  chr				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "23" _null_ _null_ _null_ _null_ _null_ chr _null_ _null_ _null_ ));
+DESCR("convert int4 to char");
+DATA(insert OID = 1622 (  repeat			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ _null_ repeat _null_ _null_ _null_ ));
+DESCR("replicate string n times");
+
+DATA(insert OID = 1623 (  similar_escape	PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ _null_ similar_escape _null_ _null_ _null_ ));
+DESCR("convert SQL99 regexp pattern to POSIX style");
+
+DATA(insert OID = 1624 (  mul_d_interval	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "701 1186" _null_ _null_ _null_ _null_ _null_ mul_d_interval _null_ _null_ _null_ ));
+
+DATA(insert OID = 1631 (  bpcharlike	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ _null_ textlike _null_ _null_ _null_ ));
+DATA(insert OID = 1632 (  bpcharnlike	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ _null_ textnlike _null_ _null_ _null_ ));
+
+DATA(insert OID = 1633 (  texticlike		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ texticlike _null_ _null_ _null_ ));
+DATA(insert OID = 1634 (  texticnlike		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ texticnlike _null_ _null_ _null_ ));
+DATA(insert OID = 1635 (  nameiclike		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ _null_ nameiclike _null_ _null_ _null_ ));
+DATA(insert OID = 1636 (  nameicnlike		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ _null_ nameicnlike _null_ _null_ _null_ ));
+DATA(insert OID = 1637 (  like_escape		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ _null_ like_escape _null_ _null_ _null_ ));
+DESCR("convert LIKE pattern to use backslash escapes");
+
+DATA(insert OID = 1656 (  bpcharicregexeq	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ _null_ texticregexeq _null_ _null_ _null_ ));
+DATA(insert OID = 1657 (  bpcharicregexne	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ _null_ texticregexne _null_ _null_ _null_ ));
+DATA(insert OID = 1658 (  bpcharregexeq    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ _null_ textregexeq _null_ _null_ _null_ ));
+DATA(insert OID = 1659 (  bpcharregexne    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ _null_ textregexne _null_ _null_ _null_ ));
+DATA(insert OID = 1660 (  bpchariclike		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ _null_ texticlike _null_ _null_ _null_ ));
+DATA(insert OID = 1661 (  bpcharicnlike		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ _null_ texticnlike _null_ _null_ _null_ ));
+
+/* Oracle Compatibility Related Functions - By Edmund Mergl <E.Mergl@bawue.de> */
+DATA(insert OID =  868 (  strpos	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ _null_ textpos _null_ _null_ _null_ ));
+DESCR("position of substring");
+DATA(insert OID =  870 (  lower		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ lower _null_ _null_ _null_ ));
+DESCR("lowercase");
+DATA(insert OID =  871 (  upper		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ upper _null_ _null_ _null_ ));
+DESCR("uppercase");
+DATA(insert OID =  872 (  initcap	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ initcap _null_ _null_ _null_ ));
+DESCR("capitalize each word");
+DATA(insert OID =  873 (  lpad		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 23 25" _null_ _null_ _null_ _null_ _null_	lpad _null_ _null_ _null_ ));
+DESCR("left-pad string to length");
+DATA(insert OID =  874 (  rpad		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 23 25" _null_ _null_ _null_ _null_ _null_	rpad _null_ _null_ _null_ ));
+DESCR("right-pad string to length");
+DATA(insert OID =  875 (  ltrim		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ _null_ ltrim _null_ _null_ _null_ ));
+DESCR("trim selected characters from left end of string");
+DATA(insert OID =  876 (  rtrim		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ _null_ rtrim _null_ _null_ _null_ ));
+DESCR("trim selected characters from right end of string");
+DATA(insert OID =  877 (  substr	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 23 23" _null_ _null_ _null_ _null_ _null_	text_substr _null_ _null_ _null_ ));
+DESCR("extract portion of string");
+DATA(insert OID =  878 (  translate    PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 25 25" _null_ _null_ _null_ _null_ _null_	translate _null_ _null_ _null_ ));
+DESCR("map a set of characters appearing in string");
+DATA(insert OID =  879 (  lpad		   PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.lpad($1, $2, '' '')" _null_ _null_ _null_ ));
+DESCR("left-pad string to length");
+DATA(insert OID =  880 (  rpad		   PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.rpad($1, $2, '' '')" _null_ _null_ _null_ ));
+DESCR("right-pad string to length");
+DATA(insert OID =  881 (  ltrim		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ ltrim1 _null_ _null_ _null_ ));
+DESCR("trim spaces from left end of string");
+DATA(insert OID =  882 (  rtrim		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ rtrim1 _null_ _null_ _null_ ));
+DESCR("trim spaces from right end of string");
+DATA(insert OID =  883 (  substr	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ _null_ text_substr_no_len _null_ _null_ _null_ ));
+DESCR("extract portion of string");
+DATA(insert OID =  884 (  btrim		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ _null_ btrim _null_ _null_ _null_ ));
+DESCR("trim selected characters from both ends of string");
+DATA(insert OID =  885 (  btrim		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ btrim1 _null_ _null_ _null_ ));
+DESCR("trim spaces from both ends of string");
+
+DATA(insert OID =  936 (  substring    PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 23 23" _null_ _null_ _null_ _null_ _null_	text_substr _null_ _null_ _null_ ));
+DESCR("extract portion of string");
+DATA(insert OID =  937 (  substring    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ _null_ text_substr_no_len _null_ _null_ _null_ ));
+DESCR("extract portion of string");
+DATA(insert OID =  2087 ( replace	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 25 25" _null_ _null_ _null_ _null_ _null_	replace_text _null_ _null_ _null_ ));
+DESCR("replace all occurrences in string of old_substr with new_substr");
+DATA(insert OID =  2284 ( regexp_replace	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 25 25" _null_ _null_ _null_ _null_ _null_	textregexreplace_noopt _null_ _null_ _null_ ));
+DESCR("replace text using regexp");
+DATA(insert OID =  2285 ( regexp_replace	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 25 "25 25 25 25" _null_ _null_ _null_ _null_ _null_ textregexreplace _null_ _null_ _null_ ));
+DESCR("replace text using regexp");
+DATA(insert OID =  2763 ( regexp_matches   PGNSP PGUID 12 1 1 0 0 f f f f t t i 2 0 1009 "25 25" _null_ _null_ _null_ _null_ _null_ regexp_matches_no_flags _null_ _null_ _null_ ));
+DESCR("find all match groups for regexp");
+DATA(insert OID =  2764 ( regexp_matches   PGNSP PGUID 12 1 10 0 0 f f f f t t i 3 0 1009 "25 25 25" _null_ _null_ _null_ _null_ _null_ regexp_matches _null_ _null_ _null_ ));
+DESCR("find all match groups for regexp");
+DATA(insert OID =  2088 ( split_part   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 25 23" _null_ _null_ _null_ _null_ _null_	split_text _null_ _null_ _null_ ));
+DESCR("split string by field_sep and return field_num");
+DATA(insert OID =  2765 ( regexp_split_to_table PGNSP PGUID 12 1 1000 0 0 f f f f t t i 2 0 25 "25 25" _null_ _null_ _null_ _null_ _null_	regexp_split_to_table_no_flags _null_ _null_ _null_ ));
+DESCR("split string by pattern");
+DATA(insert OID =  2766 ( regexp_split_to_table PGNSP PGUID 12 1 1000 0 0 f f f f t t i 3 0 25 "25 25 25" _null_ _null_ _null_ _null_ _null_	regexp_split_to_table _null_ _null_ _null_ ));
+DESCR("split string by pattern");
+DATA(insert OID =  2767 ( regexp_split_to_array PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1009 "25 25" _null_ _null_ _null_ _null_ _null_	regexp_split_to_array_no_flags _null_ _null_ _null_ ));
+DESCR("split string by pattern");
+DATA(insert OID =  2768 ( regexp_split_to_array PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1009 "25 25 25" _null_ _null_ _null_ _null_ _null_ regexp_split_to_array _null_ _null_ _null_ ));
+DESCR("split string by pattern");
+DATA(insert OID =  2089 ( to_hex	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "23" _null_ _null_ _null_ _null_ _null_ to_hex32 _null_ _null_ _null_ ));
+DESCR("convert int4 number to hex");
+DATA(insert OID =  2090 ( to_hex	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "20" _null_ _null_ _null_ _null_ _null_ to_hex64 _null_ _null_ _null_ ));
+DESCR("convert int8 number to hex");
+
+/* for character set encoding support */
+
+/* return database encoding name */
+DATA(insert OID = 1039 (  getdatabaseencoding	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ _null_ getdatabaseencoding _null_ _null_ _null_ ));
+DESCR("encoding name of current database");
+
+/* return client encoding name i.e. session encoding */
+DATA(insert OID = 810 (  pg_client_encoding    PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ _null_ pg_client_encoding _null_ _null_ _null_ ));
+DESCR("encoding name of current database");
+
+DATA(insert OID = 1713 (  length		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 23 "17 19" _null_ _null_ _null_ _null_ _null_ length_in_encoding _null_ _null_ _null_ ));
+DESCR("length of string in specified encoding");
+
+DATA(insert OID = 1714 (  convert_from		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "17 19" _null_ _null_ _null_ _null_ _null_ pg_convert_from _null_ _null_ _null_ ));
+DESCR("convert string with specified source encoding name");
+
+DATA(insert OID = 1717 (  convert_to		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 17 "25 19" _null_ _null_ _null_ _null_ _null_ pg_convert_to _null_ _null_ _null_ ));
+DESCR("convert string with specified destination encoding name");
+
+DATA(insert OID = 1813 (  convert		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 17 "17 19 19" _null_ _null_ _null_ _null_ _null_ pg_convert _null_ _null_ _null_ ));
+DESCR("convert string with specified encoding names");
+
+DATA(insert OID = 1264 (  pg_char_to_encoding	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 23 "19" _null_ _null_ _null_ _null_ _null_ PG_char_to_encoding _null_ _null_ _null_ ));
+DESCR("convert encoding name to encoding id");
+
+DATA(insert OID = 1597 (  pg_encoding_to_char	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 19 "23" _null_ _null_ _null_ _null_ _null_ PG_encoding_to_char _null_ _null_ _null_ ));
+DESCR("convert encoding id to encoding name");
+
+DATA(insert OID = 2319 (  pg_encoding_max_length   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ pg_encoding_max_length_sql _null_ _null_ _null_ ));
+DESCR("maximum octet length of a character in given encoding");
+
+DATA(insert OID = 1638 (  oidgt				   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "26 26" _null_ _null_ _null_ _null_ _null_ oidgt _null_ _null_ _null_ ));
+DATA(insert OID = 1639 (  oidge				   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "26 26" _null_ _null_ _null_ _null_ _null_ oidge _null_ _null_ _null_ ));
+
+/* System-view support functions */
+DATA(insert OID = 1573 (  pg_get_ruledef	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ _null_ pg_get_ruledef _null_ _null_ _null_ ));
+DESCR("source text of a rule");
+DATA(insert OID = 1640 (  pg_get_viewdef	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ pg_get_viewdef_name _null_ _null_ _null_ ));
+DESCR("select statement of a view");
+DATA(insert OID = 1641 (  pg_get_viewdef	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ _null_ pg_get_viewdef _null_ _null_ _null_ ));
+DESCR("select statement of a view");
+DATA(insert OID = 1642 (  pg_get_userbyid	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 19 "26" _null_ _null_ _null_ _null_ _null_ pg_get_userbyid _null_ _null_ _null_ ));
+DESCR("role name by OID (with fallback)");
+DATA(insert OID = 1643 (  pg_get_indexdef	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ _null_ pg_get_indexdef _null_ _null_ _null_ ));
+DESCR("index description");
+DATA(insert OID = 1662 (  pg_get_triggerdef    PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ _null_ pg_get_triggerdef _null_ _null_ _null_ ));
+DESCR("trigger description");
+DATA(insert OID = 1387 (  pg_get_constraintdef PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ _null_ pg_get_constraintdef _null_ _null_ _null_ ));
+DESCR("constraint description");
+DATA(insert OID = 1716 (  pg_get_expr		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "194 26" _null_ _null_ _null_ _null_ _null_ pg_get_expr _null_ _null_ _null_ ));
+DESCR("deparse an encoded expression");
+DATA(insert OID = 1665 (  pg_get_serial_sequence	PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "25 25" _null_ _null_ _null_ _null_ _null_ pg_get_serial_sequence _null_ _null_ _null_ ));
+DESCR("name of sequence for a serial column");
+DATA(insert OID = 2098 (  pg_get_functiondef	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ _null_ pg_get_functiondef _null_ _null_ _null_ ));
+DESCR("definition of a function");
+DATA(insert OID = 2162 (  pg_get_function_arguments    PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ _null_ pg_get_function_arguments _null_ _null_ _null_ ));
+DESCR("argument list of a function");
+DATA(insert OID = 2232 (  pg_get_function_identity_arguments	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ _null_ pg_get_function_identity_arguments _null_ _null_ _null_ ));
+DESCR("identity argument list of a function");
+DATA(insert OID = 2165 (  pg_get_function_result	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ _null_ pg_get_function_result _null_ _null_ _null_ ));
+DESCR("result type of a function");
+DATA(insert OID = 3808 (  pg_get_function_arg_default	PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "26 23" _null_ _null_ _null_ _null_ _null_ pg_get_function_arg_default _null_ _null_ _null_ ));
+DESCR("function argument default");
+
+DATA(insert OID = 1686 (  pg_get_keywords		PGNSP PGUID 12 10 400 0 0 f f f f t t s 0 0 2249 "" "{25,18,25}" "{o,o,o}" "{word,catcode,catdesc}" _null_ _null_ pg_get_keywords _null_ _null_ _null_ ));
+DESCR("list of SQL keywords");
+
+DATA(insert OID = 2289 (  pg_options_to_table		PGNSP PGUID 12 1 3 0 0 f f f f t t s 1 0 2249 "1009" "{1009,25,25}" "{i,o,o}" "{options_array,option_name,option_value}" _null_ _null_ pg_options_to_table _null_ _null_ _null_ ));
+DESCR("convert generic options array to name/value table");
+
+DATA(insert OID = 1619 (  pg_typeof				PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0 2206 "2276" _null_ _null_ _null_ _null_  _null_ pg_typeof _null_ _null_ _null_ ));
+DESCR("type of the argument");
+DATA(insert OID = 3162 (  pg_collation_for		PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0   25 "2276" _null_ _null_ _null_ _null_  _null_ pg_collation_for _null_ _null_ _null_ ));
+DESCR("collation of the argument; implementation of the COLLATION FOR expression");
+
+DATA(insert OID = 3842 (  pg_relation_is_updatable	PGNSP PGUID 12 10 0 0 0 f f f f t f s 2 0 23 "2205 16" _null_ _null_ _null_ _null_ _null_ pg_relation_is_updatable _null_ _null_ _null_ ));
+DESCR("is a relation insertable/updatable/deletable");
+DATA(insert OID = 3843 (  pg_column_is_updatable	PGNSP PGUID 12 10 0 0 0 f f f f t f s 3 0 16 "2205 21 16" _null_ _null_ _null_ _null_ _null_ pg_column_is_updatable _null_ _null_ _null_ ));
+DESCR("is a column updatable");
+
+/* Deferrable unique constraint trigger */
+DATA(insert OID = 1250 (  unique_key_recheck	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ unique_key_recheck _null_ _null_ _null_ ));
+DESCR("deferred UNIQUE constraint check");
+
+/* Generic referential integrity constraint triggers */
+DATA(insert OID = 1644 (  RI_FKey_check_ins		PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ RI_FKey_check_ins _null_ _null_ _null_ ));
+DESCR("referential integrity FOREIGN KEY ... REFERENCES");
+DATA(insert OID = 1645 (  RI_FKey_check_upd		PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ RI_FKey_check_upd _null_ _null_ _null_ ));
+DESCR("referential integrity FOREIGN KEY ... REFERENCES");
+DATA(insert OID = 1646 (  RI_FKey_cascade_del	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ RI_FKey_cascade_del _null_ _null_ _null_ ));
+DESCR("referential integrity ON DELETE CASCADE");
+DATA(insert OID = 1647 (  RI_FKey_cascade_upd	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ RI_FKey_cascade_upd _null_ _null_ _null_ ));
+DESCR("referential integrity ON UPDATE CASCADE");
+DATA(insert OID = 1648 (  RI_FKey_restrict_del	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ RI_FKey_restrict_del _null_ _null_ _null_ ));
+DESCR("referential integrity ON DELETE RESTRICT");
+DATA(insert OID = 1649 (  RI_FKey_restrict_upd	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ RI_FKey_restrict_upd _null_ _null_ _null_ ));
+DESCR("referential integrity ON UPDATE RESTRICT");
+DATA(insert OID = 1650 (  RI_FKey_setnull_del	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ RI_FKey_setnull_del _null_ _null_ _null_ ));
+DESCR("referential integrity ON DELETE SET NULL");
+DATA(insert OID = 1651 (  RI_FKey_setnull_upd	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ RI_FKey_setnull_upd _null_ _null_ _null_ ));
+DESCR("referential integrity ON UPDATE SET NULL");
+DATA(insert OID = 1652 (  RI_FKey_setdefault_del PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ RI_FKey_setdefault_del _null_ _null_ _null_ ));
+DESCR("referential integrity ON DELETE SET DEFAULT");
+DATA(insert OID = 1653 (  RI_FKey_setdefault_upd PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ RI_FKey_setdefault_upd _null_ _null_ _null_ ));
+DESCR("referential integrity ON UPDATE SET DEFAULT");
+DATA(insert OID = 1654 (  RI_FKey_noaction_del PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ RI_FKey_noaction_del _null_ _null_ _null_ ));
+DESCR("referential integrity ON DELETE NO ACTION");
+DATA(insert OID = 1655 (  RI_FKey_noaction_upd PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ RI_FKey_noaction_upd _null_ _null_ _null_ ));
+DESCR("referential integrity ON UPDATE NO ACTION");
+
+DATA(insert OID = 1666 (  varbiteq			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ _null_ biteq _null_ _null_ _null_ ));
+DATA(insert OID = 1667 (  varbitne			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ _null_ bitne _null_ _null_ _null_ ));
+DATA(insert OID = 1668 (  varbitge			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ _null_ bitge _null_ _null_ _null_ ));
+DATA(insert OID = 1669 (  varbitgt			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ _null_ bitgt _null_ _null_ _null_ ));
+DATA(insert OID = 1670 (  varbitle			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ _null_ bitle _null_ _null_ _null_ ));
+DATA(insert OID = 1671 (  varbitlt			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ _null_ bitlt _null_ _null_ _null_ ));
+DATA(insert OID = 1672 (  varbitcmp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1562 1562" _null_ _null_ _null_ _null_ _null_ bitcmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+DATA(insert OID = 1673 (  bitand			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1560 "1560 1560" _null_ _null_ _null_ _null_ _null_	bit_and _null_ _null_ _null_ ));
+DATA(insert OID = 1674 (  bitor				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1560 "1560 1560" _null_ _null_ _null_ _null_ _null_	bit_or _null_ _null_ _null_ ));
+DATA(insert OID = 1675 (  bitxor			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1560 "1560 1560" _null_ _null_ _null_ _null_ _null_	bitxor _null_ _null_ _null_ ));
+DATA(insert OID = 1676 (  bitnot			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1560 "1560" _null_ _null_ _null_ _null_ _null_ bitnot _null_ _null_ _null_ ));
+DATA(insert OID = 1677 (  bitshiftleft		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1560 "1560 23" _null_ _null_ _null_ _null_ _null_ bitshiftleft _null_ _null_ _null_ ));
+DATA(insert OID = 1678 (  bitshiftright		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1560 "1560 23" _null_ _null_ _null_ _null_ _null_ bitshiftright _null_ _null_ _null_ ));
+DATA(insert OID = 1679 (  bitcat			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1562 "1562 1562" _null_ _null_ _null_ _null_ _null_	bitcat _null_ _null_ _null_ ));
+DATA(insert OID = 1680 (  substring			PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1560 "1560 23 23" _null_ _null_ _null_ _null_ _null_ bitsubstr _null_ _null_ _null_ ));
+DESCR("extract portion of bitstring");
+DATA(insert OID = 1681 (  length			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1560" _null_ _null_ _null_ _null_ _null_ bitlength _null_ _null_ _null_ ));
+DESCR("bitstring length");
+DATA(insert OID = 1682 (  octet_length		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1560" _null_ _null_ _null_ _null_ _null_ bitoctetlength _null_ _null_ _null_ ));
+DESCR("octet length");
+DATA(insert OID = 1683 (  bit				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1560 "23 23" _null_ _null_ _null_ _null_ _null_	bitfromint4 _null_ _null_ _null_ ));
+DESCR("convert int4 to bitstring");
+DATA(insert OID = 1684 (  int4				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1560" _null_ _null_ _null_ _null_ _null_ bittoint4 _null_ _null_ _null_ ));
+DESCR("convert bitstring to int4");
+
+DATA(insert OID = 1685 (  bit			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1560 "1560 23 16" _null_ _null_ _null_ _null_ _null_ bit _null_ _null_ _null_ ));
+DESCR("adjust bit() to typmod length");
+DATA(insert OID = 3158 ( varbit_transform  PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ varbit_transform _null_ _null_ _null_ ));
+DESCR("transform a varbit length coercion");
+DATA(insert OID = 1687 (  varbit		   PGNSP PGUID 12 1 0 0 varbit_transform f f f f t f i 3 0 1562 "1562 23 16" _null_ _null_ _null_ _null_ _null_ varbit _null_ _null_ _null_ ));
+DESCR("adjust varbit() to typmod length");
+
+DATA(insert OID = 1698 (  position		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1560 1560" _null_ _null_ _null_ _null_ _null_ bitposition _null_ _null_ _null_ ));
+DESCR("position of sub-bitstring");
+DATA(insert OID = 1699 (  substring		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1560 "1560 23" _null_ _null_ _null_ _null_ _null_ bitsubstr_no_len _null_ _null_ _null_ ));
+DESCR("extract portion of bitstring");
+
+DATA(insert OID = 3030 (  overlay		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 1560 "1560 1560 23 23" _null_ _null_ _null_ _null_ _null_	bitoverlay _null_ _null_ _null_ ));
+DESCR("substitute portion of bitstring");
+DATA(insert OID = 3031 (  overlay		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1560 "1560 1560 23" _null_ _null_ _null_ _null_ _null_ bitoverlay_no_len _null_ _null_ _null_ ));
+DESCR("substitute portion of bitstring");
+DATA(insert OID = 3032 (  get_bit		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1560 23" _null_ _null_ _null_ _null_ _null_ bitgetbit _null_ _null_ _null_ ));
+DESCR("get bit");
+DATA(insert OID = 3033 (  set_bit		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1560 "1560 23 23" _null_ _null_ _null_ _null_ _null_ bitsetbit _null_ _null_ _null_ ));
+DESCR("set bit");
+
+/* for mac type support */
+DATA(insert OID = 436 (  macaddr_in			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 829 "2275" _null_ _null_ _null_ _null_ _null_ macaddr_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 437 (  macaddr_out		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "829" _null_ _null_ _null_ _null_ _null_ macaddr_out _null_ _null_ _null_ ));
+DESCR("I/O");
+
+DATA(insert OID = 753 (  trunc				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 829 "829" _null_ _null_ _null_ _null_ _null_ macaddr_trunc _null_ _null_ _null_ ));
+DESCR("MAC manufacturer fields");
+
+DATA(insert OID = 830 (  macaddr_eq			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "829 829" _null_ _null_ _null_ _null_ _null_	macaddr_eq _null_ _null_ _null_ ));
+DATA(insert OID = 831 (  macaddr_lt			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "829 829" _null_ _null_ _null_ _null_ _null_	macaddr_lt _null_ _null_ _null_ ));
+DATA(insert OID = 832 (  macaddr_le			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "829 829" _null_ _null_ _null_ _null_ _null_	macaddr_le _null_ _null_ _null_ ));
+DATA(insert OID = 833 (  macaddr_gt			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "829 829" _null_ _null_ _null_ _null_ _null_	macaddr_gt _null_ _null_ _null_ ));
+DATA(insert OID = 834 (  macaddr_ge			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "829 829" _null_ _null_ _null_ _null_ _null_	macaddr_ge _null_ _null_ _null_ ));
+DATA(insert OID = 835 (  macaddr_ne			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "829 829" _null_ _null_ _null_ _null_ _null_	macaddr_ne _null_ _null_ _null_ ));
+DATA(insert OID = 836 (  macaddr_cmp		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "829 829" _null_ _null_ _null_ _null_ _null_	macaddr_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 3144 (  macaddr_not		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 829 "829" _null_ _null_ _null_ _null_ _null_	macaddr_not _null_ _null_ _null_ ));
+DATA(insert OID = 3145 (  macaddr_and		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 829 "829 829" _null_ _null_ _null_ _null_ _null_	macaddr_and _null_ _null_ _null_ ));
+DATA(insert OID = 3146 (  macaddr_or		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 829 "829 829" _null_ _null_ _null_ _null_ _null_	macaddr_or _null_ _null_ _null_ ));
+
+/* for inet type support */
+DATA(insert OID = 910 (  inet_in			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 869 "2275" _null_ _null_ _null_ _null_ _null_ inet_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 911 (  inet_out			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "869" _null_ _null_ _null_ _null_ _null_ inet_out _null_ _null_ _null_ ));
+DESCR("I/O");
+
+/* for cidr type support */
+DATA(insert OID = 1267 (  cidr_in			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 650 "2275" _null_ _null_ _null_ _null_ _null_ cidr_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1427 (  cidr_out			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "650" _null_ _null_ _null_ _null_ _null_ cidr_out _null_ _null_ _null_ ));
+DESCR("I/O");
+
+/* these are used for both inet and cidr */
+DATA(insert OID = 920 (  network_eq			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ _null_	network_eq _null_ _null_ _null_ ));
+DATA(insert OID = 921 (  network_lt			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ _null_	network_lt _null_ _null_ _null_ ));
+DATA(insert OID = 922 (  network_le			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ _null_	network_le _null_ _null_ _null_ ));
+DATA(insert OID = 923 (  network_gt			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ _null_	network_gt _null_ _null_ _null_ ));
+DATA(insert OID = 924 (  network_ge			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ _null_	network_ge _null_ _null_ _null_ ));
+DATA(insert OID = 925 (  network_ne			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ _null_	network_ne _null_ _null_ _null_ ));
+DATA(insert OID = 3562 (  network_larger	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 869 "869 869" _null_ _null_ _null_ _null_ _null_	network_larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 3563 (  network_smaller	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 869 "869 869" _null_ _null_ _null_ _null_ _null_	network_smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+DATA(insert OID = 926 (  network_cmp		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "869 869" _null_ _null_ _null_ _null_ _null_	network_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 927 (  network_sub		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ _null_	network_sub _null_ _null_ _null_ ));
+DATA(insert OID = 928 (  network_subeq		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ _null_	network_subeq _null_ _null_ _null_ ));
+DATA(insert OID = 929 (  network_sup		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ _null_	network_sup _null_ _null_ _null_ ));
+DATA(insert OID = 930 (  network_supeq		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ _null_	network_supeq _null_ _null_ _null_ ));
+DATA(insert OID = 3551 (  network_overlap	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ _null_	network_overlap _null_ _null_ _null_ ));
+
+/* inet/cidr functions */
+DATA(insert OID = 598 (  abbrev				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "869" _null_ _null_ _null_ _null_ _null_	inet_abbrev _null_ _null_ _null_ ));
+DESCR("abbreviated display of inet value");
+DATA(insert OID = 599 (  abbrev				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "650" _null_ _null_ _null_ _null_ _null_	cidr_abbrev _null_ _null_ _null_ ));
+DESCR("abbreviated display of cidr value");
+DATA(insert OID = 605 (  set_masklen		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 869 "869 23" _null_ _null_ _null_ _null_ _null_	inet_set_masklen _null_ _null_ _null_ ));
+DESCR("change netmask of inet");
+DATA(insert OID = 635 (  set_masklen		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 650 "650 23" _null_ _null_ _null_ _null_ _null_	cidr_set_masklen _null_ _null_ _null_ ));
+DESCR("change netmask of cidr");
+DATA(insert OID = 711 (  family				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "869" _null_ _null_ _null_ _null_ _null_	network_family _null_ _null_ _null_ ));
+DESCR("address family (4 for IPv4, 6 for IPv6)");
+DATA(insert OID = 683 (  network			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 650 "869" _null_ _null_ _null_ _null_ _null_ network_network _null_ _null_ _null_ ));
+DESCR("network part of address");
+DATA(insert OID = 696 (  netmask			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 869 "869" _null_ _null_ _null_ _null_ _null_ network_netmask _null_ _null_ _null_ ));
+DESCR("netmask of address");
+DATA(insert OID = 697 (  masklen			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "869" _null_ _null_ _null_ _null_ _null_	network_masklen _null_ _null_ _null_ ));
+DESCR("netmask length");
+DATA(insert OID = 698 (  broadcast			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 869 "869" _null_ _null_ _null_ _null_ _null_ network_broadcast _null_ _null_ _null_ ));
+DESCR("broadcast address of network");
+DATA(insert OID = 699 (  host				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "869" _null_ _null_ _null_ _null_ _null_	network_host _null_ _null_ _null_ ));
+DESCR("show address octets only");
+DATA(insert OID = 730 (  text				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "869" _null_ _null_ _null_ _null_ _null_	network_show _null_ _null_ _null_ ));
+DESCR("show all parts of inet/cidr value");
+DATA(insert OID = 1362 (  hostmask			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 869 "869" _null_ _null_ _null_ _null_ _null_ network_hostmask _null_ _null_ _null_ ));
+DESCR("hostmask of address");
+DATA(insert OID = 1715 (  cidr				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 650 "869" _null_ _null_ _null_ _null_ _null_	inet_to_cidr _null_ _null_ _null_ ));
+DESCR("convert inet to cidr");
+
+DATA(insert OID = 2196 (  inet_client_addr		PGNSP PGUID 12 1 0 0 0 f f f f f f s 0 0 869 "" _null_ _null_ _null_ _null_ _null_ inet_client_addr _null_ _null_ _null_ ));
+DESCR("inet address of the client");
+DATA(insert OID = 2197 (  inet_client_port		PGNSP PGUID 12 1 0 0 0 f f f f f f s 0 0 23 "" _null_ _null_ _null_ _null_ _null_	inet_client_port _null_ _null_ _null_ ));
+DESCR("client's port number for this connection");
+DATA(insert OID = 2198 (  inet_server_addr		PGNSP PGUID 12 1 0 0 0 f f f f f f s 0 0 869 "" _null_ _null_ _null_ _null_ _null_ inet_server_addr _null_ _null_ _null_ ));
+DESCR("inet address of the server");
+DATA(insert OID = 2199 (  inet_server_port		PGNSP PGUID 12 1 0 0 0 f f f f f f s 0 0 23 "" _null_ _null_ _null_ _null_ _null_	inet_server_port _null_ _null_ _null_ ));
+DESCR("server's port number for this connection");
+
+DATA(insert OID = 2627 (  inetnot			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 869 "869" _null_ _null_ _null_ _null_ _null_	inetnot _null_ _null_ _null_ ));
+DATA(insert OID = 2628 (  inetand			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 869 "869 869" _null_ _null_ _null_ _null_ _null_	inetand _null_ _null_ _null_ ));
+DATA(insert OID = 2629 (  inetor			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 869 "869 869" _null_ _null_ _null_ _null_ _null_	inetor _null_ _null_ _null_ ));
+DATA(insert OID = 2630 (  inetpl			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 869 "869 20" _null_ _null_ _null_ _null_ _null_	inetpl _null_ _null_ _null_ ));
+DATA(insert OID = 2631 (  int8pl_inet		PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 869 "20 869" _null_ _null_ _null_ _null_ _null_ "select $2 + $1" _null_ _null_ _null_ ));
+DATA(insert OID = 2632 (  inetmi_int8		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 869 "869 20" _null_ _null_ _null_ _null_ _null_	inetmi_int8 _null_ _null_ _null_ ));
+DATA(insert OID = 2633 (  inetmi			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "869 869" _null_ _null_ _null_ _null_ _null_	inetmi _null_ _null_ _null_ ));
+DATA(insert OID = 4071 (  inet_same_family	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ _null_ inet_same_family _null_ _null_ _null_ ));
+DESCR("are the addresses from the same family?");
+DATA(insert OID = 4063 (  inet_merge		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 650 "869 869" _null_ _null_ _null_ _null_ _null_ inet_merge _null_ _null_ _null_ ));
+DESCR("the smallest network which includes both of the given networks");
+
+/* GiST support for inet and cidr */
+DATA(insert OID = 3553 (  inet_gist_consistent	PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 16 "2281 869 23 26 2281" _null_ _null_ _null_ _null_ _null_ inet_gist_consistent _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3554 (  inet_gist_union		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ inet_gist_union _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3555 (  inet_gist_compress	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ inet_gist_compress _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3556 (  inet_gist_decompress	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ inet_gist_decompress _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3573 (  inet_gist_fetch		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ inet_gist_fetch _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3557 (  inet_gist_penalty		PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ inet_gist_penalty _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3558 (  inet_gist_picksplit	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ inet_gist_picksplit _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3559 (  inet_gist_same		PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "869 869 2281" _null_ _null_ _null_ _null_ _null_ inet_gist_same _null_ _null_ _null_ ));
+DESCR("GiST support");
+
+/* Selectivity estimation for inet and cidr */
+DATA(insert OID = 3560 (  networksel		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_	networksel _null_ _null_ _null_ ));
+DESCR("restriction selectivity for network operators");
+DATA(insert OID = 3561 (  networkjoinsel	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ _null_	networkjoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity for network operators");
+
+DATA(insert OID = 1690 ( time_mi_time		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1083 1083" _null_ _null_ _null_ _null_ _null_	time_mi_time _null_ _null_ _null_ ));
+
+DATA(insert OID = 1691 (  boolle			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ _null_ boolle _null_ _null_ _null_ ));
+DATA(insert OID = 1692 (  boolge			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ _null_ boolge _null_ _null_ _null_ ));
+DATA(insert OID = 1693 (  btboolcmp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "16 16" _null_ _null_ _null_ _null_ _null_ btboolcmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+DATA(insert OID = 1688 (  time_hash			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1083" _null_ _null_ _null_ _null_ _null_ time_hash _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 1696 (  timetz_hash		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1266" _null_ _null_ _null_ _null_ _null_ timetz_hash _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 1697 (  interval_hash		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1186" _null_ _null_ _null_ _null_ _null_ interval_hash _null_ _null_ _null_ ));
+DESCR("hash");
+
+
+/* OID's 1700 - 1799 NUMERIC data type */
+DATA(insert OID = 1701 ( numeric_in				PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1700 "2275 26 23" _null_ _null_ _null_ _null_ _null_	numeric_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1702 ( numeric_out			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "1700" _null_ _null_ _null_ _null_ _null_ numeric_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2917 (  numerictypmodin		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ _null_	numerictypmodin _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 2918 (  numerictypmodout		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ _null_	numerictypmodout _null_ _null_ _null_ ));
+DESCR("I/O typmod");
+DATA(insert OID = 3157 ( numeric_transform		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ numeric_transform _null_ _null_ _null_ ));
+DESCR("transform a numeric length coercion");
+DATA(insert OID = 1703 ( numeric				PGNSP PGUID 12 1 0 0 numeric_transform f f f f t f i 2 0 1700 "1700 23" _null_ _null_ _null_ _null_ _null_ numeric _null_ _null_ _null_ ));
+DESCR("adjust numeric to typmod precision/scale");
+DATA(insert OID = 1704 ( numeric_abs			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_abs _null_ _null_ _null_ ));
+DATA(insert OID = 1705 ( abs					PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_abs _null_ _null_ _null_ ));
+DESCR("absolute value");
+DATA(insert OID = 1706 ( sign					PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_sign _null_ _null_ _null_ ));
+DESCR("sign of value");
+DATA(insert OID = 1707 ( round					PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 23" _null_ _null_ _null_ _null_ _null_ numeric_round _null_ _null_ _null_ ));
+DESCR("value rounded to 'scale'");
+DATA(insert OID = 1708 ( round					PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.round($1,0)" _null_ _null_ _null_ ));
+DESCR("value rounded to 'scale' of zero");
+DATA(insert OID = 1709 ( trunc					PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 23" _null_ _null_ _null_ _null_ _null_ numeric_trunc _null_ _null_ _null_ ));
+DESCR("value truncated to 'scale'");
+DATA(insert OID = 1710 ( trunc					PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.trunc($1,0)" _null_ _null_ _null_ ));
+DESCR("value truncated to 'scale' of zero");
+DATA(insert OID = 1711 ( ceil					PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_ceil _null_ _null_ _null_ ));
+DESCR("smallest integer >= value");
+DATA(insert OID = 2167 ( ceiling				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_ceil _null_ _null_ _null_ ));
+DESCR("smallest integer >= value");
+DATA(insert OID = 1712 ( floor					PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_floor _null_ _null_ _null_ ));
+DESCR("largest integer <= value");
+DATA(insert OID = 1718 ( numeric_eq				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ _null_ numeric_eq _null_ _null_ _null_ ));
+DATA(insert OID = 1719 ( numeric_ne				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ _null_ numeric_ne _null_ _null_ _null_ ));
+DATA(insert OID = 1720 ( numeric_gt				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ _null_ numeric_gt _null_ _null_ _null_ ));
+DATA(insert OID = 1721 ( numeric_ge				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ _null_ numeric_ge _null_ _null_ _null_ ));
+DATA(insert OID = 1722 ( numeric_lt				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ _null_ numeric_lt _null_ _null_ _null_ ));
+DATA(insert OID = 1723 ( numeric_le				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ _null_ numeric_le _null_ _null_ _null_ ));
+DATA(insert OID = 1724 ( numeric_add			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ _null_	numeric_add _null_ _null_ _null_ ));
+DATA(insert OID = 1725 ( numeric_sub			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ _null_	numeric_sub _null_ _null_ _null_ ));
+DATA(insert OID = 1726 ( numeric_mul			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ _null_	numeric_mul _null_ _null_ _null_ ));
+DATA(insert OID = 1727 ( numeric_div			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ _null_	numeric_div _null_ _null_ _null_ ));
+DATA(insert OID = 1728 ( mod					PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ _null_	numeric_mod _null_ _null_ _null_ ));
+DESCR("modulus");
+DATA(insert OID = 1729 ( numeric_mod			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ _null_	numeric_mod _null_ _null_ _null_ ));
+DATA(insert OID = 1730 ( sqrt					PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_sqrt _null_ _null_ _null_ ));
+DESCR("square root");
+DATA(insert OID = 1731 ( numeric_sqrt			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_sqrt _null_ _null_ _null_ ));
+DESCR("square root");
+DATA(insert OID = 1732 ( exp					PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_exp _null_ _null_ _null_ ));
+DESCR("natural exponential (e^x)");
+DATA(insert OID = 1733 ( numeric_exp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_exp _null_ _null_ _null_ ));
+DESCR("natural exponential (e^x)");
+DATA(insert OID = 1734 ( ln						PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_ln _null_ _null_ _null_ ));
+DESCR("natural logarithm");
+DATA(insert OID = 1735 ( numeric_ln				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_ln _null_ _null_ _null_ ));
+DESCR("natural logarithm");
+DATA(insert OID = 1736 ( log					PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ _null_	numeric_log _null_ _null_ _null_ ));
+DESCR("logarithm base m of n");
+DATA(insert OID = 1737 ( numeric_log			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ _null_	numeric_log _null_ _null_ _null_ ));
+DESCR("logarithm base m of n");
+DATA(insert OID = 1738 ( pow					PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ _null_	numeric_power _null_ _null_ _null_ ));
+DESCR("exponentiation");
+DATA(insert OID = 2169 ( power					PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ _null_	numeric_power _null_ _null_ _null_ ));
+DESCR("exponentiation");
+DATA(insert OID = 1739 ( numeric_power			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ _null_	numeric_power _null_ _null_ _null_ ));
+DATA(insert OID = 1740 ( numeric				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "23" _null_ _null_ _null_ _null_ _null_ int4_numeric _null_ _null_ _null_ ));
+DESCR("convert int4 to numeric");
+DATA(insert OID = 1741 ( log					PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.log(10, $1)" _null_ _null_ _null_ ));
+DESCR("base 10 logarithm");
+DATA(insert OID = 1742 ( numeric				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "700" _null_ _null_ _null_ _null_ _null_ float4_numeric _null_ _null_ _null_ ));
+DESCR("convert float4 to numeric");
+DATA(insert OID = 1743 ( numeric				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "701" _null_ _null_ _null_ _null_ _null_ float8_numeric _null_ _null_ _null_ ));
+DESCR("convert float8 to numeric");
+DATA(insert OID = 1744 ( int4					PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1700" _null_ _null_ _null_ _null_ _null_ numeric_int4 _null_ _null_ _null_ ));
+DESCR("convert numeric to int4");
+DATA(insert OID = 1745 ( float4					PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_float4 _null_ _null_ _null_ ));
+DESCR("convert numeric to float4");
+DATA(insert OID = 1746 ( float8					PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1700" _null_ _null_ _null_ _null_ _null_ numeric_float8 _null_ _null_ _null_ ));
+DESCR("convert numeric to float8");
+DATA(insert OID = 1973 ( div					PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ _null_	numeric_div_trunc _null_ _null_ _null_ ));
+DESCR("trunc(x/y)");
+DATA(insert OID = 1980 ( numeric_div_trunc		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ _null_	numeric_div_trunc _null_ _null_ _null_ ));
+DESCR("trunc(x/y)");
+DATA(insert OID = 2170 ( width_bucket			PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 23 "1700 1700 1700 23" _null_ _null_ _null_ _null_ _null_ width_bucket_numeric _null_ _null_ _null_ ));
+DESCR("bucket number of operand in equal-width histogram");
+
+DATA(insert OID = 1747 ( time_pl_interval		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1083 "1083 1186" _null_ _null_ _null_ _null_ _null_	time_pl_interval _null_ _null_ _null_ ));
+DATA(insert OID = 1748 ( time_mi_interval		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1083 "1083 1186" _null_ _null_ _null_ _null_ _null_	time_mi_interval _null_ _null_ _null_ ));
+DATA(insert OID = 1749 ( timetz_pl_interval		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1266 "1266 1186" _null_ _null_ _null_ _null_ _null_	timetz_pl_interval _null_ _null_ _null_ ));
+DATA(insert OID = 1750 ( timetz_mi_interval		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1266 "1266 1186" _null_ _null_ _null_ _null_ _null_	timetz_mi_interval _null_ _null_ _null_ ));
+
+DATA(insert OID = 1764 ( numeric_inc			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_inc _null_ _null_ _null_ ));
+DESCR("increment by one");
+DATA(insert OID = 1766 ( numeric_smaller		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ _null_	numeric_smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+DATA(insert OID = 1767 ( numeric_larger			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ _null_	numeric_larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 1769 ( numeric_cmp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1700 1700" _null_ _null_ _null_ _null_ _null_ numeric_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 3283 ( numeric_sortsupport	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ numeric_sortsupport _null_ _null_ _null_ ));
+DESCR("sort support");
+DATA(insert OID = 1771 ( numeric_uminus			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_uminus _null_ _null_ _null_ ));
+DATA(insert OID = 1779 ( int8					PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "1700" _null_ _null_ _null_ _null_ _null_ numeric_int8 _null_ _null_ _null_ ));
+DESCR("convert numeric to int8");
+DATA(insert OID = 1781 ( numeric				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "20" _null_ _null_ _null_ _null_ _null_ int8_numeric _null_ _null_ _null_ ));
+DESCR("convert int8 to numeric");
+DATA(insert OID = 1782 ( numeric				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "21" _null_ _null_ _null_ _null_ _null_ int2_numeric _null_ _null_ _null_ ));
+DESCR("convert int2 to numeric");
+DATA(insert OID = 1783 ( int2					PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "1700" _null_ _null_ _null_ _null_ _null_ numeric_int2 _null_ _null_ _null_ ));
+DESCR("convert numeric to int2");
+
+/* formatting */
+DATA(insert OID = 1770 ( to_char			PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "1184 25" _null_ _null_ _null_ _null_  _null_ timestamptz_to_char _null_ _null_ _null_ ));
+DESCR("format timestamp with time zone to text");
+DATA(insert OID = 1772 ( to_char			PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "1700 25" _null_ _null_ _null_ _null_  _null_ numeric_to_char _null_ _null_ _null_ ));
+DESCR("format numeric to text");
+DATA(insert OID = 1773 ( to_char			PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "23 25" _null_ _null_ _null_ _null_ _null_ int4_to_char _null_ _null_ _null_ ));
+DESCR("format int4 to text");
+DATA(insert OID = 1774 ( to_char			PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "20 25" _null_ _null_ _null_ _null_ _null_ int8_to_char _null_ _null_ _null_ ));
+DESCR("format int8 to text");
+DATA(insert OID = 1775 ( to_char			PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "700 25" _null_ _null_ _null_ _null_ _null_ float4_to_char _null_ _null_ _null_ ));
+DESCR("format float4 to text");
+DATA(insert OID = 1776 ( to_char			PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "701 25" _null_ _null_ _null_ _null_ _null_ float8_to_char _null_ _null_ _null_ ));
+DESCR("format float8 to text");
+DATA(insert OID = 1777 ( to_number			PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 1700 "25 25" _null_ _null_ _null_ _null_  _null_ numeric_to_number _null_ _null_ _null_ ));
+DESCR("convert text to numeric");
+DATA(insert OID = 1778 ( to_timestamp		PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 1184 "25 25" _null_ _null_ _null_ _null_  _null_ to_timestamp _null_ _null_ _null_ ));
+DESCR("convert text to timestamp with time zone");
+DATA(insert OID = 1780 ( to_date			PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 1082 "25 25" _null_ _null_ _null_ _null_  _null_ to_date _null_ _null_ _null_ ));
+DESCR("convert text to date");
+DATA(insert OID = 1768 ( to_char			PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "1186 25" _null_ _null_ _null_ _null_  _null_ interval_to_char _null_ _null_ _null_ ));
+DESCR("format interval to text");
+
+DATA(insert OID =  1282 ( quote_ident	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ quote_ident _null_ _null_ _null_ ));
+DESCR("quote an identifier for usage in a querystring");
+DATA(insert OID =  1283 ( quote_literal    PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ quote_literal _null_ _null_ _null_ ));
+DESCR("quote a literal for usage in a querystring");
+DATA(insert OID =  1285 ( quote_literal    PGNSP PGUID 14 1 0 0 0 f f f f t f s 1 0 25 "2283" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.quote_literal($1::pg_catalog.text)" _null_ _null_ _null_ ));
+DESCR("quote a data value for usage in a querystring");
+DATA(insert OID =  1289 ( quote_nullable   PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ quote_nullable _null_ _null_ _null_ ));
+DESCR("quote a possibly-null literal for usage in a querystring");
+DATA(insert OID =  1290 ( quote_nullable   PGNSP PGUID 14 1 0 0 0 f f f f f f s 1 0 25 "2283" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.quote_nullable($1::pg_catalog.text)" _null_ _null_ _null_ ));
+DESCR("quote a possibly-null data value for usage in a querystring");
+
+DATA(insert OID = 1798 (  oidin			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 26 "2275" _null_ _null_ _null_ _null_ _null_ oidin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 1799 (  oidout		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "26" _null_ _null_ _null_ _null_ _null_ oidout _null_ _null_ _null_ ));
+DESCR("I/O");
+
+DATA(insert OID = 3058 ( concat		PGNSP PGUID 12 1 0 2276 0 f f f f f f s 1 0 25 "2276" "{2276}" "{v}" _null_ _null_ _null_	text_concat _null_ _null_ _null_ ));
+DESCR("concatenate values");
+DATA(insert OID = 3059 ( concat_ws	PGNSP PGUID 12 1 0 2276 0 f f f f f f s 2 0 25 "25 2276" "{25,2276}" "{i,v}" _null_ _null_ _null_	text_concat_ws _null_ _null_ _null_ ));
+DESCR("concatenate values with separators");
+DATA(insert OID = 3060 ( left		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_  _null_ text_left _null_ _null_ _null_ ));
+DESCR("extract the first n characters");
+DATA(insert OID = 3061 ( right		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_  _null_ text_right _null_ _null_ _null_ ));
+DESCR("extract the last n characters");
+DATA(insert OID = 3062 ( reverse	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ _null_  text_reverse	_null_ _null_ _null_ ));
+DESCR("reverse text");
+DATA(insert OID = 3539 ( format		PGNSP PGUID 12 1 0 2276 0 f f f f f f s 2 0 25 "25 2276" "{25,2276}" "{i,v}" _null_ _null_ _null_	text_format _null_ _null_ _null_ ));
+DESCR("format text message");
+DATA(insert OID = 3540 ( format		PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0 25 "25" _null_ _null_ _null_ _null_  _null_ text_format_nv _null_ _null_ _null_ ));
+DESCR("format text message");
+
+DATA(insert OID = 1810 (  bit_length	   PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 23 "17" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.octet_length($1) * 8" _null_ _null_ _null_ ));
+DESCR("length in bits");
+DATA(insert OID = 1811 (  bit_length	   PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.octet_length($1) * 8" _null_ _null_ _null_ ));
+DESCR("length in bits");
+DATA(insert OID = 1812 (  bit_length	   PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 23 "1560" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.length($1)" _null_ _null_ _null_ ));
+DESCR("length in bits");
+
+/* Selectivity estimators for LIKE and related operators */
+DATA(insert OID = 1814 ( iclikesel			PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_	iclikesel _null_ _null_ _null_ ));
+DESCR("restriction selectivity of ILIKE");
+DATA(insert OID = 1815 ( icnlikesel			PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_	icnlikesel _null_ _null_ _null_ ));
+DESCR("restriction selectivity of NOT ILIKE");
+DATA(insert OID = 1816 ( iclikejoinsel		PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_  _null_ iclikejoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity of ILIKE");
+DATA(insert OID = 1817 ( icnlikejoinsel		PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_  _null_ icnlikejoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity of NOT ILIKE");
+DATA(insert OID = 1818 ( regexeqsel			PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_	regexeqsel _null_ _null_ _null_ ));
+DESCR("restriction selectivity of regex match");
+DATA(insert OID = 1819 ( likesel			PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_	likesel _null_ _null_ _null_ ));
+DESCR("restriction selectivity of LIKE");
+DATA(insert OID = 1820 ( icregexeqsel		PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_	icregexeqsel _null_ _null_ _null_ ));
+DESCR("restriction selectivity of case-insensitive regex match");
+DATA(insert OID = 1821 ( regexnesel			PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_	regexnesel _null_ _null_ _null_ ));
+DESCR("restriction selectivity of regex non-match");
+DATA(insert OID = 1822 ( nlikesel			PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_	nlikesel _null_ _null_ _null_ ));
+DESCR("restriction selectivity of NOT LIKE");
+DATA(insert OID = 1823 ( icregexnesel		PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_	icregexnesel _null_ _null_ _null_ ));
+DESCR("restriction selectivity of case-insensitive regex non-match");
+DATA(insert OID = 1824 ( regexeqjoinsel		PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_  _null_ regexeqjoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity of regex match");
+DATA(insert OID = 1825 ( likejoinsel		PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_  _null_ likejoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity of LIKE");
+DATA(insert OID = 1826 ( icregexeqjoinsel	PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_  _null_ icregexeqjoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity of case-insensitive regex match");
+DATA(insert OID = 1827 ( regexnejoinsel		PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_  _null_ regexnejoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity of regex non-match");
+DATA(insert OID = 1828 ( nlikejoinsel		PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_  _null_ nlikejoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity of NOT LIKE");
+DATA(insert OID = 1829 ( icregexnejoinsel	PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_  _null_ icregexnejoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity of case-insensitive regex non-match");
+
+/* Aggregate-related functions */
+DATA(insert OID = 1830 (  float8_avg	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ _null_ float8_avg _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2512 (  float8_var_pop   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ _null_ float8_var_pop _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 1831 (  float8_var_samp  PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ _null_ float8_var_samp _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2513 (  float8_stddev_pop PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ _null_ float8_stddev_pop _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 1832 (  float8_stddev_samp	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ _null_ float8_stddev_samp _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 1833 (  numeric_accum    PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 1700" _null_ _null_ _null_ _null_ _null_ numeric_accum _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 2858 (  numeric_avg_accum    PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 1700" _null_ _null_ _null_ _null_ _null_ numeric_avg_accum _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 3548 (  numeric_accum_inv    PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 1700" _null_ _null_ _null_ _null_ _null_ numeric_accum_inv _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 1834 (  int2_accum	   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 21" _null_ _null_ _null_ _null_ _null_ int2_accum _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 1835 (  int4_accum	   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 23" _null_ _null_ _null_ _null_ _null_ int4_accum _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 1836 (  int8_accum	   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 20" _null_ _null_ _null_ _null_ _null_ int8_accum _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 2746 (  int8_avg_accum	   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 20" _null_ _null_ _null_ _null_ _null_ int8_avg_accum _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 3567 (  int2_accum_inv   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 21" _null_ _null_ _null_ _null_ _null_ int2_accum_inv _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 3568 (  int4_accum_inv   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 23" _null_ _null_ _null_ _null_ _null_ int4_accum_inv _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 3569 (  int8_accum_inv   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 20" _null_ _null_ _null_ _null_ _null_ int8_accum_inv _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 3387 (  int8_avg_accum_inv   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 20" _null_ _null_ _null_ _null_ _null_ int8_avg_accum_inv _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 3178 (  numeric_sum	   PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ _null_ numeric_sum _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 1837 (  numeric_avg	   PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ _null_ numeric_avg _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2514 (  numeric_var_pop  PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ _null_ numeric_var_pop _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 1838 (  numeric_var_samp PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ _null_ numeric_var_samp _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2596 (  numeric_stddev_pop PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ _null_	numeric_stddev_pop _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 1839 (  numeric_stddev_samp	PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ _null_ numeric_stddev_samp _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 1840 (  int2_sum		   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 20 "20 21" _null_ _null_ _null_ _null_ _null_ int2_sum _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 1841 (  int4_sum		   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 20 "20 23" _null_ _null_ _null_ _null_ _null_ int4_sum _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 1842 (  int8_sum		   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 1700 "1700 20" _null_ _null_ _null_ _null_ _null_ int8_sum _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 3388 (  numeric_poly_sum	   PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ _null_ numeric_poly_sum _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3389 (  numeric_poly_avg	   PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ _null_ numeric_poly_avg _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3390 (  numeric_poly_var_pop	PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ _null_ numeric_poly_var_pop _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3391 (  numeric_poly_var_samp PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ _null_ numeric_poly_var_samp _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3392 (  numeric_poly_stddev_pop PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ _null_ numeric_poly_stddev_pop _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3393 (  numeric_poly_stddev_samp	PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ _null_ numeric_poly_stddev_samp _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+
+DATA(insert OID = 1843 (  interval_accum   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1187 "1187 1186" _null_ _null_ _null_ _null_ _null_ interval_accum _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 3549 (  interval_accum_inv   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1187 "1187 1186" _null_ _null_ _null_ _null_ _null_ interval_accum_inv _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 1844 (  interval_avg	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1186 "1187" _null_ _null_ _null_ _null_ _null_ interval_avg _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 1962 (  int2_avg_accum   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1016 "1016 21" _null_ _null_ _null_ _null_ _null_ int2_avg_accum _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 1963 (  int4_avg_accum   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1016 "1016 23" _null_ _null_ _null_ _null_ _null_ int4_avg_accum _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 3570 (  int2_avg_accum_inv   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1016 "1016 21" _null_ _null_ _null_ _null_ _null_ int2_avg_accum_inv _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 3571 (  int4_avg_accum_inv   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1016 "1016 23" _null_ _null_ _null_ _null_ _null_ int4_avg_accum_inv _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 1964 (  int8_avg		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1016" _null_ _null_ _null_ _null_ _null_ int8_avg _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3572 (  int2int4_sum	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "1016" _null_ _null_ _null_ _null_ _null_ int2int4_sum _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2805 (  int8inc_float8_float8		PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 20 "20 701 701" _null_ _null_ _null_ _null_ _null_ int8inc_float8_float8 _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 2806 (  float8_regr_accum			PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1022 "1022 701 701" _null_ _null_ _null_ _null_ _null_ float8_regr_accum _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 2807 (  float8_regr_sxx			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ _null_ float8_regr_sxx _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2808 (  float8_regr_syy			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ _null_ float8_regr_syy _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2809 (  float8_regr_sxy			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ _null_ float8_regr_sxy _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2810 (  float8_regr_avgx			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ _null_ float8_regr_avgx _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2811 (  float8_regr_avgy			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ _null_ float8_regr_avgy _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2812 (  float8_regr_r2			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ _null_ float8_regr_r2 _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2813 (  float8_regr_slope			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ _null_ float8_regr_slope _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2814 (  float8_regr_intercept		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ _null_ float8_regr_intercept _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2815 (  float8_covar_pop			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ _null_ float8_covar_pop _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2816 (  float8_covar_samp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ _null_ float8_covar_samp _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2817 (  float8_corr				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ _null_ float8_corr _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+
+DATA(insert OID = 3535 (  string_agg_transfn		PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 2281 "2281 25 25" _null_ _null_ _null_ _null_ _null_ string_agg_transfn _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 3536 (  string_agg_finalfn		PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 25 "2281" _null_ _null_ _null_ _null_ _null_ string_agg_finalfn _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3538 (  string_agg				PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("concatenate aggregate input into a string");
+DATA(insert OID = 3543 (  bytea_string_agg_transfn	PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 2281 "2281 17 17" _null_ _null_ _null_ _null_ _null_ bytea_string_agg_transfn _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 3544 (  bytea_string_agg_finalfn	PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 17 "2281" _null_ _null_ _null_ _null_ _null_ bytea_string_agg_finalfn _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3545 (  string_agg				PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 17 "17 17" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("concatenate aggregate input into a bytea");
+
+/* To ASCII conversion */
+DATA(insert OID = 1845 ( to_ascii	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ to_ascii_default _null_ _null_ _null_ ));
+DESCR("encode text from DB encoding to ASCII text");
+DATA(insert OID = 1846 ( to_ascii	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ _null_ to_ascii_enc _null_ _null_ _null_ ));
+DESCR("encode text from encoding to ASCII text");
+DATA(insert OID = 1847 ( to_ascii	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 19" _null_ _null_ _null_ _null_ _null_ to_ascii_encname _null_ _null_ _null_ ));
+DESCR("encode text from encoding to ASCII text");
+
+DATA(insert OID = 1848 ( interval_pl_time	PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 1083 "1186 1083" _null_ _null_ _null_ _null_ _null_ "select $2 + $1" _null_ _null_ _null_ ));
+
+DATA(insert OID = 1850 (  int28eq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 20" _null_ _null_ _null_ _null_ _null_ int28eq _null_ _null_ _null_ ));
+DATA(insert OID = 1851 (  int28ne		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 20" _null_ _null_ _null_ _null_ _null_ int28ne _null_ _null_ _null_ ));
+DATA(insert OID = 1852 (  int28lt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 20" _null_ _null_ _null_ _null_ _null_ int28lt _null_ _null_ _null_ ));
+DATA(insert OID = 1853 (  int28gt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 20" _null_ _null_ _null_ _null_ _null_ int28gt _null_ _null_ _null_ ));
+DATA(insert OID = 1854 (  int28le		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 20" _null_ _null_ _null_ _null_ _null_ int28le _null_ _null_ _null_ ));
+DATA(insert OID = 1855 (  int28ge		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 20" _null_ _null_ _null_ _null_ _null_ int28ge _null_ _null_ _null_ ));
+
+DATA(insert OID = 1856 (  int82eq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 21" _null_ _null_ _null_ _null_ _null_ int82eq _null_ _null_ _null_ ));
+DATA(insert OID = 1857 (  int82ne		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 21" _null_ _null_ _null_ _null_ _null_ int82ne _null_ _null_ _null_ ));
+DATA(insert OID = 1858 (  int82lt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 21" _null_ _null_ _null_ _null_ _null_ int82lt _null_ _null_ _null_ ));
+DATA(insert OID = 1859 (  int82gt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 21" _null_ _null_ _null_ _null_ _null_ int82gt _null_ _null_ _null_ ));
+DATA(insert OID = 1860 (  int82le		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 21" _null_ _null_ _null_ _null_ _null_ int82le _null_ _null_ _null_ ));
+DATA(insert OID = 1861 (  int82ge		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 21" _null_ _null_ _null_ _null_ _null_ int82ge _null_ _null_ _null_ ));
+
+DATA(insert OID = 1892 (  int2and		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ _null_ int2and _null_ _null_ _null_ ));
+DATA(insert OID = 1893 (  int2or		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ _null_ int2or _null_ _null_ _null_ ));
+DATA(insert OID = 1894 (  int2xor		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ _null_ int2xor _null_ _null_ _null_ ));
+DATA(insert OID = 1895 (  int2not		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ _null_ int2not _null_ _null_ _null_ ));
+DATA(insert OID = 1896 (  int2shl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 23" _null_ _null_ _null_ _null_ _null_ int2shl _null_ _null_ _null_ ));
+DATA(insert OID = 1897 (  int2shr		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 23" _null_ _null_ _null_ _null_ _null_ int2shr _null_ _null_ _null_ ));
+
+DATA(insert OID = 1898 (  int4and		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ _null_ int4and _null_ _null_ _null_ ));
+DATA(insert OID = 1899 (  int4or		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ _null_ int4or _null_ _null_ _null_ ));
+DATA(insert OID = 1900 (  int4xor		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ _null_ int4xor _null_ _null_ _null_ ));
+DATA(insert OID = 1901 (  int4not		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ int4not _null_ _null_ _null_ ));
+DATA(insert OID = 1902 (  int4shl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ _null_ int4shl _null_ _null_ _null_ ));
+DATA(insert OID = 1903 (  int4shr		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ _null_ int4shr _null_ _null_ _null_ ));
+
+DATA(insert OID = 1904 (  int8and		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ _null_ int8and _null_ _null_ _null_ ));
+DATA(insert OID = 1905 (  int8or		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ _null_ int8or _null_ _null_ _null_ ));
+DATA(insert OID = 1906 (  int8xor		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ _null_ int8xor _null_ _null_ _null_ ));
+DATA(insert OID = 1907 (  int8not		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ _null_ int8not _null_ _null_ _null_ ));
+DATA(insert OID = 1908 (  int8shl		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 23" _null_ _null_ _null_ _null_ _null_ int8shl _null_ _null_ _null_ ));
+DATA(insert OID = 1909 (  int8shr		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 23" _null_ _null_ _null_ _null_ _null_ int8shr _null_ _null_ _null_ ));
+
+DATA(insert OID = 1910 (  int8up		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ _null_ int8up _null_ _null_ _null_ ));
+DATA(insert OID = 1911 (  int2up		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ _null_ int2up _null_ _null_ _null_ ));
+DATA(insert OID = 1912 (  int4up		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ int4up _null_ _null_ _null_ ));
+DATA(insert OID = 1913 (  float4up		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "700" _null_ _null_ _null_ _null_ _null_ float4up _null_ _null_ _null_ ));
+DATA(insert OID = 1914 (  float8up		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_ float8up _null_ _null_ _null_ ));
+DATA(insert OID = 1915 (  numeric_uplus    PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_uplus _null_ _null_ _null_ ));
+
+DATA(insert OID = 1922 (  has_table_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ _null_	has_table_privilege_name_name _null_ _null_ _null_ ));
+DESCR("user privilege on relation by username, rel name");
+DATA(insert OID = 1923 (  has_table_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ _null_	has_table_privilege_name_id _null_ _null_ _null_ ));
+DESCR("user privilege on relation by username, rel oid");
+DATA(insert OID = 1924 (  has_table_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ _null_	has_table_privilege_id_name _null_ _null_ _null_ ));
+DESCR("user privilege on relation by user oid, rel name");
+DATA(insert OID = 1925 (  has_table_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ _null_	has_table_privilege_id_id _null_ _null_ _null_ ));
+DESCR("user privilege on relation by user oid, rel oid");
+DATA(insert OID = 1926 (  has_table_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ has_table_privilege_name _null_ _null_ _null_ ));
+DESCR("current user privilege on relation by rel name");
+DATA(insert OID = 1927 (  has_table_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ _null_ has_table_privilege_id _null_ _null_ _null_ ));
+DESCR("current user privilege on relation by rel oid");
+
+DATA(insert OID = 2181 (  has_sequence_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ _null_	has_sequence_privilege_name_name _null_ _null_ _null_ ));
+DESCR("user privilege on sequence by username, seq name");
+DATA(insert OID = 2182 (  has_sequence_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ _null_	has_sequence_privilege_name_id _null_ _null_ _null_ ));
+DESCR("user privilege on sequence by username, seq oid");
+DATA(insert OID = 2183 (  has_sequence_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ _null_	has_sequence_privilege_id_name _null_ _null_ _null_ ));
+DESCR("user privilege on sequence by user oid, seq name");
+DATA(insert OID = 2184 (  has_sequence_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ _null_	has_sequence_privilege_id_id _null_ _null_ _null_ ));
+DESCR("user privilege on sequence by user oid, seq oid");
+DATA(insert OID = 2185 (  has_sequence_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ has_sequence_privilege_name _null_ _null_ _null_ ));
+DESCR("current user privilege on sequence by seq name");
+DATA(insert OID = 2186 (  has_sequence_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ _null_ has_sequence_privilege_id _null_ _null_ _null_ ));
+DESCR("current user privilege on sequence by seq oid");
+
+DATA(insert OID = 3012 (  has_column_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 16 "19 25 25 25" _null_ _null_ _null_ _null_ _null_ has_column_privilege_name_name_name _null_ _null_ _null_ ));
+DESCR("user privilege on column by username, rel name, col name");
+DATA(insert OID = 3013 (  has_column_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 16 "19 25 21 25" _null_ _null_ _null_ _null_ _null_ has_column_privilege_name_name_attnum _null_ _null_ _null_ ));
+DESCR("user privilege on column by username, rel name, col attnum");
+DATA(insert OID = 3014 (  has_column_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 16 "19 26 25 25" _null_ _null_ _null_ _null_ _null_ has_column_privilege_name_id_name _null_ _null_ _null_ ));
+DESCR("user privilege on column by username, rel oid, col name");
+DATA(insert OID = 3015 (  has_column_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 16 "19 26 21 25" _null_ _null_ _null_ _null_ _null_ has_column_privilege_name_id_attnum _null_ _null_ _null_ ));
+DESCR("user privilege on column by username, rel oid, col attnum");
+DATA(insert OID = 3016 (  has_column_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 16 "26 25 25 25" _null_ _null_ _null_ _null_ _null_ has_column_privilege_id_name_name _null_ _null_ _null_ ));
+DESCR("user privilege on column by user oid, rel name, col name");
+DATA(insert OID = 3017 (  has_column_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 16 "26 25 21 25" _null_ _null_ _null_ _null_ _null_ has_column_privilege_id_name_attnum _null_ _null_ _null_ ));
+DESCR("user privilege on column by user oid, rel name, col attnum");
+DATA(insert OID = 3018 (  has_column_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 16 "26 26 25 25" _null_ _null_ _null_ _null_ _null_ has_column_privilege_id_id_name _null_ _null_ _null_ ));
+DESCR("user privilege on column by user oid, rel oid, col name");
+DATA(insert OID = 3019 (  has_column_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 16 "26 26 21 25" _null_ _null_ _null_ _null_ _null_ has_column_privilege_id_id_attnum _null_ _null_ _null_ ));
+DESCR("user privilege on column by user oid, rel oid, col attnum");
+DATA(insert OID = 3020 (  has_column_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "25 25 25" _null_ _null_ _null_ _null_ _null_ has_column_privilege_name_name _null_ _null_ _null_ ));
+DESCR("current user privilege on column by rel name, col name");
+DATA(insert OID = 3021 (  has_column_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "25 21 25" _null_ _null_ _null_ _null_ _null_ has_column_privilege_name_attnum _null_ _null_ _null_ ));
+DESCR("current user privilege on column by rel name, col attnum");
+DATA(insert OID = 3022 (  has_column_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ _null_ has_column_privilege_id_name _null_ _null_ _null_ ));
+DESCR("current user privilege on column by rel oid, col name");
+DATA(insert OID = 3023 (  has_column_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 21 25" _null_ _null_ _null_ _null_ _null_ has_column_privilege_id_attnum _null_ _null_ _null_ ));
+DESCR("current user privilege on column by rel oid, col attnum");
+
+DATA(insert OID = 3024 (  has_any_column_privilege	   PGNSP PGUID 12 10 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ _null_	has_any_column_privilege_name_name _null_ _null_ _null_ ));
+DESCR("user privilege on any column by username, rel name");
+DATA(insert OID = 3025 (  has_any_column_privilege	   PGNSP PGUID 12 10 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ _null_	has_any_column_privilege_name_id _null_ _null_ _null_ ));
+DESCR("user privilege on any column by username, rel oid");
+DATA(insert OID = 3026 (  has_any_column_privilege	   PGNSP PGUID 12 10 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ _null_	has_any_column_privilege_id_name _null_ _null_ _null_ ));
+DESCR("user privilege on any column by user oid, rel name");
+DATA(insert OID = 3027 (  has_any_column_privilege	   PGNSP PGUID 12 10 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ _null_	has_any_column_privilege_id_id _null_ _null_ _null_ ));
+DESCR("user privilege on any column by user oid, rel oid");
+DATA(insert OID = 3028 (  has_any_column_privilege	   PGNSP PGUID 12 10 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ has_any_column_privilege_name _null_ _null_ _null_ ));
+DESCR("current user privilege on any column by rel name");
+DATA(insert OID = 3029 (  has_any_column_privilege	   PGNSP PGUID 12 10 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ _null_ has_any_column_privilege_id _null_ _null_ _null_ ));
+DESCR("current user privilege on any column by rel oid");
+
+DATA(insert OID = 1928 (  pg_stat_get_numscans			PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_numscans _null_ _null_ _null_ ));
+DESCR("statistics: number of scans done for table/index");
+DATA(insert OID = 1929 (  pg_stat_get_tuples_returned	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_tuples_returned _null_ _null_ _null_ ));
+DESCR("statistics: number of tuples read by seqscan");
+DATA(insert OID = 1930 (  pg_stat_get_tuples_fetched	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_tuples_fetched _null_ _null_ _null_ ));
+DESCR("statistics: number of tuples fetched by idxscan");
+DATA(insert OID = 1931 (  pg_stat_get_tuples_inserted	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_tuples_inserted _null_ _null_ _null_ ));
+DESCR("statistics: number of tuples inserted");
+DATA(insert OID = 1932 (  pg_stat_get_tuples_updated	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_tuples_updated _null_ _null_ _null_ ));
+DESCR("statistics: number of tuples updated");
+DATA(insert OID = 1933 (  pg_stat_get_tuples_deleted	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_tuples_deleted _null_ _null_ _null_ ));
+DESCR("statistics: number of tuples deleted");
+DATA(insert OID = 1972 (  pg_stat_get_tuples_hot_updated PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_tuples_hot_updated _null_ _null_ _null_ ));
+DESCR("statistics: number of tuples hot updated");
+DATA(insert OID = 2878 (  pg_stat_get_live_tuples	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_live_tuples _null_ _null_ _null_ ));
+DESCR("statistics: number of live tuples");
+DATA(insert OID = 2879 (  pg_stat_get_dead_tuples	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_dead_tuples _null_ _null_ _null_ ));
+DESCR("statistics: number of dead tuples");
+DATA(insert OID = 3177 (  pg_stat_get_mod_since_analyze PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_mod_since_analyze _null_ _null_ _null_ ));
+DESCR("statistics: number of tuples changed since last analyze");
+DATA(insert OID = 1934 (  pg_stat_get_blocks_fetched	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_blocks_fetched _null_ _null_ _null_ ));
+DESCR("statistics: number of blocks fetched");
+DATA(insert OID = 1935 (  pg_stat_get_blocks_hit		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_blocks_hit _null_ _null_ _null_ ));
+DESCR("statistics: number of blocks found in cache");
+DATA(insert OID = 2781 (  pg_stat_get_last_vacuum_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "26" _null_ _null_ _null_ _null_ _null_	pg_stat_get_last_vacuum_time _null_ _null_ _null_ ));
+DESCR("statistics: last manual vacuum time for a table");
+DATA(insert OID = 2782 (  pg_stat_get_last_autovacuum_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "26" _null_ _null_ _null_ _null_ _null_	pg_stat_get_last_autovacuum_time _null_ _null_ _null_ ));
+DESCR("statistics: last auto vacuum time for a table");
+DATA(insert OID = 2783 (  pg_stat_get_last_analyze_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "26" _null_ _null_ _null_ _null_ _null_	pg_stat_get_last_analyze_time _null_ _null_ _null_ ));
+DESCR("statistics: last manual analyze time for a table");
+DATA(insert OID = 2784 (  pg_stat_get_last_autoanalyze_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "26" _null_ _null_ _null_ _null_ _null_	pg_stat_get_last_autoanalyze_time _null_ _null_ _null_ ));
+DESCR("statistics: last auto analyze time for a table");
+DATA(insert OID = 3054 ( pg_stat_get_vacuum_count PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_vacuum_count _null_ _null_ _null_ ));
+DESCR("statistics: number of manual vacuums for a table");
+DATA(insert OID = 3055 ( pg_stat_get_autovacuum_count PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_autovacuum_count _null_ _null_ _null_ ));
+DESCR("statistics: number of auto vacuums for a table");
+DATA(insert OID = 3056 ( pg_stat_get_analyze_count PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_analyze_count _null_ _null_ _null_ ));
+DESCR("statistics: number of manual analyzes for a table");
+DATA(insert OID = 3057 ( pg_stat_get_autoanalyze_count PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_autoanalyze_count _null_ _null_ _null_ ));
+DESCR("statistics: number of auto analyzes for a table");
+DATA(insert OID = 1936 (  pg_stat_get_backend_idset		PGNSP PGUID 12 1 100 0 0 f f f f t t s 0 0 23 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_backend_idset _null_ _null_ _null_ ));
+DESCR("statistics: currently active backend IDs");
+DATA(insert OID = 2022 (  pg_stat_get_activity			PGNSP PGUID 12 1 100 0 0 f f f f f t s 1 0 2249 "23" "{23,26,23,26,25,25,25,16,1184,1184,1184,1184,869,25,23,28,28,16,25,25,23,16,25}" "{i,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{pid,datid,pid,usesysid,application_name,state,query,waiting,xact_start,query_start,backend_start,state_change,client_addr,client_hostname,client_port,backend_xid,backend_xmin,ssl,sslversion,sslcipher,sslbits,sslcompression,sslclientdn}" _null_ _null_ pg_stat_get_activity _null_ _null_ _null_ ));
+DESCR("statistics: information about currently active backends");
+DATA(insert OID = 3099 (  pg_stat_get_wal_senders	PGNSP PGUID 12 1 10 0 0 f f f f f t s 0 0 2249 "" "{23,25,3220,3220,3220,3220,23,25}" "{o,o,o,o,o,o,o,o}" "{pid,state,sent_location,write_location,flush_location,replay_location,sync_priority,sync_state}" _null_ _null_ pg_stat_get_wal_senders _null_ _null_ _null_ ));
+DESCR("statistics: information about currently active replication");
+DATA(insert OID = 2026 (  pg_backend_pid				PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 23 "" _null_ _null_ _null_ _null_ _null_ pg_backend_pid _null_ _null_ _null_ ));
+DESCR("statistics: current backend PID");
+DATA(insert OID = 1937 (  pg_stat_get_backend_pid		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ pg_stat_get_backend_pid _null_ _null_ _null_ ));
+DESCR("statistics: PID of backend");
+DATA(insert OID = 1938 (  pg_stat_get_backend_dbid		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 26 "23" _null_ _null_ _null_ _null_ _null_ pg_stat_get_backend_dbid _null_ _null_ _null_ ));
+DESCR("statistics: database ID of backend");
+DATA(insert OID = 1939 (  pg_stat_get_backend_userid	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 26 "23" _null_ _null_ _null_ _null_ _null_ pg_stat_get_backend_userid _null_ _null_ _null_ ));
+DESCR("statistics: user ID of backend");
+DATA(insert OID = 1940 (  pg_stat_get_backend_activity	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "23" _null_ _null_ _null_ _null_ _null_ pg_stat_get_backend_activity _null_ _null_ _null_ ));
+DESCR("statistics: current query of backend");
+DATA(insert OID = 2853 (  pg_stat_get_backend_waiting	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "23" _null_ _null_ _null_ _null_ _null_ pg_stat_get_backend_waiting _null_ _null_ _null_ ));
+DESCR("statistics: is backend currently waiting for a lock");
+DATA(insert OID = 2094 (  pg_stat_get_backend_activity_start PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "23" _null_ _null_ _null_ _null_ _null_ pg_stat_get_backend_activity_start _null_ _null_ _null_ ));
+DESCR("statistics: start time for current query of backend");
+DATA(insert OID = 2857 (  pg_stat_get_backend_xact_start PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "23" _null_ _null_ _null_ _null_ _null_ pg_stat_get_backend_xact_start _null_ _null_ _null_ ));
+DESCR("statistics: start time for backend's current transaction");
+DATA(insert OID = 1391 ( pg_stat_get_backend_start PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "23" _null_ _null_ _null_ _null_ _null_ pg_stat_get_backend_start _null_ _null_ _null_ ));
+DESCR("statistics: start time for current backend session");
+DATA(insert OID = 1392 ( pg_stat_get_backend_client_addr PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 869 "23" _null_ _null_ _null_ _null_ _null_ pg_stat_get_backend_client_addr _null_ _null_ _null_ ));
+DESCR("statistics: address of client connected to backend");
+DATA(insert OID = 1393 ( pg_stat_get_backend_client_port PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ pg_stat_get_backend_client_port _null_ _null_ _null_ ));
+DESCR("statistics: port number of client connected to backend");
+DATA(insert OID = 1941 (  pg_stat_get_db_numbackends	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 23 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_numbackends _null_ _null_ _null_ ));
+DESCR("statistics: number of backends in database");
+DATA(insert OID = 1942 (  pg_stat_get_db_xact_commit	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_xact_commit _null_ _null_ _null_ ));
+DESCR("statistics: transactions committed");
+DATA(insert OID = 1943 (  pg_stat_get_db_xact_rollback	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_xact_rollback _null_ _null_ _null_ ));
+DESCR("statistics: transactions rolled back");
+DATA(insert OID = 1944 (  pg_stat_get_db_blocks_fetched PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_blocks_fetched _null_ _null_ _null_ ));
+DESCR("statistics: blocks fetched for database");
+DATA(insert OID = 1945 (  pg_stat_get_db_blocks_hit		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_blocks_hit _null_ _null_ _null_ ));
+DESCR("statistics: blocks found in cache for database");
+DATA(insert OID = 2758 (  pg_stat_get_db_tuples_returned PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_tuples_returned _null_ _null_ _null_ ));
+DESCR("statistics: tuples returned for database");
+DATA(insert OID = 2759 (  pg_stat_get_db_tuples_fetched PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_tuples_fetched _null_ _null_ _null_ ));
+DESCR("statistics: tuples fetched for database");
+DATA(insert OID = 2760 (  pg_stat_get_db_tuples_inserted PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_tuples_inserted _null_ _null_ _null_ ));
+DESCR("statistics: tuples inserted in database");
+DATA(insert OID = 2761 (  pg_stat_get_db_tuples_updated PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_tuples_updated _null_ _null_ _null_ ));
+DESCR("statistics: tuples updated in database");
+DATA(insert OID = 2762 (  pg_stat_get_db_tuples_deleted PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_tuples_deleted _null_ _null_ _null_ ));
+DESCR("statistics: tuples deleted in database");
+DATA(insert OID = 3065 (  pg_stat_get_db_conflict_tablespace PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_conflict_tablespace _null_ _null_ _null_ ));
+DESCR("statistics: recovery conflicts in database caused by drop tablespace");
+DATA(insert OID = 3066 (  pg_stat_get_db_conflict_lock PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_conflict_lock _null_ _null_ _null_ ));
+DESCR("statistics: recovery conflicts in database caused by relation lock");
+DATA(insert OID = 3067 (  pg_stat_get_db_conflict_snapshot PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_conflict_snapshot _null_ _null_ _null_ ));
+DESCR("statistics: recovery conflicts in database caused by snapshot expiry");
+DATA(insert OID = 3068 (  pg_stat_get_db_conflict_bufferpin PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_conflict_bufferpin _null_ _null_ _null_ ));
+DESCR("statistics: recovery conflicts in database caused by shared buffer pin");
+DATA(insert OID = 3069 (  pg_stat_get_db_conflict_startup_deadlock PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_conflict_startup_deadlock _null_ _null_ _null_ ));
+DESCR("statistics: recovery conflicts in database caused by buffer deadlock");
+DATA(insert OID = 3070 (  pg_stat_get_db_conflict_all PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_conflict_all _null_ _null_ _null_ ));
+DESCR("statistics: recovery conflicts in database");
+DATA(insert OID = 3152 (  pg_stat_get_db_deadlocks PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_deadlocks _null_ _null_ _null_ ));
+DESCR("statistics: deadlocks detected in database");
+DATA(insert OID = 3074 (  pg_stat_get_db_stat_reset_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_stat_reset_time _null_ _null_ _null_ ));
+DESCR("statistics: last reset for a database");
+DATA(insert OID = 3150 (  pg_stat_get_db_temp_files PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_temp_files _null_ _null_ _null_ ));
+DESCR("statistics: number of temporary files written");
+DATA(insert OID = 3151 (  pg_stat_get_db_temp_bytes PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_temp_bytes _null_ _null_ _null_ ));
+DESCR("statistics: number of bytes in temporary files written");
+DATA(insert OID = 2844 (  pg_stat_get_db_blk_read_time	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 701 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_blk_read_time _null_ _null_ _null_ ));
+DESCR("statistics: block read time, in msec");
+DATA(insert OID = 2845 (  pg_stat_get_db_blk_write_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 701 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_blk_write_time _null_ _null_ _null_ ));
+DESCR("statistics: block write time, in msec");
+DATA(insert OID = 3195 (  pg_stat_get_archiver		PGNSP PGUID 12 1 0 0 0 f f f f f f s 0 0 2249 "" "{20,25,1184,20,25,1184,1184}" "{o,o,o,o,o,o,o}" "{archived_count,last_archived_wal,last_archived_time,failed_count,last_failed_wal,last_failed_time,stats_reset}" _null_ _null_ pg_stat_get_archiver _null_ _null_ _null_ ));
+DESCR("statistics: information about WAL archiver");
+DATA(insert OID = 2769 ( pg_stat_get_bgwriter_timed_checkpoints PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_timed_checkpoints _null_ _null_ _null_ ));
+DESCR("statistics: number of timed checkpoints started by the bgwriter");
+DATA(insert OID = 2770 ( pg_stat_get_bgwriter_requested_checkpoints PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_requested_checkpoints _null_ _null_ _null_ ));
+DESCR("statistics: number of backend requested checkpoints started by the bgwriter");
+DATA(insert OID = 2771 ( pg_stat_get_bgwriter_buf_written_checkpoints PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_buf_written_checkpoints _null_ _null_ _null_ ));
+DESCR("statistics: number of buffers written by the bgwriter during checkpoints");
+DATA(insert OID = 2772 ( pg_stat_get_bgwriter_buf_written_clean PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_buf_written_clean _null_ _null_ _null_ ));
+DESCR("statistics: number of buffers written by the bgwriter for cleaning dirty buffers");
+DATA(insert OID = 2773 ( pg_stat_get_bgwriter_maxwritten_clean PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_maxwritten_clean _null_ _null_ _null_ ));
+DESCR("statistics: number of times the bgwriter stopped processing when it had written too many buffers while cleaning");
+DATA(insert OID = 3075 ( pg_stat_get_bgwriter_stat_reset_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ _null_	pg_stat_get_bgwriter_stat_reset_time _null_ _null_ _null_ ));
+DESCR("statistics: last reset for the bgwriter");
+DATA(insert OID = 3160 ( pg_stat_get_checkpoint_write_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 701 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_checkpoint_write_time _null_ _null_ _null_ ));
+DESCR("statistics: checkpoint time spent writing buffers to disk, in msec");
+DATA(insert OID = 3161 ( pg_stat_get_checkpoint_sync_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 701 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_checkpoint_sync_time _null_ _null_ _null_ ));
+DESCR("statistics: checkpoint time spent synchronizing buffers to disk, in msec");
+DATA(insert OID = 2775 ( pg_stat_get_buf_written_backend PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_buf_written_backend _null_ _null_ _null_ ));
+DESCR("statistics: number of buffers written by backends");
+DATA(insert OID = 3063 ( pg_stat_get_buf_fsync_backend PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_buf_fsync_backend _null_ _null_ _null_ ));
+DESCR("statistics: number of backend buffer writes that did their own fsync");
+DATA(insert OID = 2859 ( pg_stat_get_buf_alloc			PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_buf_alloc _null_ _null_ _null_ ));
+DESCR("statistics: number of buffer allocations");
+
+DATA(insert OID = 2978 (  pg_stat_get_function_calls		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_function_calls _null_ _null_ _null_ ));
+DESCR("statistics: number of function calls");
+DATA(insert OID = 2979 (  pg_stat_get_function_total_time	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 701 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_function_total_time _null_ _null_ _null_ ));
+DESCR("statistics: total execution time of function, in msec");
+DATA(insert OID = 2980 (  pg_stat_get_function_self_time	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 701 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_function_self_time _null_ _null_ _null_ ));
+DESCR("statistics: self execution time of function, in msec");
+
+DATA(insert OID = 3037 (  pg_stat_get_xact_numscans				PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_xact_numscans _null_ _null_ _null_ ));
+DESCR("statistics: number of scans done for table/index in current transaction");
+DATA(insert OID = 3038 (  pg_stat_get_xact_tuples_returned		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_returned _null_ _null_ _null_ ));
+DESCR("statistics: number of tuples read by seqscan in current transaction");
+DATA(insert OID = 3039 (  pg_stat_get_xact_tuples_fetched		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_fetched _null_ _null_ _null_ ));
+DESCR("statistics: number of tuples fetched by idxscan in current transaction");
+DATA(insert OID = 3040 (  pg_stat_get_xact_tuples_inserted		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_inserted _null_ _null_ _null_ ));
+DESCR("statistics: number of tuples inserted in current transaction");
+DATA(insert OID = 3041 (  pg_stat_get_xact_tuples_updated		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_updated _null_ _null_ _null_ ));
+DESCR("statistics: number of tuples updated in current transaction");
+DATA(insert OID = 3042 (  pg_stat_get_xact_tuples_deleted		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_deleted _null_ _null_ _null_ ));
+DESCR("statistics: number of tuples deleted in current transaction");
+DATA(insert OID = 3043 (  pg_stat_get_xact_tuples_hot_updated	PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_hot_updated _null_ _null_ _null_ ));
+DESCR("statistics: number of tuples hot updated in current transaction");
+DATA(insert OID = 3044 (  pg_stat_get_xact_blocks_fetched		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_xact_blocks_fetched _null_ _null_ _null_ ));
+DESCR("statistics: number of blocks fetched in current transaction");
+DATA(insert OID = 3045 (  pg_stat_get_xact_blocks_hit			PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_xact_blocks_hit _null_ _null_ _null_ ));
+DESCR("statistics: number of blocks found in cache in current transaction");
+DATA(insert OID = 3046 (  pg_stat_get_xact_function_calls		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_xact_function_calls _null_ _null_ _null_ ));
+DESCR("statistics: number of function calls in current transaction");
+DATA(insert OID = 3047 (  pg_stat_get_xact_function_total_time	PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 701 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_xact_function_total_time _null_ _null_ _null_ ));
+DESCR("statistics: total execution time of function in current transaction, in msec");
+DATA(insert OID = 3048 (  pg_stat_get_xact_function_self_time	PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 701 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_xact_function_self_time _null_ _null_ _null_ ));
+DESCR("statistics: self execution time of function in current transaction, in msec");
+
+DATA(insert OID = 3788 (  pg_stat_get_snapshot_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ _null_	pg_stat_get_snapshot_timestamp _null_ _null_ _null_ ));
+DESCR("statistics: timestamp of the current statistics snapshot");
+DATA(insert OID = 2230 (  pg_stat_clear_snapshot		PGNSP PGUID 12 1 0 0 0 f f f f f f v 0 0 2278 "" _null_ _null_ _null_ _null_ _null_ pg_stat_clear_snapshot _null_ _null_ _null_ ));
+DESCR("statistics: discard current transaction's statistics snapshot");
+DATA(insert OID = 2274 (  pg_stat_reset					PGNSP PGUID 12 1 0 0 0 f f f f f f v 0 0 2278 "" _null_ _null_ _null_ _null_ _null_ pg_stat_reset _null_ _null_ _null_ ));
+DESCR("statistics: reset collected statistics for current database");
+DATA(insert OID = 3775 (  pg_stat_reset_shared			PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "25" _null_ _null_ _null_ _null_ _null_	pg_stat_reset_shared _null_ _null_ _null_ ));
+DESCR("statistics: reset collected statistics shared across the cluster");
+DATA(insert OID = 3776 (  pg_stat_reset_single_table_counters	PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "26" _null_ _null_ _null_ _null_ _null_	pg_stat_reset_single_table_counters _null_ _null_ _null_ ));
+DESCR("statistics: reset collected statistics for a single table or index in the current database");
+DATA(insert OID = 3777 (  pg_stat_reset_single_function_counters	PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "26" _null_ _null_ _null_ _null_ _null_	pg_stat_reset_single_function_counters _null_ _null_ _null_ ));
+DESCR("statistics: reset collected statistics for a single function in the current database");
+
+DATA(insert OID = 3163 (  pg_trigger_depth				PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 23 "" _null_ _null_ _null_ _null_ _null_ pg_trigger_depth _null_ _null_ _null_ ));
+DESCR("current trigger depth");
+
+DATA(insert OID = 3778 ( pg_tablespace_location PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ _null_ pg_tablespace_location _null_ _null_ _null_ ));
+DESCR("tablespace location");
+
+DATA(insert OID = 1946 (  encode						PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "17 25" _null_ _null_ _null_ _null_ _null_ binary_encode _null_ _null_ _null_ ));
+DESCR("convert bytea value into some ascii-only text string");
+DATA(insert OID = 1947 (  decode						PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 17 "25 25" _null_ _null_ _null_ _null_ _null_ binary_decode _null_ _null_ _null_ ));
+DESCR("convert ascii-encoded text string into bytea value");
+
+DATA(insert OID = 1948 (  byteaeq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ _null_ byteaeq _null_ _null_ _null_ ));
+DATA(insert OID = 1949 (  bytealt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ _null_ bytealt _null_ _null_ _null_ ));
+DATA(insert OID = 1950 (  byteale		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ _null_ byteale _null_ _null_ _null_ ));
+DATA(insert OID = 1951 (  byteagt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ _null_ byteagt _null_ _null_ _null_ ));
+DATA(insert OID = 1952 (  byteage		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ _null_ byteage _null_ _null_ _null_ ));
+DATA(insert OID = 1953 (  byteane		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ _null_ byteane _null_ _null_ _null_ ));
+DATA(insert OID = 1954 (  byteacmp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "17 17" _null_ _null_ _null_ _null_ _null_ byteacmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+DATA(insert OID = 3917 (  timestamp_transform PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ timestamp_transform _null_ _null_ _null_ ));
+DESCR("transform a timestamp length coercion");
+DATA(insert OID = 3944 (  time_transform   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ time_transform _null_ _null_ _null_ ));
+DESCR("transform a time length coercion");
+
+DATA(insert OID = 1961 (  timestamp		   PGNSP PGUID 12 1 0 0 timestamp_transform f f f f t f i 2 0 1114 "1114 23" _null_ _null_ _null_ _null_ _null_ timestamp_scale _null_ _null_ _null_ ));
+DESCR("adjust timestamp precision");
+
+DATA(insert OID = 1965 (  oidlarger		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 26 "26 26" _null_ _null_ _null_ _null_ _null_ oidlarger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 1966 (  oidsmaller	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 26 "26 26" _null_ _null_ _null_ _null_ _null_ oidsmaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+
+DATA(insert OID = 1967 (  timestamptz	   PGNSP PGUID 12 1 0 0 timestamp_transform f f f f t f i 2 0 1184 "1184 23" _null_ _null_ _null_ _null_ _null_ timestamptz_scale _null_ _null_ _null_ ));
+DESCR("adjust timestamptz precision");
+DATA(insert OID = 1968 (  time			   PGNSP PGUID 12 1 0 0 time_transform f f f f t f i 2 0 1083 "1083 23" _null_ _null_ _null_ _null_ _null_ time_scale _null_ _null_ _null_ ));
+DESCR("adjust time precision");
+DATA(insert OID = 1969 (  timetz		   PGNSP PGUID 12 1 0 0 time_transform f f f f t f i 2 0 1266 "1266 23" _null_ _null_ _null_ _null_ _null_ timetz_scale _null_ _null_ _null_ ));
+DESCR("adjust time with time zone precision");
+
+DATA(insert OID = 2003 (  textanycat	   PGNSP PGUID 14 1 0 0 0 f f f f t f s 2 0 25 "25 2776" _null_ _null_ _null_ _null_ _null_ "select $1 || $2::pg_catalog.text" _null_ _null_ _null_ ));
+DATA(insert OID = 2004 (  anytextcat	   PGNSP PGUID 14 1 0 0 0 f f f f t f s 2 0 25 "2776 25" _null_ _null_ _null_ _null_ _null_ "select $1::pg_catalog.text || $2" _null_ _null_ _null_ ));
+
+DATA(insert OID = 2005 (  bytealike		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ _null_ bytealike _null_ _null_ _null_ ));
+DATA(insert OID = 2006 (  byteanlike	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ _null_ byteanlike _null_ _null_ _null_ ));
+DATA(insert OID = 2007 (  like			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ _null_ bytealike _null_ _null_ _null_ ));
+DESCR("matches LIKE expression");
+DATA(insert OID = 2008 (  notlike		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ _null_ byteanlike _null_ _null_ _null_ ));
+DESCR("does not match LIKE expression");
+DATA(insert OID = 2009 (  like_escape	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 17 "17 17" _null_ _null_ _null_ _null_ _null_ like_escape_bytea _null_ _null_ _null_ ));
+DESCR("convert LIKE pattern to use backslash escapes");
+DATA(insert OID = 2010 (  length		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "17" _null_ _null_ _null_ _null_ _null_ byteaoctetlen _null_ _null_ _null_ ));
+DESCR("octet length");
+DATA(insert OID = 2011 (  byteacat		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 17 "17 17" _null_ _null_ _null_ _null_ _null_ byteacat _null_ _null_ _null_ ));
+DATA(insert OID = 2012 (  substring		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 17 "17 23 23" _null_ _null_ _null_ _null_ _null_	bytea_substr _null_ _null_ _null_ ));
+DESCR("extract portion of string");
+DATA(insert OID = 2013 (  substring		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 17 "17 23" _null_ _null_ _null_ _null_ _null_ bytea_substr_no_len _null_ _null_ _null_ ));
+DESCR("extract portion of string");
+DATA(insert OID = 2085 (  substr		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 17 "17 23 23" _null_ _null_ _null_ _null_ _null_	bytea_substr _null_ _null_ _null_ ));
+DESCR("extract portion of string");
+DATA(insert OID = 2086 (  substr		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 17 "17 23" _null_ _null_ _null_ _null_ _null_ bytea_substr_no_len _null_ _null_ _null_ ));
+DESCR("extract portion of string");
+DATA(insert OID = 2014 (  position		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "17 17" _null_ _null_ _null_ _null_ _null_ byteapos _null_ _null_ _null_ ));
+DESCR("position of substring");
+DATA(insert OID = 2015 (  btrim			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 17 "17 17" _null_ _null_ _null_ _null_ _null_ byteatrim _null_ _null_ _null_ ));
+DESCR("trim both ends of string");
+
+DATA(insert OID = 2019 (  time				PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1083 "1184" _null_ _null_ _null_ _null_ _null_ timestamptz_time _null_ _null_ _null_ ));
+DESCR("convert timestamp with time zone to time");
+DATA(insert OID = 2020 (  date_trunc		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "25 1114" _null_ _null_ _null_ _null_ _null_ timestamp_trunc _null_ _null_ _null_ ));
+DESCR("truncate timestamp to specified units");
+DATA(insert OID = 2021 (  date_part			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "25 1114" _null_ _null_ _null_ _null_ _null_	timestamp_part _null_ _null_ _null_ ));
+DESCR("extract field from timestamp");
+DATA(insert OID = 2023 (  timestamp			PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1114 "702" _null_ _null_ _null_ _null_ _null_ abstime_timestamp _null_ _null_ _null_ ));
+DESCR("convert abstime to timestamp");
+DATA(insert OID = 2024 (  timestamp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1114 "1082" _null_ _null_ _null_ _null_ _null_ date_timestamp _null_ _null_ _null_ ));
+DESCR("convert date to timestamp");
+DATA(insert OID = 2025 (  timestamp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1082 1083" _null_ _null_ _null_ _null_ _null_	datetime_timestamp _null_ _null_ _null_ ));
+DESCR("convert date and time to timestamp");
+DATA(insert OID = 2027 (  timestamp			PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1114 "1184" _null_ _null_ _null_ _null_ _null_ timestamptz_timestamp _null_ _null_ _null_ ));
+DESCR("convert timestamp with time zone to timestamp");
+DATA(insert OID = 2028 (  timestamptz		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "1114" _null_ _null_ _null_ _null_ _null_ timestamp_timestamptz _null_ _null_ _null_ ));
+DESCR("convert timestamp to timestamp with time zone");
+DATA(insert OID = 2029 (  date				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1082 "1114" _null_ _null_ _null_ _null_ _null_ timestamp_date _null_ _null_ _null_ ));
+DESCR("convert timestamp to date");
+DATA(insert OID = 2030 (  abstime			PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 702 "1114" _null_ _null_ _null_ _null_ _null_ timestamp_abstime _null_ _null_ _null_ ));
+DESCR("convert timestamp to abstime");
+DATA(insert OID = 2031 (  timestamp_mi		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1114 1114" _null_ _null_ _null_ _null_ _null_	timestamp_mi _null_ _null_ _null_ ));
+DATA(insert OID = 2032 (  timestamp_pl_interval PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1114 1186" _null_ _null_ _null_ _null_ _null_	timestamp_pl_interval _null_ _null_ _null_ ));
+DATA(insert OID = 2033 (  timestamp_mi_interval PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1114 1186" _null_ _null_ _null_ _null_ _null_	timestamp_mi_interval _null_ _null_ _null_ ));
+DATA(insert OID = 2035 (  timestamp_smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1114 1114" _null_ _null_ _null_ _null_ _null_	timestamp_smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+DATA(insert OID = 2036 (  timestamp_larger	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1114 1114" _null_ _null_ _null_ _null_ _null_	timestamp_larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 2037 (  timezone			PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 1266 "25 1266" _null_ _null_ _null_ _null_ _null_ timetz_zone _null_ _null_ _null_ ));
+DESCR("adjust time with time zone to new zone");
+DATA(insert OID = 2038 (  timezone			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1266 "1186 1266" _null_ _null_ _null_ _null_ _null_	timetz_izone _null_ _null_ _null_ ));
+DESCR("adjust time with time zone to new zone");
+DATA(insert OID = 2039 (  timestamp_hash	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1114" _null_ _null_ _null_ _null_ _null_ timestamp_hash _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 2041 ( overlaps			PGNSP PGUID 12 1 0 0 0 f f f f f f i 4 0 16 "1114 1114 1114 1114" _null_ _null_ _null_ _null_ _null_	overlaps_timestamp _null_ _null_ _null_ ));
+DESCR("intervals overlap?");
+DATA(insert OID = 2042 ( overlaps			PGNSP PGUID 14 1 0 0 0 f f f f f f i 4 0 16 "1114 1186 1114 1186" _null_ _null_ _null_ _null_	_null_ "select ($1, ($1 + $2)) overlaps ($3, ($3 + $4))" _null_ _null_ _null_ ));
+DESCR("intervals overlap?");
+DATA(insert OID = 2043 ( overlaps			PGNSP PGUID 14 1 0 0 0 f f f f f f i 4 0 16 "1114 1114 1114 1186" _null_ _null_ _null_ _null_	_null_ "select ($1, $2) overlaps ($3, ($3 + $4))" _null_ _null_ _null_ ));
+DESCR("intervals overlap?");
+DATA(insert OID = 2044 ( overlaps			PGNSP PGUID 14 1 0 0 0 f f f f f f i 4 0 16 "1114 1186 1114 1114" _null_ _null_ _null_ _null_	_null_ "select ($1, ($1 + $2)) overlaps ($3, $4)" _null_ _null_ _null_ ));
+DESCR("intervals overlap?");
+DATA(insert OID = 2045 (  timestamp_cmp		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1114 1114" _null_ _null_ _null_ _null_ _null_ timestamp_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 3137 (  timestamp_sortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ timestamp_sortsupport _null_ _null_ _null_ ));
+DESCR("sort support");
+DATA(insert OID = 2046 (  time				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1083 "1266" _null_ _null_ _null_ _null_ _null_ timetz_time _null_ _null_ _null_ ));
+DESCR("convert time with time zone to time");
+DATA(insert OID = 2047 (  timetz			PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1266 "1083" _null_ _null_ _null_ _null_ _null_ time_timetz _null_ _null_ _null_ ));
+DESCR("convert time to time with time zone");
+DATA(insert OID = 2048 (  isfinite			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "1114" _null_ _null_ _null_ _null_ _null_ timestamp_finite _null_ _null_ _null_ ));
+DESCR("finite timestamp?");
+DATA(insert OID = 2049 ( to_char			PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "1114 25" _null_ _null_ _null_ _null_  _null_ timestamp_to_char _null_ _null_ _null_ ));
+DESCR("format timestamp to text");
+DATA(insert OID = 2052 (  timestamp_eq		PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ _null_ timestamp_eq _null_ _null_ _null_ ));
+DATA(insert OID = 2053 (  timestamp_ne		PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ _null_ timestamp_ne _null_ _null_ _null_ ));
+DATA(insert OID = 2054 (  timestamp_lt		PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ _null_ timestamp_lt _null_ _null_ _null_ ));
+DATA(insert OID = 2055 (  timestamp_le		PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ _null_ timestamp_le _null_ _null_ _null_ ));
+DATA(insert OID = 2056 (  timestamp_ge		PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ _null_ timestamp_ge _null_ _null_ _null_ ));
+DATA(insert OID = 2057 (  timestamp_gt		PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ _null_ timestamp_gt _null_ _null_ _null_ ));
+DATA(insert OID = 2058 (  age				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1114 1114" _null_ _null_ _null_ _null_ _null_	timestamp_age _null_ _null_ _null_ ));
+DESCR("date difference preserving months and years");
+DATA(insert OID = 2059 (  age				PGNSP PGUID 14 1 0 0 0 f f f f t f s 1 0 1186 "1114" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.age(cast(current_date as timestamp without time zone), $1)" _null_ _null_ _null_ ));
+DESCR("date difference from today preserving months and years");
+
+DATA(insert OID = 2069 (  timezone			PGNSP PGUID 12 1 0 0 timestamp_zone_transform f f f f t f i 2 0 1184 "25 1114" _null_ _null_ _null_ _null_ _null_ timestamp_zone _null_ _null_ _null_ ));
+DESCR("adjust timestamp to new time zone");
+DATA(insert OID = 2070 (  timezone			PGNSP PGUID 12 1 0 0 timestamp_izone_transform f f f f t f i 2 0 1184 "1186 1114" _null_ _null_ _null_ _null_ _null_	timestamp_izone _null_ _null_ _null_ ));
+DESCR("adjust timestamp to new time zone");
+DATA(insert OID = 2071 (  date_pl_interval	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1082 1186" _null_ _null_ _null_ _null_ _null_	date_pl_interval _null_ _null_ _null_ ));
+DATA(insert OID = 2072 (  date_mi_interval	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1082 1186" _null_ _null_ _null_ _null_ _null_	date_mi_interval _null_ _null_ _null_ ));
+
+DATA(insert OID = 2073 (  substring			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ _null_ textregexsubstr _null_ _null_ _null_ ));
+DESCR("extract text matching regular expression");
+DATA(insert OID = 2074 (  substring			PGNSP PGUID 14 1 0 0 0 f f f f t f i 3 0 25 "25 25 25" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.substring($1, pg_catalog.similar_escape($2, $3))" _null_ _null_ _null_ ));
+DESCR("extract text matching SQL99 regular expression");
+
+DATA(insert OID = 2075 (  bit				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1560 "20 23" _null_ _null_ _null_ _null_ _null_	bitfromint8 _null_ _null_ _null_ ));
+DESCR("convert int8 to bitstring");
+DATA(insert OID = 2076 (  int8				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "1560" _null_ _null_ _null_ _null_ _null_ bittoint8 _null_ _null_ _null_ ));
+DESCR("convert bitstring to int8");
+
+DATA(insert OID = 2077 (  current_setting	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ show_config_by_name _null_ _null_ _null_ ));
+DESCR("SHOW X as a function");
+DATA(insert OID = 2078 (  set_config		PGNSP PGUID 12 1 0 0 0 f f f f f f v 3 0 25 "25 25 16" _null_ _null_ _null_ _null_ _null_ set_config_by_name _null_ _null_ _null_ ));
+DESCR("SET X as a function");
+DATA(insert OID = 2084 (  pg_show_all_settings	PGNSP PGUID 12 1 1000 0 0 f f f f t t s 0 0 2249 "" "{25,25,25,25,25,25,25,25,25,25,25,1009,25,25,25,23,16}" "{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{name,setting,unit,category,short_desc,extra_desc,context,vartype,source,min_val,max_val,enumvals,boot_val,reset_val,sourcefile,sourceline,pending_restart}" _null_ _null_ show_all_settings _null_ _null_ _null_ ));
+DESCR("SHOW ALL as a function");
+DATA(insert OID = 3329 (  pg_show_all_file_settings PGNSP PGUID 12 1 1000 0 0 f f f f t t v 0 0 2249 "" "{25,23,23,25,25,16,25}" "{o,o,o,o,o,o,o}" "{sourcefile,sourceline,seqno,name,setting,applied,error}" _null_ _null_ show_all_file_settings _null_ _null_ _null_ ));
+DESCR("show config file settings");
+DATA(insert OID = 1371 (  pg_lock_status   PGNSP PGUID 12 1 1000 0 0 f f f f t t v 0 0 2249 "" "{25,26,26,23,21,25,28,26,26,21,25,23,25,16,16}" "{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{locktype,database,relation,page,tuple,virtualxid,transactionid,classid,objid,objsubid,virtualtransaction,pid,mode,granted,fastpath}" _null_ _null_ pg_lock_status _null_ _null_ _null_ ));
+DESCR("view system lock information");
+DATA(insert OID = 1065 (  pg_prepared_xact PGNSP PGUID 12 1 1000 0 0 f f f f t t v 0 0 2249 "" "{28,25,1184,26,26}" "{o,o,o,o,o}" "{transaction,gid,prepared,ownerid,dbid}" _null_ _null_ pg_prepared_xact _null_ _null_ _null_ ));
+DESCR("view two-phase transactions");
+DATA(insert OID = 3819 (  pg_get_multixact_members PGNSP PGUID 12 1 1000 0 0 f f f f t t v 1 0 2249 "28" "{28,28,25}" "{i,o,o}" "{multixid,xid,mode}" _null_ _null_ pg_get_multixact_members _null_ _null_ _null_ ));
+DESCR("view members of a multixactid");
+
+DATA(insert OID = 3581 ( pg_xact_commit_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 1184 "28" _null_ _null_ _null_ _null_ _null_ pg_xact_commit_timestamp _null_ _null_ _null_ ));
+DESCR("get commit timestamp of a transaction");
+
+DATA(insert OID = 3583 ( pg_last_committed_xact PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2249 "" "{28,1184}" "{o,o}" "{xid,timestamp}" _null_ _null_ pg_last_committed_xact _null_ _null_ _null_ ));
+DESCR("get transaction Id and commit timestamp of latest transaction commit");
+
+DATA(insert OID = 3537 (  pg_describe_object		PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 25 "26 26 23" _null_ _null_ _null_ _null_ _null_ pg_describe_object _null_ _null_ _null_ ));
+DESCR("get identification of SQL object");
+
+DATA(insert OID = 3839 (  pg_identify_object		PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 2249 "26 26 23" "{26,26,23,25,25,25,25}" "{i,i,i,o,o,o,o}" "{classid,objid,subobjid,type,schema,name,identity}" _null_ _null_ pg_identify_object _null_ _null_ _null_ ));
+DESCR("get machine-parseable identification of SQL object");
+
+DATA(insert OID = 3382 (  pg_identify_object_as_address PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 2249 "26 26 23" "{26,26,23,25,1009,1009}" "{i,i,i,o,o,o}" "{classid,objid,subobjid,type,object_names,object_args}" _null_ _null_ pg_identify_object_as_address _null_ _null_ _null_ ));
+DESCR("get identification of SQL object for pg_get_object_address()");
+
+DATA(insert OID = 3954 (  pg_get_object_address    PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 2249 "25 1009 1009" "{25,1009,1009,26,26,23}" "{i,i,i,o,o,o}" "{type,name,args,classid,objid,subobjid}" _null_ _null_ pg_get_object_address _null_ _null_ _null_ ));
+DESCR("get OID-based object address from name/args arrays");
+
+DATA(insert OID = 2079 (  pg_table_is_visible		PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ pg_table_is_visible _null_ _null_ _null_ ));
+DESCR("is table visible in search path?");
+DATA(insert OID = 2080 (  pg_type_is_visible		PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ pg_type_is_visible _null_ _null_ _null_ ));
+DESCR("is type visible in search path?");
+DATA(insert OID = 2081 (  pg_function_is_visible	PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ pg_function_is_visible _null_ _null_ _null_ ));
+DESCR("is function visible in search path?");
+DATA(insert OID = 2082 (  pg_operator_is_visible	PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ pg_operator_is_visible _null_ _null_ _null_ ));
+DESCR("is operator visible in search path?");
+DATA(insert OID = 2083 (  pg_opclass_is_visible		PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ pg_opclass_is_visible _null_ _null_ _null_ ));
+DESCR("is opclass visible in search path?");
+DATA(insert OID = 3829 (  pg_opfamily_is_visible	PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ pg_opfamily_is_visible _null_ _null_ _null_ ));
+DESCR("is opfamily visible in search path?");
+DATA(insert OID = 2093 (  pg_conversion_is_visible	PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ pg_conversion_is_visible _null_ _null_ _null_ ));
+DESCR("is conversion visible in search path?");
+DATA(insert OID = 3756 (  pg_ts_parser_is_visible	PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ pg_ts_parser_is_visible _null_ _null_ _null_ ));
+DESCR("is text search parser visible in search path?");
+DATA(insert OID = 3757 (  pg_ts_dict_is_visible		PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ pg_ts_dict_is_visible _null_ _null_ _null_ ));
+DESCR("is text search dictionary visible in search path?");
+DATA(insert OID = 3768 (  pg_ts_template_is_visible PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ pg_ts_template_is_visible _null_ _null_ _null_ ));
+DESCR("is text search template visible in search path?");
+DATA(insert OID = 3758 (  pg_ts_config_is_visible	PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ pg_ts_config_is_visible _null_ _null_ _null_ ));
+DESCR("is text search configuration visible in search path?");
+DATA(insert OID = 3815 (  pg_collation_is_visible	PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ pg_collation_is_visible _null_ _null_ _null_ ));
+DESCR("is collation visible in search path?");
+
+DATA(insert OID = 2854 (  pg_my_temp_schema			PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 26 "" _null_ _null_ _null_ _null_ _null_ pg_my_temp_schema _null_ _null_ _null_ ));
+DESCR("get OID of current session's temp schema, if any");
+DATA(insert OID = 2855 (  pg_is_other_temp_schema	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ pg_is_other_temp_schema _null_ _null_ _null_ ));
+DESCR("is schema another session's temp schema?");
+
+DATA(insert OID = 2171 ( pg_cancel_backend		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "23" _null_ _null_ _null_ _null_ _null_ pg_cancel_backend _null_ _null_ _null_ ));
+DESCR("cancel a server process' current query");
+DATA(insert OID = 2096 ( pg_terminate_backend		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "23" _null_ _null_ _null_ _null_ _null_ pg_terminate_backend _null_ _null_ _null_ ));
+DESCR("terminate a server process");
+DATA(insert OID = 2172 ( pg_start_backup		PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 3220 "25 16" _null_ _null_ _null_ _null_ _null_ pg_start_backup _null_ _null_ _null_ ));
+DESCR("prepare for taking an online backup");
+DATA(insert OID = 2173 ( pg_stop_backup			PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_stop_backup _null_ _null_ _null_ ));
+DESCR("finish taking an online backup");
+DATA(insert OID = 3813 ( pg_is_in_backup		PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ _null_ pg_is_in_backup _null_ _null_ _null_ ));
+DESCR("true if server is in online backup");
+DATA(insert OID = 3814 ( pg_backup_start_time		PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ _null_ pg_backup_start_time _null_ _null_ _null_ ));
+DESCR("start time of an online backup");
+DATA(insert OID = 2848 ( pg_switch_xlog			PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_switch_xlog _null_ _null_ _null_ ));
+DESCR("switch to new xlog file");
+DATA(insert OID = 3098 ( pg_create_restore_point	PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 3220 "25" _null_ _null_ _null_ _null_ _null_ pg_create_restore_point _null_ _null_ _null_ ));
+DESCR("create a named restore point");
+DATA(insert OID = 2849 ( pg_current_xlog_location	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_current_xlog_location _null_ _null_ _null_ ));
+DESCR("current xlog write location");
+DATA(insert OID = 2852 ( pg_current_xlog_insert_location	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_current_xlog_insert_location _null_ _null_ _null_ ));
+DESCR("current xlog insert location");
+DATA(insert OID = 2850 ( pg_xlogfile_name_offset	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2249 "3220" "{3220,25,23}" "{i,o,o}" "{wal_location,file_name,file_offset}" _null_ _null_ pg_xlogfile_name_offset _null_ _null_ _null_ ));
+DESCR("xlog filename and byte offset, given an xlog location");
+DATA(insert OID = 2851 ( pg_xlogfile_name			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "3220" _null_ _null_ _null_ _null_ _null_ pg_xlogfile_name _null_ _null_ _null_ ));
+DESCR("xlog filename, given an xlog location");
+
+DATA(insert OID = 3165 ( pg_xlog_location_diff		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "3220 3220" _null_ _null_ _null_ _null_ _null_ pg_xlog_location_diff _null_ _null_ _null_ ));
+DESCR("difference in bytes, given two xlog locations");
+
+DATA(insert OID = 3809 ( pg_export_snapshot		PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ _null_ pg_export_snapshot _null_ _null_ _null_ ));
+DESCR("export a snapshot");
+
+DATA(insert OID = 3810 (  pg_is_in_recovery		PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ _null_ pg_is_in_recovery _null_ _null_ _null_ ));
+DESCR("true if server is in recovery");
+
+DATA(insert OID = 3820 ( pg_last_xlog_receive_location	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_last_xlog_receive_location _null_ _null_ _null_ ));
+DESCR("current xlog flush location");
+DATA(insert OID = 3821 ( pg_last_xlog_replay_location	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_last_xlog_replay_location _null_ _null_ _null_ ));
+DESCR("last xlog replay location");
+DATA(insert OID = 3830 ( pg_last_xact_replay_timestamp	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 1184 "" _null_ _null_ _null_ _null_ _null_ pg_last_xact_replay_timestamp _null_ _null_ _null_ ));
+DESCR("timestamp of last replay xact");
+
+DATA(insert OID = 3071 ( pg_xlog_replay_pause		PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2278 "" _null_ _null_ _null_ _null_ _null_ pg_xlog_replay_pause _null_ _null_ _null_ ));
+DESCR("pause xlog replay");
+DATA(insert OID = 3072 ( pg_xlog_replay_resume		PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2278 "" _null_ _null_ _null_ _null_ _null_ pg_xlog_replay_resume _null_ _null_ _null_ ));
+DESCR("resume xlog replay, if it was paused");
+DATA(insert OID = 3073 ( pg_is_xlog_replay_paused	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ _null_ pg_is_xlog_replay_paused _null_ _null_ _null_ ));
+DESCR("true if xlog replay is paused");
+
+DATA(insert OID = 2621 ( pg_reload_conf			PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ _null_ pg_reload_conf _null_ _null_ _null_ ));
+DESCR("reload configuration files");
+DATA(insert OID = 2622 ( pg_rotate_logfile		PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ _null_ pg_rotate_logfile _null_ _null_ _null_ ));
+DESCR("rotate log file");
+
+DATA(insert OID = 2623 ( pg_stat_file		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2249 "25" "{25,20,1184,1184,1184,1184,16}" "{i,o,o,o,o,o,o}" "{filename,size,access,modification,change,creation,isdir}" _null_ _null_ pg_stat_file_1arg _null_ _null_ _null_ ));
+DESCR("get information about file");
+DATA(insert OID = 3307 ( pg_stat_file		PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2249 "25 16" "{25,16,20,1184,1184,1184,1184,16}" "{i,i,o,o,o,o,o,o}" "{filename,missing_ok,size,access,modification,change,creation,isdir}" _null_ _null_ pg_stat_file _null_ _null_ _null_ ));
+DESCR("get information about file");
+DATA(insert OID = 2624 ( pg_read_file		PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 25 "25 20 20" _null_ _null_ _null_ _null_ _null_ pg_read_file_off_len _null_ _null_ _null_ ));
+DESCR("read text from a file");
+DATA(insert OID = 3293 ( pg_read_file		PGNSP PGUID 12 1 0 0 0 f f f f t f v 4 0 25 "25 20 20 16" _null_ _null_ _null_ _null_ _null_ pg_read_file _null_ _null_ _null_ ));
+DESCR("read text from a file");
+DATA(insert OID = 3826 ( pg_read_file		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ pg_read_file_all _null_ _null_ _null_ ));
+DESCR("read text from a file");
+DATA(insert OID = 3827 ( pg_read_binary_file	PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 17 "25 20 20" _null_ _null_ _null_ _null_ _null_ pg_read_binary_file_off_len _null_ _null_ _null_ ));
+DESCR("read bytea from a file");
+DATA(insert OID = 3295 ( pg_read_binary_file	PGNSP PGUID 12 1 0 0 0 f f f f t f v 4 0 17 "25 20 20 16" _null_ _null_ _null_ _null_ _null_ pg_read_binary_file _null_ _null_ _null_ ));
+DESCR("read bytea from a file");
+DATA(insert OID = 3828 ( pg_read_binary_file	PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 17 "25" _null_ _null_ _null_ _null_ _null_ pg_read_binary_file_all _null_ _null_ _null_ ));
+DESCR("read bytea from a file");
+DATA(insert OID = 2625 ( pg_ls_dir			PGNSP PGUID 12 1 1000 0 0 f f f f t t v 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ pg_ls_dir_1arg _null_ _null_ _null_ ));
+DESCR("list all files in a directory");
+DATA(insert OID = 3297 ( pg_ls_dir			PGNSP PGUID 12 1 1000 0 0 f f f f t t v 3 0 25 "25 16 16" _null_ _null_ _null_ _null_ _null_ pg_ls_dir _null_ _null_ _null_ ));
+DESCR("list all files in a directory");
+DATA(insert OID = 2626 ( pg_sleep			PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "701" _null_ _null_ _null_ _null_ _null_ pg_sleep _null_ _null_ _null_ ));
+DESCR("sleep for the specified time in seconds");
+DATA(insert OID = 3935 ( pg_sleep_for			PGNSP PGUID 14 1 0 0 0 f f f f t f v 1 0 2278 "1186" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.pg_sleep(extract(epoch from pg_catalog.clock_timestamp() operator(pg_catalog.+) $1) operator(pg_catalog.-) extract(epoch from pg_catalog.clock_timestamp()))" _null_ _null_ _null_ ));
+DESCR("sleep for the specified interval");
+DATA(insert OID = 3936 ( pg_sleep_until			PGNSP PGUID 14 1 0 0 0 f f f f t f v 1 0 2278 "1184" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.pg_sleep(extract(epoch from $1) operator(pg_catalog.-) extract(epoch from pg_catalog.clock_timestamp()))" _null_ _null_ _null_ ));
+DESCR("sleep until the specified time");
+
+DATA(insert OID = 2971 (  text				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "16" _null_ _null_ _null_ _null_ _null_ booltext _null_ _null_ _null_ ));
+DESCR("convert boolean to text");
+
+/* Aggregates (moved here from pg_aggregate for 7.3) */
+
+DATA(insert OID = 2100 (  avg				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("the average (arithmetic mean) as numeric of all bigint values");
+DATA(insert OID = 2101 (  avg				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("the average (arithmetic mean) as numeric of all integer values");
+DATA(insert OID = 2102 (  avg				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("the average (arithmetic mean) as numeric of all smallint values");
+DATA(insert OID = 2103 (  avg				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("the average (arithmetic mean) as numeric of all numeric values");
+DATA(insert OID = 2104 (  avg				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("the average (arithmetic mean) as float8 of all float4 values");
+DATA(insert OID = 2105 (  avg				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("the average (arithmetic mean) as float8 of all float8 values");
+DATA(insert OID = 2106 (  avg				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("the average (arithmetic mean) as interval of all interval values");
+
+DATA(insert OID = 2107 (  sum				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sum as numeric across all bigint input values");
+DATA(insert OID = 2108 (  sum				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 20 "23" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sum as bigint across all integer input values");
+DATA(insert OID = 2109 (  sum				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 20 "21" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sum as bigint across all smallint input values");
+DATA(insert OID = 2110 (  sum				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 700 "700" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sum as float4 across all float4 input values");
+DATA(insert OID = 2111 (  sum				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sum as float8 across all float8 input values");
+DATA(insert OID = 2112 (  sum				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 790 "790" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sum as money across all money input values");
+DATA(insert OID = 2113 (  sum				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sum as interval across all interval input values");
+DATA(insert OID = 2114 (  sum				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sum as numeric across all numeric input values");
+
+DATA(insert OID = 2115 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 20 "20" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all bigint input values");
+DATA(insert OID = 2116 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all integer input values");
+DATA(insert OID = 2117 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 21 "21" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all smallint input values");
+DATA(insert OID = 2118 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 26 "26" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all oid input values");
+DATA(insert OID = 2119 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 700 "700" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all float4 input values");
+DATA(insert OID = 2120 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all float8 input values");
+DATA(insert OID = 2121 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 702 "702" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all abstime input values");
+DATA(insert OID = 2122 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1082 "1082" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all date input values");
+DATA(insert OID = 2123 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1083 "1083" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all time input values");
+DATA(insert OID = 2124 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1266 "1266" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all time with time zone input values");
+DATA(insert OID = 2125 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 790 "790" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all money input values");
+DATA(insert OID = 2126 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1114 "1114" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all timestamp input values");
+DATA(insert OID = 2127 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1184 "1184" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all timestamp with time zone input values");
+DATA(insert OID = 2128 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all interval input values");
+DATA(insert OID = 2129 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all text input values");
+DATA(insert OID = 2130 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all numeric input values");
+DATA(insert OID = 2050 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 2277 "2277" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all anyarray input values");
+DATA(insert OID = 2244 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1042 "1042" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all bpchar input values");
+DATA(insert OID = 2797 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 27 "27" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all tid input values");
+DATA(insert OID = 3564 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 869 "869" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all inet input values");
+
+DATA(insert OID = 2131 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 20 "20" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all bigint input values");
+DATA(insert OID = 2132 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all integer input values");
+DATA(insert OID = 2133 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 21 "21" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all smallint input values");
+DATA(insert OID = 2134 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 26 "26" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all oid input values");
+DATA(insert OID = 2135 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 700 "700" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all float4 input values");
+DATA(insert OID = 2136 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all float8 input values");
+DATA(insert OID = 2137 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 702 "702" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all abstime input values");
+DATA(insert OID = 2138 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1082 "1082" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all date input values");
+DATA(insert OID = 2139 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1083 "1083" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all time input values");
+DATA(insert OID = 2140 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1266 "1266" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all time with time zone input values");
+DATA(insert OID = 2141 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 790 "790" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all money input values");
+DATA(insert OID = 2142 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1114 "1114" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all timestamp input values");
+DATA(insert OID = 2143 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1184 "1184" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all timestamp with time zone input values");
+DATA(insert OID = 2144 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all interval input values");
+DATA(insert OID = 2145 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all text values");
+DATA(insert OID = 2146 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all numeric input values");
+DATA(insert OID = 2051 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 2277 "2277" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all anyarray input values");
+DATA(insert OID = 2245 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1042 "1042" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all bpchar input values");
+DATA(insert OID = 2798 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 27 "27" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all tid input values");
+DATA(insert OID = 3565 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 869 "869" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all inet input values");
+
+/* count has two forms: count(any) and count(*) */
+DATA(insert OID = 2147 (  count				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 20 "2276" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("number of input rows for which the input expression is not null");
+DATA(insert OID = 2803 (  count				PGNSP PGUID 12 1 0 0 0 t f f f f f i 0 0 20 "" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("number of input rows");
+
+DATA(insert OID = 2718 (  var_pop			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("population variance of bigint input values (square of the population standard deviation)");
+DATA(insert OID = 2719 (  var_pop			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("population variance of integer input values (square of the population standard deviation)");
+DATA(insert OID = 2720 (  var_pop			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("population variance of smallint input values (square of the population standard deviation)");
+DATA(insert OID = 2721 (  var_pop			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("population variance of float4 input values (square of the population standard deviation)");
+DATA(insert OID = 2722 (  var_pop			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("population variance of float8 input values (square of the population standard deviation)");
+DATA(insert OID = 2723 (  var_pop			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("population variance of numeric input values (square of the population standard deviation)");
+
+DATA(insert OID = 2641 (  var_samp			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sample variance of bigint input values (square of the sample standard deviation)");
+DATA(insert OID = 2642 (  var_samp			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sample variance of integer input values (square of the sample standard deviation)");
+DATA(insert OID = 2643 (  var_samp			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sample variance of smallint input values (square of the sample standard deviation)");
+DATA(insert OID = 2644 (  var_samp			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sample variance of float4 input values (square of the sample standard deviation)");
+
+DATA(insert OID = 2645 (  var_samp			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sample variance of float8 input values (square of the sample standard deviation)");
+DATA(insert OID = 2646 (  var_samp			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sample variance of numeric input values (square of the sample standard deviation)");
+
+DATA(insert OID = 2148 (  variance			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("historical alias for var_samp");
+DATA(insert OID = 2149 (  variance			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("historical alias for var_samp");
+DATA(insert OID = 2150 (  variance			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("historical alias for var_samp");
+DATA(insert OID = 2151 (  variance			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("historical alias for var_samp");
+DATA(insert OID = 2152 (  variance			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("historical alias for var_samp");
+DATA(insert OID = 2153 (  variance			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("historical alias for var_samp");
+
+DATA(insert OID = 2724 (  stddev_pop		PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("population standard deviation of bigint input values");
+DATA(insert OID = 2725 (  stddev_pop		PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("population standard deviation of integer input values");
+DATA(insert OID = 2726 (  stddev_pop		PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("population standard deviation of smallint input values");
+DATA(insert OID = 2727 (  stddev_pop		PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("population standard deviation of float4 input values");
+DATA(insert OID = 2728 (  stddev_pop		PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("population standard deviation of float8 input values");
+DATA(insert OID = 2729 (  stddev_pop		PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("population standard deviation of numeric input values");
+
+DATA(insert OID = 2712 (  stddev_samp		PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sample standard deviation of bigint input values");
+DATA(insert OID = 2713 (  stddev_samp		PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sample standard deviation of integer input values");
+DATA(insert OID = 2714 (  stddev_samp		PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sample standard deviation of smallint input values");
+DATA(insert OID = 2715 (  stddev_samp		PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sample standard deviation of float4 input values");
+DATA(insert OID = 2716 (  stddev_samp		PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sample standard deviation of float8 input values");
+DATA(insert OID = 2717 (  stddev_samp		PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sample standard deviation of numeric input values");
+
+DATA(insert OID = 2154 (  stddev			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("historical alias for stddev_samp");
+DATA(insert OID = 2155 (  stddev			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("historical alias for stddev_samp");
+DATA(insert OID = 2156 (  stddev			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("historical alias for stddev_samp");
+DATA(insert OID = 2157 (  stddev			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("historical alias for stddev_samp");
+DATA(insert OID = 2158 (  stddev			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("historical alias for stddev_samp");
+DATA(insert OID = 2159 (  stddev			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("historical alias for stddev_samp");
+
+DATA(insert OID = 2818 (  regr_count		PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 20 "701 701" _null_ _null_ _null_ _null_  _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("number of input rows in which both expressions are not null");
+DATA(insert OID = 2819 (  regr_sxx			PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sum of squares of the independent variable (sum(X^2) - sum(X)^2/N)");
+DATA(insert OID = 2820 (  regr_syy			PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sum of squares of the dependent variable (sum(Y^2) - sum(Y)^2/N)");
+DATA(insert OID = 2821 (  regr_sxy			PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sum of products of independent times dependent variable (sum(X*Y) - sum(X) * sum(Y)/N)");
+DATA(insert OID = 2822 (  regr_avgx			PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("average of the independent variable (sum(X)/N)");
+DATA(insert OID = 2823 (  regr_avgy			PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("average of the dependent variable (sum(Y)/N)");
+DATA(insert OID = 2824 (  regr_r2			PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("square of the correlation coefficient");
+DATA(insert OID = 2825 (  regr_slope		PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("slope of the least-squares-fit linear equation determined by the (X, Y) pairs");
+DATA(insert OID = 2826 (  regr_intercept	PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("y-intercept of the least-squares-fit linear equation determined by the (X, Y) pairs");
+
+DATA(insert OID = 2827 (  covar_pop			PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("population covariance");
+DATA(insert OID = 2828 (  covar_samp		PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("sample covariance");
+DATA(insert OID = 2829 (  corr				PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("correlation coefficient");
+
+DATA(insert OID = 2160 ( text_pattern_lt	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ text_pattern_lt _null_ _null_ _null_ ));
+DATA(insert OID = 2161 ( text_pattern_le	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ text_pattern_le _null_ _null_ _null_ ));
+DATA(insert OID = 2163 ( text_pattern_ge	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ text_pattern_ge _null_ _null_ _null_ ));
+DATA(insert OID = 2164 ( text_pattern_gt	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ text_pattern_gt _null_ _null_ _null_ ));
+DATA(insert OID = 2166 ( bttext_pattern_cmp  PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ _null_ bttext_pattern_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+DATA(insert OID = 2174 ( bpchar_pattern_lt	  PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ _null_ bpchar_pattern_lt _null_ _null_ _null_ ));
+DATA(insert OID = 2175 ( bpchar_pattern_le	  PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ _null_ bpchar_pattern_le _null_ _null_ _null_ ));
+DATA(insert OID = 2177 ( bpchar_pattern_ge	  PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ _null_ bpchar_pattern_ge _null_ _null_ _null_ ));
+DATA(insert OID = 2178 ( bpchar_pattern_gt	  PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ _null_ bpchar_pattern_gt _null_ _null_ _null_ ));
+DATA(insert OID = 2180 ( btbpchar_pattern_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1042 1042" _null_ _null_ _null_ _null_ _null_ btbpchar_pattern_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+DATA(insert OID = 2188 ( btint48cmp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 20" _null_ _null_ _null_ _null_ _null_ btint48cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 2189 ( btint84cmp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "20 23" _null_ _null_ _null_ _null_ _null_ btint84cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 2190 ( btint24cmp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "21 23" _null_ _null_ _null_ _null_ _null_ btint24cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 2191 ( btint42cmp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 21" _null_ _null_ _null_ _null_ _null_ btint42cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 2192 ( btint28cmp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "21 20" _null_ _null_ _null_ _null_ _null_ btint28cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 2193 ( btint82cmp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "20 21" _null_ _null_ _null_ _null_ _null_ btint82cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 2194 ( btfloat48cmp		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "700 701" _null_ _null_ _null_ _null_ _null_ btfloat48cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 2195 ( btfloat84cmp		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "701 700" _null_ _null_ _null_ _null_ _null_ btfloat84cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+DATA(insert OID = 2212 (  regprocedurein	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2202 "2275" _null_ _null_ _null_ _null_ _null_ regprocedurein _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2213 (  regprocedureout	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2202" _null_ _null_ _null_ _null_ _null_ regprocedureout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2214 (  regoperin			PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2203 "2275" _null_ _null_ _null_ _null_ _null_ regoperin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2215 (  regoperout		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2203" _null_ _null_ _null_ _null_ _null_ regoperout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3492 (  to_regoper		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2203 "2275" _null_ _null_ _null_ _null_ _null_ to_regoper _null_ _null_ _null_ ));
+DESCR("convert operator name to regoper");
+DATA(insert OID = 3476 (  to_regoperator	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2204 "2275" _null_ _null_ _null_ _null_ _null_ to_regoperator _null_ _null_ _null_ ));
+DESCR("convert operator name to regoperator");
+DATA(insert OID = 2216 (  regoperatorin		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2204 "2275" _null_ _null_ _null_ _null_ _null_ regoperatorin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2217 (  regoperatorout	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2204" _null_ _null_ _null_ _null_ _null_ regoperatorout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2218 (  regclassin		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2205 "2275" _null_ _null_ _null_ _null_ _null_ regclassin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2219 (  regclassout		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2205" _null_ _null_ _null_ _null_ _null_ regclassout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3495 (  to_regclass		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2205 "2275" _null_ _null_ _null_ _null_ _null_ to_regclass _null_ _null_ _null_ ));
+DESCR("convert classname to regclass");
+DATA(insert OID = 2220 (  regtypein			PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2206 "2275" _null_ _null_ _null_ _null_ _null_ regtypein _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2221 (  regtypeout		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2206" _null_ _null_ _null_ _null_ _null_ regtypeout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3493 (  to_regtype		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2206 "2275" _null_ _null_ _null_ _null_ _null_ to_regtype _null_ _null_ _null_ ));
+DESCR("convert type name to regtype");
+DATA(insert OID = 1079 (  regclass			PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2205 "25" _null_ _null_ _null_ _null_ _null_	text_regclass _null_ _null_ _null_ ));
+DESCR("convert text to regclass");
+
+DATA(insert OID = 4098 (  regrolein			PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 4096 "2275" _null_ _null_ _null_ _null_ _null_ regrolein _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 4092 (  regroleout		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "4096" _null_ _null_ _null_ _null_ _null_ regroleout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 4093 (  to_regrole		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 4096 "2275" _null_ _null_ _null_ _null_ _null_ to_regrole _null_ _null_ _null_ ));
+DESCR("convert role name to regrole");
+
+DATA(insert OID = 4084 (  regnamespacein	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 4089 "2275" _null_ _null_ _null_ _null_ _null_ regnamespacein _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 4085 (  regnamespaceout	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "4089" _null_ _null_ _null_ _null_ _null_ regnamespaceout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 4086 (  to_regnamespace	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 4089 "2275" _null_ _null_ _null_ _null_ _null_ to_regnamespace _null_ _null_ _null_ ));
+DESCR("convert namespace name to regnamespace");
+
+DATA(insert OID = 2246 ( fmgr_internal_validator PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2278 "26" _null_ _null_ _null_ _null_ _null_ fmgr_internal_validator _null_ _null_ _null_ ));
+DESCR("(internal)");
+DATA(insert OID = 2247 ( fmgr_c_validator	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2278 "26" _null_ _null_ _null_ _null_ _null_ fmgr_c_validator _null_ _null_ _null_ ));
+DESCR("(internal)");
+DATA(insert OID = 2248 ( fmgr_sql_validator PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2278 "26" _null_ _null_ _null_ _null_ _null_ fmgr_sql_validator _null_ _null_ _null_ ));
+DESCR("(internal)");
+
+DATA(insert OID = 2250 (  has_database_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ _null_	has_database_privilege_name_name _null_ _null_ _null_ ));
+DESCR("user privilege on database by username, database name");
+DATA(insert OID = 2251 (  has_database_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ _null_	has_database_privilege_name_id _null_ _null_ _null_ ));
+DESCR("user privilege on database by username, database oid");
+DATA(insert OID = 2252 (  has_database_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ _null_	has_database_privilege_id_name _null_ _null_ _null_ ));
+DESCR("user privilege on database by user oid, database name");
+DATA(insert OID = 2253 (  has_database_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ _null_	has_database_privilege_id_id _null_ _null_ _null_ ));
+DESCR("user privilege on database by user oid, database oid");
+DATA(insert OID = 2254 (  has_database_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ has_database_privilege_name _null_ _null_ _null_ ));
+DESCR("current user privilege on database by database name");
+DATA(insert OID = 2255 (  has_database_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ _null_ has_database_privilege_id _null_ _null_ _null_ ));
+DESCR("current user privilege on database by database oid");
+
+DATA(insert OID = 2256 (  has_function_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ _null_	has_function_privilege_name_name _null_ _null_ _null_ ));
+DESCR("user privilege on function by username, function name");
+DATA(insert OID = 2257 (  has_function_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ _null_	has_function_privilege_name_id _null_ _null_ _null_ ));
+DESCR("user privilege on function by username, function oid");
+DATA(insert OID = 2258 (  has_function_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ _null_	has_function_privilege_id_name _null_ _null_ _null_ ));
+DESCR("user privilege on function by user oid, function name");
+DATA(insert OID = 2259 (  has_function_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ _null_	has_function_privilege_id_id _null_ _null_ _null_ ));
+DESCR("user privilege on function by user oid, function oid");
+DATA(insert OID = 2260 (  has_function_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ has_function_privilege_name _null_ _null_ _null_ ));
+DESCR("current user privilege on function by function name");
+DATA(insert OID = 2261 (  has_function_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ _null_ has_function_privilege_id _null_ _null_ _null_ ));
+DESCR("current user privilege on function by function oid");
+
+DATA(insert OID = 2262 (  has_language_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ _null_	has_language_privilege_name_name _null_ _null_ _null_ ));
+DESCR("user privilege on language by username, language name");
+DATA(insert OID = 2263 (  has_language_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ _null_	has_language_privilege_name_id _null_ _null_ _null_ ));
+DESCR("user privilege on language by username, language oid");
+DATA(insert OID = 2264 (  has_language_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ _null_	has_language_privilege_id_name _null_ _null_ _null_ ));
+DESCR("user privilege on language by user oid, language name");
+DATA(insert OID = 2265 (  has_language_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ _null_	has_language_privilege_id_id _null_ _null_ _null_ ));
+DESCR("user privilege on language by user oid, language oid");
+DATA(insert OID = 2266 (  has_language_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ has_language_privilege_name _null_ _null_ _null_ ));
+DESCR("current user privilege on language by language name");
+DATA(insert OID = 2267 (  has_language_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ _null_ has_language_privilege_id _null_ _null_ _null_ ));
+DESCR("current user privilege on language by language oid");
+
+DATA(insert OID = 2268 (  has_schema_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ _null_	has_schema_privilege_name_name _null_ _null_ _null_ ));
+DESCR("user privilege on schema by username, schema name");
+DATA(insert OID = 2269 (  has_schema_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ _null_	has_schema_privilege_name_id _null_ _null_ _null_ ));
+DESCR("user privilege on schema by username, schema oid");
+DATA(insert OID = 2270 (  has_schema_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ _null_	has_schema_privilege_id_name _null_ _null_ _null_ ));
+DESCR("user privilege on schema by user oid, schema name");
+DATA(insert OID = 2271 (  has_schema_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ _null_	has_schema_privilege_id_id _null_ _null_ _null_ ));
+DESCR("user privilege on schema by user oid, schema oid");
+DATA(insert OID = 2272 (  has_schema_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ has_schema_privilege_name _null_ _null_ _null_ ));
+DESCR("current user privilege on schema by schema name");
+DATA(insert OID = 2273 (  has_schema_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ _null_ has_schema_privilege_id _null_ _null_ _null_ ));
+DESCR("current user privilege on schema by schema oid");
+
+DATA(insert OID = 2390 (  has_tablespace_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ _null_	has_tablespace_privilege_name_name _null_ _null_ _null_ ));
+DESCR("user privilege on tablespace by username, tablespace name");
+DATA(insert OID = 2391 (  has_tablespace_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ _null_	has_tablespace_privilege_name_id _null_ _null_ _null_ ));
+DESCR("user privilege on tablespace by username, tablespace oid");
+DATA(insert OID = 2392 (  has_tablespace_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ _null_	has_tablespace_privilege_id_name _null_ _null_ _null_ ));
+DESCR("user privilege on tablespace by user oid, tablespace name");
+DATA(insert OID = 2393 (  has_tablespace_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ _null_	has_tablespace_privilege_id_id _null_ _null_ _null_ ));
+DESCR("user privilege on tablespace by user oid, tablespace oid");
+DATA(insert OID = 2394 (  has_tablespace_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ has_tablespace_privilege_name _null_ _null_ _null_ ));
+DESCR("current user privilege on tablespace by tablespace name");
+DATA(insert OID = 2395 (  has_tablespace_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ _null_ has_tablespace_privilege_id _null_ _null_ _null_ ));
+DESCR("current user privilege on tablespace by tablespace oid");
+
+DATA(insert OID = 3000 (  has_foreign_data_wrapper_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ _null_	has_foreign_data_wrapper_privilege_name_name _null_ _null_ _null_ ));
+DESCR("user privilege on foreign data wrapper by username, foreign data wrapper name");
+DATA(insert OID = 3001 (  has_foreign_data_wrapper_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ _null_	has_foreign_data_wrapper_privilege_name_id _null_ _null_ _null_ ));
+DESCR("user privilege on foreign data wrapper by username, foreign data wrapper oid");
+DATA(insert OID = 3002 (  has_foreign_data_wrapper_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ _null_	has_foreign_data_wrapper_privilege_id_name _null_ _null_ _null_ ));
+DESCR("user privilege on foreign data wrapper by user oid, foreign data wrapper name");
+DATA(insert OID = 3003 (  has_foreign_data_wrapper_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ _null_	has_foreign_data_wrapper_privilege_id_id _null_ _null_ _null_ ));
+DESCR("user privilege on foreign data wrapper by user oid, foreign data wrapper oid");
+DATA(insert OID = 3004 (  has_foreign_data_wrapper_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ has_foreign_data_wrapper_privilege_name _null_ _null_ _null_ ));
+DESCR("current user privilege on foreign data wrapper by foreign data wrapper name");
+DATA(insert OID = 3005 (  has_foreign_data_wrapper_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ _null_ has_foreign_data_wrapper_privilege_id _null_ _null_ _null_ ));
+DESCR("current user privilege on foreign data wrapper by foreign data wrapper oid");
+
+DATA(insert OID = 3006 (  has_server_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ _null_	has_server_privilege_name_name _null_ _null_ _null_ ));
+DESCR("user privilege on server by username, server name");
+DATA(insert OID = 3007 (  has_server_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ _null_	has_server_privilege_name_id _null_ _null_ _null_ ));
+DESCR("user privilege on server by username, server oid");
+DATA(insert OID = 3008 (  has_server_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ _null_	has_server_privilege_id_name _null_ _null_ _null_ ));
+DESCR("user privilege on server by user oid, server name");
+DATA(insert OID = 3009 (  has_server_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ _null_	has_server_privilege_id_id _null_ _null_ _null_ ));
+DESCR("user privilege on server by user oid, server oid");
+DATA(insert OID = 3010 (  has_server_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ has_server_privilege_name _null_ _null_ _null_ ));
+DESCR("current user privilege on server by server name");
+DATA(insert OID = 3011 (  has_server_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ _null_ has_server_privilege_id _null_ _null_ _null_ ));
+DESCR("current user privilege on server by server oid");
+
+DATA(insert OID = 3138 (  has_type_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ _null_	has_type_privilege_name_name _null_ _null_ _null_ ));
+DESCR("user privilege on type by username, type name");
+DATA(insert OID = 3139 (  has_type_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ _null_	has_type_privilege_name_id _null_ _null_ _null_ ));
+DESCR("user privilege on type by username, type oid");
+DATA(insert OID = 3140 (  has_type_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ _null_	has_type_privilege_id_name _null_ _null_ _null_ ));
+DESCR("user privilege on type by user oid, type name");
+DATA(insert OID = 3141 (  has_type_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ _null_	has_type_privilege_id_id _null_ _null_ _null_ ));
+DESCR("user privilege on type by user oid, type oid");
+DATA(insert OID = 3142 (  has_type_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ has_type_privilege_name _null_ _null_ _null_ ));
+DESCR("current user privilege on type by type name");
+DATA(insert OID = 3143 (  has_type_privilege		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ _null_ has_type_privilege_id _null_ _null_ _null_ ));
+DESCR("current user privilege on type by type oid");
+
+DATA(insert OID = 2705 (  pg_has_role		PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 19 25" _null_ _null_ _null_ _null_ _null_	pg_has_role_name_name _null_ _null_ _null_ ));
+DESCR("user privilege on role by username, role name");
+DATA(insert OID = 2706 (  pg_has_role		PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ _null_	pg_has_role_name_id _null_ _null_ _null_ ));
+DESCR("user privilege on role by username, role oid");
+DATA(insert OID = 2707 (  pg_has_role		PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 19 25" _null_ _null_ _null_ _null_ _null_	pg_has_role_id_name _null_ _null_ _null_ ));
+DESCR("user privilege on role by user oid, role name");
+DATA(insert OID = 2708 (  pg_has_role		PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ _null_	pg_has_role_id_id _null_ _null_ _null_ ));
+DESCR("user privilege on role by user oid, role oid");
+DATA(insert OID = 2709 (  pg_has_role		PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "19 25" _null_ _null_ _null_ _null_ _null_ pg_has_role_name _null_ _null_ _null_ ));
+DESCR("current user privilege on role by role name");
+DATA(insert OID = 2710 (  pg_has_role		PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ _null_ pg_has_role_id _null_ _null_ _null_ ));
+DESCR("current user privilege on role by role oid");
+
+DATA(insert OID = 1269 (  pg_column_size		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 23 "2276" _null_ _null_ _null_ _null_ _null_	pg_column_size _null_ _null_ _null_ ));
+DESCR("bytes required to store the value, perhaps with compression");
+DATA(insert OID = 2322 ( pg_tablespace_size		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_tablespace_size_oid _null_ _null_ _null_ ));
+DESCR("total disk space usage for the specified tablespace");
+DATA(insert OID = 2323 ( pg_tablespace_size		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "19" _null_ _null_ _null_ _null_ _null_ pg_tablespace_size_name _null_ _null_ _null_ ));
+DESCR("total disk space usage for the specified tablespace");
+DATA(insert OID = 2324 ( pg_database_size		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_database_size_oid _null_ _null_ _null_ ));
+DESCR("total disk space usage for the specified database");
+DATA(insert OID = 2168 ( pg_database_size		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "19" _null_ _null_ _null_ _null_ _null_ pg_database_size_name _null_ _null_ _null_ ));
+DESCR("total disk space usage for the specified database");
+DATA(insert OID = 2325 ( pg_relation_size		PGNSP PGUID 14 1 0 0 0 f f f f t f v 1 0 20 "2205" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.pg_relation_size($1, ''main'')" _null_ _null_ _null_ ));
+DESCR("disk space usage for the main fork of the specified table or index");
+DATA(insert OID = 2332 ( pg_relation_size		PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 20 "2205 25" _null_ _null_ _null_ _null_ _null_ pg_relation_size _null_ _null_ _null_ ));
+DESCR("disk space usage for the specified fork of a table or index");
+DATA(insert OID = 2286 ( pg_total_relation_size PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "2205" _null_ _null_ _null_ _null_ _null_ pg_total_relation_size _null_ _null_ _null_ ));
+DESCR("total disk space usage for the specified table and associated indexes");
+DATA(insert OID = 2288 ( pg_size_pretty			PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 25 "20" _null_ _null_ _null_ _null_ _null_ pg_size_pretty _null_ _null_ _null_ ));
+DESCR("convert a long int to a human readable text using size units");
+DATA(insert OID = 3166 ( pg_size_pretty			PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 25 "1700" _null_ _null_ _null_ _null_ _null_ pg_size_pretty_numeric _null_ _null_ _null_ ));
+DESCR("convert a numeric to a human readable text using size units");
+DATA(insert OID = 2997 ( pg_table_size			PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "2205" _null_ _null_ _null_ _null_ _null_ pg_table_size _null_ _null_ _null_ ));
+DESCR("disk space usage for the specified table, including TOAST, free space and visibility map");
+DATA(insert OID = 2998 ( pg_indexes_size		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "2205" _null_ _null_ _null_ _null_ _null_ pg_indexes_size _null_ _null_ _null_ ));
+DESCR("disk space usage for all indexes attached to the specified table");
+DATA(insert OID = 2999 ( pg_relation_filenode	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 26 "2205" _null_ _null_ _null_ _null_ _null_ pg_relation_filenode _null_ _null_ _null_ ));
+DESCR("filenode identifier of relation");
+DATA(insert OID = 3454 ( pg_filenode_relation PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 2205 "26 26" _null_ _null_ _null_ _null_ _null_ pg_filenode_relation _null_ _null_ _null_ ));
+DESCR("relation OID for filenode and tablespace");
+DATA(insert OID = 3034 ( pg_relation_filepath	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "2205" _null_ _null_ _null_ _null_ _null_ pg_relation_filepath _null_ _null_ _null_ ));
+DESCR("file path of relation");
+
+DATA(insert OID = 2316 ( postgresql_fdw_validator PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1009 26" _null_ _null_ _null_ _null_ _null_ postgresql_fdw_validator _null_ _null_ _null_));
+DESCR("(internal)");
+
+DATA(insert OID = 2290 (  record_in			PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 2249 "2275 26 23" _null_ _null_ _null_ _null_ _null_	record_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2291 (  record_out		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2249" _null_ _null_ _null_ _null_ _null_ record_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2292 (  cstring_in		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2275" _null_ _null_ _null_ _null_ _null_ cstring_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2293 (  cstring_out		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2275" _null_ _null_ _null_ _null_ _null_ cstring_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2294 (  any_in			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2276 "2275" _null_ _null_ _null_ _null_ _null_ any_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2295 (  any_out			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2276" _null_ _null_ _null_ _null_ _null_ any_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2296 (  anyarray_in		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2277 "2275" _null_ _null_ _null_ _null_ _null_ anyarray_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2297 (  anyarray_out		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2277" _null_ _null_ _null_ _null_ _null_ anyarray_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2298 (  void_in			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2275" _null_ _null_ _null_ _null_ _null_ void_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2299 (  void_out			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2278" _null_ _null_ _null_ _null_ _null_ void_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2300 (  trigger_in		PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 2279 "2275" _null_ _null_ _null_ _null_ _null_ trigger_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2301 (  trigger_out		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2279" _null_ _null_ _null_ _null_ _null_ trigger_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3594 (  event_trigger_in	PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 3838 "2275" _null_ _null_ _null_ _null_ _null_ event_trigger_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3595 (  event_trigger_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "3838" _null_ _null_ _null_ _null_ _null_ event_trigger_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2302 (  language_handler_in	PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 2280 "2275" _null_ _null_ _null_ _null_ _null_ language_handler_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2303 (  language_handler_out	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2280" _null_ _null_ _null_ _null_ _null_ language_handler_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2304 (  internal_in		PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 2281 "2275" _null_ _null_ _null_ _null_ _null_ internal_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2305 (  internal_out		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2281" _null_ _null_ _null_ _null_ _null_ internal_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2306 (  opaque_in			PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 2282 "2275" _null_ _null_ _null_ _null_ _null_ opaque_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2307 (  opaque_out		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2282" _null_ _null_ _null_ _null_ _null_ opaque_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2312 (  anyelement_in		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2283 "2275" _null_ _null_ _null_ _null_ _null_ anyelement_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2313 (  anyelement_out	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2283" _null_ _null_ _null_ _null_ _null_ anyelement_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2398 (  shell_in			PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 2282 "2275" _null_ _null_ _null_ _null_ _null_ shell_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2399 (  shell_out			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2282" _null_ _null_ _null_ _null_ _null_ shell_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2597 (  domain_in			PGNSP PGUID 12 1 0 0 0 f f f f f f s 3 0 2276 "2275 26 23" _null_ _null_ _null_ _null_ _null_ domain_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2598 (  domain_recv		PGNSP PGUID 12 1 0 0 0 f f f f f f s 3 0 2276 "2281 26 23" _null_ _null_ _null_ _null_ _null_ domain_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2777 (  anynonarray_in	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2776 "2275" _null_ _null_ _null_ _null_ _null_ anynonarray_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2778 (  anynonarray_out	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2776" _null_ _null_ _null_ _null_ _null_ anynonarray_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3116 (  fdw_handler_in	PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 3115 "2275" _null_ _null_ _null_ _null_ _null_ fdw_handler_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3117 (  fdw_handler_out	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "3115" _null_ _null_ _null_ _null_ _null_ fdw_handler_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3311 (  tsm_handler_in	PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 3310 "2275" _null_ _null_ _null_ _null_ _null_ tsm_handler_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3312 (  tsm_handler_out	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "3310" _null_ _null_ _null_ _null_ _null_ tsm_handler_out _null_ _null_ _null_ ));
+DESCR("I/O");
+
+/* tablesample method handlers */
+DATA(insert OID = 3313 (  bernoulli			PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 3310 "2281" _null_ _null_ _null_ _null_ _null_ tsm_bernoulli_handler _null_ _null_ _null_ ));
+DESCR("BERNOULLI tablesample method handler");
+DATA(insert OID = 3314 (  system			PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 3310 "2281" _null_ _null_ _null_ _null_ _null_ tsm_system_handler _null_ _null_ _null_ ));
+DESCR("SYSTEM tablesample method handler");
+
+/* cryptographic */
+DATA(insert OID =  2311 (  md5	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ _null_ md5_text _null_ _null_ _null_ ));
+DESCR("MD5 hash");
+DATA(insert OID =  2321 (  md5	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "17" _null_ _null_ _null_ _null_ _null_ md5_bytea _null_ _null_ _null_ ));
+DESCR("MD5 hash");
+
+/* crosstype operations for date vs. timestamp and timestamptz */
+DATA(insert OID = 2338 (  date_lt_timestamp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1082 1114" _null_ _null_ _null_ _null_ _null_ date_lt_timestamp _null_ _null_ _null_ ));
+DATA(insert OID = 2339 (  date_le_timestamp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1082 1114" _null_ _null_ _null_ _null_ _null_ date_le_timestamp _null_ _null_ _null_ ));
+DATA(insert OID = 2340 (  date_eq_timestamp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1082 1114" _null_ _null_ _null_ _null_ _null_ date_eq_timestamp _null_ _null_ _null_ ));
+DATA(insert OID = 2341 (  date_gt_timestamp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1082 1114" _null_ _null_ _null_ _null_ _null_ date_gt_timestamp _null_ _null_ _null_ ));
+DATA(insert OID = 2342 (  date_ge_timestamp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1082 1114" _null_ _null_ _null_ _null_ _null_ date_ge_timestamp _null_ _null_ _null_ ));
+DATA(insert OID = 2343 (  date_ne_timestamp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1082 1114" _null_ _null_ _null_ _null_ _null_ date_ne_timestamp _null_ _null_ _null_ ));
+DATA(insert OID = 2344 (  date_cmp_timestamp	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1082 1114" _null_ _null_ _null_ _null_ _null_ date_cmp_timestamp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+DATA(insert OID = 2351 (  date_lt_timestamptz	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1082 1184" _null_ _null_ _null_ _null_ _null_ date_lt_timestamptz _null_ _null_ _null_ ));
+DATA(insert OID = 2352 (  date_le_timestamptz	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1082 1184" _null_ _null_ _null_ _null_ _null_ date_le_timestamptz _null_ _null_ _null_ ));
+DATA(insert OID = 2353 (  date_eq_timestamptz	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1082 1184" _null_ _null_ _null_ _null_ _null_ date_eq_timestamptz _null_ _null_ _null_ ));
+DATA(insert OID = 2354 (  date_gt_timestamptz	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1082 1184" _null_ _null_ _null_ _null_ _null_ date_gt_timestamptz _null_ _null_ _null_ ));
+DATA(insert OID = 2355 (  date_ge_timestamptz	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1082 1184" _null_ _null_ _null_ _null_ _null_ date_ge_timestamptz _null_ _null_ _null_ ));
+DATA(insert OID = 2356 (  date_ne_timestamptz	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1082 1184" _null_ _null_ _null_ _null_ _null_ date_ne_timestamptz _null_ _null_ _null_ ));
+DATA(insert OID = 2357 (  date_cmp_timestamptz	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 23 "1082 1184" _null_ _null_ _null_ _null_ _null_ date_cmp_timestamptz _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+DATA(insert OID = 2364 (  timestamp_lt_date		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1114 1082" _null_ _null_ _null_ _null_ _null_ timestamp_lt_date _null_ _null_ _null_ ));
+DATA(insert OID = 2365 (  timestamp_le_date		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1114 1082" _null_ _null_ _null_ _null_ _null_ timestamp_le_date _null_ _null_ _null_ ));
+DATA(insert OID = 2366 (  timestamp_eq_date		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1114 1082" _null_ _null_ _null_ _null_ _null_ timestamp_eq_date _null_ _null_ _null_ ));
+DATA(insert OID = 2367 (  timestamp_gt_date		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1114 1082" _null_ _null_ _null_ _null_ _null_ timestamp_gt_date _null_ _null_ _null_ ));
+DATA(insert OID = 2368 (  timestamp_ge_date		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1114 1082" _null_ _null_ _null_ _null_ _null_ timestamp_ge_date _null_ _null_ _null_ ));
+DATA(insert OID = 2369 (  timestamp_ne_date		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1114 1082" _null_ _null_ _null_ _null_ _null_ timestamp_ne_date _null_ _null_ _null_ ));
+DATA(insert OID = 2370 (  timestamp_cmp_date	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1114 1082" _null_ _null_ _null_ _null_ _null_ timestamp_cmp_date _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+DATA(insert OID = 2377 (  timestamptz_lt_date	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1082" _null_ _null_ _null_ _null_ _null_ timestamptz_lt_date _null_ _null_ _null_ ));
+DATA(insert OID = 2378 (  timestamptz_le_date	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1082" _null_ _null_ _null_ _null_ _null_ timestamptz_le_date _null_ _null_ _null_ ));
+DATA(insert OID = 2379 (  timestamptz_eq_date	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1082" _null_ _null_ _null_ _null_ _null_ timestamptz_eq_date _null_ _null_ _null_ ));
+DATA(insert OID = 2380 (  timestamptz_gt_date	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1082" _null_ _null_ _null_ _null_ _null_ timestamptz_gt_date _null_ _null_ _null_ ));
+DATA(insert OID = 2381 (  timestamptz_ge_date	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1082" _null_ _null_ _null_ _null_ _null_ timestamptz_ge_date _null_ _null_ _null_ ));
+DATA(insert OID = 2382 (  timestamptz_ne_date	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1082" _null_ _null_ _null_ _null_ _null_ timestamptz_ne_date _null_ _null_ _null_ ));
+DATA(insert OID = 2383 (  timestamptz_cmp_date	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 23 "1184 1082" _null_ _null_ _null_ _null_ _null_ timestamptz_cmp_date _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+/* crosstype operations for timestamp vs. timestamptz */
+DATA(insert OID = 2520 (  timestamp_lt_timestamptz	PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ _null_ timestamp_lt_timestamptz _null_ _null_ _null_ ));
+DATA(insert OID = 2521 (  timestamp_le_timestamptz	PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ _null_ timestamp_le_timestamptz _null_ _null_ _null_ ));
+DATA(insert OID = 2522 (  timestamp_eq_timestamptz	PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ _null_ timestamp_eq_timestamptz _null_ _null_ _null_ ));
+DATA(insert OID = 2523 (  timestamp_gt_timestamptz	PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ _null_ timestamp_gt_timestamptz _null_ _null_ _null_ ));
+DATA(insert OID = 2524 (  timestamp_ge_timestamptz	PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ _null_ timestamp_ge_timestamptz _null_ _null_ _null_ ));
+DATA(insert OID = 2525 (  timestamp_ne_timestamptz	PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ _null_ timestamp_ne_timestamptz _null_ _null_ _null_ ));
+DATA(insert OID = 2526 (  timestamp_cmp_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 23 "1114 1184" _null_ _null_ _null_ _null_ _null_ timestamp_cmp_timestamptz _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+DATA(insert OID = 2527 (  timestamptz_lt_timestamp	PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ _null_ timestamptz_lt_timestamp _null_ _null_ _null_ ));
+DATA(insert OID = 2528 (  timestamptz_le_timestamp	PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ _null_ timestamptz_le_timestamp _null_ _null_ _null_ ));
+DATA(insert OID = 2529 (  timestamptz_eq_timestamp	PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ _null_ timestamptz_eq_timestamp _null_ _null_ _null_ ));
+DATA(insert OID = 2530 (  timestamptz_gt_timestamp	PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ _null_ timestamptz_gt_timestamp _null_ _null_ _null_ ));
+DATA(insert OID = 2531 (  timestamptz_ge_timestamp	PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ _null_ timestamptz_ge_timestamp _null_ _null_ _null_ ));
+DATA(insert OID = 2532 (  timestamptz_ne_timestamp	PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ _null_ timestamptz_ne_timestamp _null_ _null_ _null_ ));
+DATA(insert OID = 2533 (  timestamptz_cmp_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 23 "1184 1114" _null_ _null_ _null_ _null_ _null_ timestamptz_cmp_timestamp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+
+/* send/receive functions */
+DATA(insert OID = 2400 (  array_recv		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 2277 "2281 26 23" _null_ _null_ _null_ _null_  _null_ array_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2401 (  array_send		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "2277" _null_ _null_ _null_ _null_ _null_	array_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2402 (  record_recv		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 2249 "2281 26 23" _null_ _null_ _null_ _null_  _null_ record_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2403 (  record_send		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "2249" _null_ _null_ _null_ _null_  _null_ record_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2404 (  int2recv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "2281" _null_ _null_ _null_ _null_ _null_	int2recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2405 (  int2send			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "21" _null_ _null_ _null_ _null_ _null_ int2send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2406 (  int4recv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "2281" _null_ _null_ _null_ _null_ _null_	int4recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2407 (  int4send			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "23" _null_ _null_ _null_ _null_ _null_ int4send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2408 (  int8recv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "2281" _null_ _null_ _null_ _null_ _null_	int8recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2409 (  int8send			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "20" _null_ _null_ _null_ _null_ _null_ int8send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2410 (  int2vectorrecv	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 22 "2281" _null_ _null_ _null_ _null_ _null_	int2vectorrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2411 (  int2vectorsend	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "22" _null_ _null_ _null_ _null_ _null_ int2vectorsend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2412 (  bytearecv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2281" _null_ _null_ _null_ _null_ _null_	bytearecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2413 (  byteasend			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "17" _null_ _null_ _null_ _null_ _null_ byteasend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2414 (  textrecv			   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "2281" _null_ _null_ _null_ _null_ _null_	textrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2415 (  textsend			   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "25" _null_ _null_ _null_ _null_ _null_ textsend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2416 (  unknownrecv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 705 "2281" _null_ _null_ _null_ _null_ _null_	unknownrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2417 (  unknownsend		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "705" _null_ _null_ _null_ _null_ _null_ unknownsend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2418 (  oidrecv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 26 "2281" _null_ _null_ _null_ _null_ _null_	oidrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2419 (  oidsend			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "26" _null_ _null_ _null_ _null_ _null_ oidsend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2420 (  oidvectorrecv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 30 "2281" _null_ _null_ _null_ _null_ _null_	oidvectorrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2421 (  oidvectorsend		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "30" _null_ _null_ _null_ _null_ _null_ oidvectorsend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2422 (  namerecv			   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 19 "2281" _null_ _null_ _null_ _null_ _null_	namerecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2423 (  namesend			   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "19" _null_ _null_ _null_ _null_ _null_ namesend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2424 (  float4recv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "2281" _null_ _null_ _null_ _null_ _null_	float4recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2425 (  float4send		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "700" _null_ _null_ _null_ _null_ _null_ float4send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2426 (  float8recv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "2281" _null_ _null_ _null_ _null_ _null_	float8recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2427 (  float8send		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "701" _null_ _null_ _null_ _null_ _null_ float8send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2428 (  point_recv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "2281" _null_ _null_ _null_ _null_ _null_	point_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2429 (  point_send		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "600" _null_ _null_ _null_ _null_ _null_ point_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2430 (  bpcharrecv		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 1042 "2281 26 23" _null_ _null_ _null_ _null_  _null_ bpcharrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2431 (  bpcharsend		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "1042" _null_ _null_ _null_ _null_ _null_	bpcharsend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2432 (  varcharrecv		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 1043 "2281 26 23" _null_ _null_ _null_ _null_  _null_ varcharrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2433 (  varcharsend		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "1043" _null_ _null_ _null_ _null_ _null_	varcharsend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2434 (  charrecv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 18 "2281" _null_ _null_ _null_ _null_ _null_	charrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2435 (  charsend			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "18" _null_ _null_ _null_ _null_ _null_ charsend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2436 (  boolrecv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "2281" _null_ _null_ _null_ _null_ _null_	boolrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2437 (  boolsend			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "16" _null_ _null_ _null_ _null_ _null_ boolsend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2438 (  tidrecv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 27 "2281" _null_ _null_ _null_ _null_ _null_	tidrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2439 (  tidsend			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "27" _null_ _null_ _null_ _null_ _null_ tidsend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2440 (  xidrecv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 28 "2281" _null_ _null_ _null_ _null_ _null_	xidrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2441 (  xidsend			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "28" _null_ _null_ _null_ _null_ _null_ xidsend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2442 (  cidrecv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 29 "2281" _null_ _null_ _null_ _null_ _null_	cidrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2443 (  cidsend			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "29" _null_ _null_ _null_ _null_ _null_ cidsend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2444 (  regprocrecv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 24 "2281" _null_ _null_ _null_ _null_ _null_	regprocrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2445 (  regprocsend		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "24" _null_ _null_ _null_ _null_ _null_ regprocsend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2446 (  regprocedurerecv	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2202 "2281" _null_ _null_ _null_ _null_ _null_ regprocedurerecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2447 (  regproceduresend	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2202" _null_ _null_ _null_ _null_ _null_	regproceduresend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2448 (  regoperrecv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2203 "2281" _null_ _null_ _null_ _null_ _null_ regoperrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2449 (  regopersend		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2203" _null_ _null_ _null_ _null_ _null_	regopersend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2450 (  regoperatorrecv	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2204 "2281" _null_ _null_ _null_ _null_ _null_ regoperatorrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2451 (  regoperatorsend	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2204" _null_ _null_ _null_ _null_ _null_	regoperatorsend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2452 (  regclassrecv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2205 "2281" _null_ _null_ _null_ _null_ _null_ regclassrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2453 (  regclasssend		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2205" _null_ _null_ _null_ _null_ _null_	regclasssend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2454 (  regtyperecv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2206 "2281" _null_ _null_ _null_ _null_ _null_ regtyperecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2455 (  regtypesend		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2206" _null_ _null_ _null_ _null_ _null_	regtypesend _null_ _null_ _null_ ));
+DESCR("I/O");
+
+DATA(insert OID = 4094 (  regrolerecv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 4096 "2281" _null_ _null_ _null_ _null_ _null_	regrolerecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 4095 (  regrolesend		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "4096" _null_ _null_ _null_ _null_ _null_	regrolesend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 4087 (  regnamespacerecv	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 4089 "2281" _null_ _null_ _null_ _null_ _null_ regnamespacerecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 4088 (  regnamespacesend	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "4089" _null_ _null_ _null_ _null_ _null_	regnamespacesend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2456 (  bit_recv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1560 "2281 26 23" _null_ _null_ _null_ _null_  _null_ bit_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2457 (  bit_send			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1560" _null_ _null_ _null_ _null_ _null_	bit_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2458 (  varbit_recv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1562 "2281 26 23" _null_ _null_ _null_ _null_  _null_ varbit_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2459 (  varbit_send		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1562" _null_ _null_ _null_ _null_ _null_	varbit_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2460 (  numeric_recv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1700 "2281 26 23" _null_ _null_ _null_ _null_  _null_ numeric_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2461 (  numeric_send		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1700" _null_ _null_ _null_ _null_ _null_	numeric_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2462 (  abstimerecv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 702 "2281" _null_ _null_ _null_ _null_ _null_	abstimerecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2463 (  abstimesend		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "702" _null_ _null_ _null_ _null_ _null_ abstimesend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2464 (  reltimerecv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 703 "2281" _null_ _null_ _null_ _null_ _null_	reltimerecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2465 (  reltimesend		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "703" _null_ _null_ _null_ _null_ _null_ reltimesend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2466 (  tintervalrecv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 704 "2281" _null_ _null_ _null_ _null_ _null_	tintervalrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2467 (  tintervalsend		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "704" _null_ _null_ _null_ _null_ _null_ tintervalsend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2468 (  date_recv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1082 "2281" _null_ _null_ _null_ _null_ _null_ date_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2469 (  date_send			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1082" _null_ _null_ _null_ _null_ _null_	date_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2470 (  time_recv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1083 "2281 26 23" _null_ _null_ _null_ _null_  _null_ time_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2471 (  time_send			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1083" _null_ _null_ _null_ _null_ _null_	time_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2472 (  timetz_recv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1266 "2281 26 23" _null_ _null_ _null_ _null_  _null_ timetz_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2473 (  timetz_send		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1266" _null_ _null_ _null_ _null_ _null_	timetz_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2474 (  timestamp_recv	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1114 "2281 26 23" _null_ _null_ _null_ _null_  _null_ timestamp_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2475 (  timestamp_send	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1114" _null_ _null_ _null_ _null_ _null_	timestamp_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2476 (  timestamptz_recv	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1184 "2281 26 23" _null_ _null_ _null_ _null_  _null_ timestamptz_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2477 (  timestamptz_send	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1184" _null_ _null_ _null_ _null_ _null_	timestamptz_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2478 (  interval_recv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1186 "2281 26 23" _null_ _null_ _null_ _null_  _null_ interval_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2479 (  interval_send		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1186" _null_ _null_ _null_ _null_ _null_	interval_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2480 (  lseg_recv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 601 "2281" _null_ _null_ _null_ _null_ _null_	lseg_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2481 (  lseg_send			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "601" _null_ _null_ _null_ _null_ _null_ lseg_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2482 (  path_recv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 602 "2281" _null_ _null_ _null_ _null_ _null_	path_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2483 (  path_send			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "602" _null_ _null_ _null_ _null_ _null_ path_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2484 (  box_recv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 603 "2281" _null_ _null_ _null_ _null_ _null_	box_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2485 (  box_send			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "603" _null_ _null_ _null_ _null_ _null_ box_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2486 (  poly_recv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 604 "2281" _null_ _null_ _null_ _null_ _null_	poly_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2487 (  poly_send			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "604" _null_ _null_ _null_ _null_ _null_ poly_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2488 (  line_recv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 628 "2281" _null_ _null_ _null_ _null_ _null_	line_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2489 (  line_send			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "628" _null_ _null_ _null_ _null_ _null_ line_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2490 (  circle_recv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 718 "2281" _null_ _null_ _null_ _null_ _null_	circle_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2491 (  circle_send		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "718" _null_ _null_ _null_ _null_ _null_ circle_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2492 (  cash_recv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 790 "2281" _null_ _null_ _null_ _null_ _null_	cash_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2493 (  cash_send			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "790" _null_ _null_ _null_ _null_ _null_ cash_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2494 (  macaddr_recv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 829 "2281" _null_ _null_ _null_ _null_ _null_	macaddr_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2495 (  macaddr_send		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "829" _null_ _null_ _null_ _null_ _null_ macaddr_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2496 (  inet_recv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 869 "2281" _null_ _null_ _null_ _null_ _null_	inet_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2497 (  inet_send			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "869" _null_ _null_ _null_ _null_ _null_ inet_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2498 (  cidr_recv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 650 "2281" _null_ _null_ _null_ _null_ _null_	cidr_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2499 (  cidr_send			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "650" _null_ _null_ _null_ _null_ _null_ cidr_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2500 (  cstring_recv		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2281" _null_ _null_ _null_ _null_ _null_ cstring_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2501 (  cstring_send		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "2275" _null_ _null_ _null_ _null_ _null_	cstring_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2502 (  anyarray_recv		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2277 "2281" _null_ _null_ _null_ _null_ _null_ anyarray_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2503 (  anyarray_send		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "2277" _null_ _null_ _null_ _null_ _null_	anyarray_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3120 (  void_recv			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ void_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3121 (  void_send			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2278" _null_ _null_ _null_ _null_ _null_	void_send _null_ _null_ _null_ ));
+DESCR("I/O");
+
+/* System-view support functions with pretty-print option */
+DATA(insert OID = 2504 (  pg_get_ruledef	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "26 16" _null_ _null_ _null_ _null_ _null_	pg_get_ruledef_ext _null_ _null_ _null_ ));
+DESCR("source text of a rule with pretty-print option");
+DATA(insert OID = 2505 (  pg_get_viewdef	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "25 16" _null_ _null_ _null_ _null_ _null_	pg_get_viewdef_name_ext _null_ _null_ _null_ ));
+DESCR("select statement of a view with pretty-print option");
+DATA(insert OID = 2506 (  pg_get_viewdef	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "26 16" _null_ _null_ _null_ _null_ _null_	pg_get_viewdef_ext _null_ _null_ _null_ ));
+DESCR("select statement of a view with pretty-print option");
+DATA(insert OID = 3159 (  pg_get_viewdef	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "26 23" _null_ _null_ _null_ _null_ _null_	pg_get_viewdef_wrap _null_ _null_ _null_ ));
+DESCR("select statement of a view with pretty-printing and specified line wrapping");
+DATA(insert OID = 2507 (  pg_get_indexdef	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 25 "26 23 16" _null_ _null_ _null_ _null_ _null_	pg_get_indexdef_ext _null_ _null_ _null_ ));
+DESCR("index description (full create statement or single expression) with pretty-print option");
+DATA(insert OID = 2508 (  pg_get_constraintdef PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "26 16" _null_ _null_ _null_ _null_ _null_	pg_get_constraintdef_ext _null_ _null_ _null_ ));
+DESCR("constraint description with pretty-print option");
+DATA(insert OID = 2509 (  pg_get_expr		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 25 "194 26 16" _null_ _null_ _null_ _null_ _null_ pg_get_expr_ext _null_ _null_ _null_ ));
+DESCR("deparse an encoded expression with pretty-print option");
+DATA(insert OID = 2510 (  pg_prepared_statement PGNSP PGUID 12 1 1000 0 0 f f f f t t s 0 0 2249 "" "{25,25,1184,2211,16}" "{o,o,o,o,o}" "{name,statement,prepare_time,parameter_types,from_sql}" _null_ _null_ pg_prepared_statement _null_ _null_ _null_ ));
+DESCR("get the prepared statements for this session");
+DATA(insert OID = 2511 (  pg_cursor PGNSP PGUID 12 1 1000 0 0 f f f f t t s 0 0 2249 "" "{25,25,16,16,16,1184}" "{o,o,o,o,o,o}" "{name,statement,is_holdable,is_binary,is_scrollable,creation_time}" _null_ _null_ pg_cursor _null_ _null_ _null_ ));
+DESCR("get the open cursors for this session");
+DATA(insert OID = 2599 (  pg_timezone_abbrevs	PGNSP PGUID 12 1 1000 0 0 f f f f t t s 0 0 2249 "" "{25,1186,16}" "{o,o,o}" "{abbrev,utc_offset,is_dst}" _null_ _null_ pg_timezone_abbrevs _null_ _null_ _null_ ));
+DESCR("get the available time zone abbreviations");
+DATA(insert OID = 2856 (  pg_timezone_names		PGNSP PGUID 12 1 1000 0 0 f f f f t t s 0 0 2249 "" "{25,25,1186,16}" "{o,o,o,o}" "{name,abbrev,utc_offset,is_dst}" _null_ _null_ pg_timezone_names _null_ _null_ _null_ ));
+DESCR("get the available time zone names");
+DATA(insert OID = 2730 (  pg_get_triggerdef		PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "26 16" _null_ _null_ _null_ _null_ _null_ pg_get_triggerdef_ext _null_ _null_ _null_ ));
+DESCR("trigger description with pretty-print option");
+DATA(insert OID = 3035 (  pg_listening_channels PGNSP PGUID 12 1 10 0 0 f f f f t t s 0 0 25 "" _null_ _null_ _null_ _null_ _null_ pg_listening_channels _null_ _null_ _null_ ));
+DESCR("get the channels that the current backend listens to");
+DATA(insert OID = 3036 (  pg_notify				PGNSP PGUID 12 1 0 0 0 f f f f f f v 2 0 2278 "25 25" _null_ _null_ _null_ _null_ _null_ pg_notify _null_ _null_ _null_ ));
+DESCR("send a notification event");
+
+/* non-persistent series generator */
+DATA(insert OID = 1066 (  generate_series PGNSP PGUID 12 1 1000 0 0 f f f f t t i 3 0 23 "23 23 23" _null_ _null_ _null_ _null_ _null_ generate_series_step_int4 _null_ _null_ _null_ ));
+DESCR("non-persistent series generator");
+DATA(insert OID = 1067 (  generate_series PGNSP PGUID 12 1 1000 0 0 f f f f t t i 2 0 23 "23 23" _null_ _null_ _null_ _null_ _null_ generate_series_int4 _null_ _null_ _null_ ));
+DESCR("non-persistent series generator");
+DATA(insert OID = 1068 (  generate_series PGNSP PGUID 12 1 1000 0 0 f f f f t t i 3 0 20 "20 20 20" _null_ _null_ _null_ _null_ _null_ generate_series_step_int8 _null_ _null_ _null_ ));
+DESCR("non-persistent series generator");
+DATA(insert OID = 1069 (  generate_series PGNSP PGUID 12 1 1000 0 0 f f f f t t i 2 0 20 "20 20" _null_ _null_ _null_ _null_ _null_ generate_series_int8 _null_ _null_ _null_ ));
+DESCR("non-persistent series generator");
+DATA(insert OID = 3259 (  generate_series PGNSP PGUID 12 1 1000 0 0 f f f f t t i 3 0 1700 "1700 1700 1700" _null_ _null_ _null_ _null_ _null_ generate_series_step_numeric _null_ _null_ _null_ ));
+DESCR("non-persistent series generator");
+DATA(insert OID = 3260 (  generate_series PGNSP PGUID 12 1 1000 0 0 f f f f t t i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ _null_ generate_series_numeric _null_ _null_ _null_ ));
+DESCR("non-persistent series generator");
+DATA(insert OID = 938  (  generate_series PGNSP PGUID 12 1 1000 0 0 f f f f t t i 3 0 1114 "1114 1114 1186" _null_ _null_ _null_ _null_ _null_ generate_series_timestamp _null_ _null_ _null_ ));
+DESCR("non-persistent series generator");
+DATA(insert OID = 939  (  generate_series PGNSP PGUID 12 1 1000 0 0 f f f f t t s 3 0 1184 "1184 1184 1186" _null_ _null_ _null_ _null_ _null_ generate_series_timestamptz _null_ _null_ _null_ ));
+DESCR("non-persistent series generator");
+
+/* boolean aggregates */
+DATA(insert OID = 2515 ( booland_statefunc			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ _null_ booland_statefunc _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 2516 ( boolor_statefunc			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ _null_ boolor_statefunc _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 3496 ( bool_accum					   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 16" _null_ _null_ _null_ _null_ _null_ bool_accum _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 3497 ( bool_accum_inv				   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 16" _null_ _null_ _null_ _null_ _null_ bool_accum_inv _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 3498 ( bool_alltrue				   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "2281" _null_ _null_ _null_ _null_ _null_ bool_alltrue _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3499 ( bool_anytrue				   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "2281" _null_ _null_ _null_ _null_ _null_ bool_anytrue _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 2517 ( bool_and					   PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 16 "16" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("boolean-and aggregate");
+/* ANY, SOME? These names conflict with subquery operators. See doc. */
+DATA(insert OID = 2518 ( bool_or					   PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 16 "16" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("boolean-or aggregate");
+DATA(insert OID = 2519 ( every						   PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 16 "16" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("boolean-and aggregate");
+
+/* bitwise integer aggregates */
+DATA(insert OID = 2236 ( bit_and					   PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 21 "21" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("bitwise-and smallint aggregate");
+DATA(insert OID = 2237 ( bit_or						   PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 21 "21" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("bitwise-or smallint aggregate");
+DATA(insert OID = 2238 ( bit_and					   PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("bitwise-and integer aggregate");
+DATA(insert OID = 2239 ( bit_or						   PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("bitwise-or integer aggregate");
+DATA(insert OID = 2240 ( bit_and					   PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 20 "20" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("bitwise-and bigint aggregate");
+DATA(insert OID = 2241 ( bit_or						   PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 20 "20" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("bitwise-or bigint aggregate");
+DATA(insert OID = 2242 ( bit_and					   PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1560 "1560" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("bitwise-and bit aggregate");
+DATA(insert OID = 2243 ( bit_or						   PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1560 "1560" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("bitwise-or bit aggregate");
+
+/* formerly-missing interval + datetime operators */
+DATA(insert OID = 2546 ( interval_pl_date			PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 1114 "1186 1082" _null_ _null_ _null_ _null_	_null_ "select $2 + $1" _null_ _null_ _null_ ));
+DATA(insert OID = 2547 ( interval_pl_timetz			PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 1266 "1186 1266" _null_ _null_ _null_ _null_	_null_ "select $2 + $1" _null_ _null_ _null_ ));
+DATA(insert OID = 2548 ( interval_pl_timestamp		PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 1114 "1186 1114" _null_ _null_ _null_ _null_	_null_ "select $2 + $1" _null_ _null_ _null_ ));
+DATA(insert OID = 2549 ( interval_pl_timestamptz	PGNSP PGUID 14 1 0 0 0 f f f f t f s 2 0 1184 "1186 1184" _null_ _null_ _null_ _null_	_null_ "select $2 + $1" _null_ _null_ _null_ ));
+DATA(insert OID = 2550 ( integer_pl_date			PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 1082 "23 1082" _null_ _null_ _null_ _null_ _null_ "select $2 + $1" _null_ _null_ _null_ ));
+
+DATA(insert OID = 2556 ( pg_tablespace_databases	PGNSP PGUID 12 1 1000 0 0 f f f f t t s 1 0 26 "26" _null_ _null_ _null_ _null_ _null_ pg_tablespace_databases _null_ _null_ _null_ ));
+DESCR("get OIDs of databases in a tablespace");
+
+DATA(insert OID = 2557 ( bool				   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "23" _null_ _null_ _null_ _null_ _null_ int4_bool _null_ _null_ _null_ ));
+DESCR("convert int4 to boolean");
+DATA(insert OID = 2558 ( int4				   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "16" _null_ _null_ _null_ _null_ _null_ bool_int4 _null_ _null_ _null_ ));
+DESCR("convert boolean to int4");
+DATA(insert OID = 2559 ( lastval			   PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 20 "" _null_ _null_ _null_ _null_ _null_	lastval _null_ _null_ _null_ ));
+DESCR("current value from last used sequence");
+
+/* start time function */
+DATA(insert OID = 2560 (  pg_postmaster_start_time	PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ _null_ pg_postmaster_start_time _null_ _null_ _null_ ));
+DESCR("postmaster start time");
+/* config reload time function */
+DATA(insert OID = 2034 (  pg_conf_load_time			PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ _null_ pg_conf_load_time _null_ _null_ _null_ ));
+DESCR("configuration load time");
+
+/* new functions for Y-direction rtree opclasses */
+DATA(insert OID = 2562 (  box_below		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_below _null_ _null_ _null_ ));
+DATA(insert OID = 2563 (  box_overbelow    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_overbelow _null_ _null_ _null_ ));
+DATA(insert OID = 2564 (  box_overabove    PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_overabove _null_ _null_ _null_ ));
+DATA(insert OID = 2565 (  box_above		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ _null_ box_above _null_ _null_ _null_ ));
+DATA(insert OID = 2566 (  poly_below	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ _null_ poly_below _null_ _null_ _null_ ));
+DATA(insert OID = 2567 (  poly_overbelow   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ _null_ poly_overbelow _null_ _null_ _null_ ));
+DATA(insert OID = 2568 (  poly_overabove   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ _null_ poly_overabove _null_ _null_ _null_ ));
+DATA(insert OID = 2569 (  poly_above	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ _null_ poly_above _null_ _null_ _null_ ));
+DATA(insert OID = 2587 (  circle_overbelow		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_overbelow _null_ _null_ _null_ ));
+DATA(insert OID = 2588 (  circle_overabove		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_  _null_ circle_overabove _null_ _null_ _null_ ));
+
+/* support functions for GiST r-tree emulation */
+DATA(insert OID = 2578 (  gist_box_consistent	PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 16 "2281 603 23 26 2281" _null_ _null_ _null_ _null_ _null_	gist_box_consistent _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 2579 (  gist_box_compress		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ gist_box_compress _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 2580 (  gist_box_decompress	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ gist_box_decompress _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3281 (  gist_box_fetch	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ gist_box_fetch _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 2581 (  gist_box_penalty		PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_	gist_box_penalty _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 2582 (  gist_box_picksplit	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_	gist_box_picksplit _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 2583 (  gist_box_union		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 603 "2281 2281" _null_ _null_ _null_ _null_ _null_ gist_box_union _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 2584 (  gist_box_same			PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "603 603 2281" _null_ _null_ _null_ _null_ _null_ gist_box_same _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 2585 (  gist_poly_consistent	PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 16 "2281 604 23 26 2281" _null_ _null_ _null_ _null_ _null_	gist_poly_consistent _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 2586 (  gist_poly_compress	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ gist_poly_compress _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 2591 (  gist_circle_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 16 "2281 718 23 26 2281" _null_ _null_ _null_ _null_ _null_	gist_circle_consistent _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 2592 (  gist_circle_compress	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ gist_circle_compress _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 1030 (  gist_point_compress	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ gist_point_compress _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3282 (  gist_point_fetch	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ gist_point_fetch _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 2179 (  gist_point_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 16 "2281 600 23 26 2281" _null_ _null_ _null_ _null_ _null_	gist_point_consistent _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3064 (  gist_point_distance	PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 701 "2281 600 23 26" _null_ _null_ _null_ _null_ _null_	gist_point_distance _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3288 (  gist_bbox_distance	PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 701 "2281 600 23 26" _null_ _null_ _null_ _null_ _null_	gist_bbox_distance _null_ _null_ _null_ ));
+DESCR("GiST support");
+
+/* GIN */
+DATA(insert OID = 2731 (  gingetbitmap	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ _null_	gingetbitmap _null_ _null_ _null_ ));
+DESCR("gin(internal)");
+DATA(insert OID = 2732 (  gininsert		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 6 0 16 "2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_	gininsert _null_ _null_ _null_ ));
+DESCR("gin(internal)");
+DATA(insert OID = 2733 (  ginbeginscan	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_	ginbeginscan _null_ _null_ _null_ ));
+DESCR("gin(internal)");
+DATA(insert OID = 2734 (  ginrescan		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 5 0 2278 "2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ ginrescan _null_ _null_ _null_ ));
+DESCR("gin(internal)");
+DATA(insert OID = 2735 (  ginendscan	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ ginendscan _null_ _null_ _null_ ));
+DESCR("gin(internal)");
+DATA(insert OID = 2736 (  ginmarkpos	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ ginmarkpos _null_ _null_ _null_ ));
+DESCR("gin(internal)");
+DATA(insert OID = 2737 (  ginrestrpos	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ ginrestrpos _null_ _null_ _null_ ));
+DESCR("gin(internal)");
+DATA(insert OID = 2738 (  ginbuild		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ ginbuild _null_ _null_ _null_ ));
+DESCR("gin(internal)");
+DATA(insert OID = 325 (  ginbuildempty	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ ginbuildempty _null_ _null_ _null_ ));
+DESCR("gin(internal)");
+DATA(insert OID = 2739 (  ginbulkdelete    PGNSP PGUID 12 1 0 0 0 f f f f t f v 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ ginbulkdelete _null_ _null_ _null_ ));
+DESCR("gin(internal)");
+DATA(insert OID = 2740 (  ginvacuumcleanup PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ ginvacuumcleanup _null_ _null_ _null_ ));
+DESCR("gin(internal)");
+DATA(insert OID = 2741 (  gincostestimate  PGNSP PGUID 12 1 0 0 0 f f f f t f v 7 0 2278 "2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gincostestimate _null_ _null_ _null_ ));
+DESCR("gin(internal)");
+DATA(insert OID = 2788 (  ginoptions	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 17 "1009 16" _null_ _null_ _null_ _null_  _null_ ginoptions _null_ _null_ _null_ ));
+DESCR("gin(internal)");
+
+/* GIN array support */
+DATA(insert OID = 2743 (  ginarrayextract	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2277 2281 2281" _null_ _null_ _null_ _null_ _null_ ginarrayextract _null_ _null_ _null_ ));
+DESCR("GIN array support");
+DATA(insert OID = 2774 (  ginqueryarrayextract	PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 2281 "2277 2281 21 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ ginqueryarrayextract _null_ _null_ _null_ ));
+DESCR("GIN array support");
+DATA(insert OID = 2744 (  ginarrayconsistent	PGNSP PGUID 12 1 0 0 0 f f f f t f i 8 0 16 "2281 21 2277 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ ginarrayconsistent _null_ _null_ _null_ ));
+DESCR("GIN array support");
+DATA(insert OID = 3920 (  ginarraytriconsistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 18 "2281 21 2277 23 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ ginarraytriconsistent _null_ _null_ _null_ ));
+DESCR("GIN array support");
+DATA(insert OID = 3076 (  ginarrayextract	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2277 2281" _null_ _null_ _null_ _null_ _null_	ginarrayextract_2args _null_ _null_ _null_ ));
+DESCR("GIN array support (obsolete)");
+
+/* overlap/contains/contained */
+DATA(insert OID = 2747 (  arrayoverlap		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ _null_ arrayoverlap _null_ _null_ _null_ ));
+DATA(insert OID = 2748 (  arraycontains		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ _null_ arraycontains _null_ _null_ _null_ ));
+DATA(insert OID = 2749 (  arraycontained	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ _null_ arraycontained _null_ _null_ _null_ ));
+
+/* BRIN minmax */
+DATA(insert OID = 3383 ( brin_minmax_opcinfo	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ brin_minmax_opcinfo _null_ _null_ _null_ ));
+DESCR("BRIN minmax support");
+DATA(insert OID = 3384 ( brin_minmax_add_value	PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 16 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ brin_minmax_add_value _null_ _null_ _null_ ));
+DESCR("BRIN minmax support");
+DATA(insert OID = 3385 ( brin_minmax_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 16 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ brin_minmax_consistent _null_ _null_ _null_ ));
+DESCR("BRIN minmax support");
+DATA(insert OID = 3386 ( brin_minmax_union		PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 16 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ brin_minmax_union _null_ _null_ _null_ ));
+DESCR("BRIN minmax support");
+
+/* BRIN inclusion */
+DATA(insert OID = 4105 ( brin_inclusion_opcinfo PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ brin_inclusion_opcinfo _null_ _null_ _null_ ));
+DESCR("BRIN inclusion support");
+DATA(insert OID = 4106 ( brin_inclusion_add_value PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 16 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ brin_inclusion_add_value _null_ _null_ _null_ ));
+DESCR("BRIN inclusion support");
+DATA(insert OID = 4107 ( brin_inclusion_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 16 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ brin_inclusion_consistent _null_ _null_ _null_ ));
+DESCR("BRIN inclusion support");
+DATA(insert OID = 4108 ( brin_inclusion_union	PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 16 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ brin_inclusion_union _null_ _null_ _null_ ));
+DESCR("BRIN inclusion support");
+
+/* userlock replacements */
+DATA(insert OID = 2880 (  pg_advisory_lock				PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "20" _null_ _null_ _null_ _null_ _null_ pg_advisory_lock_int8 _null_ _null_ _null_ ));
+DESCR("obtain exclusive advisory lock");
+DATA(insert OID = 3089 (  pg_advisory_xact_lock				PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "20" _null_ _null_ _null_ _null_ _null_ pg_advisory_xact_lock_int8 _null_ _null_ _null_ ));
+DESCR("obtain exclusive advisory lock");
+DATA(insert OID = 2881 (  pg_advisory_lock_shared		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "20" _null_ _null_ _null_ _null_ _null_ pg_advisory_lock_shared_int8 _null_ _null_ _null_ ));
+DESCR("obtain shared advisory lock");
+DATA(insert OID = 3090 (  pg_advisory_xact_lock_shared		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "20" _null_ _null_ _null_ _null_ _null_ pg_advisory_xact_lock_shared_int8 _null_ _null_ _null_ ));
+DESCR("obtain shared advisory lock");
+DATA(insert OID = 2882 (  pg_try_advisory_lock			PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "20" _null_ _null_ _null_ _null_ _null_ pg_try_advisory_lock_int8 _null_ _null_ _null_ ));
+DESCR("obtain exclusive advisory lock if available");
+DATA(insert OID = 3091 (  pg_try_advisory_xact_lock			PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "20" _null_ _null_ _null_ _null_ _null_ pg_try_advisory_xact_lock_int8 _null_ _null_ _null_ ));
+DESCR("obtain exclusive advisory lock if available");
+DATA(insert OID = 2883 (  pg_try_advisory_lock_shared	PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "20" _null_ _null_ _null_ _null_ _null_ pg_try_advisory_lock_shared_int8 _null_ _null_ _null_ ));
+DESCR("obtain shared advisory lock if available");
+DATA(insert OID = 3092 (  pg_try_advisory_xact_lock_shared	PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "20" _null_ _null_ _null_ _null_ _null_ pg_try_advisory_xact_lock_shared_int8 _null_ _null_ _null_ ));
+DESCR("obtain shared advisory lock if available");
+DATA(insert OID = 2884 (  pg_advisory_unlock			PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "20" _null_ _null_ _null_ _null_ _null_ pg_advisory_unlock_int8 _null_ _null_ _null_ ));
+DESCR("release exclusive advisory lock");
+DATA(insert OID = 2885 (  pg_advisory_unlock_shared		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "20" _null_ _null_ _null_ _null_ _null_ pg_advisory_unlock_shared_int8 _null_ _null_ _null_ ));
+DESCR("release shared advisory lock");
+DATA(insert OID = 2886 (  pg_advisory_lock				PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2278 "23 23" _null_ _null_ _null_ _null_ _null_ pg_advisory_lock_int4 _null_ _null_ _null_ ));
+DESCR("obtain exclusive advisory lock");
+DATA(insert OID = 3093 (  pg_advisory_xact_lock				PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2278 "23 23" _null_ _null_ _null_ _null_ _null_ pg_advisory_xact_lock_int4 _null_ _null_ _null_ ));
+DESCR("obtain exclusive advisory lock");
+DATA(insert OID = 2887 (  pg_advisory_lock_shared		PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2278 "23 23" _null_ _null_ _null_ _null_ _null_ pg_advisory_lock_shared_int4 _null_ _null_ _null_ ));
+DESCR("obtain shared advisory lock");
+DATA(insert OID = 3094 (  pg_advisory_xact_lock_shared		PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2278 "23 23" _null_ _null_ _null_ _null_ _null_ pg_advisory_xact_lock_shared_int4 _null_ _null_ _null_ ));
+DESCR("obtain shared advisory lock");
+DATA(insert OID = 2888 (  pg_try_advisory_lock			PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "23 23" _null_ _null_ _null_ _null_ _null_ pg_try_advisory_lock_int4 _null_ _null_ _null_ ));
+DESCR("obtain exclusive advisory lock if available");
+DATA(insert OID = 3095 (  pg_try_advisory_xact_lock			PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "23 23" _null_ _null_ _null_ _null_ _null_ pg_try_advisory_xact_lock_int4 _null_ _null_ _null_ ));
+DESCR("obtain exclusive advisory lock if available");
+DATA(insert OID = 2889 (  pg_try_advisory_lock_shared	PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "23 23" _null_ _null_ _null_ _null_ _null_ pg_try_advisory_lock_shared_int4 _null_ _null_ _null_ ));
+DESCR("obtain shared advisory lock if available");
+DATA(insert OID = 3096 (  pg_try_advisory_xact_lock_shared	PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "23 23" _null_ _null_ _null_ _null_ _null_ pg_try_advisory_xact_lock_shared_int4 _null_ _null_ _null_ ));
+DESCR("obtain shared advisory lock if available");
+DATA(insert OID = 2890 (  pg_advisory_unlock			PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "23 23" _null_ _null_ _null_ _null_ _null_ pg_advisory_unlock_int4 _null_ _null_ _null_ ));
+DESCR("release exclusive advisory lock");
+DATA(insert OID = 2891 (  pg_advisory_unlock_shared		PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "23 23" _null_ _null_ _null_ _null_ _null_ pg_advisory_unlock_shared_int4 _null_ _null_ _null_ ));
+DESCR("release shared advisory lock");
+DATA(insert OID = 2892 (  pg_advisory_unlock_all		PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2278 "" _null_ _null_ _null_ _null_ _null_ pg_advisory_unlock_all _null_ _null_ _null_ ));
+DESCR("release all advisory locks");
+
+/* XML support */
+DATA(insert OID = 2893 (  xml_in		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 142 "2275" _null_ _null_ _null_ _null_ _null_ xml_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2894 (  xml_out		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "142" _null_ _null_ _null_ _null_ _null_ xml_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2895 (  xmlcomment	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 142 "25" _null_ _null_ _null_ _null_ _null_ xmlcomment _null_ _null_ _null_ ));
+DESCR("generate XML comment");
+DATA(insert OID = 2896 (  xml			   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 142 "25" _null_ _null_ _null_ _null_ _null_ texttoxml _null_ _null_ _null_ ));
+DESCR("perform a non-validating parse of a character string to produce an XML value");
+DATA(insert OID = 2897 (  xmlvalidate	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "142 25" _null_ _null_ _null_ _null_ _null_ xmlvalidate _null_ _null_ _null_ ));
+DESCR("validate an XML value");
+DATA(insert OID = 2898 (  xml_recv		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 142 "2281" _null_ _null_ _null_ _null_ _null_	xml_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2899 (  xml_send		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "142" _null_ _null_ _null_ _null_ _null_ xml_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2900 (  xmlconcat2	   PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 142 "142 142" _null_ _null_ _null_ _null_ _null_ xmlconcat2 _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 2901 (  xmlagg		   PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 142 "142" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("concatenate XML values");
+DATA(insert OID = 2922 (  text			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "142" _null_ _null_ _null_ _null_ _null_ xmltotext _null_ _null_ _null_ ));
+DESCR("serialize an XML value to a character string");
+
+DATA(insert OID = 2923 (  table_to_xml				  PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "2205 16 16 25" _null_ _null_ "{tbl,nulls,tableforest,targetns}" _null_ _null_ table_to_xml _null_ _null_ _null_ ));
+DESCR("map table contents to XML");
+DATA(insert OID = 2924 (  query_to_xml				  PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "25 16 16 25" _null_ _null_ "{query,nulls,tableforest,targetns}" _null_ _null_ query_to_xml _null_ _null_ _null_ ));
+DESCR("map query result to XML");
+DATA(insert OID = 2925 (  cursor_to_xml				  PGNSP PGUID 12 100 0 0 0 f f f f t f s 5 0 142 "1790 23 16 16 25" _null_ _null_ "{cursor,count,nulls,tableforest,targetns}" _null_ _null_ cursor_to_xml _null_ _null_ _null_ ));
+DESCR("map rows from cursor to XML");
+DATA(insert OID = 2926 (  table_to_xmlschema		  PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "2205 16 16 25" _null_ _null_ "{tbl,nulls,tableforest,targetns}" _null_ _null_ table_to_xmlschema _null_ _null_ _null_ ));
+DESCR("map table structure to XML Schema");
+DATA(insert OID = 2927 (  query_to_xmlschema		  PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "25 16 16 25" _null_ _null_ "{query,nulls,tableforest,targetns}" _null_ _null_ query_to_xmlschema _null_ _null_ _null_ ));
+DESCR("map query result structure to XML Schema");
+DATA(insert OID = 2928 (  cursor_to_xmlschema		  PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "1790 16 16 25" _null_ _null_ "{cursor,nulls,tableforest,targetns}" _null_ _null_ cursor_to_xmlschema _null_ _null_ _null_ ));
+DESCR("map cursor structure to XML Schema");
+DATA(insert OID = 2929 (  table_to_xml_and_xmlschema  PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "2205 16 16 25" _null_ _null_ "{tbl,nulls,tableforest,targetns}" _null_ _null_ table_to_xml_and_xmlschema _null_ _null_ _null_ ));
+DESCR("map table contents and structure to XML and XML Schema");
+DATA(insert OID = 2930 (  query_to_xml_and_xmlschema  PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "25 16 16 25" _null_ _null_ "{query,nulls,tableforest,targetns}" _null_ _null_ query_to_xml_and_xmlschema _null_ _null_ _null_ ));
+DESCR("map query result and structure to XML and XML Schema");
+
+DATA(insert OID = 2933 (  schema_to_xml				  PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "19 16 16 25" _null_ _null_ "{schema,nulls,tableforest,targetns}" _null_ _null_ schema_to_xml _null_ _null_ _null_ ));
+DESCR("map schema contents to XML");
+DATA(insert OID = 2934 (  schema_to_xmlschema		  PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "19 16 16 25" _null_ _null_ "{schema,nulls,tableforest,targetns}" _null_ _null_ schema_to_xmlschema _null_ _null_ _null_ ));
+DESCR("map schema structure to XML Schema");
+DATA(insert OID = 2935 (  schema_to_xml_and_xmlschema PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "19 16 16 25" _null_ _null_ "{schema,nulls,tableforest,targetns}" _null_ _null_ schema_to_xml_and_xmlschema _null_ _null_ _null_ ));
+DESCR("map schema contents and structure to XML and XML Schema");
+
+DATA(insert OID = 2936 (  database_to_xml			  PGNSP PGUID 12 100 0 0 0 f f f f t f s 3 0 142 "16 16 25" _null_ _null_ "{nulls,tableforest,targetns}" _null_ _null_ database_to_xml _null_ _null_ _null_ ));
+DESCR("map database contents to XML");
+DATA(insert OID = 2937 (  database_to_xmlschema		  PGNSP PGUID 12 100 0 0 0 f f f f t f s 3 0 142 "16 16 25" _null_ _null_ "{nulls,tableforest,targetns}" _null_ _null_ database_to_xmlschema _null_ _null_ _null_ ));
+DESCR("map database structure to XML Schema");
+DATA(insert OID = 2938 (  database_to_xml_and_xmlschema PGNSP PGUID 12 100 0 0 0 f f f f t f s 3 0 142 "16 16 25" _null_ _null_ "{nulls,tableforest,targetns}" _null_ _null_ database_to_xml_and_xmlschema _null_ _null_ _null_ ));
+DESCR("map database contents and structure to XML and XML Schema");
+
+DATA(insert OID = 2931 (  xpath		 PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 143 "25 142 1009" _null_ _null_ _null_ _null_ _null_ xpath _null_ _null_ _null_ ));
+DESCR("evaluate XPath expression, with namespaces support");
+DATA(insert OID = 2932 (  xpath		 PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 143 "25 142" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.xpath($1, $2, ''{}''::pg_catalog.text[])" _null_ _null_ _null_ ));
+DESCR("evaluate XPath expression");
+
+DATA(insert OID = 2614 (  xmlexists  PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 142" _null_ _null_ _null_ _null_ _null_ xmlexists _null_ _null_ _null_ ));
+DESCR("test XML value against XPath expression");
+
+DATA(insert OID = 3049 (  xpath_exists	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 16 "25 142 1009" _null_ _null_ _null_ _null_ _null_ xpath_exists _null_ _null_ _null_ ));
+DESCR("test XML value against XPath expression, with namespace support");
+DATA(insert OID = 3050 (  xpath_exists	 PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 16 "25 142" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.xpath_exists($1, $2, ''{}''::pg_catalog.text[])" _null_ _null_ _null_ ));
+DESCR("test XML value against XPath expression");
+DATA(insert OID = 3051 (  xml_is_well_formed			 PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "25" _null_ _null_ _null_ _null_ _null_ xml_is_well_formed _null_ _null_ _null_ ));
+DESCR("determine if a string is well formed XML");
+DATA(insert OID = 3052 (  xml_is_well_formed_document	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "25" _null_ _null_ _null_ _null_ _null_ xml_is_well_formed_document _null_ _null_ _null_ ));
+DESCR("determine if a string is well formed XML document");
+DATA(insert OID = 3053 (  xml_is_well_formed_content	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "25" _null_ _null_ _null_ _null_ _null_ xml_is_well_formed_content _null_ _null_ _null_ ));
+DESCR("determine if a string is well formed XML content");
+
+/* json */
+DATA(insert OID = 321 (  json_in		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 114 "2275" _null_ _null_ _null_ _null_ _null_ json_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 322 (  json_out		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "114" _null_ _null_ _null_ _null_ _null_ json_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 323 (  json_recv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 114 "2281" _null_ _null_ _null_ _null_ _null_	json_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 324 (  json_send		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "114" _null_ _null_ _null_ _null_ _null_ json_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3153 (  array_to_json    PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 114 "2277" _null_ _null_ _null_ _null_ _null_ array_to_json _null_ _null_ _null_ ));
+DESCR("map array to json");
+DATA(insert OID = 3154 (  array_to_json    PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 114 "2277 16" _null_ _null_ _null_ _null_ _null_ array_to_json_pretty _null_ _null_ _null_ ));
+DESCR("map array to json with optional pretty printing");
+DATA(insert OID = 3155 (  row_to_json	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 114 "2249" _null_ _null_ _null_ _null_ _null_ row_to_json _null_ _null_ _null_ ));
+DESCR("map row to json");
+DATA(insert OID = 3156 (  row_to_json	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 114 "2249 16" _null_ _null_ _null_ _null_ _null_ row_to_json_pretty _null_ _null_ _null_ ));
+DESCR("map row to json with optional pretty printing");
+DATA(insert OID = 3173 (  json_agg_transfn	 PGNSP PGUID 12 1 0 0 0 f f f f f f s 2 0 2281 "2281 2283" _null_ _null_ _null_ _null_ _null_ json_agg_transfn _null_ _null_ _null_ ));
+DESCR("json aggregate transition function");
+DATA(insert OID = 3174 (  json_agg_finalfn	 PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 114 "2281" _null_ _null_ _null_ _null_ _null_ json_agg_finalfn _null_ _null_ _null_ ));
+DESCR("json aggregate final function");
+DATA(insert OID = 3175 (  json_agg		   PGNSP PGUID 12 1 0 0 0 t f f f f f s 1 0 114 "2283" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("aggregate input into json");
+DATA(insert OID = 3180 (  json_object_agg_transfn	 PGNSP PGUID 12 1 0 0 0 f f f f f f s 3 0 2281 "2281 2276 2276" _null_ _null_ _null_ _null_ _null_ json_object_agg_transfn _null_ _null_ _null_ ));
+DESCR("json object aggregate transition function");
+DATA(insert OID = 3196 (  json_object_agg_finalfn	 PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 114 "2281" _null_ _null_ _null_ _null_ _null_ json_object_agg_finalfn _null_ _null_ _null_ ));
+DESCR("json object aggregate final function");
+DATA(insert OID = 3197 (  json_object_agg		   PGNSP PGUID 12 1 0 0 0 t f f f f f s 2 0 114 "2276 2276" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("aggregate input into a json object");
+DATA(insert OID = 3198 (  json_build_array	   PGNSP PGUID 12 1 0 2276 0 f f f f f f s 1 0 114 "2276" "{2276}" "{v}" _null_ _null_ _null_ json_build_array _null_ _null_ _null_ ));
+DESCR("build a json array from any inputs");
+DATA(insert OID = 3199 (  json_build_array	   PGNSP PGUID 12 1 0 0 0 f f f f f f s 0 0 114  "" _null_ _null_ _null_ _null_ _null_ json_build_array_noargs _null_ _null_ _null_ ));
+DESCR("build an empty json array");
+DATA(insert OID = 3200 (  json_build_object    PGNSP PGUID 12 1 0 2276 0 f f f f f f s 1 0 114 "2276" "{2276}" "{v}" _null_ _null_ _null_ json_build_object _null_ _null_ _null_ ));
+DESCR("build a json object from pairwise key/value inputs");
+DATA(insert OID = 3201 (  json_build_object    PGNSP PGUID 12 1 0 0 0 f f f f f f s 0 0 114  "" _null_ _null_ _null_ _null_ _null_ json_build_object_noargs _null_ _null_ _null_ ));
+DESCR("build an empty json object");
+DATA(insert OID = 3202 (  json_object	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 114 "1009" _null_ _null_ _null_ _null_ _null_ json_object _null_ _null_ _null_ ));
+DESCR("map text array of key value pairs to json object");
+DATA(insert OID = 3203 (  json_object	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 114 "1009 1009" _null_ _null_ _null_ _null_ _null_ json_object_two_arg _null_ _null_ _null_ ));
+DESCR("map text arrays of keys and values to json object");
+DATA(insert OID = 3176 (  to_json	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 114 "2283" _null_ _null_ _null_ _null_ _null_ to_json _null_ _null_ _null_ ));
+DESCR("map input to json");
+DATA(insert OID = 3261 (  json_strip_nulls	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 114 "114" _null_ _null_ _null_ _null_ _null_ json_strip_nulls _null_ _null_ _null_ ));
+DESCR("remove object fields with null values from json");
+
+DATA(insert OID = 3947 (  json_object_field			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 114 "114 25" _null_ _null_ "{from_json, field_name}" _null_ _null_ json_object_field _null_ _null_ _null_ ));
+DATA(insert OID = 3948 (  json_object_field_text	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25  "114 25" _null_ _null_ "{from_json, field_name}" _null_ _null_ json_object_field_text _null_ _null_ _null_ ));
+DATA(insert OID = 3949 (  json_array_element		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 114 "114 23" _null_ _null_ "{from_json, element_index}" _null_ _null_ json_array_element _null_ _null_ _null_ ));
+DATA(insert OID = 3950 (  json_array_element_text	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25  "114 23" _null_ _null_ "{from_json, element_index}" _null_ _null_ json_array_element_text _null_ _null_ _null_ ));
+DATA(insert OID = 3951 (  json_extract_path			PGNSP PGUID 12 1 0 25 0 f f f f t f i 2 0 114 "114 1009" "{114,1009}" "{i,v}" "{from_json,path_elems}" _null_ _null_ json_extract_path _null_ _null_ _null_ ));
+DESCR("get value from json with path elements");
+DATA(insert OID = 3953 (  json_extract_path_text	PGNSP PGUID 12 1 0 25 0 f f f f t f i 2 0 25 "114 1009" "{114,1009}" "{i,v}" "{from_json,path_elems}" _null_ _null_ json_extract_path_text _null_ _null_ _null_ ));
+DESCR("get value from json as text with path elements");
+DATA(insert OID = 3955 (  json_array_elements		PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 114 "114" "{114,114}" "{i,o}" "{from_json,value}" _null_ _null_ json_array_elements _null_ _null_ _null_ ));
+DESCR("key value pairs of a json object");
+DATA(insert OID = 3969 (  json_array_elements_text	PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 25 "114" "{114,25}" "{i,o}" "{from_json,value}" _null_ _null_ json_array_elements_text _null_ _null_ _null_ ));
+DESCR("elements of json array");
+DATA(insert OID = 3956 (  json_array_length			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "114" _null_ _null_ _null_ _null_ _null_ json_array_length _null_ _null_ _null_ ));
+DESCR("length of json array");
+DATA(insert OID = 3957 (  json_object_keys			PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 25 "114" _null_ _null_ _null_ _null_ _null_ json_object_keys _null_ _null_ _null_ ));
+DESCR("get json object keys");
+DATA(insert OID = 3958 (  json_each				   PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 2249 "114" "{114,25,114}" "{i,o,o}" "{from_json,key,value}" _null_ _null_ json_each _null_ _null_ _null_ ));
+DESCR("key value pairs of a json object");
+DATA(insert OID = 3959 (  json_each_text		   PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 2249 "114" "{114,25,25}" "{i,o,o}" "{from_json,key,value}" _null_ _null_ json_each_text _null_ _null_ _null_ ));
+DESCR("key value pairs of a json object");
+DATA(insert OID = 3960 (  json_populate_record	   PGNSP PGUID 12 1 0 0 0 f f f f f f s 3 0 2283 "2283 114 16" _null_ _null_ _null_ _null_ _null_ json_populate_record _null_ _null_ _null_ ));
+DESCR("get record fields from a json object");
+DATA(insert OID = 3961 (  json_populate_recordset  PGNSP PGUID 12 1 100 0 0 f f f f f t s 3 0 2283 "2283 114 16" _null_ _null_ _null_ _null_ _null_ json_populate_recordset _null_ _null_ _null_ ));
+DESCR("get set of records with fields from a json array of objects");
+DATA(insert OID = 3204 (  json_to_record		   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2249 "114" _null_ _null_ _null_ _null_ _null_ json_to_record _null_ _null_ _null_ ));
+DESCR("get record fields from a json object");
+DATA(insert OID = 3205 (  json_to_recordset		   PGNSP PGUID 12 1 100 0 0 f f f f f t s 1 0 2249 "114" _null_ _null_ _null_ _null_ _null_ json_to_recordset _null_ _null_ _null_ ));
+DESCR("get set of records with fields from a json array of objects");
+DATA(insert OID = 3968 (  json_typeof			   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "114" _null_ _null_ _null_ _null_ _null_ json_typeof _null_ _null_ _null_ ));
+DESCR("get the type of a json value");
+
+/* uuid */
+DATA(insert OID = 2952 (  uuid_in		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2950 "2275" _null_ _null_ _null_ _null_ _null_ uuid_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2953 (  uuid_out		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2950" _null_ _null_ _null_ _null_ _null_ uuid_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2954 (  uuid_lt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "2950 2950" _null_ _null_ _null_ _null_ _null_ uuid_lt _null_ _null_ _null_ ));
+DATA(insert OID = 2955 (  uuid_le		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "2950 2950" _null_ _null_ _null_ _null_ _null_ uuid_le _null_ _null_ _null_ ));
+DATA(insert OID = 2956 (  uuid_eq		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "2950 2950" _null_ _null_ _null_ _null_ _null_ uuid_eq _null_ _null_ _null_ ));
+DATA(insert OID = 2957 (  uuid_ge		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "2950 2950" _null_ _null_ _null_ _null_ _null_ uuid_ge _null_ _null_ _null_ ));
+DATA(insert OID = 2958 (  uuid_gt		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "2950 2950" _null_ _null_ _null_ _null_ _null_ uuid_gt _null_ _null_ _null_ ));
+DATA(insert OID = 2959 (  uuid_ne		   PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "2950 2950" _null_ _null_ _null_ _null_ _null_ uuid_ne _null_ _null_ _null_ ));
+DATA(insert OID = 2960 (  uuid_cmp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2950 2950" _null_ _null_ _null_ _null_ _null_ uuid_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 2961 (  uuid_recv		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2950 "2281" _null_ _null_ _null_ _null_ _null_ uuid_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2962 (  uuid_send		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2950" _null_ _null_ _null_ _null_ _null_ uuid_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2963 (  uuid_hash		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "2950" _null_ _null_ _null_ _null_ _null_ uuid_hash _null_ _null_ _null_ ));
+DESCR("hash");
+
+/* pg_lsn */
+DATA(insert OID = 3229 (  pg_lsn_in		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3220 "2275" _null_ _null_ _null_ _null_ _null_ pg_lsn_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3230 (  pg_lsn_out		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "3220" _null_ _null_ _null_ _null_ _null_ pg_lsn_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3231 (  pg_lsn_lt		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3220 3220" _null_ _null_ _null_ _null_ _null_ pg_lsn_lt _null_ _null_ _null_ ));
+DATA(insert OID = 3232 (  pg_lsn_le		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3220 3220" _null_ _null_ _null_ _null_ _null_ pg_lsn_le _null_ _null_ _null_ ));
+DATA(insert OID = 3233 (  pg_lsn_eq		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3220 3220" _null_ _null_ _null_ _null_ _null_ pg_lsn_eq _null_ _null_ _null_ ));
+DATA(insert OID = 3234 (  pg_lsn_ge		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3220 3220" _null_ _null_ _null_ _null_ _null_ pg_lsn_ge _null_ _null_ _null_ ));
+DATA(insert OID = 3235 (  pg_lsn_gt		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3220 3220" _null_ _null_ _null_ _null_ _null_ pg_lsn_gt _null_ _null_ _null_ ));
+DATA(insert OID = 3236 (  pg_lsn_ne		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3220 3220" _null_ _null_ _null_ _null_ _null_ pg_lsn_ne _null_ _null_ _null_ ));
+DATA(insert OID = 3237 (  pg_lsn_mi		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "3220 3220" _null_ _null_ _null_ _null_ _null_ pg_lsn_mi _null_ _null_ _null_ ));
+DATA(insert OID = 3238 (  pg_lsn_recv	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3220 "2281" _null_ _null_ _null_ _null_ _null_ pg_lsn_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3239 (  pg_lsn_send	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "3220" _null_ _null_ _null_ _null_ _null_ pg_lsn_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3251 (  pg_lsn_cmp	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "3220 3220" _null_ _null_ _null_ _null_ _null_ pg_lsn_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 3252 (  pg_lsn_hash	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "3220" _null_ _null_ _null_ _null_ _null_ pg_lsn_hash _null_ _null_ _null_ ));
+DESCR("hash");
+
+/* enum related procs */
+DATA(insert OID = 3504 (  anyenum_in	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3500 "2275" _null_ _null_ _null_ _null_ _null_ anyenum_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3505 (  anyenum_out	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "3500" _null_ _null_ _null_ _null_ _null_ anyenum_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3506 (  enum_in		PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 3500 "2275 26" _null_ _null_ _null_ _null_ _null_ enum_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3507 (  enum_out		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "3500" _null_ _null_ _null_ _null_ _null_ enum_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3508 (  enum_eq		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3500 3500" _null_ _null_ _null_ _null_ _null_ enum_eq _null_ _null_ _null_ ));
+DATA(insert OID = 3509 (  enum_ne		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3500 3500" _null_ _null_ _null_ _null_ _null_ enum_ne _null_ _null_ _null_ ));
+DATA(insert OID = 3510 (  enum_lt		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3500 3500" _null_ _null_ _null_ _null_ _null_ enum_lt _null_ _null_ _null_ ));
+DATA(insert OID = 3511 (  enum_gt		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3500 3500" _null_ _null_ _null_ _null_ _null_ enum_gt _null_ _null_ _null_ ));
+DATA(insert OID = 3512 (  enum_le		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3500 3500" _null_ _null_ _null_ _null_ _null_ enum_le _null_ _null_ _null_ ));
+DATA(insert OID = 3513 (  enum_ge		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3500 3500" _null_ _null_ _null_ _null_ _null_ enum_ge _null_ _null_ _null_ ));
+DATA(insert OID = 3514 (  enum_cmp		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "3500 3500" _null_ _null_ _null_ _null_ _null_ enum_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 3515 (  hashenum		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "3500" _null_ _null_ _null_ _null_ _null_ hashenum _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 3524 (  enum_smaller	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3500 "3500 3500" _null_ _null_ _null_ _null_ _null_ enum_smaller _null_ _null_ _null_ ));
+DESCR("smaller of two");
+DATA(insert OID = 3525 (  enum_larger	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3500 "3500 3500" _null_ _null_ _null_ _null_ _null_ enum_larger _null_ _null_ _null_ ));
+DESCR("larger of two");
+DATA(insert OID = 3526 (  max			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 3500 "3500" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("maximum value of all enum input values");
+DATA(insert OID = 3527 (  min			PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 3500 "3500" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("minimum value of all enum input values");
+DATA(insert OID = 3528 (  enum_first	PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0 3500 "3500" _null_ _null_ _null_ _null_ _null_ enum_first _null_ _null_ _null_ ));
+DESCR("first value of the input enum type");
+DATA(insert OID = 3529 (  enum_last		PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0 3500 "3500" _null_ _null_ _null_ _null_ _null_ enum_last _null_ _null_ _null_ ));
+DESCR("last value of the input enum type");
+DATA(insert OID = 3530 (  enum_range	PGNSP PGUID 12 1 0 0 0 f f f f f f s 2 0 2277 "3500 3500" _null_ _null_ _null_ _null_ _null_ enum_range_bounds _null_ _null_ _null_ ));
+DESCR("range between the two given enum values, as an ordered array");
+DATA(insert OID = 3531 (  enum_range	PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0 2277 "3500" _null_ _null_ _null_ _null_ _null_ enum_range_all _null_ _null_ _null_ ));
+DESCR("range of the given enum type, as an ordered array");
+DATA(insert OID = 3532 (  enum_recv		PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 3500 "2281 26" _null_ _null_ _null_ _null_ _null_ enum_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3533 (  enum_send		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "3500" _null_ _null_ _null_ _null_ _null_ enum_send _null_ _null_ _null_ ));
+DESCR("I/O");
+
+/* text search stuff */
+DATA(insert OID =  3610 (  tsvectorin			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3614 "2275" _null_ _null_ _null_ _null_ _null_ tsvectorin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  3639 (  tsvectorrecv			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3614 "2281" _null_ _null_ _null_ _null_ _null_ tsvectorrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  3611 (  tsvectorout			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "3614" _null_ _null_ _null_ _null_ _null_ tsvectorout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  3638 (  tsvectorsend			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "3614" _null_ _null_ _null_ _null_ _null_	tsvectorsend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  3612 (  tsqueryin			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3615 "2275" _null_ _null_ _null_ _null_ _null_ tsqueryin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  3641 (  tsqueryrecv			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3615 "2281" _null_ _null_ _null_ _null_ _null_ tsqueryrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  3613 (  tsqueryout			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "3615" _null_ _null_ _null_ _null_ _null_ tsqueryout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  3640 (  tsquerysend			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "3615" _null_ _null_ _null_ _null_ _null_	tsquerysend _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  3646 (  gtsvectorin			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3642 "2275" _null_ _null_ _null_ _null_ _null_ gtsvectorin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  3647 (  gtsvectorout			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "3642" _null_ _null_ _null_ _null_ _null_ gtsvectorout _null_ _null_ _null_ ));
+DESCR("I/O");
+
+DATA(insert OID = 3616 (  tsvector_lt			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3614 3614" _null_ _null_ _null_ _null_ _null_ tsvector_lt _null_ _null_ _null_ ));
+DATA(insert OID = 3617 (  tsvector_le			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3614 3614" _null_ _null_ _null_ _null_ _null_ tsvector_le _null_ _null_ _null_ ));
+DATA(insert OID = 3618 (  tsvector_eq			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3614 3614" _null_ _null_ _null_ _null_ _null_ tsvector_eq _null_ _null_ _null_ ));
+DATA(insert OID = 3619 (  tsvector_ne			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3614 3614" _null_ _null_ _null_ _null_ _null_ tsvector_ne _null_ _null_ _null_ ));
+DATA(insert OID = 3620 (  tsvector_ge			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3614 3614" _null_ _null_ _null_ _null_ _null_ tsvector_ge _null_ _null_ _null_ ));
+DATA(insert OID = 3621 (  tsvector_gt			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3614 3614" _null_ _null_ _null_ _null_ _null_ tsvector_gt _null_ _null_ _null_ ));
+DATA(insert OID = 3622 (  tsvector_cmp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "3614 3614" _null_ _null_ _null_ _null_ _null_ tsvector_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+DATA(insert OID = 3711 (  length				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "3614" _null_ _null_ _null_ _null_ _null_ tsvector_length _null_ _null_ _null_ ));
+DESCR("number of lexemes");
+DATA(insert OID = 3623 (  strip					PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3614 "3614" _null_ _null_ _null_ _null_ _null_ tsvector_strip _null_ _null_ _null_ ));
+DESCR("strip position information");
+DATA(insert OID = 3624 (  setweight				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3614 "3614 18" _null_ _null_ _null_ _null_ _null_ tsvector_setweight _null_ _null_ _null_ ));
+DESCR("set weight of lexeme's entries");
+DATA(insert OID = 3625 (  tsvector_concat		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3614 "3614 3614" _null_ _null_ _null_ _null_ _null_ tsvector_concat _null_ _null_ _null_ ));
+
+DATA(insert OID = 3634 (  ts_match_vq			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3614 3615" _null_ _null_ _null_ _null_ _null_ ts_match_vq _null_ _null_ _null_ ));
+DATA(insert OID = 3635 (  ts_match_qv			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3614" _null_ _null_ _null_ _null_ _null_ ts_match_qv _null_ _null_ _null_ ));
+DATA(insert OID = 3760 (  ts_match_tt			PGNSP PGUID 12 100 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ ts_match_tt _null_ _null_ _null_ ));
+DATA(insert OID = 3761 (  ts_match_tq			PGNSP PGUID 12 100 0 0 0 f f f f t f s 2 0 16 "25 3615" _null_ _null_ _null_ _null_ _null_ ts_match_tq _null_ _null_ _null_ ));
+
+DATA(insert OID = 3648 (  gtsvector_compress	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ gtsvector_compress _null_ _null_ _null_ ));
+DESCR("GiST tsvector support");
+DATA(insert OID = 3649 (  gtsvector_decompress	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ gtsvector_decompress _null_ _null_ _null_ ));
+DESCR("GiST tsvector support");
+DATA(insert OID = 3650 (  gtsvector_picksplit	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ gtsvector_picksplit _null_ _null_ _null_ ));
+DESCR("GiST tsvector support");
+DATA(insert OID = 3651 (  gtsvector_union		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ gtsvector_union _null_ _null_ _null_ ));
+DESCR("GiST tsvector support");
+DATA(insert OID = 3652 (  gtsvector_same		PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "3642 3642 2281" _null_ _null_ _null_ _null_ _null_ gtsvector_same _null_ _null_ _null_ ));
+DESCR("GiST tsvector support");
+DATA(insert OID = 3653 (  gtsvector_penalty		PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gtsvector_penalty _null_ _null_ _null_ ));
+DESCR("GiST tsvector support");
+DATA(insert OID = 3654 (  gtsvector_consistent	PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 16 "2281 3642 23 26 2281" _null_ _null_ _null_ _null_ _null_ gtsvector_consistent _null_ _null_ _null_ ));
+DESCR("GiST tsvector support");
+
+DATA(insert OID = 3656 (  gin_extract_tsvector	PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "3614 2281 2281" _null_ _null_ _null_ _null_ _null_	gin_extract_tsvector _null_ _null_ _null_ ));
+DESCR("GIN tsvector support");
+DATA(insert OID = 3657 (  gin_extract_tsquery	PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 2281 "3615 2281 21 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_tsquery _null_ _null_ _null_ ));
+DESCR("GIN tsvector support");
+DATA(insert OID = 3658 (  gin_tsquery_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 8 0 16 "2281 21 3615 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_	gin_tsquery_consistent _null_ _null_ _null_ ));
+DESCR("GIN tsvector support");
+DATA(insert OID = 3921 (  gin_tsquery_triconsistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 18 "2281 21 3615 23 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_tsquery_triconsistent _null_ _null_ _null_ ));
+DESCR("GIN tsvector support");
+DATA(insert OID = 3724 (  gin_cmp_tslexeme		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ _null_ gin_cmp_tslexeme _null_ _null_ _null_ ));
+DESCR("GIN tsvector support");
+DATA(insert OID = 2700 (  gin_cmp_prefix		PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 23 "25 25 21 2281" _null_ _null_ _null_ _null_ _null_ gin_cmp_prefix _null_ _null_ _null_ ));
+DESCR("GIN tsvector support");
+DATA(insert OID = 3077 (  gin_extract_tsvector	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "3614 2281" _null_ _null_ _null_ _null_ _null_	gin_extract_tsvector_2args _null_ _null_ _null_ ));
+DESCR("GIN tsvector support (obsolete)");
+DATA(insert OID = 3087 (  gin_extract_tsquery	PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 2281 "3615 2281 21 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_tsquery_5args _null_ _null_ _null_ ));
+DESCR("GIN tsvector support (obsolete)");
+DATA(insert OID = 3088 (  gin_tsquery_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 6 0 16 "2281 21 3615 23 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_tsquery_consistent_6args _null_ _null_ _null_ ));
+DESCR("GIN tsvector support (obsolete)");
+
+DATA(insert OID = 3662 (  tsquery_lt			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ _null_ tsquery_lt _null_ _null_ _null_ ));
+DATA(insert OID = 3663 (  tsquery_le			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ _null_ tsquery_le _null_ _null_ _null_ ));
+DATA(insert OID = 3664 (  tsquery_eq			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ _null_ tsquery_eq _null_ _null_ _null_ ));
+DATA(insert OID = 3665 (  tsquery_ne			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ _null_ tsquery_ne _null_ _null_ _null_ ));
+DATA(insert OID = 3666 (  tsquery_ge			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ _null_ tsquery_ge _null_ _null_ _null_ ));
+DATA(insert OID = 3667 (  tsquery_gt			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ _null_ tsquery_gt _null_ _null_ _null_ ));
+DATA(insert OID = 3668 (  tsquery_cmp			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "3615 3615" _null_ _null_ _null_ _null_ _null_ tsquery_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+DATA(insert OID = 3669 (  tsquery_and		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3615 "3615 3615" _null_ _null_ _null_ _null_ _null_ tsquery_and _null_ _null_ _null_ ));
+DATA(insert OID = 3670 (  tsquery_or		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3615 "3615 3615" _null_ _null_ _null_ _null_ _null_ tsquery_or _null_ _null_ _null_ ));
+DATA(insert OID = 3671 (  tsquery_not		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3615 "3615" _null_ _null_ _null_ _null_ _null_ tsquery_not _null_ _null_ _null_ ));
+
+DATA(insert OID = 3691 (  tsq_mcontains		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ _null_ tsq_mcontains _null_ _null_ _null_ ));
+DATA(insert OID = 3692 (  tsq_mcontained	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ _null_ tsq_mcontained _null_ _null_ _null_ ));
+
+DATA(insert OID = 3672 (  numnode			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "3615" _null_ _null_ _null_ _null_ _null_ tsquery_numnode _null_ _null_ _null_ ));
+DESCR("number of nodes");
+DATA(insert OID = 3673 (  querytree			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "3615" _null_ _null_ _null_ _null_ _null_ tsquerytree _null_ _null_ _null_ ));
+DESCR("show real useful query for GiST index");
+
+DATA(insert OID = 3684 (  ts_rewrite		PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 3615 "3615 3615 3615" _null_ _null_ _null_ _null_ _null_ tsquery_rewrite _null_ _null_ _null_ ));
+DESCR("rewrite tsquery");
+DATA(insert OID = 3685 (  ts_rewrite		PGNSP PGUID 12 100 0 0 0 f f f f t f v 2 0 3615 "3615 25" _null_ _null_ _null_ _null_ _null_ tsquery_rewrite_query _null_ _null_ _null_ ));
+DESCR("rewrite tsquery");
+
+DATA(insert OID = 3695 (  gtsquery_compress				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ gtsquery_compress _null_ _null_ _null_ ));
+DESCR("GiST tsquery support");
+DATA(insert OID = 3696 (  gtsquery_decompress			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ gtsquery_decompress _null_ _null_ _null_ ));
+DESCR("GiST tsquery support");
+DATA(insert OID = 3697 (  gtsquery_picksplit			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ gtsquery_picksplit _null_ _null_ _null_ ));
+DESCR("GiST tsquery support");
+DATA(insert OID = 3698 (  gtsquery_union				PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ gtsquery_union _null_ _null_ _null_ ));
+DESCR("GiST tsquery support");
+DATA(insert OID = 3699 (  gtsquery_same					PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "20 20 2281" _null_ _null_ _null_ _null_ _null_ gtsquery_same _null_ _null_ _null_ ));
+DESCR("GiST tsquery support");
+DATA(insert OID = 3700 (  gtsquery_penalty				PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gtsquery_penalty _null_ _null_ _null_ ));
+DESCR("GiST tsquery support");
+DATA(insert OID = 3701 (  gtsquery_consistent			PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 16 "2281 2281 23 26 2281" _null_ _null_ _null_ _null_ _null_ gtsquery_consistent _null_ _null_ _null_ ));
+DESCR("GiST tsquery support");
+
+DATA(insert OID = 3686 (  tsmatchsel		PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_ tsmatchsel _null_ _null_ _null_ ));
+DESCR("restriction selectivity of tsvector @@ tsquery");
+DATA(insert OID = 3687 (  tsmatchjoinsel	PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ _null_ tsmatchjoinsel _null_ _null_ _null_ ));
+DESCR("join selectivity of tsvector @@ tsquery");
+DATA(insert OID = 3688 (  ts_typanalyze		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "2281" _null_ _null_ _null_ _null_ _null_ ts_typanalyze _null_ _null_ _null_ ));
+DESCR("tsvector typanalyze");
+
+DATA(insert OID = 3689 (  ts_stat		PGNSP PGUID 12 10 10000 0 0 f f f f t t v 1 0 2249 "25" "{25,25,23,23}" "{i,o,o,o}" "{query,word,ndoc,nentry}" _null_ _null_ ts_stat1 _null_ _null_ _null_ ));
+DESCR("statistics of tsvector column");
+DATA(insert OID = 3690 (  ts_stat		PGNSP PGUID 12 10 10000 0 0 f f f f t t v 2 0 2249 "25 25" "{25,25,25,23,23}" "{i,i,o,o,o}" "{query,weights,word,ndoc,nentry}" _null_ _null_ ts_stat2 _null_ _null_ _null_ ));
+DESCR("statistics of tsvector column");
+
+DATA(insert OID = 3703 (  ts_rank		PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 700 "1021 3614 3615 23" _null_ _null_ _null_ _null_ _null_ ts_rank_wttf _null_ _null_ _null_ ));
+DESCR("relevance");
+DATA(insert OID = 3704 (  ts_rank		PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 700 "1021 3614 3615" _null_ _null_ _null_ _null_ _null_ ts_rank_wtt _null_ _null_ _null_ ));
+DESCR("relevance");
+DATA(insert OID = 3705 (  ts_rank		PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 700 "3614 3615 23" _null_ _null_ _null_ _null_ _null_ ts_rank_ttf _null_ _null_ _null_ ));
+DESCR("relevance");
+DATA(insert OID = 3706 (  ts_rank		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 700 "3614 3615" _null_ _null_ _null_ _null_ _null_ ts_rank_tt _null_ _null_ _null_ ));
+DESCR("relevance");
+DATA(insert OID = 3707 (  ts_rank_cd	PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 700 "1021 3614 3615 23" _null_ _null_ _null_ _null_ _null_ ts_rankcd_wttf _null_ _null_ _null_ ));
+DESCR("relevance");
+DATA(insert OID = 3708 (  ts_rank_cd	PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 700 "1021 3614 3615" _null_ _null_ _null_ _null_ _null_ ts_rankcd_wtt _null_ _null_ _null_ ));
+DESCR("relevance");
+DATA(insert OID = 3709 (  ts_rank_cd	PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 700 "3614 3615 23" _null_ _null_ _null_ _null_ _null_ ts_rankcd_ttf _null_ _null_ _null_ ));
+DESCR("relevance");
+DATA(insert OID = 3710 (  ts_rank_cd	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 700 "3614 3615" _null_ _null_ _null_ _null_ _null_ ts_rankcd_tt _null_ _null_ _null_ ));
+DESCR("relevance");
+
+DATA(insert OID = 3713 (  ts_token_type PGNSP PGUID 12 1 16 0 0 f f f f t t i 1 0 2249 "26" "{26,23,25,25}" "{i,o,o,o}" "{parser_oid,tokid,alias,description}" _null_ _null_ ts_token_type_byid _null_ _null_ _null_ ));
+DESCR("get parser's token types");
+DATA(insert OID = 3714 (  ts_token_type PGNSP PGUID 12 1 16 0 0 f f f f t t s 1 0 2249 "25" "{25,23,25,25}" "{i,o,o,o}" "{parser_name,tokid,alias,description}" _null_ _null_ ts_token_type_byname _null_ _null_ _null_ ));
+DESCR("get parser's token types");
+DATA(insert OID = 3715 (  ts_parse		PGNSP PGUID 12 1 1000 0 0 f f f f t t i 2 0 2249 "26 25" "{26,25,23,25}" "{i,i,o,o}" "{parser_oid,txt,tokid,token}" _null_ _null_ ts_parse_byid _null_ _null_ _null_ ));
+DESCR("parse text to tokens");
+DATA(insert OID = 3716 (  ts_parse		PGNSP PGUID 12 1 1000 0 0 f f f f t t s 2 0 2249 "25 25" "{25,25,23,25}" "{i,i,o,o}" "{parser_name,txt,tokid,token}" _null_ _null_ ts_parse_byname _null_ _null_ _null_ ));
+DESCR("parse text to tokens");
+
+DATA(insert OID = 3717 (  prsd_start		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 23" _null_ _null_ _null_ _null_ _null_ prsd_start _null_ _null_ _null_ ));
+DESCR("(internal)");
+DATA(insert OID = 3718 (  prsd_nexttoken	PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ prsd_nexttoken _null_ _null_ _null_ ));
+DESCR("(internal)");
+DATA(insert OID = 3719 (  prsd_end			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ prsd_end _null_ _null_ _null_ ));
+DESCR("(internal)");
+DATA(insert OID = 3720 (  prsd_headline		PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 3615" _null_ _null_ _null_ _null_ _null_ prsd_headline _null_ _null_ _null_ ));
+DESCR("(internal)");
+DATA(insert OID = 3721 (  prsd_lextype		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ prsd_lextype _null_ _null_ _null_ ));
+DESCR("(internal)");
+
+DATA(insert OID = 3723 (  ts_lexize			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1009 "3769 25" _null_ _null_ _null_ _null_ _null_ ts_lexize _null_ _null_ _null_ ));
+DESCR("normalize one word by dictionary");
+
+DATA(insert OID = 3725 (  dsimple_init		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ dsimple_init _null_ _null_ _null_ ));
+DESCR("(internal)");
+DATA(insert OID = 3726 (  dsimple_lexize	PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ dsimple_lexize _null_ _null_ _null_ ));
+DESCR("(internal)");
+
+DATA(insert OID = 3728 (  dsynonym_init		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ dsynonym_init _null_ _null_ _null_ ));
+DESCR("(internal)");
+DATA(insert OID = 3729 (  dsynonym_lexize	PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ dsynonym_lexize _null_ _null_ _null_ ));
+DESCR("(internal)");
+
+DATA(insert OID = 3731 (  dispell_init		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ dispell_init _null_ _null_ _null_ ));
+DESCR("(internal)");
+DATA(insert OID = 3732 (  dispell_lexize	PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ dispell_lexize _null_ _null_ _null_ ));
+DESCR("(internal)");
+
+DATA(insert OID = 3740 (  thesaurus_init	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ thesaurus_init _null_ _null_ _null_ ));
+DESCR("(internal)");
+DATA(insert OID = 3741 (  thesaurus_lexize	PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ thesaurus_lexize _null_ _null_ _null_ ));
+DESCR("(internal)");
+
+DATA(insert OID = 3743 (  ts_headline	PGNSP PGUID 12 100 0 0 0 f f f f t f i 4 0 25 "3734 25 3615 25" _null_ _null_ _null_ _null_ _null_ ts_headline_byid_opt _null_ _null_ _null_ ));
+DESCR("generate headline");
+DATA(insert OID = 3744 (  ts_headline	PGNSP PGUID 12 100 0 0 0 f f f f t f i 3 0 25 "3734 25 3615" _null_ _null_ _null_ _null_ _null_ ts_headline_byid _null_ _null_ _null_ ));
+DESCR("generate headline");
+DATA(insert OID = 3754 (  ts_headline	PGNSP PGUID 12 100 0 0 0 f f f f t f s 3 0 25 "25 3615 25" _null_ _null_ _null_ _null_ _null_ ts_headline_opt _null_ _null_ _null_ ));
+DESCR("generate headline");
+DATA(insert OID = 3755 (  ts_headline	PGNSP PGUID 12 100 0 0 0 f f f f t f s 2 0 25 "25 3615" _null_ _null_ _null_ _null_ _null_ ts_headline _null_ _null_ _null_ ));
+DESCR("generate headline");
+
+DATA(insert OID = 3745 (  to_tsvector		PGNSP PGUID 12 100 0 0 0 f f f f t f i 2 0 3614 "3734 25" _null_ _null_ _null_ _null_ _null_ to_tsvector_byid _null_ _null_ _null_ ));
+DESCR("transform to tsvector");
+DATA(insert OID = 3746 (  to_tsquery		PGNSP PGUID 12 100 0 0 0 f f f f t f i 2 0 3615 "3734 25" _null_ _null_ _null_ _null_ _null_ to_tsquery_byid _null_ _null_ _null_ ));
+DESCR("make tsquery");
+DATA(insert OID = 3747 (  plainto_tsquery	PGNSP PGUID 12 100 0 0 0 f f f f t f i 2 0 3615 "3734 25" _null_ _null_ _null_ _null_ _null_ plainto_tsquery_byid _null_ _null_ _null_ ));
+DESCR("transform to tsquery");
+DATA(insert OID = 3749 (  to_tsvector		PGNSP PGUID 12 100 0 0 0 f f f f t f s 1 0 3614 "25" _null_ _null_ _null_ _null_ _null_ to_tsvector _null_ _null_ _null_ ));
+DESCR("transform to tsvector");
+DATA(insert OID = 3750 (  to_tsquery		PGNSP PGUID 12 100 0 0 0 f f f f t f s 1 0 3615 "25" _null_ _null_ _null_ _null_ _null_ to_tsquery _null_ _null_ _null_ ));
+DESCR("make tsquery");
+DATA(insert OID = 3751 (  plainto_tsquery	PGNSP PGUID 12 100 0 0 0 f f f f t f s 1 0 3615 "25" _null_ _null_ _null_ _null_ _null_ plainto_tsquery _null_ _null_ _null_ ));
+DESCR("transform to tsquery");
+
+DATA(insert OID = 3752 (  tsvector_update_trigger			PGNSP PGUID 12 1 0 0 0 f f f f f f v 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ tsvector_update_trigger_byid _null_ _null_ _null_ ));
+DESCR("trigger for automatic update of tsvector column");
+DATA(insert OID = 3753 (  tsvector_update_trigger_column	PGNSP PGUID 12 1 0 0 0 f f f f f f v 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ tsvector_update_trigger_bycolumn _null_ _null_ _null_ ));
+DESCR("trigger for automatic update of tsvector column");
+
+DATA(insert OID = 3759 (  get_current_ts_config PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 3734 "" _null_ _null_ _null_ _null_ _null_ get_current_ts_config _null_ _null_ _null_ ));
+DESCR("get current tsearch configuration");
+
+DATA(insert OID = 3736 (  regconfigin		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 3734 "2275" _null_ _null_ _null_ _null_ _null_ regconfigin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3737 (  regconfigout		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "3734" _null_ _null_ _null_ _null_ _null_ regconfigout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3738 (  regconfigrecv		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3734 "2281" _null_ _null_ _null_ _null_ _null_ regconfigrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3739 (  regconfigsend		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "3734" _null_ _null_ _null_ _null_ _null_ regconfigsend _null_ _null_ _null_ ));
+DESCR("I/O");
+
+DATA(insert OID = 3771 (  regdictionaryin	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 3769 "2275" _null_ _null_ _null_ _null_ _null_ regdictionaryin _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3772 (  regdictionaryout	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "3769" _null_ _null_ _null_ _null_ _null_ regdictionaryout _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3773 (  regdictionaryrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3769 "2281" _null_ _null_ _null_ _null_ _null_ regdictionaryrecv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3774 (  regdictionarysend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "3769" _null_ _null_ _null_ _null_ _null_ regdictionarysend _null_ _null_ _null_ ));
+DESCR("I/O");
+
+/* jsonb */
+DATA(insert OID =  3806 (  jsonb_in			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3802 "2275" _null_ _null_ _null_ _null_ _null_ jsonb_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  3805 (  jsonb_recv		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3802 "2281" _null_ _null_ _null_ _null_ _null_ jsonb_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  3804 (  jsonb_out		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "3802" _null_ _null_ _null_ _null_ _null_ jsonb_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID =  3803 (  jsonb_send		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "3802" _null_ _null_ _null_ _null_ _null_	jsonb_send _null_ _null_ _null_ ));
+DESCR("I/O");
+
+DATA(insert OID = 3263 (  jsonb_object	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3802 "1009" _null_ _null_ _null_ _null_ _null_ jsonb_object _null_ _null_ _null_ ));
+DESCR("map text array of key value pairs to jsonb object");
+DATA(insert OID = 3264 (  jsonb_object	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3802 "1009 1009" _null_ _null_ _null_ _null_ _null_ jsonb_object_two_arg _null_ _null_ _null_ ));
+DESCR("map text array of key value pairs to jsonb object");
+DATA(insert OID = 3787 (  to_jsonb	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 3802 "2283" _null_ _null_ _null_ _null_ _null_ to_jsonb _null_ _null_ _null_ ));
+DESCR("map input to jsonb");
+DATA(insert OID = 3265 (  jsonb_agg_transfn  PGNSP PGUID 12 1 0 0 0 f f f f f f s 2 0 2281 "2281 2283" _null_ _null_ _null_ _null_ _null_ jsonb_agg_transfn _null_ _null_ _null_ ));
+DESCR("jsonb aggregate transition function");
+DATA(insert OID = 3266 (  jsonb_agg_finalfn  PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0 3802 "2281" _null_ _null_ _null_ _null_ _null_ jsonb_agg_finalfn _null_ _null_ _null_ ));
+DESCR("jsonb aggregate final function");
+DATA(insert OID = 3267 (  jsonb_agg		   PGNSP PGUID 12 1 0 0 0 t f f f f f s 1 0 3802 "2283" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("aggregate input into jsonb");
+DATA(insert OID = 3268 (  jsonb_object_agg_transfn	 PGNSP PGUID 12 1 0 0 0 f f f f f f s 3 0 2281 "2281 2276 2276" _null_ _null_ _null_ _null_ _null_ jsonb_object_agg_transfn _null_ _null_ _null_ ));
+DESCR("jsonb object aggregate transition function");
+DATA(insert OID = 3269 (  jsonb_object_agg_finalfn	 PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0 3802 "2281" _null_ _null_ _null_ _null_ _null_ jsonb_object_agg_finalfn _null_ _null_ _null_ ));
+DESCR("jsonb object aggregate final function");
+DATA(insert OID = 3270 (  jsonb_object_agg		   PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 3802 "2276 2276" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("aggregate inputs into jsonb object");
+DATA(insert OID = 3271 (  jsonb_build_array    PGNSP PGUID 12 1 0 2276 0 f f f f f f s 1 0 3802 "2276" "{2276}" "{v}" _null_ _null_ _null_ jsonb_build_array _null_ _null_ _null_ ));
+DESCR("build a jsonb array from any inputs");
+DATA(insert OID = 3272 (  jsonb_build_array    PGNSP PGUID 12 1 0 0 0 f f f f f f s 0 0 3802  "" _null_ _null_ _null_ _null_ _null_ jsonb_build_array_noargs _null_ _null_ _null_ ));
+DESCR("build an empty jsonb array");
+DATA(insert OID = 3273 (  jsonb_build_object	PGNSP PGUID 12 1 0 2276 0 f f f f f f s 1 0 3802 "2276" "{2276}" "{v}" _null_ _null_ _null_ jsonb_build_object _null_ _null_ _null_ ));
+DESCR("build a jsonb object from pairwise key/value inputs");
+DATA(insert OID = 3274 (  jsonb_build_object	PGNSP PGUID 12 1 0 0 0 f f f f f f s 0 0 3802  "" _null_ _null_ _null_ _null_ _null_ jsonb_build_object_noargs _null_ _null_ _null_ ));
+DESCR("build an empty jsonb object");
+DATA(insert OID = 3262 (  jsonb_strip_nulls    PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3802 "3802" _null_ _null_ _null_ _null_ _null_ jsonb_strip_nulls _null_ _null_ _null_ ));
+DESCR("remove object fields with null values from jsonb");
+
+DATA(insert OID = 3478 (  jsonb_object_field			PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3802 "3802 25" _null_ _null_ "{from_json, field_name}" _null_ _null_ jsonb_object_field _null_ _null_ _null_ ));
+DATA(insert OID = 3214 (  jsonb_object_field_text	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25  "3802 25" _null_ _null_ "{from_json, field_name}" _null_ _null_ jsonb_object_field_text _null_ _null_ _null_ ));
+DATA(insert OID = 3215 (  jsonb_array_element		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3802 "3802 23" _null_ _null_ "{from_json, element_index}" _null_ _null_ jsonb_array_element _null_ _null_ _null_ ));
+DATA(insert OID = 3216 (  jsonb_array_element_text	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25  "3802 23" _null_ _null_ "{from_json, element_index}" _null_ _null_ jsonb_array_element_text _null_ _null_ _null_ ));
+DATA(insert OID = 3217 (  jsonb_extract_path			PGNSP PGUID 12 1 0 25 0 f f f f t f i 2 0 3802 "3802 1009" "{3802,1009}" "{i,v}" "{from_json,path_elems}" _null_ _null_ jsonb_extract_path _null_ _null_ _null_ ));
+DESCR("get value from jsonb with path elements");
+DATA(insert OID = 3940 (  jsonb_extract_path_text	PGNSP PGUID 12 1 0 25 0 f f f f t f i 2 0 25 "3802 1009" "{3802,1009}" "{i,v}" "{from_json,path_elems}" _null_ _null_ jsonb_extract_path_text _null_ _null_ _null_ ));
+DESCR("get value from jsonb as text with path elements");
+DATA(insert OID = 3219 (  jsonb_array_elements		PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 3802 "3802" "{3802,3802}" "{i,o}" "{from_json,value}" _null_ _null_ jsonb_array_elements _null_ _null_ _null_ ));
+DESCR("elements of a jsonb array");
+DATA(insert OID = 3465 (  jsonb_array_elements_text PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 25 "3802" "{3802,25}" "{i,o}" "{from_json,value}" _null_ _null_ jsonb_array_elements_text _null_ _null_ _null_ ));
+DESCR("elements of jsonb array");
+DATA(insert OID = 3207 (  jsonb_array_length			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "3802" _null_ _null_ _null_ _null_ _null_ jsonb_array_length _null_ _null_ _null_ ));
+DESCR("length of jsonb array");
+DATA(insert OID = 3931 (  jsonb_object_keys			PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 25 "3802" _null_ _null_ _null_ _null_ _null_ jsonb_object_keys _null_ _null_ _null_ ));
+DESCR("get jsonb object keys");
+DATA(insert OID = 3208 (  jsonb_each				   PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 2249 "3802" "{3802,25,3802}" "{i,o,o}" "{from_json,key,value}" _null_ _null_ jsonb_each _null_ _null_ _null_ ));
+DESCR("key value pairs of a jsonb object");
+DATA(insert OID = 3932 (  jsonb_each_text		   PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 2249 "3802" "{3802,25,25}" "{i,o,o}" "{from_json,key,value}" _null_ _null_ jsonb_each_text _null_ _null_ _null_ ));
+DESCR("key value pairs of a jsonb object");
+DATA(insert OID = 3209 (  jsonb_populate_record    PGNSP PGUID 12 1 0 0 0 f f f f f f s 2 0 2283 "2283 3802" _null_ _null_ _null_ _null_ _null_ jsonb_populate_record _null_ _null_ _null_ ));
+DESCR("get record fields from a jsonb object");
+DATA(insert OID = 3475 (  jsonb_populate_recordset	PGNSP PGUID 12 1 100 0 0 f f f f f t s 2 0 2283 "2283 3802" _null_ _null_ _null_ _null_ _null_ jsonb_populate_recordset _null_ _null_ _null_ ));
+DESCR("get set of records with fields from a jsonb array of objects");
+DATA(insert OID = 3490 (  jsonb_to_record			PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2249 "3802" _null_ _null_ _null_ _null_ _null_ jsonb_to_record _null_ _null_ _null_ ));
+DESCR("get record fields from a jsonb object");
+DATA(insert OID = 3491 (  jsonb_to_recordset		PGNSP PGUID 12 1 100 0 0 f f f f f t s 1 0 2249 "3802" _null_ _null_ _null_ _null_ _null_ jsonb_to_recordset _null_ _null_ _null_ ));
+DESCR("get set of records with fields from a jsonb array of objects");
+DATA(insert OID = 3210 (  jsonb_typeof				PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "3802" _null_ _null_ _null_ _null_ _null_ jsonb_typeof _null_ _null_ _null_ ));
+DESCR("get the type of a jsonb value");
+DATA(insert OID = 4038 (  jsonb_ne		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 3802" _null_ _null_ _null_ _null_ _null_ jsonb_ne _null_ _null_ _null_ ));
+DATA(insert OID = 4039 (  jsonb_lt		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 3802" _null_ _null_ _null_ _null_ _null_ jsonb_lt _null_ _null_ _null_ ));
+DATA(insert OID = 4040 (  jsonb_gt		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 3802" _null_ _null_ _null_ _null_ _null_ jsonb_gt _null_ _null_ _null_ ));
+DATA(insert OID = 4041 (  jsonb_le		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 3802" _null_ _null_ _null_ _null_ _null_ jsonb_le _null_ _null_ _null_ ));
+DATA(insert OID = 4042 (  jsonb_ge		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 3802" _null_ _null_ _null_ _null_ _null_ jsonb_ge _null_ _null_ _null_ ));
+DATA(insert OID = 4043 (  jsonb_eq		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 3802" _null_ _null_ _null_ _null_ _null_ jsonb_eq _null_ _null_ _null_ ));
+DATA(insert OID = 4044 (  jsonb_cmp		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "3802 3802" _null_ _null_ _null_ _null_ _null_ jsonb_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 4045 (  jsonb_hash	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "3802" _null_ _null_ _null_ _null_ _null_ jsonb_hash _null_ _null_ _null_ ));
+DESCR("hash");
+DATA(insert OID = 4046 (  jsonb_contains   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 3802" _null_ _null_ _null_ _null_ _null_ jsonb_contains _null_ _null_ _null_ ));
+DESCR("implementation of @> operator");
+DATA(insert OID = 4047 (  jsonb_exists	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 25" _null_ _null_ _null_ _null_ _null_ jsonb_exists _null_ _null_ _null_ ));
+DESCR("implementation of ? operator");
+DATA(insert OID = 4048 (  jsonb_exists_any	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 1009" _null_ _null_ _null_ _null_ _null_ jsonb_exists_any _null_ _null_ _null_ ));
+DESCR("implementation of ?| operator");
+DATA(insert OID = 4049 (  jsonb_exists_all	 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 1009" _null_ _null_ _null_ _null_ _null_ jsonb_exists_all _null_ _null_ _null_ ));
+DESCR("implementation of ?& operator");
+DATA(insert OID = 4050 (  jsonb_contained	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 3802" _null_ _null_ _null_ _null_ _null_ jsonb_contained _null_ _null_ _null_ ));
+DESCR("implementation of <@ operator");
+DATA(insert OID = 3480 (  gin_compare_jsonb  PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ _null_ gin_compare_jsonb _null_ _null_ _null_ ));
+DESCR("GIN support");
+DATA(insert OID = 3482 (  gin_extract_jsonb  PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_jsonb _null_ _null_ _null_ ));
+DESCR("GIN support");
+DATA(insert OID = 3483 (  gin_extract_jsonb_query  PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 2281 "2277 2281 21 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_jsonb_query _null_ _null_ _null_ ));
+DESCR("GIN support");
+DATA(insert OID = 3484 (  gin_consistent_jsonb	PGNSP PGUID 12 1 0 0 0 f f f f t f i 8 0 16 "2281 21 2277 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_consistent_jsonb _null_ _null_ _null_ ));
+DESCR("GIN support");
+DATA(insert OID = 3488 (  gin_triconsistent_jsonb	PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 18 "2281 21 2277 23 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_triconsistent_jsonb _null_ _null_ _null_ ));
+DESCR("GIN support");
+DATA(insert OID = 3485 (  gin_extract_jsonb_path  PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_jsonb_path _null_ _null_ _null_ ));
+DESCR("GIN support");
+DATA(insert OID = 3486 (  gin_extract_jsonb_query_path	PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 2281 "2277 2281 21 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_jsonb_query_path _null_ _null_ _null_ ));
+DESCR("GIN support");
+DATA(insert OID = 3487 (  gin_consistent_jsonb_path  PGNSP PGUID 12 1 0 0 0 f f f f t f i 8 0 16 "2281 21 2277 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_consistent_jsonb_path _null_ _null_ _null_ ));
+DESCR("GIN support");
+DATA(insert OID = 3489 (  gin_triconsistent_jsonb_path	PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 18 "2281 21 2277 23 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_triconsistent_jsonb_path _null_ _null_ _null_ ));
+DESCR("GIN support");
+DATA(insert OID = 3301 (  jsonb_concat	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3802 "3802 3802" _null_ _null_ _null_ _null_ _null_ jsonb_concat _null_ _null_ _null_ ));
+DATA(insert OID = 3302 (  jsonb_delete	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3802 "3802 25" _null_ _null_ _null_ _null_ _null_ jsonb_delete _null_ _null_ _null_ ));
+DATA(insert OID = 3303 (  jsonb_delete	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3802 "3802 23" _null_ _null_ _null_ _null_ _null_ jsonb_delete_idx _null_ _null_ _null_ ));
+DATA(insert OID = 3304 (  jsonb_delete_path	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3802 "3802 1009" _null_ _null_ _null_ _null_ _null_ jsonb_delete_path _null_ _null_ _null_ ));
+DATA(insert OID = 3305 (  jsonb_set	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 3802 "3802 1009 3802 16" _null_ _null_ _null_ _null_ _null_ jsonb_set _null_ _null_ _null_ ));
+DESCR("Set part of a jsonb");
+DATA(insert OID = 3306 (  jsonb_pretty	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "3802" _null_ _null_ _null_ _null_ _null_ jsonb_pretty _null_ _null_ _null_ ));
+DESCR("Indented text from jsonb");
+/* txid */
+DATA(insert OID = 2939 (  txid_snapshot_in			PGNSP PGUID 12 1  0 0 0 f f f f t f i 1 0 2970 "2275" _null_ _null_ _null_ _null_ _null_ txid_snapshot_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2940 (  txid_snapshot_out			PGNSP PGUID 12 1  0 0 0 f f f f t f i 1 0 2275 "2970" _null_ _null_ _null_ _null_ _null_ txid_snapshot_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2941 (  txid_snapshot_recv		PGNSP PGUID 12 1  0 0 0 f f f f t f i 1 0 2970 "2281" _null_ _null_ _null_ _null_ _null_ txid_snapshot_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2942 (  txid_snapshot_send		PGNSP PGUID 12 1  0 0 0 f f f f t f i 1 0 17 "2970" _null_ _null_ _null_ _null_ _null_ txid_snapshot_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2943 (  txid_current				PGNSP PGUID 12 1  0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ _null_ txid_current _null_ _null_ _null_ ));
+DESCR("get current transaction ID");
+DATA(insert OID = 2944 (  txid_current_snapshot		PGNSP PGUID 12 1  0 0 0 f f f f t f s 0 0 2970 "" _null_ _null_ _null_ _null_ _null_ txid_current_snapshot _null_ _null_ _null_ ));
+DESCR("get current snapshot");
+DATA(insert OID = 2945 (  txid_snapshot_xmin		PGNSP PGUID 12 1  0 0 0 f f f f t f i 1 0 20 "2970" _null_ _null_ _null_ _null_ _null_ txid_snapshot_xmin _null_ _null_ _null_ ));
+DESCR("get xmin of snapshot");
+DATA(insert OID = 2946 (  txid_snapshot_xmax		PGNSP PGUID 12 1  0 0 0 f f f f t f i 1 0 20 "2970" _null_ _null_ _null_ _null_ _null_ txid_snapshot_xmax _null_ _null_ _null_ ));
+DESCR("get xmax of snapshot");
+DATA(insert OID = 2947 (  txid_snapshot_xip			PGNSP PGUID 12 1 50 0 0 f f f f t t i 1 0 20 "2970" _null_ _null_ _null_ _null_ _null_ txid_snapshot_xip _null_ _null_ _null_ ));
+DESCR("get set of in-progress txids in snapshot");
+DATA(insert OID = 2948 (  txid_visible_in_snapshot	PGNSP PGUID 12 1  0 0 0 f f f f t f i 2 0 16 "20 2970" _null_ _null_ _null_ _null_ _null_ txid_visible_in_snapshot _null_ _null_ _null_ ));
+DESCR("is txid visible in snapshot?");
+
+/* record comparison using normal comparison rules */
+DATA(insert OID = 2981 (  record_eq		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ _null_ record_eq _null_ _null_ _null_ ));
+DATA(insert OID = 2982 (  record_ne		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ _null_ record_ne _null_ _null_ _null_ ));
+DATA(insert OID = 2983 (  record_lt		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ _null_ record_lt _null_ _null_ _null_ ));
+DATA(insert OID = 2984 (  record_gt		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ _null_ record_gt _null_ _null_ _null_ ));
+DATA(insert OID = 2985 (  record_le		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ _null_ record_le _null_ _null_ _null_ ));
+DATA(insert OID = 2986 (  record_ge		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ _null_ record_ge _null_ _null_ _null_ ));
+DATA(insert OID = 2987 (  btrecordcmp	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2249 2249" _null_ _null_ _null_ _null_ _null_ btrecordcmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+
+/* record comparison using raw byte images */
+DATA(insert OID = 3181 (  record_image_eq	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ _null_ record_image_eq _null_ _null_ _null_ ));
+DATA(insert OID = 3182 (  record_image_ne	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ _null_ record_image_ne _null_ _null_ _null_ ));
+DATA(insert OID = 3183 (  record_image_lt	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ _null_ record_image_lt _null_ _null_ _null_ ));
+DATA(insert OID = 3184 (  record_image_gt	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ _null_ record_image_gt _null_ _null_ _null_ ));
+DATA(insert OID = 3185 (  record_image_le	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ _null_ record_image_le _null_ _null_ _null_ ));
+DATA(insert OID = 3186 (  record_image_ge	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ _null_ record_image_ge _null_ _null_ _null_ ));
+DATA(insert OID = 3187 (  btrecordimagecmp	   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2249 2249" _null_ _null_ _null_ _null_ _null_ btrecordimagecmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater based on byte images");
+
+/* Extensions */
+DATA(insert OID = 3082 (  pg_available_extensions		PGNSP PGUID 12 10 100 0 0 f f f f t t s 0 0 2249 "" "{19,25,25}" "{o,o,o}" "{name,default_version,comment}" _null_ _null_ pg_available_extensions _null_ _null_ _null_ ));
+DESCR("list available extensions");
+DATA(insert OID = 3083 (  pg_available_extension_versions	PGNSP PGUID 12 10 100 0 0 f f f f t t s 0 0 2249 "" "{19,25,16,16,19,1003,25}" "{o,o,o,o,o,o,o}" "{name,version,superuser,relocatable,schema,requires,comment}" _null_ _null_ pg_available_extension_versions _null_ _null_ _null_ ));
+DESCR("list available extension versions");
+DATA(insert OID = 3084 (  pg_extension_update_paths		PGNSP PGUID 12 10 100 0 0 f f f f t t s 1 0 2249 "19" "{19,25,25,25}" "{i,o,o,o}" "{name,source,target,path}" _null_ _null_ pg_extension_update_paths _null_ _null_ _null_ ));
+DESCR("list an extension's version update paths");
+DATA(insert OID = 3086 (  pg_extension_config_dump		PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2278 "2205 25" _null_ _null_ _null_ _null_ _null_ pg_extension_config_dump _null_ _null_ _null_ ));
+DESCR("flag an extension's table contents to be emitted by pg_dump");
+
+/* SQL-spec window functions */
+DATA(insert OID = 3100 (  row_number	PGNSP PGUID 12 1 0 0 0 f t f f f f i 0 0 20 "" _null_ _null_ _null_ _null_ _null_ window_row_number _null_ _null_ _null_ ));
+DESCR("row number within partition");
+DATA(insert OID = 3101 (  rank			PGNSP PGUID 12 1 0 0 0 f t f f f f i 0 0 20 "" _null_ _null_ _null_ _null_ _null_ window_rank _null_ _null_ _null_ ));
+DESCR("integer rank with gaps");
+DATA(insert OID = 3102 (  dense_rank	PGNSP PGUID 12 1 0 0 0 f t f f f f i 0 0 20 "" _null_ _null_ _null_ _null_ _null_ window_dense_rank _null_ _null_ _null_ ));
+DESCR("integer rank without gaps");
+DATA(insert OID = 3103 (  percent_rank	PGNSP PGUID 12 1 0 0 0 f t f f f f i 0 0 701 "" _null_ _null_ _null_ _null_ _null_ window_percent_rank _null_ _null_ _null_ ));
+DESCR("fractional rank within partition");
+DATA(insert OID = 3104 (  cume_dist		PGNSP PGUID 12 1 0 0 0 f t f f f f i 0 0 701 "" _null_ _null_ _null_ _null_ _null_ window_cume_dist _null_ _null_ _null_ ));
+DESCR("fractional row number within partition");
+DATA(insert OID = 3105 (  ntile			PGNSP PGUID 12 1 0 0 0 f t f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ _null_ window_ntile _null_ _null_ _null_ ));
+DESCR("split rows into N groups");
+DATA(insert OID = 3106 (  lag			PGNSP PGUID 12 1 0 0 0 f t f f t f i 1 0 2283 "2283" _null_ _null_ _null_ _null_ _null_ window_lag _null_ _null_ _null_ ));
+DESCR("fetch the preceding row value");
+DATA(insert OID = 3107 (  lag			PGNSP PGUID 12 1 0 0 0 f t f f t f i 2 0 2283 "2283 23" _null_ _null_ _null_ _null_ _null_ window_lag_with_offset _null_ _null_ _null_ ));
+DESCR("fetch the Nth preceding row value");
+DATA(insert OID = 3108 (  lag			PGNSP PGUID 12 1 0 0 0 f t f f t f i 3 0 2283 "2283 23 2283" _null_ _null_ _null_ _null_ _null_ window_lag_with_offset_and_default _null_ _null_ _null_ ));
+DESCR("fetch the Nth preceding row value with default");
+DATA(insert OID = 3109 (  lead			PGNSP PGUID 12 1 0 0 0 f t f f t f i 1 0 2283 "2283" _null_ _null_ _null_ _null_ _null_ window_lead _null_ _null_ _null_ ));
+DESCR("fetch the following row value");
+DATA(insert OID = 3110 (  lead			PGNSP PGUID 12 1 0 0 0 f t f f t f i 2 0 2283 "2283 23" _null_ _null_ _null_ _null_ _null_ window_lead_with_offset _null_ _null_ _null_ ));
+DESCR("fetch the Nth following row value");
+DATA(insert OID = 3111 (  lead			PGNSP PGUID 12 1 0 0 0 f t f f t f i 3 0 2283 "2283 23 2283" _null_ _null_ _null_ _null_ _null_ window_lead_with_offset_and_default _null_ _null_ _null_ ));
+DESCR("fetch the Nth following row value with default");
+DATA(insert OID = 3112 (  first_value	PGNSP PGUID 12 1 0 0 0 f t f f t f i 1 0 2283 "2283" _null_ _null_ _null_ _null_ _null_ window_first_value _null_ _null_ _null_ ));
+DESCR("fetch the first row value");
+DATA(insert OID = 3113 (  last_value	PGNSP PGUID 12 1 0 0 0 f t f f t f i 1 0 2283 "2283" _null_ _null_ _null_ _null_ _null_ window_last_value _null_ _null_ _null_ ));
+DESCR("fetch the last row value");
+DATA(insert OID = 3114 (  nth_value		PGNSP PGUID 12 1 0 0 0 f t f f t f i 2 0 2283 "2283 23" _null_ _null_ _null_ _null_ _null_ window_nth_value _null_ _null_ _null_ ));
+DESCR("fetch the Nth row value");
+
+/* functions for range types */
+DATA(insert OID = 3832 (  anyrange_in	PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 3831 "2275 26 23" _null_ _null_ _null_ _null_ _null_ anyrange_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3833 (  anyrange_out	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "3831" _null_ _null_ _null_ _null_ _null_ anyrange_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3834 (  range_in		PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 3831 "2275 26 23" _null_ _null_ _null_ _null_ _null_ range_in _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3835 (  range_out		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "3831" _null_ _null_ _null_ _null_ _null_ range_out _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3836 (  range_recv	PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 3831 "2281 26 23" _null_ _null_ _null_ _null_ _null_ range_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3837 (  range_send	PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "3831" _null_ _null_ _null_ _null_ _null_ range_send _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3848 (  lower		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2283 "3831" _null_ _null_ _null_ _null_ _null_ range_lower _null_ _null_ _null_ ));
+DESCR("lower bound of range");
+DATA(insert OID = 3849 (  upper		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2283 "3831" _null_ _null_ _null_ _null_ _null_ range_upper _null_ _null_ _null_ ));
+DESCR("upper bound of range");
+DATA(insert OID = 3850 (  isempty	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "3831" _null_ _null_ _null_ _null_ _null_ range_empty _null_ _null_ _null_ ));
+DESCR("is the range empty?");
+DATA(insert OID = 3851 (  lower_inc PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "3831" _null_ _null_ _null_ _null_ _null_ range_lower_inc _null_ _null_ _null_ ));
+DESCR("is the range's lower bound inclusive?");
+DATA(insert OID = 3852 (  upper_inc PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "3831" _null_ _null_ _null_ _null_ _null_ range_upper_inc _null_ _null_ _null_ ));
+DESCR("is the range's upper bound inclusive?");
+DATA(insert OID = 3853 (  lower_inf PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "3831" _null_ _null_ _null_ _null_ _null_ range_lower_inf _null_ _null_ _null_ ));
+DESCR("is the range's lower bound infinite?");
+DATA(insert OID = 3854 (  upper_inf PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "3831" _null_ _null_ _null_ _null_ _null_ range_upper_inf _null_ _null_ _null_ ));
+DESCR("is the range's upper bound infinite?");
+DATA(insert OID = 3855 (  range_eq	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_eq _null_ _null_ _null_ ));
+DESCR("implementation of = operator");
+DATA(insert OID = 3856 (  range_ne	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_ne _null_ _null_ _null_ ));
+DESCR("implementation of <> operator");
+DATA(insert OID = 3857 (  range_overlaps		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_overlaps _null_ _null_ _null_ ));
+DESCR("implementation of && operator");
+DATA(insert OID = 3858 (  range_contains_elem	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 2283" _null_ _null_ _null_ _null_ _null_ range_contains_elem _null_ _null_ _null_ ));
+DESCR("implementation of @> operator");
+DATA(insert OID = 3859 (  range_contains		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_contains _null_ _null_ _null_ ));
+DESCR("implementation of @> operator");
+DATA(insert OID = 3860 (  elem_contained_by_range	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2283 3831" _null_ _null_ _null_ _null_ _null_ elem_contained_by_range _null_ _null_ _null_ ));
+DESCR("implementation of <@ operator");
+DATA(insert OID = 3861 (  range_contained_by	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_contained_by _null_ _null_ _null_ ));
+DESCR("implementation of <@ operator");
+DATA(insert OID = 3862 (  range_adjacent		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_adjacent _null_ _null_ _null_ ));
+DESCR("implementation of -|- operator");
+DATA(insert OID = 3863 (  range_before		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_before _null_ _null_ _null_ ));
+DESCR("implementation of << operator");
+DATA(insert OID = 3864 (  range_after		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_after _null_ _null_ _null_ ));
+DESCR("implementation of >> operator");
+DATA(insert OID = 3865 (  range_overleft	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_overleft _null_ _null_ _null_ ));
+DESCR("implementation of &< operator");
+DATA(insert OID = 3866 (  range_overright	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_overright _null_ _null_ _null_ ));
+DESCR("implementation of &> operator");
+DATA(insert OID = 3867 (  range_union		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3831 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_union _null_ _null_ _null_ ));
+DESCR("implementation of + operator");
+DATA(insert OID = 4057 (  range_merge		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3831 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_merge _null_ _null_ _null_ ));
+DESCR("the smallest range which includes both of the given ranges");
+DATA(insert OID = 3868 (  range_intersect	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3831 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_intersect _null_ _null_ _null_ ));
+DESCR("implementation of * operator");
+DATA(insert OID = 3869 (  range_minus		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3831 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_minus _null_ _null_ _null_ ));
+DESCR("implementation of - operator");
+DATA(insert OID = 3870 (  range_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_cmp _null_ _null_ _null_ ));
+DESCR("less-equal-greater");
+DATA(insert OID = 3871 (  range_lt	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_lt _null_ _null_ _null_ ));
+DATA(insert OID = 3872 (  range_le	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_le _null_ _null_ _null_ ));
+DATA(insert OID = 3873 (  range_ge	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_ge _null_ _null_ _null_ ));
+DATA(insert OID = 3874 (  range_gt	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_gt _null_ _null_ _null_ ));
+DATA(insert OID = 3875 (  range_gist_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 16 "2281 3831 23 26 2281" _null_ _null_ _null_ _null_ _null_ range_gist_consistent _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3876 (  range_gist_union		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ range_gist_union _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3877 (  range_gist_compress	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ range_gist_compress _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3878 (  range_gist_decompress PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ range_gist_decompress _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3996 (  range_gist_fetch		PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ range_gist_fetch _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3879 (  range_gist_penalty	PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ range_gist_penalty _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3880 (  range_gist_picksplit	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ range_gist_picksplit _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3881 (  range_gist_same		PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "3831 3831 2281" _null_ _null_ _null_ _null_ _null_ range_gist_same _null_ _null_ _null_ ));
+DESCR("GiST support");
+DATA(insert OID = 3902 (  hash_range			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "3831" _null_ _null_ _null_ _null_ _null_ hash_range _null_ _null_ _null_ ));
+DESCR("hash a range");
+DATA(insert OID = 3916 (  range_typanalyze		PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "2281" _null_ _null_ _null_ _null_ _null_ range_typanalyze _null_ _null_ _null_ ));
+DESCR("range typanalyze");
+DATA(insert OID = 3169 (  rangesel				PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_ rangesel _null_ _null_ _null_ ));
+DESCR("restriction selectivity for range operators");
+
+DATA(insert OID = 3914 (  int4range_canonical		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3904 "3904" _null_ _null_ _null_ _null_ _null_ int4range_canonical _null_ _null_ _null_ ));
+DESCR("convert an int4 range to canonical form");
+DATA(insert OID = 3928 (  int8range_canonical		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3926 "3926" _null_ _null_ _null_ _null_ _null_ int8range_canonical _null_ _null_ _null_ ));
+DESCR("convert an int8 range to canonical form");
+DATA(insert OID = 3915 (  daterange_canonical		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3912 "3912" _null_ _null_ _null_ _null_ _null_ daterange_canonical _null_ _null_ _null_ ));
+DESCR("convert a date range to canonical form");
+DATA(insert OID = 3922 (  int4range_subdiff		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "23 23" _null_ _null_ _null_ _null_ _null_ int4range_subdiff _null_ _null_ _null_ ));
+DESCR("float8 difference of two int4 values");
+DATA(insert OID = 3923 (  int8range_subdiff		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "20 20" _null_ _null_ _null_ _null_ _null_ int8range_subdiff _null_ _null_ _null_ ));
+DESCR("float8 difference of two int8 values");
+DATA(insert OID = 3924 (  numrange_subdiff		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "1700 1700" _null_ _null_ _null_ _null_ _null_ numrange_subdiff _null_ _null_ _null_ ));
+DESCR("float8 difference of two numeric values");
+DATA(insert OID = 3925 (  daterange_subdiff		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "1082 1082" _null_ _null_ _null_ _null_ _null_ daterange_subdiff _null_ _null_ _null_ ));
+DESCR("float8 difference of two date values");
+DATA(insert OID = 3929 (  tsrange_subdiff		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "1114 1114" _null_ _null_ _null_ _null_ _null_ tsrange_subdiff _null_ _null_ _null_ ));
+DESCR("float8 difference of two timestamp values");
+DATA(insert OID = 3930 (  tstzrange_subdiff		   PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "1184 1184" _null_ _null_ _null_ _null_ _null_ tstzrange_subdiff _null_ _null_ _null_ ));
+DESCR("float8 difference of two timestamp with time zone values");
+
+DATA(insert OID = 3840 (  int4range PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 3904 "23 23" _null_ _null_ _null_ _null_ _null_ range_constructor2 _null_ _null_ _null_ ));
+DESCR("int4range constructor");
+DATA(insert OID = 3841 (  int4range PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 3904 "23 23 25" _null_ _null_ _null_ _null_ _null_ range_constructor3 _null_ _null_ _null_ ));
+DESCR("int4range constructor");
+DATA(insert OID = 3844 (  numrange	PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 3906 "1700 1700" _null_ _null_ _null_ _null_ _null_ range_constructor2 _null_ _null_ _null_ ));
+DESCR("numrange constructor");
+DATA(insert OID = 3845 (  numrange	PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 3906 "1700 1700 25" _null_ _null_ _null_ _null_ _null_ range_constructor3 _null_ _null_ _null_ ));
+DESCR("numrange constructor");
+DATA(insert OID = 3933 (  tsrange	PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 3908 "1114 1114" _null_ _null_ _null_ _null_ _null_ range_constructor2 _null_ _null_ _null_ ));
+DESCR("tsrange constructor");
+DATA(insert OID = 3934 (  tsrange	PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 3908 "1114 1114 25" _null_ _null_ _null_ _null_ _null_ range_constructor3 _null_ _null_ _null_ ));
+DESCR("tsrange constructor");
+DATA(insert OID = 3937 (  tstzrange PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 3910 "1184 1184" _null_ _null_ _null_ _null_ _null_ range_constructor2 _null_ _null_ _null_ ));
+DESCR("tstzrange constructor");
+DATA(insert OID = 3938 (  tstzrange PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 3910 "1184 1184 25" _null_ _null_ _null_ _null_ _null_ range_constructor3 _null_ _null_ _null_ ));
+DESCR("tstzrange constructor");
+DATA(insert OID = 3941 (  daterange PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 3912 "1082 1082" _null_ _null_ _null_ _null_ _null_ range_constructor2 _null_ _null_ _null_ ));
+DESCR("daterange constructor");
+DATA(insert OID = 3942 (  daterange PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 3912 "1082 1082 25" _null_ _null_ _null_ _null_ _null_ range_constructor3 _null_ _null_ _null_ ));
+DESCR("daterange constructor");
+DATA(insert OID = 3945 (  int8range PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 3926 "20 20" _null_ _null_ _null_ _null_ _null_ range_constructor2 _null_ _null_ _null_ ));
+DESCR("int8range constructor");
+DATA(insert OID = 3946 (  int8range PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 3926 "20 20 25" _null_ _null_ _null_ _null_ _null_ range_constructor3 _null_ _null_ _null_ ));
+DESCR("int8range constructor");
+
+/* date, time, timestamp constructors */
+DATA(insert OID = 3846 ( make_date	PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1082 "23 23 23" _null_ _null_ "{year,month,day}" _null_ _null_ make_date _null_ _null_ _null_ ));
+DESCR("construct date");
+DATA(insert OID = 3847 ( make_time	PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1083 "23 23 701" _null_ _null_ "{hour,min,sec}" _null_ _null_ make_time _null_ _null_ _null_ ));
+DESCR("construct time");
+DATA(insert OID = 3461 ( make_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f i 6 0 1114 "23 23 23 23 23 701" _null_ _null_ "{year,month,mday,hour,min,sec}" _null_ _null_ make_timestamp _null_ _null_ _null_ ));
+DESCR("construct timestamp");
+DATA(insert OID = 3462 ( make_timestamptz	PGNSP PGUID 12 1 0 0 0 f f f f t f s 6 0 1184 "23 23 23 23 23 701" _null_ _null_ "{year,month,mday,hour,min,sec}" _null_ _null_ make_timestamptz _null_ _null_ _null_ ));
+DESCR("construct timestamp with time zone");
+DATA(insert OID = 3463 ( make_timestamptz	PGNSP PGUID 12 1 0 0 0 f f f f t f s 7 0 1184 "23 23 23 23 23 701 25" _null_ _null_ "{year,month,mday,hour,min,sec,timezone}" _null_ _null_ make_timestamptz_at_timezone _null_ _null_ _null_ ));
+DESCR("construct timestamp with time zone");
+DATA(insert OID = 3464 ( make_interval	PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 1186 "23 23 23 23 23 23 701" _null_ _null_ "{years,months,weeks,days,hours,mins,secs}" _null_ _null_ make_interval _null_ _null_ _null_ ));
+DESCR("construct interval");
+
+/* spgist support functions */
+DATA(insert OID = 4001 (  spggettuple	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ _null_	spggettuple _null_ _null_ _null_ ));
+DESCR("spgist(internal)");
+DATA(insert OID = 4002 (  spggetbitmap	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ _null_	spggetbitmap _null_ _null_ _null_ ));
+DESCR("spgist(internal)");
+DATA(insert OID = 4003 (  spginsert		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 6 0 16 "2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_	spginsert _null_ _null_ _null_ ));
+DESCR("spgist(internal)");
+DATA(insert OID = 4004 (  spgbeginscan	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_	spgbeginscan _null_ _null_ _null_ ));
+DESCR("spgist(internal)");
+DATA(insert OID = 4005 (  spgrescan		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 5 0 2278 "2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ spgrescan _null_ _null_ _null_ ));
+DESCR("spgist(internal)");
+DATA(insert OID = 4006 (  spgendscan	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ spgendscan _null_ _null_ _null_ ));
+DESCR("spgist(internal)");
+DATA(insert OID = 4007 (  spgmarkpos	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ spgmarkpos _null_ _null_ _null_ ));
+DESCR("spgist(internal)");
+DATA(insert OID = 4008 (  spgrestrpos	   PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ spgrestrpos _null_ _null_ _null_ ));
+DESCR("spgist(internal)");
+DATA(insert OID = 4009 (  spgbuild		   PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ spgbuild _null_ _null_ _null_ ));
+DESCR("spgist(internal)");
+DATA(insert OID = 4010 (  spgbuildempty    PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ _null_ spgbuildempty _null_ _null_ _null_ ));
+DESCR("spgist(internal)");
+DATA(insert OID = 4011 (  spgbulkdelete    PGNSP PGUID 12 1 0 0 0 f f f f t f v 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ spgbulkdelete _null_ _null_ _null_ ));
+DESCR("spgist(internal)");
+DATA(insert OID = 4012 (  spgvacuumcleanup	 PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ spgvacuumcleanup _null_ _null_ _null_ ));
+DESCR("spgist(internal)");
+DATA(insert OID = 4032 (  spgcanreturn	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "2281 23" _null_ _null_ _null_ _null_ _null_ spgcanreturn _null_ _null_ _null_ ));
+DESCR("spgist(internal)");
+DATA(insert OID = 4013 (  spgcostestimate  PGNSP PGUID 12 1 0 0 0 f f f f t f v 7 0 2278 "2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ spgcostestimate _null_ _null_ _null_ ));
+DESCR("spgist(internal)");
+DATA(insert OID = 4014 (  spgoptions	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 17 "1009 16" _null_ _null_ _null_ _null_  _null_ spgoptions _null_ _null_ _null_ ));
+DESCR("spgist(internal)");
+
+/* spgist opclasses */
+DATA(insert OID = 4018 (  spg_quad_config	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_quad_config _null_ _null_ _null_ ));
+DESCR("SP-GiST support for quad tree over point");
+DATA(insert OID = 4019 (  spg_quad_choose	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_quad_choose _null_ _null_ _null_ ));
+DESCR("SP-GiST support for quad tree over point");
+DATA(insert OID = 4020 (  spg_quad_picksplit	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_quad_picksplit _null_ _null_ _null_ ));
+DESCR("SP-GiST support for quad tree over point");
+DATA(insert OID = 4021 (  spg_quad_inner_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_quad_inner_consistent _null_ _null_ _null_ ));
+DESCR("SP-GiST support for quad tree over point");
+DATA(insert OID = 4022 (  spg_quad_leaf_consistent	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_quad_leaf_consistent _null_ _null_ _null_ ));
+DESCR("SP-GiST support for quad tree and k-d tree over point");
+
+DATA(insert OID = 4023 (  spg_kd_config PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_kd_config _null_ _null_ _null_ ));
+DESCR("SP-GiST support for k-d tree over point");
+DATA(insert OID = 4024 (  spg_kd_choose PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_kd_choose _null_ _null_ _null_ ));
+DESCR("SP-GiST support for k-d tree over point");
+DATA(insert OID = 4025 (  spg_kd_picksplit	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_kd_picksplit _null_ _null_ _null_ ));
+DESCR("SP-GiST support for k-d tree over point");
+DATA(insert OID = 4026 (  spg_kd_inner_consistent	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_kd_inner_consistent _null_ _null_ _null_ ));
+DESCR("SP-GiST support for k-d tree over point");
+
+DATA(insert OID = 4027 (  spg_text_config	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_text_config _null_ _null_ _null_ ));
+DESCR("SP-GiST support for radix tree over text");
+DATA(insert OID = 4028 (  spg_text_choose	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_text_choose _null_ _null_ _null_ ));
+DESCR("SP-GiST support for radix tree over text");
+DATA(insert OID = 4029 (  spg_text_picksplit	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_text_picksplit _null_ _null_ _null_ ));
+DESCR("SP-GiST support for radix tree over text");
+DATA(insert OID = 4030 (  spg_text_inner_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_text_inner_consistent _null_ _null_ _null_ ));
+DESCR("SP-GiST support for radix tree over text");
+DATA(insert OID = 4031 (  spg_text_leaf_consistent	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_text_leaf_consistent _null_ _null_ _null_ ));
+DESCR("SP-GiST support for radix tree over text");
+
+DATA(insert OID = 3469 (  spg_range_quad_config PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_range_quad_config _null_ _null_ _null_ ));
+DESCR("SP-GiST support for quad tree over range");
+DATA(insert OID = 3470 (  spg_range_quad_choose PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_range_quad_choose _null_ _null_ _null_ ));
+DESCR("SP-GiST support for quad tree over range");
+DATA(insert OID = 3471 (  spg_range_quad_picksplit	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_range_quad_picksplit _null_ _null_ _null_ ));
+DESCR("SP-GiST support for quad tree over range");
+DATA(insert OID = 3472 (  spg_range_quad_inner_consistent	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_range_quad_inner_consistent _null_ _null_ _null_ ));
+DESCR("SP-GiST support for quad tree over range");
+DATA(insert OID = 3473 (  spg_range_quad_leaf_consistent	PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2281 2281" _null_ _null_ _null_ _null_  _null_ spg_range_quad_leaf_consistent _null_ _null_ _null_ ));
+DESCR("SP-GiST support for quad tree over range");
+
+/* replication slots */
+DATA(insert OID = 3779 (  pg_create_physical_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2249 "19" "{19,19,3220}" "{i,o,o}" "{slot_name,slot_name,xlog_position}" _null_ _null_ pg_create_physical_replication_slot _null_ _null_ _null_ ));
+DESCR("create a physical replication slot");
+DATA(insert OID = 3780 (  pg_drop_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "19" _null_ _null_ _null_ _null_ _null_ pg_drop_replication_slot _null_ _null_ _null_ ));
+DESCR("drop a replication slot");
+DATA(insert OID = 3781 (  pg_get_replication_slots	PGNSP PGUID 12 1 10 0 0 f f f f f t s 0 0 2249 "" "{19,19,25,26,16,23,28,28,3220}" "{o,o,o,o,o,o,o,o,o}" "{slot_name,plugin,slot_type,datoid,active,active_pid,xmin,catalog_xmin,restart_lsn}" _null_ _null_ pg_get_replication_slots _null_ _null_ _null_ ));
+DESCR("information about replication slots currently in use");
+DATA(insert OID = 3786 (  pg_create_logical_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2249 "19 19" "{19,19,25,3220}" "{i,i,o,o}" "{slot_name,plugin,slot_name,xlog_position}" _null_ _null_ pg_create_logical_replication_slot _null_ _null_ _null_ ));
+DESCR("set up a logical replication slot");
+DATA(insert OID = 3782 (  pg_logical_slot_get_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,25}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ _null_ pg_logical_slot_get_changes _null_ _null_ _null_ ));
+DESCR("get changes from replication slot");
+DATA(insert OID = 3783 (  pg_logical_slot_get_binary_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,17}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ _null_ pg_logical_slot_get_binary_changes _null_ _null_ _null_ ));
+DESCR("get binary changes from replication slot");
+DATA(insert OID = 3784 (  pg_logical_slot_peek_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,25}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ _null_ pg_logical_slot_peek_changes _null_ _null_ _null_ ));
+DESCR("peek at changes from replication slot");
+DATA(insert OID = 3785 (  pg_logical_slot_peek_binary_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,17}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ _null_ pg_logical_slot_peek_binary_changes _null_ _null_ _null_ ));
+DESCR("peek at binary changes from replication slot");
+
+/* event triggers */
+DATA(insert OID = 3566 (  pg_event_trigger_dropped_objects		PGNSP PGUID 12 10 100 0 0 f f f f t t s 0 0 2249 "" "{26,26,23,16,16,16,25,25,25,25,1009,1009}" "{o,o,o,o,o,o,o,o,o,o,o,o}" "{classid, objid, objsubid, original, normal, is_temporary, object_type, schema_name, object_name, object_identity, address_names, address_args}" _null_ _null_ pg_event_trigger_dropped_objects _null_ _null_ _null_ ));
+DESCR("list objects dropped by the current command");
+DATA(insert OID = 4566 (  pg_event_trigger_table_rewrite_oid	PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 26 "" "{26}" "{o}" "{oid}" _null_ _null_ pg_event_trigger_table_rewrite_oid _null_ _null_ _null_ ));
+DESCR("return Oid of the table getting rewritten");
+DATA(insert OID = 4567 (  pg_event_trigger_table_rewrite_reason PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 23 "" _null_ _null_ _null_ _null_ _null_ pg_event_trigger_table_rewrite_reason _null_ _null_ _null_ ));
+DESCR("return reason code for table getting rewritten");
+DATA(insert OID = 4568 (  pg_event_trigger_ddl_commands			PGNSP PGUID 12 10 100 0 0 f f f f t t s 0 0 2249 "" "{26,26,23,25,25,25,25,16,32}" "{o,o,o,o,o,o,o,o,o}" "{classid, objid, objsubid, command_tag, object_type, schema_name, object_identity, in_extension, command}" _null_ _null_ pg_event_trigger_ddl_commands _null_ _null_ _null_ ));
+DESCR("list DDL actions being executed by the current command");
+
+/* generic transition functions for ordered-set aggregates */
+DATA(insert OID = 3970 ( ordered_set_transition			PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 2276" _null_ _null_ _null_ _null_ _null_ ordered_set_transition _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+DATA(insert OID = 3971 ( ordered_set_transition_multi	PGNSP PGUID 12 1 0 2276 0 f f f f f f i 2 0 2281 "2281 2276" "{2281,2276}" "{i,v}" _null_ _null_ _null_ ordered_set_transition_multi _null_ _null_ _null_ ));
+DESCR("aggregate transition function");
+
+/* inverse distribution aggregates (and their support functions) */
+DATA(insert OID = 3972 ( percentile_disc		PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 2283 "701 2283" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("discrete percentile");
+DATA(insert OID = 3973 ( percentile_disc_final	PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 2283 "2281 701 2283" _null_ _null_ _null_ _null_ _null_ percentile_disc_final _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3974 ( percentile_cont		PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("continuous distribution percentile");
+DATA(insert OID = 3975 ( percentile_cont_float8_final	PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 701 "2281 701" _null_ _null_ _null_ _null_ _null_ percentile_cont_float8_final _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3976 ( percentile_cont		PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 1186 "701 1186" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("continuous distribution percentile");
+DATA(insert OID = 3977 ( percentile_cont_interval_final PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 1186 "2281 701" _null_ _null_ _null_ _null_ _null_ percentile_cont_interval_final _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3978 ( percentile_disc		PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 2277 "1022 2283" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("multiple discrete percentiles");
+DATA(insert OID = 3979 ( percentile_disc_multi_final	PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 2277 "2281 1022 2283" _null_ _null_ _null_ _null_ _null_ percentile_disc_multi_final _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3980 ( percentile_cont		PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 1022 "1022 701" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("multiple continuous percentiles");
+DATA(insert OID = 3981 ( percentile_cont_float8_multi_final PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 1022 "2281 1022" _null_ _null_ _null_ _null_ _null_ percentile_cont_float8_multi_final _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3982 ( percentile_cont		PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 1187 "1022 1186" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("multiple continuous percentiles");
+DATA(insert OID = 3983 ( percentile_cont_interval_multi_final	PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 1187 "2281 1022" _null_ _null_ _null_ _null_ _null_ percentile_cont_interval_multi_final _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3984 ( mode					PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 2283 "2283" _null_ _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("most common value");
+DATA(insert OID = 3985 ( mode_final				PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2283 "2281 2283" _null_ _null_ _null_ _null_ _null_	mode_final _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+
+/* hypothetical-set aggregates (and their support functions) */
+DATA(insert OID = 3986 ( rank				PGNSP PGUID 12 1 0 2276 0 t f f f f f i 1 0 20 "2276" "{2276}" "{v}" _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("rank of hypothetical row");
+DATA(insert OID = 3987 ( rank_final			PGNSP PGUID 12 1 0 2276 0 f f f f f f i 2 0 20 "2281 2276" "{2281,2276}" "{i,v}" _null_ _null_ _null_	hypothetical_rank_final _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3988 ( percent_rank		PGNSP PGUID 12 1 0 2276 0 t f f f f f i 1 0 701 "2276" "{2276}" "{v}" _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("fractional rank of hypothetical row");
+DATA(insert OID = 3989 ( percent_rank_final PGNSP PGUID 12 1 0 2276 0 f f f f f f i 2 0 701 "2281 2276" "{2281,2276}" "{i,v}" _null_ _null_ _null_ hypothetical_percent_rank_final _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3990 ( cume_dist			PGNSP PGUID 12 1 0 2276 0 t f f f f f i 1 0 701 "2276" "{2276}" "{v}" _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+DESCR("cumulative distribution of hypothetical row");
+DATA(insert OID = 3991 ( cume_dist_final	PGNSP PGUID 12 1 0 2276 0 f f f f f f i 2 0 701 "2281 2276" "{2281,2276}" "{i,v}" _null_ _null_ _null_ hypothetical_cume_dist_final _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+DATA(insert OID = 3992 ( dense_rank			PGNSP PGUID 12 1 0 2276 0 t f f f f f i 1 0 20 "2276" "{2276}" "{v}" _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
+DESCR("rank of hypothetical row without gaps");
+DATA(insert OID = 3993 ( dense_rank_final	PGNSP PGUID 12 1 0 2276 0 f f f f f f i 2 0 20 "2281 2276" "{2281,2276}" "{i,v}" _null_ _null_ _null_	hypothetical_dense_rank_final _null_ _null_ _null_ ));
+DESCR("aggregate final function");
+
+/* pg_upgrade support */
+DATA(insert OID = 3582 ( binary_upgrade_set_next_pg_type_oid PGNSP PGUID  12 1 0 0 0 f f f f t f v 1 0 2278 "26" _null_ _null_ _null_ _null_ _null_ binary_upgrade_set_next_pg_type_oid _null_ _null_ _null_ ));
+DESCR("for use by pg_upgrade");
+DATA(insert OID = 3584 ( binary_upgrade_set_next_array_pg_type_oid PGNSP PGUID	12 1 0 0 0 f f f f t f v 1 0 2278 "26" _null_ _null_ _null_ _null_ _null_ binary_upgrade_set_next_array_pg_type_oid _null_ _null_ _null_ ));
+DESCR("for use by pg_upgrade");
+DATA(insert OID = 3585 ( binary_upgrade_set_next_toast_pg_type_oid PGNSP PGUID	12 1 0 0 0 f f f f t f v 1 0 2278 "26" _null_ _null_ _null_ _null_ _null_ binary_upgrade_set_next_toast_pg_type_oid _null_ _null_ _null_ ));
+DESCR("for use by pg_upgrade");
+DATA(insert OID = 3586 ( binary_upgrade_set_next_heap_pg_class_oid PGNSP PGUID	12 1 0 0 0 f f f f t f v 1 0 2278 "26" _null_ _null_ _null_ _null_ _null_ binary_upgrade_set_next_heap_pg_class_oid _null_ _null_ _null_ ));
+DESCR("for use by pg_upgrade");
+DATA(insert OID = 3587 ( binary_upgrade_set_next_index_pg_class_oid PGNSP PGUID  12 1 0 0 0 f f f f t f v 1 0 2278 "26" _null_ _null_ _null_ _null_ _null_ binary_upgrade_set_next_index_pg_class_oid _null_ _null_ _null_ ));
+DESCR("for use by pg_upgrade");
+DATA(insert OID = 3588 ( binary_upgrade_set_next_toast_pg_class_oid PGNSP PGUID  12 1 0 0 0 f f f f t f v 1 0 2278 "26" _null_ _null_ _null_ _null_ _null_ binary_upgrade_set_next_toast_pg_class_oid _null_ _null_ _null_ ));
+DESCR("for use by pg_upgrade");
+DATA(insert OID = 3589 ( binary_upgrade_set_next_pg_enum_oid PGNSP PGUID  12 1 0 0 0 f f f f t f v 1 0 2278 "26" _null_ _null_ _null_ _null_ _null_ binary_upgrade_set_next_pg_enum_oid _null_ _null_ _null_ ));
+DESCR("for use by pg_upgrade");
+DATA(insert OID = 3590 ( binary_upgrade_set_next_pg_authid_oid PGNSP PGUID	12 1 0 0 0 f f f f t f v 1 0 2278 "26" _null_ _null_ _null_ _null_ _null_ binary_upgrade_set_next_pg_authid_oid _null_ _null_ _null_ ));
+DESCR("for use by pg_upgrade");
+DATA(insert OID = 3591 ( binary_upgrade_create_empty_extension PGNSP PGUID	12 1 0 0 0 f f f f f f v 7 0 2278 "25 25 16 25 1028 1009 1009" _null_ _null_ _null_ _null_ _null_ binary_upgrade_create_empty_extension _null_ _null_ _null_ ));
+DESCR("for use by pg_upgrade");
+
+/* replication/origin.h */
+DATA(insert OID = 6003 ( pg_replication_origin_create PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 26 "25" _null_ _null_ _null_ _null_ _null_ pg_replication_origin_create _null_ _null_ _null_ ));
+DESCR("create a replication origin");
+
+DATA(insert OID = 6004 ( pg_replication_origin_drop PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "25" _null_ _null_ _null_ _null_ _null_ pg_replication_origin_drop _null_ _null_ _null_ ));
+DESCR("drop replication origin identified by its name");
+
+DATA(insert OID = 6005 ( pg_replication_origin_oid PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 26 "25" _null_ _null_ _null_ _null_ _null_ pg_replication_origin_oid _null_ _null_ _null_ ));
+DESCR("translate the replication origin's name to its id");
+
+DATA(insert OID = 6006 ( pg_replication_origin_session_setup PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "25" _null_ _null_ _null_ _null_ _null_ pg_replication_origin_session_setup _null_ _null_ _null_ ));
+DESCR("configure session to maintain replication progress tracking for the passed in origin");
+
+DATA(insert OID = 6007 ( pg_replication_origin_session_reset PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2278 "" _null_ _null_ _null_ _null_ _null_ pg_replication_origin_session_reset _null_ _null_ _null_ ));
+DESCR("teardown configured replication progress tracking");
+
+DATA(insert OID = 6008 ( pg_replication_origin_session_is_setup PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ _null_ pg_replication_origin_session_is_setup _null_ _null_ _null_ ));
+DESCR("is a replication origin configured in this session");
+
+DATA(insert OID = 6009 ( pg_replication_origin_session_progress PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 3220 "16" _null_ _null_ _null_ _null_ _null_ pg_replication_origin_session_progress _null_ _null_ _null_ ));
+DESCR("get the replication progress of the current session");
+
+DATA(insert OID = 6010 ( pg_replication_origin_xact_setup PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2278 "3220 1184" _null_ _null_ _null_ _null_ _null_ pg_replication_origin_xact_setup _null_ _null_ _null_ ));
+DESCR("setup the transaction's origin lsn and timestamp");
+
+DATA(insert OID = 6011 ( pg_replication_origin_xact_reset PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2278 "3220 1184" _null_ _null_ _null_ _null_ _null_ pg_replication_origin_xact_reset _null_ _null_ _null_ ));
+DESCR("reset the transaction's origin lsn and timestamp");
+
+DATA(insert OID = 6012 ( pg_replication_origin_advance PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2278 "25 3220" _null_ _null_ _null_ _null_ _null_ pg_replication_origin_advance _null_ _null_ _null_ ));
+DESCR("advance replication itentifier to specific location");
+
+DATA(insert OID = 6013 ( pg_replication_origin_progress PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 3220 "25 16" _null_ _null_ _null_ _null_ _null_ pg_replication_origin_progress _null_ _null_ _null_ ));
+DESCR("get an individual replication origin's replication progress");
+
+DATA(insert OID = 6014 ( pg_show_replication_origin_status PGNSP PGUID 12 1 100 0 0 f f f f f t v 0 0 2249 "" "{26,25,3220,3220}" "{o,o,o,o}" "{local_id, external_id, remote_lsn, local_lsn}" _null_ _null_ pg_show_replication_origin_status _null_ _null_ _null_ ));
+DESCR("get progress for all replication origins");
+
+/* rls */
+DATA(insert OID = 3298 (  row_security_active	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_	row_security_active _null_ _null_ _null_ ));
+DESCR("row security for current context active on table by table oid");
+DATA(insert OID = 3299 (  row_security_active	   PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "25" _null_ _null_ _null_ _null_ _null_	row_security_active_name _null_ _null_ _null_ ));
+DESCR("row security for current context active on table by table name");
+
+/*
+ * Symbolic values for provolatile column: these indicate whether the result
+ * of a function is dependent *only* on the values of its explicit arguments,
+ * or can change due to outside factors (such as parameter variables or
+ * table contents).  NOTE: functions having side-effects, such as setval(),
+ * must be labeled volatile to ensure they will not get optimized away,
+ * even if the actual return value is not changeable.
+ */
+#define PROVOLATILE_IMMUTABLE	'i'		/* never changes for given input */
+#define PROVOLATILE_STABLE		's'		/* does not change within a scan */
+#define PROVOLATILE_VOLATILE	'v'		/* can change even within a scan */
+
+/*
+ * Symbolic values for proargmodes column.  Note that these must agree with
+ * the FunctionParameterMode enum in parsenodes.h; we declare them here to
+ * be accessible from either header.
+ */
+#define PROARGMODE_IN		'i'
+#define PROARGMODE_OUT		'o'
+#define PROARGMODE_INOUT	'b'
+#define PROARGMODE_VARIADIC 'v'
+#define PROARGMODE_TABLE	't'
+
+#endif   /* PG_PROC_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_proc_fn.h b/foreign/libpg_query/src/postgres/include/catalog/pg_proc_fn.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_proc_fn.h
@@ -0,0 +1,50 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_proc_fn.h
+ *	 prototypes for functions in catalog/pg_proc.c
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_proc_fn.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_PROC_FN_H
+#define PG_PROC_FN_H
+
+#include "catalog/objectaddress.h"
+#include "nodes/pg_list.h"
+
+extern ObjectAddress ProcedureCreate(const char *procedureName,
+				Oid procNamespace,
+				bool replace,
+				bool returnsSet,
+				Oid returnType,
+				Oid proowner,
+				Oid languageObjectId,
+				Oid languageValidator,
+				const char *prosrc,
+				const char *probin,
+				bool isAgg,
+				bool isWindowFunc,
+				bool security_definer,
+				bool isLeakProof,
+				bool isStrict,
+				char volatility,
+				oidvector *parameterTypes,
+				Datum allParameterTypes,
+				Datum parameterModes,
+				Datum parameterNames,
+				List *parameterDefaults,
+				Datum trftypes,
+				Datum proconfig,
+				float4 procost,
+				float4 prorows);
+
+extern bool function_parse_error_transpose(const char *prosrc);
+
+extern List *oid_array_to_list(Datum datum);
+
+#endif   /* PG_PROC_FN_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_replication_origin.h b/foreign/libpg_query/src/postgres/include/catalog/pg_replication_origin.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_replication_origin.h
@@ -0,0 +1,70 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_replication_origin.h
+ *	  Persistent replication origin registry
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_replication_origin.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_REPLICATION_ORIGIN_H
+#define PG_REPLICATION_ORIGIN_H
+
+#include "catalog/genbki.h"
+#include "access/xlogdefs.h"
+
+/* ----------------
+ *		pg_replication_origin.  cpp turns this into
+ *		typedef struct FormData_pg_replication_origin
+ * ----------------
+ */
+#define ReplicationOriginRelationId 6000
+
+CATALOG(pg_replication_origin,6000) BKI_SHARED_RELATION BKI_WITHOUT_OIDS
+{
+	/*
+	 * Locally known id that get included into WAL.
+	 *
+	 * This should never leave the system.
+	 *
+	 * Needs to fit into an uint16, so we don't waste too much space in WAL
+	 * records. For this reason we don't use a normal Oid column here, since
+	 * we need to handle allocation of new values manually.
+	 */
+	Oid			roident;
+
+	/*
+	 * Variable-length fields start here, but we allow direct access to
+	 * roname.
+	 */
+
+	/* external, free-format, name */
+	text roname BKI_FORCE_NOT_NULL;
+
+#ifdef CATALOG_VARLEN			/* further variable-length fields */
+#endif
+} FormData_pg_replication_origin;
+
+typedef FormData_pg_replication_origin *Form_pg_replication_origin;
+
+/* ----------------
+ *		compiler constants for pg_replication_origin
+ * ----------------
+ */
+#define Natts_pg_replication_origin					2
+#define Anum_pg_replication_origin_roident			1
+#define Anum_pg_replication_origin_roname			2
+
+/* ----------------
+ *		pg_replication_origin has no initial contents
+ * ----------------
+ */
+
+#endif   /* PG_REPLICATION_ORIGIN_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_statistic.h b/foreign/libpg_query/src/postgres/include/catalog/pg_statistic.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_statistic.h
@@ -0,0 +1,293 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_statistic.h
+ *	  definition of the system "statistic" relation (pg_statistic)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_statistic.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_STATISTIC_H
+#define PG_STATISTIC_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_statistic definition.  cpp turns this into
+ *		typedef struct FormData_pg_statistic
+ * ----------------
+ */
+#define StatisticRelationId  2619
+
+CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS
+{
+	/* These fields form the unique key for the entry: */
+	Oid			starelid;		/* relation containing attribute */
+	int16		staattnum;		/* attribute (column) stats are for */
+	bool		stainherit;		/* true if inheritance children are included */
+
+	/* the fraction of the column's entries that are NULL: */
+	float4		stanullfrac;
+
+	/*
+	 * stawidth is the average width in bytes of non-null entries.  For
+	 * fixed-width datatypes this is of course the same as the typlen, but for
+	 * var-width types it is more useful.  Note that this is the average width
+	 * of the data as actually stored, post-TOASTing (eg, for a
+	 * moved-out-of-line value, only the size of the pointer object is
+	 * counted).  This is the appropriate definition for the primary use of
+	 * the statistic, which is to estimate sizes of in-memory hash tables of
+	 * tuples.
+	 */
+	int32		stawidth;
+
+	/* ----------------
+	 * stadistinct indicates the (approximate) number of distinct non-null
+	 * data values in the column.  The interpretation is:
+	 *		0		unknown or not computed
+	 *		> 0		actual number of distinct values
+	 *		< 0		negative of multiplier for number of rows
+	 * The special negative case allows us to cope with columns that are
+	 * unique (stadistinct = -1) or nearly so (for example, a column in
+	 * which values appear about twice on the average could be represented
+	 * by stadistinct = -0.5).  Because the number-of-rows statistic in
+	 * pg_class may be updated more frequently than pg_statistic is, it's
+	 * important to be able to describe such situations as a multiple of
+	 * the number of rows, rather than a fixed number of distinct values.
+	 * But in other cases a fixed number is correct (eg, a boolean column).
+	 * ----------------
+	 */
+	float4		stadistinct;
+
+	/* ----------------
+	 * To allow keeping statistics on different kinds of datatypes,
+	 * we do not hard-wire any particular meaning for the remaining
+	 * statistical fields.  Instead, we provide several "slots" in which
+	 * statistical data can be placed.  Each slot includes:
+	 *		kind			integer code identifying kind of data (see below)
+	 *		op				OID of associated operator, if needed
+	 *		numbers			float4 array (for statistical values)
+	 *		values			anyarray (for representations of data values)
+	 * The ID and operator fields are never NULL; they are zeroes in an
+	 * unused slot.  The numbers and values fields are NULL in an unused
+	 * slot, and might also be NULL in a used slot if the slot kind has
+	 * no need for one or the other.
+	 * ----------------
+	 */
+
+	int16		stakind1;
+	int16		stakind2;
+	int16		stakind3;
+	int16		stakind4;
+	int16		stakind5;
+
+	Oid			staop1;
+	Oid			staop2;
+	Oid			staop3;
+	Oid			staop4;
+	Oid			staop5;
+
+#ifdef CATALOG_VARLEN			/* variable-length fields start here */
+	float4		stanumbers1[1];
+	float4		stanumbers2[1];
+	float4		stanumbers3[1];
+	float4		stanumbers4[1];
+	float4		stanumbers5[1];
+
+	/*
+	 * Values in these arrays are values of the column's data type, or of some
+	 * related type such as an array element type.  We presently have to cheat
+	 * quite a bit to allow polymorphic arrays of this kind, but perhaps
+	 * someday it'll be a less bogus facility.
+	 */
+	anyarray	stavalues1;
+	anyarray	stavalues2;
+	anyarray	stavalues3;
+	anyarray	stavalues4;
+	anyarray	stavalues5;
+#endif
+} FormData_pg_statistic;
+
+#define STATISTIC_NUM_SLOTS  5
+
+
+/* ----------------
+ *		Form_pg_statistic corresponds to a pointer to a tuple with
+ *		the format of pg_statistic relation.
+ * ----------------
+ */
+typedef FormData_pg_statistic *Form_pg_statistic;
+
+/* ----------------
+ *		compiler constants for pg_statistic
+ * ----------------
+ */
+#define Natts_pg_statistic				26
+#define Anum_pg_statistic_starelid		1
+#define Anum_pg_statistic_staattnum		2
+#define Anum_pg_statistic_stainherit	3
+#define Anum_pg_statistic_stanullfrac	4
+#define Anum_pg_statistic_stawidth		5
+#define Anum_pg_statistic_stadistinct	6
+#define Anum_pg_statistic_stakind1		7
+#define Anum_pg_statistic_stakind2		8
+#define Anum_pg_statistic_stakind3		9
+#define Anum_pg_statistic_stakind4		10
+#define Anum_pg_statistic_stakind5		11
+#define Anum_pg_statistic_staop1		12
+#define Anum_pg_statistic_staop2		13
+#define Anum_pg_statistic_staop3		14
+#define Anum_pg_statistic_staop4		15
+#define Anum_pg_statistic_staop5		16
+#define Anum_pg_statistic_stanumbers1	17
+#define Anum_pg_statistic_stanumbers2	18
+#define Anum_pg_statistic_stanumbers3	19
+#define Anum_pg_statistic_stanumbers4	20
+#define Anum_pg_statistic_stanumbers5	21
+#define Anum_pg_statistic_stavalues1	22
+#define Anum_pg_statistic_stavalues2	23
+#define Anum_pg_statistic_stavalues3	24
+#define Anum_pg_statistic_stavalues4	25
+#define Anum_pg_statistic_stavalues5	26
+
+/*
+ * Currently, five statistical slot "kinds" are defined by core PostgreSQL,
+ * as documented below.  Additional "kinds" will probably appear in
+ * future to help cope with non-scalar datatypes.  Also, custom data types
+ * can define their own "kind" codes by mutual agreement between a custom
+ * typanalyze routine and the selectivity estimation functions of the type's
+ * operators.
+ *
+ * Code reading the pg_statistic relation should not assume that a particular
+ * data "kind" will appear in any particular slot.  Instead, search the
+ * stakind fields to see if the desired data is available.  (The standard
+ * function get_attstatsslot() may be used for this.)
+ */
+
+/*
+ * The present allocation of "kind" codes is:
+ *
+ *	1-99:		reserved for assignment by the core PostgreSQL project
+ *				(values in this range will be documented in this file)
+ *	100-199:	reserved for assignment by the PostGIS project
+ *				(values to be documented in PostGIS documentation)
+ *	200-299:	reserved for assignment by the ESRI ST_Geometry project
+ *				(values to be documented in ESRI ST_Geometry documentation)
+ *	300-9999:	reserved for future public assignments
+ *
+ * For private use you may choose a "kind" code at random in the range
+ * 10000-30000.  However, for code that is to be widely disseminated it is
+ * better to obtain a publicly defined "kind" code by request from the
+ * PostgreSQL Global Development Group.
+ */
+
+/*
+ * In a "most common values" slot, staop is the OID of the "=" operator
+ * used to decide whether values are the same or not.  stavalues contains
+ * the K most common non-null values appearing in the column, and stanumbers
+ * contains their frequencies (fractions of total row count).  The values
+ * shall be ordered in decreasing frequency.  Note that since the arrays are
+ * variable-size, K may be chosen by the statistics collector.  Values should
+ * not appear in MCV unless they have been observed to occur more than once;
+ * a unique column will have no MCV slot.
+ */
+#define STATISTIC_KIND_MCV	1
+
+/*
+ * A "histogram" slot describes the distribution of scalar data.  staop is
+ * the OID of the "<" operator that describes the sort ordering.  (In theory,
+ * more than one histogram could appear, if a datatype has more than one
+ * useful sort operator.)  stavalues contains M (>=2) non-null values that
+ * divide the non-null column data values into M-1 bins of approximately equal
+ * population.  The first stavalues item is the MIN and the last is the MAX.
+ * stanumbers is not used and should be NULL.  IMPORTANT POINT: if an MCV
+ * slot is also provided, then the histogram describes the data distribution
+ * *after removing the values listed in MCV* (thus, it's a "compressed
+ * histogram" in the technical parlance).  This allows a more accurate
+ * representation of the distribution of a column with some very-common
+ * values.  In a column with only a few distinct values, it's possible that
+ * the MCV list describes the entire data population; in this case the
+ * histogram reduces to empty and should be omitted.
+ */
+#define STATISTIC_KIND_HISTOGRAM  2
+
+/*
+ * A "correlation" slot describes the correlation between the physical order
+ * of table tuples and the ordering of data values of this column, as seen
+ * by the "<" operator identified by staop.  (As with the histogram, more
+ * than one entry could theoretically appear.)	stavalues is not used and
+ * should be NULL.  stanumbers contains a single entry, the correlation
+ * coefficient between the sequence of data values and the sequence of
+ * their actual tuple positions.  The coefficient ranges from +1 to -1.
+ */
+#define STATISTIC_KIND_CORRELATION	3
+
+/*
+ * A "most common elements" slot is similar to a "most common values" slot,
+ * except that it stores the most common non-null *elements* of the column
+ * values.  This is useful when the column datatype is an array or some other
+ * type with identifiable elements (for instance, tsvector).  staop contains
+ * the equality operator appropriate to the element type.  stavalues contains
+ * the most common element values, and stanumbers their frequencies.  Unlike
+ * MCV slots, frequencies are measured as the fraction of non-null rows the
+ * element value appears in, not the frequency of all rows.  Also unlike
+ * MCV slots, the values are sorted into the element type's default order
+ * (to support binary search for a particular value).  Since this puts the
+ * minimum and maximum frequencies at unpredictable spots in stanumbers,
+ * there are two extra members of stanumbers, holding copies of the minimum
+ * and maximum frequencies.  Optionally, there can be a third extra member,
+ * which holds the frequency of null elements (expressed in the same terms:
+ * the fraction of non-null rows that contain at least one null element).  If
+ * this member is omitted, the column is presumed to contain no null elements.
+ *
+ * Note: in current usage for tsvector columns, the stavalues elements are of
+ * type text, even though their representation within tsvector is not
+ * exactly text.
+ */
+#define STATISTIC_KIND_MCELEM  4
+
+/*
+ * A "distinct elements count histogram" slot describes the distribution of
+ * the number of distinct element values present in each row of an array-type
+ * column.  Only non-null rows are considered, and only non-null elements.
+ * staop contains the equality operator appropriate to the element type.
+ * stavalues is not used and should be NULL.  The last member of stanumbers is
+ * the average count of distinct element values over all non-null rows.  The
+ * preceding M (>=2) members form a histogram that divides the population of
+ * distinct-elements counts into M-1 bins of approximately equal population.
+ * The first of these is the minimum observed count, and the last the maximum.
+ */
+#define STATISTIC_KIND_DECHIST	5
+
+/*
+ * A "length histogram" slot describes the distribution of range lengths in
+ * rows of a range-type column. stanumbers contains a single entry, the
+ * fraction of empty ranges. stavalues is a histogram of non-empty lengths, in
+ * a format similar to STATISTIC_KIND_HISTOGRAM: it contains M (>=2) range
+ * values that divide the column data values into M-1 bins of approximately
+ * equal population. The lengths are stores as float8s, as measured by the
+ * range type's subdiff function. Only non-null rows are considered.
+ */
+#define STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM  6
+
+/*
+ * A "bounds histogram" slot is similar to STATISTIC_KIND_HISTOGRAM, but for
+ * a range-type column.  stavalues contains M (>=2) range values that divide
+ * the column data values into M-1 bins of approximately equal population.
+ * Unlike a regular scalar histogram, this is actually two histograms combined
+ * into a single array, with the lower bounds of each value forming a
+ * histogram of lower bounds, and the upper bounds a histogram of upper
+ * bounds.  Only non-NULL, non-empty ranges are included.
+ */
+#define STATISTIC_KIND_BOUNDS_HISTOGRAM  7
+
+#endif   /* PG_STATISTIC_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_transform.h b/foreign/libpg_query/src/postgres/include/catalog/pg_transform.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_transform.h
@@ -0,0 +1,47 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_transform.h
+ *
+ * Copyright (c) 2012-2015, PostgreSQL Global Development Group
+ *
+ * src/include/catalog/pg_transform.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_TRANSFORM_H
+#define PG_TRANSFORM_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_transform definition.  cpp turns this into
+ *		typedef struct FormData_pg_transform
+ * ----------------
+ */
+#define TransformRelationId 3576
+
+CATALOG(pg_transform,3576)
+{
+	Oid			trftype;
+	Oid			trflang;
+	regproc		trffromsql;
+	regproc		trftosql;
+} FormData_pg_transform;
+
+typedef FormData_pg_transform *Form_pg_transform;
+
+/* ----------------
+ *		compiler constants for pg_transform
+ * ----------------
+ */
+#define Natts_pg_transform			4
+#define Anum_pg_transform_trftype	1
+#define Anum_pg_transform_trflang	2
+#define Anum_pg_transform_trffromsql	3
+#define Anum_pg_transform_trftosql	4
+
+#endif   /* PG_TRANSFORM_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_trigger.h b/foreign/libpg_query/src/postgres/include/catalog/pg_trigger.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_trigger.h
@@ -0,0 +1,145 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_trigger.h
+ *	  definition of the system "trigger" relation (pg_trigger)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_trigger.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_TRIGGER_H
+#define PG_TRIGGER_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_trigger definition.  cpp turns this into
+ *		typedef struct FormData_pg_trigger
+ *
+ * Note: when tgconstraint is nonzero, tgconstrrelid, tgconstrindid,
+ * tgdeferrable, and tginitdeferred are largely redundant with the referenced
+ * pg_constraint entry.  However, it is possible for a non-deferrable trigger
+ * to be associated with a deferrable constraint.
+ * ----------------
+ */
+#define TriggerRelationId  2620
+
+CATALOG(pg_trigger,2620)
+{
+	Oid			tgrelid;		/* relation trigger is attached to */
+	NameData	tgname;			/* trigger's name */
+	Oid			tgfoid;			/* OID of function to be called */
+	int16		tgtype;			/* BEFORE/AFTER/INSTEAD, UPDATE/DELETE/INSERT,
+								 * ROW/STATEMENT; see below */
+	char		tgenabled;		/* trigger's firing configuration WRT
+								 * session_replication_role */
+	bool		tgisinternal;	/* trigger is system-generated */
+	Oid			tgconstrrelid;	/* constraint's FROM table, if any */
+	Oid			tgconstrindid;	/* constraint's supporting index, if any */
+	Oid			tgconstraint;	/* associated pg_constraint entry, if any */
+	bool		tgdeferrable;	/* constraint trigger is deferrable */
+	bool		tginitdeferred; /* constraint trigger is deferred initially */
+	int16		tgnargs;		/* # of extra arguments in tgargs */
+
+	/*
+	 * Variable-length fields start here, but we allow direct access to
+	 * tgattr. Note: tgattr and tgargs must not be null.
+	 */
+	int2vector	tgattr;			/* column numbers, if trigger is on columns */
+
+#ifdef CATALOG_VARLEN
+	bytea tgargs BKI_FORCE_NOT_NULL;	/* first\000second\000tgnargs\000 */
+	pg_node_tree tgqual;		/* WHEN expression, or NULL if none */
+#endif
+} FormData_pg_trigger;
+
+/* ----------------
+ *		Form_pg_trigger corresponds to a pointer to a tuple with
+ *		the format of pg_trigger relation.
+ * ----------------
+ */
+typedef FormData_pg_trigger *Form_pg_trigger;
+
+/* ----------------
+ *		compiler constants for pg_trigger
+ * ----------------
+ */
+#define Natts_pg_trigger				15
+#define Anum_pg_trigger_tgrelid			1
+#define Anum_pg_trigger_tgname			2
+#define Anum_pg_trigger_tgfoid			3
+#define Anum_pg_trigger_tgtype			4
+#define Anum_pg_trigger_tgenabled		5
+#define Anum_pg_trigger_tgisinternal	6
+#define Anum_pg_trigger_tgconstrrelid	7
+#define Anum_pg_trigger_tgconstrindid	8
+#define Anum_pg_trigger_tgconstraint	9
+#define Anum_pg_trigger_tgdeferrable	10
+#define Anum_pg_trigger_tginitdeferred	11
+#define Anum_pg_trigger_tgnargs			12
+#define Anum_pg_trigger_tgattr			13
+#define Anum_pg_trigger_tgargs			14
+#define Anum_pg_trigger_tgqual			15
+
+/* Bits within tgtype */
+#define TRIGGER_TYPE_ROW				(1 << 0)
+#define TRIGGER_TYPE_BEFORE				(1 << 1)
+#define TRIGGER_TYPE_INSERT				(1 << 2)
+#define TRIGGER_TYPE_DELETE				(1 << 3)
+#define TRIGGER_TYPE_UPDATE				(1 << 4)
+#define TRIGGER_TYPE_TRUNCATE			(1 << 5)
+#define TRIGGER_TYPE_INSTEAD			(1 << 6)
+
+#define TRIGGER_TYPE_LEVEL_MASK			(TRIGGER_TYPE_ROW)
+#define TRIGGER_TYPE_STATEMENT			0
+
+/* Note bits within TRIGGER_TYPE_TIMING_MASK aren't adjacent */
+#define TRIGGER_TYPE_TIMING_MASK \
+	(TRIGGER_TYPE_BEFORE | TRIGGER_TYPE_INSTEAD)
+#define TRIGGER_TYPE_AFTER				0
+
+#define TRIGGER_TYPE_EVENT_MASK \
+	(TRIGGER_TYPE_INSERT | TRIGGER_TYPE_DELETE | TRIGGER_TYPE_UPDATE | TRIGGER_TYPE_TRUNCATE)
+
+/* Macros for manipulating tgtype */
+#define TRIGGER_CLEAR_TYPE(type)		((type) = 0)
+
+#define TRIGGER_SETT_ROW(type)			((type) |= TRIGGER_TYPE_ROW)
+#define TRIGGER_SETT_STATEMENT(type)	((type) |= TRIGGER_TYPE_STATEMENT)
+#define TRIGGER_SETT_BEFORE(type)		((type) |= TRIGGER_TYPE_BEFORE)
+#define TRIGGER_SETT_AFTER(type)		((type) |= TRIGGER_TYPE_AFTER)
+#define TRIGGER_SETT_INSTEAD(type)		((type) |= TRIGGER_TYPE_INSTEAD)
+#define TRIGGER_SETT_INSERT(type)		((type) |= TRIGGER_TYPE_INSERT)
+#define TRIGGER_SETT_DELETE(type)		((type) |= TRIGGER_TYPE_DELETE)
+#define TRIGGER_SETT_UPDATE(type)		((type) |= TRIGGER_TYPE_UPDATE)
+#define TRIGGER_SETT_TRUNCATE(type)		((type) |= TRIGGER_TYPE_TRUNCATE)
+
+#define TRIGGER_FOR_ROW(type)			((type) & TRIGGER_TYPE_ROW)
+#define TRIGGER_FOR_BEFORE(type)		(((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_BEFORE)
+#define TRIGGER_FOR_AFTER(type)			(((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_AFTER)
+#define TRIGGER_FOR_INSTEAD(type)		(((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_INSTEAD)
+#define TRIGGER_FOR_INSERT(type)		((type) & TRIGGER_TYPE_INSERT)
+#define TRIGGER_FOR_DELETE(type)		((type) & TRIGGER_TYPE_DELETE)
+#define TRIGGER_FOR_UPDATE(type)		((type) & TRIGGER_TYPE_UPDATE)
+#define TRIGGER_FOR_TRUNCATE(type)		((type) & TRIGGER_TYPE_TRUNCATE)
+
+/*
+ * Efficient macro for checking if tgtype matches a particular level
+ * (TRIGGER_TYPE_ROW or TRIGGER_TYPE_STATEMENT), timing (TRIGGER_TYPE_BEFORE,
+ * TRIGGER_TYPE_AFTER or TRIGGER_TYPE_INSTEAD), and event (TRIGGER_TYPE_INSERT,
+ * TRIGGER_TYPE_DELETE, TRIGGER_TYPE_UPDATE, or TRIGGER_TYPE_TRUNCATE).  Note
+ * that a tgtype can match more than one event, but only one level or timing.
+ */
+#define TRIGGER_TYPE_MATCHES(type, level, timing, event) \
+	(((type) & (TRIGGER_TYPE_LEVEL_MASK | TRIGGER_TYPE_TIMING_MASK | (event))) == ((level) | (timing) | (event)))
+
+#endif   /* PG_TRIGGER_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_ts_config.h b/foreign/libpg_query/src/postgres/include/catalog/pg_ts_config.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_ts_config.h
@@ -0,0 +1,60 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_ts_config.h
+ *	definition of configuration of tsearch
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_ts_config.h
+ *
+ * NOTES
+ *		the genbki.pl script reads this file and generates .bki
+ *		information from the DATA() statements.
+ *
+ *		XXX do NOT break up DATA() statements into multiple lines!
+ *			the scripts are not as smart as you might think...
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_TS_CONFIG_H
+#define PG_TS_CONFIG_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_ts_config definition.  cpp turns this into
+ *		typedef struct FormData_pg_ts_config
+ * ----------------
+ */
+#define TSConfigRelationId	3602
+
+CATALOG(pg_ts_config,3602)
+{
+	NameData	cfgname;		/* name of configuration */
+	Oid			cfgnamespace;	/* name space */
+	Oid			cfgowner;		/* owner */
+	Oid			cfgparser;		/* OID of parser (in pg_ts_parser) */
+} FormData_pg_ts_config;
+
+typedef FormData_pg_ts_config *Form_pg_ts_config;
+
+/* ----------------
+ *		compiler constants for pg_ts_config
+ * ----------------
+ */
+#define Natts_pg_ts_config				4
+#define Anum_pg_ts_config_cfgname		1
+#define Anum_pg_ts_config_cfgnamespace	2
+#define Anum_pg_ts_config_cfgowner		3
+#define Anum_pg_ts_config_cfgparser		4
+
+/* ----------------
+ *		initial contents of pg_ts_config
+ * ----------------
+ */
+DATA(insert OID = 3748 ( "simple" PGNSP PGUID 3722 ));
+DESCR("simple configuration");
+
+#endif   /* PG_TS_CONFIG_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_ts_dict.h b/foreign/libpg_query/src/postgres/include/catalog/pg_ts_dict.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_ts_dict.h
@@ -0,0 +1,66 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_ts_dict.h
+ *	definition of dictionaries for tsearch
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_ts_dict.h
+ *
+ * NOTES
+ *		the genbki.pl script reads this file and generates .bki
+ *		information from the DATA() statements.
+ *
+ *		XXX do NOT break up DATA() statements into multiple lines!
+ *			the scripts are not as smart as you might think...
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_TS_DICT_H
+#define PG_TS_DICT_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_ts_dict definition.  cpp turns this into
+ *		typedef struct FormData_pg_ts_dict
+ * ----------------
+ */
+#define TSDictionaryRelationId	3600
+
+CATALOG(pg_ts_dict,3600)
+{
+	NameData	dictname;		/* dictionary name */
+	Oid			dictnamespace;	/* name space */
+	Oid			dictowner;		/* owner */
+	Oid			dicttemplate;	/* dictionary's template */
+
+#ifdef CATALOG_VARLEN			/* variable-length fields start here */
+	text		dictinitoption; /* options passed to dict_init() */
+#endif
+} FormData_pg_ts_dict;
+
+typedef FormData_pg_ts_dict *Form_pg_ts_dict;
+
+/* ----------------
+ *		compiler constants for pg_ts_dict
+ * ----------------
+ */
+#define Natts_pg_ts_dict				5
+#define Anum_pg_ts_dict_dictname		1
+#define Anum_pg_ts_dict_dictnamespace	2
+#define Anum_pg_ts_dict_dictowner		3
+#define Anum_pg_ts_dict_dicttemplate	4
+#define Anum_pg_ts_dict_dictinitoption	5
+
+/* ----------------
+ *		initial contents of pg_ts_dict
+ * ----------------
+ */
+
+DATA(insert OID = 3765 ( "simple" PGNSP PGUID 3727 _null_));
+DESCR("simple dictionary: just lower case and check for stopword");
+
+#endif   /* PG_TS_DICT_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_ts_parser.h b/foreign/libpg_query/src/postgres/include/catalog/pg_ts_parser.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_ts_parser.h
@@ -0,0 +1,67 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_ts_parser.h
+ *	definition of parsers for tsearch
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_ts_parser.h
+ *
+ * NOTES
+ *		the genbki.pl script reads this file and generates .bki
+ *		information from the DATA() statements.
+ *
+ *		XXX do NOT break up DATA() statements into multiple lines!
+ *			the scripts are not as smart as you might think...
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_TS_PARSER_H
+#define PG_TS_PARSER_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_ts_parser definition.  cpp turns this into
+ *		typedef struct FormData_pg_ts_parser
+ * ----------------
+ */
+#define TSParserRelationId	3601
+
+CATALOG(pg_ts_parser,3601)
+{
+	NameData	prsname;		/* parser's name */
+	Oid			prsnamespace;	/* name space */
+	regproc		prsstart;		/* init parsing session */
+	regproc		prstoken;		/* return next token */
+	regproc		prsend;			/* finalize parsing session */
+	regproc		prsheadline;	/* return data for headline creation */
+	regproc		prslextype;		/* return descriptions of lexeme's types */
+} FormData_pg_ts_parser;
+
+typedef FormData_pg_ts_parser *Form_pg_ts_parser;
+
+/* ----------------
+ *		compiler constants for pg_ts_parser
+ * ----------------
+ */
+#define Natts_pg_ts_parser					7
+#define Anum_pg_ts_parser_prsname			1
+#define Anum_pg_ts_parser_prsnamespace		2
+#define Anum_pg_ts_parser_prsstart			3
+#define Anum_pg_ts_parser_prstoken			4
+#define Anum_pg_ts_parser_prsend			5
+#define Anum_pg_ts_parser_prsheadline		6
+#define Anum_pg_ts_parser_prslextype		7
+
+/* ----------------
+ *		initial contents of pg_ts_parser
+ * ----------------
+ */
+
+DATA(insert OID = 3722 ( "default" PGNSP prsd_start prsd_nexttoken prsd_end prsd_headline prsd_lextype ));
+DESCR("default word parser");
+
+#endif   /* PG_TS_PARSER_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_ts_template.h b/foreign/libpg_query/src/postgres/include/catalog/pg_ts_template.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_ts_template.h
@@ -0,0 +1,67 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_ts_template.h
+ *	definition of dictionary templates for tsearch
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_ts_template.h
+ *
+ * NOTES
+ *		the genbki.pl script reads this file and generates .bki
+ *		information from the DATA() statements.
+ *
+ *		XXX do NOT break up DATA() statements into multiple lines!
+ *			the scripts are not as smart as you might think...
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_TS_TEMPLATE_H
+#define PG_TS_TEMPLATE_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_ts_template definition.  cpp turns this into
+ *		typedef struct FormData_pg_ts_template
+ * ----------------
+ */
+#define TSTemplateRelationId	3764
+
+CATALOG(pg_ts_template,3764)
+{
+	NameData	tmplname;		/* template name */
+	Oid			tmplnamespace;	/* name space */
+	regproc		tmplinit;		/* initialization method of dict (may be 0) */
+	regproc		tmpllexize;		/* base method of dictionary */
+} FormData_pg_ts_template;
+
+typedef FormData_pg_ts_template *Form_pg_ts_template;
+
+/* ----------------
+ *		compiler constants for pg_ts_template
+ * ----------------
+ */
+#define Natts_pg_ts_template				4
+#define Anum_pg_ts_template_tmplname		1
+#define Anum_pg_ts_template_tmplnamespace	2
+#define Anum_pg_ts_template_tmplinit		3
+#define Anum_pg_ts_template_tmpllexize		4
+
+/* ----------------
+ *		initial contents of pg_ts_template
+ * ----------------
+ */
+
+DATA(insert OID = 3727 ( "simple" PGNSP dsimple_init dsimple_lexize ));
+DESCR("simple dictionary: just lower case and check for stopword");
+DATA(insert OID = 3730 ( "synonym" PGNSP dsynonym_init dsynonym_lexize ));
+DESCR("synonym dictionary: replace word by its synonym");
+DATA(insert OID = 3733 ( "ispell" PGNSP dispell_init dispell_lexize ));
+DESCR("ispell dictionary");
+DATA(insert OID = 3742 ( "thesaurus" PGNSP thesaurus_init thesaurus_lexize ));
+DESCR("thesaurus dictionary: phrase by phrase substitution");
+
+#endif   /* PG_TS_TEMPLATE_H */
diff --git a/foreign/libpg_query/src/postgres/include/catalog/pg_type.h b/foreign/libpg_query/src/postgres/include/catalog/pg_type.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/catalog/pg_type.h
@@ -0,0 +1,738 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_type.h
+ *	  definition of the system "type" relation (pg_type)
+ *	  along with the relation's initial contents.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_type.h
+ *
+ * NOTES
+ *	  the genbki.pl script reads this file and generates .bki
+ *	  information from the DATA() statements.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_TYPE_H
+#define PG_TYPE_H
+
+#include "catalog/genbki.h"
+
+/* ----------------
+ *		pg_type definition.  cpp turns this into
+ *		typedef struct FormData_pg_type
+ *
+ *		Some of the values in a pg_type instance are copied into
+ *		pg_attribute instances.  Some parts of Postgres use the pg_type copy,
+ *		while others use the pg_attribute copy, so they must match.
+ *		See struct FormData_pg_attribute for details.
+ * ----------------
+ */
+#define TypeRelationId	1247
+#define TypeRelation_Rowtype_Id  71
+
+CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO
+{
+	NameData	typname;		/* type name */
+	Oid			typnamespace;	/* OID of namespace containing this type */
+	Oid			typowner;		/* type owner */
+
+	/*
+	 * For a fixed-size type, typlen is the number of bytes we use to
+	 * represent a value of this type, e.g. 4 for an int4.  But for a
+	 * variable-length type, typlen is negative.  We use -1 to indicate a
+	 * "varlena" type (one that has a length word), -2 to indicate a
+	 * null-terminated C string.
+	 */
+	int16		typlen;
+
+	/*
+	 * typbyval determines whether internal Postgres routines pass a value of
+	 * this type by value or by reference.  typbyval had better be FALSE if
+	 * the length is not 1, 2, or 4 (or 8 on 8-byte-Datum machines).
+	 * Variable-length types are always passed by reference. Note that
+	 * typbyval can be false even if the length would allow pass-by-value;
+	 * this is currently true for type float4, for example.
+	 */
+	bool		typbyval;
+
+	/*
+	 * typtype is 'b' for a base type, 'c' for a composite type (e.g., a
+	 * table's rowtype), 'd' for a domain, 'e' for an enum type, 'p' for a
+	 * pseudo-type, or 'r' for a range type. (Use the TYPTYPE macros below.)
+	 *
+	 * If typtype is 'c', typrelid is the OID of the class' entry in pg_class.
+	 */
+	char		typtype;
+
+	/*
+	 * typcategory and typispreferred help the parser distinguish preferred
+	 * and non-preferred coercions.  The category can be any single ASCII
+	 * character (but not \0).  The categories used for built-in types are
+	 * identified by the TYPCATEGORY macros below.
+	 */
+	char		typcategory;	/* arbitrary type classification */
+
+	bool		typispreferred; /* is type "preferred" within its category? */
+
+	/*
+	 * If typisdefined is false, the entry is only a placeholder (forward
+	 * reference).  We know the type name, but not yet anything else about it.
+	 */
+	bool		typisdefined;
+
+	char		typdelim;		/* delimiter for arrays of this type */
+
+	Oid			typrelid;		/* 0 if not a composite type */
+
+	/*
+	 * If typelem is not 0 then it identifies another row in pg_type. The
+	 * current type can then be subscripted like an array yielding values of
+	 * type typelem. A non-zero typelem does not guarantee this type to be a
+	 * "real" array type; some ordinary fixed-length types can also be
+	 * subscripted (e.g., name, point). Variable-length types can *not* be
+	 * turned into pseudo-arrays like that. Hence, the way to determine
+	 * whether a type is a "true" array type is if:
+	 *
+	 * typelem != 0 and typlen == -1.
+	 */
+	Oid			typelem;
+
+	/*
+	 * If there is a "true" array type having this type as element type,
+	 * typarray links to it.  Zero if no associated "true" array type.
+	 */
+	Oid			typarray;
+
+	/*
+	 * I/O conversion procedures for the datatype.
+	 */
+	regproc		typinput;		/* text format (required) */
+	regproc		typoutput;
+	regproc		typreceive;		/* binary format (optional) */
+	regproc		typsend;
+
+	/*
+	 * I/O functions for optional type modifiers.
+	 */
+	regproc		typmodin;
+	regproc		typmodout;
+
+	/*
+	 * Custom ANALYZE procedure for the datatype (0 selects the default).
+	 */
+	regproc		typanalyze;
+
+	/* ----------------
+	 * typalign is the alignment required when storing a value of this
+	 * type.  It applies to storage on disk as well as most
+	 * representations of the value inside Postgres.  When multiple values
+	 * are stored consecutively, such as in the representation of a
+	 * complete row on disk, padding is inserted before a datum of this
+	 * type so that it begins on the specified boundary.  The alignment
+	 * reference is the beginning of the first datum in the sequence.
+	 *
+	 * 'c' = CHAR alignment, ie no alignment needed.
+	 * 's' = SHORT alignment (2 bytes on most machines).
+	 * 'i' = INT alignment (4 bytes on most machines).
+	 * 'd' = DOUBLE alignment (8 bytes on many machines, but by no means all).
+	 *
+	 * See include/access/tupmacs.h for the macros that compute these
+	 * alignment requirements.  Note also that we allow the nominal alignment
+	 * to be violated when storing "packed" varlenas; the TOAST mechanism
+	 * takes care of hiding that from most code.
+	 *
+	 * NOTE: for types used in system tables, it is critical that the
+	 * size and alignment defined in pg_type agree with the way that the
+	 * compiler will lay out the field in a struct representing a table row.
+	 * ----------------
+	 */
+	char		typalign;
+
+	/* ----------------
+	 * typstorage tells if the type is prepared for toasting and what
+	 * the default strategy for attributes of this type should be.
+	 *
+	 * 'p' PLAIN	  type not prepared for toasting
+	 * 'e' EXTERNAL   external storage possible, don't try to compress
+	 * 'x' EXTENDED   try to compress and store external if required
+	 * 'm' MAIN		  like 'x' but try to keep in main tuple
+	 * ----------------
+	 */
+	char		typstorage;
+
+	/*
+	 * This flag represents a "NOT NULL" constraint against this datatype.
+	 *
+	 * If true, the attnotnull column for a corresponding table column using
+	 * this datatype will always enforce the NOT NULL constraint.
+	 *
+	 * Used primarily for domain types.
+	 */
+	bool		typnotnull;
+
+	/*
+	 * Domains use typbasetype to show the base (or domain) type that the
+	 * domain is based on.  Zero if the type is not a domain.
+	 */
+	Oid			typbasetype;
+
+	/*
+	 * Domains use typtypmod to record the typmod to be applied to their base
+	 * type (-1 if base type does not use a typmod).  -1 if this type is not a
+	 * domain.
+	 */
+	int32		typtypmod;
+
+	/*
+	 * typndims is the declared number of dimensions for an array domain type
+	 * (i.e., typbasetype is an array type).  Otherwise zero.
+	 */
+	int32		typndims;
+
+	/*
+	 * Collation: 0 if type cannot use collations, DEFAULT_COLLATION_OID for
+	 * collatable base types, possibly other OID for domains
+	 */
+	Oid			typcollation;
+
+#ifdef CATALOG_VARLEN			/* variable-length fields start here */
+
+	/*
+	 * If typdefaultbin is not NULL, it is the nodeToString representation of
+	 * a default expression for the type.  Currently this is only used for
+	 * domains.
+	 */
+	pg_node_tree typdefaultbin;
+
+	/*
+	 * typdefault is NULL if the type has no associated default value. If
+	 * typdefaultbin is not NULL, typdefault must contain a human-readable
+	 * version of the default expression represented by typdefaultbin. If
+	 * typdefaultbin is NULL and typdefault is not, then typdefault is the
+	 * external representation of the type's default value, which may be fed
+	 * to the type's input converter to produce a constant.
+	 */
+	text		typdefault;
+
+	/*
+	 * Access permissions
+	 */
+	aclitem		typacl[1];
+#endif
+} FormData_pg_type;
+
+/* ----------------
+ *		Form_pg_type corresponds to a pointer to a row with
+ *		the format of pg_type relation.
+ * ----------------
+ */
+typedef FormData_pg_type *Form_pg_type;
+
+/* ----------------
+ *		compiler constants for pg_type
+ * ----------------
+ */
+#define Natts_pg_type					30
+#define Anum_pg_type_typname			1
+#define Anum_pg_type_typnamespace		2
+#define Anum_pg_type_typowner			3
+#define Anum_pg_type_typlen				4
+#define Anum_pg_type_typbyval			5
+#define Anum_pg_type_typtype			6
+#define Anum_pg_type_typcategory		7
+#define Anum_pg_type_typispreferred		8
+#define Anum_pg_type_typisdefined		9
+#define Anum_pg_type_typdelim			10
+#define Anum_pg_type_typrelid			11
+#define Anum_pg_type_typelem			12
+#define Anum_pg_type_typarray			13
+#define Anum_pg_type_typinput			14
+#define Anum_pg_type_typoutput			15
+#define Anum_pg_type_typreceive			16
+#define Anum_pg_type_typsend			17
+#define Anum_pg_type_typmodin			18
+#define Anum_pg_type_typmodout			19
+#define Anum_pg_type_typanalyze			20
+#define Anum_pg_type_typalign			21
+#define Anum_pg_type_typstorage			22
+#define Anum_pg_type_typnotnull			23
+#define Anum_pg_type_typbasetype		24
+#define Anum_pg_type_typtypmod			25
+#define Anum_pg_type_typndims			26
+#define Anum_pg_type_typcollation		27
+#define Anum_pg_type_typdefaultbin		28
+#define Anum_pg_type_typdefault			29
+#define Anum_pg_type_typacl				30
+
+
+/* ----------------
+ *		initial contents of pg_type
+ * ----------------
+ */
+
+/*
+ * Keep the following ordered by OID so that later changes can be made more
+ * easily.
+ *
+ * For types used in the system catalogs, make sure the values here match
+ * TypInfo[] in bootstrap.c.
+ */
+
+/* OIDS 1 - 99 */
+DATA(insert OID = 16 (	bool	   PGNSP PGUID	1 t b B t t \054 0	 0 1000 boolin boolout boolrecv boolsend - - - c p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("boolean, 'true'/'false'");
+#define BOOLOID			16
+
+DATA(insert OID = 17 (	bytea	   PGNSP PGUID -1 f b U f t \054 0	0 1001 byteain byteaout bytearecv byteasend - - - i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("variable-length string, binary values escaped");
+#define BYTEAOID		17
+
+DATA(insert OID = 18 (	char	   PGNSP PGUID	1 t b S f t \054 0	 0 1002 charin charout charrecv charsend - - - c p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("single character");
+#define CHAROID			18
+
+DATA(insert OID = 19 (	name	   PGNSP PGUID NAMEDATALEN f b S f t \054 0 18 1003 namein nameout namerecv namesend - - - c p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("63-byte type for storing system identifiers");
+#define NAMEOID			19
+
+DATA(insert OID = 20 (	int8	   PGNSP PGUID	8 FLOAT8PASSBYVAL b N f t \054 0	 0 1016 int8in int8out int8recv int8send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("~18 digit integer, 8-byte storage");
+#define INT8OID			20
+
+DATA(insert OID = 21 (	int2	   PGNSP PGUID	2 t b N f t \054 0	 0 1005 int2in int2out int2recv int2send - - - s p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("-32 thousand to 32 thousand, 2-byte storage");
+#define INT2OID			21
+
+DATA(insert OID = 22 (	int2vector PGNSP PGUID -1 f b A f t \054 0	21 1006 int2vectorin int2vectorout int2vectorrecv int2vectorsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("array of int2, used in system tables");
+#define INT2VECTOROID	22
+
+DATA(insert OID = 23 (	int4	   PGNSP PGUID	4 t b N f t \054 0	 0 1007 int4in int4out int4recv int4send - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("-2 billion to 2 billion integer, 4-byte storage");
+#define INT4OID			23
+
+DATA(insert OID = 24 (	regproc    PGNSP PGUID	4 t b N f t \054 0	 0 1008 regprocin regprocout regprocrecv regprocsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("registered procedure");
+#define REGPROCOID		24
+
+DATA(insert OID = 25 (	text	   PGNSP PGUID -1 f b S t t \054 0	0 1009 textin textout textrecv textsend - - - i x f 0 -1 0 100 _null_ _null_ _null_ ));
+DESCR("variable-length string, no limit specified");
+#define TEXTOID			25
+
+DATA(insert OID = 26 (	oid		   PGNSP PGUID	4 t b N t t \054 0	 0 1028 oidin oidout oidrecv oidsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("object identifier(oid), maximum 4 billion");
+#define OIDOID			26
+
+DATA(insert OID = 27 (	tid		   PGNSP PGUID	6 f b U f t \054 0	 0 1010 tidin tidout tidrecv tidsend - - - s p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("(block, offset), physical location of tuple");
+#define TIDOID		27
+
+DATA(insert OID = 28 (	xid		   PGNSP PGUID	4 t b U f t \054 0	 0 1011 xidin xidout xidrecv xidsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("transaction id");
+#define XIDOID 28
+
+DATA(insert OID = 29 (	cid		   PGNSP PGUID	4 t b U f t \054 0	 0 1012 cidin cidout cidrecv cidsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("command identifier type, sequence in transaction id");
+#define CIDOID 29
+
+DATA(insert OID = 30 (	oidvector  PGNSP PGUID -1 f b A f t \054 0	26 1013 oidvectorin oidvectorout oidvectorrecv oidvectorsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("array of oids, used in system tables");
+#define OIDVECTOROID	30
+
+/* hand-built rowtype entries for bootstrapped catalogs */
+/* NB: OIDs assigned here must match the BKI_ROWTYPE_OID declarations */
+
+DATA(insert OID = 71 (	pg_type			PGNSP PGUID -1 f c C f t \054 1247 0 0 record_in record_out record_recv record_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 75 (	pg_attribute	PGNSP PGUID -1 f c C f t \054 1249 0 0 record_in record_out record_recv record_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 81 (	pg_proc			PGNSP PGUID -1 f c C f t \054 1255 0 0 record_in record_out record_recv record_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 83 (	pg_class		PGNSP PGUID -1 f c C f t \054 1259 0 0 record_in record_out record_recv record_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
+
+/* OIDS 100 - 199 */
+DATA(insert OID = 114 ( json		   PGNSP PGUID -1 f b U f t \054 0 0 199 json_in json_out json_recv json_send - - - i x f 0 -1 0 0 _null_ _null_ _null_ ));
+#define JSONOID 114
+DATA(insert OID = 142 ( xml		   PGNSP PGUID -1 f b U f t \054 0 0 143 xml_in xml_out xml_recv xml_send - - - i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("XML content");
+#define XMLOID 142
+DATA(insert OID = 143 ( _xml	   PGNSP PGUID -1 f b A f t \054 0 142 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 199 ( _json	   PGNSP PGUID -1 f b A f t \054 0 114 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+
+DATA(insert OID = 194 ( pg_node_tree	PGNSP PGUID -1 f b S f t \054 0 0 0 pg_node_tree_in pg_node_tree_out pg_node_tree_recv pg_node_tree_send - - - i x f 0 -1 0 100 _null_ _null_ _null_ ));
+DESCR("string representing an internal node tree");
+#define PGNODETREEOID	194
+
+DATA(insert OID = 32 ( pg_ddl_command	PGNSP PGUID SIZEOF_POINTER t p P f t \054 0 0 0 pg_ddl_command_in pg_ddl_command_out pg_ddl_command_recv pg_ddl_command_send - - - ALIGNOF_POINTER p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("internal type for passing CollectedCommand");
+#define PGDDLCOMMANDOID 32
+
+/* OIDS 200 - 299 */
+
+DATA(insert OID = 210 (  smgr	   PGNSP PGUID 2 t b U f t \054 0 0 0 smgrin smgrout - - - - - s p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("storage manager");
+
+/* OIDS 300 - 399 */
+
+/* OIDS 400 - 499 */
+
+/* OIDS 500 - 599 */
+
+/* OIDS 600 - 699 */
+DATA(insert OID = 600 (  point	   PGNSP PGUID 16 f b G f t \054 0 701 1017 point_in point_out point_recv point_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("geometric point '(x, y)'");
+#define POINTOID		600
+DATA(insert OID = 601 (  lseg	   PGNSP PGUID 32 f b G f t \054 0 600 1018 lseg_in lseg_out lseg_recv lseg_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("geometric line segment '(pt1,pt2)'");
+#define LSEGOID			601
+DATA(insert OID = 602 (  path	   PGNSP PGUID -1 f b G f t \054 0 0 1019 path_in path_out path_recv path_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("geometric path '(pt1,...)'");
+#define PATHOID			602
+DATA(insert OID = 603 (  box	   PGNSP PGUID 32 f b G f t \073 0 600 1020 box_in box_out box_recv box_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("geometric box '(lower left,upper right)'");
+#define BOXOID			603
+DATA(insert OID = 604 (  polygon   PGNSP PGUID -1 f b G f t \054 0	 0 1027 poly_in poly_out poly_recv poly_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("geometric polygon '(pt1,...)'");
+#define POLYGONOID		604
+
+DATA(insert OID = 628 (  line	   PGNSP PGUID 24 f b G f t \054 0 701 629 line_in line_out line_recv line_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("geometric line");
+#define LINEOID			628
+DATA(insert OID = 629 (  _line	   PGNSP PGUID	-1 f b A f t \054 0 628 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+
+/* OIDS 700 - 799 */
+
+DATA(insert OID = 700 (  float4    PGNSP PGUID	4 FLOAT4PASSBYVAL b N f t \054 0	 0 1021 float4in float4out float4recv float4send - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("single-precision floating point number, 4-byte storage");
+#define FLOAT4OID 700
+DATA(insert OID = 701 (  float8    PGNSP PGUID	8 FLOAT8PASSBYVAL b N t t \054 0	 0 1022 float8in float8out float8recv float8send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("double-precision floating point number, 8-byte storage");
+#define FLOAT8OID 701
+DATA(insert OID = 702 (  abstime   PGNSP PGUID	4 t b D f t \054 0	 0 1023 abstimein abstimeout abstimerecv abstimesend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("absolute, limited-range date and time (Unix system time)");
+#define ABSTIMEOID		702
+DATA(insert OID = 703 (  reltime   PGNSP PGUID	4 t b T f t \054 0	 0 1024 reltimein reltimeout reltimerecv reltimesend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("relative, limited-range time interval (Unix delta time)");
+#define RELTIMEOID		703
+DATA(insert OID = 704 (  tinterval PGNSP PGUID 12 f b T f t \054 0	 0 1025 tintervalin tintervalout tintervalrecv tintervalsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("(abstime,abstime), time interval");
+#define TINTERVALOID	704
+DATA(insert OID = 705 (  unknown   PGNSP PGUID -2 f b X f t \054 0	 0 0 unknownin unknownout unknownrecv unknownsend - - - c p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("");
+#define UNKNOWNOID		705
+
+DATA(insert OID = 718 (  circle    PGNSP PGUID	24 f b G f t \054 0 0 719 circle_in circle_out circle_recv circle_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("geometric circle '(center,radius)'");
+#define CIRCLEOID		718
+DATA(insert OID = 719 (  _circle   PGNSP PGUID	-1 f b A f t \054 0  718 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 790 (  money	   PGNSP PGUID	 8 FLOAT8PASSBYVAL b N f t \054 0 0 791 cash_in cash_out cash_recv cash_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("monetary amounts, $d,ddd.cc");
+#define CASHOID 790
+DATA(insert OID = 791 (  _money    PGNSP PGUID	-1 f b A f t \054 0  790 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+
+/* OIDS 800 - 899 */
+DATA(insert OID = 829 ( macaddr    PGNSP PGUID	6 f b U f t \054 0 0 1040 macaddr_in macaddr_out macaddr_recv macaddr_send - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("XX:XX:XX:XX:XX:XX, MAC address");
+#define MACADDROID 829
+DATA(insert OID = 869 ( inet	   PGNSP PGUID	-1 f b I t t \054 0 0 1041 inet_in inet_out inet_recv inet_send - - - i m f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("IP address/netmask, host address, netmask optional");
+#define INETOID 869
+DATA(insert OID = 650 ( cidr	   PGNSP PGUID	-1 f b I f t \054 0 0 651 cidr_in cidr_out cidr_recv cidr_send - - - i m f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("network IP address/netmask, network address");
+#define CIDROID 650
+
+/* OIDS 900 - 999 */
+
+/* OIDS 1000 - 1099 */
+DATA(insert OID = 1000 (  _bool		 PGNSP PGUID -1 f b A f t \054 0	16 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1001 (  _bytea	 PGNSP PGUID -1 f b A f t \054 0	17 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1002 (  _char		 PGNSP PGUID -1 f b A f t \054 0	18 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1003 (  _name		 PGNSP PGUID -1 f b A f t \054 0	19 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1005 (  _int2		 PGNSP PGUID -1 f b A f t \054 0	21 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+#define INT2ARRAYOID		1005
+DATA(insert OID = 1006 (  _int2vector PGNSP PGUID -1 f b A f t \054 0	22 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1007 (  _int4		 PGNSP PGUID -1 f b A f t \054 0	23 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+#define INT4ARRAYOID		1007
+DATA(insert OID = 1008 (  _regproc	 PGNSP PGUID -1 f b A f t \054 0	24 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1009 (  _text		 PGNSP PGUID -1 f b A f t \054 0	25 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 100 _null_ _null_ _null_ ));
+#define TEXTARRAYOID		1009
+DATA(insert OID = 1028 (  _oid		 PGNSP PGUID -1 f b A f t \054 0	26 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+#define OIDARRAYOID			1028
+DATA(insert OID = 1010 (  _tid		 PGNSP PGUID -1 f b A f t \054 0	27 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1011 (  _xid		 PGNSP PGUID -1 f b A f t \054 0	28 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1012 (  _cid		 PGNSP PGUID -1 f b A f t \054 0	29 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1013 (  _oidvector PGNSP PGUID -1 f b A f t \054 0	30 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1014 (  _bpchar	 PGNSP PGUID -1 f b A f t \054 0 1042 0 array_in array_out array_recv array_send bpchartypmodin bpchartypmodout array_typanalyze i x f 0 -1 0 100 _null_ _null_ _null_ ));
+DATA(insert OID = 1015 (  _varchar	 PGNSP PGUID -1 f b A f t \054 0 1043 0 array_in array_out array_recv array_send varchartypmodin varchartypmodout array_typanalyze i x f 0 -1 0 100 _null_ _null_ _null_ ));
+DATA(insert OID = 1016 (  _int8		 PGNSP PGUID -1 f b A f t \054 0	20 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1017 (  _point	 PGNSP PGUID -1 f b A f t \054 0 600 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1018 (  _lseg		 PGNSP PGUID -1 f b A f t \054 0 601 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1019 (  _path		 PGNSP PGUID -1 f b A f t \054 0 602 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1020 (  _box		 PGNSP PGUID -1 f b A f t \073 0 603 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1021 (  _float4	 PGNSP PGUID -1 f b A f t \054 0 700 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+#define FLOAT4ARRAYOID 1021
+DATA(insert OID = 1022 (  _float8	 PGNSP PGUID -1 f b A f t \054 0 701 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1023 (  _abstime	 PGNSP PGUID -1 f b A f t \054 0 702 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1024 (  _reltime	 PGNSP PGUID -1 f b A f t \054 0 703 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1025 (  _tinterval PGNSP PGUID -1 f b A f t \054 0 704 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1027 (  _polygon	 PGNSP PGUID -1 f b A f t \054 0 604 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1033 (  aclitem	 PGNSP PGUID 12 f b U f t \054 0 0 1034 aclitemin aclitemout - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("access control list");
+#define ACLITEMOID		1033
+DATA(insert OID = 1034 (  _aclitem	 PGNSP PGUID -1 f b A f t \054 0 1033 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1040 (  _macaddr	 PGNSP PGUID -1 f b A f t \054 0  829 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1041 (  _inet		 PGNSP PGUID -1 f b A f t \054 0  869 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 651  (  _cidr		 PGNSP PGUID -1 f b A f t \054 0  650 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1263 (  _cstring	 PGNSP PGUID -1 f b A f t \054 0 2275 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+#define CSTRINGARRAYOID		1263
+
+DATA(insert OID = 1042 ( bpchar		 PGNSP PGUID -1 f b S f t \054 0	0 1014 bpcharin bpcharout bpcharrecv bpcharsend bpchartypmodin bpchartypmodout - i x f 0 -1 0 100 _null_ _null_ _null_ ));
+DESCR("char(length), blank-padded string, fixed storage length");
+#define BPCHAROID		1042
+DATA(insert OID = 1043 ( varchar	 PGNSP PGUID -1 f b S f t \054 0	0 1015 varcharin varcharout varcharrecv varcharsend varchartypmodin varchartypmodout - i x f 0 -1 0 100 _null_ _null_ _null_ ));
+DESCR("varchar(length), non-blank-padded string, variable storage length");
+#define VARCHAROID		1043
+
+DATA(insert OID = 1082 ( date		 PGNSP PGUID	4 t b D f t \054 0	0 1182 date_in date_out date_recv date_send - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("date");
+#define DATEOID			1082
+DATA(insert OID = 1083 ( time		 PGNSP PGUID	8 FLOAT8PASSBYVAL b D f t \054 0	0 1183 time_in time_out time_recv time_send timetypmodin timetypmodout - d p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("time of day");
+#define TIMEOID			1083
+
+/* OIDS 1100 - 1199 */
+DATA(insert OID = 1114 ( timestamp	 PGNSP PGUID	8 FLOAT8PASSBYVAL b D f t \054 0	0 1115 timestamp_in timestamp_out timestamp_recv timestamp_send timestamptypmodin timestamptypmodout - d p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("date and time");
+#define TIMESTAMPOID	1114
+DATA(insert OID = 1115 ( _timestamp  PGNSP PGUID	-1 f b A f t \054 0 1114 0 array_in array_out array_recv array_send timestamptypmodin timestamptypmodout array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1182 ( _date		 PGNSP PGUID	-1 f b A f t \054 0 1082 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1183 ( _time		 PGNSP PGUID	-1 f b A f t \054 0 1083 0 array_in array_out array_recv array_send timetypmodin timetypmodout array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1184 ( timestamptz PGNSP PGUID	8 FLOAT8PASSBYVAL b D t t \054 0	0 1185 timestamptz_in timestamptz_out timestamptz_recv timestamptz_send timestamptztypmodin timestamptztypmodout - d p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("date and time with time zone");
+#define TIMESTAMPTZOID	1184
+DATA(insert OID = 1185 ( _timestamptz PGNSP PGUID -1 f b A f t \054 0	1184 0 array_in array_out array_recv array_send timestamptztypmodin timestamptztypmodout array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1186 ( interval	 PGNSP PGUID 16 f b T t t \054 0	0 1187 interval_in interval_out interval_recv interval_send intervaltypmodin intervaltypmodout - d p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("@ <number> <units>, time interval");
+#define INTERVALOID		1186
+DATA(insert OID = 1187 ( _interval	 PGNSP PGUID	-1 f b A f t \054 0 1186 0 array_in array_out array_recv array_send intervaltypmodin intervaltypmodout array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+
+/* OIDS 1200 - 1299 */
+DATA(insert OID = 1231 (  _numeric	 PGNSP PGUID -1 f b A f t \054 0	1700 0 array_in array_out array_recv array_send numerictypmodin numerictypmodout array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1266 ( timetz		 PGNSP PGUID 12 f b D f t \054 0	0 1270 timetz_in timetz_out timetz_recv timetz_send timetztypmodin timetztypmodout - d p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("time of day with time zone");
+#define TIMETZOID		1266
+DATA(insert OID = 1270 ( _timetz	 PGNSP PGUID -1 f b A f t \054 0	1266 0 array_in array_out array_recv array_send timetztypmodin timetztypmodout array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+
+/* OIDS 1500 - 1599 */
+DATA(insert OID = 1560 ( bit		 PGNSP PGUID -1 f b V f t \054 0	0 1561 bit_in bit_out bit_recv bit_send bittypmodin bittypmodout - i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("fixed-length bit string");
+#define BITOID	 1560
+DATA(insert OID = 1561 ( _bit		 PGNSP PGUID -1 f b A f t \054 0	1560 0 array_in array_out array_recv array_send bittypmodin bittypmodout array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 1562 ( varbit		 PGNSP PGUID -1 f b V t t \054 0	0 1563 varbit_in varbit_out varbit_recv varbit_send varbittypmodin varbittypmodout - i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("variable-length bit string");
+#define VARBITOID	  1562
+DATA(insert OID = 1563 ( _varbit	 PGNSP PGUID -1 f b A f t \054 0	1562 0 array_in array_out array_recv array_send varbittypmodin varbittypmodout array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+
+/* OIDS 1600 - 1699 */
+
+/* OIDS 1700 - 1799 */
+DATA(insert OID = 1700 ( numeric	   PGNSP PGUID -1 f b N f t \054 0	0 1231 numeric_in numeric_out numeric_recv numeric_send numerictypmodin numerictypmodout - i m f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("numeric(precision, decimal), arbitrary precision number");
+#define NUMERICOID		1700
+
+DATA(insert OID = 1790 ( refcursor	   PGNSP PGUID -1 f b U f t \054 0	0 2201 textin textout textrecv textsend - - - i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("reference to cursor (portal name)");
+#define REFCURSOROID	1790
+
+/* OIDS 2200 - 2299 */
+DATA(insert OID = 2201 ( _refcursor    PGNSP PGUID -1 f b A f t \054 0 1790 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+
+DATA(insert OID = 2202 ( regprocedure  PGNSP PGUID	4 t b N f t \054 0	 0 2207 regprocedurein regprocedureout regprocedurerecv regproceduresend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("registered procedure (with args)");
+#define REGPROCEDUREOID 2202
+
+DATA(insert OID = 2203 ( regoper	   PGNSP PGUID	4 t b N f t \054 0	 0 2208 regoperin regoperout regoperrecv regopersend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("registered operator");
+#define REGOPEROID		2203
+
+DATA(insert OID = 2204 ( regoperator   PGNSP PGUID	4 t b N f t \054 0	 0 2209 regoperatorin regoperatorout regoperatorrecv regoperatorsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("registered operator (with args)");
+#define REGOPERATOROID	2204
+
+DATA(insert OID = 2205 ( regclass	   PGNSP PGUID	4 t b N f t \054 0	 0 2210 regclassin regclassout regclassrecv regclasssend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("registered class");
+#define REGCLASSOID		2205
+
+DATA(insert OID = 2206 ( regtype	   PGNSP PGUID	4 t b N f t \054 0	 0 2211 regtypein regtypeout regtyperecv regtypesend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("registered type");
+#define REGTYPEOID		2206
+
+DATA(insert OID = 4096 ( regrole	   PGNSP PGUID	4 t b N f t \054 0	 0 4097 regrolein regroleout regrolerecv regrolesend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("registered role");
+#define REGROLEOID		4096
+
+DATA(insert OID = 4089 ( regnamespace  PGNSP PGUID	4 t b N f t \054 0	 0 4090 regnamespacein regnamespaceout regnamespacerecv regnamespacesend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("registered namespace");
+#define REGNAMESPACEOID		4089
+
+DATA(insert OID = 2207 ( _regprocedure PGNSP PGUID -1 f b A f t \054 0 2202 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 2208 ( _regoper	   PGNSP PGUID -1 f b A f t \054 0 2203 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 2209 ( _regoperator  PGNSP PGUID -1 f b A f t \054 0 2204 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 2210 ( _regclass	   PGNSP PGUID -1 f b A f t \054 0 2205 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 2211 ( _regtype	   PGNSP PGUID -1 f b A f t \054 0 2206 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+#define REGTYPEARRAYOID 2211
+DATA(insert OID = 4097 ( _regrole	   PGNSP PGUID -1 f b A f t \054 0 4096 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 4090 ( _regnamespace PGNSP PGUID -1 f b A f t \054 0 4089 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+
+/* uuid */
+DATA(insert OID = 2950 ( uuid			PGNSP PGUID 16 f b U f t \054 0 0 2951 uuid_in uuid_out uuid_recv uuid_send - - - c p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("UUID datatype");
+#define UUIDOID 2950
+DATA(insert OID = 2951 ( _uuid			PGNSP PGUID -1 f b A f t \054 0 2950 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+
+/* pg_lsn */
+DATA(insert OID = 3220 ( pg_lsn			PGNSP PGUID 8 FLOAT8PASSBYVAL b U f t \054 0 0 3221 pg_lsn_in pg_lsn_out pg_lsn_recv pg_lsn_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("PostgreSQL LSN datatype");
+#define LSNOID			3220
+DATA(insert OID = 3221 ( _pg_lsn			PGNSP PGUID -1 f b A f t \054 0 3220 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+
+/* text search */
+DATA(insert OID = 3614 ( tsvector		PGNSP PGUID -1 f b U f t \054 0 0 3643 tsvectorin tsvectorout tsvectorrecv tsvectorsend - - ts_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("text representation for text search");
+#define TSVECTOROID		3614
+DATA(insert OID = 3642 ( gtsvector		PGNSP PGUID -1 f b U f t \054 0 0 3644 gtsvectorin gtsvectorout - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("GiST index internal text representation for text search");
+#define GTSVECTOROID	3642
+DATA(insert OID = 3615 ( tsquery		PGNSP PGUID -1 f b U f t \054 0 0 3645 tsqueryin tsqueryout tsqueryrecv tsquerysend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("query representation for text search");
+#define TSQUERYOID		3615
+DATA(insert OID = 3734 ( regconfig		PGNSP PGUID 4 t b N f t \054 0 0 3735 regconfigin regconfigout regconfigrecv regconfigsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("registered text search configuration");
+#define REGCONFIGOID	3734
+DATA(insert OID = 3769 ( regdictionary	PGNSP PGUID 4 t b N f t \054 0 0 3770 regdictionaryin regdictionaryout regdictionaryrecv regdictionarysend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("registered text search dictionary");
+#define REGDICTIONARYOID	3769
+
+DATA(insert OID = 3643 ( _tsvector		PGNSP PGUID -1 f b A f t \054 0 3614 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 3644 ( _gtsvector		PGNSP PGUID -1 f b A f t \054 0 3642 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 3645 ( _tsquery		PGNSP PGUID -1 f b A f t \054 0 3615 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 3735 ( _regconfig		PGNSP PGUID -1 f b A f t \054 0 3734 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 3770 ( _regdictionary PGNSP PGUID -1 f b A f t \054 0 3769 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+
+/* jsonb */
+DATA(insert OID = 3802 ( jsonb			PGNSP PGUID -1 f b U f t \054 0 0 3807 jsonb_in jsonb_out jsonb_recv jsonb_send - - - i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("Binary JSON");
+#define JSONBOID 3802
+DATA(insert OID = 3807 ( _jsonb			PGNSP PGUID -1 f b A f t \054 0 3802 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+
+DATA(insert OID = 2970 ( txid_snapshot	PGNSP PGUID -1 f b U f t \054 0 0 2949 txid_snapshot_in txid_snapshot_out txid_snapshot_recv txid_snapshot_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("txid snapshot");
+DATA(insert OID = 2949 ( _txid_snapshot PGNSP PGUID -1 f b A f t \054 0 2970 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+
+/* range types */
+DATA(insert OID = 3904 ( int4range		PGNSP PGUID  -1 f r R f t \054 0 0 3905 range_in range_out range_recv range_send - - range_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("range of integers");
+#define INT4RANGEOID		3904
+DATA(insert OID = 3905 ( _int4range		PGNSP PGUID  -1 f b A f t \054 0 3904 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 3906 ( numrange		PGNSP PGUID  -1 f r R f t \054 0 0 3907 range_in range_out range_recv range_send - - range_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("range of numerics");
+DATA(insert OID = 3907 ( _numrange		PGNSP PGUID  -1 f b A f t \054 0 3906 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 3908 ( tsrange		PGNSP PGUID  -1 f r R f t \054 0 0 3909 range_in range_out range_recv range_send - - range_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("range of timestamps without time zone");
+DATA(insert OID = 3909 ( _tsrange		PGNSP PGUID  -1 f b A f t \054 0 3908 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 3910 ( tstzrange		PGNSP PGUID  -1 f r R f t \054 0 0 3911 range_in range_out range_recv range_send - - range_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("range of timestamps with time zone");
+DATA(insert OID = 3911 ( _tstzrange		PGNSP PGUID  -1 f b A f t \054 0 3910 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 3912 ( daterange		PGNSP PGUID  -1 f r R f t \054 0 0 3913 range_in range_out range_recv range_send - - range_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("range of dates");
+DATA(insert OID = 3913 ( _daterange		PGNSP PGUID  -1 f b A f t \054 0 3912 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
+DATA(insert OID = 3926 ( int8range		PGNSP PGUID  -1 f r R f t \054 0 0 3927 range_in range_out range_recv range_send - - range_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+DESCR("range of bigints");
+DATA(insert OID = 3927 ( _int8range		PGNSP PGUID  -1 f b A f t \054 0 3926 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+
+/*
+ * pseudo-types
+ *
+ * types with typtype='p' represent various special cases in the type system.
+ *
+ * These cannot be used to define table columns, but are valid as function
+ * argument and result types (if supported by the function's implementation
+ * language).
+ *
+ * Note: cstring is a borderline case; it is still considered a pseudo-type,
+ * but there is now support for it in records and arrays.  Perhaps we should
+ * just treat it as a regular base type?
+ */
+DATA(insert OID = 2249 ( record			PGNSP PGUID -1 f p P f t \054 0 0 2287 record_in record_out record_recv record_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
+#define RECORDOID		2249
+DATA(insert OID = 2287 ( _record		PGNSP PGUID -1 f p P f t \054 0 2249 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
+#define RECORDARRAYOID	2287
+DATA(insert OID = 2275 ( cstring		PGNSP PGUID -2 f p P f t \054 0 0 1263 cstring_in cstring_out cstring_recv cstring_send - - - c p f 0 -1 0 0 _null_ _null_ _null_ ));
+#define CSTRINGOID		2275
+DATA(insert OID = 2276 ( any			PGNSP PGUID  4 t p P f t \054 0 0 0 any_in any_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+#define ANYOID			2276
+DATA(insert OID = 2277 ( anyarray		PGNSP PGUID -1 f p P f t \054 0 0 0 anyarray_in anyarray_out anyarray_recv anyarray_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
+#define ANYARRAYOID		2277
+DATA(insert OID = 2278 ( void			PGNSP PGUID  4 t p P f t \054 0 0 0 void_in void_out void_recv void_send - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+#define VOIDOID			2278
+DATA(insert OID = 2279 ( trigger		PGNSP PGUID  4 t p P f t \054 0 0 0 trigger_in trigger_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+#define TRIGGEROID		2279
+DATA(insert OID = 3838 ( event_trigger		PGNSP PGUID  4 t p P f t \054 0 0 0 event_trigger_in event_trigger_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+#define EVTTRIGGEROID		3838
+DATA(insert OID = 2280 ( language_handler	PGNSP PGUID  4 t p P f t \054 0 0 0 language_handler_in language_handler_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+#define LANGUAGE_HANDLEROID		2280
+DATA(insert OID = 2281 ( internal		PGNSP PGUID  SIZEOF_POINTER t p P f t \054 0 0 0 internal_in internal_out - - - - - ALIGNOF_POINTER p f 0 -1 0 0 _null_ _null_ _null_ ));
+#define INTERNALOID		2281
+DATA(insert OID = 2282 ( opaque			PGNSP PGUID  4 t p P f t \054 0 0 0 opaque_in opaque_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+#define OPAQUEOID		2282
+DATA(insert OID = 2283 ( anyelement		PGNSP PGUID  4 t p P f t \054 0 0 0 anyelement_in anyelement_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+#define ANYELEMENTOID	2283
+DATA(insert OID = 2776 ( anynonarray	PGNSP PGUID  4 t p P f t \054 0 0 0 anynonarray_in anynonarray_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+#define ANYNONARRAYOID	2776
+DATA(insert OID = 3500 ( anyenum		PGNSP PGUID  4 t p P f t \054 0 0 0 anyenum_in anyenum_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+#define ANYENUMOID		3500
+DATA(insert OID = 3115 ( fdw_handler	PGNSP PGUID  4 t p P f t \054 0 0 0 fdw_handler_in fdw_handler_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+#define FDW_HANDLEROID	3115
+DATA(insert OID = 3310 ( tsm_handler	PGNSP PGUID  4 t p P f t \054 0 0 0 tsm_handler_in tsm_handler_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
+#define TSM_HANDLEROID	3310
+DATA(insert OID = 3831 ( anyrange		PGNSP PGUID  -1 f p P f t \054 0 0 0 anyrange_in anyrange_out - - - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
+#define ANYRANGEOID		3831
+
+
+/*
+ * macros
+ */
+#define  TYPTYPE_BASE		'b' /* base type (ordinary scalar type) */
+#define  TYPTYPE_COMPOSITE	'c' /* composite (e.g., table's rowtype) */
+#define  TYPTYPE_DOMAIN		'd' /* domain over another type */
+#define  TYPTYPE_ENUM		'e' /* enumerated type */
+#define  TYPTYPE_PSEUDO		'p' /* pseudo-type */
+#define  TYPTYPE_RANGE		'r' /* range type */
+
+#define  TYPCATEGORY_INVALID	'\0'	/* not an allowed category */
+#define  TYPCATEGORY_ARRAY		'A'
+#define  TYPCATEGORY_BOOLEAN	'B'
+#define  TYPCATEGORY_COMPOSITE	'C'
+#define  TYPCATEGORY_DATETIME	'D'
+#define  TYPCATEGORY_ENUM		'E'
+#define  TYPCATEGORY_GEOMETRIC	'G'
+#define  TYPCATEGORY_NETWORK	'I'		/* think INET */
+#define  TYPCATEGORY_NUMERIC	'N'
+#define  TYPCATEGORY_PSEUDOTYPE 'P'
+#define  TYPCATEGORY_RANGE		'R'
+#define  TYPCATEGORY_STRING		'S'
+#define  TYPCATEGORY_TIMESPAN	'T'
+#define  TYPCATEGORY_USER		'U'
+#define  TYPCATEGORY_BITSTRING	'V'		/* er ... "varbit"? */
+#define  TYPCATEGORY_UNKNOWN	'X'
+
+/* Is a type OID a polymorphic pseudotype?	(Beware of multiple evaluation) */
+#define IsPolymorphicType(typid)  \
+	((typid) == ANYELEMENTOID || \
+	 (typid) == ANYARRAYOID || \
+	 (typid) == ANYNONARRAYOID || \
+	 (typid) == ANYENUMOID || \
+	 (typid) == ANYRANGEOID)
+
+#endif   /* PG_TYPE_H */
diff --git a/foreign/libpg_query/src/postgres/include/commands/async.h b/foreign/libpg_query/src/postgres/include/commands/async.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/commands/async.h
@@ -0,0 +1,57 @@
+/*-------------------------------------------------------------------------
+ *
+ * async.h
+ *	  Asynchronous notification: NOTIFY, LISTEN, UNLISTEN
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/commands/async.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef ASYNC_H
+#define ASYNC_H
+
+#include <signal.h>
+
+#include "fmgr.h"
+
+/*
+ * The number of SLRU page buffers we use for the notification queue.
+ */
+#define NUM_ASYNC_BUFFERS	8
+
+extern bool Trace_notify;
+extern volatile sig_atomic_t notifyInterruptPending;
+
+extern Size AsyncShmemSize(void);
+extern void AsyncShmemInit(void);
+
+/* notify-related SQL statements */
+extern void Async_Notify(const char *channel, const char *payload);
+extern void Async_Listen(const char *channel);
+extern void Async_Unlisten(const char *channel);
+extern void Async_UnlistenAll(void);
+
+/* notify-related SQL functions */
+extern Datum pg_listening_channels(PG_FUNCTION_ARGS);
+extern Datum pg_notify(PG_FUNCTION_ARGS);
+
+/* perform (or cancel) outbound notify processing at transaction commit */
+extern void PreCommit_Notify(void);
+extern void AtCommit_Notify(void);
+extern void AtAbort_Notify(void);
+extern void AtSubStart_Notify(void);
+extern void AtSubCommit_Notify(void);
+extern void AtSubAbort_Notify(void);
+extern void AtPrepare_Notify(void);
+extern void ProcessCompletedNotifies(void);
+
+/* signal handler for inbound notifies (PROCSIG_NOTIFY_INTERRUPT) */
+extern void HandleNotifyInterrupt(void);
+
+/* process interrupts */
+extern void ProcessNotifyInterrupt(void);
+
+#endif   /* ASYNC_H */
diff --git a/foreign/libpg_query/src/postgres/include/commands/dbcommands.h b/foreign/libpg_query/src/postgres/include/commands/dbcommands.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/commands/dbcommands.h
@@ -0,0 +1,34 @@
+/*-------------------------------------------------------------------------
+ *
+ * dbcommands.h
+ *		Database management commands (create/drop database).
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/commands/dbcommands.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef DBCOMMANDS_H
+#define DBCOMMANDS_H
+
+#include "access/xlogreader.h"
+#include "catalog/objectaddress.h"
+#include "lib/stringinfo.h"
+#include "nodes/parsenodes.h"
+
+extern Oid	createdb(const CreatedbStmt *stmt);
+extern void dropdb(const char *dbname, bool missing_ok);
+extern ObjectAddress RenameDatabase(const char *oldname, const char *newname);
+extern Oid	AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel);
+extern Oid	AlterDatabaseSet(AlterDatabaseSetStmt *stmt);
+extern ObjectAddress AlterDatabaseOwner(const char *dbname, Oid newOwnerId);
+
+extern Oid	get_database_oid(const char *dbname, bool missingok);
+extern char *get_database_name(Oid dbid);
+
+extern void check_encoding_locale_matches(int encoding, const char *collate, const char *ctype);
+
+#endif   /* DBCOMMANDS_H */
diff --git a/foreign/libpg_query/src/postgres/include/commands/defrem.h b/foreign/libpg_query/src/postgres/include/commands/defrem.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/commands/defrem.h
@@ -0,0 +1,151 @@
+/*-------------------------------------------------------------------------
+ *
+ * defrem.h
+ *	  POSTGRES define and remove utility definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/commands/defrem.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef DEFREM_H
+#define DEFREM_H
+
+#include "catalog/objectaddress.h"
+#include "nodes/parsenodes.h"
+#include "utils/array.h"
+
+/* commands/dropcmds.c */
+extern void RemoveObjects(DropStmt *stmt);
+
+/* commands/indexcmds.c */
+extern ObjectAddress DefineIndex(Oid relationId,
+			IndexStmt *stmt,
+			Oid indexRelationId,
+			bool is_alter_table,
+			bool check_rights,
+			bool skip_build,
+			bool quiet);
+extern Oid	ReindexIndex(RangeVar *indexRelation, int options);
+extern Oid	ReindexTable(RangeVar *relation, int options);
+extern void ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind,
+					  int options);
+extern char *makeObjectName(const char *name1, const char *name2,
+			   const char *label);
+extern char *ChooseRelationName(const char *name1, const char *name2,
+				   const char *label, Oid namespaceid);
+extern bool CheckIndexCompatible(Oid oldId,
+					 char *accessMethodName,
+					 List *attributeList,
+					 List *exclusionOpNames);
+extern Oid	GetDefaultOpClass(Oid type_id, Oid am_id);
+
+/* commands/functioncmds.c */
+extern ObjectAddress CreateFunction(CreateFunctionStmt *stmt, const char *queryString);
+extern void RemoveFunctionById(Oid funcOid);
+extern void SetFunctionReturnType(Oid funcOid, Oid newRetType);
+extern void SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType);
+extern ObjectAddress AlterFunction(AlterFunctionStmt *stmt);
+extern ObjectAddress CreateCast(CreateCastStmt *stmt);
+extern void DropCastById(Oid castOid);
+extern ObjectAddress CreateTransform(CreateTransformStmt *stmt);
+extern void DropTransformById(Oid transformOid);
+extern void IsThereFunctionInNamespace(const char *proname, int pronargs,
+						   oidvector *proargtypes, Oid nspOid);
+extern void ExecuteDoStmt(DoStmt *stmt);
+extern Oid	get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok);
+extern Oid	get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok);
+extern void interpret_function_parameter_list(List *parameters,
+								  Oid languageOid,
+								  bool is_aggregate,
+								  const char *queryString,
+								  oidvector **parameterTypes,
+								  ArrayType **allParameterTypes,
+								  ArrayType **parameterModes,
+								  ArrayType **parameterNames,
+								  List **parameterDefaults,
+								  Oid *variadicArgType,
+								  Oid *requiredResultType);
+
+/* commands/operatorcmds.c */
+extern ObjectAddress DefineOperator(List *names, List *parameters);
+extern void RemoveOperatorById(Oid operOid);
+
+/* commands/aggregatecmds.c */
+extern ObjectAddress DefineAggregate(List *name, List *args, bool oldstyle,
+				List *parameters, const char *queryString);
+
+/* commands/opclasscmds.c */
+extern ObjectAddress DefineOpClass(CreateOpClassStmt *stmt);
+extern ObjectAddress DefineOpFamily(CreateOpFamilyStmt *stmt);
+extern Oid	AlterOpFamily(AlterOpFamilyStmt *stmt);
+extern void RemoveOpClassById(Oid opclassOid);
+extern void RemoveOpFamilyById(Oid opfamilyOid);
+extern void RemoveAmOpEntryById(Oid entryOid);
+extern void RemoveAmProcEntryById(Oid entryOid);
+extern void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod,
+						  Oid opcnamespace);
+extern void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod,
+						   Oid opfnamespace);
+extern Oid	get_am_oid(const char *amname, bool missing_ok);
+extern char *get_am_name(Oid amOid);
+extern Oid	get_opclass_oid(Oid amID, List *opclassname, bool missing_ok);
+extern Oid	get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok);
+
+/* commands/tsearchcmds.c */
+extern ObjectAddress DefineTSParser(List *names, List *parameters);
+extern void RemoveTSParserById(Oid prsId);
+
+extern ObjectAddress DefineTSDictionary(List *names, List *parameters);
+extern void RemoveTSDictionaryById(Oid dictId);
+extern ObjectAddress AlterTSDictionary(AlterTSDictionaryStmt *stmt);
+
+extern ObjectAddress DefineTSTemplate(List *names, List *parameters);
+extern void RemoveTSTemplateById(Oid tmplId);
+
+extern ObjectAddress DefineTSConfiguration(List *names, List *parameters,
+					  ObjectAddress *copied);
+extern void RemoveTSConfigurationById(Oid cfgId);
+extern ObjectAddress AlterTSConfiguration(AlterTSConfigurationStmt *stmt);
+
+extern text *serialize_deflist(List *deflist);
+extern List *deserialize_deflist(Datum txt);
+
+/* commands/foreigncmds.c */
+extern ObjectAddress AlterForeignServerOwner(const char *name, Oid newOwnerId);
+extern void AlterForeignServerOwner_oid(Oid, Oid newOwnerId);
+extern ObjectAddress AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId);
+extern void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId);
+extern ObjectAddress CreateForeignDataWrapper(CreateFdwStmt *stmt);
+extern ObjectAddress AlterForeignDataWrapper(AlterFdwStmt *stmt);
+extern void RemoveForeignDataWrapperById(Oid fdwId);
+extern ObjectAddress CreateForeignServer(CreateForeignServerStmt *stmt);
+extern ObjectAddress AlterForeignServer(AlterForeignServerStmt *stmt);
+extern void RemoveForeignServerById(Oid srvId);
+extern ObjectAddress CreateUserMapping(CreateUserMappingStmt *stmt);
+extern ObjectAddress AlterUserMapping(AlterUserMappingStmt *stmt);
+extern Oid	RemoveUserMapping(DropUserMappingStmt *stmt);
+extern void RemoveUserMappingById(Oid umId);
+extern void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid);
+extern void ImportForeignSchema(ImportForeignSchemaStmt *stmt);
+extern Datum transformGenericOptions(Oid catalogId,
+						Datum oldOptions,
+						List *options,
+						Oid fdwvalidator);
+
+/* support routines in commands/define.c */
+
+extern char *defGetString(DefElem *def);
+extern double defGetNumeric(DefElem *def);
+extern bool defGetBoolean(DefElem *def);
+extern int32 defGetInt32(DefElem *def);
+extern int64 defGetInt64(DefElem *def);
+extern List *defGetQualifiedName(DefElem *def);
+extern TypeName *defGetTypeName(DefElem *def);
+extern int	defGetTypeLength(DefElem *def);
+extern DefElem *defWithOids(bool value);
+
+#endif   /* DEFREM_H */
diff --git a/foreign/libpg_query/src/postgres/include/commands/event_trigger.h b/foreign/libpg_query/src/postgres/include/commands/event_trigger.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/commands/event_trigger.h
@@ -0,0 +1,89 @@
+/*-------------------------------------------------------------------------
+ *
+ * event_trigger.h
+ *	  Declarations for command trigger handling.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/commands/event_trigger.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef EVENT_TRIGGER_H
+#define EVENT_TRIGGER_H
+
+#include "catalog/dependency.h"
+#include "catalog/objectaddress.h"
+#include "catalog/pg_event_trigger.h"
+#include "nodes/parsenodes.h"
+#include "utils/aclchk_internal.h"
+#include "tcop/deparse_utility.h"
+
+typedef struct EventTriggerData
+{
+	NodeTag		type;
+	const char *event;			/* event name */
+	Node	   *parsetree;		/* parse tree */
+	const char *tag;			/* command tag */
+} EventTriggerData;
+
+#define AT_REWRITE_ALTER_PERSISTENCE	0x01
+#define AT_REWRITE_DEFAULT_VAL			0x02
+#define AT_REWRITE_COLUMN_REWRITE		0x04
+#define AT_REWRITE_ALTER_OID			0x08
+
+/*
+ * EventTriggerData is the node type that is passed as fmgr "context" info
+ * when a function is called by the event trigger manager.
+ */
+#define CALLED_AS_EVENT_TRIGGER(fcinfo) \
+	((fcinfo)->context != NULL && IsA((fcinfo)->context, EventTriggerData))
+
+extern Oid	CreateEventTrigger(CreateEventTrigStmt *stmt);
+extern void RemoveEventTriggerById(Oid ctrigOid);
+extern Oid	get_event_trigger_oid(const char *trigname, bool missing_ok);
+
+extern Oid	AlterEventTrigger(AlterEventTrigStmt *stmt);
+extern ObjectAddress AlterEventTriggerOwner(const char *name, Oid newOwnerId);
+extern void AlterEventTriggerOwner_oid(Oid, Oid newOwnerId);
+
+extern bool EventTriggerSupportsObjectType(ObjectType obtype);
+extern bool EventTriggerSupportsObjectClass(ObjectClass objclass);
+extern bool EventTriggerSupportsGrantObjectType(GrantObjectType objtype);
+extern void EventTriggerDDLCommandStart(Node *parsetree);
+extern void EventTriggerDDLCommandEnd(Node *parsetree);
+extern void EventTriggerSQLDrop(Node *parsetree);
+extern void EventTriggerTableRewrite(Node *parsetree, Oid tableOid, int reason);
+
+extern bool EventTriggerBeginCompleteQuery(void);
+extern void EventTriggerEndCompleteQuery(void);
+extern bool trackDroppedObjectsNeeded(void);
+extern void EventTriggerSQLDropAddObject(const ObjectAddress *object,
+							 bool original, bool normal);
+
+extern void EventTriggerInhibitCommandCollection(void);
+extern void EventTriggerUndoInhibitCommandCollection(void);
+
+extern void EventTriggerCollectSimpleCommand(ObjectAddress address,
+								 ObjectAddress secondaryObject,
+								 Node *parsetree);
+
+extern void EventTriggerAlterTableStart(Node *parsetree);
+extern void EventTriggerAlterTableRelid(Oid objectId);
+extern void EventTriggerCollectAlterTableSubcmd(Node *subcmd,
+									ObjectAddress address);
+extern void EventTriggerAlterTableEnd(void);
+
+extern void EventTriggerCollectGrant(InternalGrant *istmt);
+extern void EventTriggerCollectAlterOpFam(AlterOpFamilyStmt *stmt,
+							  Oid opfamoid, List *operators,
+							  List *procedures);
+extern void EventTriggerCollectCreateOpClass(CreateOpClassStmt *stmt,
+								 Oid opcoid, List *operators,
+								 List *procedures);
+extern void EventTriggerCollectAlterTSConfig(AlterTSConfigurationStmt *stmt,
+								 Oid cfgId, Oid *dictIds, int ndicts);
+extern void EventTriggerCollectAlterDefPrivs(AlterDefaultPrivilegesStmt *stmt);
+
+#endif   /* EVENT_TRIGGER_H */
diff --git a/foreign/libpg_query/src/postgres/include/commands/explain.h b/foreign/libpg_query/src/postgres/include/commands/explain.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/commands/explain.h
@@ -0,0 +1,97 @@
+/*-------------------------------------------------------------------------
+ *
+ * explain.h
+ *	  prototypes for explain.c
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994-5, Regents of the University of California
+ *
+ * src/include/commands/explain.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef EXPLAIN_H
+#define EXPLAIN_H
+
+#include "executor/executor.h"
+#include "lib/stringinfo.h"
+
+typedef enum ExplainFormat
+{
+	EXPLAIN_FORMAT_TEXT,
+	EXPLAIN_FORMAT_XML,
+	EXPLAIN_FORMAT_JSON,
+	EXPLAIN_FORMAT_YAML
+} ExplainFormat;
+
+typedef struct ExplainState
+{
+	StringInfo	str;			/* output buffer */
+	/* options */
+	bool		verbose;		/* be verbose */
+	bool		analyze;		/* print actual times */
+	bool		costs;			/* print estimated costs */
+	bool		buffers;		/* print buffer usage */
+	bool		timing;			/* print detailed node timing */
+	bool		summary;		/* print total planning and execution timing */
+	ExplainFormat format;		/* output format */
+	/* other states */
+	PlannedStmt *pstmt;			/* top of plan */
+	List	   *rtable;			/* range table */
+	List	   *rtable_names;	/* alias names for RTEs */
+	int			indent;			/* current indentation level */
+	List	   *grouping_stack; /* format-specific grouping state */
+	List	   *deparse_cxt;	/* context list for deparsing expressions */
+} ExplainState;
+
+/* Hook for plugins to get control in ExplainOneQuery() */
+typedef void (*ExplainOneQuery_hook_type) (Query *query,
+													   IntoClause *into,
+													   ExplainState *es,
+													 const char *queryString,
+													   ParamListInfo params);
+extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;
+
+/* Hook for plugins to get control in explain_get_index_name() */
+typedef const char *(*explain_get_index_name_hook_type) (Oid indexId);
+extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook;
+
+
+extern void ExplainQuery(ExplainStmt *stmt, const char *queryString,
+			 ParamListInfo params, DestReceiver *dest);
+
+extern ExplainState *NewExplainState(void);
+
+extern TupleDesc ExplainResultDesc(ExplainStmt *stmt);
+
+extern void ExplainOneUtility(Node *utilityStmt, IntoClause *into,
+				  ExplainState *es,
+				  const char *queryString, ParamListInfo params);
+
+extern void ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into,
+			   ExplainState *es, const char *queryString,
+			   ParamListInfo params, const instr_time *planduration);
+
+extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc);
+extern void ExplainPrintTriggers(ExplainState *es, QueryDesc *queryDesc);
+
+extern void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc);
+
+extern void ExplainBeginOutput(ExplainState *es);
+extern void ExplainEndOutput(ExplainState *es);
+extern void ExplainSeparatePlans(ExplainState *es);
+
+extern void ExplainPropertyList(const char *qlabel, List *data,
+					ExplainState *es);
+extern void ExplainPropertyListNested(const char *qlabel, List *data,
+						  ExplainState *es);
+extern void ExplainPropertyText(const char *qlabel, const char *value,
+					ExplainState *es);
+extern void ExplainPropertyInteger(const char *qlabel, int value,
+					   ExplainState *es);
+extern void ExplainPropertyLong(const char *qlabel, long value,
+					ExplainState *es);
+extern void ExplainPropertyFloat(const char *qlabel, double value, int ndigits,
+					 ExplainState *es);
+
+#endif   /* EXPLAIN_H */
diff --git a/foreign/libpg_query/src/postgres/include/commands/prepare.h b/foreign/libpg_query/src/postgres/include/commands/prepare.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/commands/prepare.h
@@ -0,0 +1,59 @@
+/*-------------------------------------------------------------------------
+ *
+ * prepare.h
+ *	  PREPARE, EXECUTE and DEALLOCATE commands, and prepared-stmt storage
+ *
+ *
+ * Copyright (c) 2002-2015, PostgreSQL Global Development Group
+ *
+ * src/include/commands/prepare.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PREPARE_H
+#define PREPARE_H
+
+#include "commands/explain.h"
+#include "datatype/timestamp.h"
+#include "utils/plancache.h"
+
+/*
+ * The data structure representing a prepared statement.  This is now just
+ * a thin veneer over a plancache entry --- the main addition is that of
+ * a name.
+ *
+ * Note: all subsidiary storage lives in the referenced plancache entry.
+ */
+typedef struct
+{
+	/* dynahash.c requires key to be first field */
+	char		stmt_name[NAMEDATALEN];
+	CachedPlanSource *plansource;		/* the actual cached plan */
+	bool		from_sql;		/* prepared via SQL, not FE/BE protocol? */
+	TimestampTz prepare_time;	/* the time when the stmt was prepared */
+} PreparedStatement;
+
+
+/* Utility statements PREPARE, EXECUTE, DEALLOCATE, EXPLAIN EXECUTE */
+extern void PrepareQuery(PrepareStmt *stmt, const char *queryString);
+extern void ExecuteQuery(ExecuteStmt *stmt, IntoClause *intoClause,
+			 const char *queryString, ParamListInfo params,
+			 DestReceiver *dest, char *completionTag);
+extern void DeallocateQuery(DeallocateStmt *stmt);
+extern void ExplainExecuteQuery(ExecuteStmt *execstmt, IntoClause *into,
+					ExplainState *es,
+					const char *queryString, ParamListInfo params);
+
+/* Low-level access to stored prepared statements */
+extern void StorePreparedStatement(const char *stmt_name,
+					   CachedPlanSource *plansource,
+					   bool from_sql);
+extern PreparedStatement *FetchPreparedStatement(const char *stmt_name,
+					   bool throwError);
+extern void DropPreparedStatement(const char *stmt_name, bool showError);
+extern TupleDesc FetchPreparedStatementResultDesc(PreparedStatement *stmt);
+extern List *FetchPreparedStatementTargetList(PreparedStatement *stmt);
+
+extern void DropAllPreparedStatements(void);
+
+#endif   /* PREPARE_H */
diff --git a/foreign/libpg_query/src/postgres/include/commands/tablespace.h b/foreign/libpg_query/src/postgres/include/commands/tablespace.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/commands/tablespace.h
@@ -0,0 +1,65 @@
+/*-------------------------------------------------------------------------
+ *
+ * tablespace.h
+ *		Tablespace management commands (create/drop tablespace).
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/commands/tablespace.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TABLESPACE_H
+#define TABLESPACE_H
+
+#include "access/xlogreader.h"
+#include "catalog/objectaddress.h"
+#include "lib/stringinfo.h"
+#include "nodes/parsenodes.h"
+
+/* XLOG stuff */
+#define XLOG_TBLSPC_CREATE		0x00
+#define XLOG_TBLSPC_DROP		0x10
+
+typedef struct xl_tblspc_create_rec
+{
+	Oid			ts_id;
+	char		ts_path[FLEXIBLE_ARRAY_MEMBER]; /* null-terminated string */
+} xl_tblspc_create_rec;
+
+typedef struct xl_tblspc_drop_rec
+{
+	Oid			ts_id;
+} xl_tblspc_drop_rec;
+
+typedef struct TableSpaceOpts
+{
+	int32		vl_len_;		/* varlena header (do not touch directly!) */
+	float8		random_page_cost;
+	float8		seq_page_cost;
+} TableSpaceOpts;
+
+extern Oid	CreateTableSpace(CreateTableSpaceStmt *stmt);
+extern void DropTableSpace(DropTableSpaceStmt *stmt);
+extern ObjectAddress RenameTableSpace(const char *oldname, const char *newname);
+extern Oid	AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt);
+
+extern void TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo);
+
+extern Oid	GetDefaultTablespace(char relpersistence);
+
+extern void PrepareTempTablespaces(void);
+
+extern Oid	get_tablespace_oid(const char *tablespacename, bool missing_ok);
+extern char *get_tablespace_name(Oid spc_oid);
+
+extern bool directory_is_empty(const char *path);
+extern void remove_tablespace_symlink(const char *linkloc);
+
+extern void tblspc_redo(XLogReaderState *rptr);
+extern void tblspc_desc(StringInfo buf, XLogReaderState *rptr);
+extern const char *tblspc_identify(uint8 info);
+
+#endif   /* TABLESPACE_H */
diff --git a/foreign/libpg_query/src/postgres/include/commands/trigger.h b/foreign/libpg_query/src/postgres/include/commands/trigger.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/commands/trigger.h
@@ -0,0 +1,215 @@
+/*-------------------------------------------------------------------------
+ *
+ * trigger.h
+ *	  Declarations for trigger handling.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/commands/trigger.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TRIGGER_H
+#define TRIGGER_H
+
+#include "catalog/objectaddress.h"
+#include "nodes/execnodes.h"
+#include "nodes/parsenodes.h"
+
+/*
+ * TriggerData is the node type that is passed as fmgr "context" info
+ * when a function is called by the trigger manager.
+ */
+
+#define CALLED_AS_TRIGGER(fcinfo) \
+	((fcinfo)->context != NULL && IsA((fcinfo)->context, TriggerData))
+
+typedef uint32 TriggerEvent;
+
+typedef struct TriggerData
+{
+	NodeTag		type;
+	TriggerEvent tg_event;
+	Relation	tg_relation;
+	HeapTuple	tg_trigtuple;
+	HeapTuple	tg_newtuple;
+	Trigger    *tg_trigger;
+	Buffer		tg_trigtuplebuf;
+	Buffer		tg_newtuplebuf;
+} TriggerData;
+
+/*
+ * TriggerEvent bit flags
+ *
+ * Note that we assume different event types (INSERT/DELETE/UPDATE/TRUNCATE)
+ * can't be OR'd together in a single TriggerEvent.  This is unlike the
+ * situation for pg_trigger rows, so pg_trigger.tgtype uses a different
+ * representation!
+ */
+#define TRIGGER_EVENT_INSERT			0x00000000
+#define TRIGGER_EVENT_DELETE			0x00000001
+#define TRIGGER_EVENT_UPDATE			0x00000002
+#define TRIGGER_EVENT_TRUNCATE			0x00000003
+#define TRIGGER_EVENT_OPMASK			0x00000003
+
+#define TRIGGER_EVENT_ROW				0x00000004
+
+#define TRIGGER_EVENT_BEFORE			0x00000008
+#define TRIGGER_EVENT_AFTER				0x00000000
+#define TRIGGER_EVENT_INSTEAD			0x00000010
+#define TRIGGER_EVENT_TIMINGMASK		0x00000018
+
+/* More TriggerEvent flags, used only within trigger.c */
+
+#define AFTER_TRIGGER_DEFERRABLE		0x00000020
+#define AFTER_TRIGGER_INITDEFERRED		0x00000040
+
+#define TRIGGER_FIRED_BY_INSERT(event) \
+	(((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_INSERT)
+
+#define TRIGGER_FIRED_BY_DELETE(event) \
+	(((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_DELETE)
+
+#define TRIGGER_FIRED_BY_UPDATE(event) \
+	(((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_UPDATE)
+
+#define TRIGGER_FIRED_BY_TRUNCATE(event) \
+	(((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_TRUNCATE)
+
+#define TRIGGER_FIRED_FOR_ROW(event) \
+	((event) & TRIGGER_EVENT_ROW)
+
+#define TRIGGER_FIRED_FOR_STATEMENT(event) \
+	(!TRIGGER_FIRED_FOR_ROW(event))
+
+#define TRIGGER_FIRED_BEFORE(event) \
+	(((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_BEFORE)
+
+#define TRIGGER_FIRED_AFTER(event) \
+	(((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_AFTER)
+
+#define TRIGGER_FIRED_INSTEAD(event) \
+	(((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_INSTEAD)
+
+/*
+ * Definitions for replication role based firing.
+ */
+#define SESSION_REPLICATION_ROLE_ORIGIN		0
+#define SESSION_REPLICATION_ROLE_REPLICA	1
+#define SESSION_REPLICATION_ROLE_LOCAL		2
+extern PGDLLIMPORT int SessionReplicationRole;
+
+/*
+ * States at which a trigger can be fired. These are the
+ * possible values for pg_trigger.tgenabled.
+ */
+#define TRIGGER_FIRES_ON_ORIGIN				'O'
+#define TRIGGER_FIRES_ALWAYS				'A'
+#define TRIGGER_FIRES_ON_REPLICA			'R'
+#define TRIGGER_DISABLED					'D'
+
+extern ObjectAddress CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
+			  Oid relOid, Oid refRelOid, Oid constraintOid, Oid indexOid,
+			  bool isInternal);
+
+extern void RemoveTriggerById(Oid trigOid);
+extern Oid	get_trigger_oid(Oid relid, const char *name, bool missing_ok);
+
+extern ObjectAddress renametrig(RenameStmt *stmt);
+
+extern void EnableDisableTrigger(Relation rel, const char *tgname,
+					 char fires_when, bool skip_system);
+
+extern void RelationBuildTriggers(Relation relation);
+
+extern TriggerDesc *CopyTriggerDesc(TriggerDesc *trigdesc);
+
+extern void FreeTriggerDesc(TriggerDesc *trigdesc);
+
+extern void ExecBSInsertTriggers(EState *estate,
+					 ResultRelInfo *relinfo);
+extern void ExecASInsertTriggers(EState *estate,
+					 ResultRelInfo *relinfo);
+extern TupleTableSlot *ExecBRInsertTriggers(EState *estate,
+					 ResultRelInfo *relinfo,
+					 TupleTableSlot *slot);
+extern void ExecARInsertTriggers(EState *estate,
+					 ResultRelInfo *relinfo,
+					 HeapTuple trigtuple,
+					 List *recheckIndexes);
+extern TupleTableSlot *ExecIRInsertTriggers(EState *estate,
+					 ResultRelInfo *relinfo,
+					 TupleTableSlot *slot);
+extern void ExecBSDeleteTriggers(EState *estate,
+					 ResultRelInfo *relinfo);
+extern void ExecASDeleteTriggers(EState *estate,
+					 ResultRelInfo *relinfo);
+extern bool ExecBRDeleteTriggers(EState *estate,
+					 EPQState *epqstate,
+					 ResultRelInfo *relinfo,
+					 ItemPointer tupleid,
+					 HeapTuple fdw_trigtuple);
+extern void ExecARDeleteTriggers(EState *estate,
+					 ResultRelInfo *relinfo,
+					 ItemPointer tupleid,
+					 HeapTuple fdw_trigtuple);
+extern bool ExecIRDeleteTriggers(EState *estate,
+					 ResultRelInfo *relinfo,
+					 HeapTuple trigtuple);
+extern void ExecBSUpdateTriggers(EState *estate,
+					 ResultRelInfo *relinfo);
+extern void ExecASUpdateTriggers(EState *estate,
+					 ResultRelInfo *relinfo);
+extern TupleTableSlot *ExecBRUpdateTriggers(EState *estate,
+					 EPQState *epqstate,
+					 ResultRelInfo *relinfo,
+					 ItemPointer tupleid,
+					 HeapTuple fdw_trigtuple,
+					 TupleTableSlot *slot);
+extern void ExecARUpdateTriggers(EState *estate,
+					 ResultRelInfo *relinfo,
+					 ItemPointer tupleid,
+					 HeapTuple fdw_trigtuple,
+					 HeapTuple newtuple,
+					 List *recheckIndexes);
+extern TupleTableSlot *ExecIRUpdateTriggers(EState *estate,
+					 ResultRelInfo *relinfo,
+					 HeapTuple trigtuple,
+					 TupleTableSlot *slot);
+extern void ExecBSTruncateTriggers(EState *estate,
+					   ResultRelInfo *relinfo);
+extern void ExecASTruncateTriggers(EState *estate,
+					   ResultRelInfo *relinfo);
+
+extern void AfterTriggerBeginXact(void);
+extern void AfterTriggerBeginQuery(void);
+extern void AfterTriggerEndQuery(EState *estate);
+extern void AfterTriggerFireDeferred(void);
+extern void AfterTriggerEndXact(bool isCommit);
+extern void AfterTriggerBeginSubXact(void);
+extern void AfterTriggerEndSubXact(bool isCommit);
+extern void AfterTriggerSetState(ConstraintsSetStmt *stmt);
+extern bool AfterTriggerPendingOnRel(Oid relid);
+
+
+/*
+ * in utils/adt/ri_triggers.c
+ */
+extern bool RI_FKey_pk_upd_check_required(Trigger *trigger, Relation pk_rel,
+							  HeapTuple old_row, HeapTuple new_row);
+extern bool RI_FKey_fk_upd_check_required(Trigger *trigger, Relation fk_rel,
+							  HeapTuple old_row, HeapTuple new_row);
+extern bool RI_Initial_Check(Trigger *trigger,
+				 Relation fk_rel, Relation pk_rel);
+
+/* result values for RI_FKey_trigger_type: */
+#define RI_TRIGGER_PK	1		/* is a trigger on the PK relation */
+#define RI_TRIGGER_FK	2		/* is a trigger on the FK relation */
+#define RI_TRIGGER_NONE 0		/* is not an RI trigger function */
+
+extern int	RI_FKey_trigger_type(Oid tgfoid);
+
+extern Datum pg_trigger_depth(PG_FUNCTION_ARGS);
+
+#endif   /* TRIGGER_H */
diff --git a/foreign/libpg_query/src/postgres/include/commands/vacuum.h b/foreign/libpg_query/src/postgres/include/commands/vacuum.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/commands/vacuum.h
@@ -0,0 +1,206 @@
+/*-------------------------------------------------------------------------
+ *
+ * vacuum.h
+ *	  header file for postgres vacuum cleaner and statistics analyzer
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/commands/vacuum.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef VACUUM_H
+#define VACUUM_H
+
+#include "access/htup.h"
+#include "catalog/pg_statistic.h"
+#include "catalog/pg_type.h"
+#include "nodes/parsenodes.h"
+#include "storage/buf.h"
+#include "storage/lock.h"
+#include "utils/relcache.h"
+
+
+/*----------
+ * ANALYZE builds one of these structs for each attribute (column) that is
+ * to be analyzed.  The struct and subsidiary data are in anl_context,
+ * so they live until the end of the ANALYZE operation.
+ *
+ * The type-specific typanalyze function is passed a pointer to this struct
+ * and must return TRUE to continue analysis, FALSE to skip analysis of this
+ * column.  In the TRUE case it must set the compute_stats and minrows fields,
+ * and can optionally set extra_data to pass additional info to compute_stats.
+ * minrows is its request for the minimum number of sample rows to be gathered
+ * (but note this request might not be honored, eg if there are fewer rows
+ * than that in the table).
+ *
+ * The compute_stats routine will be called after sample rows have been
+ * gathered.  Aside from this struct, it is passed:
+ *		fetchfunc: a function for accessing the column values from the
+ *				   sample rows
+ *		samplerows: the number of sample tuples
+ *		totalrows: estimated total number of rows in relation
+ * The fetchfunc may be called with rownum running from 0 to samplerows-1.
+ * It returns a Datum and an isNull flag.
+ *
+ * compute_stats should set stats_valid TRUE if it is able to compute
+ * any useful statistics.  If it does, the remainder of the struct holds
+ * the information to be stored in a pg_statistic row for the column.  Be
+ * careful to allocate any pointed-to data in anl_context, which will NOT
+ * be CurrentMemoryContext when compute_stats is called.
+ *
+ * Note: for the moment, all comparisons done for statistical purposes
+ * should use the database's default collation (DEFAULT_COLLATION_OID).
+ * This might change in some future release.
+ *----------
+ */
+typedef struct VacAttrStats *VacAttrStatsP;
+
+typedef Datum (*AnalyzeAttrFetchFunc) (VacAttrStatsP stats, int rownum,
+												   bool *isNull);
+
+typedef void (*AnalyzeAttrComputeStatsFunc) (VacAttrStatsP stats,
+											  AnalyzeAttrFetchFunc fetchfunc,
+														 int samplerows,
+														 double totalrows);
+
+typedef struct VacAttrStats
+{
+	/*
+	 * These fields are set up by the main ANALYZE code before invoking the
+	 * type-specific typanalyze function.
+	 *
+	 * Note: do not assume that the data being analyzed has the same datatype
+	 * shown in attr, ie do not trust attr->atttypid, attlen, etc.  This is
+	 * because some index opclasses store a different type than the underlying
+	 * column/expression.  Instead use attrtypid, attrtypmod, and attrtype for
+	 * information about the datatype being fed to the typanalyze function.
+	 */
+	Form_pg_attribute attr;		/* copy of pg_attribute row for column */
+	Oid			attrtypid;		/* type of data being analyzed */
+	int32		attrtypmod;		/* typmod of data being analyzed */
+	Form_pg_type attrtype;		/* copy of pg_type row for attrtypid */
+	MemoryContext anl_context;	/* where to save long-lived data */
+
+	/*
+	 * These fields must be filled in by the typanalyze routine, unless it
+	 * returns FALSE.
+	 */
+	AnalyzeAttrComputeStatsFunc compute_stats;	/* function pointer */
+	int			minrows;		/* Minimum # of rows wanted for stats */
+	void	   *extra_data;		/* for extra type-specific data */
+
+	/*
+	 * These fields are to be filled in by the compute_stats routine. (They
+	 * are initialized to zero when the struct is created.)
+	 */
+	bool		stats_valid;
+	float4		stanullfrac;	/* fraction of entries that are NULL */
+	int32		stawidth;		/* average width of column values */
+	float4		stadistinct;	/* # distinct values */
+	int16		stakind[STATISTIC_NUM_SLOTS];
+	Oid			staop[STATISTIC_NUM_SLOTS];
+	int			numnumbers[STATISTIC_NUM_SLOTS];
+	float4	   *stanumbers[STATISTIC_NUM_SLOTS];
+	int			numvalues[STATISTIC_NUM_SLOTS];
+	Datum	   *stavalues[STATISTIC_NUM_SLOTS];
+
+	/*
+	 * These fields describe the stavalues[n] element types. They will be
+	 * initialized to match attrtypid, but a custom typanalyze function might
+	 * want to store an array of something other than the analyzed column's
+	 * elements. It should then overwrite these fields.
+	 */
+	Oid			statypid[STATISTIC_NUM_SLOTS];
+	int16		statyplen[STATISTIC_NUM_SLOTS];
+	bool		statypbyval[STATISTIC_NUM_SLOTS];
+	char		statypalign[STATISTIC_NUM_SLOTS];
+
+	/*
+	 * These fields are private to the main ANALYZE code and should not be
+	 * looked at by type-specific functions.
+	 */
+	int			tupattnum;		/* attribute number within tuples */
+	HeapTuple  *rows;			/* access info for std fetch function */
+	TupleDesc	tupDesc;
+	Datum	   *exprvals;		/* access info for index fetch function */
+	bool	   *exprnulls;
+	int			rowstride;
+} VacAttrStats;
+
+/*
+ * Parameters customizing behavior of VACUUM and ANALYZE.
+ */
+typedef struct VacuumParams
+{
+	int			freeze_min_age; /* min freeze age, -1 to use default */
+	int			freeze_table_age;		/* age at which to scan whole table */
+	int			multixact_freeze_min_age;		/* min multixact freeze age,
+												 * -1 to use default */
+	int			multixact_freeze_table_age;		/* multixact age at which to
+												 * scan whole table */
+	bool		is_wraparound;	/* force a for-wraparound vacuum */
+	int			log_min_duration;		/* minimum execution threshold in ms
+										 * at which  verbose logs are
+										 * activated, -1 to use default */
+} VacuumParams;
+
+/* GUC parameters */
+extern PGDLLIMPORT int default_statistics_target;		/* PGDLLIMPORT for
+														 * PostGIS */
+extern int	vacuum_freeze_min_age;
+extern int	vacuum_freeze_table_age;
+extern int	vacuum_multixact_freeze_min_age;
+extern int	vacuum_multixact_freeze_table_age;
+
+
+/* in commands/vacuum.c */
+extern void ExecVacuum(VacuumStmt *vacstmt, bool isTopLevel);
+extern void vacuum(int options, RangeVar *relation, Oid relid,
+	   VacuumParams *params, List *va_cols,
+	   BufferAccessStrategy bstrategy, bool isTopLevel);
+extern void vac_open_indexes(Relation relation, LOCKMODE lockmode,
+				 int *nindexes, Relation **Irel);
+extern void vac_close_indexes(int nindexes, Relation *Irel, LOCKMODE lockmode);
+extern double vac_estimate_reltuples(Relation relation, bool is_analyze,
+					   BlockNumber total_pages,
+					   BlockNumber scanned_pages,
+					   double scanned_tuples);
+extern void vac_update_relstats(Relation relation,
+					BlockNumber num_pages,
+					double num_tuples,
+					BlockNumber num_all_visible_pages,
+					bool hasindex,
+					TransactionId frozenxid,
+					MultiXactId minmulti,
+					bool in_outer_xact);
+extern void vacuum_set_xid_limits(Relation rel,
+					  int freeze_min_age, int freeze_table_age,
+					  int multixact_freeze_min_age,
+					  int multixact_freeze_table_age,
+					  TransactionId *oldestXmin,
+					  TransactionId *freezeLimit,
+					  TransactionId *xidFullScanLimit,
+					  MultiXactId *multiXactCutoff,
+					  MultiXactId *mxactFullScanLimit);
+extern void vac_update_datfrozenxid(void);
+extern void vacuum_delay_point(void);
+
+/* in commands/vacuumlazy.c */
+extern void lazy_vacuum_rel(Relation onerel, int options,
+				VacuumParams *params, BufferAccessStrategy bstrategy);
+
+/* in commands/analyze.c */
+extern void analyze_rel(Oid relid, RangeVar *relation, int options,
+			VacuumParams *params, List *va_cols, bool in_outer_xact,
+			BufferAccessStrategy bstrategy);
+extern bool std_typanalyze(VacAttrStats *stats);
+
+/* in utils/misc/sampling.c --- duplicate of declarations in utils/sampling.h */
+extern double anl_random_fract(void);
+extern double anl_init_selection_state(int n);
+extern double anl_get_next_S(double t, int n, double *stateptr);
+
+#endif   /* VACUUM_H */
diff --git a/foreign/libpg_query/src/postgres/include/commands/variable.h b/foreign/libpg_query/src/postgres/include/commands/variable.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/commands/variable.h
@@ -0,0 +1,40 @@
+/*
+ * variable.h
+ *		Routines for handling specialized SET variables.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/commands/variable.h
+ */
+#ifndef VARIABLE_H
+#define VARIABLE_H
+
+#include "utils/guc.h"
+
+
+extern bool check_datestyle(char **newval, void **extra, GucSource source);
+extern void assign_datestyle(const char *newval, void *extra);
+extern bool check_timezone(char **newval, void **extra, GucSource source);
+extern void assign_timezone(const char *newval, void *extra);
+extern const char *show_timezone(void);
+extern bool check_log_timezone(char **newval, void **extra, GucSource source);
+extern void assign_log_timezone(const char *newval, void *extra);
+extern const char *show_log_timezone(void);
+extern bool check_transaction_read_only(bool *newval, void **extra, GucSource source);
+extern bool check_XactIsoLevel(char **newval, void **extra, GucSource source);
+extern void assign_XactIsoLevel(const char *newval, void *extra);
+extern const char *show_XactIsoLevel(void);
+extern bool check_transaction_deferrable(bool *newval, void **extra, GucSource source);
+extern bool check_random_seed(double *newval, void **extra, GucSource source);
+extern void assign_random_seed(double newval, void *extra);
+extern const char *show_random_seed(void);
+extern bool check_client_encoding(char **newval, void **extra, GucSource source);
+extern void assign_client_encoding(const char *newval, void *extra);
+extern bool check_session_authorization(char **newval, void **extra, GucSource source);
+extern void assign_session_authorization(const char *newval, void *extra);
+extern bool check_role(char **newval, void **extra, GucSource source);
+extern void assign_role(const char *newval, void *extra);
+extern const char *show_role(void);
+
+#endif   /* VARIABLE_H */
diff --git a/foreign/libpg_query/src/postgres/include/common/relpath.h b/foreign/libpg_query/src/postgres/include/common/relpath.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/common/relpath.h
@@ -0,0 +1,74 @@
+/*-------------------------------------------------------------------------
+ *
+ * relpath.h
+ *		Declarations for GetRelationPath() and friends
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/relpath.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef RELPATH_H
+#define RELPATH_H
+
+/*
+ * Stuff for fork names.
+ *
+ * The physical storage of a relation consists of one or more forks.
+ * The main fork is always created, but in addition to that there can be
+ * additional forks for storing various metadata. ForkNumber is used when
+ * we need to refer to a specific fork in a relation.
+ */
+typedef enum ForkNumber
+{
+	InvalidForkNumber = -1,
+	MAIN_FORKNUM = 0,
+	FSM_FORKNUM,
+	VISIBILITYMAP_FORKNUM,
+	INIT_FORKNUM
+
+	/*
+	 * NOTE: if you add a new fork, change MAX_FORKNUM and possibly
+	 * FORKNAMECHARS below, and update the forkNames array in
+	 * src/common/relpath.c
+	 */
+} ForkNumber;
+
+#define MAX_FORKNUM		INIT_FORKNUM
+
+#define FORKNAMECHARS	4		/* max chars for a fork name */
+
+extern const char *const forkNames[];
+
+extern ForkNumber forkname_to_number(const char *forkName);
+extern int	forkname_chars(const char *str, ForkNumber *fork);
+
+/*
+ * Stuff for computing filesystem pathnames for relations.
+ */
+extern char *GetDatabasePath(Oid dbNode, Oid spcNode);
+
+extern char *GetRelationPath(Oid dbNode, Oid spcNode, Oid relNode,
+				int backendId, ForkNumber forkNumber);
+
+/*
+ * Wrapper macros for GetRelationPath.  Beware of multiple
+ * evaluation of the RelFileNode or RelFileNodeBackend argument!
+ */
+
+/* First argument is a RelFileNode */
+#define relpathbackend(rnode, backend, forknum) \
+	GetRelationPath((rnode).dbNode, (rnode).spcNode, (rnode).relNode, \
+					backend, forknum)
+
+/* First argument is a RelFileNode */
+#define relpathperm(rnode, forknum) \
+	relpathbackend(rnode, InvalidBackendId, forknum)
+
+/* First argument is a RelFileNodeBackend */
+#define relpath(rnode, forknum) \
+	relpathbackend((rnode).node, (rnode).backend, forknum)
+
+#endif   /* RELPATH_H */
diff --git a/foreign/libpg_query/src/postgres/include/datatype/timestamp.h b/foreign/libpg_query/src/postgres/include/datatype/timestamp.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/datatype/timestamp.h
@@ -0,0 +1,173 @@
+/*-------------------------------------------------------------------------
+ *
+ * timestamp.h
+ *	  Timestamp and Interval typedefs and related macros.
+ *
+ * Note: this file must be includable in both frontend and backend contexts.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/datatype/timestamp.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef DATATYPE_TIMESTAMP_H
+#define DATATYPE_TIMESTAMP_H
+
+#include <math.h>
+#include <limits.h>
+#include <float.h>
+
+/*
+ * Timestamp represents absolute time.
+ *
+ * Interval represents delta time. Keep track of months (and years), days,
+ * and hours/minutes/seconds separately since the elapsed time spanned is
+ * unknown until instantiated relative to an absolute time.
+ *
+ * Note that Postgres uses "time interval" to mean a bounded interval,
+ * consisting of a beginning and ending time, not a time span - thomas 97/03/20
+ *
+ * We have two implementations, one that uses int64 values with units of
+ * microseconds, and one that uses double values with units of seconds.
+ *
+ * TimeOffset and fsec_t are convenience typedefs for temporary variables
+ * that are of different types in the two cases.  Do not use fsec_t in values
+ * stored on-disk, since it is not the same size in both implementations.
+ * Also, fsec_t is only meant for *fractional* seconds; beware of overflow
+ * if the value you need to store could be many seconds.
+ */
+
+#ifdef HAVE_INT64_TIMESTAMP
+
+typedef int64 Timestamp;
+typedef int64 TimestampTz;
+typedef int64 TimeOffset;
+typedef int32 fsec_t;			/* fractional seconds (in microseconds) */
+#else
+
+typedef double Timestamp;
+typedef double TimestampTz;
+typedef double TimeOffset;
+typedef double fsec_t;			/* fractional seconds (in seconds) */
+#endif
+
+typedef struct
+{
+	TimeOffset	time;			/* all time units other than days, months and
+								 * years */
+	int32		day;			/* days, after time for alignment */
+	int32		month;			/* months and years, after time for alignment */
+} Interval;
+
+
+#define MAX_TIMESTAMP_PRECISION 6
+#define MAX_INTERVAL_PRECISION 6
+
+/*
+ *	Round off to MAX_TIMESTAMP_PRECISION decimal places.
+ *	Note: this is also used for rounding off intervals.
+ */
+#define TS_PREC_INV 1000000.0
+#define TSROUND(j) (rint(((double) (j)) * TS_PREC_INV) / TS_PREC_INV)
+
+
+/*
+ * Assorted constants for datetime-related calculations
+ */
+
+#define DAYS_PER_YEAR	365.25	/* assumes leap year every four years */
+#define MONTHS_PER_YEAR 12
+/*
+ *	DAYS_PER_MONTH is very imprecise.  The more accurate value is
+ *	365.2425/12 = 30.436875, or '30 days 10:29:06'.  Right now we only
+ *	return an integral number of days, but someday perhaps we should
+ *	also return a 'time' value to be used as well.  ISO 8601 suggests
+ *	30 days.
+ */
+#define DAYS_PER_MONTH	30		/* assumes exactly 30 days per month */
+#define HOURS_PER_DAY	24		/* assume no daylight savings time changes */
+
+/*
+ *	This doesn't adjust for uneven daylight savings time intervals or leap
+ *	seconds, and it crudely estimates leap years.  A more accurate value
+ *	for days per years is 365.2422.
+ */
+#define SECS_PER_YEAR	(36525 * 864)	/* avoid floating-point computation */
+#define SECS_PER_DAY	86400
+#define SECS_PER_HOUR	3600
+#define SECS_PER_MINUTE 60
+#define MINS_PER_HOUR	60
+
+#define USECS_PER_DAY	INT64CONST(86400000000)
+#define USECS_PER_HOUR	INT64CONST(3600000000)
+#define USECS_PER_MINUTE INT64CONST(60000000)
+#define USECS_PER_SEC	INT64CONST(1000000)
+
+/*
+ * We allow numeric timezone offsets up to 15:59:59 either way from Greenwich.
+ * Currently, the record holders for wackiest offsets in actual use are zones
+ * Asia/Manila, at -15:56:00 until 1844, and America/Metlakatla, at +15:13:42
+ * until 1867.  If we were to reject such values we would fail to dump and
+ * restore old timestamptz values with these zone settings.
+ */
+#define MAX_TZDISP_HOUR		15	/* maximum allowed hour part */
+#define TZDISP_LIMIT		((MAX_TZDISP_HOUR + 1) * SECS_PER_HOUR)
+
+/*
+ * DT_NOBEGIN represents timestamp -infinity; DT_NOEND represents +infinity
+ */
+#ifdef HAVE_INT64_TIMESTAMP
+#define DT_NOBEGIN		PG_INT64_MIN
+#define DT_NOEND		PG_INT64_MAX
+#else							/* !HAVE_INT64_TIMESTAMP */
+#ifdef HUGE_VAL
+#define DT_NOBEGIN		(-HUGE_VAL)
+#define DT_NOEND		(HUGE_VAL)
+#else
+#define DT_NOBEGIN		(-DBL_MAX)
+#define DT_NOEND		(DBL_MAX)
+#endif
+#endif   /* HAVE_INT64_TIMESTAMP */
+
+#define TIMESTAMP_NOBEGIN(j)	\
+	do {(j) = DT_NOBEGIN;} while (0)
+
+#define TIMESTAMP_IS_NOBEGIN(j) ((j) == DT_NOBEGIN)
+
+#define TIMESTAMP_NOEND(j)		\
+	do {(j) = DT_NOEND;} while (0)
+
+#define TIMESTAMP_IS_NOEND(j)	((j) == DT_NOEND)
+
+#define TIMESTAMP_NOT_FINITE(j) (TIMESTAMP_IS_NOBEGIN(j) || TIMESTAMP_IS_NOEND(j))
+
+
+/*
+ * Julian date support.
+ *
+ * IS_VALID_JULIAN checks the minimum date exactly, but is a bit sloppy
+ * about the maximum, since it's far enough out to not be especially
+ * interesting.
+ */
+
+#define JULIAN_MINYEAR (-4713)
+#define JULIAN_MINMONTH (11)
+#define JULIAN_MINDAY (24)
+#define JULIAN_MAXYEAR (5874898)
+
+#define IS_VALID_JULIAN(y,m,d) \
+	(((y) > JULIAN_MINYEAR \
+	  || ((y) == JULIAN_MINYEAR && \
+		  ((m) > JULIAN_MINMONTH \
+		   || ((m) == JULIAN_MINMONTH && (d) >= JULIAN_MINDAY)))) \
+	 && (y) < JULIAN_MAXYEAR)
+
+#define JULIAN_MAX (2147483494) /* == date2j(JULIAN_MAXYEAR, 1, 1) */
+
+/* Julian-date equivalents of Day 0 in Unix and Postgres reckoning */
+#define UNIX_EPOCH_JDATE		2440588 /* == date2j(1970, 1, 1) */
+#define POSTGRES_EPOCH_JDATE	2451545 /* == date2j(2000, 1, 1) */
+
+#endif   /* DATATYPE_TIMESTAMP_H */
diff --git a/foreign/libpg_query/src/postgres/include/executor/execdesc.h b/foreign/libpg_query/src/postgres/include/executor/execdesc.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/executor/execdesc.h
@@ -0,0 +1,72 @@
+/*-------------------------------------------------------------------------
+ *
+ * execdesc.h
+ *	  plan and query descriptor accessor macros used by the executor
+ *	  and related modules.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/executor/execdesc.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef EXECDESC_H
+#define EXECDESC_H
+
+#include "nodes/execnodes.h"
+#include "tcop/dest.h"
+
+
+/* ----------------
+ *		query descriptor:
+ *
+ *	a QueryDesc encapsulates everything that the executor
+ *	needs to execute the query.
+ *
+ *	For the convenience of SQL-language functions, we also support QueryDescs
+ *	containing utility statements; these must not be passed to the executor
+ *	however.
+ * ---------------------
+ */
+typedef struct QueryDesc
+{
+	/* These fields are provided by CreateQueryDesc */
+	CmdType		operation;		/* CMD_SELECT, CMD_UPDATE, etc. */
+	PlannedStmt *plannedstmt;	/* planner's output, or null if utility */
+	Node	   *utilitystmt;	/* utility statement, or null */
+	const char *sourceText;		/* source text of the query */
+	Snapshot	snapshot;		/* snapshot to use for query */
+	Snapshot	crosscheck_snapshot;	/* crosscheck for RI update/delete */
+	DestReceiver *dest;			/* the destination for tuple output */
+	ParamListInfo params;		/* param values being passed in */
+	int			instrument_options;		/* OR of InstrumentOption flags */
+
+	/* These fields are set by ExecutorStart */
+	TupleDesc	tupDesc;		/* descriptor for result tuples */
+	EState	   *estate;			/* executor's query-wide state */
+	PlanState  *planstate;		/* tree of per-plan-node state */
+
+	/* This is always set NULL by the core system, but plugins can change it */
+	struct Instrumentation *totaltime;	/* total time spent in ExecutorRun */
+} QueryDesc;
+
+/* in pquery.c */
+extern QueryDesc *CreateQueryDesc(PlannedStmt *plannedstmt,
+				const char *sourceText,
+				Snapshot snapshot,
+				Snapshot crosscheck_snapshot,
+				DestReceiver *dest,
+				ParamListInfo params,
+				int instrument_options);
+
+extern QueryDesc *CreateUtilityQueryDesc(Node *utilitystmt,
+					   const char *sourceText,
+					   Snapshot snapshot,
+					   DestReceiver *dest,
+					   ParamListInfo params);
+
+extern void FreeQueryDesc(QueryDesc *qdesc);
+
+#endif   /* EXECDESC_H  */
diff --git a/foreign/libpg_query/src/postgres/include/executor/executor.h b/foreign/libpg_query/src/postgres/include/executor/executor.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/executor/executor.h
@@ -0,0 +1,380 @@
+/*-------------------------------------------------------------------------
+ *
+ * executor.h
+ *	  support for the POSTGRES executor module
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/executor/executor.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef EXECUTOR_H
+#define EXECUTOR_H
+
+#include "executor/execdesc.h"
+#include "nodes/parsenodes.h"
+
+
+/*
+ * The "eflags" argument to ExecutorStart and the various ExecInitNode
+ * routines is a bitwise OR of the following flag bits, which tell the
+ * called plan node what to expect.  Note that the flags will get modified
+ * as they are passed down the plan tree, since an upper node may require
+ * functionality in its subnode not demanded of the plan as a whole
+ * (example: MergeJoin requires mark/restore capability in its inner input),
+ * or an upper node may shield its input from some functionality requirement
+ * (example: Materialize shields its input from needing to do backward scan).
+ *
+ * EXPLAIN_ONLY indicates that the plan tree is being initialized just so
+ * EXPLAIN can print it out; it will not be run.  Hence, no side-effects
+ * of startup should occur.  However, error checks (such as permission checks)
+ * should be performed.
+ *
+ * REWIND indicates that the plan node should try to efficiently support
+ * rescans without parameter changes.  (Nodes must support ExecReScan calls
+ * in any case, but if this flag was not given, they are at liberty to do it
+ * through complete recalculation.  Note that a parameter change forces a
+ * full recalculation in any case.)
+ *
+ * BACKWARD indicates that the plan node must respect the es_direction flag.
+ * When this is not passed, the plan node will only be run forwards.
+ *
+ * MARK indicates that the plan node must support Mark/Restore calls.
+ * When this is not passed, no Mark/Restore will occur.
+ *
+ * SKIP_TRIGGERS tells ExecutorStart/ExecutorFinish to skip calling
+ * AfterTriggerBeginQuery/AfterTriggerEndQuery.  This does not necessarily
+ * mean that the plan can't queue any AFTER triggers; just that the caller
+ * is responsible for there being a trigger context for them to be queued in.
+ *
+ * WITH/WITHOUT_OIDS tell the executor to emit tuples with or without space
+ * for OIDs, respectively.  These are currently used only for CREATE TABLE AS.
+ * If neither is set, the plan may or may not produce tuples including OIDs.
+ */
+#define EXEC_FLAG_EXPLAIN_ONLY	0x0001	/* EXPLAIN, no ANALYZE */
+#define EXEC_FLAG_REWIND		0x0002	/* need efficient rescan */
+#define EXEC_FLAG_BACKWARD		0x0004	/* need backward scan */
+#define EXEC_FLAG_MARK			0x0008	/* need mark/restore */
+#define EXEC_FLAG_SKIP_TRIGGERS 0x0010	/* skip AfterTrigger calls */
+#define EXEC_FLAG_WITH_OIDS		0x0020	/* force OIDs in returned tuples */
+#define EXEC_FLAG_WITHOUT_OIDS	0x0040	/* force no OIDs in returned tuples */
+#define EXEC_FLAG_WITH_NO_DATA	0x0080	/* rel scannability doesn't matter */
+
+
+/*
+ * ExecEvalExpr was formerly a function containing a switch statement;
+ * now it's just a macro invoking the function pointed to by an ExprState
+ * node.  Beware of double evaluation of the ExprState argument!
+ */
+#define ExecEvalExpr(expr, econtext, isNull, isDone) \
+	((*(expr)->evalfunc) (expr, econtext, isNull, isDone))
+
+
+/* Hook for plugins to get control in ExecutorStart() */
+typedef void (*ExecutorStart_hook_type) (QueryDesc *queryDesc, int eflags);
+extern PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook;
+
+/* Hook for plugins to get control in ExecutorRun() */
+typedef void (*ExecutorRun_hook_type) (QueryDesc *queryDesc,
+												   ScanDirection direction,
+												   long count);
+extern PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook;
+
+/* Hook for plugins to get control in ExecutorFinish() */
+typedef void (*ExecutorFinish_hook_type) (QueryDesc *queryDesc);
+extern PGDLLIMPORT ExecutorFinish_hook_type ExecutorFinish_hook;
+
+/* Hook for plugins to get control in ExecutorEnd() */
+typedef void (*ExecutorEnd_hook_type) (QueryDesc *queryDesc);
+extern PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook;
+
+/* Hook for plugins to get control in ExecCheckRTPerms() */
+typedef bool (*ExecutorCheckPerms_hook_type) (List *, bool);
+extern PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook;
+
+
+/*
+ * prototypes from functions in execAmi.c
+ */
+struct Path;					/* avoid including relation.h here */
+
+extern void ExecReScan(PlanState *node);
+extern void ExecMarkPos(PlanState *node);
+extern void ExecRestrPos(PlanState *node);
+extern bool ExecSupportsMarkRestore(struct Path *pathnode);
+extern bool ExecSupportsBackwardScan(Plan *node);
+extern bool ExecMaterializesOutput(NodeTag plantype);
+
+/*
+ * prototypes from functions in execCurrent.c
+ */
+extern bool execCurrentOf(CurrentOfExpr *cexpr,
+			  ExprContext *econtext,
+			  Oid table_oid,
+			  ItemPointer current_tid);
+
+/*
+ * prototypes from functions in execGrouping.c
+ */
+extern bool execTuplesMatch(TupleTableSlot *slot1,
+				TupleTableSlot *slot2,
+				int numCols,
+				AttrNumber *matchColIdx,
+				FmgrInfo *eqfunctions,
+				MemoryContext evalContext);
+extern bool execTuplesUnequal(TupleTableSlot *slot1,
+				  TupleTableSlot *slot2,
+				  int numCols,
+				  AttrNumber *matchColIdx,
+				  FmgrInfo *eqfunctions,
+				  MemoryContext evalContext);
+extern FmgrInfo *execTuplesMatchPrepare(int numCols,
+					   Oid *eqOperators);
+extern void execTuplesHashPrepare(int numCols,
+					  Oid *eqOperators,
+					  FmgrInfo **eqFunctions,
+					  FmgrInfo **hashFunctions);
+extern TupleHashTable BuildTupleHashTable(int numCols, AttrNumber *keyColIdx,
+					FmgrInfo *eqfunctions,
+					FmgrInfo *hashfunctions,
+					long nbuckets, Size entrysize,
+					MemoryContext tablecxt,
+					MemoryContext tempcxt);
+extern TupleHashEntry LookupTupleHashEntry(TupleHashTable hashtable,
+					 TupleTableSlot *slot,
+					 bool *isnew);
+extern TupleHashEntry FindTupleHashEntry(TupleHashTable hashtable,
+				   TupleTableSlot *slot,
+				   FmgrInfo *eqfunctions,
+				   FmgrInfo *hashfunctions);
+
+/*
+ * prototypes from functions in execJunk.c
+ */
+extern JunkFilter *ExecInitJunkFilter(List *targetList, bool hasoid,
+				   TupleTableSlot *slot);
+extern JunkFilter *ExecInitJunkFilterConversion(List *targetList,
+							 TupleDesc cleanTupType,
+							 TupleTableSlot *slot);
+extern AttrNumber ExecFindJunkAttribute(JunkFilter *junkfilter,
+					  const char *attrName);
+extern AttrNumber ExecFindJunkAttributeInTlist(List *targetlist,
+							 const char *attrName);
+extern Datum ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno,
+					 bool *isNull);
+extern TupleTableSlot *ExecFilterJunk(JunkFilter *junkfilter,
+			   TupleTableSlot *slot);
+
+
+/*
+ * prototypes from functions in execMain.c
+ */
+extern void ExecutorStart(QueryDesc *queryDesc, int eflags);
+extern void standard_ExecutorStart(QueryDesc *queryDesc, int eflags);
+extern void ExecutorRun(QueryDesc *queryDesc,
+			ScanDirection direction, long count);
+extern void standard_ExecutorRun(QueryDesc *queryDesc,
+					 ScanDirection direction, long count);
+extern void ExecutorFinish(QueryDesc *queryDesc);
+extern void standard_ExecutorFinish(QueryDesc *queryDesc);
+extern void ExecutorEnd(QueryDesc *queryDesc);
+extern void standard_ExecutorEnd(QueryDesc *queryDesc);
+extern void ExecutorRewind(QueryDesc *queryDesc);
+extern bool ExecCheckRTPerms(List *rangeTable, bool ereport_on_violation);
+extern void CheckValidResultRel(Relation resultRel, CmdType operation);
+extern void InitResultRelInfo(ResultRelInfo *resultRelInfo,
+				  Relation resultRelationDesc,
+				  Index resultRelationIndex,
+				  int instrument_options);
+extern ResultRelInfo *ExecGetTriggerResultRel(EState *estate, Oid relid);
+extern bool ExecContextForcesOids(PlanState *planstate, bool *hasoids);
+extern void ExecConstraints(ResultRelInfo *resultRelInfo,
+				TupleTableSlot *slot, EState *estate);
+extern void ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo,
+					 TupleTableSlot *slot, EState *estate);
+extern LockTupleMode ExecUpdateLockMode(EState *estate, ResultRelInfo *relinfo);
+extern ExecRowMark *ExecFindRowMark(EState *estate, Index rti, bool missing_ok);
+extern ExecAuxRowMark *ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist);
+extern TupleTableSlot *EvalPlanQual(EState *estate, EPQState *epqstate,
+			 Relation relation, Index rti, int lockmode,
+			 ItemPointer tid, TransactionId priorXmax);
+extern HeapTuple EvalPlanQualFetch(EState *estate, Relation relation,
+				  int lockmode, LockWaitPolicy wait_policy, ItemPointer tid,
+				  TransactionId priorXmax);
+extern void EvalPlanQualInit(EPQState *epqstate, EState *estate,
+				 Plan *subplan, List *auxrowmarks, int epqParam);
+extern void EvalPlanQualSetPlan(EPQState *epqstate,
+					Plan *subplan, List *auxrowmarks);
+extern void EvalPlanQualSetTuple(EPQState *epqstate, Index rti,
+					 HeapTuple tuple);
+extern HeapTuple EvalPlanQualGetTuple(EPQState *epqstate, Index rti);
+
+#define EvalPlanQualSetSlot(epqstate, slot)  ((epqstate)->origslot = (slot))
+extern void EvalPlanQualFetchRowMarks(EPQState *epqstate);
+extern TupleTableSlot *EvalPlanQualNext(EPQState *epqstate);
+extern void EvalPlanQualBegin(EPQState *epqstate, EState *parentestate);
+extern void EvalPlanQualEnd(EPQState *epqstate);
+
+/*
+ * prototypes from functions in execProcnode.c
+ */
+extern PlanState *ExecInitNode(Plan *node, EState *estate, int eflags);
+extern TupleTableSlot *ExecProcNode(PlanState *node);
+extern Node *MultiExecProcNode(PlanState *node);
+extern void ExecEndNode(PlanState *node);
+
+/*
+ * prototypes from functions in execQual.c
+ */
+extern Datum GetAttributeByNum(HeapTupleHeader tuple, AttrNumber attrno,
+				  bool *isNull);
+extern Datum GetAttributeByName(HeapTupleHeader tuple, const char *attname,
+				   bool *isNull);
+extern Tuplestorestate *ExecMakeTableFunctionResult(ExprState *funcexpr,
+							ExprContext *econtext,
+							MemoryContext argContext,
+							TupleDesc expectedDesc,
+							bool randomAccess);
+extern Datum ExecEvalExprSwitchContext(ExprState *expression, ExprContext *econtext,
+						  bool *isNull, ExprDoneCond *isDone);
+extern ExprState *ExecInitExpr(Expr *node, PlanState *parent);
+extern ExprState *ExecPrepareExpr(Expr *node, EState *estate);
+extern bool ExecQual(List *qual, ExprContext *econtext, bool resultForNull);
+extern int	ExecTargetListLength(List *targetlist);
+extern int	ExecCleanTargetListLength(List *targetlist);
+extern TupleTableSlot *ExecProject(ProjectionInfo *projInfo,
+			ExprDoneCond *isDone);
+
+/*
+ * prototypes from functions in execScan.c
+ */
+typedef TupleTableSlot *(*ExecScanAccessMtd) (ScanState *node);
+typedef bool (*ExecScanRecheckMtd) (ScanState *node, TupleTableSlot *slot);
+
+extern TupleTableSlot *ExecScan(ScanState *node, ExecScanAccessMtd accessMtd,
+		 ExecScanRecheckMtd recheckMtd);
+extern void ExecAssignScanProjectionInfo(ScanState *node);
+extern void ExecAssignScanProjectionInfoWithVarno(ScanState *node, Index varno);
+extern void ExecScanReScan(ScanState *node);
+
+/*
+ * prototypes from functions in execTuples.c
+ */
+extern void ExecInitResultTupleSlot(EState *estate, PlanState *planstate);
+extern void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate);
+extern TupleTableSlot *ExecInitExtraTupleSlot(EState *estate);
+extern TupleTableSlot *ExecInitNullTupleSlot(EState *estate,
+					  TupleDesc tupType);
+extern TupleDesc ExecTypeFromTL(List *targetList, bool hasoid);
+extern TupleDesc ExecCleanTypeFromTL(List *targetList, bool hasoid);
+extern TupleDesc ExecTypeFromExprList(List *exprList);
+extern void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList);
+extern void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg);
+
+typedef struct TupOutputState
+{
+	TupleTableSlot *slot;
+	DestReceiver *dest;
+} TupOutputState;
+
+extern TupOutputState *begin_tup_output_tupdesc(DestReceiver *dest,
+						 TupleDesc tupdesc);
+extern void do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull);
+extern void do_text_output_multiline(TupOutputState *tstate, char *text);
+extern void end_tup_output(TupOutputState *tstate);
+
+/*
+ * Write a single line of text given as a C string.
+ *
+ * Should only be used with a single-TEXT-attribute tupdesc.
+ */
+#define do_text_output_oneline(tstate, str_to_emit) \
+	do { \
+		Datum	values_[1]; \
+		bool	isnull_[1]; \
+		values_[0] = PointerGetDatum(cstring_to_text(str_to_emit)); \
+		isnull_[0] = false; \
+		do_tup_output(tstate, values_, isnull_); \
+		pfree(DatumGetPointer(values_[0])); \
+	} while (0)
+
+
+/*
+ * prototypes from functions in execUtils.c
+ */
+extern EState *CreateExecutorState(void);
+extern void FreeExecutorState(EState *estate);
+extern ExprContext *CreateExprContext(EState *estate);
+extern ExprContext *CreateStandaloneExprContext(void);
+extern void FreeExprContext(ExprContext *econtext, bool isCommit);
+extern void ReScanExprContext(ExprContext *econtext);
+
+#define ResetExprContext(econtext) \
+	MemoryContextReset((econtext)->ecxt_per_tuple_memory)
+
+extern ExprContext *MakePerTupleExprContext(EState *estate);
+
+/* Get an EState's per-output-tuple exprcontext, making it if first use */
+#define GetPerTupleExprContext(estate) \
+	((estate)->es_per_tuple_exprcontext ? \
+	 (estate)->es_per_tuple_exprcontext : \
+	 MakePerTupleExprContext(estate))
+
+#define GetPerTupleMemoryContext(estate) \
+	(GetPerTupleExprContext(estate)->ecxt_per_tuple_memory)
+
+/* Reset an EState's per-output-tuple exprcontext, if one's been created */
+#define ResetPerTupleExprContext(estate) \
+	do { \
+		if ((estate)->es_per_tuple_exprcontext) \
+			ResetExprContext((estate)->es_per_tuple_exprcontext); \
+	} while (0)
+
+extern void ExecAssignExprContext(EState *estate, PlanState *planstate);
+extern void ExecAssignResultType(PlanState *planstate, TupleDesc tupDesc);
+extern void ExecAssignResultTypeFromTL(PlanState *planstate);
+extern TupleDesc ExecGetResultType(PlanState *planstate);
+extern ProjectionInfo *ExecBuildProjectionInfo(List *targetList,
+						ExprContext *econtext,
+						TupleTableSlot *slot,
+						TupleDesc inputDesc);
+extern void ExecAssignProjectionInfo(PlanState *planstate,
+						 TupleDesc inputDesc);
+extern void ExecFreeExprContext(PlanState *planstate);
+extern TupleDesc ExecGetScanType(ScanState *scanstate);
+extern void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc);
+extern void ExecAssignScanTypeFromOuterPlan(ScanState *scanstate);
+
+extern bool ExecRelationIsTargetRelation(EState *estate, Index scanrelid);
+
+extern Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags);
+extern void ExecCloseScanRelation(Relation scanrel);
+
+extern void RegisterExprContextCallback(ExprContext *econtext,
+							ExprContextCallbackFunction function,
+							Datum arg);
+extern void UnregisterExprContextCallback(ExprContext *econtext,
+							  ExprContextCallbackFunction function,
+							  Datum arg);
+
+/*
+ * prototypes from functions in execIndexing.c
+ */
+extern void ExecOpenIndices(ResultRelInfo *resultRelInfo, bool speculative);
+extern void ExecCloseIndices(ResultRelInfo *resultRelInfo);
+extern List *ExecInsertIndexTuples(TupleTableSlot *slot, ItemPointer tupleid,
+					  EState *estate, bool noDupErr, bool *specConflict,
+					  List *arbiterIndexes);
+extern bool ExecCheckIndexConstraints(TupleTableSlot *slot, EState *estate,
+						  ItemPointer conflictTid, List *arbiterIndexes);
+extern void check_exclusion_constraint(Relation heap, Relation index,
+						   IndexInfo *indexInfo,
+						   ItemPointer tupleid,
+						   Datum *values, bool *isnull,
+						   EState *estate, bool newIndex);
+
+
+#endif   /* EXECUTOR_H  */
diff --git a/foreign/libpg_query/src/postgres/include/executor/functions.h b/foreign/libpg_query/src/postgres/include/executor/functions.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/executor/functions.h
@@ -0,0 +1,39 @@
+/*-------------------------------------------------------------------------
+ *
+ * functions.h
+ *		Declarations for execution of SQL-language functions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/executor/functions.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef FUNCTIONS_H
+#define FUNCTIONS_H
+
+#include "nodes/execnodes.h"
+#include "tcop/dest.h"
+
+/* This struct is known only within executor/functions.c */
+typedef struct SQLFunctionParseInfo *SQLFunctionParseInfoPtr;
+
+extern Datum fmgr_sql(PG_FUNCTION_ARGS);
+
+extern SQLFunctionParseInfoPtr prepare_sql_fn_parse_info(HeapTuple procedureTuple,
+						  Node *call_expr,
+						  Oid inputCollation);
+
+extern void sql_fn_parser_setup(struct ParseState *pstate,
+					SQLFunctionParseInfoPtr pinfo);
+
+extern bool check_sql_fn_retval(Oid func_id, Oid rettype,
+					List *queryTreeList,
+					bool *modifyTargetList,
+					JunkFilter **junkFilter);
+
+extern DestReceiver *CreateSQLFunctionDestReceiver(void);
+
+#endif   /* FUNCTIONS_H */
diff --git a/foreign/libpg_query/src/postgres/include/executor/instrument.h b/foreign/libpg_query/src/postgres/include/executor/instrument.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/executor/instrument.h
@@ -0,0 +1,73 @@
+/*-------------------------------------------------------------------------
+ *
+ * instrument.h
+ *	  definitions for run-time statistics collection
+ *
+ *
+ * Copyright (c) 2001-2015, PostgreSQL Global Development Group
+ *
+ * src/include/executor/instrument.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef INSTRUMENT_H
+#define INSTRUMENT_H
+
+#include "portability/instr_time.h"
+
+
+typedef struct BufferUsage
+{
+	long		shared_blks_hit;	/* # of shared buffer hits */
+	long		shared_blks_read;		/* # of shared disk blocks read */
+	long		shared_blks_dirtied;	/* # of shared blocks dirtied */
+	long		shared_blks_written;	/* # of shared disk blocks written */
+	long		local_blks_hit; /* # of local buffer hits */
+	long		local_blks_read;	/* # of local disk blocks read */
+	long		local_blks_dirtied;		/* # of shared blocks dirtied */
+	long		local_blks_written;		/* # of local disk blocks written */
+	long		temp_blks_read; /* # of temp blocks read */
+	long		temp_blks_written;		/* # of temp blocks written */
+	instr_time	blk_read_time;	/* time spent reading */
+	instr_time	blk_write_time; /* time spent writing */
+} BufferUsage;
+
+/* Flag bits included in InstrAlloc's instrument_options bitmask */
+typedef enum InstrumentOption
+{
+	INSTRUMENT_TIMER = 1 << 0,	/* needs timer (and row counts) */
+	INSTRUMENT_BUFFERS = 1 << 1,	/* needs buffer usage */
+	INSTRUMENT_ROWS = 1 << 2,	/* needs row count */
+	INSTRUMENT_ALL = PG_INT32_MAX
+} InstrumentOption;
+
+typedef struct Instrumentation
+{
+	/* Parameters set at node creation: */
+	bool		need_timer;		/* TRUE if we need timer data */
+	bool		need_bufusage;	/* TRUE if we need buffer usage data */
+	/* Info about current plan cycle: */
+	bool		running;		/* TRUE if we've completed first tuple */
+	instr_time	starttime;		/* Start time of current iteration of node */
+	instr_time	counter;		/* Accumulated runtime for this node */
+	double		firsttuple;		/* Time for first tuple of this cycle */
+	double		tuplecount;		/* Tuples emitted so far this cycle */
+	BufferUsage bufusage_start; /* Buffer usage at start */
+	/* Accumulated statistics across all completed cycles: */
+	double		startup;		/* Total startup time (in seconds) */
+	double		total;			/* Total total time (in seconds) */
+	double		ntuples;		/* Total tuples produced */
+	double		nloops;			/* # of run cycles for this node */
+	double		nfiltered1;		/* # tuples removed by scanqual or joinqual */
+	double		nfiltered2;		/* # tuples removed by "other" quals */
+	BufferUsage bufusage;		/* Total buffer usage */
+} Instrumentation;
+
+extern PGDLLIMPORT BufferUsage pgBufferUsage;
+
+extern Instrumentation *InstrAlloc(int n, int instrument_options);
+extern void InstrStartNode(Instrumentation *instr);
+extern void InstrStopNode(Instrumentation *instr, double nTuples);
+extern void InstrEndLoop(Instrumentation *instr);
+
+#endif   /* INSTRUMENT_H */
diff --git a/foreign/libpg_query/src/postgres/include/executor/spi.h b/foreign/libpg_query/src/postgres/include/executor/spi.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/executor/spi.h
@@ -0,0 +1,150 @@
+/*-------------------------------------------------------------------------
+ *
+ * spi.h
+ *				Server Programming Interface public declarations
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/executor/spi.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef SPI_H
+#define SPI_H
+
+#include "lib/ilist.h"
+#include "nodes/parsenodes.h"
+#include "utils/portal.h"
+
+
+typedef struct SPITupleTable
+{
+	MemoryContext tuptabcxt;	/* memory context of result table */
+	uint32		alloced;		/* # of alloced vals */
+	uint32		free;			/* # of free vals */
+	TupleDesc	tupdesc;		/* tuple descriptor */
+	HeapTuple  *vals;			/* tuples */
+	slist_node	next;			/* link for internal bookkeeping */
+	SubTransactionId subid;		/* subxact in which tuptable was created */
+} SPITupleTable;
+
+/* Plans are opaque structs for standard users of SPI */
+typedef struct _SPI_plan *SPIPlanPtr;
+
+#define SPI_ERROR_CONNECT		(-1)
+#define SPI_ERROR_COPY			(-2)
+#define SPI_ERROR_OPUNKNOWN		(-3)
+#define SPI_ERROR_UNCONNECTED	(-4)
+#define SPI_ERROR_CURSOR		(-5)	/* not used anymore */
+#define SPI_ERROR_ARGUMENT		(-6)
+#define SPI_ERROR_PARAM			(-7)
+#define SPI_ERROR_TRANSACTION	(-8)
+#define SPI_ERROR_NOATTRIBUTE	(-9)
+#define SPI_ERROR_NOOUTFUNC		(-10)
+#define SPI_ERROR_TYPUNKNOWN	(-11)
+
+#define SPI_OK_CONNECT			1
+#define SPI_OK_FINISH			2
+#define SPI_OK_FETCH			3
+#define SPI_OK_UTILITY			4
+#define SPI_OK_SELECT			5
+#define SPI_OK_SELINTO			6
+#define SPI_OK_INSERT			7
+#define SPI_OK_DELETE			8
+#define SPI_OK_UPDATE			9
+#define SPI_OK_CURSOR			10
+#define SPI_OK_INSERT_RETURNING 11
+#define SPI_OK_DELETE_RETURNING 12
+#define SPI_OK_UPDATE_RETURNING 13
+#define SPI_OK_REWRITTEN		14
+
+extern PGDLLIMPORT uint32 SPI_processed;
+extern PGDLLIMPORT Oid SPI_lastoid;
+extern PGDLLIMPORT SPITupleTable *SPI_tuptable;
+extern PGDLLIMPORT int SPI_result;
+
+extern int	SPI_connect(void);
+extern int	SPI_finish(void);
+extern void SPI_push(void);
+extern void SPI_pop(void);
+extern bool SPI_push_conditional(void);
+extern void SPI_pop_conditional(bool pushed);
+extern void SPI_restore_connection(void);
+extern int	SPI_execute(const char *src, bool read_only, long tcount);
+extern int SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls,
+				 bool read_only, long tcount);
+extern int SPI_execute_plan_with_paramlist(SPIPlanPtr plan,
+								ParamListInfo params,
+								bool read_only, long tcount);
+extern int	SPI_exec(const char *src, long tcount);
+extern int SPI_execp(SPIPlanPtr plan, Datum *Values, const char *Nulls,
+		  long tcount);
+extern int SPI_execute_snapshot(SPIPlanPtr plan,
+					 Datum *Values, const char *Nulls,
+					 Snapshot snapshot,
+					 Snapshot crosscheck_snapshot,
+					 bool read_only, bool fire_triggers, long tcount);
+extern int SPI_execute_with_args(const char *src,
+					  int nargs, Oid *argtypes,
+					  Datum *Values, const char *Nulls,
+					  bool read_only, long tcount);
+extern SPIPlanPtr SPI_prepare(const char *src, int nargs, Oid *argtypes);
+extern SPIPlanPtr SPI_prepare_cursor(const char *src, int nargs, Oid *argtypes,
+				   int cursorOptions);
+extern SPIPlanPtr SPI_prepare_params(const char *src,
+				   ParserSetupHook parserSetup,
+				   void *parserSetupArg,
+				   int cursorOptions);
+extern int	SPI_keepplan(SPIPlanPtr plan);
+extern SPIPlanPtr SPI_saveplan(SPIPlanPtr plan);
+extern int	SPI_freeplan(SPIPlanPtr plan);
+
+extern Oid	SPI_getargtypeid(SPIPlanPtr plan, int argIndex);
+extern int	SPI_getargcount(SPIPlanPtr plan);
+extern bool SPI_is_cursor_plan(SPIPlanPtr plan);
+extern bool SPI_plan_is_valid(SPIPlanPtr plan);
+extern const char *SPI_result_code_string(int code);
+
+extern List *SPI_plan_get_plan_sources(SPIPlanPtr plan);
+extern CachedPlan *SPI_plan_get_cached_plan(SPIPlanPtr plan);
+
+extern HeapTuple SPI_copytuple(HeapTuple tuple);
+extern HeapTupleHeader SPI_returntuple(HeapTuple tuple, TupleDesc tupdesc);
+extern HeapTuple SPI_modifytuple(Relation rel, HeapTuple tuple, int natts,
+				int *attnum, Datum *Values, const char *Nulls);
+extern int	SPI_fnumber(TupleDesc tupdesc, const char *fname);
+extern char *SPI_fname(TupleDesc tupdesc, int fnumber);
+extern char *SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber);
+extern Datum SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull);
+extern char *SPI_gettype(TupleDesc tupdesc, int fnumber);
+extern Oid	SPI_gettypeid(TupleDesc tupdesc, int fnumber);
+extern char *SPI_getrelname(Relation rel);
+extern char *SPI_getnspname(Relation rel);
+extern void *SPI_palloc(Size size);
+extern void *SPI_repalloc(void *pointer, Size size);
+extern void SPI_pfree(void *pointer);
+extern Datum SPI_datumTransfer(Datum value, bool typByVal, int typLen);
+extern void SPI_freetuple(HeapTuple pointer);
+extern void SPI_freetuptable(SPITupleTable *tuptable);
+
+extern Portal SPI_cursor_open(const char *name, SPIPlanPtr plan,
+				Datum *Values, const char *Nulls, bool read_only);
+extern Portal SPI_cursor_open_with_args(const char *name,
+						  const char *src,
+						  int nargs, Oid *argtypes,
+						  Datum *Values, const char *Nulls,
+						  bool read_only, int cursorOptions);
+extern Portal SPI_cursor_open_with_paramlist(const char *name, SPIPlanPtr plan,
+							   ParamListInfo params, bool read_only);
+extern Portal SPI_cursor_find(const char *name);
+extern void SPI_cursor_fetch(Portal portal, bool forward, long count);
+extern void SPI_cursor_move(Portal portal, bool forward, long count);
+extern void SPI_scroll_cursor_fetch(Portal, FetchDirection direction, long count);
+extern void SPI_scroll_cursor_move(Portal, FetchDirection direction, long count);
+extern void SPI_cursor_close(Portal portal);
+
+extern void AtEOXact_SPI(bool isCommit);
+extern void AtEOSubXact_SPI(bool isCommit, SubTransactionId mySubid);
+
+#endif   /* SPI_H */
diff --git a/foreign/libpg_query/src/postgres/include/executor/tuptable.h b/foreign/libpg_query/src/postgres/include/executor/tuptable.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/executor/tuptable.h
@@ -0,0 +1,174 @@
+/*-------------------------------------------------------------------------
+ *
+ * tuptable.h
+ *	  tuple table support stuff
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/executor/tuptable.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TUPTABLE_H
+#define TUPTABLE_H
+
+#include "access/htup.h"
+#include "access/tupdesc.h"
+#include "storage/buf.h"
+
+/*----------
+ * The executor stores tuples in a "tuple table" which is a List of
+ * independent TupleTableSlots.  There are several cases we need to handle:
+ *		1. physical tuple in a disk buffer page
+ *		2. physical tuple constructed in palloc'ed memory
+ *		3. "minimal" physical tuple constructed in palloc'ed memory
+ *		4. "virtual" tuple consisting of Datum/isnull arrays
+ *
+ * The first two cases are similar in that they both deal with "materialized"
+ * tuples, but resource management is different.  For a tuple in a disk page
+ * we need to hold a pin on the buffer until the TupleTableSlot's reference
+ * to the tuple is dropped; while for a palloc'd tuple we usually want the
+ * tuple pfree'd when the TupleTableSlot's reference is dropped.
+ *
+ * A "minimal" tuple is handled similarly to a palloc'd regular tuple.
+ * At present, minimal tuples never are stored in buffers, so there is no
+ * parallel to case 1.  Note that a minimal tuple has no "system columns".
+ * (Actually, it could have an OID, but we have no need to access the OID.)
+ *
+ * A "virtual" tuple is an optimization used to minimize physical data
+ * copying in a nest of plan nodes.  Any pass-by-reference Datums in the
+ * tuple point to storage that is not directly associated with the
+ * TupleTableSlot; generally they will point to part of a tuple stored in
+ * a lower plan node's output TupleTableSlot, or to a function result
+ * constructed in a plan node's per-tuple econtext.  It is the responsibility
+ * of the generating plan node to be sure these resources are not released
+ * for as long as the virtual tuple needs to be valid.  We only use virtual
+ * tuples in the result slots of plan nodes --- tuples to be copied anywhere
+ * else need to be "materialized" into physical tuples.  Note also that a
+ * virtual tuple does not have any "system columns".
+ *
+ * It is also possible for a TupleTableSlot to hold both physical and minimal
+ * copies of a tuple.  This is done when the slot is requested to provide
+ * the format other than the one it currently holds.  (Originally we attempted
+ * to handle such requests by replacing one format with the other, but that
+ * had the fatal defect of invalidating any pass-by-reference Datums pointing
+ * into the existing slot contents.)  Both copies must contain identical data
+ * payloads when this is the case.
+ *
+ * The Datum/isnull arrays of a TupleTableSlot serve double duty.  When the
+ * slot contains a virtual tuple, they are the authoritative data.  When the
+ * slot contains a physical tuple, the arrays contain data extracted from
+ * the tuple.  (In this state, any pass-by-reference Datums point into
+ * the physical tuple.)  The extracted information is built "lazily",
+ * ie, only as needed.  This serves to avoid repeated extraction of data
+ * from the physical tuple.
+ *
+ * A TupleTableSlot can also be "empty", holding no valid data.  This is
+ * the only valid state for a freshly-created slot that has not yet had a
+ * tuple descriptor assigned to it.  In this state, tts_isempty must be
+ * TRUE, tts_shouldFree FALSE, tts_tuple NULL, tts_buffer InvalidBuffer,
+ * and tts_nvalid zero.
+ *
+ * The tupleDescriptor is simply referenced, not copied, by the TupleTableSlot
+ * code.  The caller of ExecSetSlotDescriptor() is responsible for providing
+ * a descriptor that will live as long as the slot does.  (Typically, both
+ * slots and descriptors are in per-query memory and are freed by memory
+ * context deallocation at query end; so it's not worth providing any extra
+ * mechanism to do more.  However, the slot will increment the tupdesc
+ * reference count if a reference-counted tupdesc is supplied.)
+ *
+ * When tts_shouldFree is true, the physical tuple is "owned" by the slot
+ * and should be freed when the slot's reference to the tuple is dropped.
+ *
+ * If tts_buffer is not InvalidBuffer, then the slot is holding a pin
+ * on the indicated buffer page; drop the pin when we release the
+ * slot's reference to that buffer.  (tts_shouldFree should always be
+ * false in such a case, since presumably tts_tuple is pointing at the
+ * buffer page.)
+ *
+ * tts_nvalid indicates the number of valid columns in the tts_values/isnull
+ * arrays.  When the slot is holding a "virtual" tuple this must be equal
+ * to the descriptor's natts.  When the slot is holding a physical tuple
+ * this is equal to the number of columns we have extracted (we always
+ * extract columns from left to right, so there are no holes).
+ *
+ * tts_values/tts_isnull are allocated when a descriptor is assigned to the
+ * slot; they are of length equal to the descriptor's natts.
+ *
+ * tts_mintuple must always be NULL if the slot does not hold a "minimal"
+ * tuple.  When it does, tts_mintuple points to the actual MinimalTupleData
+ * object (the thing to be pfree'd if tts_shouldFreeMin is true).  If the slot
+ * has only a minimal and not also a regular physical tuple, then tts_tuple
+ * points at tts_minhdr and the fields of that struct are set correctly
+ * for access to the minimal tuple; in particular, tts_minhdr.t_data points
+ * MINIMAL_TUPLE_OFFSET bytes before tts_mintuple.  This allows column
+ * extraction to treat the case identically to regular physical tuples.
+ *
+ * tts_slow/tts_off are saved state for slot_deform_tuple, and should not
+ * be touched by any other code.
+ *----------
+ */
+typedef struct TupleTableSlot
+{
+	NodeTag		type;
+	bool		tts_isempty;	/* true = slot is empty */
+	bool		tts_shouldFree; /* should pfree tts_tuple? */
+	bool		tts_shouldFreeMin;		/* should pfree tts_mintuple? */
+	bool		tts_slow;		/* saved state for slot_deform_tuple */
+	HeapTuple	tts_tuple;		/* physical tuple, or NULL if virtual */
+	TupleDesc	tts_tupleDescriptor;	/* slot's tuple descriptor */
+	MemoryContext tts_mcxt;		/* slot itself is in this context */
+	Buffer		tts_buffer;		/* tuple's buffer, or InvalidBuffer */
+	int			tts_nvalid;		/* # of valid values in tts_values */
+	Datum	   *tts_values;		/* current per-attribute values */
+	bool	   *tts_isnull;		/* current per-attribute isnull flags */
+	MinimalTuple tts_mintuple;	/* minimal tuple, or NULL if none */
+	HeapTupleData tts_minhdr;	/* workspace for minimal-tuple-only case */
+	long		tts_off;		/* saved state for slot_deform_tuple */
+} TupleTableSlot;
+
+#define TTS_HAS_PHYSICAL_TUPLE(slot)  \
+	((slot)->tts_tuple != NULL && (slot)->tts_tuple != &((slot)->tts_minhdr))
+
+/*
+ * TupIsNull -- is a TupleTableSlot empty?
+ */
+#define TupIsNull(slot) \
+	((slot) == NULL || (slot)->tts_isempty)
+
+/* in executor/execTuples.c */
+extern TupleTableSlot *MakeTupleTableSlot(void);
+extern TupleTableSlot *ExecAllocTableSlot(List **tupleTable);
+extern void ExecResetTupleTable(List *tupleTable, bool shouldFree);
+extern TupleTableSlot *MakeSingleTupleTableSlot(TupleDesc tupdesc);
+extern void ExecDropSingleTupleTableSlot(TupleTableSlot *slot);
+extern void ExecSetSlotDescriptor(TupleTableSlot *slot, TupleDesc tupdesc);
+extern TupleTableSlot *ExecStoreTuple(HeapTuple tuple,
+			   TupleTableSlot *slot,
+			   Buffer buffer,
+			   bool shouldFree);
+extern TupleTableSlot *ExecStoreMinimalTuple(MinimalTuple mtup,
+					  TupleTableSlot *slot,
+					  bool shouldFree);
+extern TupleTableSlot *ExecClearTuple(TupleTableSlot *slot);
+extern TupleTableSlot *ExecStoreVirtualTuple(TupleTableSlot *slot);
+extern TupleTableSlot *ExecStoreAllNullTuple(TupleTableSlot *slot);
+extern HeapTuple ExecCopySlotTuple(TupleTableSlot *slot);
+extern MinimalTuple ExecCopySlotMinimalTuple(TupleTableSlot *slot);
+extern HeapTuple ExecFetchSlotTuple(TupleTableSlot *slot);
+extern MinimalTuple ExecFetchSlotMinimalTuple(TupleTableSlot *slot);
+extern Datum ExecFetchSlotTupleDatum(TupleTableSlot *slot);
+extern HeapTuple ExecMaterializeSlot(TupleTableSlot *slot);
+extern TupleTableSlot *ExecCopySlot(TupleTableSlot *dstslot,
+			 TupleTableSlot *srcslot);
+extern TupleTableSlot *ExecMakeSlotContentsReadOnly(TupleTableSlot *slot);
+
+/* in access/common/heaptuple.c */
+extern Datum slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull);
+extern void slot_getallattrs(TupleTableSlot *slot);
+extern void slot_getsomeattrs(TupleTableSlot *slot, int attnum);
+extern bool slot_attisnull(TupleTableSlot *slot, int attnum);
+
+#endif   /* TUPTABLE_H */
diff --git a/foreign/libpg_query/src/postgres/include/fmgr.h b/foreign/libpg_query/src/postgres/include/fmgr.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/fmgr.h
@@ -0,0 +1,710 @@
+/*-------------------------------------------------------------------------
+ *
+ * fmgr.h
+ *	  Definitions for the Postgres function manager and function-call
+ *	  interface.
+ *
+ * This file must be included by all Postgres modules that either define
+ * or call fmgr-callable functions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/fmgr.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef FMGR_H
+#define FMGR_H
+
+/* We don't want to include primnodes.h here, so make some stub references */
+typedef struct Node *fmNodePtr;
+typedef struct Aggref *fmAggrefPtr;
+
+/* Likewise, avoid including execnodes.h here */
+typedef void (*fmExprContextCallbackFunction) (Datum arg);
+
+/* Likewise, avoid including stringinfo.h here */
+typedef struct StringInfoData *fmStringInfo;
+
+
+/*
+ * All functions that can be called directly by fmgr must have this signature.
+ * (Other functions can be called by using a handler that does have this
+ * signature.)
+ */
+
+typedef struct FunctionCallInfoData *FunctionCallInfo;
+
+typedef Datum (*PGFunction) (FunctionCallInfo fcinfo);
+
+/*
+ * This struct holds the system-catalog information that must be looked up
+ * before a function can be called through fmgr.  If the same function is
+ * to be called multiple times, the lookup need be done only once and the
+ * info struct saved for re-use.
+ *
+ * Note that fn_expr really is parse-time-determined information about the
+ * arguments, rather than about the function itself.  But it's convenient
+ * to store it here rather than in FunctionCallInfoData, where it might more
+ * logically belong.
+ */
+typedef struct FmgrInfo
+{
+	PGFunction	fn_addr;		/* pointer to function or handler to be called */
+	Oid			fn_oid;			/* OID of function (NOT of handler, if any) */
+	short		fn_nargs;		/* number of input args (0..FUNC_MAX_ARGS) */
+	bool		fn_strict;		/* function is "strict" (NULL in => NULL out) */
+	bool		fn_retset;		/* function returns a set */
+	unsigned char fn_stats;		/* collect stats if track_functions > this */
+	void	   *fn_extra;		/* extra space for use by handler */
+	MemoryContext fn_mcxt;		/* memory context to store fn_extra in */
+	fmNodePtr	fn_expr;		/* expression parse tree for call, or NULL */
+} FmgrInfo;
+
+/*
+ * This struct is the data actually passed to an fmgr-called function.
+ */
+typedef struct FunctionCallInfoData
+{
+	FmgrInfo   *flinfo;			/* ptr to lookup info used for this call */
+	fmNodePtr	context;		/* pass info about context of call */
+	fmNodePtr	resultinfo;		/* pass or return extra info about result */
+	Oid			fncollation;	/* collation for function to use */
+	bool		isnull;			/* function must set true if result is NULL */
+	short		nargs;			/* # arguments actually passed */
+	Datum		arg[FUNC_MAX_ARGS];		/* Arguments passed to function */
+	bool		argnull[FUNC_MAX_ARGS]; /* T if arg[i] is actually NULL */
+} FunctionCallInfoData;
+
+/*
+ * This routine fills a FmgrInfo struct, given the OID
+ * of the function to be called.
+ */
+extern void fmgr_info(Oid functionId, FmgrInfo *finfo);
+
+/*
+ * Same, when the FmgrInfo struct is in a memory context longer-lived than
+ * CurrentMemoryContext.  The specified context will be set as fn_mcxt
+ * and used to hold all subsidiary data of finfo.
+ */
+extern void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo,
+			  MemoryContext mcxt);
+
+/* Convenience macro for setting the fn_expr field */
+#define fmgr_info_set_expr(expr, finfo) \
+	((finfo)->fn_expr = (expr))
+
+/*
+ * Copy an FmgrInfo struct
+ */
+extern void fmgr_info_copy(FmgrInfo *dstinfo, FmgrInfo *srcinfo,
+			   MemoryContext destcxt);
+
+/*
+ * This macro initializes all the fields of a FunctionCallInfoData except
+ * for the arg[] and argnull[] arrays.  Performance testing has shown that
+ * the fastest way to set up argnull[] for small numbers of arguments is to
+ * explicitly set each required element to false, so we don't try to zero
+ * out the argnull[] array in the macro.
+ */
+#define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo) \
+	do { \
+		(Fcinfo).flinfo = (Flinfo); \
+		(Fcinfo).context = (Context); \
+		(Fcinfo).resultinfo = (Resultinfo); \
+		(Fcinfo).fncollation = (Collation); \
+		(Fcinfo).isnull = false; \
+		(Fcinfo).nargs = (Nargs); \
+	} while (0)
+
+/*
+ * This macro invokes a function given a filled-in FunctionCallInfoData
+ * struct.  The macro result is the returned Datum --- but note that
+ * caller must still check fcinfo->isnull!	Also, if function is strict,
+ * it is caller's responsibility to verify that no null arguments are present
+ * before calling.
+ */
+#define FunctionCallInvoke(fcinfo)	((* (fcinfo)->flinfo->fn_addr) (fcinfo))
+
+
+/*-------------------------------------------------------------------------
+ *		Support macros to ease writing fmgr-compatible functions
+ *
+ * A C-coded fmgr-compatible function should be declared as
+ *
+ *		Datum
+ *		function_name(PG_FUNCTION_ARGS)
+ *		{
+ *			...
+ *		}
+ *
+ * It should access its arguments using appropriate PG_GETARG_xxx macros
+ * and should return its result using PG_RETURN_xxx.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/* Standard parameter list for fmgr-compatible functions */
+#define PG_FUNCTION_ARGS	FunctionCallInfo fcinfo
+
+/*
+ * Get collation function should use.
+ */
+#define PG_GET_COLLATION()	(fcinfo->fncollation)
+
+/*
+ * Get number of arguments passed to function.
+ */
+#define PG_NARGS() (fcinfo->nargs)
+
+/*
+ * If function is not marked "proisstrict" in pg_proc, it must check for
+ * null arguments using this macro.  Do not try to GETARG a null argument!
+ */
+#define PG_ARGISNULL(n)  (fcinfo->argnull[n])
+
+/*
+ * Support for fetching detoasted copies of toastable datatypes (all of
+ * which are varlena types).  pg_detoast_datum() gives you either the input
+ * datum (if not toasted) or a detoasted copy allocated with palloc().
+ * pg_detoast_datum_copy() always gives you a palloc'd copy --- use it
+ * if you need a modifiable copy of the input.  Caller is expected to have
+ * checked for null inputs first, if necessary.
+ *
+ * pg_detoast_datum_packed() will return packed (1-byte header) datums
+ * unmodified.  It will still expand an externally toasted or compressed datum.
+ * The resulting datum can be accessed using VARSIZE_ANY() and VARDATA_ANY()
+ * (beware of multiple evaluations in those macros!)
+ *
+ * WARNING: It is only safe to use pg_detoast_datum_packed() and
+ * VARDATA_ANY() if you really don't care about the alignment. Either because
+ * you're working with something like text where the alignment doesn't matter
+ * or because you're not going to access its constituent parts and just use
+ * things like memcpy on it anyways.
+ *
+ * Note: it'd be nice if these could be macros, but I see no way to do that
+ * without evaluating the arguments multiple times, which is NOT acceptable.
+ */
+extern struct varlena *pg_detoast_datum(struct varlena * datum);
+extern struct varlena *pg_detoast_datum_copy(struct varlena * datum);
+extern struct varlena *pg_detoast_datum_slice(struct varlena * datum,
+					   int32 first, int32 count);
+extern struct varlena *pg_detoast_datum_packed(struct varlena * datum);
+
+#define PG_DETOAST_DATUM(datum) \
+	pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
+#define PG_DETOAST_DATUM_COPY(datum) \
+	pg_detoast_datum_copy((struct varlena *) DatumGetPointer(datum))
+#define PG_DETOAST_DATUM_SLICE(datum,f,c) \
+		pg_detoast_datum_slice((struct varlena *) DatumGetPointer(datum), \
+		(int32) (f), (int32) (c))
+/* WARNING -- unaligned pointer */
+#define PG_DETOAST_DATUM_PACKED(datum) \
+	pg_detoast_datum_packed((struct varlena *) DatumGetPointer(datum))
+
+/*
+ * Support for cleaning up detoasted copies of inputs.  This must only
+ * be used for pass-by-ref datatypes, and normally would only be used
+ * for toastable types.  If the given pointer is different from the
+ * original argument, assume it's a palloc'd detoasted copy, and pfree it.
+ * NOTE: most functions on toastable types do not have to worry about this,
+ * but we currently require that support functions for indexes not leak
+ * memory.
+ */
+#define PG_FREE_IF_COPY(ptr,n) \
+	do { \
+		if ((Pointer) (ptr) != PG_GETARG_POINTER(n)) \
+			pfree(ptr); \
+	} while (0)
+
+/* Macros for fetching arguments of standard types */
+
+#define PG_GETARG_DATUM(n)	 (fcinfo->arg[n])
+#define PG_GETARG_INT32(n)	 DatumGetInt32(PG_GETARG_DATUM(n))
+#define PG_GETARG_UINT32(n)  DatumGetUInt32(PG_GETARG_DATUM(n))
+#define PG_GETARG_INT16(n)	 DatumGetInt16(PG_GETARG_DATUM(n))
+#define PG_GETARG_UINT16(n)  DatumGetUInt16(PG_GETARG_DATUM(n))
+#define PG_GETARG_CHAR(n)	 DatumGetChar(PG_GETARG_DATUM(n))
+#define PG_GETARG_BOOL(n)	 DatumGetBool(PG_GETARG_DATUM(n))
+#define PG_GETARG_OID(n)	 DatumGetObjectId(PG_GETARG_DATUM(n))
+#define PG_GETARG_POINTER(n) DatumGetPointer(PG_GETARG_DATUM(n))
+#define PG_GETARG_CSTRING(n) DatumGetCString(PG_GETARG_DATUM(n))
+#define PG_GETARG_NAME(n)	 DatumGetName(PG_GETARG_DATUM(n))
+/* these macros hide the pass-by-reference-ness of the datatype: */
+#define PG_GETARG_FLOAT4(n)  DatumGetFloat4(PG_GETARG_DATUM(n))
+#define PG_GETARG_FLOAT8(n)  DatumGetFloat8(PG_GETARG_DATUM(n))
+#define PG_GETARG_INT64(n)	 DatumGetInt64(PG_GETARG_DATUM(n))
+/* use this if you want the raw, possibly-toasted input datum: */
+#define PG_GETARG_RAW_VARLENA_P(n)	((struct varlena *) PG_GETARG_POINTER(n))
+/* use this if you want the input datum de-toasted: */
+#define PG_GETARG_VARLENA_P(n) PG_DETOAST_DATUM(PG_GETARG_DATUM(n))
+/* and this if you can handle 1-byte-header datums: */
+#define PG_GETARG_VARLENA_PP(n) PG_DETOAST_DATUM_PACKED(PG_GETARG_DATUM(n))
+/* DatumGetFoo macros for varlena types will typically look like this: */
+#define DatumGetByteaP(X)			((bytea *) PG_DETOAST_DATUM(X))
+#define DatumGetByteaPP(X)			((bytea *) PG_DETOAST_DATUM_PACKED(X))
+#define DatumGetTextP(X)			((text *) PG_DETOAST_DATUM(X))
+#define DatumGetTextPP(X)			((text *) PG_DETOAST_DATUM_PACKED(X))
+#define DatumGetBpCharP(X)			((BpChar *) PG_DETOAST_DATUM(X))
+#define DatumGetBpCharPP(X)			((BpChar *) PG_DETOAST_DATUM_PACKED(X))
+#define DatumGetVarCharP(X)			((VarChar *) PG_DETOAST_DATUM(X))
+#define DatumGetVarCharPP(X)		((VarChar *) PG_DETOAST_DATUM_PACKED(X))
+#define DatumGetHeapTupleHeader(X)	((HeapTupleHeader) PG_DETOAST_DATUM(X))
+/* And we also offer variants that return an OK-to-write copy */
+#define DatumGetByteaPCopy(X)		((bytea *) PG_DETOAST_DATUM_COPY(X))
+#define DatumGetTextPCopy(X)		((text *) PG_DETOAST_DATUM_COPY(X))
+#define DatumGetBpCharPCopy(X)		((BpChar *) PG_DETOAST_DATUM_COPY(X))
+#define DatumGetVarCharPCopy(X)		((VarChar *) PG_DETOAST_DATUM_COPY(X))
+#define DatumGetHeapTupleHeaderCopy(X)	((HeapTupleHeader) PG_DETOAST_DATUM_COPY(X))
+/* Variants which return n bytes starting at pos. m */
+#define DatumGetByteaPSlice(X,m,n)	((bytea *) PG_DETOAST_DATUM_SLICE(X,m,n))
+#define DatumGetTextPSlice(X,m,n)	((text *) PG_DETOAST_DATUM_SLICE(X,m,n))
+#define DatumGetBpCharPSlice(X,m,n) ((BpChar *) PG_DETOAST_DATUM_SLICE(X,m,n))
+#define DatumGetVarCharPSlice(X,m,n) ((VarChar *) PG_DETOAST_DATUM_SLICE(X,m,n))
+/* GETARG macros for varlena types will typically look like this: */
+#define PG_GETARG_BYTEA_P(n)		DatumGetByteaP(PG_GETARG_DATUM(n))
+#define PG_GETARG_BYTEA_PP(n)		DatumGetByteaPP(PG_GETARG_DATUM(n))
+#define PG_GETARG_TEXT_P(n)			DatumGetTextP(PG_GETARG_DATUM(n))
+#define PG_GETARG_TEXT_PP(n)		DatumGetTextPP(PG_GETARG_DATUM(n))
+#define PG_GETARG_BPCHAR_P(n)		DatumGetBpCharP(PG_GETARG_DATUM(n))
+#define PG_GETARG_BPCHAR_PP(n)		DatumGetBpCharPP(PG_GETARG_DATUM(n))
+#define PG_GETARG_VARCHAR_P(n)		DatumGetVarCharP(PG_GETARG_DATUM(n))
+#define PG_GETARG_VARCHAR_PP(n)		DatumGetVarCharPP(PG_GETARG_DATUM(n))
+#define PG_GETARG_HEAPTUPLEHEADER(n)	DatumGetHeapTupleHeader(PG_GETARG_DATUM(n))
+/* And we also offer variants that return an OK-to-write copy */
+#define PG_GETARG_BYTEA_P_COPY(n)	DatumGetByteaPCopy(PG_GETARG_DATUM(n))
+#define PG_GETARG_TEXT_P_COPY(n)	DatumGetTextPCopy(PG_GETARG_DATUM(n))
+#define PG_GETARG_BPCHAR_P_COPY(n)	DatumGetBpCharPCopy(PG_GETARG_DATUM(n))
+#define PG_GETARG_VARCHAR_P_COPY(n) DatumGetVarCharPCopy(PG_GETARG_DATUM(n))
+#define PG_GETARG_HEAPTUPLEHEADER_COPY(n)	DatumGetHeapTupleHeaderCopy(PG_GETARG_DATUM(n))
+/* And a b-byte slice from position a -also OK to write */
+#define PG_GETARG_BYTEA_P_SLICE(n,a,b) DatumGetByteaPSlice(PG_GETARG_DATUM(n),a,b)
+#define PG_GETARG_TEXT_P_SLICE(n,a,b)  DatumGetTextPSlice(PG_GETARG_DATUM(n),a,b)
+#define PG_GETARG_BPCHAR_P_SLICE(n,a,b) DatumGetBpCharPSlice(PG_GETARG_DATUM(n),a,b)
+#define PG_GETARG_VARCHAR_P_SLICE(n,a,b) DatumGetVarCharPSlice(PG_GETARG_DATUM(n),a,b)
+
+/* To return a NULL do this: */
+#define PG_RETURN_NULL()  \
+	do { fcinfo->isnull = true; return (Datum) 0; } while (0)
+
+/* A few internal functions return void (which is not the same as NULL!) */
+#define PG_RETURN_VOID()	 return (Datum) 0
+
+/* Macros for returning results of standard types */
+
+#define PG_RETURN_DATUM(x)	 return (x)
+#define PG_RETURN_INT32(x)	 return Int32GetDatum(x)
+#define PG_RETURN_UINT32(x)  return UInt32GetDatum(x)
+#define PG_RETURN_INT16(x)	 return Int16GetDatum(x)
+#define PG_RETURN_UINT16(x)  return UInt16GetDatum(x)
+#define PG_RETURN_CHAR(x)	 return CharGetDatum(x)
+#define PG_RETURN_BOOL(x)	 return BoolGetDatum(x)
+#define PG_RETURN_OID(x)	 return ObjectIdGetDatum(x)
+#define PG_RETURN_POINTER(x) return PointerGetDatum(x)
+#define PG_RETURN_CSTRING(x) return CStringGetDatum(x)
+#define PG_RETURN_NAME(x)	 return NameGetDatum(x)
+/* these macros hide the pass-by-reference-ness of the datatype: */
+#define PG_RETURN_FLOAT4(x)  return Float4GetDatum(x)
+#define PG_RETURN_FLOAT8(x)  return Float8GetDatum(x)
+#define PG_RETURN_INT64(x)	 return Int64GetDatum(x)
+/* RETURN macros for other pass-by-ref types will typically look like this: */
+#define PG_RETURN_BYTEA_P(x)   PG_RETURN_POINTER(x)
+#define PG_RETURN_TEXT_P(x)    PG_RETURN_POINTER(x)
+#define PG_RETURN_BPCHAR_P(x)  PG_RETURN_POINTER(x)
+#define PG_RETURN_VARCHAR_P(x) PG_RETURN_POINTER(x)
+#define PG_RETURN_HEAPTUPLEHEADER(x)  return HeapTupleHeaderGetDatum(x)
+
+
+/*-------------------------------------------------------------------------
+ *		Support for detecting call convention of dynamically-loaded functions
+ *
+ * Dynamically loaded functions may use either the version-1 ("new style")
+ * or version-0 ("old style") calling convention.  Version 1 is the call
+ * convention defined in this header file; version 0 is the old "plain C"
+ * convention.  A version-1 function must be accompanied by the macro call
+ *
+ *		PG_FUNCTION_INFO_V1(function_name);
+ *
+ * Note that internal functions do not need this decoration since they are
+ * assumed to be version-1.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+typedef struct
+{
+	int			api_version;	/* specifies call convention version number */
+	/* More fields may be added later, for version numbers > 1. */
+} Pg_finfo_record;
+
+/* Expected signature of an info function */
+typedef const Pg_finfo_record *(*PGFInfoFunction) (void);
+
+/*
+ *	Macro to build an info function associated with the given function name.
+ *	Win32 loadable functions usually link with 'dlltool --export-all', but it
+ *	doesn't hurt to add PGDLLIMPORT in case they don't.
+ */
+#define PG_FUNCTION_INFO_V1(funcname) \
+Datum funcname(PG_FUNCTION_ARGS); \
+extern PGDLLEXPORT const Pg_finfo_record * CppConcat(pg_finfo_,funcname)(void); \
+const Pg_finfo_record * \
+CppConcat(pg_finfo_,funcname) (void) \
+{ \
+	static const Pg_finfo_record my_finfo = { 1 }; \
+	return &my_finfo; \
+} \
+extern int no_such_variable
+
+
+/*-------------------------------------------------------------------------
+ *		Support for verifying backend compatibility of loaded modules
+ *
+ * We require dynamically-loaded modules to include the macro call
+ *		PG_MODULE_MAGIC;
+ * so that we can check for obvious incompatibility, such as being compiled
+ * for a different major PostgreSQL version.
+ *
+ * To compile with versions of PostgreSQL that do not support this,
+ * you may put an #ifdef/#endif test around it.  Note that in a multiple-
+ * source-file module, the macro call should only appear once.
+ *
+ * The specific items included in the magic block are intended to be ones that
+ * are custom-configurable and especially likely to break dynamically loaded
+ * modules if they were compiled with other values.  Also, the length field
+ * can be used to detect definition changes.
+ *
+ * Note: we compare magic blocks with memcmp(), so there had better not be
+ * any alignment pad bytes in them.
+ *
+ * Note: when changing the contents of magic blocks, be sure to adjust the
+ * incompatible_module_error() function in dfmgr.c.
+ *-------------------------------------------------------------------------
+ */
+
+/* Definition of the magic block structure */
+typedef struct
+{
+	int			len;			/* sizeof(this struct) */
+	int			version;		/* PostgreSQL major version */
+	int			funcmaxargs;	/* FUNC_MAX_ARGS */
+	int			indexmaxkeys;	/* INDEX_MAX_KEYS */
+	int			namedatalen;	/* NAMEDATALEN */
+	int			float4byval;	/* FLOAT4PASSBYVAL */
+	int			float8byval;	/* FLOAT8PASSBYVAL */
+} Pg_magic_struct;
+
+/* The actual data block contents */
+#define PG_MODULE_MAGIC_DATA \
+{ \
+	sizeof(Pg_magic_struct), \
+	PG_VERSION_NUM / 100, \
+	FUNC_MAX_ARGS, \
+	INDEX_MAX_KEYS, \
+	NAMEDATALEN, \
+	FLOAT4PASSBYVAL, \
+	FLOAT8PASSBYVAL \
+}
+
+/*
+ * Declare the module magic function.  It needs to be a function as the dlsym
+ * in the backend is only guaranteed to work on functions, not data
+ */
+typedef const Pg_magic_struct *(*PGModuleMagicFunction) (void);
+
+#define PG_MAGIC_FUNCTION_NAME Pg_magic_func
+#define PG_MAGIC_FUNCTION_NAME_STRING "Pg_magic_func"
+
+#define PG_MODULE_MAGIC \
+extern PGDLLEXPORT const Pg_magic_struct *PG_MAGIC_FUNCTION_NAME(void); \
+const Pg_magic_struct * \
+PG_MAGIC_FUNCTION_NAME(void) \
+{ \
+	static const Pg_magic_struct Pg_magic_data = PG_MODULE_MAGIC_DATA; \
+	return &Pg_magic_data; \
+} \
+extern int no_such_variable
+
+
+/*-------------------------------------------------------------------------
+ *		Support routines and macros for callers of fmgr-compatible functions
+ *-------------------------------------------------------------------------
+ */
+
+/* These are for invocation of a specifically named function with a
+ * directly-computed parameter list.  Note that neither arguments nor result
+ * are allowed to be NULL.
+ */
+extern Datum DirectFunctionCall1Coll(PGFunction func, Oid collation,
+						Datum arg1);
+extern Datum DirectFunctionCall2Coll(PGFunction func, Oid collation,
+						Datum arg1, Datum arg2);
+extern Datum DirectFunctionCall3Coll(PGFunction func, Oid collation,
+						Datum arg1, Datum arg2,
+						Datum arg3);
+extern Datum DirectFunctionCall4Coll(PGFunction func, Oid collation,
+						Datum arg1, Datum arg2,
+						Datum arg3, Datum arg4);
+extern Datum DirectFunctionCall5Coll(PGFunction func, Oid collation,
+						Datum arg1, Datum arg2,
+						Datum arg3, Datum arg4, Datum arg5);
+extern Datum DirectFunctionCall6Coll(PGFunction func, Oid collation,
+						Datum arg1, Datum arg2,
+						Datum arg3, Datum arg4, Datum arg5,
+						Datum arg6);
+extern Datum DirectFunctionCall7Coll(PGFunction func, Oid collation,
+						Datum arg1, Datum arg2,
+						Datum arg3, Datum arg4, Datum arg5,
+						Datum arg6, Datum arg7);
+extern Datum DirectFunctionCall8Coll(PGFunction func, Oid collation,
+						Datum arg1, Datum arg2,
+						Datum arg3, Datum arg4, Datum arg5,
+						Datum arg6, Datum arg7, Datum arg8);
+extern Datum DirectFunctionCall9Coll(PGFunction func, Oid collation,
+						Datum arg1, Datum arg2,
+						Datum arg3, Datum arg4, Datum arg5,
+						Datum arg6, Datum arg7, Datum arg8,
+						Datum arg9);
+
+/* These are for invocation of a previously-looked-up function with a
+ * directly-computed parameter list.  Note that neither arguments nor result
+ * are allowed to be NULL.
+ */
+extern Datum FunctionCall1Coll(FmgrInfo *flinfo, Oid collation,
+				  Datum arg1);
+extern Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation,
+				  Datum arg1, Datum arg2);
+extern Datum FunctionCall3Coll(FmgrInfo *flinfo, Oid collation,
+				  Datum arg1, Datum arg2,
+				  Datum arg3);
+extern Datum FunctionCall4Coll(FmgrInfo *flinfo, Oid collation,
+				  Datum arg1, Datum arg2,
+				  Datum arg3, Datum arg4);
+extern Datum FunctionCall5Coll(FmgrInfo *flinfo, Oid collation,
+				  Datum arg1, Datum arg2,
+				  Datum arg3, Datum arg4, Datum arg5);
+extern Datum FunctionCall6Coll(FmgrInfo *flinfo, Oid collation,
+				  Datum arg1, Datum arg2,
+				  Datum arg3, Datum arg4, Datum arg5,
+				  Datum arg6);
+extern Datum FunctionCall7Coll(FmgrInfo *flinfo, Oid collation,
+				  Datum arg1, Datum arg2,
+				  Datum arg3, Datum arg4, Datum arg5,
+				  Datum arg6, Datum arg7);
+extern Datum FunctionCall8Coll(FmgrInfo *flinfo, Oid collation,
+				  Datum arg1, Datum arg2,
+				  Datum arg3, Datum arg4, Datum arg5,
+				  Datum arg6, Datum arg7, Datum arg8);
+extern Datum FunctionCall9Coll(FmgrInfo *flinfo, Oid collation,
+				  Datum arg1, Datum arg2,
+				  Datum arg3, Datum arg4, Datum arg5,
+				  Datum arg6, Datum arg7, Datum arg8,
+				  Datum arg9);
+
+/* These are for invocation of a function identified by OID with a
+ * directly-computed parameter list.  Note that neither arguments nor result
+ * are allowed to be NULL.  These are essentially fmgr_info() followed by
+ * FunctionCallN().  If the same function is to be invoked repeatedly, do the
+ * fmgr_info() once and then use FunctionCallN().
+ */
+extern Datum OidFunctionCall0Coll(Oid functionId, Oid collation);
+extern Datum OidFunctionCall1Coll(Oid functionId, Oid collation,
+					 Datum arg1);
+extern Datum OidFunctionCall2Coll(Oid functionId, Oid collation,
+					 Datum arg1, Datum arg2);
+extern Datum OidFunctionCall3Coll(Oid functionId, Oid collation,
+					 Datum arg1, Datum arg2,
+					 Datum arg3);
+extern Datum OidFunctionCall4Coll(Oid functionId, Oid collation,
+					 Datum arg1, Datum arg2,
+					 Datum arg3, Datum arg4);
+extern Datum OidFunctionCall5Coll(Oid functionId, Oid collation,
+					 Datum arg1, Datum arg2,
+					 Datum arg3, Datum arg4, Datum arg5);
+extern Datum OidFunctionCall6Coll(Oid functionId, Oid collation,
+					 Datum arg1, Datum arg2,
+					 Datum arg3, Datum arg4, Datum arg5,
+					 Datum arg6);
+extern Datum OidFunctionCall7Coll(Oid functionId, Oid collation,
+					 Datum arg1, Datum arg2,
+					 Datum arg3, Datum arg4, Datum arg5,
+					 Datum arg6, Datum arg7);
+extern Datum OidFunctionCall8Coll(Oid functionId, Oid collation,
+					 Datum arg1, Datum arg2,
+					 Datum arg3, Datum arg4, Datum arg5,
+					 Datum arg6, Datum arg7, Datum arg8);
+extern Datum OidFunctionCall9Coll(Oid functionId, Oid collation,
+					 Datum arg1, Datum arg2,
+					 Datum arg3, Datum arg4, Datum arg5,
+					 Datum arg6, Datum arg7, Datum arg8,
+					 Datum arg9);
+
+/* These macros allow the collation argument to be omitted (with a default of
+ * InvalidOid, ie, no collation).  They exist mostly for backwards
+ * compatibility of source code.
+ */
+#define DirectFunctionCall1(func, arg1) \
+	DirectFunctionCall1Coll(func, InvalidOid, arg1)
+#define DirectFunctionCall2(func, arg1, arg2) \
+	DirectFunctionCall2Coll(func, InvalidOid, arg1, arg2)
+#define DirectFunctionCall3(func, arg1, arg2, arg3) \
+	DirectFunctionCall3Coll(func, InvalidOid, arg1, arg2, arg3)
+#define DirectFunctionCall4(func, arg1, arg2, arg3, arg4) \
+	DirectFunctionCall4Coll(func, InvalidOid, arg1, arg2, arg3, arg4)
+#define DirectFunctionCall5(func, arg1, arg2, arg3, arg4, arg5) \
+	DirectFunctionCall5Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5)
+#define DirectFunctionCall6(func, arg1, arg2, arg3, arg4, arg5, arg6) \
+	DirectFunctionCall6Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)
+#define DirectFunctionCall7(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
+	DirectFunctionCall7Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
+#define DirectFunctionCall8(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
+	DirectFunctionCall8Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
+#define DirectFunctionCall9(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
+	DirectFunctionCall9Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
+#define FunctionCall1(flinfo, arg1) \
+	FunctionCall1Coll(flinfo, InvalidOid, arg1)
+#define FunctionCall2(flinfo, arg1, arg2) \
+	FunctionCall2Coll(flinfo, InvalidOid, arg1, arg2)
+#define FunctionCall3(flinfo, arg1, arg2, arg3) \
+	FunctionCall3Coll(flinfo, InvalidOid, arg1, arg2, arg3)
+#define FunctionCall4(flinfo, arg1, arg2, arg3, arg4) \
+	FunctionCall4Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4)
+#define FunctionCall5(flinfo, arg1, arg2, arg3, arg4, arg5) \
+	FunctionCall5Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5)
+#define FunctionCall6(flinfo, arg1, arg2, arg3, arg4, arg5, arg6) \
+	FunctionCall6Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)
+#define FunctionCall7(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
+	FunctionCall7Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
+#define FunctionCall8(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
+	FunctionCall8Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
+#define FunctionCall9(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
+	FunctionCall9Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
+#define OidFunctionCall0(functionId) \
+	OidFunctionCall0Coll(functionId, InvalidOid)
+#define OidFunctionCall1(functionId, arg1) \
+	OidFunctionCall1Coll(functionId, InvalidOid, arg1)
+#define OidFunctionCall2(functionId, arg1, arg2) \
+	OidFunctionCall2Coll(functionId, InvalidOid, arg1, arg2)
+#define OidFunctionCall3(functionId, arg1, arg2, arg3) \
+	OidFunctionCall3Coll(functionId, InvalidOid, arg1, arg2, arg3)
+#define OidFunctionCall4(functionId, arg1, arg2, arg3, arg4) \
+	OidFunctionCall4Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4)
+#define OidFunctionCall5(functionId, arg1, arg2, arg3, arg4, arg5) \
+	OidFunctionCall5Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5)
+#define OidFunctionCall6(functionId, arg1, arg2, arg3, arg4, arg5, arg6) \
+	OidFunctionCall6Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)
+#define OidFunctionCall7(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
+	OidFunctionCall7Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
+#define OidFunctionCall8(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
+	OidFunctionCall8Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
+#define OidFunctionCall9(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
+	OidFunctionCall9Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
+
+
+/* Special cases for convenient invocation of datatype I/O functions. */
+extern Datum InputFunctionCall(FmgrInfo *flinfo, char *str,
+				  Oid typioparam, int32 typmod);
+extern Datum OidInputFunctionCall(Oid functionId, char *str,
+					 Oid typioparam, int32 typmod);
+extern char *OutputFunctionCall(FmgrInfo *flinfo, Datum val);
+extern char *OidOutputFunctionCall(Oid functionId, Datum val);
+extern Datum ReceiveFunctionCall(FmgrInfo *flinfo, fmStringInfo buf,
+					Oid typioparam, int32 typmod);
+extern Datum OidReceiveFunctionCall(Oid functionId, fmStringInfo buf,
+					   Oid typioparam, int32 typmod);
+extern bytea *SendFunctionCall(FmgrInfo *flinfo, Datum val);
+extern bytea *OidSendFunctionCall(Oid functionId, Datum val);
+
+
+/*
+ * Routines in fmgr.c
+ */
+extern const Pg_finfo_record *fetch_finfo_record(void *filehandle, char *funcname);
+extern void clear_external_function_hash(void *filehandle);
+extern Oid	fmgr_internal_function(const char *proname);
+extern Oid	get_fn_expr_rettype(FmgrInfo *flinfo);
+extern Oid	get_fn_expr_argtype(FmgrInfo *flinfo, int argnum);
+extern Oid	get_call_expr_argtype(fmNodePtr expr, int argnum);
+extern bool get_fn_expr_arg_stable(FmgrInfo *flinfo, int argnum);
+extern bool get_call_expr_arg_stable(fmNodePtr expr, int argnum);
+extern bool get_fn_expr_variadic(FmgrInfo *flinfo);
+extern bool CheckFunctionValidatorAccess(Oid validatorOid, Oid functionOid);
+
+/*
+ * Routines in dfmgr.c
+ */
+extern char *Dynamic_library_path;
+
+extern PGFunction load_external_function(char *filename, char *funcname,
+					   bool signalNotFound, void **filehandle);
+extern PGFunction lookup_external_function(void *filehandle, char *funcname);
+extern void load_file(const char *filename, bool restricted);
+extern void **find_rendezvous_variable(const char *varName);
+extern Size EstimateLibraryStateSpace(void);
+extern void SerializeLibraryState(Size maxsize, char *start_address);
+extern void RestoreLibraryState(char *start_address);
+
+/*
+ * Support for aggregate functions
+ *
+ * These are actually in executor/nodeAgg.c, but we declare them here since
+ * the whole point is for callers to not be overly friendly with nodeAgg.
+ */
+
+/* AggCheckCallContext can return one of the following codes, or 0: */
+#define AGG_CONTEXT_AGGREGATE	1		/* regular aggregate */
+#define AGG_CONTEXT_WINDOW		2		/* window function */
+
+extern int AggCheckCallContext(FunctionCallInfo fcinfo,
+					MemoryContext *aggcontext);
+extern fmAggrefPtr AggGetAggref(FunctionCallInfo fcinfo);
+extern MemoryContext AggGetTempMemoryContext(FunctionCallInfo fcinfo);
+extern void AggRegisterCallback(FunctionCallInfo fcinfo,
+					fmExprContextCallbackFunction func,
+					Datum arg);
+
+/*
+ * We allow plugin modules to hook function entry/exit.  This is intended
+ * as support for loadable security policy modules, which may want to
+ * perform additional privilege checks on function entry or exit, or to do
+ * other internal bookkeeping.  To make this possible, such modules must be
+ * able not only to support normal function entry and exit, but also to trap
+ * the case where we bail out due to an error; and they must also be able to
+ * prevent inlining.
+ */
+typedef enum FmgrHookEventType
+{
+	FHET_START,
+	FHET_END,
+	FHET_ABORT
+} FmgrHookEventType;
+
+typedef bool (*needs_fmgr_hook_type) (Oid fn_oid);
+
+typedef void (*fmgr_hook_type) (FmgrHookEventType event,
+											FmgrInfo *flinfo, Datum *arg);
+
+extern PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook;
+extern PGDLLIMPORT fmgr_hook_type fmgr_hook;
+
+#define FmgrHookIsNeeded(fn_oid)							\
+	(!needs_fmgr_hook ? false : (*needs_fmgr_hook)(fn_oid))
+
+/*
+ * !!! OLD INTERFACE !!!
+ *
+ * fmgr() is the only remaining vestige of the old-style caller support
+ * functions.  It's no longer used anywhere in the Postgres distribution,
+ * but we should leave it around for a release or two to ease the transition
+ * for user-supplied C functions.  OidFunctionCallN() replaces it for new
+ * code.
+ */
+
+/*
+ * DEPRECATED, DO NOT USE IN NEW CODE
+ */
+extern char *fmgr(Oid procedureId,...);
+
+#endif   /* FMGR_H */
diff --git a/foreign/libpg_query/src/postgres/include/funcapi.h b/foreign/libpg_query/src/postgres/include/funcapi.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/funcapi.h
@@ -0,0 +1,318 @@
+/*-------------------------------------------------------------------------
+ *
+ * funcapi.h
+ *	  Definitions for functions which return composite type and/or sets
+ *
+ * This file must be included by all Postgres modules that either define
+ * or call FUNCAPI-callable functions or macros.
+ *
+ *
+ * Copyright (c) 2002-2015, PostgreSQL Global Development Group
+ *
+ * src/include/funcapi.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef FUNCAPI_H
+#define FUNCAPI_H
+
+#include "fmgr.h"
+#include "access/tupdesc.h"
+#include "executor/executor.h"
+#include "executor/tuptable.h"
+
+
+/*-------------------------------------------------------------------------
+ *	Support to ease writing Functions returning composite types
+ *-------------------------------------------------------------------------
+ *
+ * This struct holds arrays of individual attribute information
+ * needed to create a tuple from raw C strings. It also requires
+ * a copy of the TupleDesc. The information carried here
+ * is derived from the TupleDesc, but it is stored here to
+ * avoid redundant cpu cycles on each call to an SRF.
+ */
+typedef struct AttInMetadata
+{
+	/* full TupleDesc */
+	TupleDesc	tupdesc;
+
+	/* array of attribute type input function finfo */
+	FmgrInfo   *attinfuncs;
+
+	/* array of attribute type i/o parameter OIDs */
+	Oid		   *attioparams;
+
+	/* array of attribute typmod */
+	int32	   *atttypmods;
+} AttInMetadata;
+
+/*-------------------------------------------------------------------------
+ *		Support struct to ease writing Set Returning Functions (SRFs)
+ *-------------------------------------------------------------------------
+ *
+ * This struct holds function context for Set Returning Functions.
+ * Use fn_extra to hold a pointer to it across calls
+ */
+typedef struct FuncCallContext
+{
+	/*
+	 * Number of times we've been called before
+	 *
+	 * call_cntr is initialized to 0 for you by SRF_FIRSTCALL_INIT(), and
+	 * incremented for you every time SRF_RETURN_NEXT() is called.
+	 */
+	uint32		call_cntr;
+
+	/*
+	 * OPTIONAL maximum number of calls
+	 *
+	 * max_calls is here for convenience only and setting it is optional. If
+	 * not set, you must provide alternative means to know when the function
+	 * is done.
+	 */
+	uint32		max_calls;
+
+	/*
+	 * OPTIONAL pointer to result slot
+	 *
+	 * This is obsolete and only present for backwards compatibility, viz,
+	 * user-defined SRFs that use the deprecated TupleDescGetSlot().
+	 */
+	TupleTableSlot *slot;
+
+	/*
+	 * OPTIONAL pointer to miscellaneous user-provided context information
+	 *
+	 * user_fctx is for use as a pointer to your own struct to retain
+	 * arbitrary context information between calls of your function.
+	 */
+	void	   *user_fctx;
+
+	/*
+	 * OPTIONAL pointer to struct containing attribute type input metadata
+	 *
+	 * attinmeta is for use when returning tuples (i.e. composite data types)
+	 * and is not used when returning base data types. It is only needed if
+	 * you intend to use BuildTupleFromCStrings() to create the return tuple.
+	 */
+	AttInMetadata *attinmeta;
+
+	/*
+	 * memory context used for structures that must live for multiple calls
+	 *
+	 * multi_call_memory_ctx is set by SRF_FIRSTCALL_INIT() for you, and used
+	 * by SRF_RETURN_DONE() for cleanup. It is the most appropriate memory
+	 * context for any memory that is to be reused across multiple calls of
+	 * the SRF.
+	 */
+	MemoryContext multi_call_memory_ctx;
+
+	/*
+	 * OPTIONAL pointer to struct containing tuple description
+	 *
+	 * tuple_desc is for use when returning tuples (i.e. composite data types)
+	 * and is only needed if you are going to build the tuples with
+	 * heap_form_tuple() rather than with BuildTupleFromCStrings(). Note that
+	 * the TupleDesc pointer stored here should usually have been run through
+	 * BlessTupleDesc() first.
+	 */
+	TupleDesc	tuple_desc;
+
+} FuncCallContext;
+
+/*----------
+ *	Support to ease writing functions returning composite types
+ *
+ * External declarations:
+ * get_call_result_type:
+ *		Given a function's call info record, determine the kind of datatype
+ *		it is supposed to return.  If resultTypeId isn't NULL, *resultTypeId
+ *		receives the actual datatype OID (this is mainly useful for scalar
+ *		result types).  If resultTupleDesc isn't NULL, *resultTupleDesc
+ *		receives a pointer to a TupleDesc when the result is of a composite
+ *		type, or NULL when it's a scalar result or the rowtype could not be
+ *		determined.  NB: the tupledesc should be copied if it is to be
+ *		accessed over a long period.
+ * get_expr_result_type:
+ *		Given an expression node, return the same info as for
+ *		get_call_result_type.  Note: the cases in which rowtypes cannot be
+ *		determined are different from the cases for get_call_result_type.
+ * get_func_result_type:
+ *		Given only a function's OID, return the same info as for
+ *		get_call_result_type.  Note: the cases in which rowtypes cannot be
+ *		determined are different from the cases for get_call_result_type.
+ *		Do *not* use this if you can use one of the others.
+ *----------
+ */
+
+/* Type categories for get_call_result_type and siblings */
+typedef enum TypeFuncClass
+{
+	TYPEFUNC_SCALAR,			/* scalar result type */
+	TYPEFUNC_COMPOSITE,			/* determinable rowtype result */
+	TYPEFUNC_RECORD,			/* indeterminate rowtype result */
+	TYPEFUNC_OTHER				/* bogus type, eg pseudotype */
+} TypeFuncClass;
+
+extern TypeFuncClass get_call_result_type(FunctionCallInfo fcinfo,
+					 Oid *resultTypeId,
+					 TupleDesc *resultTupleDesc);
+extern TypeFuncClass get_expr_result_type(Node *expr,
+					 Oid *resultTypeId,
+					 TupleDesc *resultTupleDesc);
+extern TypeFuncClass get_func_result_type(Oid functionId,
+					 Oid *resultTypeId,
+					 TupleDesc *resultTupleDesc);
+
+extern bool resolve_polymorphic_argtypes(int numargs, Oid *argtypes,
+							 char *argmodes,
+							 Node *call_expr);
+
+extern int get_func_arg_info(HeapTuple procTup,
+				  Oid **p_argtypes, char ***p_argnames,
+				  char **p_argmodes);
+
+extern int get_func_input_arg_names(Datum proargnames, Datum proargmodes,
+						 char ***arg_names);
+
+extern int	get_func_trftypes(HeapTuple procTup, Oid **p_trftypes);
+extern char *get_func_result_name(Oid functionId);
+
+extern TupleDesc build_function_result_tupdesc_d(Datum proallargtypes,
+								Datum proargmodes,
+								Datum proargnames);
+extern TupleDesc build_function_result_tupdesc_t(HeapTuple procTuple);
+
+
+/*----------
+ *	Support to ease writing functions returning composite types
+ *
+ * External declarations:
+ * TupleDesc BlessTupleDesc(TupleDesc tupdesc) - "Bless" a completed tuple
+ *		descriptor so that it can be used to return properly labeled tuples.
+ *		You need to call this if you are going to use heap_form_tuple directly.
+ *		TupleDescGetAttInMetadata does it for you, however, so no need to call
+ *		it if you call TupleDescGetAttInMetadata.
+ * AttInMetadata *TupleDescGetAttInMetadata(TupleDesc tupdesc) - Build an
+ *		AttInMetadata struct based on the given TupleDesc. AttInMetadata can
+ *		be used in conjunction with C strings to produce a properly formed
+ *		tuple.
+ * HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values) -
+ *		build a HeapTuple given user data in C string form. values is an array
+ *		of C strings, one for each attribute of the return tuple.
+ * Datum HeapTupleHeaderGetDatum(HeapTupleHeader tuple) - convert a
+ *		HeapTupleHeader to a Datum.
+ *
+ * Macro declarations:
+ * HeapTupleGetDatum(HeapTuple tuple) - convert a HeapTuple to a Datum.
+ *
+ * Obsolete routines and macros:
+ * TupleDesc RelationNameGetTupleDesc(const char *relname) - Use to get a
+ *		TupleDesc based on a named relation.
+ * TupleDesc TypeGetTupleDesc(Oid typeoid, List *colaliases) - Use to get a
+ *		TupleDesc based on a type OID.
+ * TupleTableSlot *TupleDescGetSlot(TupleDesc tupdesc) - Builds a
+ *		TupleTableSlot, which is not needed anymore.
+ * TupleGetDatum(TupleTableSlot *slot, HeapTuple tuple) - get a Datum
+ *		given a tuple and a slot.
+ *----------
+ */
+
+#define HeapTupleGetDatum(tuple)		HeapTupleHeaderGetDatum((tuple)->t_data)
+/* obsolete version of above */
+#define TupleGetDatum(_slot, _tuple)	HeapTupleGetDatum(_tuple)
+
+extern TupleDesc RelationNameGetTupleDesc(const char *relname);
+extern TupleDesc TypeGetTupleDesc(Oid typeoid, List *colaliases);
+
+/* from execTuples.c */
+extern TupleDesc BlessTupleDesc(TupleDesc tupdesc);
+extern AttInMetadata *TupleDescGetAttInMetadata(TupleDesc tupdesc);
+extern HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values);
+extern Datum HeapTupleHeaderGetDatum(HeapTupleHeader tuple);
+extern TupleTableSlot *TupleDescGetSlot(TupleDesc tupdesc);
+
+
+/*----------
+ *		Support for Set Returning Functions (SRFs)
+ *
+ * The basic API for SRFs looks something like:
+ *
+ * Datum
+ * my_Set_Returning_Function(PG_FUNCTION_ARGS)
+ * {
+ *	FuncCallContext    *funcctx;
+ *	Datum				result;
+ *	MemoryContext		oldcontext;
+ *	<user defined declarations>
+ *
+ *	if (SRF_IS_FIRSTCALL())
+ *	{
+ *		funcctx = SRF_FIRSTCALL_INIT();
+ *		// switch context when allocating stuff to be used in later calls
+ *		oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
+ *		<user defined code>
+ *		<if returning composite>
+ *			<build TupleDesc, and perhaps AttInMetaData>
+ *		<endif returning composite>
+ *		<user defined code>
+ *		// return to original context when allocating transient memory
+ *		MemoryContextSwitchTo(oldcontext);
+ *	}
+ *	<user defined code>
+ *	funcctx = SRF_PERCALL_SETUP();
+ *	<user defined code>
+ *
+ *	if (funcctx->call_cntr < funcctx->max_calls)
+ *	{
+ *		<user defined code>
+ *		<obtain result Datum>
+ *		SRF_RETURN_NEXT(funcctx, result);
+ *	}
+ *	else
+ *		SRF_RETURN_DONE(funcctx);
+ * }
+ *
+ *----------
+ */
+
+/* from funcapi.c */
+extern FuncCallContext *init_MultiFuncCall(PG_FUNCTION_ARGS);
+extern FuncCallContext *per_MultiFuncCall(PG_FUNCTION_ARGS);
+extern void end_MultiFuncCall(PG_FUNCTION_ARGS, FuncCallContext *funcctx);
+
+#define SRF_IS_FIRSTCALL() (fcinfo->flinfo->fn_extra == NULL)
+
+#define SRF_FIRSTCALL_INIT() init_MultiFuncCall(fcinfo)
+
+#define SRF_PERCALL_SETUP() per_MultiFuncCall(fcinfo)
+
+#define SRF_RETURN_NEXT(_funcctx, _result) \
+	do { \
+		ReturnSetInfo	   *rsi; \
+		(_funcctx)->call_cntr++; \
+		rsi = (ReturnSetInfo *) fcinfo->resultinfo; \
+		rsi->isDone = ExprMultipleResult; \
+		PG_RETURN_DATUM(_result); \
+	} while (0)
+
+#define SRF_RETURN_NEXT_NULL(_funcctx) \
+	do { \
+		ReturnSetInfo	   *rsi; \
+		(_funcctx)->call_cntr++; \
+		rsi = (ReturnSetInfo *) fcinfo->resultinfo; \
+		rsi->isDone = ExprMultipleResult; \
+		PG_RETURN_NULL(); \
+	} while (0)
+
+#define  SRF_RETURN_DONE(_funcctx) \
+	do { \
+		ReturnSetInfo	   *rsi; \
+		end_MultiFuncCall(fcinfo, _funcctx); \
+		rsi = (ReturnSetInfo *) fcinfo->resultinfo; \
+		rsi->isDone = ExprEndResult; \
+		PG_RETURN_NULL(); \
+	} while (0)
+
+#endif   /* FUNCAPI_H */
diff --git a/foreign/libpg_query/src/postgres/include/getaddrinfo.h b/foreign/libpg_query/src/postgres/include/getaddrinfo.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/getaddrinfo.h
@@ -0,0 +1,164 @@
+/*-------------------------------------------------------------------------
+ *
+ * getaddrinfo.h
+ *	  Support getaddrinfo() on platforms that don't have it.
+ *
+ * Note: we use our own routines on platforms that don't HAVE_STRUCT_ADDRINFO,
+ * whether or not the library routine getaddrinfo() can be found.  This
+ * policy is needed because on some platforms a manually installed libbind.a
+ * may provide getaddrinfo(), yet the system headers may not provide the
+ * struct definitions needed to call it.  To avoid conflict with the libbind
+ * definition in such cases, we rename our routines to pg_xxx() via macros.
+ *
+ * This code will also work on platforms where struct addrinfo is defined
+ * in the system headers but no getaddrinfo() can be located.
+ *
+ * Copyright (c) 2003-2015, PostgreSQL Global Development Group
+ *
+ * src/include/getaddrinfo.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef GETADDRINFO_H
+#define GETADDRINFO_H
+
+#include <sys/socket.h>
+#include <netdb.h>
+
+
+/* Various macros that ought to be in <netdb.h>, but might not be */
+
+#ifndef EAI_FAIL
+#ifndef WIN32
+#define EAI_BADFLAGS	(-1)
+#define EAI_NONAME		(-2)
+#define EAI_AGAIN		(-3)
+#define EAI_FAIL		(-4)
+#define EAI_FAMILY		(-6)
+#define EAI_SOCKTYPE	(-7)
+#define EAI_SERVICE		(-8)
+#define EAI_MEMORY		(-10)
+#define EAI_SYSTEM		(-11)
+#else							/* WIN32 */
+#ifdef WIN32_ONLY_COMPILER
+#ifndef WSA_NOT_ENOUGH_MEMORY
+#define WSA_NOT_ENOUGH_MEMORY	(WSAENOBUFS)
+#endif
+#ifndef __BORLANDC__
+#define WSATYPE_NOT_FOUND		(WSABASEERR+109)
+#endif
+#endif
+#define EAI_AGAIN		WSATRY_AGAIN
+#define EAI_BADFLAGS	WSAEINVAL
+#define EAI_FAIL		WSANO_RECOVERY
+#define EAI_FAMILY		WSAEAFNOSUPPORT
+#define EAI_MEMORY		WSA_NOT_ENOUGH_MEMORY
+#define EAI_NODATA		WSANO_DATA
+#define EAI_NONAME		WSAHOST_NOT_FOUND
+#define EAI_SERVICE		WSATYPE_NOT_FOUND
+#define EAI_SOCKTYPE	WSAESOCKTNOSUPPORT
+#endif   /* !WIN32 */
+#endif   /* !EAI_FAIL */
+
+#ifndef AI_PASSIVE
+#define AI_PASSIVE		0x0001
+#endif
+
+#ifndef AI_NUMERICHOST
+/*
+ * some platforms don't support AI_NUMERICHOST; define as zero if using
+ * the system version of getaddrinfo...
+ */
+#if defined(HAVE_STRUCT_ADDRINFO) && defined(HAVE_GETADDRINFO)
+#define AI_NUMERICHOST	0
+#else
+#define AI_NUMERICHOST	0x0004
+#endif
+#endif
+
+#ifndef NI_NUMERICHOST
+#define NI_NUMERICHOST	1
+#endif
+#ifndef NI_NUMERICSERV
+#define NI_NUMERICSERV	2
+#endif
+#ifndef NI_NAMEREQD
+#define NI_NAMEREQD		4
+#endif
+
+#ifndef NI_MAXHOST
+#define NI_MAXHOST	1025
+#endif
+#ifndef NI_MAXSERV
+#define NI_MAXSERV	32
+#endif
+
+
+#ifndef HAVE_STRUCT_ADDRINFO
+
+#ifndef WIN32
+struct addrinfo
+{
+	int			ai_flags;
+	int			ai_family;
+	int			ai_socktype;
+	int			ai_protocol;
+	size_t		ai_addrlen;
+	struct sockaddr *ai_addr;
+	char	   *ai_canonname;
+	struct addrinfo *ai_next;
+};
+#else
+/*
+ *	The order of the structure elements on Win32 doesn't match the
+ *	order specified in the standard, but we have to match it for
+ *	IPv6 to work.
+ */
+struct addrinfo
+{
+	int			ai_flags;
+	int			ai_family;
+	int			ai_socktype;
+	int			ai_protocol;
+	size_t		ai_addrlen;
+	char	   *ai_canonname;
+	struct sockaddr *ai_addr;
+	struct addrinfo *ai_next;
+};
+#endif
+#endif   /* HAVE_STRUCT_ADDRINFO */
+
+
+#ifndef HAVE_GETADDRINFO
+
+/* Rename private copies per comments above */
+#ifdef getaddrinfo
+#undef getaddrinfo
+#endif
+#define getaddrinfo pg_getaddrinfo
+
+#ifdef freeaddrinfo
+#undef freeaddrinfo
+#endif
+#define freeaddrinfo pg_freeaddrinfo
+
+#ifdef gai_strerror
+#undef gai_strerror
+#endif
+#define gai_strerror pg_gai_strerror
+
+#ifdef getnameinfo
+#undef getnameinfo
+#endif
+#define getnameinfo pg_getnameinfo
+
+extern int getaddrinfo(const char *node, const char *service,
+			const struct addrinfo * hints, struct addrinfo ** res);
+extern void freeaddrinfo(struct addrinfo * res);
+extern const char *gai_strerror(int errcode);
+extern int getnameinfo(const struct sockaddr * sa, int salen,
+			char *node, int nodelen,
+			char *service, int servicelen, int flags);
+#endif   /* HAVE_GETADDRINFO */
+
+#endif   /* GETADDRINFO_H */
diff --git a/foreign/libpg_query/src/postgres/include/lib/ilist.h b/foreign/libpg_query/src/postgres/include/lib/ilist.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/lib/ilist.h
@@ -0,0 +1,775 @@
+/*-------------------------------------------------------------------------
+ *
+ * ilist.h
+ *		integrated/inline doubly- and singly-linked lists
+ *
+ * These list types are useful when there are only a predetermined set of
+ * lists that an object could be in.  List links are embedded directly into
+ * the objects, and thus no extra memory management overhead is required.
+ * (Of course, if only a small proportion of existing objects are in a list,
+ * the link fields in the remainder would be wasted space.  But usually,
+ * it saves space to not have separately-allocated list nodes.)
+ *
+ * None of the functions here allocate any memory; they just manipulate
+ * externally managed memory.  The APIs for singly and doubly linked lists
+ * are identical as far as capabilities of both allow.
+ *
+ * Each list has a list header, which exists even when the list is empty.
+ * An empty singly-linked list has a NULL pointer in its header.
+ * There are two kinds of empty doubly linked lists: those that have been
+ * initialized to NULL, and those that have been initialized to circularity.
+ * (If a dlist is modified and then all its elements are deleted, it will be
+ * in the circular state.)	We prefer circular dlists because there are some
+ * operations that can be done without branches (and thus faster) on lists
+ * that use circular representation.  However, it is often convenient to
+ * initialize list headers to zeroes rather than setting them up with an
+ * explicit initialization function, so we also allow the other case.
+ *
+ * EXAMPLES
+ *
+ * Here's a simple example demonstrating how this can be used.  Let's assume
+ * we want to store information about the tables contained in a database.
+ *
+ * #include "lib/ilist.h"
+ *
+ * // Define struct for the databases including a list header that will be
+ * // used to access the nodes in the table list later on.
+ * typedef struct my_database
+ * {
+ *		char	   *datname;
+ *		dlist_head	tables;
+ *		// ...
+ * } my_database;
+ *
+ * // Define struct for the tables.  Note the list_node element which stores
+ * // prev/next list links.  The list_node element need not be first.
+ * typedef struct my_table
+ * {
+ *		char	   *tablename;
+ *		dlist_node	list_node;
+ *		perm_t		permissions;
+ *		// ...
+ * } my_table;
+ *
+ * // create a database
+ * my_database *db = create_database();
+ *
+ * // and add a few tables to its table list
+ * dlist_push_head(&db->tables, &create_table(db, "a")->list_node);
+ * ...
+ * dlist_push_head(&db->tables, &create_table(db, "b")->list_node);
+ *
+ *
+ * To iterate over the table list, we allocate an iterator variable and use
+ * a specialized looping construct.  Inside a dlist_foreach, the iterator's
+ * 'cur' field can be used to access the current element.  iter.cur points to
+ * a 'dlist_node', but most of the time what we want is the actual table
+ * information; dlist_container() gives us that, like so:
+ *
+ * dlist_iter	iter;
+ * dlist_foreach(iter, &db->tables)
+ * {
+ *		my_table   *tbl = dlist_container(my_table, list_node, iter.cur);
+ *		printf("we have a table: %s in database %s\n",
+ *			   tbl->tablename, db->datname);
+ * }
+ *
+ *
+ * While a simple iteration is useful, we sometimes also want to manipulate
+ * the list while iterating.  There is a different iterator element and looping
+ * construct for that.  Suppose we want to delete tables that meet a certain
+ * criterion:
+ *
+ * dlist_mutable_iter miter;
+ * dlist_foreach_modify(miter, &db->tables)
+ * {
+ *		my_table   *tbl = dlist_container(my_table, list_node, miter.cur);
+ *
+ *		if (!tbl->to_be_deleted)
+ *			continue;		// don't touch this one
+ *
+ *		// unlink the current table from the linked list
+ *		dlist_delete(miter.cur);
+ *		// as these lists never manage memory, we can still access the table
+ *		// after it's been unlinked
+ *		drop_table(db, tbl);
+ * }
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ *		src/include/lib/ilist.h
+ *-------------------------------------------------------------------------
+ */
+#ifndef ILIST_H
+#define ILIST_H
+
+/*
+ * Enable for extra debugging. This is rather expensive, so it's not enabled by
+ * default even when USE_ASSERT_CHECKING.
+ */
+/* #define ILIST_DEBUG */
+
+/*
+ * Node of a doubly linked list.
+ *
+ * Embed this in structs that need to be part of a doubly linked list.
+ */
+typedef struct dlist_node dlist_node;
+struct dlist_node
+{
+	dlist_node *prev;
+	dlist_node *next;
+};
+
+/*
+ * Head of a doubly linked list.
+ *
+ * Non-empty lists are internally circularly linked.  Circular lists have the
+ * advantage of not needing any branches in the most common list manipulations.
+ * An empty list can also be represented as a pair of NULL pointers, making
+ * initialization easier.
+ */
+typedef struct dlist_head
+{
+	/*
+	 * head.next either points to the first element of the list; to &head if
+	 * it's a circular empty list; or to NULL if empty and not circular.
+	 *
+	 * head.prev either points to the last element of the list; to &head if
+	 * it's a circular empty list; or to NULL if empty and not circular.
+	 */
+	dlist_node	head;
+} dlist_head;
+
+
+/*
+ * Doubly linked list iterator.
+ *
+ * Used as state in dlist_foreach() and dlist_reverse_foreach(). To get the
+ * current element of the iteration use the 'cur' member.
+ *
+ * Iterations using this are *not* allowed to change the list while iterating!
+ *
+ * NB: We use an extra "end" field here to avoid multiple evaluations of
+ * arguments in the dlist_foreach() macro.
+ */
+typedef struct dlist_iter
+{
+	dlist_node *cur;			/* current element */
+	dlist_node *end;			/* last node we'll iterate to */
+} dlist_iter;
+
+/*
+ * Doubly linked list iterator allowing some modifications while iterating.
+ *
+ * Used as state in dlist_foreach_modify(). To get the current element of the
+ * iteration use the 'cur' member.
+ *
+ * Iterations using this are only allowed to change the list at the current
+ * point of iteration. It is fine to delete the current node, but it is *not*
+ * fine to insert or delete adjacent nodes.
+ *
+ * NB: We need a separate type for mutable iterations so that we can store
+ * the 'next' node of the current node in case it gets deleted or modified.
+ */
+typedef struct dlist_mutable_iter
+{
+	dlist_node *cur;			/* current element */
+	dlist_node *next;			/* next node we'll iterate to */
+	dlist_node *end;			/* last node we'll iterate to */
+} dlist_mutable_iter;
+
+/*
+ * Node of a singly linked list.
+ *
+ * Embed this in structs that need to be part of a singly linked list.
+ */
+typedef struct slist_node slist_node;
+struct slist_node
+{
+	slist_node *next;
+};
+
+/*
+ * Head of a singly linked list.
+ *
+ * Singly linked lists are not circularly linked, in contrast to doubly linked
+ * lists; we just set head.next to NULL if empty.  This doesn't incur any
+ * additional branches in the usual manipulations.
+ */
+typedef struct slist_head
+{
+	slist_node	head;
+} slist_head;
+
+/*
+ * Singly linked list iterator.
+ *
+ * Used as state in slist_foreach(). To get the current element of the
+ * iteration use the 'cur' member.
+ *
+ * It's allowed to modify the list while iterating, with the exception of
+ * deleting the iterator's current node; deletion of that node requires
+ * care if the iteration is to be continued afterward.  (Doing so and also
+ * deleting or inserting adjacent list elements might misbehave; also, if
+ * the user frees the current node's storage, continuing the iteration is
+ * not safe.)
+ *
+ * NB: this wouldn't really need to be an extra struct, we could use an
+ * slist_node * directly. We prefer a separate type for consistency.
+ */
+typedef struct slist_iter
+{
+	slist_node *cur;
+} slist_iter;
+
+/*
+ * Singly linked list iterator allowing some modifications while iterating.
+ *
+ * Used as state in slist_foreach_modify(). To get the current element of the
+ * iteration use the 'cur' member.
+ *
+ * The only list modification allowed while iterating is to remove the current
+ * node via slist_delete_current() (*not* slist_delete()).  Insertion or
+ * deletion of nodes adjacent to the current node would misbehave.
+ */
+typedef struct slist_mutable_iter
+{
+	slist_node *cur;			/* current element */
+	slist_node *next;			/* next node we'll iterate to */
+	slist_node *prev;			/* prev node, for deletions */
+} slist_mutable_iter;
+
+
+/* Static initializers */
+#define DLIST_STATIC_INIT(name) {{&(name).head, &(name).head}}
+#define SLIST_STATIC_INIT(name) {{NULL}}
+
+
+/* Prototypes for functions too big to be inline */
+
+/* Caution: this is O(n); consider using slist_delete_current() instead */
+extern void slist_delete(slist_head *head, slist_node *node);
+
+#ifdef ILIST_DEBUG
+extern void dlist_check(dlist_head *head);
+extern void slist_check(slist_head *head);
+#else
+/*
+ * These seemingly useless casts to void are here to keep the compiler quiet
+ * about the argument being unused in many functions in a non-debug compile,
+ * in which functions the only point of passing the list head pointer is to be
+ * able to run these checks.
+ */
+#define dlist_check(head)	((void) (head))
+#define slist_check(head)	((void) (head))
+#endif   /* ILIST_DEBUG */
+
+
+/*
+ * We want the functions below to be inline; but if the compiler doesn't
+ * support that, fall back on providing them as regular functions.  See
+ * STATIC_IF_INLINE in c.h.
+ */
+#ifndef PG_USE_INLINE
+extern void dlist_init(dlist_head *head);
+extern bool dlist_is_empty(dlist_head *head);
+extern void dlist_push_head(dlist_head *head, dlist_node *node);
+extern void dlist_push_tail(dlist_head *head, dlist_node *node);
+extern void dlist_insert_after(dlist_node *after, dlist_node *node);
+extern void dlist_insert_before(dlist_node *before, dlist_node *node);
+extern void dlist_delete(dlist_node *node);
+extern dlist_node *dlist_pop_head_node(dlist_head *head);
+extern void dlist_move_head(dlist_head *head, dlist_node *node);
+extern bool dlist_has_next(dlist_head *head, dlist_node *node);
+extern bool dlist_has_prev(dlist_head *head, dlist_node *node);
+extern dlist_node *dlist_next_node(dlist_head *head, dlist_node *node);
+extern dlist_node *dlist_prev_node(dlist_head *head, dlist_node *node);
+extern dlist_node *dlist_head_node(dlist_head *head);
+extern dlist_node *dlist_tail_node(dlist_head *head);
+
+/* dlist macro support functions */
+extern void *dlist_tail_element_off(dlist_head *head, size_t off);
+extern void *dlist_head_element_off(dlist_head *head, size_t off);
+#endif   /* !PG_USE_INLINE */
+
+#if defined(PG_USE_INLINE) || defined(ILIST_INCLUDE_DEFINITIONS)
+/*
+ * Initialize a doubly linked list.
+ * Previous state will be thrown away without any cleanup.
+ */
+STATIC_IF_INLINE void
+dlist_init(dlist_head *head)
+{
+	head->head.next = head->head.prev = &head->head;
+}
+
+/*
+ * Is the list empty?
+ *
+ * An empty list has either its first 'next' pointer set to NULL, or to itself.
+ */
+STATIC_IF_INLINE bool
+dlist_is_empty(dlist_head *head)
+{
+	dlist_check(head);
+
+	return head->head.next == NULL || head->head.next == &(head->head);
+}
+
+/*
+ * Insert a node at the beginning of the list.
+ */
+STATIC_IF_INLINE void
+dlist_push_head(dlist_head *head, dlist_node *node)
+{
+	if (head->head.next == NULL)	/* convert NULL header to circular */
+		dlist_init(head);
+
+	node->next = head->head.next;
+	node->prev = &head->head;
+	node->next->prev = node;
+	head->head.next = node;
+
+	dlist_check(head);
+}
+
+/*
+ * Insert a node at the end of the list.
+ */
+STATIC_IF_INLINE void
+dlist_push_tail(dlist_head *head, dlist_node *node)
+{
+	if (head->head.next == NULL)	/* convert NULL header to circular */
+		dlist_init(head);
+
+	node->next = &head->head;
+	node->prev = head->head.prev;
+	node->prev->next = node;
+	head->head.prev = node;
+
+	dlist_check(head);
+}
+
+/*
+ * Insert a node after another *in the same list*
+ */
+STATIC_IF_INLINE void
+dlist_insert_after(dlist_node *after, dlist_node *node)
+{
+	node->prev = after;
+	node->next = after->next;
+	after->next = node;
+	node->next->prev = node;
+}
+
+/*
+ * Insert a node before another *in the same list*
+ */
+STATIC_IF_INLINE void
+dlist_insert_before(dlist_node *before, dlist_node *node)
+{
+	node->prev = before->prev;
+	node->next = before;
+	before->prev = node;
+	node->prev->next = node;
+}
+
+/*
+ * Delete 'node' from its list (it must be in one).
+ */
+STATIC_IF_INLINE void
+dlist_delete(dlist_node *node)
+{
+	node->prev->next = node->next;
+	node->next->prev = node->prev;
+}
+
+/*
+ * Remove and return the first node from a list (there must be one).
+ */
+STATIC_IF_INLINE dlist_node *
+dlist_pop_head_node(dlist_head *head)
+{
+	dlist_node *node;
+
+	Assert(!dlist_is_empty(head));
+	node = head->head.next;
+	dlist_delete(node);
+	return node;
+}
+
+/*
+ * Move element from its current position in the list to the head position in
+ * the same list.
+ *
+ * Undefined behaviour if 'node' is not already part of the list.
+ */
+STATIC_IF_INLINE void
+dlist_move_head(dlist_head *head, dlist_node *node)
+{
+	/* fast path if it's already at the head */
+	if (head->head.next == node)
+		return;
+
+	dlist_delete(node);
+	dlist_push_head(head, node);
+
+	dlist_check(head);
+}
+
+/*
+ * Check whether 'node' has a following node.
+ * Caution: unreliable if 'node' is not in the list.
+ */
+STATIC_IF_INLINE bool
+dlist_has_next(dlist_head *head, dlist_node *node)
+{
+	return node->next != &head->head;
+}
+
+/*
+ * Check whether 'node' has a preceding node.
+ * Caution: unreliable if 'node' is not in the list.
+ */
+STATIC_IF_INLINE bool
+dlist_has_prev(dlist_head *head, dlist_node *node)
+{
+	return node->prev != &head->head;
+}
+
+/*
+ * Return the next node in the list (there must be one).
+ */
+STATIC_IF_INLINE dlist_node *
+dlist_next_node(dlist_head *head, dlist_node *node)
+{
+	Assert(dlist_has_next(head, node));
+	return node->next;
+}
+
+/*
+ * Return previous node in the list (there must be one).
+ */
+STATIC_IF_INLINE dlist_node *
+dlist_prev_node(dlist_head *head, dlist_node *node)
+{
+	Assert(dlist_has_prev(head, node));
+	return node->prev;
+}
+
+/* internal support function to get address of head element's struct */
+STATIC_IF_INLINE void *
+dlist_head_element_off(dlist_head *head, size_t off)
+{
+	Assert(!dlist_is_empty(head));
+	return (char *) head->head.next - off;
+}
+
+/*
+ * Return the first node in the list (there must be one).
+ */
+STATIC_IF_INLINE dlist_node *
+dlist_head_node(dlist_head *head)
+{
+	return (dlist_node *) dlist_head_element_off(head, 0);
+}
+
+/* internal support function to get address of tail element's struct */
+STATIC_IF_INLINE void *
+dlist_tail_element_off(dlist_head *head, size_t off)
+{
+	Assert(!dlist_is_empty(head));
+	return (char *) head->head.prev - off;
+}
+
+/*
+ * Return the last node in the list (there must be one).
+ */
+STATIC_IF_INLINE dlist_node *
+dlist_tail_node(dlist_head *head)
+{
+	return (dlist_node *) dlist_tail_element_off(head, 0);
+}
+#endif   /* PG_USE_INLINE || ILIST_INCLUDE_DEFINITIONS */
+
+/*
+ * Return the containing struct of 'type' where 'membername' is the dlist_node
+ * pointed at by 'ptr'.
+ *
+ * This is used to convert a dlist_node * back to its containing struct.
+ */
+#define dlist_container(type, membername, ptr)								\
+	(AssertVariableIsOfTypeMacro(ptr, dlist_node *),						\
+	 AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node),	\
+	 ((type *) ((char *) (ptr) - offsetof(type, membername))))
+
+/*
+ * Return the address of the first element in the list.
+ *
+ * The list must not be empty.
+ */
+#define dlist_head_element(type, membername, lhead)							\
+	(AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node),	\
+	 (type *) dlist_head_element_off(lhead, offsetof(type, membername)))
+
+/*
+ * Return the address of the last element in the list.
+ *
+ * The list must not be empty.
+ */
+#define dlist_tail_element(type, membername, lhead)							\
+	(AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node),	\
+	 ((type *) dlist_tail_element_off(lhead, offsetof(type, membername))))
+
+/*
+ * Iterate through the list pointed at by 'lhead' storing the state in 'iter'.
+ *
+ * Access the current element with iter.cur.
+ *
+ * It is *not* allowed to manipulate the list during iteration.
+ */
+#define dlist_foreach(iter, lhead)											\
+	for (AssertVariableIsOfTypeMacro(iter, dlist_iter),						\
+		 AssertVariableIsOfTypeMacro(lhead, dlist_head *),					\
+		 (iter).end = &(lhead)->head,										\
+		 (iter).cur = (iter).end->next ? (iter).end->next : (iter).end;		\
+		 (iter).cur != (iter).end;											\
+		 (iter).cur = (iter).cur->next)
+
+/*
+ * Iterate through the list pointed at by 'lhead' storing the state in 'iter'.
+ *
+ * Access the current element with iter.cur.
+ *
+ * Iterations using this are only allowed to change the list at the current
+ * point of iteration. It is fine to delete the current node, but it is *not*
+ * fine to insert or delete adjacent nodes.
+ */
+#define dlist_foreach_modify(iter, lhead)									\
+	for (AssertVariableIsOfTypeMacro(iter, dlist_mutable_iter),				\
+		 AssertVariableIsOfTypeMacro(lhead, dlist_head *),					\
+		 (iter).end = &(lhead)->head,										\
+		 (iter).cur = (iter).end->next ? (iter).end->next : (iter).end,		\
+		 (iter).next = (iter).cur->next;									\
+		 (iter).cur != (iter).end;											\
+		 (iter).cur = (iter).next, (iter).next = (iter).cur->next)
+
+/*
+ * Iterate through the list in reverse order.
+ *
+ * It is *not* allowed to manipulate the list during iteration.
+ */
+#define dlist_reverse_foreach(iter, lhead)									\
+	for (AssertVariableIsOfTypeMacro(iter, dlist_iter),						\
+		 AssertVariableIsOfTypeMacro(lhead, dlist_head *),					\
+		 (iter).end = &(lhead)->head,										\
+		 (iter).cur = (iter).end->prev ? (iter).end->prev : (iter).end;		\
+		 (iter).cur != (iter).end;											\
+		 (iter).cur = (iter).cur->prev)
+
+
+/*
+ * We want the functions below to be inline; but if the compiler doesn't
+ * support that, fall back on providing them as regular functions.  See
+ * STATIC_IF_INLINE in c.h.
+ */
+#ifndef PG_USE_INLINE
+extern void slist_init(slist_head *head);
+extern bool slist_is_empty(slist_head *head);
+extern void slist_push_head(slist_head *head, slist_node *node);
+extern void slist_insert_after(slist_node *after, slist_node *node);
+extern slist_node *slist_pop_head_node(slist_head *head);
+extern bool slist_has_next(slist_head *head, slist_node *node);
+extern slist_node *slist_next_node(slist_head *head, slist_node *node);
+extern slist_node *slist_head_node(slist_head *head);
+extern void slist_delete_current(slist_mutable_iter *iter);
+
+/* slist macro support function */
+extern void *slist_head_element_off(slist_head *head, size_t off);
+#endif
+
+#if defined(PG_USE_INLINE) || defined(ILIST_INCLUDE_DEFINITIONS)
+/*
+ * Initialize a singly linked list.
+ * Previous state will be thrown away without any cleanup.
+ */
+STATIC_IF_INLINE void
+slist_init(slist_head *head)
+{
+	head->head.next = NULL;
+}
+
+/*
+ * Is the list empty?
+ */
+STATIC_IF_INLINE bool
+slist_is_empty(slist_head *head)
+{
+	slist_check(head);
+
+	return head->head.next == NULL;
+}
+
+/*
+ * Insert a node at the beginning of the list.
+ */
+STATIC_IF_INLINE void
+slist_push_head(slist_head *head, slist_node *node)
+{
+	node->next = head->head.next;
+	head->head.next = node;
+
+	slist_check(head);
+}
+
+/*
+ * Insert a node after another *in the same list*
+ */
+STATIC_IF_INLINE void
+slist_insert_after(slist_node *after, slist_node *node)
+{
+	node->next = after->next;
+	after->next = node;
+}
+
+/*
+ * Remove and return the first node from a list (there must be one).
+ */
+STATIC_IF_INLINE slist_node *
+slist_pop_head_node(slist_head *head)
+{
+	slist_node *node;
+
+	Assert(!slist_is_empty(head));
+	node = head->head.next;
+	head->head.next = node->next;
+	slist_check(head);
+	return node;
+}
+
+/*
+ * Check whether 'node' has a following node.
+ */
+STATIC_IF_INLINE bool
+slist_has_next(slist_head *head, slist_node *node)
+{
+	slist_check(head);
+
+	return node->next != NULL;
+}
+
+/*
+ * Return the next node in the list (there must be one).
+ */
+STATIC_IF_INLINE slist_node *
+slist_next_node(slist_head *head, slist_node *node)
+{
+	Assert(slist_has_next(head, node));
+	return node->next;
+}
+
+/* internal support function to get address of head element's struct */
+STATIC_IF_INLINE void *
+slist_head_element_off(slist_head *head, size_t off)
+{
+	Assert(!slist_is_empty(head));
+	return (char *) head->head.next - off;
+}
+
+/*
+ * Return the first node in the list (there must be one).
+ */
+STATIC_IF_INLINE slist_node *
+slist_head_node(slist_head *head)
+{
+	return (slist_node *) slist_head_element_off(head, 0);
+}
+
+/*
+ * Delete the list element the iterator currently points to.
+ *
+ * Caution: this modifies iter->cur, so don't use that again in the current
+ * loop iteration.
+ */
+STATIC_IF_INLINE void
+slist_delete_current(slist_mutable_iter *iter)
+{
+	/*
+	 * Update previous element's forward link.  If the iteration is at the
+	 * first list element, iter->prev will point to the list header's "head"
+	 * field, so we don't need a special case for that.
+	 */
+	iter->prev->next = iter->next;
+
+	/*
+	 * Reset cur to prev, so that prev will continue to point to the prior
+	 * valid list element after slist_foreach_modify() advances to the next.
+	 */
+	iter->cur = iter->prev;
+}
+#endif   /* PG_USE_INLINE || ILIST_INCLUDE_DEFINITIONS */
+
+/*
+ * Return the containing struct of 'type' where 'membername' is the slist_node
+ * pointed at by 'ptr'.
+ *
+ * This is used to convert a slist_node * back to its containing struct.
+ */
+#define slist_container(type, membername, ptr)								\
+	(AssertVariableIsOfTypeMacro(ptr, slist_node *),						\
+	 AssertVariableIsOfTypeMacro(((type *) NULL)->membername, slist_node),	\
+	 ((type *) ((char *) (ptr) - offsetof(type, membername))))
+
+/*
+ * Return the address of the first element in the list.
+ *
+ * The list must not be empty.
+ */
+#define slist_head_element(type, membername, lhead)							\
+	(AssertVariableIsOfTypeMacro(((type *) NULL)->membername, slist_node),	\
+	 (type *) slist_head_element_off(lhead, offsetof(type, membername)))
+
+/*
+ * Iterate through the list pointed at by 'lhead' storing the state in 'iter'.
+ *
+ * Access the current element with iter.cur.
+ *
+ * It's allowed to modify the list while iterating, with the exception of
+ * deleting the iterator's current node; deletion of that node requires
+ * care if the iteration is to be continued afterward.  (Doing so and also
+ * deleting or inserting adjacent list elements might misbehave; also, if
+ * the user frees the current node's storage, continuing the iteration is
+ * not safe.)
+ */
+#define slist_foreach(iter, lhead)											\
+	for (AssertVariableIsOfTypeMacro(iter, slist_iter),						\
+		 AssertVariableIsOfTypeMacro(lhead, slist_head *),					\
+		 (iter).cur = (lhead)->head.next;									\
+		 (iter).cur != NULL;												\
+		 (iter).cur = (iter).cur->next)
+
+/*
+ * Iterate through the list pointed at by 'lhead' storing the state in 'iter'.
+ *
+ * Access the current element with iter.cur.
+ *
+ * The only list modification allowed while iterating is to remove the current
+ * node via slist_delete_current() (*not* slist_delete()).  Insertion or
+ * deletion of nodes adjacent to the current node would misbehave.
+ */
+#define slist_foreach_modify(iter, lhead)									\
+	for (AssertVariableIsOfTypeMacro(iter, slist_mutable_iter),				\
+		 AssertVariableIsOfTypeMacro(lhead, slist_head *),					\
+		 (iter).prev = &(lhead)->head,										\
+		 (iter).cur = (iter).prev->next,									\
+		 (iter).next = (iter).cur ? (iter).cur->next : NULL;				\
+		 (iter).cur != NULL;												\
+		 (iter).prev = (iter).cur,											\
+		 (iter).cur = (iter).next,											\
+		 (iter).next = (iter).next ? (iter).next->next : NULL)
+
+#endif   /* ILIST_H */
diff --git a/foreign/libpg_query/src/postgres/include/lib/pairingheap.h b/foreign/libpg_query/src/postgres/include/lib/pairingheap.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/lib/pairingheap.h
@@ -0,0 +1,102 @@
+/*
+ * pairingheap.h
+ *
+ * A Pairing Heap implementation
+ *
+ * Portions Copyright (c) 2012-2015, PostgreSQL Global Development Group
+ *
+ * src/include/lib/pairingheap.h
+ */
+
+#ifndef PAIRINGHEAP_H
+#define PAIRINGHEAP_H
+
+#include "lib/stringinfo.h"
+
+/* Enable if you need the pairingheap_dump() debug function */
+/* #define PAIRINGHEAP_DEBUG */
+
+/*
+ * This represents an element stored in the heap. Embed this in a larger
+ * struct containing the actual data you're storing.
+ *
+ * A node can have multiple children, which form a double-linked list.
+ * first_child points to the node's first child, and the subsequent children
+ * can be found by following the next_sibling pointers. The last child has
+ * next_sibling == NULL. The prev_or_parent pointer points to the node's
+ * previous sibling, or if the node is its parent's first child, to the
+ * parent.
+ */
+typedef struct pairingheap_node
+{
+	struct pairingheap_node *first_child;
+	struct pairingheap_node *next_sibling;
+	struct pairingheap_node *prev_or_parent;
+} pairingheap_node;
+
+/*
+ * Return the containing struct of 'type' where 'membername' is the
+ * pairingheap_node pointed at by 'ptr'.
+ *
+ * This is used to convert a pairingheap_node * back to its containing struct.
+ */
+#define pairingheap_container(type, membername, ptr) \
+	(AssertVariableIsOfTypeMacro(ptr, pairingheap_node *), \
+	 AssertVariableIsOfTypeMacro(((type *) NULL)->membername, pairingheap_node),  \
+	 ((type *) ((char *) (ptr) - offsetof(type, membername))))
+
+/*
+ * Like pairingheap_container, but used when the pointer is 'const ptr'
+ */
+#define pairingheap_const_container(type, membername, ptr) \
+	(AssertVariableIsOfTypeMacro(ptr, const pairingheap_node *), \
+	 AssertVariableIsOfTypeMacro(((type *) NULL)->membername, pairingheap_node),  \
+	 ((const type *) ((const char *) (ptr) - offsetof(type, membername))))
+
+/*
+ * For a max-heap, the comparator must return <0 iff a < b, 0 iff a == b,
+ * and >0 iff a > b.  For a min-heap, the conditions are reversed.
+ */
+typedef int (*pairingheap_comparator) (const pairingheap_node *a,
+												   const pairingheap_node *b,
+												   void *arg);
+
+/*
+ * A pairing heap.
+ *
+ * You can use pairingheap_allocate() to create a new palloc'd heap, or embed
+ * this in a larger struct, set ph_compare and ph_arg directly and initialize
+ * ph_root to NULL.
+ */
+typedef struct pairingheap
+{
+	pairingheap_comparator ph_compare;	/* comparison function */
+	void	   *ph_arg;			/* opaque argument to ph_compare */
+	pairingheap_node *ph_root;	/* current root of the heap */
+} pairingheap;
+
+extern pairingheap *pairingheap_allocate(pairingheap_comparator compare,
+					 void *arg);
+extern void pairingheap_free(pairingheap *heap);
+extern void pairingheap_add(pairingheap *heap, pairingheap_node *node);
+extern pairingheap_node *pairingheap_first(pairingheap *heap);
+extern pairingheap_node *pairingheap_remove_first(pairingheap *heap);
+extern void pairingheap_remove(pairingheap *heap, pairingheap_node *node);
+
+#ifdef PAIRINGHEAP_DEBUG
+extern char *pairingheap_dump(pairingheap *heap,
+	 void (*dumpfunc) (pairingheap_node *node, StringInfo buf, void *opaque),
+				 void *opaque);
+#endif
+
+/* Resets the heap to be empty. */
+#define pairingheap_reset(h)			((h)->ph_root = NULL)
+
+/* Is the heap empty? */
+#define pairingheap_is_empty(h)			((h)->ph_root == NULL)
+
+/* Is there exactly one node in the heap? */
+#define pairingheap_is_singular(h) \
+	((h)->ph_root && (h)->ph_root->first_child == NULL)
+
+#endif   /* PAIRINGHEAP_H */
diff --git a/foreign/libpg_query/src/postgres/include/lib/stringinfo.h b/foreign/libpg_query/src/postgres/include/lib/stringinfo.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/lib/stringinfo.h
@@ -0,0 +1,152 @@
+/*-------------------------------------------------------------------------
+ *
+ * stringinfo.h
+ *	  Declarations/definitions for "StringInfo" functions.
+ *
+ * StringInfo provides an indefinitely-extensible string data type.
+ * It can be used to buffer either ordinary C strings (null-terminated text)
+ * or arbitrary binary data.  All storage is allocated with palloc().
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/lib/stringinfo.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef STRINGINFO_H
+#define STRINGINFO_H
+
+/*-------------------------
+ * StringInfoData holds information about an extensible string.
+ *		data	is the current buffer for the string (allocated with palloc).
+ *		len		is the current string length.  There is guaranteed to be
+ *				a terminating '\0' at data[len], although this is not very
+ *				useful when the string holds binary data rather than text.
+ *		maxlen	is the allocated size in bytes of 'data', i.e. the maximum
+ *				string size (including the terminating '\0' char) that we can
+ *				currently store in 'data' without having to reallocate
+ *				more space.  We must always have maxlen > len.
+ *		cursor	is initialized to zero by makeStringInfo or initStringInfo,
+ *				but is not otherwise touched by the stringinfo.c routines.
+ *				Some routines use it to scan through a StringInfo.
+ *-------------------------
+ */
+typedef struct StringInfoData
+{
+	char	   *data;
+	int			len;
+	int			maxlen;
+	int			cursor;
+} StringInfoData;
+
+typedef StringInfoData *StringInfo;
+
+
+/*------------------------
+ * There are two ways to create a StringInfo object initially:
+ *
+ * StringInfo stringptr = makeStringInfo();
+ *		Both the StringInfoData and the data buffer are palloc'd.
+ *
+ * StringInfoData string;
+ * initStringInfo(&string);
+ *		The data buffer is palloc'd but the StringInfoData is just local.
+ *		This is the easiest approach for a StringInfo object that will
+ *		only live as long as the current routine.
+ *
+ * To destroy a StringInfo, pfree() the data buffer, and then pfree() the
+ * StringInfoData if it was palloc'd.  There's no special support for this.
+ *
+ * NOTE: some routines build up a string using StringInfo, and then
+ * release the StringInfoData but return the data string itself to their
+ * caller.  At that point the data string looks like a plain palloc'd
+ * string.
+ *-------------------------
+ */
+
+/*------------------------
+ * makeStringInfo
+ * Create an empty 'StringInfoData' & return a pointer to it.
+ */
+extern StringInfo makeStringInfo(void);
+
+/*------------------------
+ * initStringInfo
+ * Initialize a StringInfoData struct (with previously undefined contents)
+ * to describe an empty string.
+ */
+extern void initStringInfo(StringInfo str);
+
+/*------------------------
+ * resetStringInfo
+ * Clears the current content of the StringInfo, if any. The
+ * StringInfo remains valid.
+ */
+extern void resetStringInfo(StringInfo str);
+
+/*------------------------
+ * appendStringInfo
+ * Format text data under the control of fmt (an sprintf-style format string)
+ * and append it to whatever is already in str.  More space is allocated
+ * to str if necessary.  This is sort of like a combination of sprintf and
+ * strcat.
+ */
+extern void appendStringInfo(StringInfo str, const char *fmt,...) pg_attribute_printf(2, 3);
+
+/*------------------------
+ * appendStringInfoVA
+ * Attempt to format text data under the control of fmt (an sprintf-style
+ * format string) and append it to whatever is already in str.  If successful
+ * return zero; if not (because there's not enough space), return an estimate
+ * of the space needed, without modifying str.  Typically the caller should
+ * pass the return value to enlargeStringInfo() before trying again; see
+ * appendStringInfo for standard usage pattern.
+ */
+extern int	appendStringInfoVA(StringInfo str, const char *fmt, va_list args) pg_attribute_printf(2, 0);
+
+/*------------------------
+ * appendStringInfoString
+ * Append a null-terminated string to str.
+ * Like appendStringInfo(str, "%s", s) but faster.
+ */
+extern void appendStringInfoString(StringInfo str, const char *s);
+
+/*------------------------
+ * appendStringInfoChar
+ * Append a single byte to str.
+ * Like appendStringInfo(str, "%c", ch) but much faster.
+ */
+extern void appendStringInfoChar(StringInfo str, char ch);
+
+/*------------------------
+ * appendStringInfoCharMacro
+ * As above, but a macro for even more speed where it matters.
+ * Caution: str argument will be evaluated multiple times.
+ */
+#define appendStringInfoCharMacro(str,ch) \
+	(((str)->len + 1 >= (str)->maxlen) ? \
+	 appendStringInfoChar(str, ch) : \
+	 (void)((str)->data[(str)->len] = (ch), (str)->data[++(str)->len] = '\0'))
+
+/*------------------------
+ * appendStringInfoSpaces
+ * Append a given number of spaces to str.
+ */
+extern void appendStringInfoSpaces(StringInfo str, int count);
+
+/*------------------------
+ * appendBinaryStringInfo
+ * Append arbitrary binary data to a StringInfo, allocating more space
+ * if necessary.
+ */
+extern void appendBinaryStringInfo(StringInfo str,
+					   const char *data, int datalen);
+
+/*------------------------
+ * enlargeStringInfo
+ * Make sure a StringInfo's buffer can hold at least 'needed' more bytes.
+ */
+extern void enlargeStringInfo(StringInfo str, int needed);
+
+#endif   /* STRINGINFO_H */
diff --git a/foreign/libpg_query/src/postgres/include/libpq/auth.h b/foreign/libpg_query/src/postgres/include/libpq/auth.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/libpq/auth.h
@@ -0,0 +1,29 @@
+/*-------------------------------------------------------------------------
+ *
+ * auth.h
+ *	  Definitions for network authentication routines
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/libpq/auth.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef AUTH_H
+#define AUTH_H
+
+#include "libpq/libpq-be.h"
+
+extern char *pg_krb_server_keyfile;
+extern bool pg_krb_caseins_users;
+extern char *pg_krb_realm;
+
+extern void ClientAuthentication(Port *port);
+
+/* Hook for plugins to get control in ClientAuthentication() */
+typedef void (*ClientAuthentication_hook_type) (Port *, int);
+extern PGDLLIMPORT ClientAuthentication_hook_type ClientAuthentication_hook;
+
+#endif   /* AUTH_H */
diff --git a/foreign/libpg_query/src/postgres/include/libpq/be-fsstubs.h b/foreign/libpg_query/src/postgres/include/libpq/be-fsstubs.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/libpq/be-fsstubs.h
@@ -0,0 +1,68 @@
+/*-------------------------------------------------------------------------
+ *
+ * be-fsstubs.h
+ *
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/libpq/be-fsstubs.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef BE_FSSTUBS_H
+#define BE_FSSTUBS_H
+
+#include "fmgr.h"
+
+/*
+ * LO functions available via pg_proc entries
+ */
+extern Datum lo_import(PG_FUNCTION_ARGS);
+extern Datum lo_import_with_oid(PG_FUNCTION_ARGS);
+extern Datum lo_export(PG_FUNCTION_ARGS);
+
+extern Datum lo_creat(PG_FUNCTION_ARGS);
+extern Datum lo_create(PG_FUNCTION_ARGS);
+extern Datum lo_from_bytea(PG_FUNCTION_ARGS);
+
+extern Datum lo_open(PG_FUNCTION_ARGS);
+extern Datum lo_close(PG_FUNCTION_ARGS);
+
+extern Datum loread(PG_FUNCTION_ARGS);
+extern Datum lowrite(PG_FUNCTION_ARGS);
+
+extern Datum lo_get(PG_FUNCTION_ARGS);
+extern Datum lo_get_fragment(PG_FUNCTION_ARGS);
+extern Datum lo_put(PG_FUNCTION_ARGS);
+
+extern Datum lo_lseek(PG_FUNCTION_ARGS);
+extern Datum lo_tell(PG_FUNCTION_ARGS);
+extern Datum lo_lseek64(PG_FUNCTION_ARGS);
+extern Datum lo_tell64(PG_FUNCTION_ARGS);
+extern Datum lo_unlink(PG_FUNCTION_ARGS);
+extern Datum lo_truncate(PG_FUNCTION_ARGS);
+extern Datum lo_truncate64(PG_FUNCTION_ARGS);
+
+/*
+ * compatibility option for access control
+ */
+extern bool lo_compat_privileges;
+
+/*
+ * These are not fmgr-callable, but are available to C code.
+ * Probably these should have had the underscore-free names,
+ * but too late now...
+ */
+extern int	lo_read(int fd, char *buf, int len);
+extern int	lo_write(int fd, const char *buf, int len);
+
+/*
+ * Cleanup LOs at xact commit/abort
+ */
+extern void AtEOXact_LargeObject(bool isCommit);
+extern void AtEOSubXact_LargeObject(bool isCommit, SubTransactionId mySubid,
+						SubTransactionId parentSubid);
+
+#endif   /* BE_FSSTUBS_H */
diff --git a/foreign/libpg_query/src/postgres/include/libpq/hba.h b/foreign/libpg_query/src/postgres/include/libpq/hba.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/libpq/hba.h
@@ -0,0 +1,107 @@
+/*-------------------------------------------------------------------------
+ *
+ * hba.h
+ *	  Interface to hba.c
+ *
+ *
+ * src/include/libpq/hba.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef HBA_H
+#define HBA_H
+
+#include "libpq/pqcomm.h"	/* pgrminclude ignore */	/* needed for NetBSD */
+#include "nodes/pg_list.h"
+#include "regex/regex.h"
+
+
+typedef enum UserAuth
+{
+	uaReject,
+	uaImplicitReject,
+	uaTrust,
+	uaIdent,
+	uaPassword,
+	uaMD5,
+	uaGSS,
+	uaSSPI,
+	uaPAM,
+	uaLDAP,
+	uaCert,
+	uaRADIUS,
+	uaPeer
+} UserAuth;
+
+typedef enum IPCompareMethod
+{
+	ipCmpMask,
+	ipCmpSameHost,
+	ipCmpSameNet,
+	ipCmpAll
+} IPCompareMethod;
+
+typedef enum ConnType
+{
+	ctLocal,
+	ctHost,
+	ctHostSSL,
+	ctHostNoSSL
+} ConnType;
+
+typedef struct HbaLine
+{
+	int			linenumber;
+	char	   *rawline;
+	ConnType	conntype;
+	List	   *databases;
+	List	   *roles;
+	struct sockaddr_storage addr;
+	struct sockaddr_storage mask;
+	IPCompareMethod ip_cmp_method;
+	char	   *hostname;
+	UserAuth	auth_method;
+
+	char	   *usermap;
+	char	   *pamservice;
+	bool		ldaptls;
+	char	   *ldapserver;
+	int			ldapport;
+	char	   *ldapbinddn;
+	char	   *ldapbindpasswd;
+	char	   *ldapsearchattribute;
+	char	   *ldapbasedn;
+	int			ldapscope;
+	char	   *ldapprefix;
+	char	   *ldapsuffix;
+	bool		clientcert;
+	char	   *krb_realm;
+	bool		include_realm;
+	char	   *radiusserver;
+	char	   *radiussecret;
+	char	   *radiusidentifier;
+	int			radiusport;
+} HbaLine;
+
+typedef struct IdentLine
+{
+	int			linenumber;
+
+	char	   *usermap;
+	char	   *ident_user;
+	char	   *pg_role;
+	regex_t		re;
+} IdentLine;
+
+/* kluge to avoid including libpq/libpq-be.h here */
+typedef struct Port hbaPort;
+
+extern bool load_hba(void);
+extern bool load_ident(void);
+extern void hba_getauthmethod(hbaPort *port);
+extern int check_usermap(const char *usermap_name,
+			  const char *pg_role, const char *auth_user,
+			  bool case_sensitive);
+extern bool pg_isblank(const char c);
+
+#endif   /* HBA_H */
diff --git a/foreign/libpg_query/src/postgres/include/libpq/ip.h b/foreign/libpg_query/src/postgres/include/libpq/ip.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/libpq/ip.h
@@ -0,0 +1,51 @@
+/*-------------------------------------------------------------------------
+ *
+ * ip.h
+ *	  Definitions for IPv6-aware network access.
+ *
+ * These definitions are used by both frontend and backend code.  Be careful
+ * what you include here!
+ *
+ * Copyright (c) 2003-2015, PostgreSQL Global Development Group
+ *
+ * src/include/libpq/ip.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef IP_H
+#define IP_H
+
+#include "getaddrinfo.h"		/* pgrminclude ignore */
+#include "libpq/pqcomm.h"		/* pgrminclude ignore */
+
+
+#ifdef	HAVE_UNIX_SOCKETS
+#define IS_AF_UNIX(fam) ((fam) == AF_UNIX)
+#else
+#define IS_AF_UNIX(fam) (0)
+#endif
+
+typedef void (*PgIfAddrCallback) (struct sockaddr * addr,
+											  struct sockaddr * netmask,
+											  void *cb_data);
+
+extern int pg_getaddrinfo_all(const char *hostname, const char *servname,
+				   const struct addrinfo * hintp,
+				   struct addrinfo ** result);
+extern void pg_freeaddrinfo_all(int hint_ai_family, struct addrinfo * ai);
+
+extern int pg_getnameinfo_all(const struct sockaddr_storage * addr, int salen,
+				   char *node, int nodelen,
+				   char *service, int servicelen,
+				   int flags);
+
+extern int pg_range_sockaddr(const struct sockaddr_storage * addr,
+				  const struct sockaddr_storage * netaddr,
+				  const struct sockaddr_storage * netmask);
+
+extern int pg_sockaddr_cidr_mask(struct sockaddr_storage * mask,
+					  char *numbits, int family);
+
+extern int	pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data);
+
+#endif   /* IP_H */
diff --git a/foreign/libpg_query/src/postgres/include/libpq/libpq-be.h b/foreign/libpg_query/src/postgres/include/libpq/libpq-be.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/libpq/libpq-be.h
@@ -0,0 +1,229 @@
+/*-------------------------------------------------------------------------
+ *
+ * libpq_be.h
+ *	  This file contains definitions for structures and externs used
+ *	  by the postmaster during client authentication.
+ *
+ *	  Note that this is backend-internal and is NOT exported to clients.
+ *	  Structs that need to be client-visible are in pqcomm.h.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/libpq/libpq-be.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef LIBPQ_BE_H
+#define LIBPQ_BE_H
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef USE_OPENSSL
+#include <openssl/ssl.h>
+#include <openssl/err.h>
+#endif
+#ifdef HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
+
+#ifdef ENABLE_GSS
+#if defined(HAVE_GSSAPI_H)
+#include <gssapi.h>
+#else
+#include <gssapi/gssapi.h>
+#endif   /* HAVE_GSSAPI_H */
+/*
+ * GSSAPI brings in headers that set a lot of things in the global namespace on win32,
+ * that doesn't match the msvc build. It gives a bunch of compiler warnings that we ignore,
+ * but also defines a symbol that simply does not exist. Undefine it again.
+ */
+#ifdef WIN32_ONLY_COMPILER
+#undef HAVE_GETADDRINFO
+#endif
+#endif   /* ENABLE_GSS */
+
+#ifdef ENABLE_SSPI
+#define SECURITY_WIN32
+#if defined(WIN32) && !defined(WIN32_ONLY_COMPILER)
+#include <ntsecapi.h>
+#endif
+#include <security.h>
+#undef SECURITY_WIN32
+
+#ifndef ENABLE_GSS
+/*
+ * Define a fake structure compatible with GSSAPI on Unix.
+ */
+typedef struct
+{
+	void	   *value;
+	int			length;
+} gss_buffer_desc;
+#endif
+#endif   /* ENABLE_SSPI */
+
+#include "datatype/timestamp.h"
+#include "libpq/hba.h"
+#include "libpq/pqcomm.h"
+
+
+typedef enum CAC_state
+{
+	CAC_OK, CAC_STARTUP, CAC_SHUTDOWN, CAC_RECOVERY, CAC_TOOMANY,
+	CAC_WAITBACKUP
+} CAC_state;
+
+
+/*
+ * GSSAPI specific state information
+ */
+#if defined(ENABLE_GSS) | defined(ENABLE_SSPI)
+typedef struct
+{
+	gss_buffer_desc outbuf;		/* GSSAPI output token buffer */
+#ifdef ENABLE_GSS
+	gss_cred_id_t cred;			/* GSSAPI connection cred's */
+	gss_ctx_id_t ctx;			/* GSSAPI connection context */
+	gss_name_t	name;			/* GSSAPI client name */
+#endif
+} pg_gssinfo;
+#endif
+
+/*
+ * This is used by the postmaster in its communication with frontends.  It
+ * contains all state information needed during this communication before the
+ * backend is run.  The Port structure is kept in malloc'd memory and is
+ * still available when a backend is running (see MyProcPort).  The data
+ * it points to must also be malloc'd, or else palloc'd in TopMemoryContext,
+ * so that it survives into PostgresMain execution!
+ *
+ * remote_hostname is set if we did a successful reverse lookup of the
+ * client's IP address during connection setup.
+ * remote_hostname_resolv tracks the state of hostname verification:
+ *	+1 = remote_hostname is known to resolve to client's IP address
+ *	-1 = remote_hostname is known NOT to resolve to client's IP address
+ *	 0 = we have not done the forward DNS lookup yet
+ *	-2 = there was an error in name resolution
+ * If reverse lookup of the client IP address fails, remote_hostname will be
+ * left NULL while remote_hostname_resolv is set to -2.  If reverse lookup
+ * succeeds but forward lookup fails, remote_hostname_resolv is also set to -2
+ * (the case is distinguishable because remote_hostname isn't NULL).  In
+ * either of the -2 cases, remote_hostname_errcode saves the lookup return
+ * code for possible later use with gai_strerror.
+ */
+
+typedef struct Port
+{
+	pgsocket	sock;			/* File descriptor */
+	bool		noblock;		/* is the socket in non-blocking mode? */
+	ProtocolVersion proto;		/* FE/BE protocol version */
+	SockAddr	laddr;			/* local addr (postmaster) */
+	SockAddr	raddr;			/* remote addr (client) */
+	char	   *remote_host;	/* name (or ip addr) of remote host */
+	char	   *remote_hostname;/* name (not ip addr) of remote host, if
+								 * available */
+	int			remote_hostname_resolv; /* see above */
+	int			remote_hostname_errcode;		/* see above */
+	char	   *remote_port;	/* text rep of remote port */
+	CAC_state	canAcceptConnections;	/* postmaster connection status */
+
+	/*
+	 * Information that needs to be saved from the startup packet and passed
+	 * into backend execution.  "char *" fields are NULL if not set.
+	 * guc_options points to a List of alternating option names and values.
+	 */
+	char	   *database_name;
+	char	   *user_name;
+	char	   *cmdline_options;
+	List	   *guc_options;
+
+	/*
+	 * Information that needs to be held during the authentication cycle.
+	 */
+	HbaLine    *hba;
+	char		md5Salt[4];		/* Password salt */
+
+	/*
+	 * Information that really has no business at all being in struct Port,
+	 * but since it gets used by elog.c in the same way as database_name and
+	 * other members of this struct, we may as well keep it here.
+	 */
+	TimestampTz SessionStartTime;		/* backend start time */
+
+	/*
+	 * TCP keepalive settings.
+	 *
+	 * default values are 0 if AF_UNIX or not yet known; current values are 0
+	 * if AF_UNIX or using the default. Also, -1 in a default value means we
+	 * were unable to find out the default (getsockopt failed).
+	 */
+	int			default_keepalives_idle;
+	int			default_keepalives_interval;
+	int			default_keepalives_count;
+	int			keepalives_idle;
+	int			keepalives_interval;
+	int			keepalives_count;
+
+#if defined(ENABLE_GSS) || defined(ENABLE_SSPI)
+
+	/*
+	 * If GSSAPI is supported, store GSSAPI information. Otherwise, store a
+	 * NULL pointer to make sure offsets in the struct remain the same.
+	 */
+	pg_gssinfo *gss;
+#else
+	void	   *gss;
+#endif
+
+	/*
+	 * SSL structures.
+	 */
+	bool		ssl_in_use;
+	char	   *peer_cn;
+	bool		peer_cert_valid;
+
+	/*
+	 * OpenSSL structures. (Keep these last so that the locations of other
+	 * fields are the same whether or not you build with OpenSSL.)
+	 */
+#ifdef USE_OPENSSL
+	SSL		   *ssl;
+	X509	   *peer;
+	unsigned long count;
+#endif
+} Port;
+
+#ifdef USE_SSL
+/*
+ * These functions are implemented by the glue code specific to each
+ * SSL implementation (e.g. be-secure-openssl.c)
+ */
+extern void be_tls_init(void);
+extern int	be_tls_open_server(Port *port);
+extern void be_tls_close(Port *port);
+extern ssize_t be_tls_read(Port *port, void *ptr, size_t len, int *waitfor);
+extern ssize_t be_tls_write(Port *port, void *ptr, size_t len, int *waitfor);
+
+extern int	be_tls_get_cipher_bits(Port *port);
+extern bool be_tls_get_compression(Port *port);
+extern void be_tls_get_version(Port *port, char *ptr, size_t len);
+extern void be_tls_get_cipher(Port *port, char *ptr, size_t len);
+extern void be_tls_get_peerdn_name(Port *port, char *ptr, size_t len);
+#endif
+
+extern ProtocolVersion FrontendProtocol;
+
+/* TCP keepalives configuration. These are no-ops on an AF_UNIX socket. */
+
+extern int	pq_getkeepalivesidle(Port *port);
+extern int	pq_getkeepalivesinterval(Port *port);
+extern int	pq_getkeepalivescount(Port *port);
+
+extern int	pq_setkeepalivesidle(int idle, Port *port);
+extern int	pq_setkeepalivesinterval(int interval, Port *port);
+extern int	pq_setkeepalivescount(int count, Port *port);
+
+#endif   /* LIBPQ_BE_H */
diff --git a/foreign/libpg_query/src/postgres/include/libpq/libpq.h b/foreign/libpg_query/src/postgres/include/libpq/libpq.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/libpq/libpq.h
@@ -0,0 +1,103 @@
+/*-------------------------------------------------------------------------
+ *
+ * libpq.h
+ *	  POSTGRES LIBPQ buffer structure definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/libpq/libpq.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef LIBPQ_H
+#define LIBPQ_H
+
+#include <sys/types.h>
+#include <netinet/in.h>
+
+#include "lib/stringinfo.h"
+#include "libpq/libpq-be.h"
+
+
+typedef struct
+{
+	void		(*comm_reset) (void);
+	int			(*flush) (void);
+	int			(*flush_if_writable) (void);
+	bool		(*is_send_pending) (void);
+	int			(*putmessage) (char msgtype, const char *s, size_t len);
+	void		(*putmessage_noblock) (char msgtype, const char *s, size_t len);
+	void		(*startcopyout) (void);
+	void		(*endcopyout) (bool errorAbort);
+} PQcommMethods;
+
+extern PGDLLIMPORT PQcommMethods *PqCommMethods;
+
+#define pq_comm_reset() (PqCommMethods->comm_reset())
+#define pq_flush() (PqCommMethods->flush())
+#define pq_flush_if_writable() (PqCommMethods->flush_if_writable())
+#define pq_is_send_pending() (PqCommMethods->is_send_pending())
+#define pq_putmessage(msgtype, s, len) \
+	(PqCommMethods->putmessage(msgtype, s, len))
+#define pq_putmessage_noblock(msgtype, s, len) \
+	(PqCommMethods->putmessage(msgtype, s, len))
+#define pq_startcopyout() (PqCommMethods->startcopyout())
+#define pq_endcopyout(errorAbort) (PqCommMethods->endcopyout(errorAbort))
+
+/*
+ * External functions.
+ */
+
+/*
+ * prototypes for functions in pqcomm.c
+ */
+extern int StreamServerPort(int family, char *hostName,
+				 unsigned short portNumber, char *unixSocketDir,
+				 pgsocket ListenSocket[], int MaxListen);
+extern int	StreamConnection(pgsocket server_fd, Port *port);
+extern void StreamClose(pgsocket sock);
+extern void TouchSocketFiles(void);
+extern void RemoveSocketFiles(void);
+extern void pq_init(void);
+extern int	pq_getbytes(char *s, size_t len);
+extern int	pq_getstring(StringInfo s);
+extern void pq_startmsgread(void);
+extern void pq_endmsgread(void);
+extern bool pq_is_reading_msg(void);
+extern int	pq_getmessage(StringInfo s, int maxlen);
+extern int	pq_getbyte(void);
+extern int	pq_peekbyte(void);
+extern int	pq_getbyte_if_available(unsigned char *c);
+extern int	pq_putbytes(const char *s, size_t len);
+
+/*
+ * prototypes for functions in be-secure.c
+ */
+extern char *ssl_cert_file;
+extern char *ssl_key_file;
+extern char *ssl_ca_file;
+extern char *ssl_crl_file;
+
+extern int	(*pq_putmessage_hook) (char msgtype, const char *s, size_t len);
+extern int	(*pq_flush_hook) (void);
+
+extern int	secure_initialize(void);
+extern bool secure_loaded_verify_locations(void);
+extern void secure_destroy(void);
+extern int	secure_open_server(Port *port);
+extern void secure_close(Port *port);
+extern ssize_t secure_read(Port *port, void *ptr, size_t len);
+extern ssize_t secure_write(Port *port, void *ptr, size_t len);
+extern ssize_t secure_raw_read(Port *port, void *ptr, size_t len);
+extern ssize_t secure_raw_write(Port *port, const void *ptr, size_t len);
+
+extern bool ssl_loaded_verify_locations;
+
+/* GUCs */
+extern char *SSLCipherSuites;
+extern char *SSLECDHCurve;
+extern bool SSLPreferServerCiphers;
+
+#endif   /* LIBPQ_H */
diff --git a/foreign/libpg_query/src/postgres/include/libpq/pqcomm.h b/foreign/libpg_query/src/postgres/include/libpq/pqcomm.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/libpq/pqcomm.h
@@ -0,0 +1,204 @@
+/*-------------------------------------------------------------------------
+ *
+ * pqcomm.h
+ *		Definitions common to frontends and backends.
+ *
+ * NOTE: for historical reasons, this does not correspond to pqcomm.c.
+ * pqcomm.c's routines are declared in libpq.h.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/libpq/pqcomm.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PQCOMM_H
+#define PQCOMM_H
+
+#include <sys/socket.h>
+#include <netdb.h>
+#ifdef HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+#include <netinet/in.h>
+
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
+
+#ifndef HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY
+#define ss_family __ss_family
+#else
+#error struct sockaddr_storage does not provide an ss_family member
+#endif
+#endif
+
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE___SS_LEN
+#define ss_len __ss_len
+#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN 1
+#endif
+#else							/* !HAVE_STRUCT_SOCKADDR_STORAGE */
+
+/* Define a struct sockaddr_storage if we don't have one. */
+
+struct sockaddr_storage
+{
+	union
+	{
+		struct sockaddr sa;		/* get the system-dependent fields */
+		int64		ss_align;	/* ensures struct is properly aligned */
+		char		ss_pad[128];	/* ensures struct has desired size */
+	}			ss_stuff;
+};
+
+#define ss_family	ss_stuff.sa.sa_family
+/* It should have an ss_len field if sockaddr has sa_len. */
+#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
+#define ss_len		ss_stuff.sa.sa_len
+#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN 1
+#endif
+#endif   /* HAVE_STRUCT_SOCKADDR_STORAGE */
+
+typedef struct
+{
+	struct sockaddr_storage addr;
+	ACCEPT_TYPE_ARG3 salen;
+} SockAddr;
+
+/* Configure the UNIX socket location for the well known port. */
+
+#define UNIXSOCK_PATH(path, port, sockdir) \
+		snprintf(path, sizeof(path), "%s/.s.PGSQL.%d", \
+				((sockdir) && *(sockdir) != '\0') ? (sockdir) : \
+				DEFAULT_PGSOCKET_DIR, \
+				(port))
+
+/*
+ * The maximum workable length of a socket path is what will fit into
+ * struct sockaddr_un.  This is usually only 100 or so bytes :-(.
+ *
+ * For consistency, always pass a MAXPGPATH-sized buffer to UNIXSOCK_PATH(),
+ * then complain if the resulting string is >= UNIXSOCK_PATH_BUFLEN bytes.
+ * (Because the standard API for getaddrinfo doesn't allow it to complain in
+ * a useful way when the socket pathname is too long, we have to test for
+ * this explicitly, instead of just letting the subroutine return an error.)
+ */
+#define UNIXSOCK_PATH_BUFLEN sizeof(((struct sockaddr_un *) NULL)->sun_path)
+
+
+/*
+ * These manipulate the frontend/backend protocol version number.
+ *
+ * The major number should be incremented for incompatible changes.  The minor
+ * number should be incremented for compatible changes (eg. additional
+ * functionality).
+ *
+ * If a backend supports version m.n of the protocol it must actually support
+ * versions m.[0..n].  Backend support for version m-1 can be dropped after a
+ * `reasonable' length of time.
+ *
+ * A frontend isn't required to support anything other than the current
+ * version.
+ */
+
+#define PG_PROTOCOL_MAJOR(v)	((v) >> 16)
+#define PG_PROTOCOL_MINOR(v)	((v) & 0x0000ffff)
+#define PG_PROTOCOL(m,n)	(((m) << 16) | (n))
+
+/* The earliest and latest frontend/backend protocol version supported. */
+
+#define PG_PROTOCOL_EARLIEST	PG_PROTOCOL(1,0)
+#define PG_PROTOCOL_LATEST		PG_PROTOCOL(3,0)
+
+typedef uint32 ProtocolVersion; /* FE/BE protocol version number */
+
+typedef ProtocolVersion MsgType;
+
+
+/*
+ * Packet lengths are 4 bytes in network byte order.
+ *
+ * The initial length is omitted from the packet layouts appearing below.
+ */
+
+typedef uint32 PacketLen;
+
+
+/*
+ * Old-style startup packet layout with fixed-width fields.  This is used in
+ * protocol 1.0 and 2.0, but not in later versions.  Note that the fields
+ * in this layout are '\0' terminated only if there is room.
+ */
+
+#define SM_DATABASE		64
+#define SM_USER			32
+/* We append database name if db_user_namespace true. */
+#define SM_DATABASE_USER (SM_DATABASE+SM_USER+1)		/* +1 for @ */
+#define SM_OPTIONS		64
+#define SM_UNUSED		64
+#define SM_TTY			64
+
+typedef struct StartupPacket
+{
+	ProtocolVersion protoVersion;		/* Protocol version */
+	char		database[SM_DATABASE];	/* Database name */
+	/* Db_user_namespace appends dbname */
+	char		user[SM_USER];	/* User name */
+	char		options[SM_OPTIONS];	/* Optional additional args */
+	char		unused[SM_UNUSED];		/* Unused */
+	char		tty[SM_TTY];	/* Tty for debug output */
+} StartupPacket;
+
+extern bool Db_user_namespace;
+
+/*
+ * In protocol 3.0 and later, the startup packet length is not fixed, but
+ * we set an arbitrary limit on it anyway.  This is just to prevent simple
+ * denial-of-service attacks via sending enough data to run the server
+ * out of memory.
+ */
+#define MAX_STARTUP_PACKET_LENGTH 10000
+
+
+/* These are the authentication request codes sent by the backend. */
+
+#define AUTH_REQ_OK			0	/* User is authenticated  */
+#define AUTH_REQ_KRB4		1	/* Kerberos V4. Not supported any more. */
+#define AUTH_REQ_KRB5		2	/* Kerberos V5. Not supported any more. */
+#define AUTH_REQ_PASSWORD	3	/* Password */
+#define AUTH_REQ_CRYPT		4	/* crypt password. Not supported any more. */
+#define AUTH_REQ_MD5		5	/* md5 password */
+#define AUTH_REQ_SCM_CREDS	6	/* transfer SCM credentials */
+#define AUTH_REQ_GSS		7	/* GSSAPI without wrap() */
+#define AUTH_REQ_GSS_CONT	8	/* Continue GSS exchanges */
+#define AUTH_REQ_SSPI		9	/* SSPI negotiate without wrap() */
+
+typedef uint32 AuthRequest;
+
+
+/*
+ * A client can also send a cancel-current-operation request to the postmaster.
+ * This is uglier than sending it directly to the client's backend, but it
+ * avoids depending on out-of-band communication facilities.
+ *
+ * The cancel request code must not match any protocol version number
+ * we're ever likely to use.  This random choice should do.
+ */
+#define CANCEL_REQUEST_CODE PG_PROTOCOL(1234,5678)
+
+typedef struct CancelRequestPacket
+{
+	/* Note that each field is stored in network byte order! */
+	MsgType		cancelRequestCode;		/* code to identify a cancel request */
+	uint32		backendPID;		/* PID of client's backend */
+	uint32		cancelAuthCode; /* secret key to authorize cancel */
+} CancelRequestPacket;
+
+
+/*
+ * A client can also start by sending a SSL negotiation request, to get a
+ * secure channel.
+ */
+#define NEGOTIATE_SSL_CODE PG_PROTOCOL(1234,5679)
+
+#endif   /* PQCOMM_H */
diff --git a/foreign/libpg_query/src/postgres/include/libpq/pqformat.h b/foreign/libpg_query/src/postgres/include/libpq/pqformat.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/libpq/pqformat.h
@@ -0,0 +1,49 @@
+/*-------------------------------------------------------------------------
+ *
+ * pqformat.h
+ *		Definitions for formatting and parsing frontend/backend messages
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/libpq/pqformat.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PQFORMAT_H
+#define PQFORMAT_H
+
+#include "lib/stringinfo.h"
+
+extern void pq_beginmessage(StringInfo buf, char msgtype);
+extern void pq_sendbyte(StringInfo buf, int byt);
+extern void pq_sendbytes(StringInfo buf, const char *data, int datalen);
+extern void pq_sendcountedtext(StringInfo buf, const char *str, int slen,
+				   bool countincludesself);
+extern void pq_sendtext(StringInfo buf, const char *str, int slen);
+extern void pq_sendstring(StringInfo buf, const char *str);
+extern void pq_send_ascii_string(StringInfo buf, const char *str);
+extern void pq_sendint(StringInfo buf, int i, int b);
+extern void pq_sendint64(StringInfo buf, int64 i);
+extern void pq_sendfloat4(StringInfo buf, float4 f);
+extern void pq_sendfloat8(StringInfo buf, float8 f);
+extern void pq_endmessage(StringInfo buf);
+
+extern void pq_begintypsend(StringInfo buf);
+extern bytea *pq_endtypsend(StringInfo buf);
+
+extern void pq_puttextmessage(char msgtype, const char *str);
+extern void pq_putemptymessage(char msgtype);
+
+extern int	pq_getmsgbyte(StringInfo msg);
+extern unsigned int pq_getmsgint(StringInfo msg, int b);
+extern int64 pq_getmsgint64(StringInfo msg);
+extern float4 pq_getmsgfloat4(StringInfo msg);
+extern float8 pq_getmsgfloat8(StringInfo msg);
+extern const char *pq_getmsgbytes(StringInfo msg, int datalen);
+extern void pq_copymsgbytes(StringInfo msg, char *buf, int datalen);
+extern char *pq_getmsgtext(StringInfo msg, int rawbytes, int *nbytes);
+extern const char *pq_getmsgstring(StringInfo msg);
+extern void pq_getmsgend(StringInfo msg);
+
+#endif   /* PQFORMAT_H */
diff --git a/foreign/libpg_query/src/postgres/include/libpq/pqsignal.h b/foreign/libpg_query/src/postgres/include/libpq/pqsignal.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/libpq/pqsignal.h
@@ -0,0 +1,42 @@
+/*-------------------------------------------------------------------------
+ *
+ * pqsignal.h
+ *	  Backend signal(2) support (see also src/port/pqsignal.c)
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/libpq/pqsignal.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PQSIGNAL_H
+#define PQSIGNAL_H
+
+#include <signal.h>
+
+#ifdef HAVE_SIGPROCMASK
+extern sigset_t UnBlockSig,
+			BlockSig,
+			StartupBlockSig;
+
+#define PG_SETMASK(mask)	sigprocmask(SIG_SETMASK, mask, NULL)
+#else							/* not HAVE_SIGPROCMASK */
+extern int	UnBlockSig,
+			BlockSig,
+			StartupBlockSig;
+
+#ifndef WIN32
+#define PG_SETMASK(mask)	sigsetmask(*((int*)(mask)))
+#else
+#define PG_SETMASK(mask)		pqsigsetmask(*((int*)(mask)))
+int			pqsigsetmask(int mask);
+#endif
+
+#define sigaddset(set, signum)	(*(set) |= (sigmask(signum)))
+#define sigdelset(set, signum)	(*(set) &= ~(sigmask(signum)))
+#endif   /* not HAVE_SIGPROCMASK */
+
+extern void pqinitmask(void);
+
+#endif   /* PQSIGNAL_H */
diff --git a/foreign/libpg_query/src/postgres/include/mb/pg_wchar.h b/foreign/libpg_query/src/postgres/include/mb/pg_wchar.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/mb/pg_wchar.h
@@ -0,0 +1,559 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_wchar.h
+ *	  multibyte-character support
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/mb/pg_wchar.h
+ *
+ *	NOTES
+ *		This is used both by the backend and by libpq, but should not be
+ *		included by libpq client programs.  In particular, a libpq client
+ *		should not assume that the encoding IDs used by the version of libpq
+ *		it's linked to match up with the IDs declared here.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_WCHAR_H
+#define PG_WCHAR_H
+
+/*
+ * The pg_wchar type
+ */
+typedef unsigned int pg_wchar;
+
+/*
+ * Maximum byte length of multibyte characters in any backend encoding
+ */
+#define MAX_MULTIBYTE_CHAR_LEN	4
+
+/*
+ * various definitions for EUC
+ */
+#define SS2 0x8e				/* single shift 2 (JIS0201) */
+#define SS3 0x8f				/* single shift 3 (JIS0212) */
+
+/*
+ * SJIS validation macros
+ */
+#define ISSJISHEAD(c) (((c) >= 0x81 && (c) <= 0x9f) || ((c) >= 0xe0 && (c) <= 0xfc))
+#define ISSJISTAIL(c) (((c) >= 0x40 && (c) <= 0x7e) || ((c) >= 0x80 && (c) <= 0xfc))
+
+/*----------------------------------------------------
+ * MULE Internal Encoding (MIC)
+ *
+ * This encoding follows the design used within XEmacs; it is meant to
+ * subsume many externally-defined character sets.  Each character includes
+ * identification of the character set it belongs to, so the encoding is
+ * general but somewhat bulky.
+ *
+ * Currently PostgreSQL supports 5 types of MULE character sets:
+ *
+ * 1) 1-byte ASCII characters.  Each byte is below 0x80.
+ *
+ * 2) "Official" single byte charsets such as ISO-8859-1 (Latin1).
+ *	  Each MULE character consists of 2 bytes: LC1 + C1, where LC1 is
+ *	  an identifier for the charset (in the range 0x81 to 0x8d) and C1
+ *	  is the character code (in the range 0xa0 to 0xff).
+ *
+ * 3) "Private" single byte charsets such as SISHENG.  Each MULE
+ *	  character consists of 3 bytes: LCPRV1 + LC12 + C1, where LCPRV1
+ *	  is a private-charset flag, LC12 is an identifier for the charset,
+ *	  and C1 is the character code (in the range 0xa0 to 0xff).
+ *	  LCPRV1 is either 0x9a (if LC12 is in the range 0xa0 to 0xdf)
+ *	  or 0x9b (if LC12 is in the range 0xe0 to 0xef).
+ *
+ * 4) "Official" multibyte charsets such as JIS X0208.  Each MULE
+ *	  character consists of 3 bytes: LC2 + C1 + C2, where LC2 is
+ *	  an identifier for the charset (in the range 0x90 to 0x99) and C1
+ *	  and C2 form the character code (each in the range 0xa0 to 0xff).
+ *
+ * 5) "Private" multibyte charsets such as CNS 11643-1992 Plane 3.
+ *	  Each MULE character consists of 4 bytes: LCPRV2 + LC22 + C1 + C2,
+ *	  where LCPRV2 is a private-charset flag, LC22 is an identifier for
+ *	  the charset, and C1 and C2 form the character code (each in the range
+ *	  0xa0 to 0xff).  LCPRV2 is either 0x9c (if LC22 is in the range 0xf0
+ *	  to 0xf4) or 0x9d (if LC22 is in the range 0xf5 to 0xfe).
+ *
+ * "Official" encodings are those that have been assigned code numbers by
+ * the XEmacs project; "private" encodings have Postgres-specific charset
+ * identifiers.
+ *
+ * See the "XEmacs Internals Manual", available at http://www.xemacs.org,
+ * for more details.  Note that for historical reasons, Postgres'
+ * private-charset flag values do not match what XEmacs says they should be,
+ * so this isn't really exactly MULE (not that private charsets would be
+ * interoperable anyway).
+ *
+ * Note that XEmacs's implementation is different from what emacs does.
+ * We follow emacs's implementation, rather than XEmacs's.
+ *----------------------------------------------------
+ */
+
+/*
+ * Charset identifiers (also called "leading bytes" in the MULE documentation)
+ */
+
+/*
+ * Charset IDs for official single byte encodings (0x81-0x8e)
+ */
+#define LC_ISO8859_1		0x81	/* ISO8859 Latin 1 */
+#define LC_ISO8859_2		0x82	/* ISO8859 Latin 2 */
+#define LC_ISO8859_3		0x83	/* ISO8859 Latin 3 */
+#define LC_ISO8859_4		0x84	/* ISO8859 Latin 4 */
+#define LC_TIS620			0x85	/* Thai (not supported yet) */
+#define LC_ISO8859_7		0x86	/* Greek (not supported yet) */
+#define LC_ISO8859_6		0x87	/* Arabic (not supported yet) */
+#define LC_ISO8859_8		0x88	/* Hebrew (not supported yet) */
+#define LC_JISX0201K		0x89	/* Japanese 1 byte kana */
+#define LC_JISX0201R		0x8a	/* Japanese 1 byte Roman */
+/* Note that 0x8b seems to be unused as of Emacs 20.7.
+ * However, there might be a chance that 0x8b could be used
+ * in later versions of Emacs.
+ */
+#define LC_KOI8_R			0x8b	/* Cyrillic KOI8-R */
+#define LC_ISO8859_5		0x8c	/* ISO8859 Cyrillic */
+#define LC_ISO8859_9		0x8d	/* ISO8859 Latin 5 (not supported yet) */
+#define LC_ISO8859_15		0x8e	/* ISO8859 Latin 15 (not supported yet) */
+/* #define CONTROL_1		0x8f	control characters (unused) */
+
+/* Is a leading byte for "official" single byte encodings? */
+#define IS_LC1(c)	((unsigned char)(c) >= 0x81 && (unsigned char)(c) <= 0x8d)
+
+/*
+ * Charset IDs for official multibyte encodings (0x90-0x99)
+ * 0x9a-0x9d are free. 0x9e and 0x9f are reserved.
+ */
+#define LC_JISX0208_1978	0x90	/* Japanese Kanji, old JIS (not supported) */
+#define LC_GB2312_80		0x91	/* Chinese */
+#define LC_JISX0208			0x92	/* Japanese Kanji (JIS X 0208) */
+#define LC_KS5601			0x93	/* Korean */
+#define LC_JISX0212			0x94	/* Japanese Kanji (JIS X 0212) */
+#define LC_CNS11643_1		0x95	/* CNS 11643-1992 Plane 1 */
+#define LC_CNS11643_2		0x96	/* CNS 11643-1992 Plane 2 */
+#define LC_JISX0213_1		0x97/* Japanese Kanji (JIS X 0213 Plane 1) (not
+								 * supported) */
+#define LC_BIG5_1			0x98	/* Plane 1 Chinese traditional (not supported) */
+#define LC_BIG5_2			0x99	/* Plane 1 Chinese traditional (not supported) */
+
+/* Is a leading byte for "official" multibyte encodings? */
+#define IS_LC2(c)	((unsigned char)(c) >= 0x90 && (unsigned char)(c) <= 0x99)
+
+/*
+ * Postgres-specific prefix bytes for "private" single byte encodings
+ * (According to the MULE docs, we should be using 0x9e for this)
+ */
+#define LCPRV1_A		0x9a
+#define LCPRV1_B		0x9b
+#define IS_LCPRV1(c)	((unsigned char)(c) == LCPRV1_A || (unsigned char)(c) == LCPRV1_B)
+#define IS_LCPRV1_A_RANGE(c)	\
+	((unsigned char)(c) >= 0xa0 && (unsigned char)(c) <= 0xdf)
+#define IS_LCPRV1_B_RANGE(c)	\
+	((unsigned char)(c) >= 0xe0 && (unsigned char)(c) <= 0xef)
+
+/*
+ * Postgres-specific prefix bytes for "private" multibyte encodings
+ * (According to the MULE docs, we should be using 0x9f for this)
+ */
+#define LCPRV2_A		0x9c
+#define LCPRV2_B		0x9d
+#define IS_LCPRV2(c)	((unsigned char)(c) == LCPRV2_A || (unsigned char)(c) == LCPRV2_B)
+#define IS_LCPRV2_A_RANGE(c)	\
+	((unsigned char)(c) >= 0xf0 && (unsigned char)(c) <= 0xf4)
+#define IS_LCPRV2_B_RANGE(c)	\
+	((unsigned char)(c) >= 0xf5 && (unsigned char)(c) <= 0xfe)
+
+/*
+ * Charset IDs for private single byte encodings (0xa0-0xef)
+ */
+#define LC_SISHENG			0xa0/* Chinese SiSheng characters for
+								 * PinYin/ZhuYin (not supported) */
+#define LC_IPA				0xa1/* IPA (International Phonetic Association)
+								 * (not supported) */
+#define LC_VISCII_LOWER		0xa2/* Vietnamese VISCII1.1 lower-case (not
+								 * supported) */
+#define LC_VISCII_UPPER		0xa3/* Vietnamese VISCII1.1 upper-case (not
+								 * supported) */
+#define LC_ARABIC_DIGIT		0xa4	/* Arabic digit (not supported) */
+#define LC_ARABIC_1_COLUMN	0xa5	/* Arabic 1-column (not supported) */
+#define LC_ASCII_RIGHT_TO_LEFT	0xa6	/* ASCII (left half of ISO8859-1) with
+										 * right-to-left direction (not
+										 * supported) */
+#define LC_LAO				0xa7/* Lao characters (ISO10646 0E80..0EDF) (not
+								 * supported) */
+#define LC_ARABIC_2_COLUMN	0xa8	/* Arabic 1-column (not supported) */
+
+/*
+ * Charset IDs for private multibyte encodings (0xf0-0xff)
+ */
+#define LC_INDIAN_1_COLUMN	0xf0/* Indian charset for 1-column width glyphs
+								 * (not supported) */
+#define LC_TIBETAN_1_COLUMN 0xf1/* Tibetan 1-column width glyphs (not
+								 * supported) */
+#define LC_UNICODE_SUBSET_2 0xf2/* Unicode characters of the range
+								 * U+2500..U+33FF. (not supported) */
+#define LC_UNICODE_SUBSET_3 0xf3/* Unicode characters of the range
+								 * U+E000..U+FFFF. (not supported) */
+#define LC_UNICODE_SUBSET	0xf4/* Unicode characters of the range
+								 * U+0100..U+24FF. (not supported) */
+#define LC_ETHIOPIC			0xf5	/* Ethiopic characters (not supported) */
+#define LC_CNS11643_3		0xf6	/* CNS 11643-1992 Plane 3 */
+#define LC_CNS11643_4		0xf7	/* CNS 11643-1992 Plane 4 */
+#define LC_CNS11643_5		0xf8	/* CNS 11643-1992 Plane 5 */
+#define LC_CNS11643_6		0xf9	/* CNS 11643-1992 Plane 6 */
+#define LC_CNS11643_7		0xfa	/* CNS 11643-1992 Plane 7 */
+#define LC_INDIAN_2_COLUMN	0xfb/* Indian charset for 2-column width glyphs
+								 * (not supported) */
+#define LC_TIBETAN			0xfc	/* Tibetan (not supported) */
+/* #define FREE				0xfd	free (unused) */
+/* #define FREE				0xfe	free (unused) */
+/* #define FREE				0xff	free (unused) */
+
+/*----------------------------------------------------
+ * end of MULE stuff
+ *----------------------------------------------------
+ */
+
+/*
+ * PostgreSQL encoding identifiers
+ *
+ * WARNING: the order of this enum must be same as order of entries
+ *			in the pg_enc2name_tbl[] array (in mb/encnames.c), and
+ *			in the pg_wchar_table[] array (in mb/wchar.c)!
+ *
+ *			If you add some encoding don't forget to check
+ *			PG_ENCODING_BE_LAST macro.
+ *
+ * PG_SQL_ASCII is default encoding and must be = 0.
+ *
+ * XXX	We must avoid renumbering any backend encoding until libpq's major
+ * version number is increased beyond 5; it turns out that the backend
+ * encoding IDs are effectively part of libpq's ABI as far as 8.2 initdb and
+ * psql are concerned.
+ */
+typedef enum pg_enc
+{
+	PG_SQL_ASCII = 0,			/* SQL/ASCII */
+	PG_EUC_JP,					/* EUC for Japanese */
+	PG_EUC_CN,					/* EUC for Chinese */
+	PG_EUC_KR,					/* EUC for Korean */
+	PG_EUC_TW,					/* EUC for Taiwan */
+	PG_EUC_JIS_2004,			/* EUC-JIS-2004 */
+	PG_UTF8,					/* Unicode UTF8 */
+	PG_MULE_INTERNAL,			/* Mule internal code */
+	PG_LATIN1,					/* ISO-8859-1 Latin 1 */
+	PG_LATIN2,					/* ISO-8859-2 Latin 2 */
+	PG_LATIN3,					/* ISO-8859-3 Latin 3 */
+	PG_LATIN4,					/* ISO-8859-4 Latin 4 */
+	PG_LATIN5,					/* ISO-8859-9 Latin 5 */
+	PG_LATIN6,					/* ISO-8859-10 Latin6 */
+	PG_LATIN7,					/* ISO-8859-13 Latin7 */
+	PG_LATIN8,					/* ISO-8859-14 Latin8 */
+	PG_LATIN9,					/* ISO-8859-15 Latin9 */
+	PG_LATIN10,					/* ISO-8859-16 Latin10 */
+	PG_WIN1256,					/* windows-1256 */
+	PG_WIN1258,					/* Windows-1258 */
+	PG_WIN866,					/* (MS-DOS CP866) */
+	PG_WIN874,					/* windows-874 */
+	PG_KOI8R,					/* KOI8-R */
+	PG_WIN1251,					/* windows-1251 */
+	PG_WIN1252,					/* windows-1252 */
+	PG_ISO_8859_5,				/* ISO-8859-5 */
+	PG_ISO_8859_6,				/* ISO-8859-6 */
+	PG_ISO_8859_7,				/* ISO-8859-7 */
+	PG_ISO_8859_8,				/* ISO-8859-8 */
+	PG_WIN1250,					/* windows-1250 */
+	PG_WIN1253,					/* windows-1253 */
+	PG_WIN1254,					/* windows-1254 */
+	PG_WIN1255,					/* windows-1255 */
+	PG_WIN1257,					/* windows-1257 */
+	PG_KOI8U,					/* KOI8-U */
+	/* PG_ENCODING_BE_LAST points to the above entry */
+
+	/* followings are for client encoding only */
+	PG_SJIS,					/* Shift JIS (Windows-932) */
+	PG_BIG5,					/* Big5 (Windows-950) */
+	PG_GBK,						/* GBK (Windows-936) */
+	PG_UHC,						/* UHC (Windows-949) */
+	PG_GB18030,					/* GB18030 */
+	PG_JOHAB,					/* EUC for Korean JOHAB */
+	PG_SHIFT_JIS_2004,			/* Shift-JIS-2004 */
+	_PG_LAST_ENCODING_			/* mark only */
+
+} pg_enc;
+
+#define PG_ENCODING_BE_LAST PG_KOI8U
+
+/*
+ * Please use these tests before access to pg_encconv_tbl[]
+ * or to other places...
+ */
+#define PG_VALID_BE_ENCODING(_enc) \
+		((_enc) >= 0 && (_enc) <= PG_ENCODING_BE_LAST)
+
+#define PG_ENCODING_IS_CLIENT_ONLY(_enc) \
+		((_enc) > PG_ENCODING_BE_LAST && (_enc) < _PG_LAST_ENCODING_)
+
+#define PG_VALID_ENCODING(_enc) \
+		((_enc) >= 0 && (_enc) < _PG_LAST_ENCODING_)
+
+/* On FE are possible all encodings */
+#define PG_VALID_FE_ENCODING(_enc)	PG_VALID_ENCODING(_enc)
+
+/*
+ * Table for mapping an encoding number to official encoding name and
+ * possibly other subsidiary data.  Be careful to check encoding number
+ * before accessing a table entry!
+ *
+ * if (PG_VALID_ENCODING(encoding))
+ *		pg_enc2name_tbl[ encoding ];
+ */
+typedef struct pg_enc2name
+{
+	const char *name;
+	pg_enc		encoding;
+#ifdef WIN32
+	unsigned	codepage;		/* codepage for WIN32 */
+#endif
+} pg_enc2name;
+
+extern const pg_enc2name pg_enc2name_tbl[];
+
+/*
+ * Encoding names for gettext
+ */
+typedef struct pg_enc2gettext
+{
+	pg_enc		encoding;
+	const char *name;
+} pg_enc2gettext;
+
+extern const pg_enc2gettext pg_enc2gettext_tbl[];
+
+/*
+ * pg_wchar stuff
+ */
+typedef int (*mb2wchar_with_len_converter) (const unsigned char *from,
+														pg_wchar *to,
+														int len);
+
+typedef int (*wchar2mb_with_len_converter) (const pg_wchar *from,
+														unsigned char *to,
+														int len);
+
+typedef int (*mblen_converter) (const unsigned char *mbstr);
+
+typedef int (*mbdisplaylen_converter) (const unsigned char *mbstr);
+
+typedef bool (*mbcharacter_incrementer) (unsigned char *mbstr, int len);
+
+typedef int (*mbverifier) (const unsigned char *mbstr, int len);
+
+typedef struct
+{
+	mb2wchar_with_len_converter mb2wchar_with_len;		/* convert a multibyte
+														 * string to a wchar */
+	wchar2mb_with_len_converter wchar2mb_with_len;		/* convert a wchar
+														 * string to a multibyte */
+	mblen_converter mblen;		/* get byte length of a char */
+	mbdisplaylen_converter dsplen;		/* get display width of a char */
+	mbverifier	mbverify;		/* verify multibyte sequence */
+	int			maxmblen;		/* max bytes for a char in this encoding */
+} pg_wchar_tbl;
+
+extern const pg_wchar_tbl pg_wchar_table[];
+
+/*
+ * Data structures for conversions between UTF-8 and other encodings
+ * (UtfToLocal() and LocalToUtf()).  In these data structures, characters of
+ * either encoding are represented by uint32 words; hence we can only support
+ * characters up to 4 bytes long.  For example, the byte sequence 0xC2 0x89
+ * would be represented by 0x0000C289, and 0xE8 0xA2 0xB4 by 0x00E8A2B4.
+ *
+ * Maps are arrays of these structs, which must be in order by the lookup key
+ * (so that bsearch() can be used).
+ *
+ * UTF-8 to local code conversion map
+ */
+typedef struct
+{
+	uint32		utf;			/* UTF-8 */
+	uint32		code;			/* local code */
+} pg_utf_to_local;
+
+/*
+ * local code to UTF-8 conversion map
+ */
+typedef struct
+{
+	uint32		code;			/* local code */
+	uint32		utf;			/* UTF-8 */
+} pg_local_to_utf;
+
+/*
+ * UTF-8 to local code conversion map (for combined characters)
+ */
+typedef struct
+{
+	uint32		utf1;			/* UTF-8 code 1 */
+	uint32		utf2;			/* UTF-8 code 2 */
+	uint32		code;			/* local code */
+} pg_utf_to_local_combined;
+
+/*
+ * local code to UTF-8 conversion map (for combined characters)
+ */
+typedef struct
+{
+	uint32		code;			/* local code */
+	uint32		utf1;			/* UTF-8 code 1 */
+	uint32		utf2;			/* UTF-8 code 2 */
+} pg_local_to_utf_combined;
+
+/*
+ * callback function for algorithmic encoding conversions (in either direction)
+ *
+ * if function returns zero, it does not know how to convert the code
+ */
+typedef uint32 (*utf_local_conversion_func) (uint32 code);
+
+/*
+ * Support macro for encoding conversion functions to validate their
+ * arguments.  (This could be made more compact if we included fmgr.h
+ * here, but we don't want to do that because this header file is also
+ * used by frontends.)
+ */
+#define CHECK_ENCODING_CONVERSION_ARGS(srcencoding,destencoding) \
+	check_encoding_conversion_args(PG_GETARG_INT32(0), \
+								   PG_GETARG_INT32(1), \
+								   PG_GETARG_INT32(4), \
+								   (srcencoding), \
+								   (destencoding))
+
+
+/*
+ * These functions are considered part of libpq's exported API and
+ * are also declared in libpq-fe.h.
+ */
+extern int	pg_char_to_encoding(const char *name);
+extern const char *pg_encoding_to_char(int encoding);
+extern int	pg_valid_server_encoding_id(int encoding);
+
+/*
+ * Remaining functions are not considered part of libpq's API, though many
+ * of them do exist inside libpq.
+ */
+extern int	pg_mb2wchar(const char *from, pg_wchar *to);
+extern int	pg_mb2wchar_with_len(const char *from, pg_wchar *to, int len);
+extern int pg_encoding_mb2wchar_with_len(int encoding,
+							  const char *from, pg_wchar *to, int len);
+extern int	pg_wchar2mb(const pg_wchar *from, char *to);
+extern int	pg_wchar2mb_with_len(const pg_wchar *from, char *to, int len);
+extern int pg_encoding_wchar2mb_with_len(int encoding,
+							  const pg_wchar *from, char *to, int len);
+extern int	pg_char_and_wchar_strcmp(const char *s1, const pg_wchar *s2);
+extern int	pg_wchar_strncmp(const pg_wchar *s1, const pg_wchar *s2, size_t n);
+extern int	pg_char_and_wchar_strncmp(const char *s1, const pg_wchar *s2, size_t n);
+extern size_t pg_wchar_strlen(const pg_wchar *wstr);
+extern int	pg_mblen(const char *mbstr);
+extern int	pg_dsplen(const char *mbstr);
+extern int	pg_encoding_mblen(int encoding, const char *mbstr);
+extern int	pg_encoding_dsplen(int encoding, const char *mbstr);
+extern int	pg_encoding_verifymb(int encoding, const char *mbstr, int len);
+extern int	pg_mule_mblen(const unsigned char *mbstr);
+extern int	pg_mic_mblen(const unsigned char *mbstr);
+extern int	pg_mbstrlen(const char *mbstr);
+extern int	pg_mbstrlen_with_len(const char *mbstr, int len);
+extern int	pg_mbcliplen(const char *mbstr, int len, int limit);
+extern int pg_encoding_mbcliplen(int encoding, const char *mbstr,
+					  int len, int limit);
+extern int	pg_mbcharcliplen(const char *mbstr, int len, int imit);
+extern int	pg_encoding_max_length(int encoding);
+extern int	pg_database_encoding_max_length(void);
+extern mbcharacter_incrementer pg_database_encoding_character_incrementer(void);
+
+extern int	PrepareClientEncoding(int encoding);
+extern int	SetClientEncoding(int encoding);
+extern void InitializeClientEncoding(void);
+extern int	pg_get_client_encoding(void);
+extern const char *pg_get_client_encoding_name(void);
+
+extern void SetDatabaseEncoding(int encoding);
+extern int	GetDatabaseEncoding(void);
+extern const char *GetDatabaseEncodingName(void);
+extern void SetMessageEncoding(int encoding);
+extern int	GetMessageEncoding(void);
+
+#ifdef ENABLE_NLS
+extern int	pg_bind_textdomain_codeset(const char *domainname);
+#endif
+
+extern int	pg_valid_client_encoding(const char *name);
+extern int	pg_valid_server_encoding(const char *name);
+
+extern unsigned char *unicode_to_utf8(pg_wchar c, unsigned char *utf8string);
+extern pg_wchar utf8_to_unicode(const unsigned char *c);
+extern int	pg_utf_mblen(const unsigned char *);
+extern unsigned char *pg_do_encoding_conversion(unsigned char *src, int len,
+						  int src_encoding,
+						  int dest_encoding);
+
+extern char *pg_client_to_server(const char *s, int len);
+extern char *pg_server_to_client(const char *s, int len);
+extern char *pg_any_to_server(const char *s, int len, int encoding);
+extern char *pg_server_to_any(const char *s, int len, int encoding);
+
+extern unsigned short BIG5toCNS(unsigned short big5, unsigned char *lc);
+extern unsigned short CNStoBIG5(unsigned short cns, unsigned char lc);
+
+extern void UtfToLocal(const unsigned char *utf, int len,
+		   unsigned char *iso,
+		   const pg_utf_to_local *map, int mapsize,
+		   const pg_utf_to_local_combined *cmap, int cmapsize,
+		   utf_local_conversion_func conv_func,
+		   int encoding);
+extern void LocalToUtf(const unsigned char *iso, int len,
+		   unsigned char *utf,
+		   const pg_local_to_utf *map, int mapsize,
+		   const pg_local_to_utf_combined *cmap, int cmapsize,
+		   utf_local_conversion_func conv_func,
+		   int encoding);
+
+extern bool pg_verifymbstr(const char *mbstr, int len, bool noError);
+extern bool pg_verify_mbstr(int encoding, const char *mbstr, int len,
+				bool noError);
+extern int pg_verify_mbstr_len(int encoding, const char *mbstr, int len,
+					bool noError);
+
+extern void check_encoding_conversion_args(int src_encoding,
+							   int dest_encoding,
+							   int len,
+							   int expected_src_encoding,
+							   int expected_dest_encoding);
+
+extern void report_invalid_encoding(int encoding, const char *mbstr, int len) pg_attribute_noreturn();
+extern void report_untranslatable_char(int src_encoding, int dest_encoding,
+						 const char *mbstr, int len) pg_attribute_noreturn();
+
+extern void pg_ascii2mic(const unsigned char *l, unsigned char *p, int len);
+extern void pg_mic2ascii(const unsigned char *mic, unsigned char *p, int len);
+extern void latin2mic(const unsigned char *l, unsigned char *p, int len,
+		  int lc, int encoding);
+extern void mic2latin(const unsigned char *mic, unsigned char *p, int len,
+		  int lc, int encoding);
+extern void latin2mic_with_table(const unsigned char *l, unsigned char *p,
+					 int len, int lc, int encoding,
+					 const unsigned char *tab);
+extern void mic2latin_with_table(const unsigned char *mic, unsigned char *p,
+					 int len, int lc, int encoding,
+					 const unsigned char *tab);
+
+extern bool pg_utf8_islegal(const unsigned char *source, int length);
+
+#ifdef WIN32
+extern WCHAR *pgwin32_message_to_UTF16(const char *str, int len, int *utf16len);
+#endif
+
+#endif   /* PG_WCHAR_H */
diff --git a/foreign/libpg_query/src/postgres/include/miscadmin.h b/foreign/libpg_query/src/postgres/include/miscadmin.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/miscadmin.h
@@ -0,0 +1,467 @@
+/*-------------------------------------------------------------------------
+ *
+ * miscadmin.h
+ *	  This file contains general postgres administration and initialization
+ *	  stuff that used to be spread out between the following files:
+ *		globals.h						global variables
+ *		pdir.h							directory path crud
+ *		pinit.h							postgres initialization
+ *		pmod.h							processing modes
+ *	  Over time, this has also become the preferred place for widely known
+ *	  resource-limitation stuff, such as work_mem and check_stack_depth().
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/miscadmin.h
+ *
+ * NOTES
+ *	  some of the information in this file should be moved to other files.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef MISCADMIN_H
+#define MISCADMIN_H
+
+#include "pgtime.h"				/* for pg_time_t */
+
+
+#define PG_BACKEND_VERSIONSTR "postgres (PostgreSQL) " PG_VERSION "\n"
+
+#define InvalidPid				(-1)
+
+
+/*****************************************************************************
+ *	  System interrupt and critical section handling
+ *
+ * There are two types of interrupts that a running backend needs to accept
+ * without messing up its state: QueryCancel (SIGINT) and ProcDie (SIGTERM).
+ * In both cases, we need to be able to clean up the current transaction
+ * gracefully, so we can't respond to the interrupt instantaneously ---
+ * there's no guarantee that internal data structures would be self-consistent
+ * if the code is interrupted at an arbitrary instant.  Instead, the signal
+ * handlers set flags that are checked periodically during execution.
+ *
+ * The CHECK_FOR_INTERRUPTS() macro is called at strategically located spots
+ * where it is normally safe to accept a cancel or die interrupt.  In some
+ * cases, we invoke CHECK_FOR_INTERRUPTS() inside low-level subroutines that
+ * might sometimes be called in contexts that do *not* want to allow a cancel
+ * or die interrupt.  The HOLD_INTERRUPTS() and RESUME_INTERRUPTS() macros
+ * allow code to ensure that no cancel or die interrupt will be accepted,
+ * even if CHECK_FOR_INTERRUPTS() gets called in a subroutine.  The interrupt
+ * will be held off until CHECK_FOR_INTERRUPTS() is done outside any
+ * HOLD_INTERRUPTS() ... RESUME_INTERRUPTS() section.
+ *
+ * There is also a mechanism to prevent query cancel interrupts, while still
+ * allowing die interrupts: HOLD_CANCEL_INTERRUPTS() and
+ * RESUME_CANCEL_INTERRUPTS().
+ *
+ * Special mechanisms are used to let an interrupt be accepted when we are
+ * waiting for a lock or when we are waiting for command input (but, of
+ * course, only if the interrupt holdoff counter is zero).  See the
+ * related code for details.
+ *
+ * A lost connection is handled similarly, although the loss of connection
+ * does not raise a signal, but is detected when we fail to write to the
+ * socket. If there was a signal for a broken connection, we could make use of
+ * it by setting ClientConnectionLost in the signal handler.
+ *
+ * A related, but conceptually distinct, mechanism is the "critical section"
+ * mechanism.  A critical section not only holds off cancel/die interrupts,
+ * but causes any ereport(ERROR) or ereport(FATAL) to become ereport(PANIC)
+ * --- that is, a system-wide reset is forced.  Needless to say, only really
+ * *critical* code should be marked as a critical section!	Currently, this
+ * mechanism is only used for XLOG-related code.
+ *
+ *****************************************************************************/
+
+/* in globals.c */
+/* these are marked volatile because they are set by signal handlers: */
+extern PGDLLIMPORT __thread volatile bool InterruptPending;
+extern PGDLLIMPORT volatile bool QueryCancelPending;
+extern PGDLLIMPORT volatile bool ProcDiePending;
+
+extern volatile bool ClientConnectionLost;
+
+/* these are marked volatile because they are examined by signal handlers: */
+extern PGDLLIMPORT __thread volatile uint32 InterruptHoldoffCount;
+extern PGDLLIMPORT __thread volatile uint32 QueryCancelHoldoffCount;
+extern PGDLLIMPORT __thread volatile uint32 CritSectionCount;
+
+/* in tcop/postgres.c */
+extern void ProcessInterrupts(void);
+
+#ifndef WIN32
+
+#define CHECK_FOR_INTERRUPTS() \
+do { \
+	if (InterruptPending) \
+		ProcessInterrupts(); \
+} while(0)
+#else							/* WIN32 */
+
+#define CHECK_FOR_INTERRUPTS() \
+do { \
+	if (UNBLOCKED_SIGNAL_QUEUE()) \
+		pgwin32_dispatch_queued_signals(); \
+	if (InterruptPending) \
+		ProcessInterrupts(); \
+} while(0)
+#endif   /* WIN32 */
+
+
+#define HOLD_INTERRUPTS()  (InterruptHoldoffCount++)
+
+#define RESUME_INTERRUPTS() \
+do { \
+	Assert(InterruptHoldoffCount > 0); \
+	InterruptHoldoffCount--; \
+} while(0)
+
+#define HOLD_CANCEL_INTERRUPTS()  (QueryCancelHoldoffCount++)
+
+#define RESUME_CANCEL_INTERRUPTS() \
+do { \
+	Assert(QueryCancelHoldoffCount > 0); \
+	QueryCancelHoldoffCount--; \
+} while(0)
+
+#define START_CRIT_SECTION()  (CritSectionCount++)
+
+#define END_CRIT_SECTION() \
+do { \
+	Assert(CritSectionCount > 0); \
+	CritSectionCount--; \
+} while(0)
+
+
+/*****************************************************************************
+ *	  globals.h --															 *
+ *****************************************************************************/
+
+/*
+ * from utils/init/globals.c
+ */
+extern pid_t PostmasterPid;
+extern __thread  bool IsPostmasterEnvironment;
+extern PGDLLIMPORT bool IsUnderPostmaster;
+extern bool IsBackgroundWorker;
+extern PGDLLIMPORT bool IsBinaryUpgrade;
+
+extern __thread  bool ExitOnAnyError;
+
+extern PGDLLIMPORT char *DataDir;
+
+extern PGDLLIMPORT int NBuffers;
+extern int	MaxBackends;
+extern int	MaxConnections;
+extern int	max_worker_processes;
+
+extern PGDLLIMPORT int MyProcPid;
+extern PGDLLIMPORT pg_time_t MyStartTime;
+extern PGDLLIMPORT struct Port *MyProcPort;
+extern PGDLLIMPORT struct Latch *MyLatch;
+extern long MyCancelKey;
+extern int	MyPMChildSlot;
+
+extern char OutputFileName[];
+extern PGDLLIMPORT char my_exec_path[];
+extern char pkglib_path[];
+
+#ifdef EXEC_BACKEND
+extern char postgres_exec_path[];
+#endif
+
+/*
+ * done in storage/backendid.h for now.
+ *
+ * extern BackendId    MyBackendId;
+ */
+extern PGDLLIMPORT Oid MyDatabaseId;
+
+extern PGDLLIMPORT Oid MyDatabaseTableSpace;
+
+/*
+ * Date/Time Configuration
+ *
+ * DateStyle defines the output formatting choice for date/time types:
+ *	USE_POSTGRES_DATES specifies traditional Postgres format
+ *	USE_ISO_DATES specifies ISO-compliant format
+ *	USE_SQL_DATES specifies Oracle/Ingres-compliant format
+ *	USE_GERMAN_DATES specifies German-style dd.mm/yyyy
+ *
+ * DateOrder defines the field order to be assumed when reading an
+ * ambiguous date (anything not in YYYY-MM-DD format, with a four-digit
+ * year field first, is taken to be ambiguous):
+ *	DATEORDER_YMD specifies field order yy-mm-dd
+ *	DATEORDER_DMY specifies field order dd-mm-yy ("European" convention)
+ *	DATEORDER_MDY specifies field order mm-dd-yy ("US" convention)
+ *
+ * In the Postgres and SQL DateStyles, DateOrder also selects output field
+ * order: day comes before month in DMY style, else month comes before day.
+ *
+ * The user-visible "DateStyle" run-time parameter subsumes both of these.
+ */
+
+/* valid DateStyle values */
+#define USE_POSTGRES_DATES		0
+#define USE_ISO_DATES			1
+#define USE_SQL_DATES			2
+#define USE_GERMAN_DATES		3
+#define USE_XSD_DATES			4
+
+/* valid DateOrder values */
+#define DATEORDER_YMD			0
+#define DATEORDER_DMY			1
+#define DATEORDER_MDY			2
+
+extern PGDLLIMPORT int DateStyle;
+extern PGDLLIMPORT int DateOrder;
+
+/*
+ * IntervalStyles
+ *	 INTSTYLE_POSTGRES			   Like Postgres < 8.4 when DateStyle = 'iso'
+ *	 INTSTYLE_POSTGRES_VERBOSE	   Like Postgres < 8.4 when DateStyle != 'iso'
+ *	 INTSTYLE_SQL_STANDARD		   SQL standard interval literals
+ *	 INTSTYLE_ISO_8601			   ISO-8601-basic formatted intervals
+ */
+#define INTSTYLE_POSTGRES			0
+#define INTSTYLE_POSTGRES_VERBOSE	1
+#define INTSTYLE_SQL_STANDARD		2
+#define INTSTYLE_ISO_8601			3
+
+extern PGDLLIMPORT int IntervalStyle;
+
+#define MAXTZLEN		10		/* max TZ name len, not counting tr. null */
+
+extern bool enableFsync;
+extern bool allowSystemTableMods;
+extern PGDLLIMPORT int work_mem;
+extern PGDLLIMPORT int maintenance_work_mem;
+
+extern int	VacuumCostPageHit;
+extern int	VacuumCostPageMiss;
+extern int	VacuumCostPageDirty;
+extern int	VacuumCostLimit;
+extern int	VacuumCostDelay;
+
+extern int	VacuumPageHit;
+extern int	VacuumPageMiss;
+extern int	VacuumPageDirty;
+
+extern int	VacuumCostBalance;
+extern bool VacuumCostActive;
+
+
+/* in tcop/postgres.c */
+
+#if defined(__ia64__) || defined(__ia64)
+typedef struct
+{
+	char	   *stack_base_ptr;
+	char	   *register_stack_base_ptr;
+} pg_stack_base_t;
+#else
+typedef char *pg_stack_base_t;
+#endif
+
+extern pg_stack_base_t set_stack_base(void);
+extern void restore_stack_base(pg_stack_base_t base);
+extern void check_stack_depth(void);
+extern bool stack_is_too_deep(void);
+
+/* in tcop/utility.c */
+extern void PreventCommandIfReadOnly(const char *cmdname);
+extern void PreventCommandIfParallelMode(const char *cmdname);
+extern void PreventCommandDuringRecovery(const char *cmdname);
+
+/* in utils/misc/guc.c */
+extern int	trace_recovery_messages;
+extern int	trace_recovery(int trace_level);
+
+/*****************************************************************************
+ *	  pdir.h --																 *
+ *			POSTGRES directory path definitions.                             *
+ *****************************************************************************/
+
+/* flags to be OR'd to form sec_context */
+#define SECURITY_LOCAL_USERID_CHANGE	0x0001
+#define SECURITY_RESTRICTED_OPERATION	0x0002
+#define SECURITY_NOFORCE_RLS			0x0004
+
+extern char *DatabasePath;
+
+/* now in utils/init/miscinit.c */
+extern void InitPostmasterChild(void);
+extern void InitStandaloneProcess(const char *argv0);
+
+extern void SetDatabasePath(const char *path);
+
+extern char *GetUserNameFromId(Oid roleid, bool noerr);
+extern Oid	GetUserId(void);
+extern Oid	GetOuterUserId(void);
+extern Oid	GetSessionUserId(void);
+extern Oid	GetAuthenticatedUserId(void);
+extern void GetUserIdAndSecContext(Oid *userid, int *sec_context);
+extern void SetUserIdAndSecContext(Oid userid, int sec_context);
+extern bool InLocalUserIdChange(void);
+extern bool InSecurityRestrictedOperation(void);
+extern bool InNoForceRLSOperation(void);
+extern void GetUserIdAndContext(Oid *userid, bool *sec_def_context);
+extern void SetUserIdAndContext(Oid userid, bool sec_def_context);
+extern void InitializeSessionUserId(const char *rolename, Oid useroid);
+extern void InitializeSessionUserIdStandalone(void);
+extern void SetSessionAuthorization(Oid userid, bool is_superuser);
+extern Oid	GetCurrentRoleId(void);
+extern void SetCurrentRoleId(Oid roleid, bool is_superuser);
+
+extern void SetDataDir(const char *dir);
+extern void ChangeToDataDir(void);
+
+extern void SwitchToSharedLatch(void);
+extern void SwitchBackToLocalLatch(void);
+
+/* in utils/misc/superuser.c */
+extern bool superuser(void);	/* current user is superuser */
+extern bool superuser_arg(Oid roleid);	/* given user is superuser */
+
+
+/*****************************************************************************
+ *	  pmod.h --																 *
+ *			POSTGRES processing mode definitions.                            *
+ *****************************************************************************/
+
+/*
+ * Description:
+ *		There are three processing modes in POSTGRES.  They are
+ * BootstrapProcessing or "bootstrap," InitProcessing or
+ * "initialization," and NormalProcessing or "normal."
+ *
+ * The first two processing modes are used during special times. When the
+ * system state indicates bootstrap processing, transactions are all given
+ * transaction id "one" and are consequently guaranteed to commit. This mode
+ * is used during the initial generation of template databases.
+ *
+ * Initialization mode: used while starting a backend, until all normal
+ * initialization is complete.  Some code behaves differently when executed
+ * in this mode to enable system bootstrapping.
+ *
+ * If a POSTGRES backend process is in normal mode, then all code may be
+ * executed normally.
+ */
+
+typedef enum ProcessingMode
+{
+	BootstrapProcessing,		/* bootstrap creation of template database */
+	InitProcessing,				/* initializing system */
+	NormalProcessing			/* normal processing */
+} ProcessingMode;
+
+extern ProcessingMode Mode;
+
+#define IsBootstrapProcessingMode() (Mode == BootstrapProcessing)
+#define IsInitProcessingMode()		(Mode == InitProcessing)
+#define IsNormalProcessingMode()	(Mode == NormalProcessing)
+
+#define GetProcessingMode() Mode
+
+#define SetProcessingMode(mode) \
+	do { \
+		AssertArg((mode) == BootstrapProcessing || \
+				  (mode) == InitProcessing || \
+				  (mode) == NormalProcessing); \
+		Mode = (mode); \
+	} while(0)
+
+
+/*
+ * Auxiliary-process type identifiers.  These used to be in bootstrap.h
+ * but it seems saner to have them here, with the ProcessingMode stuff.
+ * The MyAuxProcType global is defined and set in bootstrap.c.
+ */
+
+typedef enum
+{
+	NotAnAuxProcess = -1,
+	CheckerProcess = 0,
+	BootstrapProcess,
+	StartupProcess,
+	BgWriterProcess,
+	CheckpointerProcess,
+	WalWriterProcess,
+	WalReceiverProcess,
+
+	NUM_AUXPROCTYPES			/* Must be last! */
+} AuxProcType;
+
+extern AuxProcType MyAuxProcType;
+
+#define AmBootstrapProcess()		(MyAuxProcType == BootstrapProcess)
+#define AmStartupProcess()			(MyAuxProcType == StartupProcess)
+#define AmBackgroundWriterProcess() (MyAuxProcType == BgWriterProcess)
+#define AmCheckpointerProcess()		(MyAuxProcType == CheckpointerProcess)
+#define AmWalWriterProcess()		(MyAuxProcType == WalWriterProcess)
+#define AmWalReceiverProcess()		(MyAuxProcType == WalReceiverProcess)
+
+
+/*****************************************************************************
+ *	  pinit.h --															 *
+ *			POSTGRES initialization and cleanup definitions.                 *
+ *****************************************************************************/
+
+/* in utils/init/postinit.c */
+extern void pg_split_opts(char **argv, int *argcp, const char *optstr);
+extern void InitializeMaxBackends(void);
+extern void InitPostgres(const char *in_dbname, Oid dboid, const char *username,
+			 Oid useroid, char *out_dbname);
+extern void BaseInit(void);
+
+/* in utils/init/miscinit.c */
+extern bool IgnoreSystemIndexes;
+extern PGDLLIMPORT bool process_shared_preload_libraries_in_progress;
+extern char *session_preload_libraries_string;
+extern char *shared_preload_libraries_string;
+extern char *local_preload_libraries_string;
+
+/*
+ * As of 9.1, the contents of the data-directory lock file are:
+ *
+ * line #
+ *		1	postmaster PID (or negative of a standalone backend's PID)
+ *		2	data directory path
+ *		3	postmaster start timestamp (time_t representation)
+ *		4	port number
+ *		5	first Unix socket directory path (empty if none)
+ *		6	first listen_address (IP address or "*"; empty if no TCP port)
+ *		7	shared memory key (not present on Windows)
+ *
+ * Lines 6 and up are added via AddToDataDirLockFile() after initial file
+ * creation.
+ *
+ * The socket lock file, if used, has the same contents as lines 1-5.
+ */
+#define LOCK_FILE_LINE_PID			1
+#define LOCK_FILE_LINE_DATA_DIR		2
+#define LOCK_FILE_LINE_START_TIME	3
+#define LOCK_FILE_LINE_PORT			4
+#define LOCK_FILE_LINE_SOCKET_DIR	5
+#define LOCK_FILE_LINE_LISTEN_ADDR	6
+#define LOCK_FILE_LINE_SHMEM_KEY	7
+
+extern void CreateDataDirLockFile(bool amPostmaster);
+extern void CreateSocketLockFile(const char *socketfile, bool amPostmaster,
+					 const char *socketDir);
+extern void TouchSocketLockFiles(void);
+extern void AddToDataDirLockFile(int target_line, const char *str);
+extern bool RecheckDataDirLockFile(void);
+extern void ValidatePgVersion(const char *path);
+extern void process_shared_preload_libraries(void);
+extern void process_session_preload_libraries(void);
+extern void pg_bindtextdomain(const char *domain);
+extern bool has_rolreplication(Oid roleid);
+
+/* in access/transam/xlog.c */
+extern bool BackupInProgress(void);
+extern void CancelBackup(void);
+
+#endif   /* MISCADMIN_H */
diff --git a/foreign/libpg_query/src/postgres/include/nodes/bitmapset.h b/foreign/libpg_query/src/postgres/include/nodes/bitmapset.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/nodes/bitmapset.h
@@ -0,0 +1,98 @@
+/*-------------------------------------------------------------------------
+ *
+ * bitmapset.h
+ *	  PostgreSQL generic bitmap set package
+ *
+ * A bitmap set can represent any set of nonnegative integers, although
+ * it is mainly intended for sets where the maximum value is not large,
+ * say at most a few hundred.  By convention, a NULL pointer is always
+ * accepted by all operations to represent the empty set.  (But beware
+ * that this is not the only representation of the empty set.  Use
+ * bms_is_empty() in preference to testing for NULL.)
+ *
+ *
+ * Copyright (c) 2003-2015, PostgreSQL Global Development Group
+ *
+ * src/include/nodes/bitmapset.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef BITMAPSET_H
+#define BITMAPSET_H
+
+/*
+ * Data representation
+ */
+
+/* The unit size can be adjusted by changing these three declarations: */
+#define BITS_PER_BITMAPWORD 32
+typedef uint32 bitmapword;		/* must be an unsigned type */
+typedef int32 signedbitmapword; /* must be the matching signed type */
+
+typedef struct Bitmapset
+{
+	int			nwords;			/* number of words in array */
+	bitmapword	words[FLEXIBLE_ARRAY_MEMBER];	/* really [nwords] */
+} Bitmapset;
+
+
+/* result of bms_subset_compare */
+typedef enum
+{
+	BMS_EQUAL,					/* sets are equal */
+	BMS_SUBSET1,				/* first set is a subset of the second */
+	BMS_SUBSET2,				/* second set is a subset of the first */
+	BMS_DIFFERENT				/* neither set is a subset of the other */
+} BMS_Comparison;
+
+/* result of bms_membership */
+typedef enum
+{
+	BMS_EMPTY_SET,				/* 0 members */
+	BMS_SINGLETON,				/* 1 member */
+	BMS_MULTIPLE				/* >1 member */
+} BMS_Membership;
+
+
+/*
+ * function prototypes in nodes/bitmapset.c
+ */
+
+extern Bitmapset *bms_copy(const Bitmapset *a);
+extern bool bms_equal(const Bitmapset *a, const Bitmapset *b);
+extern Bitmapset *bms_make_singleton(int x);
+extern void bms_free(Bitmapset *a);
+
+extern Bitmapset *bms_union(const Bitmapset *a, const Bitmapset *b);
+extern Bitmapset *bms_intersect(const Bitmapset *a, const Bitmapset *b);
+extern Bitmapset *bms_difference(const Bitmapset *a, const Bitmapset *b);
+extern bool bms_is_subset(const Bitmapset *a, const Bitmapset *b);
+extern BMS_Comparison bms_subset_compare(const Bitmapset *a, const Bitmapset *b);
+extern bool bms_is_member(int x, const Bitmapset *a);
+extern bool bms_overlap(const Bitmapset *a, const Bitmapset *b);
+extern bool bms_nonempty_difference(const Bitmapset *a, const Bitmapset *b);
+extern int	bms_singleton_member(const Bitmapset *a);
+extern bool bms_get_singleton_member(const Bitmapset *a, int *member);
+extern int	bms_num_members(const Bitmapset *a);
+
+/* optimized tests when we don't need to know exact membership count: */
+extern BMS_Membership bms_membership(const Bitmapset *a);
+extern bool bms_is_empty(const Bitmapset *a);
+
+/* these routines recycle (modify or free) their non-const inputs: */
+
+extern Bitmapset *bms_add_member(Bitmapset *a, int x);
+extern Bitmapset *bms_del_member(Bitmapset *a, int x);
+extern Bitmapset *bms_add_members(Bitmapset *a, const Bitmapset *b);
+extern Bitmapset *bms_int_members(Bitmapset *a, const Bitmapset *b);
+extern Bitmapset *bms_del_members(Bitmapset *a, const Bitmapset *b);
+extern Bitmapset *bms_join(Bitmapset *a, Bitmapset *b);
+
+/* support for iterating through the integer elements of a set: */
+extern int	bms_first_member(Bitmapset *a);
+extern int	bms_next_member(const Bitmapset *a, int prevbit);
+
+/* support for hashtables using Bitmapsets as keys: */
+extern uint32 bms_hash_value(const Bitmapset *a);
+
+#endif   /* BITMAPSET_H */
diff --git a/foreign/libpg_query/src/postgres/include/nodes/execnodes.h b/foreign/libpg_query/src/postgres/include/nodes/execnodes.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/nodes/execnodes.h
@@ -0,0 +1,2045 @@
+/*-------------------------------------------------------------------------
+ *
+ * execnodes.h
+ *	  definitions for executor state nodes
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/nodes/execnodes.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef EXECNODES_H
+#define EXECNODES_H
+
+#include "access/genam.h"
+#include "access/heapam.h"
+#include "executor/instrument.h"
+#include "lib/pairingheap.h"
+#include "nodes/params.h"
+#include "nodes/plannodes.h"
+#include "utils/reltrigger.h"
+#include "utils/sortsupport.h"
+#include "utils/tuplestore.h"
+#include "utils/tuplesort.h"
+
+
+/* ----------------
+ *	  IndexInfo information
+ *
+ *		this struct holds the information needed to construct new index
+ *		entries for a particular index.  Used for both index_build and
+ *		retail creation of index entries.
+ *
+ *		NumIndexAttrs		number of columns in this index
+ *		KeyAttrNumbers		underlying-rel attribute numbers used as keys
+ *							(zeroes indicate expressions)
+ *		Expressions			expr trees for expression entries, or NIL if none
+ *		ExpressionsState	exec state for expressions, or NIL if none
+ *		Predicate			partial-index predicate, or NIL if none
+ *		PredicateState		exec state for predicate, or NIL if none
+ *		ExclusionOps		Per-column exclusion operators, or NULL if none
+ *		ExclusionProcs		Underlying function OIDs for ExclusionOps
+ *		ExclusionStrats		Opclass strategy numbers for ExclusionOps
+ *		UniqueOps			Theses are like Exclusion*, but for unique indexes
+ *		UniqueProcs
+ *		UniqueStrats
+ *		Unique				is it a unique index?
+ *		ReadyForInserts		is it valid for inserts?
+ *		Concurrent			are we doing a concurrent index build?
+ *		BrokenHotChain		did we detect any broken HOT chains?
+ *
+ * ii_Concurrent and ii_BrokenHotChain are used only during index build;
+ * they're conventionally set to false otherwise.
+ * ----------------
+ */
+typedef struct IndexInfo
+{
+	NodeTag		type;
+	int			ii_NumIndexAttrs;
+	AttrNumber	ii_KeyAttrNumbers[INDEX_MAX_KEYS];
+	List	   *ii_Expressions; /* list of Expr */
+	List	   *ii_ExpressionsState;	/* list of ExprState */
+	List	   *ii_Predicate;	/* list of Expr */
+	List	   *ii_PredicateState;		/* list of ExprState */
+	Oid		   *ii_ExclusionOps;	/* array with one entry per column */
+	Oid		   *ii_ExclusionProcs;		/* array with one entry per column */
+	uint16	   *ii_ExclusionStrats;		/* array with one entry per column */
+	Oid		   *ii_UniqueOps;	/* array with one entry per column */
+	Oid		   *ii_UniqueProcs; /* array with one entry per column */
+	uint16	   *ii_UniqueStrats;	/* array with one entry per column */
+	bool		ii_Unique;
+	bool		ii_ReadyForInserts;
+	bool		ii_Concurrent;
+	bool		ii_BrokenHotChain;
+} IndexInfo;
+
+/* ----------------
+ *	  ExprContext_CB
+ *
+ *		List of callbacks to be called at ExprContext shutdown.
+ * ----------------
+ */
+typedef void (*ExprContextCallbackFunction) (Datum arg);
+
+typedef struct ExprContext_CB
+{
+	struct ExprContext_CB *next;
+	ExprContextCallbackFunction function;
+	Datum		arg;
+} ExprContext_CB;
+
+/* ----------------
+ *	  ExprContext
+ *
+ *		This class holds the "current context" information
+ *		needed to evaluate expressions for doing tuple qualifications
+ *		and tuple projections.  For example, if an expression refers
+ *		to an attribute in the current inner tuple then we need to know
+ *		what the current inner tuple is and so we look at the expression
+ *		context.
+ *
+ *	There are two memory contexts associated with an ExprContext:
+ *	* ecxt_per_query_memory is a query-lifespan context, typically the same
+ *	  context the ExprContext node itself is allocated in.  This context
+ *	  can be used for purposes such as storing function call cache info.
+ *	* ecxt_per_tuple_memory is a short-term context for expression results.
+ *	  As the name suggests, it will typically be reset once per tuple,
+ *	  before we begin to evaluate expressions for that tuple.  Each
+ *	  ExprContext normally has its very own per-tuple memory context.
+ *
+ *	CurrentMemoryContext should be set to ecxt_per_tuple_memory before
+ *	calling ExecEvalExpr() --- see ExecEvalExprSwitchContext().
+ * ----------------
+ */
+typedef struct ExprContext
+{
+	NodeTag		type;
+
+	/* Tuples that Var nodes in expression may refer to */
+	TupleTableSlot *ecxt_scantuple;
+	TupleTableSlot *ecxt_innertuple;
+	TupleTableSlot *ecxt_outertuple;
+
+	/* Memory contexts for expression evaluation --- see notes above */
+	MemoryContext ecxt_per_query_memory;
+	MemoryContext ecxt_per_tuple_memory;
+
+	/* Values to substitute for Param nodes in expression */
+	ParamExecData *ecxt_param_exec_vals;		/* for PARAM_EXEC params */
+	ParamListInfo ecxt_param_list_info; /* for other param types */
+
+	/*
+	 * Values to substitute for Aggref nodes in the expressions of an Agg
+	 * node, or for WindowFunc nodes within a WindowAgg node.
+	 */
+	Datum	   *ecxt_aggvalues; /* precomputed values for aggs/windowfuncs */
+	bool	   *ecxt_aggnulls;	/* null flags for aggs/windowfuncs */
+
+	/* Value to substitute for CaseTestExpr nodes in expression */
+	Datum		caseValue_datum;
+	bool		caseValue_isNull;
+
+	/* Value to substitute for CoerceToDomainValue nodes in expression */
+	Datum		domainValue_datum;
+	bool		domainValue_isNull;
+
+	/* Link to containing EState (NULL if a standalone ExprContext) */
+	struct EState *ecxt_estate;
+
+	/* Functions to call back when ExprContext is shut down or rescanned */
+	ExprContext_CB *ecxt_callbacks;
+} ExprContext;
+
+/*
+ * Set-result status returned by ExecEvalExpr()
+ */
+typedef enum
+{
+	ExprSingleResult,			/* expression does not return a set */
+	ExprMultipleResult,			/* this result is an element of a set */
+	ExprEndResult				/* there are no more elements in the set */
+} ExprDoneCond;
+
+/*
+ * Return modes for functions returning sets.  Note values must be chosen
+ * as separate bits so that a bitmask can be formed to indicate supported
+ * modes.  SFRM_Materialize_Random and SFRM_Materialize_Preferred are
+ * auxiliary flags about SFRM_Materialize mode, rather than separate modes.
+ */
+typedef enum
+{
+	SFRM_ValuePerCall = 0x01,	/* one value returned per call */
+	SFRM_Materialize = 0x02,	/* result set instantiated in Tuplestore */
+	SFRM_Materialize_Random = 0x04,		/* Tuplestore needs randomAccess */
+	SFRM_Materialize_Preferred = 0x08	/* caller prefers Tuplestore */
+} SetFunctionReturnMode;
+
+/*
+ * When calling a function that might return a set (multiple rows),
+ * a node of this type is passed as fcinfo->resultinfo to allow
+ * return status to be passed back.  A function returning set should
+ * raise an error if no such resultinfo is provided.
+ */
+typedef struct ReturnSetInfo
+{
+	NodeTag		type;
+	/* values set by caller: */
+	ExprContext *econtext;		/* context function is being called in */
+	TupleDesc	expectedDesc;	/* tuple descriptor expected by caller */
+	int			allowedModes;	/* bitmask: return modes caller can handle */
+	/* result status from function (but pre-initialized by caller): */
+	SetFunctionReturnMode returnMode;	/* actual return mode */
+	ExprDoneCond isDone;		/* status for ValuePerCall mode */
+	/* fields filled by function in Materialize return mode: */
+	Tuplestorestate *setResult; /* holds the complete returned tuple set */
+	TupleDesc	setDesc;		/* actual descriptor for returned tuples */
+} ReturnSetInfo;
+
+/* ----------------
+ *		ProjectionInfo node information
+ *
+ *		This is all the information needed to perform projections ---
+ *		that is, form new tuples by evaluation of targetlist expressions.
+ *		Nodes which need to do projections create one of these.
+ *
+ *		ExecProject() evaluates the tlist, forms a tuple, and stores it
+ *		in the given slot.  Note that the result will be a "virtual" tuple
+ *		unless ExecMaterializeSlot() is then called to force it to be
+ *		converted to a physical tuple.  The slot must have a tupledesc
+ *		that matches the output of the tlist!
+ *
+ *		The planner very often produces tlists that consist entirely of
+ *		simple Var references (lower levels of a plan tree almost always
+ *		look like that).  And top-level tlists are often mostly Vars too.
+ *		We therefore optimize execution of simple-Var tlist entries.
+ *		The pi_targetlist list actually contains only the tlist entries that
+ *		aren't simple Vars, while those that are Vars are processed using the
+ *		varSlotOffsets/varNumbers/varOutputCols arrays.
+ *
+ *		The lastXXXVar fields are used to optimize fetching of fields from
+ *		input tuples: they let us do a slot_getsomeattrs() call to ensure
+ *		that all needed attributes are extracted in one pass.
+ *
+ *		targetlist		target list for projection (non-Var expressions only)
+ *		exprContext		expression context in which to evaluate targetlist
+ *		slot			slot to place projection result in
+ *		itemIsDone		workspace array for ExecProject
+ *		directMap		true if varOutputCols[] is an identity map
+ *		numSimpleVars	number of simple Vars found in original tlist
+ *		varSlotOffsets	array indicating which slot each simple Var is from
+ *		varNumbers		array containing input attr numbers of simple Vars
+ *		varOutputCols	array containing output attr numbers of simple Vars
+ *		lastInnerVar	highest attnum from inner tuple slot (0 if none)
+ *		lastOuterVar	highest attnum from outer tuple slot (0 if none)
+ *		lastScanVar		highest attnum from scan tuple slot (0 if none)
+ * ----------------
+ */
+typedef struct ProjectionInfo
+{
+	NodeTag		type;
+	List	   *pi_targetlist;
+	ExprContext *pi_exprContext;
+	TupleTableSlot *pi_slot;
+	ExprDoneCond *pi_itemIsDone;
+	bool		pi_directMap;
+	int			pi_numSimpleVars;
+	int		   *pi_varSlotOffsets;
+	int		   *pi_varNumbers;
+	int		   *pi_varOutputCols;
+	int			pi_lastInnerVar;
+	int			pi_lastOuterVar;
+	int			pi_lastScanVar;
+} ProjectionInfo;
+
+/* ----------------
+ *	  JunkFilter
+ *
+ *	  This class is used to store information regarding junk attributes.
+ *	  A junk attribute is an attribute in a tuple that is needed only for
+ *	  storing intermediate information in the executor, and does not belong
+ *	  in emitted tuples.  For example, when we do an UPDATE query,
+ *	  the planner adds a "junk" entry to the targetlist so that the tuples
+ *	  returned to ExecutePlan() contain an extra attribute: the ctid of
+ *	  the tuple to be updated.  This is needed to do the update, but we
+ *	  don't want the ctid to be part of the stored new tuple!  So, we
+ *	  apply a "junk filter" to remove the junk attributes and form the
+ *	  real output tuple.  The junkfilter code also provides routines to
+ *	  extract the values of the junk attribute(s) from the input tuple.
+ *
+ *	  targetList:		the original target list (including junk attributes).
+ *	  cleanTupType:		the tuple descriptor for the "clean" tuple (with
+ *						junk attributes removed).
+ *	  cleanMap:			A map with the correspondence between the non-junk
+ *						attribute numbers of the "original" tuple and the
+ *						attribute numbers of the "clean" tuple.
+ *	  resultSlot:		tuple slot used to hold cleaned tuple.
+ *	  junkAttNo:		not used by junkfilter code.  Can be used by caller
+ *						to remember the attno of a specific junk attribute
+ *						(nodeModifyTable.c keeps the "ctid" or "wholerow"
+ *						attno here).
+ * ----------------
+ */
+typedef struct JunkFilter
+{
+	NodeTag		type;
+	List	   *jf_targetList;
+	TupleDesc	jf_cleanTupType;
+	AttrNumber *jf_cleanMap;
+	TupleTableSlot *jf_resultSlot;
+	AttrNumber	jf_junkAttNo;
+} JunkFilter;
+
+/* ----------------
+ *	  ResultRelInfo information
+ *
+ *		Whenever we update an existing relation, we have to
+ *		update indices on the relation, and perhaps also fire triggers.
+ *		The ResultRelInfo class is used to hold all the information needed
+ *		about a result relation, including indices.. -cim 10/15/89
+ *
+ *		RangeTableIndex			result relation's range table index
+ *		RelationDesc			relation descriptor for result relation
+ *		NumIndices				# of indices existing on result relation
+ *		IndexRelationDescs		array of relation descriptors for indices
+ *		IndexRelationInfo		array of key/attr info for indices
+ *		TrigDesc				triggers to be fired, if any
+ *		TrigFunctions			cached lookup info for trigger functions
+ *		TrigWhenExprs			array of trigger WHEN expr states
+ *		TrigInstrument			optional runtime measurements for triggers
+ *		FdwRoutine				FDW callback functions, if foreign table
+ *		FdwState				available to save private state of FDW
+ *		WithCheckOptions		list of WithCheckOption's to be checked
+ *		WithCheckOptionExprs	list of WithCheckOption expr states
+ *		ConstraintExprs			array of constraint-checking expr states
+ *		junkFilter				for removing junk attributes from tuples
+ *		projectReturning		for computing a RETURNING list
+ *		onConflictSetProj		for computing ON CONFLICT DO UPDATE SET
+ *		onConflictSetWhere		list of ON CONFLICT DO UPDATE exprs (qual)
+ * ----------------
+ */
+typedef struct ResultRelInfo
+{
+	NodeTag		type;
+	Index		ri_RangeTableIndex;
+	Relation	ri_RelationDesc;
+	int			ri_NumIndices;
+	RelationPtr ri_IndexRelationDescs;
+	IndexInfo **ri_IndexRelationInfo;
+	TriggerDesc *ri_TrigDesc;
+	FmgrInfo   *ri_TrigFunctions;
+	List	  **ri_TrigWhenExprs;
+	Instrumentation *ri_TrigInstrument;
+	struct FdwRoutine *ri_FdwRoutine;
+	void	   *ri_FdwState;
+	List	   *ri_WithCheckOptions;
+	List	   *ri_WithCheckOptionExprs;
+	List	  **ri_ConstraintExprs;
+	JunkFilter *ri_junkFilter;
+	ProjectionInfo *ri_projectReturning;
+	ProjectionInfo *ri_onConflictSetProj;
+	List	   *ri_onConflictSetWhere;
+} ResultRelInfo;
+
+/* ----------------
+ *	  EState information
+ *
+ * Master working state for an Executor invocation
+ * ----------------
+ */
+typedef struct EState
+{
+	NodeTag		type;
+
+	/* Basic state for all query types: */
+	ScanDirection es_direction; /* current scan direction */
+	Snapshot	es_snapshot;	/* time qual to use */
+	Snapshot	es_crosscheck_snapshot; /* crosscheck time qual for RI */
+	List	   *es_range_table; /* List of RangeTblEntry */
+	PlannedStmt *es_plannedstmt;	/* link to top of plan tree */
+
+	JunkFilter *es_junkFilter;	/* top-level junk filter, if any */
+
+	/* If query can insert/delete tuples, the command ID to mark them with */
+	CommandId	es_output_cid;
+
+	/* Info about target table(s) for insert/update/delete queries: */
+	ResultRelInfo *es_result_relations; /* array of ResultRelInfos */
+	int			es_num_result_relations;		/* length of array */
+	ResultRelInfo *es_result_relation_info;		/* currently active array elt */
+
+	/* Stuff used for firing triggers: */
+	List	   *es_trig_target_relations;		/* trigger-only ResultRelInfos */
+	TupleTableSlot *es_trig_tuple_slot; /* for trigger output tuples */
+	TupleTableSlot *es_trig_oldtup_slot;		/* for TriggerEnabled */
+	TupleTableSlot *es_trig_newtup_slot;		/* for TriggerEnabled */
+
+	/* Parameter info: */
+	ParamListInfo es_param_list_info;	/* values of external params */
+	ParamExecData *es_param_exec_vals;	/* values of internal params */
+
+	/* Other working state: */
+	MemoryContext es_query_cxt; /* per-query context in which EState lives */
+
+	List	   *es_tupleTable;	/* List of TupleTableSlots */
+
+	List	   *es_rowMarks;	/* List of ExecRowMarks */
+
+	uint32		es_processed;	/* # of tuples processed */
+	Oid			es_lastoid;		/* last oid processed (by INSERT) */
+
+	int			es_top_eflags;	/* eflags passed to ExecutorStart */
+	int			es_instrument;	/* OR of InstrumentOption flags */
+	bool		es_finished;	/* true when ExecutorFinish is done */
+
+	List	   *es_exprcontexts;	/* List of ExprContexts within EState */
+
+	List	   *es_subplanstates;		/* List of PlanState for SubPlans */
+
+	List	   *es_auxmodifytables;		/* List of secondary ModifyTableStates */
+
+	/*
+	 * this ExprContext is for per-output-tuple operations, such as constraint
+	 * checks and index-value computations.  It will be reset for each output
+	 * tuple.  Note that it will be created only if needed.
+	 */
+	ExprContext *es_per_tuple_exprcontext;
+
+	/*
+	 * These fields are for re-evaluating plan quals when an updated tuple is
+	 * substituted in READ COMMITTED mode.  es_epqTuple[] contains tuples that
+	 * scan plan nodes should return instead of whatever they'd normally
+	 * return, or NULL if nothing to return; es_epqTupleSet[] is true if a
+	 * particular array entry is valid; and es_epqScanDone[] is state to
+	 * remember if the tuple has been returned already.  Arrays are of size
+	 * list_length(es_range_table) and are indexed by scan node scanrelid - 1.
+	 */
+	HeapTuple  *es_epqTuple;	/* array of EPQ substitute tuples */
+	bool	   *es_epqTupleSet; /* true if EPQ tuple is provided */
+	bool	   *es_epqScanDone; /* true if EPQ tuple has been fetched */
+} EState;
+
+
+/*
+ * ExecRowMark -
+ *	   runtime representation of FOR [KEY] UPDATE/SHARE clauses
+ *
+ * When doing UPDATE, DELETE, or SELECT FOR [KEY] UPDATE/SHARE, we will have an
+ * ExecRowMark for each non-target relation in the query (except inheritance
+ * parent RTEs, which can be ignored at runtime).  Virtual relations such as
+ * subqueries-in-FROM will have an ExecRowMark with relation == NULL.  See
+ * PlanRowMark for details about most of the fields.  In addition to fields
+ * directly derived from PlanRowMark, we store an activity flag (to denote
+ * inactive children of inheritance trees), curCtid, which is used by the
+ * WHERE CURRENT OF code, and ermExtra, which is available for use by the plan
+ * node that sources the relation (e.g., for a foreign table the FDW can use
+ * ermExtra to hold information).
+ *
+ * EState->es_rowMarks is a list of these structs.
+ */
+typedef struct ExecRowMark
+{
+	Relation	relation;		/* opened and suitably locked relation */
+	Oid			relid;			/* its OID (or InvalidOid, if subquery) */
+	Index		rti;			/* its range table index */
+	Index		prti;			/* parent range table index, if child */
+	Index		rowmarkId;		/* unique identifier for resjunk columns */
+	RowMarkType markType;		/* see enum in nodes/plannodes.h */
+	LockClauseStrength strength;	/* LockingClause's strength, or LCS_NONE */
+	LockWaitPolicy waitPolicy;	/* NOWAIT and SKIP LOCKED */
+	bool		ermActive;		/* is this mark relevant for current tuple? */
+	ItemPointerData curCtid;	/* ctid of currently locked tuple, if any */
+	void	   *ermExtra;		/* available for use by relation source node */
+} ExecRowMark;
+
+/*
+ * ExecAuxRowMark -
+ *	   additional runtime representation of FOR [KEY] UPDATE/SHARE clauses
+ *
+ * Each LockRows and ModifyTable node keeps a list of the rowmarks it needs to
+ * deal with.  In addition to a pointer to the related entry in es_rowMarks,
+ * this struct carries the column number(s) of the resjunk columns associated
+ * with the rowmark (see comments for PlanRowMark for more detail).  In the
+ * case of ModifyTable, there has to be a separate ExecAuxRowMark list for
+ * each child plan, because the resjunk columns could be at different physical
+ * column positions in different subplans.
+ */
+typedef struct ExecAuxRowMark
+{
+	ExecRowMark *rowmark;		/* related entry in es_rowMarks */
+	AttrNumber	ctidAttNo;		/* resno of ctid junk attribute, if any */
+	AttrNumber	toidAttNo;		/* resno of tableoid junk attribute, if any */
+	AttrNumber	wholeAttNo;		/* resno of whole-row junk attribute, if any */
+} ExecAuxRowMark;
+
+
+/* ----------------------------------------------------------------
+ *				 Tuple Hash Tables
+ *
+ * All-in-memory tuple hash tables are used for a number of purposes.
+ *
+ * Note: tab_hash_funcs are for the key datatype(s) stored in the table,
+ * and tab_eq_funcs are non-cross-type equality operators for those types.
+ * Normally these are the only functions used, but FindTupleHashEntry()
+ * supports searching a hashtable using cross-data-type hashing.  For that,
+ * the caller must supply hash functions for the LHS datatype as well as
+ * the cross-type equality operators to use.  in_hash_funcs and cur_eq_funcs
+ * are set to point to the caller's function arrays while doing such a search.
+ * During LookupTupleHashEntry(), they point to tab_hash_funcs and
+ * tab_eq_funcs respectively.
+ * ----------------------------------------------------------------
+ */
+typedef struct TupleHashEntryData *TupleHashEntry;
+typedef struct TupleHashTableData *TupleHashTable;
+
+typedef struct TupleHashEntryData
+{
+	/* firstTuple must be the first field in this struct! */
+	MinimalTuple firstTuple;	/* copy of first tuple in this group */
+	/* there may be additional data beyond the end of this struct */
+} TupleHashEntryData;			/* VARIABLE LENGTH STRUCT */
+
+typedef struct TupleHashTableData
+{
+	HTAB	   *hashtab;		/* underlying dynahash table */
+	int			numCols;		/* number of columns in lookup key */
+	AttrNumber *keyColIdx;		/* attr numbers of key columns */
+	FmgrInfo   *tab_hash_funcs; /* hash functions for table datatype(s) */
+	FmgrInfo   *tab_eq_funcs;	/* equality functions for table datatype(s) */
+	MemoryContext tablecxt;		/* memory context containing table */
+	MemoryContext tempcxt;		/* context for function evaluations */
+	Size		entrysize;		/* actual size to make each hash entry */
+	TupleTableSlot *tableslot;	/* slot for referencing table entries */
+	/* The following fields are set transiently for each table search: */
+	TupleTableSlot *inputslot;	/* current input tuple's slot */
+	FmgrInfo   *in_hash_funcs;	/* hash functions for input datatype(s) */
+	FmgrInfo   *cur_eq_funcs;	/* equality functions for input vs. table */
+}	TupleHashTableData;
+
+typedef HASH_SEQ_STATUS TupleHashIterator;
+
+/*
+ * Use InitTupleHashIterator/TermTupleHashIterator for a read/write scan.
+ * Use ResetTupleHashIterator if the table can be frozen (in this case no
+ * explicit scan termination is needed).
+ */
+#define InitTupleHashIterator(htable, iter) \
+	hash_seq_init(iter, (htable)->hashtab)
+#define TermTupleHashIterator(iter) \
+	hash_seq_term(iter)
+#define ResetTupleHashIterator(htable, iter) \
+	do { \
+		hash_freeze((htable)->hashtab); \
+		hash_seq_init(iter, (htable)->hashtab); \
+	} while (0)
+#define ScanTupleHashTable(iter) \
+	((TupleHashEntry) hash_seq_search(iter))
+
+
+/* ----------------------------------------------------------------
+ *				 Expression State Trees
+ *
+ * Each executable expression tree has a parallel ExprState tree.
+ *
+ * Unlike PlanState, there is not an exact one-for-one correspondence between
+ * ExprState node types and Expr node types.  Many Expr node types have no
+ * need for node-type-specific run-time state, and so they can use plain
+ * ExprState or GenericExprState as their associated ExprState node type.
+ * ----------------------------------------------------------------
+ */
+
+/* ----------------
+ *		ExprState node
+ *
+ * ExprState is the common superclass for all ExprState-type nodes.
+ *
+ * It can also be instantiated directly for leaf Expr nodes that need no
+ * local run-time state (such as Var, Const, or Param).
+ *
+ * To save on dispatch overhead, each ExprState node contains a function
+ * pointer to the routine to execute to evaluate the node.
+ * ----------------
+ */
+
+typedef struct ExprState ExprState;
+
+typedef Datum (*ExprStateEvalFunc) (ExprState *expression,
+												ExprContext *econtext,
+												bool *isNull,
+												ExprDoneCond *isDone);
+
+struct ExprState
+{
+	NodeTag		type;
+	Expr	   *expr;			/* associated Expr node */
+	ExprStateEvalFunc evalfunc; /* routine to run to execute node */
+};
+
+/* ----------------
+ *		GenericExprState node
+ *
+ * This is used for Expr node types that need no local run-time state,
+ * but have one child Expr node.
+ * ----------------
+ */
+typedef struct GenericExprState
+{
+	ExprState	xprstate;
+	ExprState  *arg;			/* state of my child node */
+} GenericExprState;
+
+/* ----------------
+ *		WholeRowVarExprState node
+ * ----------------
+ */
+typedef struct WholeRowVarExprState
+{
+	ExprState	xprstate;
+	struct PlanState *parent;	/* parent PlanState, or NULL if none */
+	TupleDesc	wrv_tupdesc;	/* descriptor for resulting tuples */
+	JunkFilter *wrv_junkFilter; /* JunkFilter to remove resjunk cols */
+} WholeRowVarExprState;
+
+/* ----------------
+ *		AggrefExprState node
+ * ----------------
+ */
+typedef struct AggrefExprState
+{
+	ExprState	xprstate;
+	List	   *aggdirectargs;	/* states of direct-argument expressions */
+	List	   *args;			/* states of aggregated-argument expressions */
+	ExprState  *aggfilter;		/* state of FILTER expression, if any */
+	int			aggno;			/* ID number for agg within its plan node */
+} AggrefExprState;
+
+/* ----------------
+ *		GroupingFuncExprState node
+ *
+ * The list of column numbers refers to the input tuples of the Agg node to
+ * which the GroupingFunc belongs, and may contain 0 for references to columns
+ * that are only present in grouping sets processed by different Agg nodes (and
+ * which are therefore always considered "grouping" here).
+ * ----------------
+ */
+typedef struct GroupingFuncExprState
+{
+	ExprState	xprstate;
+	struct AggState *aggstate;
+	List	   *clauses;		/* integer list of column numbers */
+} GroupingFuncExprState;
+
+/* ----------------
+ *		WindowFuncExprState node
+ * ----------------
+ */
+typedef struct WindowFuncExprState
+{
+	ExprState	xprstate;
+	List	   *args;			/* states of argument expressions */
+	ExprState  *aggfilter;		/* FILTER expression */
+	int			wfuncno;		/* ID number for wfunc within its plan node */
+} WindowFuncExprState;
+
+/* ----------------
+ *		ArrayRefExprState node
+ *
+ * Note: array types can be fixed-length (typlen > 0), but only when the
+ * element type is itself fixed-length.  Otherwise they are varlena structures
+ * and have typlen = -1.  In any case, an array type is never pass-by-value.
+ * ----------------
+ */
+typedef struct ArrayRefExprState
+{
+	ExprState	xprstate;
+	List	   *refupperindexpr;	/* states for child nodes */
+	List	   *reflowerindexpr;
+	ExprState  *refexpr;
+	ExprState  *refassgnexpr;
+	int16		refattrlength;	/* typlen of array type */
+	int16		refelemlength;	/* typlen of the array element type */
+	bool		refelembyval;	/* is the element type pass-by-value? */
+	char		refelemalign;	/* typalign of the element type */
+} ArrayRefExprState;
+
+/* ----------------
+ *		FuncExprState node
+ *
+ * Although named for FuncExpr, this is also used for OpExpr, DistinctExpr,
+ * and NullIf nodes; be careful to check what xprstate.expr is actually
+ * pointing at!
+ * ----------------
+ */
+typedef struct FuncExprState
+{
+	ExprState	xprstate;
+	List	   *args;			/* states of argument expressions */
+
+	/*
+	 * Function manager's lookup info for the target function.  If func.fn_oid
+	 * is InvalidOid, we haven't initialized it yet (nor any of the following
+	 * fields).
+	 */
+	FmgrInfo	func;
+
+	/*
+	 * For a set-returning function (SRF) that returns a tuplestore, we keep
+	 * the tuplestore here and dole out the result rows one at a time. The
+	 * slot holds the row currently being returned.
+	 */
+	Tuplestorestate *funcResultStore;
+	TupleTableSlot *funcResultSlot;
+
+	/*
+	 * In some cases we need to compute a tuple descriptor for the function's
+	 * output.  If so, it's stored here.
+	 */
+	TupleDesc	funcResultDesc;
+	bool		funcReturnsTuple;		/* valid when funcResultDesc isn't
+										 * NULL */
+
+	/*
+	 * setArgsValid is true when we are evaluating a set-returning function
+	 * that uses value-per-call mode and we are in the middle of a call
+	 * series; we want to pass the same argument values to the function again
+	 * (and again, until it returns ExprEndResult).  This indicates that
+	 * fcinfo_data already contains valid argument data.
+	 */
+	bool		setArgsValid;
+
+	/*
+	 * Flag to remember whether we found a set-valued argument to the
+	 * function. This causes the function result to be a set as well. Valid
+	 * only when setArgsValid is true or funcResultStore isn't NULL.
+	 */
+	bool		setHasSetArg;	/* some argument returns a set */
+
+	/*
+	 * Flag to remember whether we have registered a shutdown callback for
+	 * this FuncExprState.  We do so only if funcResultStore or setArgsValid
+	 * has been set at least once (since all the callback is for is to release
+	 * the tuplestore or clear setArgsValid).
+	 */
+	bool		shutdown_reg;	/* a shutdown callback is registered */
+
+	/*
+	 * Call parameter structure for the function.  This has been initialized
+	 * (by InitFunctionCallInfoData) if func.fn_oid is valid.  It also saves
+	 * argument values between calls, when setArgsValid is true.
+	 */
+	FunctionCallInfoData fcinfo_data;
+} FuncExprState;
+
+/* ----------------
+ *		ScalarArrayOpExprState node
+ *
+ * This is a FuncExprState plus some additional data.
+ * ----------------
+ */
+typedef struct ScalarArrayOpExprState
+{
+	FuncExprState fxprstate;
+	/* Cached info about array element type */
+	Oid			element_type;
+	int16		typlen;
+	bool		typbyval;
+	char		typalign;
+} ScalarArrayOpExprState;
+
+/* ----------------
+ *		BoolExprState node
+ * ----------------
+ */
+typedef struct BoolExprState
+{
+	ExprState	xprstate;
+	List	   *args;			/* states of argument expression(s) */
+} BoolExprState;
+
+/* ----------------
+ *		SubPlanState node
+ * ----------------
+ */
+typedef struct SubPlanState
+{
+	ExprState	xprstate;
+	struct PlanState *planstate;	/* subselect plan's state tree */
+	struct PlanState *parent;	/* parent plan node's state tree */
+	ExprState  *testexpr;		/* state of combining expression */
+	List	   *args;			/* states of argument expression(s) */
+	HeapTuple	curTuple;		/* copy of most recent tuple from subplan */
+	Datum		curArray;		/* most recent array from ARRAY() subplan */
+	/* these are used when hashing the subselect's output: */
+	ProjectionInfo *projLeft;	/* for projecting lefthand exprs */
+	ProjectionInfo *projRight;	/* for projecting subselect output */
+	TupleHashTable hashtable;	/* hash table for no-nulls subselect rows */
+	TupleHashTable hashnulls;	/* hash table for rows with null(s) */
+	bool		havehashrows;	/* TRUE if hashtable is not empty */
+	bool		havenullrows;	/* TRUE if hashnulls is not empty */
+	MemoryContext hashtablecxt; /* memory context containing hash tables */
+	MemoryContext hashtempcxt;	/* temp memory context for hash tables */
+	ExprContext *innerecontext; /* econtext for computing inner tuples */
+	AttrNumber *keyColIdx;		/* control data for hash tables */
+	FmgrInfo   *tab_hash_funcs; /* hash functions for table datatype(s) */
+	FmgrInfo   *tab_eq_funcs;	/* equality functions for table datatype(s) */
+	FmgrInfo   *lhs_hash_funcs; /* hash functions for lefthand datatype(s) */
+	FmgrInfo   *cur_eq_funcs;	/* equality functions for LHS vs. table */
+} SubPlanState;
+
+/* ----------------
+ *		AlternativeSubPlanState node
+ * ----------------
+ */
+typedef struct AlternativeSubPlanState
+{
+	ExprState	xprstate;
+	List	   *subplans;		/* states of alternative subplans */
+	int			active;			/* list index of the one we're using */
+} AlternativeSubPlanState;
+
+/* ----------------
+ *		FieldSelectState node
+ * ----------------
+ */
+typedef struct FieldSelectState
+{
+	ExprState	xprstate;
+	ExprState  *arg;			/* input expression */
+	TupleDesc	argdesc;		/* tupdesc for most recent input */
+} FieldSelectState;
+
+/* ----------------
+ *		FieldStoreState node
+ * ----------------
+ */
+typedef struct FieldStoreState
+{
+	ExprState	xprstate;
+	ExprState  *arg;			/* input tuple value */
+	List	   *newvals;		/* new value(s) for field(s) */
+	TupleDesc	argdesc;		/* tupdesc for most recent input */
+} FieldStoreState;
+
+/* ----------------
+ *		CoerceViaIOState node
+ * ----------------
+ */
+typedef struct CoerceViaIOState
+{
+	ExprState	xprstate;
+	ExprState  *arg;			/* input expression */
+	FmgrInfo	outfunc;		/* lookup info for source output function */
+	FmgrInfo	infunc;			/* lookup info for result input function */
+	Oid			intypioparam;	/* argument needed for input function */
+} CoerceViaIOState;
+
+/* ----------------
+ *		ArrayCoerceExprState node
+ * ----------------
+ */
+typedef struct ArrayCoerceExprState
+{
+	ExprState	xprstate;
+	ExprState  *arg;			/* input array value */
+	Oid			resultelemtype; /* element type of result array */
+	FmgrInfo	elemfunc;		/* lookup info for element coercion function */
+	/* use struct pointer to avoid including array.h here */
+	struct ArrayMapState *amstate;		/* workspace for array_map */
+} ArrayCoerceExprState;
+
+/* ----------------
+ *		ConvertRowtypeExprState node
+ * ----------------
+ */
+typedef struct ConvertRowtypeExprState
+{
+	ExprState	xprstate;
+	ExprState  *arg;			/* input tuple value */
+	TupleDesc	indesc;			/* tupdesc for source rowtype */
+	TupleDesc	outdesc;		/* tupdesc for result rowtype */
+	/* use "struct" so we needn't include tupconvert.h here */
+	struct TupleConversionMap *map;
+	bool		initialized;
+} ConvertRowtypeExprState;
+
+/* ----------------
+ *		CaseExprState node
+ * ----------------
+ */
+typedef struct CaseExprState
+{
+	ExprState	xprstate;
+	ExprState  *arg;			/* implicit equality comparison argument */
+	List	   *args;			/* the arguments (list of WHEN clauses) */
+	ExprState  *defresult;		/* the default result (ELSE clause) */
+} CaseExprState;
+
+/* ----------------
+ *		CaseWhenState node
+ * ----------------
+ */
+typedef struct CaseWhenState
+{
+	ExprState	xprstate;
+	ExprState  *expr;			/* condition expression */
+	ExprState  *result;			/* substitution result */
+} CaseWhenState;
+
+/* ----------------
+ *		ArrayExprState node
+ *
+ * Note: ARRAY[] expressions always produce varlena arrays, never fixed-length
+ * arrays.
+ * ----------------
+ */
+typedef struct ArrayExprState
+{
+	ExprState	xprstate;
+	List	   *elements;		/* states for child nodes */
+	int16		elemlength;		/* typlen of the array element type */
+	bool		elembyval;		/* is the element type pass-by-value? */
+	char		elemalign;		/* typalign of the element type */
+} ArrayExprState;
+
+/* ----------------
+ *		RowExprState node
+ * ----------------
+ */
+typedef struct RowExprState
+{
+	ExprState	xprstate;
+	List	   *args;			/* the arguments */
+	TupleDesc	tupdesc;		/* descriptor for result tuples */
+} RowExprState;
+
+/* ----------------
+ *		RowCompareExprState node
+ * ----------------
+ */
+typedef struct RowCompareExprState
+{
+	ExprState	xprstate;
+	List	   *largs;			/* the left-hand input arguments */
+	List	   *rargs;			/* the right-hand input arguments */
+	FmgrInfo   *funcs;			/* array of comparison function info */
+	Oid		   *collations;		/* array of collations to use */
+} RowCompareExprState;
+
+/* ----------------
+ *		CoalesceExprState node
+ * ----------------
+ */
+typedef struct CoalesceExprState
+{
+	ExprState	xprstate;
+	List	   *args;			/* the arguments */
+} CoalesceExprState;
+
+/* ----------------
+ *		MinMaxExprState node
+ * ----------------
+ */
+typedef struct MinMaxExprState
+{
+	ExprState	xprstate;
+	List	   *args;			/* the arguments */
+	FmgrInfo	cfunc;			/* lookup info for comparison func */
+} MinMaxExprState;
+
+/* ----------------
+ *		XmlExprState node
+ * ----------------
+ */
+typedef struct XmlExprState
+{
+	ExprState	xprstate;
+	List	   *named_args;		/* ExprStates for named arguments */
+	List	   *args;			/* ExprStates for other arguments */
+} XmlExprState;
+
+/* ----------------
+ *		NullTestState node
+ * ----------------
+ */
+typedef struct NullTestState
+{
+	ExprState	xprstate;
+	ExprState  *arg;			/* input expression */
+	/* used only if input is of composite type: */
+	TupleDesc	argdesc;		/* tupdesc for most recent input */
+} NullTestState;
+
+/* ----------------
+ *		CoerceToDomainState node
+ * ----------------
+ */
+typedef struct CoerceToDomainState
+{
+	ExprState	xprstate;
+	ExprState  *arg;			/* input expression */
+	/* Cached set of constraints that need to be checked */
+	/* use struct pointer to avoid including typcache.h here */
+	struct DomainConstraintRef *constraint_ref;
+} CoerceToDomainState;
+
+/*
+ * DomainConstraintState - one item to check during CoerceToDomain
+ *
+ * Note: this is just a Node, and not an ExprState, because it has no
+ * corresponding Expr to link to.  Nonetheless it is part of an ExprState
+ * tree, so we give it a name following the xxxState convention.
+ */
+typedef enum DomainConstraintType
+{
+	DOM_CONSTRAINT_NOTNULL,
+	DOM_CONSTRAINT_CHECK
+} DomainConstraintType;
+
+typedef struct DomainConstraintState
+{
+	NodeTag		type;
+	DomainConstraintType constrainttype;		/* constraint type */
+	char	   *name;			/* name of constraint (for error msgs) */
+	ExprState  *check_expr;		/* for CHECK, a boolean expression */
+} DomainConstraintState;
+
+
+/* ----------------------------------------------------------------
+ *				 Executor State Trees
+ *
+ * An executing query has a PlanState tree paralleling the Plan tree
+ * that describes the plan.
+ * ----------------------------------------------------------------
+ */
+
+/* ----------------
+ *		PlanState node
+ *
+ * We never actually instantiate any PlanState nodes; this is just the common
+ * abstract superclass for all PlanState-type nodes.
+ * ----------------
+ */
+typedef struct PlanState
+{
+	NodeTag		type;
+
+	Plan	   *plan;			/* associated Plan node */
+
+	EState	   *state;			/* at execution time, states of individual
+								 * nodes point to one EState for the whole
+								 * top-level plan */
+
+	Instrumentation *instrument;	/* Optional runtime stats for this node */
+
+	/*
+	 * Common structural data for all Plan types.  These links to subsidiary
+	 * state trees parallel links in the associated plan tree (except for the
+	 * subPlan list, which does not exist in the plan tree).
+	 */
+	List	   *targetlist;		/* target list to be computed at this node */
+	List	   *qual;			/* implicitly-ANDed qual conditions */
+	struct PlanState *lefttree; /* input plan tree(s) */
+	struct PlanState *righttree;
+	List	   *initPlan;		/* Init SubPlanState nodes (un-correlated expr
+								 * subselects) */
+	List	   *subPlan;		/* SubPlanState nodes in my expressions */
+
+	/*
+	 * State for management of parameter-change-driven rescanning
+	 */
+	Bitmapset  *chgParam;		/* set of IDs of changed Params */
+
+	/*
+	 * Other run-time state needed by most if not all node types.
+	 */
+	TupleTableSlot *ps_ResultTupleSlot; /* slot for my result tuples */
+	ExprContext *ps_ExprContext;	/* node's expression-evaluation context */
+	ProjectionInfo *ps_ProjInfo;	/* info for doing tuple projection */
+	bool		ps_TupFromTlist;/* state flag for processing set-valued
+								 * functions in targetlist */
+} PlanState;
+
+/* ----------------
+ *	these are defined to avoid confusion problems with "left"
+ *	and "right" and "inner" and "outer".  The convention is that
+ *	the "left" plan is the "outer" plan and the "right" plan is
+ *	the inner plan, but these make the code more readable.
+ * ----------------
+ */
+#define innerPlanState(node)		(((PlanState *)(node))->righttree)
+#define outerPlanState(node)		(((PlanState *)(node))->lefttree)
+
+/* Macros for inline access to certain instrumentation counters */
+#define InstrCountFiltered1(node, delta) \
+	do { \
+		if (((PlanState *)(node))->instrument) \
+			((PlanState *)(node))->instrument->nfiltered1 += (delta); \
+	} while(0)
+#define InstrCountFiltered2(node, delta) \
+	do { \
+		if (((PlanState *)(node))->instrument) \
+			((PlanState *)(node))->instrument->nfiltered2 += (delta); \
+	} while(0)
+
+/*
+ * EPQState is state for executing an EvalPlanQual recheck on a candidate
+ * tuple in ModifyTable or LockRows.  The estate and planstate fields are
+ * NULL if inactive.
+ */
+typedef struct EPQState
+{
+	EState	   *estate;			/* subsidiary EState */
+	PlanState  *planstate;		/* plan state tree ready to be executed */
+	TupleTableSlot *origslot;	/* original output tuple to be rechecked */
+	Plan	   *plan;			/* plan tree to be executed */
+	List	   *arowMarks;		/* ExecAuxRowMarks (non-locking only) */
+	int			epqParam;		/* ID of Param to force scan node re-eval */
+} EPQState;
+
+
+/* ----------------
+ *	 ResultState information
+ * ----------------
+ */
+typedef struct ResultState
+{
+	PlanState	ps;				/* its first field is NodeTag */
+	ExprState  *resconstantqual;
+	bool		rs_done;		/* are we done? */
+	bool		rs_checkqual;	/* do we need to check the qual? */
+} ResultState;
+
+/* ----------------
+ *	 ModifyTableState information
+ * ----------------
+ */
+typedef struct ModifyTableState
+{
+	PlanState	ps;				/* its first field is NodeTag */
+	CmdType		operation;		/* INSERT, UPDATE, or DELETE */
+	bool		canSetTag;		/* do we set the command tag/es_processed? */
+	bool		mt_done;		/* are we done? */
+	PlanState **mt_plans;		/* subplans (one per target rel) */
+	int			mt_nplans;		/* number of plans in the array */
+	int			mt_whichplan;	/* which one is being executed (0..n-1) */
+	ResultRelInfo *resultRelInfo;		/* per-subplan target relations */
+	List	  **mt_arowmarks;	/* per-subplan ExecAuxRowMark lists */
+	EPQState	mt_epqstate;	/* for evaluating EvalPlanQual rechecks */
+	bool		fireBSTriggers; /* do we need to fire stmt triggers? */
+	OnConflictAction mt_onconflict;		/* ON CONFLICT type */
+	List	   *mt_arbiterindexes;		/* unique index OIDs to arbitrate
+										 * taking alt path */
+	TupleTableSlot *mt_existing;	/* slot to store existing target tuple in */
+	List	   *mt_excludedtlist;		/* the excluded pseudo relation's
+										 * tlist  */
+	TupleTableSlot *mt_conflproj;		/* CONFLICT ... SET ... projection
+										 * target */
+} ModifyTableState;
+
+/* ----------------
+ *	 AppendState information
+ *
+ *		nplans			how many plans are in the array
+ *		whichplan		which plan is being executed (0 .. n-1)
+ * ----------------
+ */
+typedef struct AppendState
+{
+	PlanState	ps;				/* its first field is NodeTag */
+	PlanState **appendplans;	/* array of PlanStates for my inputs */
+	int			as_nplans;
+	int			as_whichplan;
+} AppendState;
+
+/* ----------------
+ *	 MergeAppendState information
+ *
+ *		nplans			how many plans are in the array
+ *		nkeys			number of sort key columns
+ *		sortkeys		sort keys in SortSupport representation
+ *		slots			current output tuple of each subplan
+ *		heap			heap of active tuples
+ *		initialized		true if we have fetched first tuple from each subplan
+ * ----------------
+ */
+typedef struct MergeAppendState
+{
+	PlanState	ps;				/* its first field is NodeTag */
+	PlanState **mergeplans;		/* array of PlanStates for my inputs */
+	int			ms_nplans;
+	int			ms_nkeys;
+	SortSupport ms_sortkeys;	/* array of length ms_nkeys */
+	TupleTableSlot **ms_slots;	/* array of length ms_nplans */
+	struct binaryheap *ms_heap; /* binary heap of slot indices */
+	bool		ms_initialized; /* are subplans started? */
+} MergeAppendState;
+
+/* ----------------
+ *	 RecursiveUnionState information
+ *
+ *		RecursiveUnionState is used for performing a recursive union.
+ *
+ *		recursing			T when we're done scanning the non-recursive term
+ *		intermediate_empty	T if intermediate_table is currently empty
+ *		working_table		working table (to be scanned by recursive term)
+ *		intermediate_table	current recursive output (next generation of WT)
+ * ----------------
+ */
+typedef struct RecursiveUnionState
+{
+	PlanState	ps;				/* its first field is NodeTag */
+	bool		recursing;
+	bool		intermediate_empty;
+	Tuplestorestate *working_table;
+	Tuplestorestate *intermediate_table;
+	/* Remaining fields are unused in UNION ALL case */
+	FmgrInfo   *eqfunctions;	/* per-grouping-field equality fns */
+	FmgrInfo   *hashfunctions;	/* per-grouping-field hash fns */
+	MemoryContext tempContext;	/* short-term context for comparisons */
+	TupleHashTable hashtable;	/* hash table for tuples already seen */
+	MemoryContext tableContext; /* memory context containing hash table */
+} RecursiveUnionState;
+
+/* ----------------
+ *	 BitmapAndState information
+ * ----------------
+ */
+typedef struct BitmapAndState
+{
+	PlanState	ps;				/* its first field is NodeTag */
+	PlanState **bitmapplans;	/* array of PlanStates for my inputs */
+	int			nplans;			/* number of input plans */
+} BitmapAndState;
+
+/* ----------------
+ *	 BitmapOrState information
+ * ----------------
+ */
+typedef struct BitmapOrState
+{
+	PlanState	ps;				/* its first field is NodeTag */
+	PlanState **bitmapplans;	/* array of PlanStates for my inputs */
+	int			nplans;			/* number of input plans */
+} BitmapOrState;
+
+/* ----------------------------------------------------------------
+ *				 Scan State Information
+ * ----------------------------------------------------------------
+ */
+
+/* ----------------
+ *	 ScanState information
+ *
+ *		ScanState extends PlanState for node types that represent
+ *		scans of an underlying relation.  It can also be used for nodes
+ *		that scan the output of an underlying plan node --- in that case,
+ *		only ScanTupleSlot is actually useful, and it refers to the tuple
+ *		retrieved from the subplan.
+ *
+ *		currentRelation    relation being scanned (NULL if none)
+ *		currentScanDesc    current scan descriptor for scan (NULL if none)
+ *		ScanTupleSlot	   pointer to slot in tuple table holding scan tuple
+ * ----------------
+ */
+typedef struct ScanState
+{
+	PlanState	ps;				/* its first field is NodeTag */
+	Relation	ss_currentRelation;
+	HeapScanDesc ss_currentScanDesc;
+	TupleTableSlot *ss_ScanTupleSlot;
+} ScanState;
+
+/*
+ * SeqScan uses a bare ScanState as its state node, since it needs
+ * no additional fields.
+ */
+typedef ScanState SeqScanState;
+
+/* ----------------
+ *	 SampleScanState information
+ * ----------------
+ */
+typedef struct SampleScanState
+{
+	ScanState	ss;
+	List	   *args;			/* expr states for TABLESAMPLE params */
+	ExprState  *repeatable;		/* expr state for REPEATABLE expr */
+	/* use struct pointer to avoid including tsmapi.h here */
+	struct TsmRoutine *tsmroutine;		/* descriptor for tablesample method */
+	void	   *tsm_state;		/* tablesample method can keep state here */
+	bool		use_bulkread;	/* use bulkread buffer access strategy? */
+	bool		use_pagemode;	/* use page-at-a-time visibility checking? */
+	bool		begun;			/* false means need to call BeginSampleScan */
+	uint32		seed;			/* random seed */
+} SampleScanState;
+
+/*
+ * These structs store information about index quals that don't have simple
+ * constant right-hand sides.  See comments for ExecIndexBuildScanKeys()
+ * for discussion.
+ */
+typedef struct
+{
+	ScanKey		scan_key;		/* scankey to put value into */
+	ExprState  *key_expr;		/* expr to evaluate to get value */
+	bool		key_toastable;	/* is expr's result a toastable datatype? */
+} IndexRuntimeKeyInfo;
+
+typedef struct
+{
+	ScanKey		scan_key;		/* scankey to put value into */
+	ExprState  *array_expr;		/* expr to evaluate to get array value */
+	int			next_elem;		/* next array element to use */
+	int			num_elems;		/* number of elems in current array value */
+	Datum	   *elem_values;	/* array of num_elems Datums */
+	bool	   *elem_nulls;		/* array of num_elems is-null flags */
+} IndexArrayKeyInfo;
+
+/* ----------------
+ *	 IndexScanState information
+ *
+ *		indexqualorig	   execution state for indexqualorig expressions
+ *		indexorderbyorig   execution state for indexorderbyorig expressions
+ *		ScanKeys		   Skey structures for index quals
+ *		NumScanKeys		   number of ScanKeys
+ *		OrderByKeys		   Skey structures for index ordering operators
+ *		NumOrderByKeys	   number of OrderByKeys
+ *		RuntimeKeys		   info about Skeys that must be evaluated at runtime
+ *		NumRuntimeKeys	   number of RuntimeKeys
+ *		RuntimeKeysReady   true if runtime Skeys have been computed
+ *		RuntimeContext	   expr context for evaling runtime Skeys
+ *		RelationDesc	   index relation descriptor
+ *		ScanDesc		   index scan descriptor
+ *
+ *		ReorderQueue	   tuples that need reordering due to re-check
+ *		ReachedEnd		   have we fetched all tuples from index already?
+ *		OrderByValues	   values of ORDER BY exprs of last fetched tuple
+ *		OrderByNulls	   null flags for OrderByValues
+ *		SortSupport		   for reordering ORDER BY exprs
+ *		OrderByTypByVals   is the datatype of order by expression pass-by-value?
+ *		OrderByTypLens	   typlens of the datatypes of order by expressions
+ * ----------------
+ */
+typedef struct IndexScanState
+{
+	ScanState	ss;				/* its first field is NodeTag */
+	List	   *indexqualorig;
+	List	   *indexorderbyorig;
+	ScanKey		iss_ScanKeys;
+	int			iss_NumScanKeys;
+	ScanKey		iss_OrderByKeys;
+	int			iss_NumOrderByKeys;
+	IndexRuntimeKeyInfo *iss_RuntimeKeys;
+	int			iss_NumRuntimeKeys;
+	bool		iss_RuntimeKeysReady;
+	ExprContext *iss_RuntimeContext;
+	Relation	iss_RelationDesc;
+	IndexScanDesc iss_ScanDesc;
+
+	/* These are needed for re-checking ORDER BY expr ordering */
+	pairingheap *iss_ReorderQueue;
+	bool		iss_ReachedEnd;
+	Datum	   *iss_OrderByValues;
+	bool	   *iss_OrderByNulls;
+	SortSupport iss_SortSupport;
+	bool	   *iss_OrderByTypByVals;
+	int16	   *iss_OrderByTypLens;
+} IndexScanState;
+
+/* ----------------
+ *	 IndexOnlyScanState information
+ *
+ *		indexqual		   execution state for indexqual expressions
+ *		ScanKeys		   Skey structures for index quals
+ *		NumScanKeys		   number of ScanKeys
+ *		OrderByKeys		   Skey structures for index ordering operators
+ *		NumOrderByKeys	   number of OrderByKeys
+ *		RuntimeKeys		   info about Skeys that must be evaluated at runtime
+ *		NumRuntimeKeys	   number of RuntimeKeys
+ *		RuntimeKeysReady   true if runtime Skeys have been computed
+ *		RuntimeContext	   expr context for evaling runtime Skeys
+ *		RelationDesc	   index relation descriptor
+ *		ScanDesc		   index scan descriptor
+ *		VMBuffer		   buffer in use for visibility map testing, if any
+ *		HeapFetches		   number of tuples we were forced to fetch from heap
+ * ----------------
+ */
+typedef struct IndexOnlyScanState
+{
+	ScanState	ss;				/* its first field is NodeTag */
+	List	   *indexqual;
+	ScanKey		ioss_ScanKeys;
+	int			ioss_NumScanKeys;
+	ScanKey		ioss_OrderByKeys;
+	int			ioss_NumOrderByKeys;
+	IndexRuntimeKeyInfo *ioss_RuntimeKeys;
+	int			ioss_NumRuntimeKeys;
+	bool		ioss_RuntimeKeysReady;
+	ExprContext *ioss_RuntimeContext;
+	Relation	ioss_RelationDesc;
+	IndexScanDesc ioss_ScanDesc;
+	Buffer		ioss_VMBuffer;
+	long		ioss_HeapFetches;
+} IndexOnlyScanState;
+
+/* ----------------
+ *	 BitmapIndexScanState information
+ *
+ *		result			   bitmap to return output into, or NULL
+ *		ScanKeys		   Skey structures for index quals
+ *		NumScanKeys		   number of ScanKeys
+ *		RuntimeKeys		   info about Skeys that must be evaluated at runtime
+ *		NumRuntimeKeys	   number of RuntimeKeys
+ *		ArrayKeys		   info about Skeys that come from ScalarArrayOpExprs
+ *		NumArrayKeys	   number of ArrayKeys
+ *		RuntimeKeysReady   true if runtime Skeys have been computed
+ *		RuntimeContext	   expr context for evaling runtime Skeys
+ *		RelationDesc	   index relation descriptor
+ *		ScanDesc		   index scan descriptor
+ * ----------------
+ */
+typedef struct BitmapIndexScanState
+{
+	ScanState	ss;				/* its first field is NodeTag */
+	TIDBitmap  *biss_result;
+	ScanKey		biss_ScanKeys;
+	int			biss_NumScanKeys;
+	IndexRuntimeKeyInfo *biss_RuntimeKeys;
+	int			biss_NumRuntimeKeys;
+	IndexArrayKeyInfo *biss_ArrayKeys;
+	int			biss_NumArrayKeys;
+	bool		biss_RuntimeKeysReady;
+	ExprContext *biss_RuntimeContext;
+	Relation	biss_RelationDesc;
+	IndexScanDesc biss_ScanDesc;
+} BitmapIndexScanState;
+
+/* ----------------
+ *	 BitmapHeapScanState information
+ *
+ *		bitmapqualorig	   execution state for bitmapqualorig expressions
+ *		tbm				   bitmap obtained from child index scan(s)
+ *		tbmiterator		   iterator for scanning current pages
+ *		tbmres			   current-page data
+ *		exact_pages		   total number of exact pages retrieved
+ *		lossy_pages		   total number of lossy pages retrieved
+ *		prefetch_iterator  iterator for prefetching ahead of current page
+ *		prefetch_pages	   # pages prefetch iterator is ahead of current
+ *		prefetch_target    target prefetch distance
+ * ----------------
+ */
+typedef struct BitmapHeapScanState
+{
+	ScanState	ss;				/* its first field is NodeTag */
+	List	   *bitmapqualorig;
+	TIDBitmap  *tbm;
+	TBMIterator *tbmiterator;
+	TBMIterateResult *tbmres;
+	long		exact_pages;
+	long		lossy_pages;
+	TBMIterator *prefetch_iterator;
+	int			prefetch_pages;
+	int			prefetch_target;
+} BitmapHeapScanState;
+
+/* ----------------
+ *	 TidScanState information
+ *
+ *		isCurrentOf    scan has a CurrentOfExpr qual
+ *		NumTids		   number of tids in this scan
+ *		TidPtr		   index of currently fetched tid
+ *		TidList		   evaluated item pointers (array of size NumTids)
+ * ----------------
+ */
+typedef struct TidScanState
+{
+	ScanState	ss;				/* its first field is NodeTag */
+	List	   *tss_tidquals;	/* list of ExprState nodes */
+	bool		tss_isCurrentOf;
+	int			tss_NumTids;
+	int			tss_TidPtr;
+	ItemPointerData *tss_TidList;
+	HeapTupleData tss_htup;
+} TidScanState;
+
+/* ----------------
+ *	 SubqueryScanState information
+ *
+ *		SubqueryScanState is used for scanning a sub-query in the range table.
+ *		ScanTupleSlot references the current output tuple of the sub-query.
+ * ----------------
+ */
+typedef struct SubqueryScanState
+{
+	ScanState	ss;				/* its first field is NodeTag */
+	PlanState  *subplan;
+} SubqueryScanState;
+
+/* ----------------
+ *	 FunctionScanState information
+ *
+ *		Function nodes are used to scan the results of a
+ *		function appearing in FROM (typically a function returning set).
+ *
+ *		eflags				node's capability flags
+ *		ordinality			is this scan WITH ORDINALITY?
+ *		simple				true if we have 1 function and no ordinality
+ *		ordinal				current ordinal column value
+ *		nfuncs				number of functions being executed
+ *		funcstates			per-function execution states (private in
+ *							nodeFunctionscan.c)
+ *		argcontext			memory context to evaluate function arguments in
+ * ----------------
+ */
+struct FunctionScanPerFuncState;
+
+typedef struct FunctionScanState
+{
+	ScanState	ss;				/* its first field is NodeTag */
+	int			eflags;
+	bool		ordinality;
+	bool		simple;
+	int64		ordinal;
+	int			nfuncs;
+	struct FunctionScanPerFuncState *funcstates;		/* array of length
+														 * nfuncs */
+	MemoryContext argcontext;
+} FunctionScanState;
+
+/* ----------------
+ *	 ValuesScanState information
+ *
+ *		ValuesScan nodes are used to scan the results of a VALUES list
+ *
+ *		rowcontext			per-expression-list context
+ *		exprlists			array of expression lists being evaluated
+ *		array_len			size of array
+ *		curr_idx			current array index (0-based)
+ *
+ *	Note: ss.ps.ps_ExprContext is used to evaluate any qual or projection
+ *	expressions attached to the node.  We create a second ExprContext,
+ *	rowcontext, in which to build the executor expression state for each
+ *	Values sublist.  Resetting this context lets us get rid of expression
+ *	state for each row, avoiding major memory leakage over a long values list.
+ * ----------------
+ */
+typedef struct ValuesScanState
+{
+	ScanState	ss;				/* its first field is NodeTag */
+	ExprContext *rowcontext;
+	List	  **exprlists;
+	int			array_len;
+	int			curr_idx;
+} ValuesScanState;
+
+/* ----------------
+ *	 CteScanState information
+ *
+ *		CteScan nodes are used to scan a CommonTableExpr query.
+ *
+ * Multiple CteScan nodes can read out from the same CTE query.  We use
+ * a tuplestore to hold rows that have been read from the CTE query but
+ * not yet consumed by all readers.
+ * ----------------
+ */
+typedef struct CteScanState
+{
+	ScanState	ss;				/* its first field is NodeTag */
+	int			eflags;			/* capability flags to pass to tuplestore */
+	int			readptr;		/* index of my tuplestore read pointer */
+	PlanState  *cteplanstate;	/* PlanState for the CTE query itself */
+	/* Link to the "leader" CteScanState (possibly this same node) */
+	struct CteScanState *leader;
+	/* The remaining fields are only valid in the "leader" CteScanState */
+	Tuplestorestate *cte_table; /* rows already read from the CTE query */
+	bool		eof_cte;		/* reached end of CTE query? */
+} CteScanState;
+
+/* ----------------
+ *	 WorkTableScanState information
+ *
+ *		WorkTableScan nodes are used to scan the work table created by
+ *		a RecursiveUnion node.  We locate the RecursiveUnion node
+ *		during executor startup.
+ * ----------------
+ */
+typedef struct WorkTableScanState
+{
+	ScanState	ss;				/* its first field is NodeTag */
+	RecursiveUnionState *rustate;
+} WorkTableScanState;
+
+/* ----------------
+ *	 ForeignScanState information
+ *
+ *		ForeignScan nodes are used to scan foreign-data tables.
+ * ----------------
+ */
+typedef struct ForeignScanState
+{
+	ScanState	ss;				/* its first field is NodeTag */
+	List	   *fdw_recheck_quals;	/* original quals not in ss.ps.qual */
+	/* use struct pointer to avoid including fdwapi.h here */
+	struct FdwRoutine *fdwroutine;
+	void	   *fdw_state;		/* foreign-data wrapper can keep state here */
+} ForeignScanState;
+
+/* ----------------
+ *	 CustomScanState information
+ *
+ *		CustomScan nodes are used to execute custom code within executor.
+ *
+ * Core code must avoid assuming that the CustomScanState is only as large as
+ * the structure declared here; providers are allowed to make it the first
+ * element in a larger structure, and typically would need to do so.  The
+ * struct is actually allocated by the CreateCustomScanState method associated
+ * with the plan node.  Any additional fields can be initialized there, or in
+ * the BeginCustomScan method.
+ * ----------------
+ */
+struct ExplainState;			/* avoid including explain.h here */
+struct CustomScanState;
+
+typedef struct CustomExecMethods
+{
+	const char *CustomName;
+
+	/* Executor methods: mark/restore are optional, the rest are required */
+	void		(*BeginCustomScan) (struct CustomScanState *node,
+												EState *estate,
+												int eflags);
+	TupleTableSlot *(*ExecCustomScan) (struct CustomScanState *node);
+	void		(*EndCustomScan) (struct CustomScanState *node);
+	void		(*ReScanCustomScan) (struct CustomScanState *node);
+	void		(*MarkPosCustomScan) (struct CustomScanState *node);
+	void		(*RestrPosCustomScan) (struct CustomScanState *node);
+
+	/* Optional: print additional information in EXPLAIN */
+	void		(*ExplainCustomScan) (struct CustomScanState *node,
+												  List *ancestors,
+												  struct ExplainState *es);
+} CustomExecMethods;
+
+typedef struct CustomScanState
+{
+	ScanState	ss;
+	uint32		flags;			/* mask of CUSTOMPATH_* flags, see relation.h */
+	List	   *custom_ps;		/* list of child PlanState nodes, if any */
+	const CustomExecMethods *methods;
+} CustomScanState;
+
+/* ----------------------------------------------------------------
+ *				 Join State Information
+ * ----------------------------------------------------------------
+ */
+
+/* ----------------
+ *	 JoinState information
+ *
+ *		Superclass for state nodes of join plans.
+ * ----------------
+ */
+typedef struct JoinState
+{
+	PlanState	ps;
+	JoinType	jointype;
+	List	   *joinqual;		/* JOIN quals (in addition to ps.qual) */
+} JoinState;
+
+/* ----------------
+ *	 NestLoopState information
+ *
+ *		NeedNewOuter	   true if need new outer tuple on next call
+ *		MatchedOuter	   true if found a join match for current outer tuple
+ *		NullInnerTupleSlot prepared null tuple for left outer joins
+ * ----------------
+ */
+typedef struct NestLoopState
+{
+	JoinState	js;				/* its first field is NodeTag */
+	bool		nl_NeedNewOuter;
+	bool		nl_MatchedOuter;
+	TupleTableSlot *nl_NullInnerTupleSlot;
+} NestLoopState;
+
+/* ----------------
+ *	 MergeJoinState information
+ *
+ *		NumClauses		   number of mergejoinable join clauses
+ *		Clauses			   info for each mergejoinable clause
+ *		JoinState		   current state of ExecMergeJoin state machine
+ *		ExtraMarks		   true to issue extra Mark operations on inner scan
+ *		ConstFalseJoin	   true if we have a constant-false joinqual
+ *		FillOuter		   true if should emit unjoined outer tuples anyway
+ *		FillInner		   true if should emit unjoined inner tuples anyway
+ *		MatchedOuter	   true if found a join match for current outer tuple
+ *		MatchedInner	   true if found a join match for current inner tuple
+ *		OuterTupleSlot	   slot in tuple table for cur outer tuple
+ *		InnerTupleSlot	   slot in tuple table for cur inner tuple
+ *		MarkedTupleSlot    slot in tuple table for marked tuple
+ *		NullOuterTupleSlot prepared null tuple for right outer joins
+ *		NullInnerTupleSlot prepared null tuple for left outer joins
+ *		OuterEContext	   workspace for computing outer tuple's join values
+ *		InnerEContext	   workspace for computing inner tuple's join values
+ * ----------------
+ */
+/* private in nodeMergejoin.c: */
+typedef struct MergeJoinClauseData *MergeJoinClause;
+
+typedef struct MergeJoinState
+{
+	JoinState	js;				/* its first field is NodeTag */
+	int			mj_NumClauses;
+	MergeJoinClause mj_Clauses; /* array of length mj_NumClauses */
+	int			mj_JoinState;
+	bool		mj_ExtraMarks;
+	bool		mj_ConstFalseJoin;
+	bool		mj_FillOuter;
+	bool		mj_FillInner;
+	bool		mj_MatchedOuter;
+	bool		mj_MatchedInner;
+	TupleTableSlot *mj_OuterTupleSlot;
+	TupleTableSlot *mj_InnerTupleSlot;
+	TupleTableSlot *mj_MarkedTupleSlot;
+	TupleTableSlot *mj_NullOuterTupleSlot;
+	TupleTableSlot *mj_NullInnerTupleSlot;
+	ExprContext *mj_OuterEContext;
+	ExprContext *mj_InnerEContext;
+} MergeJoinState;
+
+/* ----------------
+ *	 HashJoinState information
+ *
+ *		hashclauses				original form of the hashjoin condition
+ *		hj_OuterHashKeys		the outer hash keys in the hashjoin condition
+ *		hj_InnerHashKeys		the inner hash keys in the hashjoin condition
+ *		hj_HashOperators		the join operators in the hashjoin condition
+ *		hj_HashTable			hash table for the hashjoin
+ *								(NULL if table not built yet)
+ *		hj_CurHashValue			hash value for current outer tuple
+ *		hj_CurBucketNo			regular bucket# for current outer tuple
+ *		hj_CurSkewBucketNo		skew bucket# for current outer tuple
+ *		hj_CurTuple				last inner tuple matched to current outer
+ *								tuple, or NULL if starting search
+ *								(hj_CurXXX variables are undefined if
+ *								OuterTupleSlot is empty!)
+ *		hj_OuterTupleSlot		tuple slot for outer tuples
+ *		hj_HashTupleSlot		tuple slot for inner (hashed) tuples
+ *		hj_NullOuterTupleSlot	prepared null tuple for right/full outer joins
+ *		hj_NullInnerTupleSlot	prepared null tuple for left/full outer joins
+ *		hj_FirstOuterTupleSlot	first tuple retrieved from outer plan
+ *		hj_JoinState			current state of ExecHashJoin state machine
+ *		hj_MatchedOuter			true if found a join match for current outer
+ *		hj_OuterNotEmpty		true if outer relation known not empty
+ * ----------------
+ */
+
+/* these structs are defined in executor/hashjoin.h: */
+typedef struct HashJoinTupleData *HashJoinTuple;
+typedef struct HashJoinTableData *HashJoinTable;
+
+typedef struct HashJoinState
+{
+	JoinState	js;				/* its first field is NodeTag */
+	List	   *hashclauses;	/* list of ExprState nodes */
+	List	   *hj_OuterHashKeys;		/* list of ExprState nodes */
+	List	   *hj_InnerHashKeys;		/* list of ExprState nodes */
+	List	   *hj_HashOperators;		/* list of operator OIDs */
+	HashJoinTable hj_HashTable;
+	uint32		hj_CurHashValue;
+	int			hj_CurBucketNo;
+	int			hj_CurSkewBucketNo;
+	HashJoinTuple hj_CurTuple;
+	TupleTableSlot *hj_OuterTupleSlot;
+	TupleTableSlot *hj_HashTupleSlot;
+	TupleTableSlot *hj_NullOuterTupleSlot;
+	TupleTableSlot *hj_NullInnerTupleSlot;
+	TupleTableSlot *hj_FirstOuterTupleSlot;
+	int			hj_JoinState;
+	bool		hj_MatchedOuter;
+	bool		hj_OuterNotEmpty;
+} HashJoinState;
+
+
+/* ----------------------------------------------------------------
+ *				 Materialization State Information
+ * ----------------------------------------------------------------
+ */
+
+/* ----------------
+ *	 MaterialState information
+ *
+ *		materialize nodes are used to materialize the results
+ *		of a subplan into a temporary file.
+ *
+ *		ss.ss_ScanTupleSlot refers to output of underlying plan.
+ * ----------------
+ */
+typedef struct MaterialState
+{
+	ScanState	ss;				/* its first field is NodeTag */
+	int			eflags;			/* capability flags to pass to tuplestore */
+	bool		eof_underlying; /* reached end of underlying plan? */
+	Tuplestorestate *tuplestorestate;
+} MaterialState;
+
+/* ----------------
+ *	 SortState information
+ * ----------------
+ */
+typedef struct SortState
+{
+	ScanState	ss;				/* its first field is NodeTag */
+	bool		randomAccess;	/* need random access to sort output? */
+	bool		bounded;		/* is the result set bounded? */
+	int64		bound;			/* if bounded, how many tuples are needed */
+	bool		sort_Done;		/* sort completed yet? */
+	bool		bounded_Done;	/* value of bounded we did the sort with */
+	int64		bound_Done;		/* value of bound we did the sort with */
+	void	   *tuplesortstate; /* private state of tuplesort.c */
+} SortState;
+
+/* ---------------------
+ *	GroupState information
+ * -------------------------
+ */
+typedef struct GroupState
+{
+	ScanState	ss;				/* its first field is NodeTag */
+	FmgrInfo   *eqfunctions;	/* per-field lookup data for equality fns */
+	bool		grp_done;		/* indicates completion of Group scan */
+} GroupState;
+
+/* ---------------------
+ *	AggState information
+ *
+ *	ss.ss_ScanTupleSlot refers to output of underlying plan.
+ *
+ *	Note: ss.ps.ps_ExprContext contains ecxt_aggvalues and
+ *	ecxt_aggnulls arrays, which hold the computed agg values for the current
+ *	input group during evaluation of an Agg node's output tuple(s).  We
+ *	create a second ExprContext, tmpcontext, in which to evaluate input
+ *	expressions and run the aggregate transition functions.
+ * -------------------------
+ */
+/* these structs are private in nodeAgg.c: */
+typedef struct AggStatePerAggData *AggStatePerAgg;
+typedef struct AggStatePerGroupData *AggStatePerGroup;
+typedef struct AggStatePerPhaseData *AggStatePerPhase;
+
+typedef struct AggState
+{
+	ScanState	ss;				/* its first field is NodeTag */
+	List	   *aggs;			/* all Aggref nodes in targetlist & quals */
+	int			numaggs;		/* length of list (could be zero!) */
+	AggStatePerPhase phase;		/* pointer to current phase data */
+	int			numphases;		/* number of phases */
+	int			current_phase;	/* current phase number */
+	FmgrInfo   *hashfunctions;	/* per-grouping-field hash fns */
+	AggStatePerAgg peragg;		/* per-Aggref information */
+	ExprContext **aggcontexts;	/* econtexts for long-lived data (per GS) */
+	ExprContext *tmpcontext;	/* econtext for input expressions */
+	AggStatePerAgg curperagg;	/* identifies currently active aggregate */
+	bool		input_done;		/* indicates end of input */
+	bool		agg_done;		/* indicates completion of Agg scan */
+	int			projected_set;	/* The last projected grouping set */
+	int			current_set;	/* The current grouping set being evaluated */
+	Bitmapset  *grouped_cols;	/* grouped cols in current projection */
+	List	   *all_grouped_cols;		/* list of all grouped cols in DESC
+										 * order */
+	/* These fields are for grouping set phase data */
+	int			maxsets;		/* The max number of sets in any phase */
+	AggStatePerPhase phases;	/* array of all phases */
+	Tuplesortstate *sort_in;	/* sorted input to phases > 0 */
+	Tuplesortstate *sort_out;	/* input is copied here for next phase */
+	TupleTableSlot *sort_slot;	/* slot for sort results */
+	/* these fields are used in AGG_PLAIN and AGG_SORTED modes: */
+	AggStatePerGroup pergroup;	/* per-Aggref-per-group working state */
+	HeapTuple	grp_firstTuple; /* copy of first tuple of current group */
+	/* these fields are used in AGG_HASHED mode: */
+	TupleHashTable hashtable;	/* hash table with one entry per group */
+	TupleTableSlot *hashslot;	/* slot for loading hash table */
+	List	   *hash_needed;	/* list of columns needed in hash table */
+	bool		table_filled;	/* hash table filled yet? */
+	TupleHashIterator hashiter; /* for iterating through hash table */
+} AggState;
+
+/* ----------------
+ *	WindowAggState information
+ * ----------------
+ */
+/* these structs are private in nodeWindowAgg.c: */
+typedef struct WindowStatePerFuncData *WindowStatePerFunc;
+typedef struct WindowStatePerAggData *WindowStatePerAgg;
+
+typedef struct WindowAggState
+{
+	ScanState	ss;				/* its first field is NodeTag */
+
+	/* these fields are filled in by ExecInitExpr: */
+	List	   *funcs;			/* all WindowFunc nodes in targetlist */
+	int			numfuncs;		/* total number of window functions */
+	int			numaggs;		/* number that are plain aggregates */
+
+	WindowStatePerFunc perfunc; /* per-window-function information */
+	WindowStatePerAgg peragg;	/* per-plain-aggregate information */
+	FmgrInfo   *partEqfunctions;	/* equality funcs for partition columns */
+	FmgrInfo   *ordEqfunctions; /* equality funcs for ordering columns */
+	Tuplestorestate *buffer;	/* stores rows of current partition */
+	int			current_ptr;	/* read pointer # for current */
+	int64		spooled_rows;	/* total # of rows in buffer */
+	int64		currentpos;		/* position of current row in partition */
+	int64		frameheadpos;	/* current frame head position */
+	int64		frametailpos;	/* current frame tail position */
+	/* use struct pointer to avoid including windowapi.h here */
+	struct WindowObjectData *agg_winobj;		/* winobj for aggregate
+												 * fetches */
+	int64		aggregatedbase; /* start row for current aggregates */
+	int64		aggregatedupto; /* rows before this one are aggregated */
+
+	int			frameOptions;	/* frame_clause options, see WindowDef */
+	ExprState  *startOffset;	/* expression for starting bound offset */
+	ExprState  *endOffset;		/* expression for ending bound offset */
+	Datum		startOffsetValue;		/* result of startOffset evaluation */
+	Datum		endOffsetValue; /* result of endOffset evaluation */
+
+	MemoryContext partcontext;	/* context for partition-lifespan data */
+	MemoryContext aggcontext;	/* shared context for aggregate working data */
+	MemoryContext curaggcontext;	/* current aggregate's working data */
+	ExprContext *tmpcontext;	/* short-term evaluation context */
+
+	bool		all_first;		/* true if the scan is starting */
+	bool		all_done;		/* true if the scan is finished */
+	bool		partition_spooled;		/* true if all tuples in current
+										 * partition have been spooled into
+										 * tuplestore */
+	bool		more_partitions;/* true if there's more partitions after this
+								 * one */
+	bool		framehead_valid;/* true if frameheadpos is known up to date
+								 * for current row */
+	bool		frametail_valid;/* true if frametailpos is known up to date
+								 * for current row */
+
+	TupleTableSlot *first_part_slot;	/* first tuple of current or next
+										 * partition */
+
+	/* temporary slots for tuples fetched back from tuplestore */
+	TupleTableSlot *agg_row_slot;
+	TupleTableSlot *temp_slot_1;
+	TupleTableSlot *temp_slot_2;
+} WindowAggState;
+
+/* ----------------
+ *	 UniqueState information
+ *
+ *		Unique nodes are used "on top of" sort nodes to discard
+ *		duplicate tuples returned from the sort phase.  Basically
+ *		all it does is compare the current tuple from the subplan
+ *		with the previously fetched tuple (stored in its result slot).
+ *		If the two are identical in all interesting fields, then
+ *		we just fetch another tuple from the sort and try again.
+ * ----------------
+ */
+typedef struct UniqueState
+{
+	PlanState	ps;				/* its first field is NodeTag */
+	FmgrInfo   *eqfunctions;	/* per-field lookup data for equality fns */
+	MemoryContext tempContext;	/* short-term context for comparisons */
+} UniqueState;
+
+/* ----------------
+ *	 HashState information
+ * ----------------
+ */
+typedef struct HashState
+{
+	PlanState	ps;				/* its first field is NodeTag */
+	HashJoinTable hashtable;	/* hash table for the hashjoin */
+	List	   *hashkeys;		/* list of ExprState nodes */
+	/* hashkeys is same as parent's hj_InnerHashKeys */
+} HashState;
+
+/* ----------------
+ *	 SetOpState information
+ *
+ *		Even in "sorted" mode, SetOp nodes are more complex than a simple
+ *		Unique, since we have to count how many duplicates to return.  But
+ *		we also support hashing, so this is really more like a cut-down
+ *		form of Agg.
+ * ----------------
+ */
+/* this struct is private in nodeSetOp.c: */
+typedef struct SetOpStatePerGroupData *SetOpStatePerGroup;
+
+typedef struct SetOpState
+{
+	PlanState	ps;				/* its first field is NodeTag */
+	FmgrInfo   *eqfunctions;	/* per-grouping-field equality fns */
+	FmgrInfo   *hashfunctions;	/* per-grouping-field hash fns */
+	bool		setop_done;		/* indicates completion of output scan */
+	long		numOutput;		/* number of dups left to output */
+	MemoryContext tempContext;	/* short-term context for comparisons */
+	/* these fields are used in SETOP_SORTED mode: */
+	SetOpStatePerGroup pergroup;	/* per-group working state */
+	HeapTuple	grp_firstTuple; /* copy of first tuple of current group */
+	/* these fields are used in SETOP_HASHED mode: */
+	TupleHashTable hashtable;	/* hash table with one entry per group */
+	MemoryContext tableContext; /* memory context containing hash table */
+	bool		table_filled;	/* hash table filled yet? */
+	TupleHashIterator hashiter; /* for iterating through hash table */
+} SetOpState;
+
+/* ----------------
+ *	 LockRowsState information
+ *
+ *		LockRows nodes are used to enforce FOR [KEY] UPDATE/SHARE locking.
+ * ----------------
+ */
+typedef struct LockRowsState
+{
+	PlanState	ps;				/* its first field is NodeTag */
+	List	   *lr_arowMarks;	/* List of ExecAuxRowMarks */
+	EPQState	lr_epqstate;	/* for evaluating EvalPlanQual rechecks */
+	HeapTuple  *lr_curtuples;	/* locked tuples (one entry per RT entry) */
+	int			lr_ntables;		/* length of lr_curtuples[] array */
+} LockRowsState;
+
+/* ----------------
+ *	 LimitState information
+ *
+ *		Limit nodes are used to enforce LIMIT/OFFSET clauses.
+ *		They just select the desired subrange of their subplan's output.
+ *
+ * offset is the number of initial tuples to skip (0 does nothing).
+ * count is the number of tuples to return after skipping the offset tuples.
+ * If no limit count was specified, count is undefined and noCount is true.
+ * When lstate == LIMIT_INITIAL, offset/count/noCount haven't been set yet.
+ * ----------------
+ */
+typedef enum
+{
+	LIMIT_INITIAL,				/* initial state for LIMIT node */
+	LIMIT_RESCAN,				/* rescan after recomputing parameters */
+	LIMIT_EMPTY,				/* there are no returnable rows */
+	LIMIT_INWINDOW,				/* have returned a row in the window */
+	LIMIT_SUBPLANEOF,			/* at EOF of subplan (within window) */
+	LIMIT_WINDOWEND,			/* stepped off end of window */
+	LIMIT_WINDOWSTART			/* stepped off beginning of window */
+} LimitStateCond;
+
+typedef struct LimitState
+{
+	PlanState	ps;				/* its first field is NodeTag */
+	ExprState  *limitOffset;	/* OFFSET parameter, or NULL if none */
+	ExprState  *limitCount;		/* COUNT parameter, or NULL if none */
+	int64		offset;			/* current OFFSET value */
+	int64		count;			/* current COUNT, if any */
+	bool		noCount;		/* if true, ignore count */
+	LimitStateCond lstate;		/* state machine status, as above */
+	int64		position;		/* 1-based index of last tuple returned */
+	TupleTableSlot *subSlot;	/* tuple last obtained from subplan */
+} LimitState;
+
+#endif   /* EXECNODES_H */
diff --git a/foreign/libpg_query/src/postgres/include/nodes/lockoptions.h b/foreign/libpg_query/src/postgres/include/nodes/lockoptions.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/nodes/lockoptions.h
@@ -0,0 +1,46 @@
+/*-------------------------------------------------------------------------
+ *
+ * lockoptions.h
+ *	  Common header for some locking-related declarations.
+ *
+ *
+ * Copyright (c) 2014-2015, PostgreSQL Global Development Group
+ *
+ * src/include/nodes/lockoptions.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef LOCKOPTIONS_H
+#define LOCKOPTIONS_H
+
+/*
+ * This enum represents the different strengths of FOR UPDATE/SHARE clauses.
+ * The ordering here is important, because the highest numerical value takes
+ * precedence when a RTE is specified multiple ways.  See applyLockingClause.
+ */
+typedef enum LockClauseStrength
+{
+	LCS_NONE,					/* no such clause - only used in PlanRowMark */
+	LCS_FORKEYSHARE,			/* FOR KEY SHARE */
+	LCS_FORSHARE,				/* FOR SHARE */
+	LCS_FORNOKEYUPDATE,			/* FOR NO KEY UPDATE */
+	LCS_FORUPDATE				/* FOR UPDATE */
+} LockClauseStrength;
+
+/*
+ * This enum controls how to deal with rows being locked by FOR UPDATE/SHARE
+ * clauses (i.e., it represents the NOWAIT and SKIP LOCKED options).
+ * The ordering here is important, because the highest numerical value takes
+ * precedence when a RTE is specified multiple ways.  See applyLockingClause.
+ */
+typedef enum LockWaitPolicy
+{
+	/* Wait for the lock to become available (default behavior) */
+	LockWaitBlock,
+	/* Skip rows that can't be locked (SKIP LOCKED) */
+	LockWaitSkip,
+	/* Raise an error if a row cannot be locked (NOWAIT) */
+	LockWaitError
+} LockWaitPolicy;
+
+#endif   /* LOCKOPTIONS_H */
diff --git a/foreign/libpg_query/src/postgres/include/nodes/makefuncs.h b/foreign/libpg_query/src/postgres/include/nodes/makefuncs.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/nodes/makefuncs.h
@@ -0,0 +1,86 @@
+/*-------------------------------------------------------------------------
+ *
+ * makefuncs.h
+ *	  prototypes for the creator functions (for primitive nodes)
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/nodes/makefuncs.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef MAKEFUNC_H
+#define MAKEFUNC_H
+
+#include "nodes/parsenodes.h"
+
+
+extern A_Expr *makeA_Expr(A_Expr_Kind kind, List *name,
+		   Node *lexpr, Node *rexpr, int location);
+
+extern A_Expr *makeSimpleA_Expr(A_Expr_Kind kind, char *name,
+				 Node *lexpr, Node *rexpr, int location);
+
+extern Var *makeVar(Index varno,
+		AttrNumber varattno,
+		Oid vartype,
+		int32 vartypmod,
+		Oid varcollid,
+		Index varlevelsup);
+
+extern Var *makeVarFromTargetEntry(Index varno,
+					   TargetEntry *tle);
+
+extern Var *makeWholeRowVar(RangeTblEntry *rte,
+				Index varno,
+				Index varlevelsup,
+				bool allowScalar);
+
+extern TargetEntry *makeTargetEntry(Expr *expr,
+				AttrNumber resno,
+				char *resname,
+				bool resjunk);
+
+extern TargetEntry *flatCopyTargetEntry(TargetEntry *src_tle);
+
+extern FromExpr *makeFromExpr(List *fromlist, Node *quals);
+
+extern Const *makeConst(Oid consttype,
+		  int32 consttypmod,
+		  Oid constcollid,
+		  int constlen,
+		  Datum constvalue,
+		  bool constisnull,
+		  bool constbyval);
+
+extern Const *makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid);
+
+extern Node *makeBoolConst(bool value, bool isnull);
+
+extern Expr *makeBoolExpr(BoolExprType boolop, List *args, int location);
+
+extern Alias *makeAlias(const char *aliasname, List *colnames);
+
+extern RelabelType *makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod,
+				Oid rcollid, CoercionForm rformat);
+
+extern RangeVar *makeRangeVar(char *schemaname, char *relname, int location);
+
+extern TypeName *makeTypeName(char *typnam);
+extern TypeName *makeTypeNameFromNameList(List *names);
+extern TypeName *makeTypeNameFromOid(Oid typeOid, int32 typmod);
+
+extern FuncExpr *makeFuncExpr(Oid funcid, Oid rettype, List *args,
+			 Oid funccollid, Oid inputcollid, CoercionForm fformat);
+
+extern FuncCall *makeFuncCall(List *name, List *args, int location);
+
+extern DefElem *makeDefElem(char *name, Node *arg);
+extern DefElem *makeDefElemExtended(char *nameSpace, char *name, Node *arg,
+					DefElemAction defaction, int location);
+
+extern GroupingSet *makeGroupingSet(GroupingSetKind kind, List *content, int location);
+
+#endif   /* MAKEFUNC_H */
diff --git a/foreign/libpg_query/src/postgres/include/nodes/memnodes.h b/foreign/libpg_query/src/postgres/include/nodes/memnodes.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/nodes/memnodes.h
@@ -0,0 +1,81 @@
+/*-------------------------------------------------------------------------
+ *
+ * memnodes.h
+ *	  POSTGRES memory context node definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/nodes/memnodes.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef MEMNODES_H
+#define MEMNODES_H
+
+#include "nodes/nodes.h"
+
+/*
+ * MemoryContext
+ *		A logical context in which memory allocations occur.
+ *
+ * MemoryContext itself is an abstract type that can have multiple
+ * implementations, though for now we have only AllocSetContext.
+ * The function pointers in MemoryContextMethods define one specific
+ * implementation of MemoryContext --- they are a virtual function table
+ * in C++ terms.
+ *
+ * Node types that are actual implementations of memory contexts must
+ * begin with the same fields as MemoryContext.
+ *
+ * Note: for largely historical reasons, typedef MemoryContext is a pointer
+ * to the context struct rather than the struct type itself.
+ */
+
+typedef struct MemoryContextMethods
+{
+	void	   *(*alloc) (MemoryContext context, Size size);
+	/* call this free_p in case someone #define's free() */
+	void		(*free_p) (MemoryContext context, void *pointer);
+	void	   *(*realloc) (MemoryContext context, void *pointer, Size size);
+	void		(*init) (MemoryContext context);
+	void		(*reset) (MemoryContext context);
+	void		(*delete_context) (MemoryContext context);
+	Size		(*get_chunk_space) (MemoryContext context, void *pointer);
+	bool		(*is_empty) (MemoryContext context);
+	void		(*stats) (MemoryContext context, int level);
+#ifdef MEMORY_CONTEXT_CHECKING
+	void		(*check) (MemoryContext context);
+#endif
+} MemoryContextMethods;
+
+
+typedef struct MemoryContextData
+{
+	NodeTag		type;			/* identifies exact kind of context */
+	/* these two fields are placed here to minimize alignment wastage: */
+	bool		isReset;		/* T = no space alloced since last reset */
+	bool		allowInCritSection;		/* allow palloc in critical section */
+	MemoryContextMethods *methods;		/* virtual function table */
+	MemoryContext parent;		/* NULL if no parent (toplevel context) */
+	MemoryContext firstchild;	/* head of linked list of children */
+	MemoryContext nextchild;	/* next child of same parent */
+	char	   *name;			/* context name (just for debugging) */
+	MemoryContextCallback *reset_cbs;	/* list of reset/delete callbacks */
+} MemoryContextData;
+
+/* utils/palloc.h contains typedef struct MemoryContextData *MemoryContext */
+
+
+/*
+ * MemoryContextIsValid
+ *		True iff memory context is valid.
+ *
+ * Add new context types to the set accepted by this macro.
+ */
+#define MemoryContextIsValid(context) \
+	((context) != NULL && \
+	 (IsA((context), AllocSetContext)))
+
+#endif   /* MEMNODES_H */
diff --git a/foreign/libpg_query/src/postgres/include/nodes/nodeFuncs.h b/foreign/libpg_query/src/postgres/include/nodes/nodeFuncs.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/nodes/nodeFuncs.h
@@ -0,0 +1,66 @@
+/*-------------------------------------------------------------------------
+ *
+ * nodeFuncs.h
+ *		Various general-purpose manipulations of Node trees
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/nodes/nodeFuncs.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef NODEFUNCS_H
+#define NODEFUNCS_H
+
+#include "nodes/parsenodes.h"
+
+
+/* flags bits for query_tree_walker and query_tree_mutator */
+#define QTW_IGNORE_RT_SUBQUERIES	0x01		/* subqueries in rtable */
+#define QTW_IGNORE_CTE_SUBQUERIES	0x02		/* subqueries in cteList */
+#define QTW_IGNORE_RC_SUBQUERIES	0x03		/* both of above */
+#define QTW_IGNORE_JOINALIASES		0x04		/* JOIN alias var lists */
+#define QTW_IGNORE_RANGE_TABLE		0x08		/* skip rangetable entirely */
+#define QTW_EXAMINE_RTES			0x10		/* examine RTEs */
+#define QTW_DONT_COPY_QUERY			0x20		/* do not copy top Query */
+
+
+extern Oid	exprType(const Node *expr);
+extern int32 exprTypmod(const Node *expr);
+extern bool exprIsLengthCoercion(const Node *expr, int32 *coercedTypmod);
+extern Node *relabel_to_typmod(Node *expr, int32 typmod);
+extern Node *strip_implicit_coercions(Node *node);
+extern bool expression_returns_set(Node *clause);
+
+extern Oid	exprCollation(const Node *expr);
+extern Oid	exprInputCollation(const Node *expr);
+extern void exprSetCollation(Node *expr, Oid collation);
+extern void exprSetInputCollation(Node *expr, Oid inputcollation);
+
+extern int	exprLocation(const Node *expr);
+
+extern bool expression_tree_walker(Node *node, bool (*walker) (),
+											   void *context);
+extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (),
+												 void *context);
+
+extern bool query_tree_walker(Query *query, bool (*walker) (),
+										  void *context, int flags);
+extern Query *query_tree_mutator(Query *query, Node *(*mutator) (),
+											 void *context, int flags);
+
+extern bool range_table_walker(List *rtable, bool (*walker) (),
+										   void *context, int flags);
+extern List *range_table_mutator(List *rtable, Node *(*mutator) (),
+											 void *context, int flags);
+
+extern bool query_or_expression_tree_walker(Node *node, bool (*walker) (),
+												   void *context, int flags);
+extern Node *query_or_expression_tree_mutator(Node *node, Node *(*mutator) (),
+												   void *context, int flags);
+
+extern bool raw_expression_tree_walker(Node *node, bool (*walker) (),
+												   void *context);
+
+#endif   /* NODEFUNCS_H */
diff --git a/foreign/libpg_query/src/postgres/include/nodes/nodes.h b/foreign/libpg_query/src/postgres/include/nodes/nodes.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/nodes/nodes.h
@@ -0,0 +1,652 @@
+/*-------------------------------------------------------------------------
+ *
+ * nodes.h
+ *	  Definitions for tagged nodes.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/nodes/nodes.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef NODES_H
+#define NODES_H
+
+/*
+ * The first field of every node is NodeTag. Each node created (with makeNode)
+ * will have one of the following tags as the value of its first field.
+ *
+ * Note that the numbers of the node tags are not contiguous. We left holes
+ * here so that we can add more tags without changing the existing enum's.
+ * (Since node tag numbers never exist outside backend memory, there's no
+ * real harm in renumbering, it just costs a full rebuild ...)
+ */
+typedef enum NodeTag
+{
+	T_Invalid = 0,
+
+	/*
+	 * TAGS FOR EXECUTOR NODES (execnodes.h)
+	 */
+	T_IndexInfo = 10,
+	T_ExprContext,
+	T_ProjectionInfo,
+	T_JunkFilter,
+	T_ResultRelInfo,
+	T_EState,
+	T_TupleTableSlot,
+
+	/*
+	 * TAGS FOR PLAN NODES (plannodes.h)
+	 */
+	T_Plan = 100,
+	T_Result,
+	T_ModifyTable,
+	T_Append,
+	T_MergeAppend,
+	T_RecursiveUnion,
+	T_BitmapAnd,
+	T_BitmapOr,
+	T_Scan,
+	T_SeqScan,
+	T_SampleScan,
+	T_IndexScan,
+	T_IndexOnlyScan,
+	T_BitmapIndexScan,
+	T_BitmapHeapScan,
+	T_TidScan,
+	T_SubqueryScan,
+	T_FunctionScan,
+	T_ValuesScan,
+	T_CteScan,
+	T_WorkTableScan,
+	T_ForeignScan,
+	T_CustomScan,
+	T_Join,
+	T_NestLoop,
+	T_MergeJoin,
+	T_HashJoin,
+	T_Material,
+	T_Sort,
+	T_Group,
+	T_Agg,
+	T_WindowAgg,
+	T_Unique,
+	T_Hash,
+	T_SetOp,
+	T_LockRows,
+	T_Limit,
+	/* these aren't subclasses of Plan: */
+	T_NestLoopParam,
+	T_PlanRowMark,
+	T_PlanInvalItem,
+
+	/*
+	 * TAGS FOR PLAN STATE NODES (execnodes.h)
+	 *
+	 * These should correspond one-to-one with Plan node types.
+	 */
+	T_PlanState = 200,
+	T_ResultState,
+	T_ModifyTableState,
+	T_AppendState,
+	T_MergeAppendState,
+	T_RecursiveUnionState,
+	T_BitmapAndState,
+	T_BitmapOrState,
+	T_ScanState,
+	T_SeqScanState,
+	T_SampleScanState,
+	T_IndexScanState,
+	T_IndexOnlyScanState,
+	T_BitmapIndexScanState,
+	T_BitmapHeapScanState,
+	T_TidScanState,
+	T_SubqueryScanState,
+	T_FunctionScanState,
+	T_ValuesScanState,
+	T_CteScanState,
+	T_WorkTableScanState,
+	T_ForeignScanState,
+	T_CustomScanState,
+	T_JoinState,
+	T_NestLoopState,
+	T_MergeJoinState,
+	T_HashJoinState,
+	T_MaterialState,
+	T_SortState,
+	T_GroupState,
+	T_AggState,
+	T_WindowAggState,
+	T_UniqueState,
+	T_HashState,
+	T_SetOpState,
+	T_LockRowsState,
+	T_LimitState,
+
+	/*
+	 * TAGS FOR PRIMITIVE NODES (primnodes.h)
+	 */
+	T_Alias = 300,
+	T_RangeVar,
+	T_Expr,
+	T_Var,
+	T_Const,
+	T_Param,
+	T_Aggref,
+	T_GroupingFunc,
+	T_WindowFunc,
+	T_ArrayRef,
+	T_FuncExpr,
+	T_NamedArgExpr,
+	T_OpExpr,
+	T_DistinctExpr,
+	T_NullIfExpr,
+	T_ScalarArrayOpExpr,
+	T_BoolExpr,
+	T_SubLink,
+	T_SubPlan,
+	T_AlternativeSubPlan,
+	T_FieldSelect,
+	T_FieldStore,
+	T_RelabelType,
+	T_CoerceViaIO,
+	T_ArrayCoerceExpr,
+	T_ConvertRowtypeExpr,
+	T_CollateExpr,
+	T_CaseExpr,
+	T_CaseWhen,
+	T_CaseTestExpr,
+	T_ArrayExpr,
+	T_RowExpr,
+	T_RowCompareExpr,
+	T_CoalesceExpr,
+	T_MinMaxExpr,
+	T_XmlExpr,
+	T_NullTest,
+	T_BooleanTest,
+	T_CoerceToDomain,
+	T_CoerceToDomainValue,
+	T_SetToDefault,
+	T_CurrentOfExpr,
+	T_InferenceElem,
+	T_TargetEntry,
+	T_RangeTblRef,
+	T_JoinExpr,
+	T_FromExpr,
+	T_OnConflictExpr,
+	T_IntoClause,
+
+	/*
+	 * TAGS FOR EXPRESSION STATE NODES (execnodes.h)
+	 *
+	 * These correspond (not always one-for-one) to primitive nodes derived
+	 * from Expr.
+	 */
+	T_ExprState = 400,
+	T_GenericExprState,
+	T_WholeRowVarExprState,
+	T_AggrefExprState,
+	T_GroupingFuncExprState,
+	T_WindowFuncExprState,
+	T_ArrayRefExprState,
+	T_FuncExprState,
+	T_ScalarArrayOpExprState,
+	T_BoolExprState,
+	T_SubPlanState,
+	T_AlternativeSubPlanState,
+	T_FieldSelectState,
+	T_FieldStoreState,
+	T_CoerceViaIOState,
+	T_ArrayCoerceExprState,
+	T_ConvertRowtypeExprState,
+	T_CaseExprState,
+	T_CaseWhenState,
+	T_ArrayExprState,
+	T_RowExprState,
+	T_RowCompareExprState,
+	T_CoalesceExprState,
+	T_MinMaxExprState,
+	T_XmlExprState,
+	T_NullTestState,
+	T_CoerceToDomainState,
+	T_DomainConstraintState,
+
+	/*
+	 * TAGS FOR PLANNER NODES (relation.h)
+	 */
+	T_PlannerInfo = 500,
+	T_PlannerGlobal,
+	T_RelOptInfo,
+	T_IndexOptInfo,
+	T_ParamPathInfo,
+	T_Path,
+	T_IndexPath,
+	T_BitmapHeapPath,
+	T_BitmapAndPath,
+	T_BitmapOrPath,
+	T_NestPath,
+	T_MergePath,
+	T_HashPath,
+	T_TidPath,
+	T_ForeignPath,
+	T_CustomPath,
+	T_AppendPath,
+	T_MergeAppendPath,
+	T_ResultPath,
+	T_MaterialPath,
+	T_UniquePath,
+	T_EquivalenceClass,
+	T_EquivalenceMember,
+	T_PathKey,
+	T_RestrictInfo,
+	T_PlaceHolderVar,
+	T_SpecialJoinInfo,
+	T_AppendRelInfo,
+	T_PlaceHolderInfo,
+	T_MinMaxAggInfo,
+	T_PlannerParamItem,
+
+	/*
+	 * TAGS FOR MEMORY NODES (memnodes.h)
+	 */
+	T_MemoryContext = 600,
+	T_AllocSetContext,
+
+	/*
+	 * TAGS FOR VALUE NODES (value.h)
+	 */
+	T_Value = 650,
+	T_Integer,
+	T_Float,
+	T_String,
+	T_BitString,
+	T_Null,
+
+	/*
+	 * TAGS FOR LIST NODES (pg_list.h)
+	 */
+	T_List,
+	T_IntList,
+	T_OidList,
+
+	/*
+	 * TAGS FOR STATEMENT NODES (mostly in parsenodes.h)
+	 */
+	T_Query = 700,
+	T_PlannedStmt,
+	T_InsertStmt,
+	T_DeleteStmt,
+	T_UpdateStmt,
+	T_SelectStmt,
+	T_AlterTableStmt,
+	T_AlterTableCmd,
+	T_AlterDomainStmt,
+	T_SetOperationStmt,
+	T_GrantStmt,
+	T_GrantRoleStmt,
+	T_AlterDefaultPrivilegesStmt,
+	T_ClosePortalStmt,
+	T_ClusterStmt,
+	T_CopyStmt,
+	T_CreateStmt,
+	T_DefineStmt,
+	T_DropStmt,
+	T_TruncateStmt,
+	T_CommentStmt,
+	T_FetchStmt,
+	T_IndexStmt,
+	T_CreateFunctionStmt,
+	T_AlterFunctionStmt,
+	T_DoStmt,
+	T_RenameStmt,
+	T_RuleStmt,
+	T_NotifyStmt,
+	T_ListenStmt,
+	T_UnlistenStmt,
+	T_TransactionStmt,
+	T_ViewStmt,
+	T_LoadStmt,
+	T_CreateDomainStmt,
+	T_CreatedbStmt,
+	T_DropdbStmt,
+	T_VacuumStmt,
+	T_ExplainStmt,
+	T_CreateTableAsStmt,
+	T_CreateSeqStmt,
+	T_AlterSeqStmt,
+	T_VariableSetStmt,
+	T_VariableShowStmt,
+	T_DiscardStmt,
+	T_CreateTrigStmt,
+	T_CreatePLangStmt,
+	T_CreateRoleStmt,
+	T_AlterRoleStmt,
+	T_DropRoleStmt,
+	T_LockStmt,
+	T_ConstraintsSetStmt,
+	T_ReindexStmt,
+	T_CheckPointStmt,
+	T_CreateSchemaStmt,
+	T_AlterDatabaseStmt,
+	T_AlterDatabaseSetStmt,
+	T_AlterRoleSetStmt,
+	T_CreateConversionStmt,
+	T_CreateCastStmt,
+	T_CreateOpClassStmt,
+	T_CreateOpFamilyStmt,
+	T_AlterOpFamilyStmt,
+	T_PrepareStmt,
+	T_ExecuteStmt,
+	T_DeallocateStmt,
+	T_DeclareCursorStmt,
+	T_CreateTableSpaceStmt,
+	T_DropTableSpaceStmt,
+	T_AlterObjectSchemaStmt,
+	T_AlterOwnerStmt,
+	T_DropOwnedStmt,
+	T_ReassignOwnedStmt,
+	T_CompositeTypeStmt,
+	T_CreateEnumStmt,
+	T_CreateRangeStmt,
+	T_AlterEnumStmt,
+	T_AlterTSDictionaryStmt,
+	T_AlterTSConfigurationStmt,
+	T_CreateFdwStmt,
+	T_AlterFdwStmt,
+	T_CreateForeignServerStmt,
+	T_AlterForeignServerStmt,
+	T_CreateUserMappingStmt,
+	T_AlterUserMappingStmt,
+	T_DropUserMappingStmt,
+	T_AlterTableSpaceOptionsStmt,
+	T_AlterTableMoveAllStmt,
+	T_SecLabelStmt,
+	T_CreateForeignTableStmt,
+	T_ImportForeignSchemaStmt,
+	T_CreateExtensionStmt,
+	T_AlterExtensionStmt,
+	T_AlterExtensionContentsStmt,
+	T_CreateEventTrigStmt,
+	T_AlterEventTrigStmt,
+	T_RefreshMatViewStmt,
+	T_ReplicaIdentityStmt,
+	T_AlterSystemStmt,
+	T_CreatePolicyStmt,
+	T_AlterPolicyStmt,
+	T_CreateTransformStmt,
+
+	/*
+	 * TAGS FOR PARSE TREE NODES (parsenodes.h)
+	 */
+	T_A_Expr = 900,
+	T_ColumnRef,
+	T_ParamRef,
+	T_A_Const,
+	T_FuncCall,
+	T_A_Star,
+	T_A_Indices,
+	T_A_Indirection,
+	T_A_ArrayExpr,
+	T_ResTarget,
+	T_MultiAssignRef,
+	T_TypeCast,
+	T_CollateClause,
+	T_SortBy,
+	T_WindowDef,
+	T_RangeSubselect,
+	T_RangeFunction,
+	T_RangeTableSample,
+	T_TypeName,
+	T_ColumnDef,
+	T_IndexElem,
+	T_Constraint,
+	T_DefElem,
+	T_RangeTblEntry,
+	T_RangeTblFunction,
+	T_TableSampleClause,
+	T_WithCheckOption,
+	T_SortGroupClause,
+	T_GroupingSet,
+	T_WindowClause,
+	T_FuncWithArgs,
+	T_AccessPriv,
+	T_CreateOpClassItem,
+	T_TableLikeClause,
+	T_FunctionParameter,
+	T_LockingClause,
+	T_RowMarkClause,
+	T_XmlSerialize,
+	T_WithClause,
+	T_InferClause,
+	T_OnConflictClause,
+	T_CommonTableExpr,
+	T_RoleSpec,
+
+	/*
+	 * TAGS FOR REPLICATION GRAMMAR PARSE NODES (replnodes.h)
+	 */
+	T_IdentifySystemCmd,
+	T_BaseBackupCmd,
+	T_CreateReplicationSlotCmd,
+	T_DropReplicationSlotCmd,
+	T_StartReplicationCmd,
+	T_TimeLineHistoryCmd,
+
+	/*
+	 * TAGS FOR RANDOM OTHER STUFF
+	 *
+	 * These are objects that aren't part of parse/plan/execute node tree
+	 * structures, but we give them NodeTags anyway for identification
+	 * purposes (usually because they are involved in APIs where we want to
+	 * pass multiple object types through the same pointer).
+	 */
+	T_TriggerData = 950,		/* in commands/trigger.h */
+	T_EventTriggerData,			/* in commands/event_trigger.h */
+	T_ReturnSetInfo,			/* in nodes/execnodes.h */
+	T_WindowObjectData,			/* private in nodeWindowAgg.c */
+	T_TIDBitmap,				/* in nodes/tidbitmap.h */
+	T_InlineCodeBlock,			/* in nodes/parsenodes.h */
+	T_FdwRoutine,				/* in foreign/fdwapi.h */
+	T_TsmRoutine				/* in access/tsmapi.h */
+} NodeTag;
+
+/*
+ * The first field of a node of any type is guaranteed to be the NodeTag.
+ * Hence the type of any node can be gotten by casting it to Node. Declaring
+ * a variable to be of Node * (instead of void *) can also facilitate
+ * debugging.
+ */
+typedef struct Node
+{
+	NodeTag		type;
+} Node;
+
+#define nodeTag(nodeptr)		(((const Node*)(nodeptr))->type)
+
+/*
+ * newNode -
+ *	  create a new node of the specified size and tag the node with the
+ *	  specified tag.
+ *
+ * !WARNING!: Avoid using newNode directly. You should be using the
+ *	  macro makeNode.  eg. to create a Query node, use makeNode(Query)
+ *
+ * Note: the size argument should always be a compile-time constant, so the
+ * apparent risk of multiple evaluation doesn't matter in practice.
+ */
+#ifdef __GNUC__
+
+/* With GCC, we can use a compound statement within an expression */
+#define newNode(size, tag) \
+({	Node   *_result; \
+	AssertMacro((size) >= sizeof(Node));		/* need the tag, at least */ \
+	_result = (Node *) palloc0fast(size); \
+	_result->type = (tag); \
+	_result; \
+})
+#else
+
+/*
+ *	There is no way to dereference the palloc'ed pointer to assign the
+ *	tag, and also return the pointer itself, so we need a holder variable.
+ *	Fortunately, this macro isn't recursive so we just define
+ *	a global variable for this purpose.
+ */
+extern PGDLLIMPORT Node *newNodeMacroHolder;
+
+#define newNode(size, tag) \
+( \
+	AssertMacro((size) >= sizeof(Node)),		/* need the tag, at least */ \
+	newNodeMacroHolder = (Node *) palloc0fast(size), \
+	newNodeMacroHolder->type = (tag), \
+	newNodeMacroHolder \
+)
+#endif   /* __GNUC__ */
+
+
+#define makeNode(_type_)		((_type_ *) newNode(sizeof(_type_),T_##_type_))
+#define NodeSetTag(nodeptr,t)	(((Node*)(nodeptr))->type = (t))
+
+#define IsA(nodeptr,_type_)		(nodeTag(nodeptr) == T_##_type_)
+
+/* ----------------------------------------------------------------
+ *					  extern declarations follow
+ * ----------------------------------------------------------------
+ */
+
+/*
+ * nodes/{outfuncs.c,print.c}
+ */
+extern char *nodeToString(const void *obj);
+
+/*
+ * nodes/{readfuncs.c,read.c}
+ */
+extern void *stringToNode(char *str);
+
+/*
+ * nodes/copyfuncs.c
+ */
+extern void *copyObject(const void *obj);
+
+/*
+ * nodes/equalfuncs.c
+ */
+extern bool equal(const void *a, const void *b);
+
+
+/*
+ * Typedefs for identifying qualifier selectivities and plan costs as such.
+ * These are just plain "double"s, but declaring a variable as Selectivity
+ * or Cost makes the intent more obvious.
+ *
+ * These could have gone into plannodes.h or some such, but many files
+ * depend on them...
+ */
+typedef double Selectivity;		/* fraction of tuples a qualifier will pass */
+typedef double Cost;			/* execution cost (in page-access units) */
+
+
+/*
+ * CmdType -
+ *	  enums for type of operation represented by a Query or PlannedStmt
+ *
+ * This is needed in both parsenodes.h and plannodes.h, so put it here...
+ */
+typedef enum CmdType
+{
+	CMD_UNKNOWN,
+	CMD_SELECT,					/* select stmt */
+	CMD_UPDATE,					/* update stmt */
+	CMD_INSERT,					/* insert stmt */
+	CMD_DELETE,
+	CMD_UTILITY,				/* cmds like create, destroy, copy, vacuum,
+								 * etc. */
+	CMD_NOTHING					/* dummy command for instead nothing rules
+								 * with qual */
+} CmdType;
+
+
+/*
+ * JoinType -
+ *	  enums for types of relation joins
+ *
+ * JoinType determines the exact semantics of joining two relations using
+ * a matching qualification.  For example, it tells what to do with a tuple
+ * that has no match in the other relation.
+ *
+ * This is needed in both parsenodes.h and plannodes.h, so put it here...
+ */
+typedef enum JoinType
+{
+	/*
+	 * The canonical kinds of joins according to the SQL JOIN syntax. Only
+	 * these codes can appear in parser output (e.g., JoinExpr nodes).
+	 */
+	JOIN_INNER,					/* matching tuple pairs only */
+	JOIN_LEFT,					/* pairs + unmatched LHS tuples */
+	JOIN_FULL,					/* pairs + unmatched LHS + unmatched RHS */
+	JOIN_RIGHT,					/* pairs + unmatched RHS tuples */
+
+	/*
+	 * Semijoins and anti-semijoins (as defined in relational theory) do not
+	 * appear in the SQL JOIN syntax, but there are standard idioms for
+	 * representing them (e.g., using EXISTS).  The planner recognizes these
+	 * cases and converts them to joins.  So the planner and executor must
+	 * support these codes.  NOTE: in JOIN_SEMI output, it is unspecified
+	 * which matching RHS row is joined to.  In JOIN_ANTI output, the row is
+	 * guaranteed to be null-extended.
+	 */
+	JOIN_SEMI,					/* 1 copy of each LHS row that has match(es) */
+	JOIN_ANTI,					/* 1 copy of each LHS row that has no match */
+
+	/*
+	 * These codes are used internally in the planner, but are not supported
+	 * by the executor (nor, indeed, by most of the planner).
+	 */
+	JOIN_UNIQUE_OUTER,			/* LHS path must be made unique */
+	JOIN_UNIQUE_INNER			/* RHS path must be made unique */
+
+	/*
+	 * We might need additional join types someday.
+	 */
+} JoinType;
+
+/*
+ * OUTER joins are those for which pushed-down quals must behave differently
+ * from the join's own quals.  This is in fact everything except INNER and
+ * SEMI joins.  However, this macro must also exclude the JOIN_UNIQUE symbols
+ * since those are temporary proxies for what will eventually be an INNER
+ * join.
+ *
+ * Note: semijoins are a hybrid case, but we choose to treat them as not
+ * being outer joins.  This is okay principally because the SQL syntax makes
+ * it impossible to have a pushed-down qual that refers to the inner relation
+ * of a semijoin; so there is no strong need to distinguish join quals from
+ * pushed-down quals.  This is convenient because for almost all purposes,
+ * quals attached to a semijoin can be treated the same as innerjoin quals.
+ */
+#define IS_OUTER_JOIN(jointype) \
+	(((1 << (jointype)) & \
+	  ((1 << JOIN_LEFT) | \
+	   (1 << JOIN_FULL) | \
+	   (1 << JOIN_RIGHT) | \
+	   (1 << JOIN_ANTI))) != 0)
+
+/*
+ * OnConflictAction -
+ *	  "ON CONFLICT" clause type of query
+ *
+ * This is needed in both parsenodes.h and plannodes.h, so put it here...
+ */
+typedef enum OnConflictAction
+{
+	ONCONFLICT_NONE,			/* No "ON CONFLICT" clause */
+	ONCONFLICT_NOTHING,			/* ON CONFLICT ... DO NOTHING */
+	ONCONFLICT_UPDATE			/* ON CONFLICT ... DO UPDATE */
+} OnConflictAction;
+
+#endif   /* NODES_H */
diff --git a/foreign/libpg_query/src/postgres/include/nodes/params.h b/foreign/libpg_query/src/postgres/include/nodes/params.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/nodes/params.h
@@ -0,0 +1,106 @@
+/*-------------------------------------------------------------------------
+ *
+ * params.h
+ *	  Support for finding the values associated with Param nodes.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/nodes/params.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PARAMS_H
+#define PARAMS_H
+
+/* To avoid including a pile of parser headers, reference ParseState thus: */
+struct ParseState;
+
+
+/* ----------------
+ *	  ParamListInfo
+ *
+ *	  ParamListInfo arrays are used to pass parameters into the executor
+ *	  for parameterized plans.  Each entry in the array defines the value
+ *	  to be substituted for a PARAM_EXTERN parameter.  The "paramid"
+ *	  of a PARAM_EXTERN Param can range from 1 to numParams.
+ *
+ *	  Although parameter numbers are normally consecutive, we allow
+ *	  ptype == InvalidOid to signal an unused array entry.
+ *
+ *	  pflags is a flags field.  Currently the only used bit is:
+ *	  PARAM_FLAG_CONST signals the planner that it may treat this parameter
+ *	  as a constant (i.e., generate a plan that works only for this value
+ *	  of the parameter).
+ *
+ *	  There are two hook functions that can be associated with a ParamListInfo
+ *	  array to support dynamic parameter handling.  First, if paramFetch
+ *	  isn't null and the executor requires a value for an invalid parameter
+ *	  (one with ptype == InvalidOid), the paramFetch hook is called to give
+ *	  it a chance to fill in the parameter value.  Second, a parserSetup
+ *	  hook can be supplied to re-instantiate the original parsing hooks if
+ *	  a query needs to be re-parsed/planned (as a substitute for supposing
+ *	  that the current ptype values represent a fixed set of parameter types).
+
+ *	  Although the data structure is really an array, not a list, we keep
+ *	  the old typedef name to avoid unnecessary code changes.
+ * ----------------
+ */
+
+#define PARAM_FLAG_CONST	0x0001		/* parameter is constant */
+
+typedef struct ParamExternData
+{
+	Datum		value;			/* parameter value */
+	bool		isnull;			/* is it NULL? */
+	uint16		pflags;			/* flag bits, see above */
+	Oid			ptype;			/* parameter's datatype, or 0 */
+} ParamExternData;
+
+typedef struct ParamListInfoData *ParamListInfo;
+
+typedef void (*ParamFetchHook) (ParamListInfo params, int paramid);
+
+typedef void (*ParserSetupHook) (struct ParseState *pstate, void *arg);
+
+typedef struct ParamListInfoData
+{
+	ParamFetchHook paramFetch;	/* parameter fetch hook */
+	void	   *paramFetchArg;
+	ParserSetupHook parserSetup;	/* parser setup hook */
+	void	   *parserSetupArg;
+	int			numParams;		/* number of ParamExternDatas following */
+	ParamExternData params[FLEXIBLE_ARRAY_MEMBER];
+}	ParamListInfoData;
+
+
+/* ----------------
+ *	  ParamExecData
+ *
+ *	  ParamExecData entries are used for executor internal parameters
+ *	  (that is, values being passed into or out of a sub-query).  The
+ *	  paramid of a PARAM_EXEC Param is a (zero-based) index into an
+ *	  array of ParamExecData records, which is referenced through
+ *	  es_param_exec_vals or ecxt_param_exec_vals.
+ *
+ *	  If execPlan is not NULL, it points to a SubPlanState node that needs
+ *	  to be executed to produce the value.  (This is done so that we can have
+ *	  lazy evaluation of InitPlans: they aren't executed until/unless a
+ *	  result value is needed.)	Otherwise the value is assumed to be valid
+ *	  when needed.
+ * ----------------
+ */
+
+typedef struct ParamExecData
+{
+	void	   *execPlan;		/* should be "SubPlanState *" */
+	Datum		value;
+	bool		isnull;
+} ParamExecData;
+
+
+/* Functions found in src/backend/nodes/params.c */
+extern ParamListInfo copyParamList(ParamListInfo from);
+
+#endif   /* PARAMS_H */
diff --git a/foreign/libpg_query/src/postgres/include/nodes/parsenodes.h b/foreign/libpg_query/src/postgres/include/nodes/parsenodes.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/nodes/parsenodes.h
@@ -0,0 +1,3056 @@
+/*-------------------------------------------------------------------------
+ *
+ * parsenodes.h
+ *	  definitions for parse tree nodes
+ *
+ * Many of the node types used in parsetrees include a "location" field.
+ * This is a byte (not character) offset in the original source text, to be
+ * used for positioning an error cursor when there is an error related to
+ * the node.  Access to the original source text is needed to make use of
+ * the location.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/nodes/parsenodes.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PARSENODES_H
+#define PARSENODES_H
+
+#include "nodes/bitmapset.h"
+#include "nodes/lockoptions.h"
+#include "nodes/primnodes.h"
+#include "nodes/value.h"
+
+/* Possible sources of a Query */
+typedef enum QuerySource
+{
+	QSRC_ORIGINAL,				/* original parsetree (explicit query) */
+	QSRC_PARSER,				/* added by parse analysis (now unused) */
+	QSRC_INSTEAD_RULE,			/* added by unconditional INSTEAD rule */
+	QSRC_QUAL_INSTEAD_RULE,		/* added by conditional INSTEAD rule */
+	QSRC_NON_INSTEAD_RULE		/* added by non-INSTEAD rule */
+} QuerySource;
+
+/* Sort ordering options for ORDER BY and CREATE INDEX */
+typedef enum SortByDir
+{
+	SORTBY_DEFAULT,
+	SORTBY_ASC,
+	SORTBY_DESC,
+	SORTBY_USING				/* not allowed in CREATE INDEX ... */
+} SortByDir;
+
+typedef enum SortByNulls
+{
+	SORTBY_NULLS_DEFAULT,
+	SORTBY_NULLS_FIRST,
+	SORTBY_NULLS_LAST
+} SortByNulls;
+
+/*
+ * Grantable rights are encoded so that we can OR them together in a bitmask.
+ * The present representation of AclItem limits us to 16 distinct rights,
+ * even though AclMode is defined as uint32.  See utils/acl.h.
+ *
+ * Caution: changing these codes breaks stored ACLs, hence forces initdb.
+ */
+typedef uint32 AclMode;			/* a bitmask of privilege bits */
+
+#define ACL_INSERT		(1<<0)	/* for relations */
+#define ACL_SELECT		(1<<1)
+#define ACL_UPDATE		(1<<2)
+#define ACL_DELETE		(1<<3)
+#define ACL_TRUNCATE	(1<<4)
+#define ACL_REFERENCES	(1<<5)
+#define ACL_TRIGGER		(1<<6)
+#define ACL_EXECUTE		(1<<7)	/* for functions */
+#define ACL_USAGE		(1<<8)	/* for languages, namespaces, FDWs, and
+								 * servers */
+#define ACL_CREATE		(1<<9)	/* for namespaces and databases */
+#define ACL_CREATE_TEMP (1<<10) /* for databases */
+#define ACL_CONNECT		(1<<11) /* for databases */
+#define N_ACL_RIGHTS	12		/* 1 plus the last 1<<x */
+#define ACL_NO_RIGHTS	0
+/* Currently, SELECT ... FOR [KEY] UPDATE/SHARE requires UPDATE privileges */
+#define ACL_SELECT_FOR_UPDATE	ACL_UPDATE
+
+
+/*****************************************************************************
+ *	Query Tree
+ *****************************************************************************/
+
+/*
+ * Query -
+ *	  Parse analysis turns all statements into a Query tree
+ *	  for further processing by the rewriter and planner.
+ *
+ *	  Utility statements (i.e. non-optimizable statements) have the
+ *	  utilityStmt field set, and the Query itself is mostly dummy.
+ *	  DECLARE CURSOR is a special case: it is represented like a SELECT,
+ *	  but the original DeclareCursorStmt is stored in utilityStmt.
+ *
+ *	  Planning converts a Query tree into a Plan tree headed by a PlannedStmt
+ *	  node --- the Query structure is not used by the executor.
+ */
+typedef struct Query
+{
+	NodeTag		type;
+
+	CmdType		commandType;	/* select|insert|update|delete|utility */
+
+	QuerySource querySource;	/* where did I come from? */
+
+	uint32		queryId;		/* query identifier (can be set by plugins) */
+
+	bool		canSetTag;		/* do I set the command result tag? */
+
+	Node	   *utilityStmt;	/* non-null if this is DECLARE CURSOR or a
+								 * non-optimizable statement */
+
+	int			resultRelation; /* rtable index of target relation for
+								 * INSERT/UPDATE/DELETE; 0 for SELECT */
+
+	bool		hasAggs;		/* has aggregates in tlist or havingQual */
+	bool		hasWindowFuncs; /* has window functions in tlist */
+	bool		hasSubLinks;	/* has subquery SubLink */
+	bool		hasDistinctOn;	/* distinctClause is from DISTINCT ON */
+	bool		hasRecursive;	/* WITH RECURSIVE was specified */
+	bool		hasModifyingCTE;	/* has INSERT/UPDATE/DELETE in WITH */
+	bool		hasForUpdate;	/* FOR [KEY] UPDATE/SHARE was specified */
+	bool		hasRowSecurity; /* row security applied? */
+
+	List	   *cteList;		/* WITH list (of CommonTableExpr's) */
+
+	List	   *rtable;			/* list of range table entries */
+	FromExpr   *jointree;		/* table join tree (FROM and WHERE clauses) */
+
+	List	   *targetList;		/* target list (of TargetEntry) */
+
+	OnConflictExpr *onConflict; /* ON CONFLICT DO [NOTHING | UPDATE] */
+
+	List	   *returningList;	/* return-values list (of TargetEntry) */
+
+	List	   *groupClause;	/* a list of SortGroupClause's */
+
+	List	   *groupingSets;	/* a list of GroupingSet's if present */
+
+	Node	   *havingQual;		/* qualifications applied to groups */
+
+	List	   *windowClause;	/* a list of WindowClause's */
+
+	List	   *distinctClause; /* a list of SortGroupClause's */
+
+	List	   *sortClause;		/* a list of SortGroupClause's */
+
+	Node	   *limitOffset;	/* # of result tuples to skip (int8 expr) */
+	Node	   *limitCount;		/* # of result tuples to return (int8 expr) */
+
+	List	   *rowMarks;		/* a list of RowMarkClause's */
+
+	Node	   *setOperations;	/* set-operation tree if this is top level of
+								 * a UNION/INTERSECT/EXCEPT query */
+
+	List	   *constraintDeps; /* a list of pg_constraint OIDs that the query
+								 * depends on to be semantically valid */
+
+	List	   *withCheckOptions;	/* a list of WithCheckOption's, which are
+									 * only added during rewrite and therefore
+									 * are not written out as part of Query. */
+} Query;
+
+
+/****************************************************************************
+ *	Supporting data structures for Parse Trees
+ *
+ *	Most of these node types appear in raw parsetrees output by the grammar,
+ *	and get transformed to something else by the analyzer.  A few of them
+ *	are used as-is in transformed querytrees.
+ ****************************************************************************/
+
+/*
+ * TypeName - specifies a type in definitions
+ *
+ * For TypeName structures generated internally, it is often easier to
+ * specify the type by OID than by name.  If "names" is NIL then the
+ * actual type OID is given by typeOid, otherwise typeOid is unused.
+ * Similarly, if "typmods" is NIL then the actual typmod is expected to
+ * be prespecified in typemod, otherwise typemod is unused.
+ *
+ * If pct_type is TRUE, then names is actually a field name and we look up
+ * the type of that field.  Otherwise (the normal case), names is a type
+ * name possibly qualified with schema and database name.
+ */
+typedef struct TypeName
+{
+	NodeTag		type;
+	List	   *names;			/* qualified name (list of Value strings) */
+	Oid			typeOid;		/* type identified by OID */
+	bool		setof;			/* is a set? */
+	bool		pct_type;		/* %TYPE specified? */
+	List	   *typmods;		/* type modifier expression(s) */
+	int32		typemod;		/* prespecified type modifier */
+	List	   *arrayBounds;	/* array bounds */
+	int			location;		/* token location, or -1 if unknown */
+} TypeName;
+
+/*
+ * ColumnRef - specifies a reference to a column, or possibly a whole tuple
+ *
+ * The "fields" list must be nonempty.  It can contain string Value nodes
+ * (representing names) and A_Star nodes (representing occurrence of a '*').
+ * Currently, A_Star must appear only as the last list element --- the grammar
+ * is responsible for enforcing this!
+ *
+ * Note: any array subscripting or selection of fields from composite columns
+ * is represented by an A_Indirection node above the ColumnRef.  However,
+ * for simplicity in the normal case, initial field selection from a table
+ * name is represented within ColumnRef and not by adding A_Indirection.
+ */
+typedef struct ColumnRef
+{
+	NodeTag		type;
+	List	   *fields;			/* field names (Value strings) or A_Star */
+	int			location;		/* token location, or -1 if unknown */
+} ColumnRef;
+
+/*
+ * ParamRef - specifies a $n parameter reference
+ */
+typedef struct ParamRef
+{
+	NodeTag		type;
+	int			number;			/* the number of the parameter */
+	int			location;		/* token location, or -1 if unknown */
+} ParamRef;
+
+/*
+ * A_Expr - infix, prefix, and postfix expressions
+ */
+typedef enum A_Expr_Kind
+{
+	AEXPR_OP,					/* normal operator */
+	AEXPR_OP_ANY,				/* scalar op ANY (array) */
+	AEXPR_OP_ALL,				/* scalar op ALL (array) */
+	AEXPR_DISTINCT,				/* IS DISTINCT FROM - name must be "=" */
+	AEXPR_NULLIF,				/* NULLIF - name must be "=" */
+	AEXPR_OF,					/* IS [NOT] OF - name must be "=" or "<>" */
+	AEXPR_IN,					/* [NOT] IN - name must be "=" or "<>" */
+	AEXPR_LIKE,					/* [NOT] LIKE - name must be "~~" or "!~~" */
+	AEXPR_ILIKE,				/* [NOT] ILIKE - name must be "~~*" or "!~~*" */
+	AEXPR_SIMILAR,				/* [NOT] SIMILAR - name must be "~" or "!~" */
+	AEXPR_BETWEEN,				/* name must be "BETWEEN" */
+	AEXPR_NOT_BETWEEN,			/* name must be "NOT BETWEEN" */
+	AEXPR_BETWEEN_SYM,			/* name must be "BETWEEN SYMMETRIC" */
+	AEXPR_NOT_BETWEEN_SYM,		/* name must be "NOT BETWEEN SYMMETRIC" */
+	AEXPR_PAREN					/* nameless dummy node for parentheses */
+} A_Expr_Kind;
+
+typedef struct A_Expr
+{
+	NodeTag		type;
+	A_Expr_Kind kind;			/* see above */
+	List	   *name;			/* possibly-qualified name of operator */
+	Node	   *lexpr;			/* left argument, or NULL if none */
+	Node	   *rexpr;			/* right argument, or NULL if none */
+	int			location;		/* token location, or -1 if unknown */
+} A_Expr;
+
+/*
+ * A_Const - a literal constant
+ */
+typedef struct A_Const
+{
+	NodeTag		type;
+	Value		val;			/* value (includes type info, see value.h) */
+	int			location;		/* token location, or -1 if unknown */
+} A_Const;
+
+/*
+ * TypeCast - a CAST expression
+ */
+typedef struct TypeCast
+{
+	NodeTag		type;
+	Node	   *arg;			/* the expression being casted */
+	TypeName   *typeName;		/* the target type */
+	int			location;		/* token location, or -1 if unknown */
+} TypeCast;
+
+/*
+ * CollateClause - a COLLATE expression
+ */
+typedef struct CollateClause
+{
+	NodeTag		type;
+	Node	   *arg;			/* input expression */
+	List	   *collname;		/* possibly-qualified collation name */
+	int			location;		/* token location, or -1 if unknown */
+} CollateClause;
+
+/*
+ * RoleSpec - a role name or one of a few special values.
+ */
+typedef enum RoleSpecType
+{
+	ROLESPEC_CSTRING,			/* role name is stored as a C string */
+	ROLESPEC_CURRENT_USER,		/* role spec is CURRENT_USER */
+	ROLESPEC_SESSION_USER,		/* role spec is SESSION_USER */
+	ROLESPEC_PUBLIC				/* role name is "public" */
+} RoleSpecType;
+
+typedef struct RoleSpec
+{
+	NodeTag		type;
+	RoleSpecType roletype;		/* Type of this rolespec */
+	char	   *rolename;		/* filled only for ROLESPEC_CSTRING */
+	int			location;		/* token location, or -1 if unknown */
+} RoleSpec;
+
+/*
+ * FuncCall - a function or aggregate invocation
+ *
+ * agg_order (if not NIL) indicates we saw 'foo(... ORDER BY ...)', or if
+ * agg_within_group is true, it was 'foo(...) WITHIN GROUP (ORDER BY ...)'.
+ * agg_star indicates we saw a 'foo(*)' construct, while agg_distinct
+ * indicates we saw 'foo(DISTINCT ...)'.  In any of these cases, the
+ * construct *must* be an aggregate call.  Otherwise, it might be either an
+ * aggregate or some other kind of function.  However, if FILTER or OVER is
+ * present it had better be an aggregate or window function.
+ *
+ * Normally, you'd initialize this via makeFuncCall() and then only change the
+ * parts of the struct its defaults don't match afterwards, as needed.
+ */
+typedef struct FuncCall
+{
+	NodeTag		type;
+	List	   *funcname;		/* qualified name of function */
+	List	   *args;			/* the arguments (list of exprs) */
+	List	   *agg_order;		/* ORDER BY (list of SortBy) */
+	Node	   *agg_filter;		/* FILTER clause, if any */
+	bool		agg_within_group;		/* ORDER BY appeared in WITHIN GROUP */
+	bool		agg_star;		/* argument was really '*' */
+	bool		agg_distinct;	/* arguments were labeled DISTINCT */
+	bool		func_variadic;	/* last argument was labeled VARIADIC */
+	struct WindowDef *over;		/* OVER clause, if any */
+	int			location;		/* token location, or -1 if unknown */
+} FuncCall;
+
+/*
+ * A_Star - '*' representing all columns of a table or compound field
+ *
+ * This can appear within ColumnRef.fields, A_Indirection.indirection, and
+ * ResTarget.indirection lists.
+ */
+typedef struct A_Star
+{
+	NodeTag		type;
+} A_Star;
+
+/*
+ * A_Indices - array subscript or slice bounds ([lidx:uidx] or [uidx])
+ */
+typedef struct A_Indices
+{
+	NodeTag		type;
+	Node	   *lidx;			/* NULL if it's a single subscript */
+	Node	   *uidx;
+} A_Indices;
+
+/*
+ * A_Indirection - select a field and/or array element from an expression
+ *
+ * The indirection list can contain A_Indices nodes (representing
+ * subscripting), string Value nodes (representing field selection --- the
+ * string value is the name of the field to select), and A_Star nodes
+ * (representing selection of all fields of a composite type).
+ * For example, a complex selection operation like
+ *				(foo).field1[42][7].field2
+ * would be represented with a single A_Indirection node having a 4-element
+ * indirection list.
+ *
+ * Currently, A_Star must appear only as the last list element --- the grammar
+ * is responsible for enforcing this!
+ */
+typedef struct A_Indirection
+{
+	NodeTag		type;
+	Node	   *arg;			/* the thing being selected from */
+	List	   *indirection;	/* subscripts and/or field names and/or * */
+} A_Indirection;
+
+/*
+ * A_ArrayExpr - an ARRAY[] construct
+ */
+typedef struct A_ArrayExpr
+{
+	NodeTag		type;
+	List	   *elements;		/* array element expressions */
+	int			location;		/* token location, or -1 if unknown */
+} A_ArrayExpr;
+
+/*
+ * ResTarget -
+ *	  result target (used in target list of pre-transformed parse trees)
+ *
+ * In a SELECT target list, 'name' is the column label from an
+ * 'AS ColumnLabel' clause, or NULL if there was none, and 'val' is the
+ * value expression itself.  The 'indirection' field is not used.
+ *
+ * INSERT uses ResTarget in its target-column-names list.  Here, 'name' is
+ * the name of the destination column, 'indirection' stores any subscripts
+ * attached to the destination, and 'val' is not used.
+ *
+ * In an UPDATE target list, 'name' is the name of the destination column,
+ * 'indirection' stores any subscripts attached to the destination, and
+ * 'val' is the expression to assign.
+ *
+ * See A_Indirection for more info about what can appear in 'indirection'.
+ */
+typedef struct ResTarget
+{
+	NodeTag		type;
+	char	   *name;			/* column name or NULL */
+	List	   *indirection;	/* subscripts, field names, and '*', or NIL */
+	Node	   *val;			/* the value expression to compute or assign */
+	int			location;		/* token location, or -1 if unknown */
+} ResTarget;
+
+/*
+ * MultiAssignRef - element of a row source expression for UPDATE
+ *
+ * In an UPDATE target list, when we have SET (a,b,c) = row-valued-expression,
+ * we generate separate ResTarget items for each of a,b,c.  Their "val" trees
+ * are MultiAssignRef nodes numbered 1..n, linking to a common copy of the
+ * row-valued-expression (which parse analysis will process only once, when
+ * handling the MultiAssignRef with colno=1).
+ */
+typedef struct MultiAssignRef
+{
+	NodeTag		type;
+	Node	   *source;			/* the row-valued expression */
+	int			colno;			/* column number for this target (1..n) */
+	int			ncolumns;		/* number of targets in the construct */
+} MultiAssignRef;
+
+/*
+ * SortBy - for ORDER BY clause
+ */
+typedef struct SortBy
+{
+	NodeTag		type;
+	Node	   *node;			/* expression to sort on */
+	SortByDir	sortby_dir;		/* ASC/DESC/USING/default */
+	SortByNulls sortby_nulls;	/* NULLS FIRST/LAST */
+	List	   *useOp;			/* name of op to use, if SORTBY_USING */
+	int			location;		/* operator location, or -1 if none/unknown */
+} SortBy;
+
+/*
+ * WindowDef - raw representation of WINDOW and OVER clauses
+ *
+ * For entries in a WINDOW list, "name" is the window name being defined.
+ * For OVER clauses, we use "name" for the "OVER window" syntax, or "refname"
+ * for the "OVER (window)" syntax, which is subtly different --- the latter
+ * implies overriding the window frame clause.
+ */
+typedef struct WindowDef
+{
+	NodeTag		type;
+	char	   *name;			/* window's own name */
+	char	   *refname;		/* referenced window name, if any */
+	List	   *partitionClause;	/* PARTITION BY expression list */
+	List	   *orderClause;	/* ORDER BY (list of SortBy) */
+	int			frameOptions;	/* frame_clause options, see below */
+	Node	   *startOffset;	/* expression for starting bound, if any */
+	Node	   *endOffset;		/* expression for ending bound, if any */
+	int			location;		/* parse location, or -1 if none/unknown */
+} WindowDef;
+
+/*
+ * frameOptions is an OR of these bits.  The NONDEFAULT and BETWEEN bits are
+ * used so that ruleutils.c can tell which properties were specified and
+ * which were defaulted; the correct behavioral bits must be set either way.
+ * The START_foo and END_foo options must come in pairs of adjacent bits for
+ * the convenience of gram.y, even though some of them are useless/invalid.
+ * We will need more bits (and fields) to cover the full SQL:2008 option set.
+ */
+#define FRAMEOPTION_NONDEFAULT					0x00001 /* any specified? */
+#define FRAMEOPTION_RANGE						0x00002 /* RANGE behavior */
+#define FRAMEOPTION_ROWS						0x00004 /* ROWS behavior */
+#define FRAMEOPTION_BETWEEN						0x00008 /* BETWEEN given? */
+#define FRAMEOPTION_START_UNBOUNDED_PRECEDING	0x00010 /* start is U. P. */
+#define FRAMEOPTION_END_UNBOUNDED_PRECEDING		0x00020 /* (disallowed) */
+#define FRAMEOPTION_START_UNBOUNDED_FOLLOWING	0x00040 /* (disallowed) */
+#define FRAMEOPTION_END_UNBOUNDED_FOLLOWING		0x00080 /* end is U. F. */
+#define FRAMEOPTION_START_CURRENT_ROW			0x00100 /* start is C. R. */
+#define FRAMEOPTION_END_CURRENT_ROW				0x00200 /* end is C. R. */
+#define FRAMEOPTION_START_VALUE_PRECEDING		0x00400 /* start is V. P. */
+#define FRAMEOPTION_END_VALUE_PRECEDING			0x00800 /* end is V. P. */
+#define FRAMEOPTION_START_VALUE_FOLLOWING		0x01000 /* start is V. F. */
+#define FRAMEOPTION_END_VALUE_FOLLOWING			0x02000 /* end is V. F. */
+
+#define FRAMEOPTION_START_VALUE \
+	(FRAMEOPTION_START_VALUE_PRECEDING | FRAMEOPTION_START_VALUE_FOLLOWING)
+#define FRAMEOPTION_END_VALUE \
+	(FRAMEOPTION_END_VALUE_PRECEDING | FRAMEOPTION_END_VALUE_FOLLOWING)
+
+#define FRAMEOPTION_DEFAULTS \
+	(FRAMEOPTION_RANGE | FRAMEOPTION_START_UNBOUNDED_PRECEDING | \
+	 FRAMEOPTION_END_CURRENT_ROW)
+
+/*
+ * RangeSubselect - subquery appearing in a FROM clause
+ */
+typedef struct RangeSubselect
+{
+	NodeTag		type;
+	bool		lateral;		/* does it have LATERAL prefix? */
+	Node	   *subquery;		/* the untransformed sub-select clause */
+	Alias	   *alias;			/* table alias & optional column aliases */
+} RangeSubselect;
+
+/*
+ * RangeFunction - function call appearing in a FROM clause
+ *
+ * functions is a List because we use this to represent the construct
+ * ROWS FROM(func1(...), func2(...), ...).  Each element of this list is a
+ * two-element sublist, the first element being the untransformed function
+ * call tree, and the second element being a possibly-empty list of ColumnDef
+ * nodes representing any columndef list attached to that function within the
+ * ROWS FROM() syntax.
+ *
+ * alias and coldeflist represent any alias and/or columndef list attached
+ * at the top level.  (We disallow coldeflist appearing both here and
+ * per-function, but that's checked in parse analysis, not by the grammar.)
+ */
+typedef struct RangeFunction
+{
+	NodeTag		type;
+	bool		lateral;		/* does it have LATERAL prefix? */
+	bool		ordinality;		/* does it have WITH ORDINALITY suffix? */
+	bool		is_rowsfrom;	/* is result of ROWS FROM() syntax? */
+	List	   *functions;		/* per-function information, see above */
+	Alias	   *alias;			/* table alias & optional column aliases */
+	List	   *coldeflist;		/* list of ColumnDef nodes to describe result
+								 * of function returning RECORD */
+} RangeFunction;
+
+/*
+ * RangeTableSample - TABLESAMPLE appearing in a raw FROM clause
+ *
+ * This node, appearing only in raw parse trees, represents
+ *		<relation> TABLESAMPLE <method> (<params>) REPEATABLE (<num>)
+ * Currently, the <relation> can only be a RangeVar, but we might in future
+ * allow RangeSubselect and other options.  Note that the RangeTableSample
+ * is wrapped around the node representing the <relation>, rather than being
+ * a subfield of it.
+ */
+typedef struct RangeTableSample
+{
+	NodeTag		type;
+	Node	   *relation;		/* relation to be sampled */
+	List	   *method;			/* sampling method name (possibly qualified) */
+	List	   *args;			/* argument(s) for sampling method */
+	Node	   *repeatable;		/* REPEATABLE expression, or NULL if none */
+	int			location;		/* method name location, or -1 if unknown */
+} RangeTableSample;
+
+/*
+ * ColumnDef - column definition (used in various creates)
+ *
+ * If the column has a default value, we may have the value expression
+ * in either "raw" form (an untransformed parse tree) or "cooked" form
+ * (a post-parse-analysis, executable expression tree), depending on
+ * how this ColumnDef node was created (by parsing, or by inheritance
+ * from an existing relation).  We should never have both in the same node!
+ *
+ * Similarly, we may have a COLLATE specification in either raw form
+ * (represented as a CollateClause with arg==NULL) or cooked form
+ * (the collation's OID).
+ *
+ * The constraints list may contain a CONSTR_DEFAULT item in a raw
+ * parsetree produced by gram.y, but transformCreateStmt will remove
+ * the item and set raw_default instead.  CONSTR_DEFAULT items
+ * should not appear in any subsequent processing.
+ */
+typedef struct ColumnDef
+{
+	NodeTag		type;
+	char	   *colname;		/* name of column */
+	TypeName   *typeName;		/* type of column */
+	int			inhcount;		/* number of times column is inherited */
+	bool		is_local;		/* column has local (non-inherited) def'n */
+	bool		is_not_null;	/* NOT NULL constraint specified? */
+	bool		is_from_type;	/* column definition came from table type */
+	char		storage;		/* attstorage setting, or 0 for default */
+	Node	   *raw_default;	/* default value (untransformed parse tree) */
+	Node	   *cooked_default; /* default value (transformed expr tree) */
+	CollateClause *collClause;	/* untransformed COLLATE spec, if any */
+	Oid			collOid;		/* collation OID (InvalidOid if not set) */
+	List	   *constraints;	/* other constraints on column */
+	List	   *fdwoptions;		/* per-column FDW options */
+	int			location;		/* parse location, or -1 if none/unknown */
+} ColumnDef;
+
+/*
+ * TableLikeClause - CREATE TABLE ( ... LIKE ... ) clause
+ */
+typedef struct TableLikeClause
+{
+	NodeTag		type;
+	RangeVar   *relation;
+	bits32		options;		/* OR of TableLikeOption flags */
+} TableLikeClause;
+
+typedef enum TableLikeOption
+{
+	CREATE_TABLE_LIKE_DEFAULTS = 1 << 0,
+	CREATE_TABLE_LIKE_CONSTRAINTS = 1 << 1,
+	CREATE_TABLE_LIKE_INDEXES = 1 << 2,
+	CREATE_TABLE_LIKE_STORAGE = 1 << 3,
+	CREATE_TABLE_LIKE_COMMENTS = 1 << 4,
+	CREATE_TABLE_LIKE_ALL = PG_INT32_MAX
+} TableLikeOption;
+
+/*
+ * IndexElem - index parameters (used in CREATE INDEX, and in ON CONFLICT)
+ *
+ * For a plain index attribute, 'name' is the name of the table column to
+ * index, and 'expr' is NULL.  For an index expression, 'name' is NULL and
+ * 'expr' is the expression tree.
+ */
+typedef struct IndexElem
+{
+	NodeTag		type;
+	char	   *name;			/* name of attribute to index, or NULL */
+	Node	   *expr;			/* expression to index, or NULL */
+	char	   *indexcolname;	/* name for index column; NULL = default */
+	List	   *collation;		/* name of collation; NIL = default */
+	List	   *opclass;		/* name of desired opclass; NIL = default */
+	SortByDir	ordering;		/* ASC/DESC/default */
+	SortByNulls nulls_ordering; /* FIRST/LAST/default */
+} IndexElem;
+
+/*
+ * DefElem - a generic "name = value" option definition
+ *
+ * In some contexts the name can be qualified.  Also, certain SQL commands
+ * allow a SET/ADD/DROP action to be attached to option settings, so it's
+ * convenient to carry a field for that too.  (Note: currently, it is our
+ * practice that the grammar allows namespace and action only in statements
+ * where they are relevant; C code can just ignore those fields in other
+ * statements.)
+ */
+typedef enum DefElemAction
+{
+	DEFELEM_UNSPEC,				/* no action given */
+	DEFELEM_SET,
+	DEFELEM_ADD,
+	DEFELEM_DROP
+} DefElemAction;
+
+typedef struct DefElem
+{
+	NodeTag		type;
+	char	   *defnamespace;	/* NULL if unqualified name */
+	char	   *defname;
+	Node	   *arg;			/* a (Value *) or a (TypeName *) */
+	DefElemAction defaction;	/* unspecified action, or SET/ADD/DROP */
+	int			location;		/* parse location, or -1 if none/unknown */
+} DefElem;
+
+/*
+ * LockingClause - raw representation of FOR [NO KEY] UPDATE/[KEY] SHARE
+ *		options
+ *
+ * Note: lockedRels == NIL means "all relations in query".  Otherwise it
+ * is a list of RangeVar nodes.  (We use RangeVar mainly because it carries
+ * a location field --- currently, parse analysis insists on unqualified
+ * names in LockingClause.)
+ */
+typedef struct LockingClause
+{
+	NodeTag		type;
+	List	   *lockedRels;		/* FOR [KEY] UPDATE/SHARE relations */
+	LockClauseStrength strength;
+	LockWaitPolicy waitPolicy;	/* NOWAIT and SKIP LOCKED */
+} LockingClause;
+
+/*
+ * XMLSERIALIZE (in raw parse tree only)
+ */
+typedef struct XmlSerialize
+{
+	NodeTag		type;
+	XmlOptionType xmloption;	/* DOCUMENT or CONTENT */
+	Node	   *expr;
+	TypeName   *typeName;
+	int			location;		/* token location, or -1 if unknown */
+} XmlSerialize;
+
+
+/****************************************************************************
+ *	Nodes for a Query tree
+ ****************************************************************************/
+
+/*--------------------
+ * RangeTblEntry -
+ *	  A range table is a List of RangeTblEntry nodes.
+ *
+ *	  A range table entry may represent a plain relation, a sub-select in
+ *	  FROM, or the result of a JOIN clause.  (Only explicit JOIN syntax
+ *	  produces an RTE, not the implicit join resulting from multiple FROM
+ *	  items.  This is because we only need the RTE to deal with SQL features
+ *	  like outer joins and join-output-column aliasing.)  Other special
+ *	  RTE types also exist, as indicated by RTEKind.
+ *
+ *	  Note that we consider RTE_RELATION to cover anything that has a pg_class
+ *	  entry.  relkind distinguishes the sub-cases.
+ *
+ *	  alias is an Alias node representing the AS alias-clause attached to the
+ *	  FROM expression, or NULL if no clause.
+ *
+ *	  eref is the table reference name and column reference names (either
+ *	  real or aliases).  Note that system columns (OID etc) are not included
+ *	  in the column list.
+ *	  eref->aliasname is required to be present, and should generally be used
+ *	  to identify the RTE for error messages etc.
+ *
+ *	  In RELATION RTEs, the colnames in both alias and eref are indexed by
+ *	  physical attribute number; this means there must be colname entries for
+ *	  dropped columns.  When building an RTE we insert empty strings ("") for
+ *	  dropped columns.  Note however that a stored rule may have nonempty
+ *	  colnames for columns dropped since the rule was created (and for that
+ *	  matter the colnames might be out of date due to column renamings).
+ *	  The same comments apply to FUNCTION RTEs when a function's return type
+ *	  is a named composite type.
+ *
+ *	  In JOIN RTEs, the colnames in both alias and eref are one-to-one with
+ *	  joinaliasvars entries.  A JOIN RTE will omit columns of its inputs when
+ *	  those columns are known to be dropped at parse time.  Again, however,
+ *	  a stored rule might contain entries for columns dropped since the rule
+ *	  was created.  (This is only possible for columns not actually referenced
+ *	  in the rule.)  When loading a stored rule, we replace the joinaliasvars
+ *	  items for any such columns with null pointers.  (We can't simply delete
+ *	  them from the joinaliasvars list, because that would affect the attnums
+ *	  of Vars referencing the rest of the list.)
+ *
+ *	  inh is TRUE for relation references that should be expanded to include
+ *	  inheritance children, if the rel has any.  This *must* be FALSE for
+ *	  RTEs other than RTE_RELATION entries.
+ *
+ *	  inFromCl marks those range variables that are listed in the FROM clause.
+ *	  It's false for RTEs that are added to a query behind the scenes, such
+ *	  as the NEW and OLD variables for a rule, or the subqueries of a UNION.
+ *	  This flag is not used anymore during parsing, since the parser now uses
+ *	  a separate "namespace" data structure to control visibility, but it is
+ *	  needed by ruleutils.c to determine whether RTEs should be shown in
+ *	  decompiled queries.
+ *
+ *	  requiredPerms and checkAsUser specify run-time access permissions
+ *	  checks to be performed at query startup.  The user must have *all*
+ *	  of the permissions that are OR'd together in requiredPerms (zero
+ *	  indicates no permissions checking).  If checkAsUser is not zero,
+ *	  then do the permissions checks using the access rights of that user,
+ *	  not the current effective user ID.  (This allows rules to act as
+ *	  setuid gateways.)  Permissions checks only apply to RELATION RTEs.
+ *
+ *	  For SELECT/INSERT/UPDATE permissions, if the user doesn't have
+ *	  table-wide permissions then it is sufficient to have the permissions
+ *	  on all columns identified in selectedCols (for SELECT) and/or
+ *	  insertedCols and/or updatedCols (INSERT with ON CONFLICT DO UPDATE may
+ *	  have all 3).  selectedCols, insertedCols and updatedCols are bitmapsets,
+ *	  which cannot have negative integer members, so we subtract
+ *	  FirstLowInvalidHeapAttributeNumber from column numbers before storing
+ *	  them in these fields.  A whole-row Var reference is represented by
+ *	  setting the bit for InvalidAttrNumber.
+ *--------------------
+ */
+typedef enum RTEKind
+{
+	RTE_RELATION,				/* ordinary relation reference */
+	RTE_SUBQUERY,				/* subquery in FROM */
+	RTE_JOIN,					/* join */
+	RTE_FUNCTION,				/* function in FROM */
+	RTE_VALUES,					/* VALUES (<exprlist>), (<exprlist>), ... */
+	RTE_CTE						/* common table expr (WITH list element) */
+} RTEKind;
+
+typedef struct RangeTblEntry
+{
+	NodeTag		type;
+
+	RTEKind		rtekind;		/* see above */
+
+	/*
+	 * XXX the fields applicable to only some rte kinds should be merged into
+	 * a union.  I didn't do this yet because the diffs would impact a lot of
+	 * code that is being actively worked on.  FIXME someday.
+	 */
+
+	/*
+	 * Fields valid for a plain relation RTE (else zero):
+	 */
+	Oid			relid;			/* OID of the relation */
+	char		relkind;		/* relation kind (see pg_class.relkind) */
+	struct TableSampleClause *tablesample;		/* sampling info, or NULL */
+
+	/*
+	 * Fields valid for a subquery RTE (else NULL):
+	 */
+	Query	   *subquery;		/* the sub-query */
+	bool		security_barrier;		/* is from security_barrier view? */
+
+	/*
+	 * Fields valid for a join RTE (else NULL/zero):
+	 *
+	 * joinaliasvars is a list of (usually) Vars corresponding to the columns
+	 * of the join result.  An alias Var referencing column K of the join
+	 * result can be replaced by the K'th element of joinaliasvars --- but to
+	 * simplify the task of reverse-listing aliases correctly, we do not do
+	 * that until planning time.  In detail: an element of joinaliasvars can
+	 * be a Var of one of the join's input relations, or such a Var with an
+	 * implicit coercion to the join's output column type, or a COALESCE
+	 * expression containing the two input column Vars (possibly coerced).
+	 * Within a Query loaded from a stored rule, it is also possible for
+	 * joinaliasvars items to be null pointers, which are placeholders for
+	 * (necessarily unreferenced) columns dropped since the rule was made.
+	 * Also, once planning begins, joinaliasvars items can be almost anything,
+	 * as a result of subquery-flattening substitutions.
+	 */
+	JoinType	jointype;		/* type of join */
+	List	   *joinaliasvars;	/* list of alias-var expansions */
+
+	/*
+	 * Fields valid for a function RTE (else NIL/zero):
+	 *
+	 * When funcordinality is true, the eref->colnames list includes an alias
+	 * for the ordinality column.  The ordinality column is otherwise
+	 * implicit, and must be accounted for "by hand" in places such as
+	 * expandRTE().
+	 */
+	List	   *functions;		/* list of RangeTblFunction nodes */
+	bool		funcordinality; /* is this called WITH ORDINALITY? */
+
+	/*
+	 * Fields valid for a values RTE (else NIL):
+	 */
+	List	   *values_lists;	/* list of expression lists */
+	List	   *values_collations;		/* OID list of column collation OIDs */
+
+	/*
+	 * Fields valid for a CTE RTE (else NULL/zero):
+	 */
+	char	   *ctename;		/* name of the WITH list item */
+	Index		ctelevelsup;	/* number of query levels up */
+	bool		self_reference; /* is this a recursive self-reference? */
+	List	   *ctecoltypes;	/* OID list of column type OIDs */
+	List	   *ctecoltypmods;	/* integer list of column typmods */
+	List	   *ctecolcollations;		/* OID list of column collation OIDs */
+
+	/*
+	 * Fields valid in all RTEs:
+	 */
+	Alias	   *alias;			/* user-written alias clause, if any */
+	Alias	   *eref;			/* expanded reference names */
+	bool		lateral;		/* subquery, function, or values is LATERAL? */
+	bool		inh;			/* inheritance requested? */
+	bool		inFromCl;		/* present in FROM clause? */
+	AclMode		requiredPerms;	/* bitmask of required access permissions */
+	Oid			checkAsUser;	/* if valid, check access as this role */
+	Bitmapset  *selectedCols;	/* columns needing SELECT permission */
+	Bitmapset  *insertedCols;	/* columns needing INSERT permission */
+	Bitmapset  *updatedCols;	/* columns needing UPDATE permission */
+	List	   *securityQuals;	/* any security barrier quals to apply */
+} RangeTblEntry;
+
+/*
+ * RangeTblFunction -
+ *	  RangeTblEntry subsidiary data for one function in a FUNCTION RTE.
+ *
+ * If the function had a column definition list (required for an
+ * otherwise-unspecified RECORD result), funccolnames lists the names given
+ * in the definition list, funccoltypes lists their declared column types,
+ * funccoltypmods lists their typmods, funccolcollations their collations.
+ * Otherwise, those fields are NIL.
+ *
+ * Notice we don't attempt to store info about the results of functions
+ * returning named composite types, because those can change from time to
+ * time.  We do however remember how many columns we thought the type had
+ * (including dropped columns!), so that we can successfully ignore any
+ * columns added after the query was parsed.
+ */
+typedef struct RangeTblFunction
+{
+	NodeTag		type;
+
+	Node	   *funcexpr;		/* expression tree for func call */
+	int			funccolcount;	/* number of columns it contributes to RTE */
+	/* These fields record the contents of a column definition list, if any: */
+	List	   *funccolnames;	/* column names (list of String) */
+	List	   *funccoltypes;	/* OID list of column type OIDs */
+	List	   *funccoltypmods; /* integer list of column typmods */
+	List	   *funccolcollations;		/* OID list of column collation OIDs */
+	/* This is set during planning for use by the executor: */
+	Bitmapset  *funcparams;		/* PARAM_EXEC Param IDs affecting this func */
+} RangeTblFunction;
+
+/*
+ * TableSampleClause - TABLESAMPLE appearing in a transformed FROM clause
+ *
+ * Unlike RangeTableSample, this is a subnode of the relevant RangeTblEntry.
+ */
+typedef struct TableSampleClause
+{
+	NodeTag		type;
+	Oid			tsmhandler;		/* OID of the tablesample handler function */
+	List	   *args;			/* tablesample argument expression(s) */
+	Expr	   *repeatable;		/* REPEATABLE expression, or NULL if none */
+} TableSampleClause;
+
+/*
+ * WithCheckOption -
+ *		representation of WITH CHECK OPTION checks to be applied to new tuples
+ *		when inserting/updating an auto-updatable view, or RLS WITH CHECK
+ *		policies to be applied when inserting/updating a relation with RLS.
+ */
+typedef enum WCOKind
+{
+	WCO_VIEW_CHECK,				/* WCO on an auto-updatable view */
+	WCO_RLS_INSERT_CHECK,		/* RLS INSERT WITH CHECK policy */
+	WCO_RLS_UPDATE_CHECK,		/* RLS UPDATE WITH CHECK policy */
+	WCO_RLS_CONFLICT_CHECK		/* RLS ON CONFLICT DO UPDATE USING policy */
+} WCOKind;
+
+typedef struct WithCheckOption
+{
+	NodeTag		type;
+	WCOKind		kind;			/* kind of WCO */
+	char	   *relname;		/* name of relation that specified the WCO */
+	char	   *polname;		/* name of RLS policy being checked */
+	Node	   *qual;			/* constraint qual to check */
+	bool		cascaded;		/* true for a cascaded WCO on a view */
+} WithCheckOption;
+
+/*
+ * SortGroupClause -
+ *		representation of ORDER BY, GROUP BY, PARTITION BY,
+ *		DISTINCT, DISTINCT ON items
+ *
+ * You might think that ORDER BY is only interested in defining ordering,
+ * and GROUP/DISTINCT are only interested in defining equality.  However,
+ * one way to implement grouping is to sort and then apply a "uniq"-like
+ * filter.  So it's also interesting to keep track of possible sort operators
+ * for GROUP/DISTINCT, and in particular to try to sort for the grouping
+ * in a way that will also yield a requested ORDER BY ordering.  So we need
+ * to be able to compare ORDER BY and GROUP/DISTINCT lists, which motivates
+ * the decision to give them the same representation.
+ *
+ * tleSortGroupRef must match ressortgroupref of exactly one entry of the
+ *		query's targetlist; that is the expression to be sorted or grouped by.
+ * eqop is the OID of the equality operator.
+ * sortop is the OID of the ordering operator (a "<" or ">" operator),
+ *		or InvalidOid if not available.
+ * nulls_first means about what you'd expect.  If sortop is InvalidOid
+ *		then nulls_first is meaningless and should be set to false.
+ * hashable is TRUE if eqop is hashable (note this condition also depends
+ *		on the datatype of the input expression).
+ *
+ * In an ORDER BY item, all fields must be valid.  (The eqop isn't essential
+ * here, but it's cheap to get it along with the sortop, and requiring it
+ * to be valid eases comparisons to grouping items.)  Note that this isn't
+ * actually enough information to determine an ordering: if the sortop is
+ * collation-sensitive, a collation OID is needed too.  We don't store the
+ * collation in SortGroupClause because it's not available at the time the
+ * parser builds the SortGroupClause; instead, consult the exposed collation
+ * of the referenced targetlist expression to find out what it is.
+ *
+ * In a grouping item, eqop must be valid.  If the eqop is a btree equality
+ * operator, then sortop should be set to a compatible ordering operator.
+ * We prefer to set eqop/sortop/nulls_first to match any ORDER BY item that
+ * the query presents for the same tlist item.  If there is none, we just
+ * use the default ordering op for the datatype.
+ *
+ * If the tlist item's type has a hash opclass but no btree opclass, then
+ * we will set eqop to the hash equality operator, sortop to InvalidOid,
+ * and nulls_first to false.  A grouping item of this kind can only be
+ * implemented by hashing, and of course it'll never match an ORDER BY item.
+ *
+ * The hashable flag is provided since we generally have the requisite
+ * information readily available when the SortGroupClause is constructed,
+ * and it's relatively expensive to get it again later.  Note there is no
+ * need for a "sortable" flag since OidIsValid(sortop) serves the purpose.
+ *
+ * A query might have both ORDER BY and DISTINCT (or DISTINCT ON) clauses.
+ * In SELECT DISTINCT, the distinctClause list is as long or longer than the
+ * sortClause list, while in SELECT DISTINCT ON it's typically shorter.
+ * The two lists must match up to the end of the shorter one --- the parser
+ * rearranges the distinctClause if necessary to make this true.  (This
+ * restriction ensures that only one sort step is needed to both satisfy the
+ * ORDER BY and set up for the Unique step.  This is semantically necessary
+ * for DISTINCT ON, and presents no real drawback for DISTINCT.)
+ */
+typedef struct SortGroupClause
+{
+	NodeTag		type;
+	Index		tleSortGroupRef;	/* reference into targetlist */
+	Oid			eqop;			/* the equality operator ('=' op) */
+	Oid			sortop;			/* the ordering operator ('<' op), or 0 */
+	bool		nulls_first;	/* do NULLs come before normal values? */
+	bool		hashable;		/* can eqop be implemented by hashing? */
+} SortGroupClause;
+
+/*
+ * GroupingSet -
+ *		representation of CUBE, ROLLUP and GROUPING SETS clauses
+ *
+ * In a Query with grouping sets, the groupClause contains a flat list of
+ * SortGroupClause nodes for each distinct expression used.  The actual
+ * structure of the GROUP BY clause is given by the groupingSets tree.
+ *
+ * In the raw parser output, GroupingSet nodes (of all types except SIMPLE
+ * which is not used) are potentially mixed in with the expressions in the
+ * groupClause of the SelectStmt.  (An expression can't contain a GroupingSet,
+ * but a list may mix GroupingSet and expression nodes.)  At this stage, the
+ * content of each node is a list of expressions, some of which may be RowExprs
+ * which represent sublists rather than actual row constructors, and nested
+ * GroupingSet nodes where legal in the grammar.  The structure directly
+ * reflects the query syntax.
+ *
+ * In parse analysis, the transformed expressions are used to build the tlist
+ * and groupClause list (of SortGroupClause nodes), and the groupingSets tree
+ * is eventually reduced to a fixed format:
+ *
+ * EMPTY nodes represent (), and obviously have no content
+ *
+ * SIMPLE nodes represent a list of one or more expressions to be treated as an
+ * atom by the enclosing structure; the content is an integer list of
+ * ressortgroupref values (see SortGroupClause)
+ *
+ * CUBE and ROLLUP nodes contain a list of one or more SIMPLE nodes.
+ *
+ * SETS nodes contain a list of EMPTY, SIMPLE, CUBE or ROLLUP nodes, but after
+ * parse analysis they cannot contain more SETS nodes; enough of the syntactic
+ * transforms of the spec have been applied that we no longer have arbitrarily
+ * deep nesting (though we still preserve the use of cube/rollup).
+ *
+ * Note that if the groupingSets tree contains no SIMPLE nodes (only EMPTY
+ * nodes at the leaves), then the groupClause will be empty, but this is still
+ * an aggregation query (similar to using aggs or HAVING without GROUP BY).
+ *
+ * As an example, the following clause:
+ *
+ * GROUP BY GROUPING SETS ((a,b), CUBE(c,(d,e)))
+ *
+ * looks like this after raw parsing:
+ *
+ * SETS( RowExpr(a,b) , CUBE( c, RowExpr(d,e) ) )
+ *
+ * and parse analysis converts it to:
+ *
+ * SETS( SIMPLE(1,2), CUBE( SIMPLE(3), SIMPLE(4,5) ) )
+ */
+typedef enum
+{
+	GROUPING_SET_EMPTY,
+	GROUPING_SET_SIMPLE,
+	GROUPING_SET_ROLLUP,
+	GROUPING_SET_CUBE,
+	GROUPING_SET_SETS
+} GroupingSetKind;
+
+typedef struct GroupingSet
+{
+	NodeTag		type;
+	GroupingSetKind kind;
+	List	   *content;
+	int			location;
+} GroupingSet;
+
+/*
+ * WindowClause -
+ *		transformed representation of WINDOW and OVER clauses
+ *
+ * A parsed Query's windowClause list contains these structs.  "name" is set
+ * if the clause originally came from WINDOW, and is NULL if it originally
+ * was an OVER clause (but note that we collapse out duplicate OVERs).
+ * partitionClause and orderClause are lists of SortGroupClause structs.
+ * winref is an ID number referenced by WindowFunc nodes; it must be unique
+ * among the members of a Query's windowClause list.
+ * When refname isn't null, the partitionClause is always copied from there;
+ * the orderClause might or might not be copied (see copiedOrder); the framing
+ * options are never copied, per spec.
+ */
+typedef struct WindowClause
+{
+	NodeTag		type;
+	char	   *name;			/* window name (NULL in an OVER clause) */
+	char	   *refname;		/* referenced window name, if any */
+	List	   *partitionClause;	/* PARTITION BY list */
+	List	   *orderClause;	/* ORDER BY list */
+	int			frameOptions;	/* frame_clause options, see WindowDef */
+	Node	   *startOffset;	/* expression for starting bound, if any */
+	Node	   *endOffset;		/* expression for ending bound, if any */
+	Index		winref;			/* ID referenced by window functions */
+	bool		copiedOrder;	/* did we copy orderClause from refname? */
+} WindowClause;
+
+/*
+ * RowMarkClause -
+ *	   parser output representation of FOR [KEY] UPDATE/SHARE clauses
+ *
+ * Query.rowMarks contains a separate RowMarkClause node for each relation
+ * identified as a FOR [KEY] UPDATE/SHARE target.  If one of these clauses
+ * is applied to a subquery, we generate RowMarkClauses for all normal and
+ * subquery rels in the subquery, but they are marked pushedDown = true to
+ * distinguish them from clauses that were explicitly written at this query
+ * level.  Also, Query.hasForUpdate tells whether there were explicit FOR
+ * UPDATE/SHARE/KEY SHARE clauses in the current query level.
+ */
+typedef struct RowMarkClause
+{
+	NodeTag		type;
+	Index		rti;			/* range table index of target relation */
+	LockClauseStrength strength;
+	LockWaitPolicy waitPolicy;	/* NOWAIT and SKIP LOCKED */
+	bool		pushedDown;		/* pushed down from higher query level? */
+} RowMarkClause;
+
+/*
+ * WithClause -
+ *	   representation of WITH clause
+ *
+ * Note: WithClause does not propagate into the Query representation;
+ * but CommonTableExpr does.
+ */
+typedef struct WithClause
+{
+	NodeTag		type;
+	List	   *ctes;			/* list of CommonTableExprs */
+	bool		recursive;		/* true = WITH RECURSIVE */
+	int			location;		/* token location, or -1 if unknown */
+} WithClause;
+
+/*
+ * InferClause -
+ *		ON CONFLICT unique index inference clause
+ *
+ * Note: InferClause does not propagate into the Query representation.
+ */
+typedef struct InferClause
+{
+	NodeTag		type;
+	List	   *indexElems;		/* IndexElems to infer unique index */
+	Node	   *whereClause;	/* qualification (partial-index predicate) */
+	char	   *conname;		/* Constraint name, or NULL if unnamed */
+	int			location;		/* token location, or -1 if unknown */
+} InferClause;
+
+/*
+ * OnConflictClause -
+ *		representation of ON CONFLICT clause
+ *
+ * Note: OnConflictClause does not propagate into the Query representation.
+ */
+typedef struct OnConflictClause
+{
+	NodeTag		type;
+	OnConflictAction action;	/* DO NOTHING or UPDATE? */
+	InferClause *infer;			/* Optional index inference clause */
+	List	   *targetList;		/* the target list (of ResTarget) */
+	Node	   *whereClause;	/* qualifications */
+	int			location;		/* token location, or -1 if unknown */
+} OnConflictClause;
+
+/*
+ * CommonTableExpr -
+ *	   representation of WITH list element
+ *
+ * We don't currently support the SEARCH or CYCLE clause.
+ */
+typedef struct CommonTableExpr
+{
+	NodeTag		type;
+	char	   *ctename;		/* query name (never qualified) */
+	List	   *aliascolnames;	/* optional list of column names */
+	/* SelectStmt/InsertStmt/etc before parse analysis, Query afterwards: */
+	Node	   *ctequery;		/* the CTE's subquery */
+	int			location;		/* token location, or -1 if unknown */
+	/* These fields are set during parse analysis: */
+	bool		cterecursive;	/* is this CTE actually recursive? */
+	int			cterefcount;	/* number of RTEs referencing this CTE
+								 * (excluding internal self-references) */
+	List	   *ctecolnames;	/* list of output column names */
+	List	   *ctecoltypes;	/* OID list of output column type OIDs */
+	List	   *ctecoltypmods;	/* integer list of output column typmods */
+	List	   *ctecolcollations;		/* OID list of column collation OIDs */
+} CommonTableExpr;
+
+/* Convenience macro to get the output tlist of a CTE's query */
+#define GetCTETargetList(cte) \
+	(AssertMacro(IsA((cte)->ctequery, Query)), \
+	 ((Query *) (cte)->ctequery)->commandType == CMD_SELECT ? \
+	 ((Query *) (cte)->ctequery)->targetList : \
+	 ((Query *) (cte)->ctequery)->returningList)
+
+
+/*****************************************************************************
+ *		Optimizable Statements
+ *****************************************************************************/
+
+/* ----------------------
+ *		Insert Statement
+ *
+ * The source expression is represented by SelectStmt for both the
+ * SELECT and VALUES cases.  If selectStmt is NULL, then the query
+ * is INSERT ... DEFAULT VALUES.
+ * ----------------------
+ */
+typedef struct InsertStmt
+{
+	NodeTag		type;
+	RangeVar   *relation;		/* relation to insert into */
+	List	   *cols;			/* optional: names of the target columns */
+	Node	   *selectStmt;		/* the source SELECT/VALUES, or NULL */
+	OnConflictClause *onConflictClause; /* ON CONFLICT clause */
+	List	   *returningList;	/* list of expressions to return */
+	WithClause *withClause;		/* WITH clause */
+} InsertStmt;
+
+/* ----------------------
+ *		Delete Statement
+ * ----------------------
+ */
+typedef struct DeleteStmt
+{
+	NodeTag		type;
+	RangeVar   *relation;		/* relation to delete from */
+	List	   *usingClause;	/* optional using clause for more tables */
+	Node	   *whereClause;	/* qualifications */
+	List	   *returningList;	/* list of expressions to return */
+	WithClause *withClause;		/* WITH clause */
+} DeleteStmt;
+
+/* ----------------------
+ *		Update Statement
+ * ----------------------
+ */
+typedef struct UpdateStmt
+{
+	NodeTag		type;
+	RangeVar   *relation;		/* relation to update */
+	List	   *targetList;		/* the target list (of ResTarget) */
+	Node	   *whereClause;	/* qualifications */
+	List	   *fromClause;		/* optional from clause for more tables */
+	List	   *returningList;	/* list of expressions to return */
+	WithClause *withClause;		/* WITH clause */
+} UpdateStmt;
+
+/* ----------------------
+ *		Select Statement
+ *
+ * A "simple" SELECT is represented in the output of gram.y by a single
+ * SelectStmt node; so is a VALUES construct.  A query containing set
+ * operators (UNION, INTERSECT, EXCEPT) is represented by a tree of SelectStmt
+ * nodes, in which the leaf nodes are component SELECTs and the internal nodes
+ * represent UNION, INTERSECT, or EXCEPT operators.  Using the same node
+ * type for both leaf and internal nodes allows gram.y to stick ORDER BY,
+ * LIMIT, etc, clause values into a SELECT statement without worrying
+ * whether it is a simple or compound SELECT.
+ * ----------------------
+ */
+typedef enum SetOperation
+{
+	SETOP_NONE = 0,
+	SETOP_UNION,
+	SETOP_INTERSECT,
+	SETOP_EXCEPT
+} SetOperation;
+
+typedef struct SelectStmt
+{
+	NodeTag		type;
+
+	/*
+	 * These fields are used only in "leaf" SelectStmts.
+	 */
+	List	   *distinctClause; /* NULL, list of DISTINCT ON exprs, or
+								 * lcons(NIL,NIL) for all (SELECT DISTINCT) */
+	IntoClause *intoClause;		/* target for SELECT INTO */
+	List	   *targetList;		/* the target list (of ResTarget) */
+	List	   *fromClause;		/* the FROM clause */
+	Node	   *whereClause;	/* WHERE qualification */
+	List	   *groupClause;	/* GROUP BY clauses */
+	Node	   *havingClause;	/* HAVING conditional-expression */
+	List	   *windowClause;	/* WINDOW window_name AS (...), ... */
+
+	/*
+	 * In a "leaf" node representing a VALUES list, the above fields are all
+	 * null, and instead this field is set.  Note that the elements of the
+	 * sublists are just expressions, without ResTarget decoration. Also note
+	 * that a list element can be DEFAULT (represented as a SetToDefault
+	 * node), regardless of the context of the VALUES list. It's up to parse
+	 * analysis to reject that where not valid.
+	 */
+	List	   *valuesLists;	/* untransformed list of expression lists */
+
+	/*
+	 * These fields are used in both "leaf" SelectStmts and upper-level
+	 * SelectStmts.
+	 */
+	List	   *sortClause;		/* sort clause (a list of SortBy's) */
+	Node	   *limitOffset;	/* # of result tuples to skip */
+	Node	   *limitCount;		/* # of result tuples to return */
+	List	   *lockingClause;	/* FOR UPDATE (list of LockingClause's) */
+	WithClause *withClause;		/* WITH clause */
+
+	/*
+	 * These fields are used only in upper-level SelectStmts.
+	 */
+	SetOperation op;			/* type of set op */
+	bool		all;			/* ALL specified? */
+	struct SelectStmt *larg;	/* left child */
+	struct SelectStmt *rarg;	/* right child */
+	/* Eventually add fields for CORRESPONDING spec here */
+} SelectStmt;
+
+
+/* ----------------------
+ *		Set Operation node for post-analysis query trees
+ *
+ * After parse analysis, a SELECT with set operations is represented by a
+ * top-level Query node containing the leaf SELECTs as subqueries in its
+ * range table.  Its setOperations field shows the tree of set operations,
+ * with leaf SelectStmt nodes replaced by RangeTblRef nodes, and internal
+ * nodes replaced by SetOperationStmt nodes.  Information about the output
+ * column types is added, too.  (Note that the child nodes do not necessarily
+ * produce these types directly, but we've checked that their output types
+ * can be coerced to the output column type.)  Also, if it's not UNION ALL,
+ * information about the types' sort/group semantics is provided in the form
+ * of a SortGroupClause list (same representation as, eg, DISTINCT).
+ * The resolved common column collations are provided too; but note that if
+ * it's not UNION ALL, it's okay for a column to not have a common collation,
+ * so a member of the colCollations list could be InvalidOid even though the
+ * column has a collatable type.
+ * ----------------------
+ */
+typedef struct SetOperationStmt
+{
+	NodeTag		type;
+	SetOperation op;			/* type of set op */
+	bool		all;			/* ALL specified? */
+	Node	   *larg;			/* left child */
+	Node	   *rarg;			/* right child */
+	/* Eventually add fields for CORRESPONDING spec here */
+
+	/* Fields derived during parse analysis: */
+	List	   *colTypes;		/* OID list of output column type OIDs */
+	List	   *colTypmods;		/* integer list of output column typmods */
+	List	   *colCollations;	/* OID list of output column collation OIDs */
+	List	   *groupClauses;	/* a list of SortGroupClause's */
+	/* groupClauses is NIL if UNION ALL, but must be set otherwise */
+} SetOperationStmt;
+
+
+/*****************************************************************************
+ *		Other Statements (no optimizations required)
+ *
+ *		These are not touched by parser/analyze.c except to put them into
+ *		the utilityStmt field of a Query.  This is eventually passed to
+ *		ProcessUtility (by-passing rewriting and planning).  Some of the
+ *		statements do need attention from parse analysis, and this is
+ *		done by routines in parser/parse_utilcmd.c after ProcessUtility
+ *		receives the command for execution.
+ *****************************************************************************/
+
+/*
+ * When a command can act on several kinds of objects with only one
+ * parse structure required, use these constants to designate the
+ * object type.  Note that commands typically don't support all the types.
+ */
+
+typedef enum ObjectType
+{
+	OBJECT_AGGREGATE,
+	OBJECT_AMOP,
+	OBJECT_AMPROC,
+	OBJECT_ATTRIBUTE,			/* type's attribute, when distinct from column */
+	OBJECT_CAST,
+	OBJECT_COLUMN,
+	OBJECT_COLLATION,
+	OBJECT_CONVERSION,
+	OBJECT_DATABASE,
+	OBJECT_DEFAULT,
+	OBJECT_DEFACL,
+	OBJECT_DOMAIN,
+	OBJECT_DOMCONSTRAINT,
+	OBJECT_EVENT_TRIGGER,
+	OBJECT_EXTENSION,
+	OBJECT_FDW,
+	OBJECT_FOREIGN_SERVER,
+	OBJECT_FOREIGN_TABLE,
+	OBJECT_FUNCTION,
+	OBJECT_INDEX,
+	OBJECT_LANGUAGE,
+	OBJECT_LARGEOBJECT,
+	OBJECT_MATVIEW,
+	OBJECT_OPCLASS,
+	OBJECT_OPERATOR,
+	OBJECT_OPFAMILY,
+	OBJECT_POLICY,
+	OBJECT_ROLE,
+	OBJECT_RULE,
+	OBJECT_SCHEMA,
+	OBJECT_SEQUENCE,
+	OBJECT_TABCONSTRAINT,
+	OBJECT_TABLE,
+	OBJECT_TABLESPACE,
+	OBJECT_TRANSFORM,
+	OBJECT_TRIGGER,
+	OBJECT_TSCONFIGURATION,
+	OBJECT_TSDICTIONARY,
+	OBJECT_TSPARSER,
+	OBJECT_TSTEMPLATE,
+	OBJECT_TYPE,
+	OBJECT_USER_MAPPING,
+	OBJECT_VIEW
+} ObjectType;
+
+/* ----------------------
+ *		Create Schema Statement
+ *
+ * NOTE: the schemaElts list contains raw parsetrees for component statements
+ * of the schema, such as CREATE TABLE, GRANT, etc.  These are analyzed and
+ * executed after the schema itself is created.
+ * ----------------------
+ */
+typedef struct CreateSchemaStmt
+{
+	NodeTag		type;
+	char	   *schemaname;		/* the name of the schema to create */
+	Node	   *authrole;		/* the owner of the created schema */
+	List	   *schemaElts;		/* schema components (list of parsenodes) */
+	bool		if_not_exists;	/* just do nothing if schema already exists? */
+} CreateSchemaStmt;
+
+typedef enum DropBehavior
+{
+	DROP_RESTRICT,				/* drop fails if any dependent objects */
+	DROP_CASCADE				/* remove dependent objects too */
+} DropBehavior;
+
+/* ----------------------
+ *	Alter Table
+ * ----------------------
+ */
+typedef struct AlterTableStmt
+{
+	NodeTag		type;
+	RangeVar   *relation;		/* table to work on */
+	List	   *cmds;			/* list of subcommands */
+	ObjectType	relkind;		/* type of object */
+	bool		missing_ok;		/* skip error if table missing */
+} AlterTableStmt;
+
+typedef enum AlterTableType
+{
+	AT_AddColumn,				/* add column */
+	AT_AddColumnRecurse,		/* internal to commands/tablecmds.c */
+	AT_AddColumnToView,			/* implicitly via CREATE OR REPLACE VIEW */
+	AT_ColumnDefault,			/* alter column default */
+	AT_DropNotNull,				/* alter column drop not null */
+	AT_SetNotNull,				/* alter column set not null */
+	AT_SetStatistics,			/* alter column set statistics */
+	AT_SetOptions,				/* alter column set ( options ) */
+	AT_ResetOptions,			/* alter column reset ( options ) */
+	AT_SetStorage,				/* alter column set storage */
+	AT_DropColumn,				/* drop column */
+	AT_DropColumnRecurse,		/* internal to commands/tablecmds.c */
+	AT_AddIndex,				/* add index */
+	AT_ReAddIndex,				/* internal to commands/tablecmds.c */
+	AT_AddConstraint,			/* add constraint */
+	AT_AddConstraintRecurse,	/* internal to commands/tablecmds.c */
+	AT_ReAddConstraint,			/* internal to commands/tablecmds.c */
+	AT_AlterConstraint,			/* alter constraint */
+	AT_ValidateConstraint,		/* validate constraint */
+	AT_ValidateConstraintRecurse,		/* internal to commands/tablecmds.c */
+	AT_ProcessedConstraint,		/* pre-processed add constraint (local in
+								 * parser/parse_utilcmd.c) */
+	AT_AddIndexConstraint,		/* add constraint using existing index */
+	AT_DropConstraint,			/* drop constraint */
+	AT_DropConstraintRecurse,	/* internal to commands/tablecmds.c */
+	AT_ReAddComment,			/* internal to commands/tablecmds.c */
+	AT_AlterColumnType,			/* alter column type */
+	AT_AlterColumnGenericOptions,		/* alter column OPTIONS (...) */
+	AT_ChangeOwner,				/* change owner */
+	AT_ClusterOn,				/* CLUSTER ON */
+	AT_DropCluster,				/* SET WITHOUT CLUSTER */
+	AT_SetLogged,				/* SET LOGGED */
+	AT_SetUnLogged,				/* SET UNLOGGED */
+	AT_AddOids,					/* SET WITH OIDS */
+	AT_AddOidsRecurse,			/* internal to commands/tablecmds.c */
+	AT_DropOids,				/* SET WITHOUT OIDS */
+	AT_SetTableSpace,			/* SET TABLESPACE */
+	AT_SetRelOptions,			/* SET (...) -- AM specific parameters */
+	AT_ResetRelOptions,			/* RESET (...) -- AM specific parameters */
+	AT_ReplaceRelOptions,		/* replace reloption list in its entirety */
+	AT_EnableTrig,				/* ENABLE TRIGGER name */
+	AT_EnableAlwaysTrig,		/* ENABLE ALWAYS TRIGGER name */
+	AT_EnableReplicaTrig,		/* ENABLE REPLICA TRIGGER name */
+	AT_DisableTrig,				/* DISABLE TRIGGER name */
+	AT_EnableTrigAll,			/* ENABLE TRIGGER ALL */
+	AT_DisableTrigAll,			/* DISABLE TRIGGER ALL */
+	AT_EnableTrigUser,			/* ENABLE TRIGGER USER */
+	AT_DisableTrigUser,			/* DISABLE TRIGGER USER */
+	AT_EnableRule,				/* ENABLE RULE name */
+	AT_EnableAlwaysRule,		/* ENABLE ALWAYS RULE name */
+	AT_EnableReplicaRule,		/* ENABLE REPLICA RULE name */
+	AT_DisableRule,				/* DISABLE RULE name */
+	AT_AddInherit,				/* INHERIT parent */
+	AT_DropInherit,				/* NO INHERIT parent */
+	AT_AddOf,					/* OF <type_name> */
+	AT_DropOf,					/* NOT OF */
+	AT_ReplicaIdentity,			/* REPLICA IDENTITY */
+	AT_EnableRowSecurity,		/* ENABLE ROW SECURITY */
+	AT_DisableRowSecurity,		/* DISABLE ROW SECURITY */
+	AT_ForceRowSecurity,		/* FORCE ROW SECURITY */
+	AT_NoForceRowSecurity,		/* NO FORCE ROW SECURITY */
+	AT_GenericOptions			/* OPTIONS (...) */
+} AlterTableType;
+
+typedef struct ReplicaIdentityStmt
+{
+	NodeTag		type;
+	char		identity_type;
+	char	   *name;
+} ReplicaIdentityStmt;
+
+typedef struct AlterTableCmd	/* one subcommand of an ALTER TABLE */
+{
+	NodeTag		type;
+	AlterTableType subtype;		/* Type of table alteration to apply */
+	char	   *name;			/* column, constraint, or trigger to act on,
+								 * or tablespace */
+	Node	   *newowner;		/* RoleSpec */
+	Node	   *def;			/* definition of new column, index,
+								 * constraint, or parent table */
+	DropBehavior behavior;		/* RESTRICT or CASCADE for DROP cases */
+	bool		missing_ok;		/* skip error if missing? */
+} AlterTableCmd;
+
+
+/* ----------------------
+ *	Alter Domain
+ *
+ * The fields are used in different ways by the different variants of
+ * this command.
+ * ----------------------
+ */
+typedef struct AlterDomainStmt
+{
+	NodeTag		type;
+	char		subtype;		/*------------
+								 *	T = alter column default
+								 *	N = alter column drop not null
+								 *	O = alter column set not null
+								 *	C = add constraint
+								 *	X = drop constraint
+								 *------------
+								 */
+	List	   *typeName;		/* domain to work on */
+	char	   *name;			/* column or constraint name to act on */
+	Node	   *def;			/* definition of default or constraint */
+	DropBehavior behavior;		/* RESTRICT or CASCADE for DROP cases */
+	bool		missing_ok;		/* skip error if missing? */
+} AlterDomainStmt;
+
+
+/* ----------------------
+ *		Grant|Revoke Statement
+ * ----------------------
+ */
+typedef enum GrantTargetType
+{
+	ACL_TARGET_OBJECT,			/* grant on specific named object(s) */
+	ACL_TARGET_ALL_IN_SCHEMA,	/* grant on all objects in given schema(s) */
+	ACL_TARGET_DEFAULTS			/* ALTER DEFAULT PRIVILEGES */
+} GrantTargetType;
+
+typedef enum GrantObjectType
+{
+	ACL_OBJECT_COLUMN,			/* column */
+	ACL_OBJECT_RELATION,		/* table, view */
+	ACL_OBJECT_SEQUENCE,		/* sequence */
+	ACL_OBJECT_DATABASE,		/* database */
+	ACL_OBJECT_DOMAIN,			/* domain */
+	ACL_OBJECT_FDW,				/* foreign-data wrapper */
+	ACL_OBJECT_FOREIGN_SERVER,	/* foreign server */
+	ACL_OBJECT_FUNCTION,		/* function */
+	ACL_OBJECT_LANGUAGE,		/* procedural language */
+	ACL_OBJECT_LARGEOBJECT,		/* largeobject */
+	ACL_OBJECT_NAMESPACE,		/* namespace */
+	ACL_OBJECT_TABLESPACE,		/* tablespace */
+	ACL_OBJECT_TYPE				/* type */
+} GrantObjectType;
+
+typedef struct GrantStmt
+{
+	NodeTag		type;
+	bool		is_grant;		/* true = GRANT, false = REVOKE */
+	GrantTargetType targtype;	/* type of the grant target */
+	GrantObjectType objtype;	/* kind of object being operated on */
+	List	   *objects;		/* list of RangeVar nodes, FuncWithArgs nodes,
+								 * or plain names (as Value strings) */
+	List	   *privileges;		/* list of AccessPriv nodes */
+	/* privileges == NIL denotes ALL PRIVILEGES */
+	List	   *grantees;		/* list of RoleSpec nodes */
+	bool		grant_option;	/* grant or revoke grant option */
+	DropBehavior behavior;		/* drop behavior (for REVOKE) */
+} GrantStmt;
+
+/*
+ * Note: FuncWithArgs carries only the types of the input parameters of the
+ * function.  So it is sufficient to identify an existing function, but it
+ * is not enough info to define a function nor to call it.
+ */
+typedef struct FuncWithArgs
+{
+	NodeTag		type;
+	List	   *funcname;		/* qualified name of function */
+	List	   *funcargs;		/* list of Typename nodes */
+} FuncWithArgs;
+
+/*
+ * An access privilege, with optional list of column names
+ * priv_name == NULL denotes ALL PRIVILEGES (only used with a column list)
+ * cols == NIL denotes "all columns"
+ * Note that simple "ALL PRIVILEGES" is represented as a NIL list, not
+ * an AccessPriv with both fields null.
+ */
+typedef struct AccessPriv
+{
+	NodeTag		type;
+	char	   *priv_name;		/* string name of privilege */
+	List	   *cols;			/* list of Value strings */
+} AccessPriv;
+
+/* ----------------------
+ *		Grant/Revoke Role Statement
+ *
+ * Note: because of the parsing ambiguity with the GRANT <privileges>
+ * statement, granted_roles is a list of AccessPriv; the execution code
+ * should complain if any column lists appear.  grantee_roles is a list
+ * of role names, as Value strings.
+ * ----------------------
+ */
+typedef struct GrantRoleStmt
+{
+	NodeTag		type;
+	List	   *granted_roles;	/* list of roles to be granted/revoked */
+	List	   *grantee_roles;	/* list of member roles to add/delete */
+	bool		is_grant;		/* true = GRANT, false = REVOKE */
+	bool		admin_opt;		/* with admin option */
+	Node	   *grantor;		/* set grantor to other than current role */
+	DropBehavior behavior;		/* drop behavior (for REVOKE) */
+} GrantRoleStmt;
+
+/* ----------------------
+ *	Alter Default Privileges Statement
+ * ----------------------
+ */
+typedef struct AlterDefaultPrivilegesStmt
+{
+	NodeTag		type;
+	List	   *options;		/* list of DefElem */
+	GrantStmt  *action;			/* GRANT/REVOKE action (with objects=NIL) */
+} AlterDefaultPrivilegesStmt;
+
+/* ----------------------
+ *		Copy Statement
+ *
+ * We support "COPY relation FROM file", "COPY relation TO file", and
+ * "COPY (query) TO file".  In any given CopyStmt, exactly one of "relation"
+ * and "query" must be non-NULL.
+ * ----------------------
+ */
+typedef struct CopyStmt
+{
+	NodeTag		type;
+	RangeVar   *relation;		/* the relation to copy */
+	Node	   *query;			/* the SELECT query to copy */
+	List	   *attlist;		/* List of column names (as Strings), or NIL
+								 * for all columns */
+	bool		is_from;		/* TO or FROM */
+	bool		is_program;		/* is 'filename' a program to popen? */
+	char	   *filename;		/* filename, or NULL for STDIN/STDOUT */
+	List	   *options;		/* List of DefElem nodes */
+} CopyStmt;
+
+/* ----------------------
+ * SET Statement (includes RESET)
+ *
+ * "SET var TO DEFAULT" and "RESET var" are semantically equivalent, but we
+ * preserve the distinction in VariableSetKind for CreateCommandTag().
+ * ----------------------
+ */
+typedef enum
+{
+	VAR_SET_VALUE,				/* SET var = value */
+	VAR_SET_DEFAULT,			/* SET var TO DEFAULT */
+	VAR_SET_CURRENT,			/* SET var FROM CURRENT */
+	VAR_SET_MULTI,				/* special case for SET TRANSACTION ... */
+	VAR_RESET,					/* RESET var */
+	VAR_RESET_ALL				/* RESET ALL */
+} VariableSetKind;
+
+typedef struct VariableSetStmt
+{
+	NodeTag		type;
+	VariableSetKind kind;
+	char	   *name;			/* variable to be set */
+	List	   *args;			/* List of A_Const nodes */
+	bool		is_local;		/* SET LOCAL? */
+} VariableSetStmt;
+
+/* ----------------------
+ * Show Statement
+ * ----------------------
+ */
+typedef struct VariableShowStmt
+{
+	NodeTag		type;
+	char	   *name;
+} VariableShowStmt;
+
+/* ----------------------
+ *		Create Table Statement
+ *
+ * NOTE: in the raw gram.y output, ColumnDef and Constraint nodes are
+ * intermixed in tableElts, and constraints is NIL.  After parse analysis,
+ * tableElts contains just ColumnDefs, and constraints contains just
+ * Constraint nodes (in fact, only CONSTR_CHECK nodes, in the present
+ * implementation).
+ * ----------------------
+ */
+
+typedef struct CreateStmt
+{
+	NodeTag		type;
+	RangeVar   *relation;		/* relation to create */
+	List	   *tableElts;		/* column definitions (list of ColumnDef) */
+	List	   *inhRelations;	/* relations to inherit from (list of
+								 * inhRelation) */
+	TypeName   *ofTypename;		/* OF typename */
+	List	   *constraints;	/* constraints (list of Constraint nodes) */
+	List	   *options;		/* options from WITH clause */
+	OnCommitAction oncommit;	/* what do we do at COMMIT? */
+	char	   *tablespacename; /* table space to use, or NULL */
+	bool		if_not_exists;	/* just do nothing if it already exists? */
+} CreateStmt;
+
+/* ----------
+ * Definitions for constraints in CreateStmt
+ *
+ * Note that column defaults are treated as a type of constraint,
+ * even though that's a bit odd semantically.
+ *
+ * For constraints that use expressions (CONSTR_CHECK, CONSTR_DEFAULT)
+ * we may have the expression in either "raw" form (an untransformed
+ * parse tree) or "cooked" form (the nodeToString representation of
+ * an executable expression tree), depending on how this Constraint
+ * node was created (by parsing, or by inheritance from an existing
+ * relation).  We should never have both in the same node!
+ *
+ * FKCONSTR_ACTION_xxx values are stored into pg_constraint.confupdtype
+ * and pg_constraint.confdeltype columns; FKCONSTR_MATCH_xxx values are
+ * stored into pg_constraint.confmatchtype.  Changing the code values may
+ * require an initdb!
+ *
+ * If skip_validation is true then we skip checking that the existing rows
+ * in the table satisfy the constraint, and just install the catalog entries
+ * for the constraint.  A new FK constraint is marked as valid iff
+ * initially_valid is true.  (Usually skip_validation and initially_valid
+ * are inverses, but we can set both true if the table is known empty.)
+ *
+ * Constraint attributes (DEFERRABLE etc) are initially represented as
+ * separate Constraint nodes for simplicity of parsing.  parse_utilcmd.c makes
+ * a pass through the constraints list to insert the info into the appropriate
+ * Constraint node.
+ * ----------
+ */
+
+typedef enum ConstrType			/* types of constraints */
+{
+	CONSTR_NULL,				/* not standard SQL, but a lot of people
+								 * expect it */
+	CONSTR_NOTNULL,
+	CONSTR_DEFAULT,
+	CONSTR_CHECK,
+	CONSTR_PRIMARY,
+	CONSTR_UNIQUE,
+	CONSTR_EXCLUSION,
+	CONSTR_FOREIGN,
+	CONSTR_ATTR_DEFERRABLE,		/* attributes for previous constraint node */
+	CONSTR_ATTR_NOT_DEFERRABLE,
+	CONSTR_ATTR_DEFERRED,
+	CONSTR_ATTR_IMMEDIATE
+} ConstrType;
+
+/* Foreign key action codes */
+#define FKCONSTR_ACTION_NOACTION	'a'
+#define FKCONSTR_ACTION_RESTRICT	'r'
+#define FKCONSTR_ACTION_CASCADE		'c'
+#define FKCONSTR_ACTION_SETNULL		'n'
+#define FKCONSTR_ACTION_SETDEFAULT	'd'
+
+/* Foreign key matchtype codes */
+#define FKCONSTR_MATCH_FULL			'f'
+#define FKCONSTR_MATCH_PARTIAL		'p'
+#define FKCONSTR_MATCH_SIMPLE		's'
+
+typedef struct Constraint
+{
+	NodeTag		type;
+	ConstrType	contype;		/* see above */
+
+	/* Fields used for most/all constraint types: */
+	char	   *conname;		/* Constraint name, or NULL if unnamed */
+	bool		deferrable;		/* DEFERRABLE? */
+	bool		initdeferred;	/* INITIALLY DEFERRED? */
+	int			location;		/* token location, or -1 if unknown */
+
+	/* Fields used for constraints with expressions (CHECK and DEFAULT): */
+	bool		is_no_inherit;	/* is constraint non-inheritable? */
+	Node	   *raw_expr;		/* expr, as untransformed parse tree */
+	char	   *cooked_expr;	/* expr, as nodeToString representation */
+
+	/* Fields used for unique constraints (UNIQUE and PRIMARY KEY): */
+	List	   *keys;			/* String nodes naming referenced column(s) */
+
+	/* Fields used for EXCLUSION constraints: */
+	List	   *exclusions;		/* list of (IndexElem, operator name) pairs */
+
+	/* Fields used for index constraints (UNIQUE, PRIMARY KEY, EXCLUSION): */
+	List	   *options;		/* options from WITH clause */
+	char	   *indexname;		/* existing index to use; otherwise NULL */
+	char	   *indexspace;		/* index tablespace; NULL for default */
+	/* These could be, but currently are not, used for UNIQUE/PKEY: */
+	char	   *access_method;	/* index access method; NULL for default */
+	Node	   *where_clause;	/* partial index predicate */
+
+	/* Fields used for FOREIGN KEY constraints: */
+	RangeVar   *pktable;		/* Primary key table */
+	List	   *fk_attrs;		/* Attributes of foreign key */
+	List	   *pk_attrs;		/* Corresponding attrs in PK table */
+	char		fk_matchtype;	/* FULL, PARTIAL, SIMPLE */
+	char		fk_upd_action;	/* ON UPDATE action */
+	char		fk_del_action;	/* ON DELETE action */
+	List	   *old_conpfeqop;	/* pg_constraint.conpfeqop of my former self */
+	Oid			old_pktable_oid;	/* pg_constraint.confrelid of my former self */
+
+	/* Fields used for constraints that allow a NOT VALID specification */
+	bool		skip_validation;	/* skip validation of existing rows? */
+	bool		initially_valid;	/* mark the new constraint as valid? */
+} Constraint;
+
+/* ----------------------
+ *		Create/Drop Table Space Statements
+ * ----------------------
+ */
+
+typedef struct CreateTableSpaceStmt
+{
+	NodeTag		type;
+	char	   *tablespacename;
+	Node	   *owner;
+	char	   *location;
+	List	   *options;
+} CreateTableSpaceStmt;
+
+typedef struct DropTableSpaceStmt
+{
+	NodeTag		type;
+	char	   *tablespacename;
+	bool		missing_ok;		/* skip error if missing? */
+} DropTableSpaceStmt;
+
+typedef struct AlterTableSpaceOptionsStmt
+{
+	NodeTag		type;
+	char	   *tablespacename;
+	List	   *options;
+	bool		isReset;
+} AlterTableSpaceOptionsStmt;
+
+typedef struct AlterTableMoveAllStmt
+{
+	NodeTag		type;
+	char	   *orig_tablespacename;
+	ObjectType	objtype;		/* Object type to move */
+	List	   *roles;			/* List of roles to move objects of */
+	char	   *new_tablespacename;
+	bool		nowait;
+} AlterTableMoveAllStmt;
+
+/* ----------------------
+ *		Create/Alter Extension Statements
+ * ----------------------
+ */
+
+typedef struct CreateExtensionStmt
+{
+	NodeTag		type;
+	char	   *extname;
+	bool		if_not_exists;	/* just do nothing if it already exists? */
+	List	   *options;		/* List of DefElem nodes */
+} CreateExtensionStmt;
+
+/* Only used for ALTER EXTENSION UPDATE; later might need an action field */
+typedef struct AlterExtensionStmt
+{
+	NodeTag		type;
+	char	   *extname;
+	List	   *options;		/* List of DefElem nodes */
+} AlterExtensionStmt;
+
+typedef struct AlterExtensionContentsStmt
+{
+	NodeTag		type;
+	char	   *extname;		/* Extension's name */
+	int			action;			/* +1 = add object, -1 = drop object */
+	ObjectType	objtype;		/* Object's type */
+	List	   *objname;		/* Qualified name of the object */
+	List	   *objargs;		/* Arguments if needed (eg, for functions) */
+} AlterExtensionContentsStmt;
+
+/* ----------------------
+ *		Create/Alter FOREIGN DATA WRAPPER Statements
+ * ----------------------
+ */
+
+typedef struct CreateFdwStmt
+{
+	NodeTag		type;
+	char	   *fdwname;		/* foreign-data wrapper name */
+	List	   *func_options;	/* HANDLER/VALIDATOR options */
+	List	   *options;		/* generic options to FDW */
+} CreateFdwStmt;
+
+typedef struct AlterFdwStmt
+{
+	NodeTag		type;
+	char	   *fdwname;		/* foreign-data wrapper name */
+	List	   *func_options;	/* HANDLER/VALIDATOR options */
+	List	   *options;		/* generic options to FDW */
+} AlterFdwStmt;
+
+/* ----------------------
+ *		Create/Alter FOREIGN SERVER Statements
+ * ----------------------
+ */
+
+typedef struct CreateForeignServerStmt
+{
+	NodeTag		type;
+	char	   *servername;		/* server name */
+	char	   *servertype;		/* optional server type */
+	char	   *version;		/* optional server version */
+	char	   *fdwname;		/* FDW name */
+	List	   *options;		/* generic options to server */
+} CreateForeignServerStmt;
+
+typedef struct AlterForeignServerStmt
+{
+	NodeTag		type;
+	char	   *servername;		/* server name */
+	char	   *version;		/* optional server version */
+	List	   *options;		/* generic options to server */
+	bool		has_version;	/* version specified */
+} AlterForeignServerStmt;
+
+/* ----------------------
+ *		Create FOREIGN TABLE Statement
+ * ----------------------
+ */
+
+typedef struct CreateForeignTableStmt
+{
+	CreateStmt	base;
+	char	   *servername;
+	List	   *options;
+} CreateForeignTableStmt;
+
+/* ----------------------
+ *		Create/Drop USER MAPPING Statements
+ * ----------------------
+ */
+
+typedef struct CreateUserMappingStmt
+{
+	NodeTag		type;
+	Node	   *user;			/* user role */
+	char	   *servername;		/* server name */
+	List	   *options;		/* generic options to server */
+} CreateUserMappingStmt;
+
+typedef struct AlterUserMappingStmt
+{
+	NodeTag		type;
+	Node	   *user;			/* user role */
+	char	   *servername;		/* server name */
+	List	   *options;		/* generic options to server */
+} AlterUserMappingStmt;
+
+typedef struct DropUserMappingStmt
+{
+	NodeTag		type;
+	Node	   *user;			/* user role */
+	char	   *servername;		/* server name */
+	bool		missing_ok;		/* ignore missing mappings */
+} DropUserMappingStmt;
+
+/* ----------------------
+ *		Import Foreign Schema Statement
+ * ----------------------
+ */
+
+typedef enum ImportForeignSchemaType
+{
+	FDW_IMPORT_SCHEMA_ALL,		/* all relations wanted */
+	FDW_IMPORT_SCHEMA_LIMIT_TO, /* include only listed tables in import */
+	FDW_IMPORT_SCHEMA_EXCEPT	/* exclude listed tables from import */
+} ImportForeignSchemaType;
+
+typedef struct ImportForeignSchemaStmt
+{
+	NodeTag		type;
+	char	   *server_name;	/* FDW server name */
+	char	   *remote_schema;	/* remote schema name to query */
+	char	   *local_schema;	/* local schema to create objects in */
+	ImportForeignSchemaType list_type;	/* type of table list */
+	List	   *table_list;		/* List of RangeVar */
+	List	   *options;		/* list of options to pass to FDW */
+} ImportForeignSchemaStmt;
+
+/*----------------------
+ *		Create POLICY Statement
+ *----------------------
+ */
+typedef struct CreatePolicyStmt
+{
+	NodeTag		type;
+	char	   *policy_name;	/* Policy's name */
+	RangeVar   *table;			/* the table name the policy applies to */
+	char	   *cmd_name;		/* the command name the policy applies to */
+	List	   *roles;			/* the roles associated with the policy */
+	Node	   *qual;			/* the policy's condition */
+	Node	   *with_check;		/* the policy's WITH CHECK condition. */
+} CreatePolicyStmt;
+
+/*----------------------
+ *		Alter POLICY Statement
+ *----------------------
+ */
+typedef struct AlterPolicyStmt
+{
+	NodeTag		type;
+	char	   *policy_name;	/* Policy's name */
+	RangeVar   *table;			/* the table name the policy applies to */
+	List	   *roles;			/* the roles associated with the policy */
+	Node	   *qual;			/* the policy's condition */
+	Node	   *with_check;		/* the policy's WITH CHECK condition. */
+} AlterPolicyStmt;
+
+/* ----------------------
+ *		Create TRIGGER Statement
+ * ----------------------
+ */
+typedef struct CreateTrigStmt
+{
+	NodeTag		type;
+	char	   *trigname;		/* TRIGGER's name */
+	RangeVar   *relation;		/* relation trigger is on */
+	List	   *funcname;		/* qual. name of function to call */
+	List	   *args;			/* list of (T_String) Values or NIL */
+	bool		row;			/* ROW/STATEMENT */
+	/* timing uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
+	int16		timing;			/* BEFORE, AFTER, or INSTEAD */
+	/* events uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
+	int16		events;			/* "OR" of INSERT/UPDATE/DELETE/TRUNCATE */
+	List	   *columns;		/* column names, or NIL for all columns */
+	Node	   *whenClause;		/* qual expression, or NULL if none */
+	bool		isconstraint;	/* This is a constraint trigger */
+	/* The remaining fields are only used for constraint triggers */
+	bool		deferrable;		/* [NOT] DEFERRABLE */
+	bool		initdeferred;	/* INITIALLY {DEFERRED|IMMEDIATE} */
+	RangeVar   *constrrel;		/* opposite relation, if RI trigger */
+} CreateTrigStmt;
+
+/* ----------------------
+ *		Create EVENT TRIGGER Statement
+ * ----------------------
+ */
+typedef struct CreateEventTrigStmt
+{
+	NodeTag		type;
+	char	   *trigname;		/* TRIGGER's name */
+	char	   *eventname;		/* event's identifier */
+	List	   *whenclause;		/* list of DefElems indicating filtering */
+	List	   *funcname;		/* qual. name of function to call */
+} CreateEventTrigStmt;
+
+/* ----------------------
+ *		Alter EVENT TRIGGER Statement
+ * ----------------------
+ */
+typedef struct AlterEventTrigStmt
+{
+	NodeTag		type;
+	char	   *trigname;		/* TRIGGER's name */
+	char		tgenabled;		/* trigger's firing configuration WRT
+								 * session_replication_role */
+} AlterEventTrigStmt;
+
+/* ----------------------
+ *		Create/Drop PROCEDURAL LANGUAGE Statements
+ *		Create PROCEDURAL LANGUAGE Statements
+ * ----------------------
+ */
+typedef struct CreatePLangStmt
+{
+	NodeTag		type;
+	bool		replace;		/* T => replace if already exists */
+	char	   *plname;			/* PL name */
+	List	   *plhandler;		/* PL call handler function (qual. name) */
+	List	   *plinline;		/* optional inline function (qual. name) */
+	List	   *plvalidator;	/* optional validator function (qual. name) */
+	bool		pltrusted;		/* PL is trusted */
+} CreatePLangStmt;
+
+/* ----------------------
+ *	Create/Alter/Drop Role Statements
+ *
+ * Note: these node types are also used for the backwards-compatible
+ * Create/Alter/Drop User/Group statements.  In the ALTER and DROP cases
+ * there's really no need to distinguish what the original spelling was,
+ * but for CREATE we mark the type because the defaults vary.
+ * ----------------------
+ */
+typedef enum RoleStmtType
+{
+	ROLESTMT_ROLE,
+	ROLESTMT_USER,
+	ROLESTMT_GROUP
+} RoleStmtType;
+
+typedef struct CreateRoleStmt
+{
+	NodeTag		type;
+	RoleStmtType stmt_type;		/* ROLE/USER/GROUP */
+	char	   *role;			/* role name */
+	List	   *options;		/* List of DefElem nodes */
+} CreateRoleStmt;
+
+typedef struct AlterRoleStmt
+{
+	NodeTag		type;
+	Node	   *role;			/* role */
+	List	   *options;		/* List of DefElem nodes */
+	int			action;			/* +1 = add members, -1 = drop members */
+} AlterRoleStmt;
+
+typedef struct AlterRoleSetStmt
+{
+	NodeTag		type;
+	Node	   *role;			/* role */
+	char	   *database;		/* database name, or NULL */
+	VariableSetStmt *setstmt;	/* SET or RESET subcommand */
+} AlterRoleSetStmt;
+
+typedef struct DropRoleStmt
+{
+	NodeTag		type;
+	List	   *roles;			/* List of roles to remove */
+	bool		missing_ok;		/* skip error if a role is missing? */
+} DropRoleStmt;
+
+/* ----------------------
+ *		{Create|Alter} SEQUENCE Statement
+ * ----------------------
+ */
+
+typedef struct CreateSeqStmt
+{
+	NodeTag		type;
+	RangeVar   *sequence;		/* the sequence to create */
+	List	   *options;
+	Oid			ownerId;		/* ID of owner, or InvalidOid for default */
+	bool		if_not_exists;	/* just do nothing if it already exists? */
+} CreateSeqStmt;
+
+typedef struct AlterSeqStmt
+{
+	NodeTag		type;
+	RangeVar   *sequence;		/* the sequence to alter */
+	List	   *options;
+	bool		missing_ok;		/* skip error if a role is missing? */
+} AlterSeqStmt;
+
+/* ----------------------
+ *		Create {Aggregate|Operator|Type} Statement
+ * ----------------------
+ */
+typedef struct DefineStmt
+{
+	NodeTag		type;
+	ObjectType	kind;			/* aggregate, operator, type */
+	bool		oldstyle;		/* hack to signal old CREATE AGG syntax */
+	List	   *defnames;		/* qualified name (list of Value strings) */
+	List	   *args;			/* a list of TypeName (if needed) */
+	List	   *definition;		/* a list of DefElem */
+} DefineStmt;
+
+/* ----------------------
+ *		Create Domain Statement
+ * ----------------------
+ */
+typedef struct CreateDomainStmt
+{
+	NodeTag		type;
+	List	   *domainname;		/* qualified name (list of Value strings) */
+	TypeName   *typeName;		/* the base type */
+	CollateClause *collClause;	/* untransformed COLLATE spec, if any */
+	List	   *constraints;	/* constraints (list of Constraint nodes) */
+} CreateDomainStmt;
+
+/* ----------------------
+ *		Create Operator Class Statement
+ * ----------------------
+ */
+typedef struct CreateOpClassStmt
+{
+	NodeTag		type;
+	List	   *opclassname;	/* qualified name (list of Value strings) */
+	List	   *opfamilyname;	/* qualified name (ditto); NIL if omitted */
+	char	   *amname;			/* name of index AM opclass is for */
+	TypeName   *datatype;		/* datatype of indexed column */
+	List	   *items;			/* List of CreateOpClassItem nodes */
+	bool		isDefault;		/* Should be marked as default for type? */
+} CreateOpClassStmt;
+
+#define OPCLASS_ITEM_OPERATOR		1
+#define OPCLASS_ITEM_FUNCTION		2
+#define OPCLASS_ITEM_STORAGETYPE	3
+
+typedef struct CreateOpClassItem
+{
+	NodeTag		type;
+	int			itemtype;		/* see codes above */
+	/* fields used for an operator or function item: */
+	List	   *name;			/* operator or function name */
+	List	   *args;			/* argument types */
+	int			number;			/* strategy num or support proc num */
+	List	   *order_family;	/* only used for ordering operators */
+	List	   *class_args;		/* only used for functions */
+	/* fields used for a storagetype item: */
+	TypeName   *storedtype;		/* datatype stored in index */
+} CreateOpClassItem;
+
+/* ----------------------
+ *		Create Operator Family Statement
+ * ----------------------
+ */
+typedef struct CreateOpFamilyStmt
+{
+	NodeTag		type;
+	List	   *opfamilyname;	/* qualified name (list of Value strings) */
+	char	   *amname;			/* name of index AM opfamily is for */
+} CreateOpFamilyStmt;
+
+/* ----------------------
+ *		Alter Operator Family Statement
+ * ----------------------
+ */
+typedef struct AlterOpFamilyStmt
+{
+	NodeTag		type;
+	List	   *opfamilyname;	/* qualified name (list of Value strings) */
+	char	   *amname;			/* name of index AM opfamily is for */
+	bool		isDrop;			/* ADD or DROP the items? */
+	List	   *items;			/* List of CreateOpClassItem nodes */
+} AlterOpFamilyStmt;
+
+/* ----------------------
+ *		Drop Table|Sequence|View|Index|Type|Domain|Conversion|Schema Statement
+ * ----------------------
+ */
+
+typedef struct DropStmt
+{
+	NodeTag		type;
+	List	   *objects;		/* list of sublists of names (as Values) */
+	List	   *arguments;		/* list of sublists of arguments (as Values) */
+	ObjectType	removeType;		/* object type */
+	DropBehavior behavior;		/* RESTRICT or CASCADE behavior */
+	bool		missing_ok;		/* skip error if object is missing? */
+	bool		concurrent;		/* drop index concurrently? */
+} DropStmt;
+
+/* ----------------------
+ *				Truncate Table Statement
+ * ----------------------
+ */
+typedef struct TruncateStmt
+{
+	NodeTag		type;
+	List	   *relations;		/* relations (RangeVars) to be truncated */
+	bool		restart_seqs;	/* restart owned sequences? */
+	DropBehavior behavior;		/* RESTRICT or CASCADE behavior */
+} TruncateStmt;
+
+/* ----------------------
+ *				Comment On Statement
+ * ----------------------
+ */
+typedef struct CommentStmt
+{
+	NodeTag		type;
+	ObjectType	objtype;		/* Object's type */
+	List	   *objname;		/* Qualified name of the object */
+	List	   *objargs;		/* Arguments if needed (eg, for functions) */
+	char	   *comment;		/* Comment to insert, or NULL to remove */
+} CommentStmt;
+
+/* ----------------------
+ *				SECURITY LABEL Statement
+ * ----------------------
+ */
+typedef struct SecLabelStmt
+{
+	NodeTag		type;
+	ObjectType	objtype;		/* Object's type */
+	List	   *objname;		/* Qualified name of the object */
+	List	   *objargs;		/* Arguments if needed (eg, for functions) */
+	char	   *provider;		/* Label provider (or NULL) */
+	char	   *label;			/* New security label to be assigned */
+} SecLabelStmt;
+
+/* ----------------------
+ *		Declare Cursor Statement
+ *
+ * Note: the "query" field of DeclareCursorStmt is only used in the raw grammar
+ * output.  After parse analysis it's set to null, and the Query points to the
+ * DeclareCursorStmt, not vice versa.
+ * ----------------------
+ */
+#define CURSOR_OPT_BINARY		0x0001	/* BINARY */
+#define CURSOR_OPT_SCROLL		0x0002	/* SCROLL explicitly given */
+#define CURSOR_OPT_NO_SCROLL	0x0004	/* NO SCROLL explicitly given */
+#define CURSOR_OPT_INSENSITIVE	0x0008	/* INSENSITIVE */
+#define CURSOR_OPT_HOLD			0x0010	/* WITH HOLD */
+/* these planner-control flags do not correspond to any SQL grammar: */
+#define CURSOR_OPT_FAST_PLAN	0x0020	/* prefer fast-start plan */
+#define CURSOR_OPT_GENERIC_PLAN 0x0040	/* force use of generic plan */
+#define CURSOR_OPT_CUSTOM_PLAN	0x0080	/* force use of custom plan */
+
+typedef struct DeclareCursorStmt
+{
+	NodeTag		type;
+	char	   *portalname;		/* name of the portal (cursor) */
+	int			options;		/* bitmask of options (see above) */
+	Node	   *query;			/* the raw SELECT query */
+} DeclareCursorStmt;
+
+/* ----------------------
+ *		Close Portal Statement
+ * ----------------------
+ */
+typedef struct ClosePortalStmt
+{
+	NodeTag		type;
+	char	   *portalname;		/* name of the portal (cursor) */
+	/* NULL means CLOSE ALL */
+} ClosePortalStmt;
+
+/* ----------------------
+ *		Fetch Statement (also Move)
+ * ----------------------
+ */
+typedef enum FetchDirection
+{
+	/* for these, howMany is how many rows to fetch; FETCH_ALL means ALL */
+	FETCH_FORWARD,
+	FETCH_BACKWARD,
+	/* for these, howMany indicates a position; only one row is fetched */
+	FETCH_ABSOLUTE,
+	FETCH_RELATIVE
+} FetchDirection;
+
+#define FETCH_ALL	LONG_MAX
+
+typedef struct FetchStmt
+{
+	NodeTag		type;
+	FetchDirection direction;	/* see above */
+	long		howMany;		/* number of rows, or position argument */
+	char	   *portalname;		/* name of portal (cursor) */
+	bool		ismove;			/* TRUE if MOVE */
+} FetchStmt;
+
+/* ----------------------
+ *		Create Index Statement
+ *
+ * This represents creation of an index and/or an associated constraint.
+ * If isconstraint is true, we should create a pg_constraint entry along
+ * with the index.  But if indexOid isn't InvalidOid, we are not creating an
+ * index, just a UNIQUE/PKEY constraint using an existing index.  isconstraint
+ * must always be true in this case, and the fields describing the index
+ * properties are empty.
+ * ----------------------
+ */
+typedef struct IndexStmt
+{
+	NodeTag		type;
+	char	   *idxname;		/* name of new index, or NULL for default */
+	RangeVar   *relation;		/* relation to build index on */
+	char	   *accessMethod;	/* name of access method (eg. btree) */
+	char	   *tableSpace;		/* tablespace, or NULL for default */
+	List	   *indexParams;	/* columns to index: a list of IndexElem */
+	List	   *options;		/* WITH clause options: a list of DefElem */
+	Node	   *whereClause;	/* qualification (partial-index predicate) */
+	List	   *excludeOpNames; /* exclusion operator names, or NIL if none */
+	char	   *idxcomment;		/* comment to apply to index, or NULL */
+	Oid			indexOid;		/* OID of an existing index, if any */
+	Oid			oldNode;		/* relfilenode of existing storage, if any */
+	bool		unique;			/* is index unique? */
+	bool		primary;		/* is index a primary key? */
+	bool		isconstraint;	/* is it for a pkey/unique constraint? */
+	bool		deferrable;		/* is the constraint DEFERRABLE? */
+	bool		initdeferred;	/* is the constraint INITIALLY DEFERRED? */
+	bool		transformed;	/* true when transformIndexStmt is finished */
+	bool		concurrent;		/* should this be a concurrent index build? */
+	bool		if_not_exists;	/* just do nothing if index already exists? */
+} IndexStmt;
+
+/* ----------------------
+ *		Create Function Statement
+ * ----------------------
+ */
+typedef struct CreateFunctionStmt
+{
+	NodeTag		type;
+	bool		replace;		/* T => replace if already exists */
+	List	   *funcname;		/* qualified name of function to create */
+	List	   *parameters;		/* a list of FunctionParameter */
+	TypeName   *returnType;		/* the return type */
+	List	   *options;		/* a list of DefElem */
+	List	   *withClause;		/* a list of DefElem */
+} CreateFunctionStmt;
+
+typedef enum FunctionParameterMode
+{
+	/* the assigned enum values appear in pg_proc, don't change 'em! */
+	FUNC_PARAM_IN = 'i',		/* input only */
+	FUNC_PARAM_OUT = 'o',		/* output only */
+	FUNC_PARAM_INOUT = 'b',		/* both */
+	FUNC_PARAM_VARIADIC = 'v',	/* variadic (always input) */
+	FUNC_PARAM_TABLE = 't'		/* table function output column */
+} FunctionParameterMode;
+
+typedef struct FunctionParameter
+{
+	NodeTag		type;
+	char	   *name;			/* parameter name, or NULL if not given */
+	TypeName   *argType;		/* TypeName for parameter type */
+	FunctionParameterMode mode; /* IN/OUT/etc */
+	Node	   *defexpr;		/* raw default expr, or NULL if not given */
+} FunctionParameter;
+
+typedef struct AlterFunctionStmt
+{
+	NodeTag		type;
+	FuncWithArgs *func;			/* name and args of function */
+	List	   *actions;		/* list of DefElem */
+} AlterFunctionStmt;
+
+/* ----------------------
+ *		DO Statement
+ *
+ * DoStmt is the raw parser output, InlineCodeBlock is the execution-time API
+ * ----------------------
+ */
+typedef struct DoStmt
+{
+	NodeTag		type;
+	List	   *args;			/* List of DefElem nodes */
+} DoStmt;
+
+typedef struct InlineCodeBlock
+{
+	NodeTag		type;
+	char	   *source_text;	/* source text of anonymous code block */
+	Oid			langOid;		/* OID of selected language */
+	bool		langIsTrusted;	/* trusted property of the language */
+} InlineCodeBlock;
+
+/* ----------------------
+ *		Alter Object Rename Statement
+ * ----------------------
+ */
+typedef struct RenameStmt
+{
+	NodeTag		type;
+	ObjectType	renameType;		/* OBJECT_TABLE, OBJECT_COLUMN, etc */
+	ObjectType	relationType;	/* if column name, associated relation type */
+	RangeVar   *relation;		/* in case it's a table */
+	List	   *object;			/* in case it's some other object */
+	List	   *objarg;			/* argument types, if applicable */
+	char	   *subname;		/* name of contained object (column, rule,
+								 * trigger, etc) */
+	char	   *newname;		/* the new name */
+	DropBehavior behavior;		/* RESTRICT or CASCADE behavior */
+	bool		missing_ok;		/* skip error if missing? */
+} RenameStmt;
+
+/* ----------------------
+ *		ALTER object SET SCHEMA Statement
+ * ----------------------
+ */
+typedef struct AlterObjectSchemaStmt
+{
+	NodeTag		type;
+	ObjectType	objectType;		/* OBJECT_TABLE, OBJECT_TYPE, etc */
+	RangeVar   *relation;		/* in case it's a table */
+	List	   *object;			/* in case it's some other object */
+	List	   *objarg;			/* argument types, if applicable */
+	char	   *newschema;		/* the new schema */
+	bool		missing_ok;		/* skip error if missing? */
+} AlterObjectSchemaStmt;
+
+/* ----------------------
+ *		Alter Object Owner Statement
+ * ----------------------
+ */
+typedef struct AlterOwnerStmt
+{
+	NodeTag		type;
+	ObjectType	objectType;		/* OBJECT_TABLE, OBJECT_TYPE, etc */
+	RangeVar   *relation;		/* in case it's a table */
+	List	   *object;			/* in case it's some other object */
+	List	   *objarg;			/* argument types, if applicable */
+	Node	   *newowner;		/* the new owner */
+} AlterOwnerStmt;
+
+
+/* ----------------------
+ *		Create Rule Statement
+ * ----------------------
+ */
+typedef struct RuleStmt
+{
+	NodeTag		type;
+	RangeVar   *relation;		/* relation the rule is for */
+	char	   *rulename;		/* name of the rule */
+	Node	   *whereClause;	/* qualifications */
+	CmdType		event;			/* SELECT, INSERT, etc */
+	bool		instead;		/* is a 'do instead'? */
+	List	   *actions;		/* the action statements */
+	bool		replace;		/* OR REPLACE */
+} RuleStmt;
+
+/* ----------------------
+ *		Notify Statement
+ * ----------------------
+ */
+typedef struct NotifyStmt
+{
+	NodeTag		type;
+	char	   *conditionname;	/* condition name to notify */
+	char	   *payload;		/* the payload string, or NULL if none */
+} NotifyStmt;
+
+/* ----------------------
+ *		Listen Statement
+ * ----------------------
+ */
+typedef struct ListenStmt
+{
+	NodeTag		type;
+	char	   *conditionname;	/* condition name to listen on */
+} ListenStmt;
+
+/* ----------------------
+ *		Unlisten Statement
+ * ----------------------
+ */
+typedef struct UnlistenStmt
+{
+	NodeTag		type;
+	char	   *conditionname;	/* name to unlisten on, or NULL for all */
+} UnlistenStmt;
+
+/* ----------------------
+ *		{Begin|Commit|Rollback} Transaction Statement
+ * ----------------------
+ */
+typedef enum TransactionStmtKind
+{
+	TRANS_STMT_BEGIN,
+	TRANS_STMT_START,			/* semantically identical to BEGIN */
+	TRANS_STMT_COMMIT,
+	TRANS_STMT_ROLLBACK,
+	TRANS_STMT_SAVEPOINT,
+	TRANS_STMT_RELEASE,
+	TRANS_STMT_ROLLBACK_TO,
+	TRANS_STMT_PREPARE,
+	TRANS_STMT_COMMIT_PREPARED,
+	TRANS_STMT_ROLLBACK_PREPARED
+} TransactionStmtKind;
+
+typedef struct TransactionStmt
+{
+	NodeTag		type;
+	TransactionStmtKind kind;	/* see above */
+	List	   *options;		/* for BEGIN/START and savepoint commands */
+	char	   *gid;			/* for two-phase-commit related commands */
+} TransactionStmt;
+
+/* ----------------------
+ *		Create Type Statement, composite types
+ * ----------------------
+ */
+typedef struct CompositeTypeStmt
+{
+	NodeTag		type;
+	RangeVar   *typevar;		/* the composite type to be created */
+	List	   *coldeflist;		/* list of ColumnDef nodes */
+} CompositeTypeStmt;
+
+/* ----------------------
+ *		Create Type Statement, enum types
+ * ----------------------
+ */
+typedef struct CreateEnumStmt
+{
+	NodeTag		type;
+	List	   *typeName;		/* qualified name (list of Value strings) */
+	List	   *vals;			/* enum values (list of Value strings) */
+} CreateEnumStmt;
+
+/* ----------------------
+ *		Create Type Statement, range types
+ * ----------------------
+ */
+typedef struct CreateRangeStmt
+{
+	NodeTag		type;
+	List	   *typeName;		/* qualified name (list of Value strings) */
+	List	   *params;			/* range parameters (list of DefElem) */
+} CreateRangeStmt;
+
+/* ----------------------
+ *		Alter Type Statement, enum types
+ * ----------------------
+ */
+typedef struct AlterEnumStmt
+{
+	NodeTag		type;
+	List	   *typeName;		/* qualified name (list of Value strings) */
+	char	   *newVal;			/* new enum value's name */
+	char	   *newValNeighbor; /* neighboring enum value, if specified */
+	bool		newValIsAfter;	/* place new enum value after neighbor? */
+	bool		skipIfExists;	/* no error if label already exists */
+} AlterEnumStmt;
+
+/* ----------------------
+ *		Create View Statement
+ * ----------------------
+ */
+typedef enum ViewCheckOption
+{
+	NO_CHECK_OPTION,
+	LOCAL_CHECK_OPTION,
+	CASCADED_CHECK_OPTION
+} ViewCheckOption;
+
+typedef struct ViewStmt
+{
+	NodeTag		type;
+	RangeVar   *view;			/* the view to be created */
+	List	   *aliases;		/* target column names */
+	Node	   *query;			/* the SELECT query */
+	bool		replace;		/* replace an existing view? */
+	List	   *options;		/* options from WITH clause */
+	ViewCheckOption withCheckOption;	/* WITH CHECK OPTION */
+} ViewStmt;
+
+/* ----------------------
+ *		Load Statement
+ * ----------------------
+ */
+typedef struct LoadStmt
+{
+	NodeTag		type;
+	char	   *filename;		/* file to load */
+} LoadStmt;
+
+/* ----------------------
+ *		Createdb Statement
+ * ----------------------
+ */
+typedef struct CreatedbStmt
+{
+	NodeTag		type;
+	char	   *dbname;			/* name of database to create */
+	List	   *options;		/* List of DefElem nodes */
+} CreatedbStmt;
+
+/* ----------------------
+ *	Alter Database
+ * ----------------------
+ */
+typedef struct AlterDatabaseStmt
+{
+	NodeTag		type;
+	char	   *dbname;			/* name of database to alter */
+	List	   *options;		/* List of DefElem nodes */
+} AlterDatabaseStmt;
+
+typedef struct AlterDatabaseSetStmt
+{
+	NodeTag		type;
+	char	   *dbname;			/* database name */
+	VariableSetStmt *setstmt;	/* SET or RESET subcommand */
+} AlterDatabaseSetStmt;
+
+/* ----------------------
+ *		Dropdb Statement
+ * ----------------------
+ */
+typedef struct DropdbStmt
+{
+	NodeTag		type;
+	char	   *dbname;			/* database to drop */
+	bool		missing_ok;		/* skip error if db is missing? */
+} DropdbStmt;
+
+/* ----------------------
+ *		Alter System Statement
+ * ----------------------
+ */
+typedef struct AlterSystemStmt
+{
+	NodeTag		type;
+	VariableSetStmt *setstmt;	/* SET subcommand */
+} AlterSystemStmt;
+
+/* ----------------------
+ *		Cluster Statement (support pbrown's cluster index implementation)
+ * ----------------------
+ */
+typedef struct ClusterStmt
+{
+	NodeTag		type;
+	RangeVar   *relation;		/* relation being indexed, or NULL if all */
+	char	   *indexname;		/* original index defined */
+	bool		verbose;		/* print progress info */
+} ClusterStmt;
+
+/* ----------------------
+ *		Vacuum and Analyze Statements
+ *
+ * Even though these are nominally two statements, it's convenient to use
+ * just one node type for both.  Note that at least one of VACOPT_VACUUM
+ * and VACOPT_ANALYZE must be set in options.
+ * ----------------------
+ */
+typedef enum VacuumOption
+{
+	VACOPT_VACUUM = 1 << 0,		/* do VACUUM */
+	VACOPT_ANALYZE = 1 << 1,	/* do ANALYZE */
+	VACOPT_VERBOSE = 1 << 2,	/* print progress info */
+	VACOPT_FREEZE = 1 << 3,		/* FREEZE option */
+	VACOPT_FULL = 1 << 4,		/* FULL (non-concurrent) vacuum */
+	VACOPT_NOWAIT = 1 << 5,		/* don't wait to get lock (autovacuum only) */
+	VACOPT_SKIPTOAST = 1 << 6	/* don't process the TOAST table, if any */
+} VacuumOption;
+
+typedef struct VacuumStmt
+{
+	NodeTag		type;
+	int			options;		/* OR of VacuumOption flags */
+	RangeVar   *relation;		/* single table to process, or NULL */
+	List	   *va_cols;		/* list of column names, or NIL for all */
+} VacuumStmt;
+
+/* ----------------------
+ *		Explain Statement
+ *
+ * The "query" field is either a raw parse tree (SelectStmt, InsertStmt, etc)
+ * or a Query node if parse analysis has been done.  Note that rewriting and
+ * planning of the query are always postponed until execution of EXPLAIN.
+ * ----------------------
+ */
+typedef struct ExplainStmt
+{
+	NodeTag		type;
+	Node	   *query;			/* the query (see comments above) */
+	List	   *options;		/* list of DefElem nodes */
+} ExplainStmt;
+
+/* ----------------------
+ *		CREATE TABLE AS Statement (a/k/a SELECT INTO)
+ *
+ * A query written as CREATE TABLE AS will produce this node type natively.
+ * A query written as SELECT ... INTO will be transformed to this form during
+ * parse analysis.
+ * A query written as CREATE MATERIALIZED view will produce this node type,
+ * during parse analysis, since it needs all the same data.
+ *
+ * The "query" field is handled similarly to EXPLAIN, though note that it
+ * can be a SELECT or an EXECUTE, but not other DML statements.
+ * ----------------------
+ */
+typedef struct CreateTableAsStmt
+{
+	NodeTag		type;
+	Node	   *query;			/* the query (see comments above) */
+	IntoClause *into;			/* destination table */
+	ObjectType	relkind;		/* OBJECT_TABLE or OBJECT_MATVIEW */
+	bool		is_select_into; /* it was written as SELECT INTO */
+	bool		if_not_exists;	/* just do nothing if it already exists? */
+} CreateTableAsStmt;
+
+/* ----------------------
+ *		REFRESH MATERIALIZED VIEW Statement
+ * ----------------------
+ */
+typedef struct RefreshMatViewStmt
+{
+	NodeTag		type;
+	bool		concurrent;		/* allow concurrent access? */
+	bool		skipData;		/* true for WITH NO DATA */
+	RangeVar   *relation;		/* relation to insert into */
+} RefreshMatViewStmt;
+
+/* ----------------------
+ * Checkpoint Statement
+ * ----------------------
+ */
+typedef struct CheckPointStmt
+{
+	NodeTag		type;
+} CheckPointStmt;
+
+/* ----------------------
+ * Discard Statement
+ * ----------------------
+ */
+
+typedef enum DiscardMode
+{
+	DISCARD_ALL,
+	DISCARD_PLANS,
+	DISCARD_SEQUENCES,
+	DISCARD_TEMP
+} DiscardMode;
+
+typedef struct DiscardStmt
+{
+	NodeTag		type;
+	DiscardMode target;
+} DiscardStmt;
+
+/* ----------------------
+ *		LOCK Statement
+ * ----------------------
+ */
+typedef struct LockStmt
+{
+	NodeTag		type;
+	List	   *relations;		/* relations to lock */
+	int			mode;			/* lock mode */
+	bool		nowait;			/* no wait mode */
+} LockStmt;
+
+/* ----------------------
+ *		SET CONSTRAINTS Statement
+ * ----------------------
+ */
+typedef struct ConstraintsSetStmt
+{
+	NodeTag		type;
+	List	   *constraints;	/* List of names as RangeVars */
+	bool		deferred;
+} ConstraintsSetStmt;
+
+/* ----------------------
+ *		REINDEX Statement
+ * ----------------------
+ */
+
+/* Reindex options */
+#define REINDEXOPT_VERBOSE 1 << 0		/* print progress info */
+
+typedef enum ReindexObjectType
+{
+	REINDEX_OBJECT_INDEX,		/* index */
+	REINDEX_OBJECT_TABLE,		/* table or materialized view */
+	REINDEX_OBJECT_SCHEMA,		/* schema */
+	REINDEX_OBJECT_SYSTEM,		/* system catalogs */
+	REINDEX_OBJECT_DATABASE		/* database */
+} ReindexObjectType;
+
+typedef struct ReindexStmt
+{
+	NodeTag		type;
+	ReindexObjectType kind;		/* REINDEX_OBJECT_INDEX, REINDEX_OBJECT_TABLE,
+								 * etc. */
+	RangeVar   *relation;		/* Table or index to reindex */
+	const char *name;			/* name of database to reindex */
+	int			options;		/* Reindex options flags */
+} ReindexStmt;
+
+/* ----------------------
+ *		CREATE CONVERSION Statement
+ * ----------------------
+ */
+typedef struct CreateConversionStmt
+{
+	NodeTag		type;
+	List	   *conversion_name;	/* Name of the conversion */
+	char	   *for_encoding_name;		/* source encoding name */
+	char	   *to_encoding_name;		/* destination encoding name */
+	List	   *func_name;		/* qualified conversion function name */
+	bool		def;			/* is this a default conversion? */
+} CreateConversionStmt;
+
+/* ----------------------
+ *	CREATE CAST Statement
+ * ----------------------
+ */
+typedef struct CreateCastStmt
+{
+	NodeTag		type;
+	TypeName   *sourcetype;
+	TypeName   *targettype;
+	FuncWithArgs *func;
+	CoercionContext context;
+	bool		inout;
+} CreateCastStmt;
+
+/* ----------------------
+ *	CREATE TRANSFORM Statement
+ * ----------------------
+ */
+typedef struct CreateTransformStmt
+{
+	NodeTag		type;
+	bool		replace;
+	TypeName   *type_name;
+	char	   *lang;
+	FuncWithArgs *fromsql;
+	FuncWithArgs *tosql;
+} CreateTransformStmt;
+
+/* ----------------------
+ *		PREPARE Statement
+ * ----------------------
+ */
+typedef struct PrepareStmt
+{
+	NodeTag		type;
+	char	   *name;			/* Name of plan, arbitrary */
+	List	   *argtypes;		/* Types of parameters (List of TypeName) */
+	Node	   *query;			/* The query itself (as a raw parsetree) */
+} PrepareStmt;
+
+
+/* ----------------------
+ *		EXECUTE Statement
+ * ----------------------
+ */
+
+typedef struct ExecuteStmt
+{
+	NodeTag		type;
+	char	   *name;			/* The name of the plan to execute */
+	List	   *params;			/* Values to assign to parameters */
+} ExecuteStmt;
+
+
+/* ----------------------
+ *		DEALLOCATE Statement
+ * ----------------------
+ */
+typedef struct DeallocateStmt
+{
+	NodeTag		type;
+	char	   *name;			/* The name of the plan to remove */
+	/* NULL means DEALLOCATE ALL */
+} DeallocateStmt;
+
+/*
+ *		DROP OWNED statement
+ */
+typedef struct DropOwnedStmt
+{
+	NodeTag		type;
+	List	   *roles;
+	DropBehavior behavior;
+} DropOwnedStmt;
+
+/*
+ *		REASSIGN OWNED statement
+ */
+typedef struct ReassignOwnedStmt
+{
+	NodeTag		type;
+	List	   *roles;
+	Node	   *newrole;
+} ReassignOwnedStmt;
+
+/*
+ * TS Dictionary stmts: DefineStmt, RenameStmt and DropStmt are default
+ */
+typedef struct AlterTSDictionaryStmt
+{
+	NodeTag		type;
+	List	   *dictname;		/* qualified name (list of Value strings) */
+	List	   *options;		/* List of DefElem nodes */
+} AlterTSDictionaryStmt;
+
+/*
+ * TS Configuration stmts: DefineStmt, RenameStmt and DropStmt are default
+ */
+typedef enum AlterTSConfigType
+{
+	ALTER_TSCONFIG_ADD_MAPPING,
+	ALTER_TSCONFIG_ALTER_MAPPING_FOR_TOKEN,
+	ALTER_TSCONFIG_REPLACE_DICT,
+	ALTER_TSCONFIG_REPLACE_DICT_FOR_TOKEN,
+	ALTER_TSCONFIG_DROP_MAPPING
+} AlterTSConfigType;
+
+typedef struct AlterTSConfigurationStmt
+{
+	NodeTag		type;
+	AlterTSConfigType kind;		/* ALTER_TSCONFIG_ADD_MAPPING, etc */
+	List	   *cfgname;		/* qualified name (list of Value strings) */
+
+	/*
+	 * dicts will be non-NIL if ADD/ALTER MAPPING was specified. If dicts is
+	 * NIL, but tokentype isn't, DROP MAPPING was specified.
+	 */
+	List	   *tokentype;		/* list of Value strings */
+	List	   *dicts;			/* list of list of Value strings */
+	bool		override;		/* if true - remove old variant */
+	bool		replace;		/* if true - replace dictionary by another */
+	bool		missing_ok;		/* for DROP - skip error if missing? */
+} AlterTSConfigurationStmt;
+
+#endif   /* PARSENODES_H */
diff --git a/foreign/libpg_query/src/postgres/include/nodes/pg_list.h b/foreign/libpg_query/src/postgres/include/nodes/pg_list.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/nodes/pg_list.h
@@ -0,0 +1,326 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_list.h
+ *	  interface for PostgreSQL generic linked list package
+ *
+ * This package implements singly-linked homogeneous lists.
+ *
+ * It is important to have constant-time length, append, and prepend
+ * operations. To achieve this, we deal with two distinct data
+ * structures:
+ *
+ *		1. A set of "list cells": each cell contains a data field and
+ *		   a link to the next cell in the list or NULL.
+ *		2. A single structure containing metadata about the list: the
+ *		   type of the list, pointers to the head and tail cells, and
+ *		   the length of the list.
+ *
+ * We support three types of lists:
+ *
+ *	T_List: lists of pointers
+ *		(in practice usually pointers to Nodes, but not always;
+ *		declared as "void *" to minimize casting annoyances)
+ *	T_IntList: lists of integers
+ *	T_OidList: lists of Oids
+ *
+ * (At the moment, ints and Oids are the same size, but they may not
+ * always be so; try to be careful to maintain the distinction.)
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/nodes/pg_list.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_LIST_H
+#define PG_LIST_H
+
+#include "nodes/nodes.h"
+
+
+typedef struct ListCell ListCell;
+
+typedef struct List
+{
+	NodeTag		type;			/* T_List, T_IntList, or T_OidList */
+	int			length;
+	ListCell   *head;
+	ListCell   *tail;
+} List;
+
+struct ListCell
+{
+	union
+	{
+		void	   *ptr_value;
+		int			int_value;
+		Oid			oid_value;
+	}			data;
+	ListCell   *next;
+};
+
+/*
+ * The *only* valid representation of an empty list is NIL; in other
+ * words, a non-NIL list is guaranteed to have length >= 1 and
+ * head/tail != NULL
+ */
+#define NIL						((List *) NULL)
+
+/*
+ * These routines are used frequently. However, we can't implement
+ * them as macros, since we want to avoid double-evaluation of macro
+ * arguments. Therefore, we implement them using static inline functions
+ * if supported by the compiler, or as regular functions otherwise.
+ * See STATIC_IF_INLINE in c.h.
+ */
+#ifndef PG_USE_INLINE
+extern ListCell *list_head(const List *l);
+extern ListCell *list_tail(List *l);
+extern int	list_length(const List *l);
+#endif   /* PG_USE_INLINE */
+#if defined(PG_USE_INLINE) || defined(PG_LIST_INCLUDE_DEFINITIONS)
+STATIC_IF_INLINE ListCell *
+list_head(const List *l)
+{
+	return l ? l->head : NULL;
+}
+
+STATIC_IF_INLINE ListCell *
+list_tail(List *l)
+{
+	return l ? l->tail : NULL;
+}
+
+STATIC_IF_INLINE int
+list_length(const List *l)
+{
+	return l ? l->length : 0;
+}
+#endif   /*-- PG_USE_INLINE || PG_LIST_INCLUDE_DEFINITIONS */
+
+/*
+ * NB: There is an unfortunate legacy from a previous incarnation of
+ * the List API: the macro lfirst() was used to mean "the data in this
+ * cons cell". To avoid changing every usage of lfirst(), that meaning
+ * has been kept. As a result, lfirst() takes a ListCell and returns
+ * the data it contains; to get the data in the first cell of a
+ * List, use linitial(). Worse, lsecond() is more closely related to
+ * linitial() than lfirst(): given a List, lsecond() returns the data
+ * in the second cons cell.
+ */
+
+#define lnext(lc)				((lc)->next)
+#define lfirst(lc)				((lc)->data.ptr_value)
+#define lfirst_int(lc)			((lc)->data.int_value)
+#define lfirst_oid(lc)			((lc)->data.oid_value)
+
+#define linitial(l)				lfirst(list_head(l))
+#define linitial_int(l)			lfirst_int(list_head(l))
+#define linitial_oid(l)			lfirst_oid(list_head(l))
+
+#define lsecond(l)				lfirst(lnext(list_head(l)))
+#define lsecond_int(l)			lfirst_int(lnext(list_head(l)))
+#define lsecond_oid(l)			lfirst_oid(lnext(list_head(l)))
+
+#define lthird(l)				lfirst(lnext(lnext(list_head(l))))
+#define lthird_int(l)			lfirst_int(lnext(lnext(list_head(l))))
+#define lthird_oid(l)			lfirst_oid(lnext(lnext(list_head(l))))
+
+#define lfourth(l)				lfirst(lnext(lnext(lnext(list_head(l)))))
+#define lfourth_int(l)			lfirst_int(lnext(lnext(lnext(list_head(l)))))
+#define lfourth_oid(l)			lfirst_oid(lnext(lnext(lnext(list_head(l)))))
+
+#define llast(l)				lfirst(list_tail(l))
+#define llast_int(l)			lfirst_int(list_tail(l))
+#define llast_oid(l)			lfirst_oid(list_tail(l))
+
+/*
+ * Convenience macros for building fixed-length lists
+ */
+#define list_make1(x1)				lcons(x1, NIL)
+#define list_make2(x1,x2)			lcons(x1, list_make1(x2))
+#define list_make3(x1,x2,x3)		lcons(x1, list_make2(x2, x3))
+#define list_make4(x1,x2,x3,x4)		lcons(x1, list_make3(x2, x3, x4))
+
+#define list_make1_int(x1)			lcons_int(x1, NIL)
+#define list_make2_int(x1,x2)		lcons_int(x1, list_make1_int(x2))
+#define list_make3_int(x1,x2,x3)	lcons_int(x1, list_make2_int(x2, x3))
+#define list_make4_int(x1,x2,x3,x4) lcons_int(x1, list_make3_int(x2, x3, x4))
+
+#define list_make1_oid(x1)			lcons_oid(x1, NIL)
+#define list_make2_oid(x1,x2)		lcons_oid(x1, list_make1_oid(x2))
+#define list_make3_oid(x1,x2,x3)	lcons_oid(x1, list_make2_oid(x2, x3))
+#define list_make4_oid(x1,x2,x3,x4) lcons_oid(x1, list_make3_oid(x2, x3, x4))
+
+/*
+ * foreach -
+ *	  a convenience macro which loops through the list
+ */
+#define foreach(cell, l)	\
+	for ((cell) = list_head(l); (cell) != NULL; (cell) = lnext(cell))
+
+/*
+ * for_each_cell -
+ *	  a convenience macro which loops through a list starting from a
+ *	  specified cell
+ */
+#define for_each_cell(cell, initcell)	\
+	for ((cell) = (initcell); (cell) != NULL; (cell) = lnext(cell))
+
+/*
+ * forboth -
+ *	  a convenience macro for advancing through two linked lists
+ *	  simultaneously. This macro loops through both lists at the same
+ *	  time, stopping when either list runs out of elements. Depending
+ *	  on the requirements of the call site, it may also be wise to
+ *	  assert that the lengths of the two lists are equal.
+ */
+#define forboth(cell1, list1, cell2, list2)							\
+	for ((cell1) = list_head(list1), (cell2) = list_head(list2);	\
+		 (cell1) != NULL && (cell2) != NULL;						\
+		 (cell1) = lnext(cell1), (cell2) = lnext(cell2))
+
+/*
+ * forthree -
+ *	  the same for three lists
+ */
+#define forthree(cell1, list1, cell2, list2, cell3, list3)			\
+	for ((cell1) = list_head(list1), (cell2) = list_head(list2), (cell3) = list_head(list3); \
+		 (cell1) != NULL && (cell2) != NULL && (cell3) != NULL;		\
+		 (cell1) = lnext(cell1), (cell2) = lnext(cell2), (cell3) = lnext(cell3))
+
+extern List *lappend(List *list, void *datum);
+extern List *lappend_int(List *list, int datum);
+extern List *lappend_oid(List *list, Oid datum);
+
+extern ListCell *lappend_cell(List *list, ListCell *prev, void *datum);
+extern ListCell *lappend_cell_int(List *list, ListCell *prev, int datum);
+extern ListCell *lappend_cell_oid(List *list, ListCell *prev, Oid datum);
+
+extern List *lcons(void *datum, List *list);
+extern List *lcons_int(int datum, List *list);
+extern List *lcons_oid(Oid datum, List *list);
+
+extern List *list_concat(List *list1, List *list2);
+extern List *list_truncate(List *list, int new_size);
+
+extern ListCell *list_nth_cell(const List *list, int n);
+extern void *list_nth(const List *list, int n);
+extern int	list_nth_int(const List *list, int n);
+extern Oid	list_nth_oid(const List *list, int n);
+
+extern bool list_member(const List *list, const void *datum);
+extern bool list_member_ptr(const List *list, const void *datum);
+extern bool list_member_int(const List *list, int datum);
+extern bool list_member_oid(const List *list, Oid datum);
+
+extern List *list_delete(List *list, void *datum);
+extern List *list_delete_ptr(List *list, void *datum);
+extern List *list_delete_int(List *list, int datum);
+extern List *list_delete_oid(List *list, Oid datum);
+extern List *list_delete_first(List *list);
+extern List *list_delete_cell(List *list, ListCell *cell, ListCell *prev);
+
+extern List *list_union(const List *list1, const List *list2);
+extern List *list_union_ptr(const List *list1, const List *list2);
+extern List *list_union_int(const List *list1, const List *list2);
+extern List *list_union_oid(const List *list1, const List *list2);
+
+extern List *list_intersection(const List *list1, const List *list2);
+extern List *list_intersection_int(const List *list1, const List *list2);
+
+/* currently, there's no need for list_intersection_ptr etc */
+
+extern List *list_difference(const List *list1, const List *list2);
+extern List *list_difference_ptr(const List *list1, const List *list2);
+extern List *list_difference_int(const List *list1, const List *list2);
+extern List *list_difference_oid(const List *list1, const List *list2);
+
+extern List *list_append_unique(List *list, void *datum);
+extern List *list_append_unique_ptr(List *list, void *datum);
+extern List *list_append_unique_int(List *list, int datum);
+extern List *list_append_unique_oid(List *list, Oid datum);
+
+extern List *list_concat_unique(List *list1, List *list2);
+extern List *list_concat_unique_ptr(List *list1, List *list2);
+extern List *list_concat_unique_int(List *list1, List *list2);
+extern List *list_concat_unique_oid(List *list1, List *list2);
+
+extern void list_free(List *list);
+extern void list_free_deep(List *list);
+
+extern List *list_copy(const List *list);
+extern List *list_copy_tail(const List *list, int nskip);
+
+/*
+ * To ease migration to the new list API, a set of compatibility
+ * macros are provided that reduce the impact of the list API changes
+ * as far as possible. Until client code has been rewritten to use the
+ * new list API, the ENABLE_LIST_COMPAT symbol can be defined before
+ * including pg_list.h
+ */
+#ifdef ENABLE_LIST_COMPAT
+
+#define lfirsti(lc)					lfirst_int(lc)
+#define lfirsto(lc)					lfirst_oid(lc)
+
+#define makeList1(x1)				list_make1(x1)
+#define makeList2(x1, x2)			list_make2(x1, x2)
+#define makeList3(x1, x2, x3)		list_make3(x1, x2, x3)
+#define makeList4(x1, x2, x3, x4)	list_make4(x1, x2, x3, x4)
+
+#define makeListi1(x1)				list_make1_int(x1)
+#define makeListi2(x1, x2)			list_make2_int(x1, x2)
+
+#define makeListo1(x1)				list_make1_oid(x1)
+#define makeListo2(x1, x2)			list_make2_oid(x1, x2)
+
+#define lconsi(datum, list)			lcons_int(datum, list)
+#define lconso(datum, list)			lcons_oid(datum, list)
+
+#define lappendi(list, datum)		lappend_int(list, datum)
+#define lappendo(list, datum)		lappend_oid(list, datum)
+
+#define nconc(l1, l2)				list_concat(l1, l2)
+
+#define nth(n, list)				list_nth(list, n)
+
+#define member(datum, list)			list_member(list, datum)
+#define ptrMember(datum, list)		list_member_ptr(list, datum)
+#define intMember(datum, list)		list_member_int(list, datum)
+#define oidMember(datum, list)		list_member_oid(list, datum)
+
+/*
+ * Note that the old lremove() determined equality via pointer
+ * comparison, whereas the new list_delete() uses equal(); in order to
+ * keep the same behavior, we therefore need to map lremove() calls to
+ * list_delete_ptr() rather than list_delete()
+ */
+#define lremove(elem, list)			list_delete_ptr(list, elem)
+#define LispRemove(elem, list)		list_delete(list, elem)
+#define lremovei(elem, list)		list_delete_int(list, elem)
+#define lremoveo(elem, list)		list_delete_oid(list, elem)
+
+#define ltruncate(n, list)			list_truncate(list, n)
+
+#define set_union(l1, l2)			list_union(l1, l2)
+#define set_uniono(l1, l2)			list_union_oid(l1, l2)
+#define set_ptrUnion(l1, l2)		list_union_ptr(l1, l2)
+
+#define set_difference(l1, l2)		list_difference(l1, l2)
+#define set_differenceo(l1, l2)		list_difference_oid(l1, l2)
+#define set_ptrDifference(l1, l2)	list_difference_ptr(l1, l2)
+
+#define equali(l1, l2)				equal(l1, l2)
+#define equalo(l1, l2)				equal(l1, l2)
+
+#define freeList(list)				list_free(list)
+
+#define listCopy(list)				list_copy(list)
+
+extern int	length(List *list);
+#endif   /* ENABLE_LIST_COMPAT */
+
+#endif   /* PG_LIST_H */
diff --git a/foreign/libpg_query/src/postgres/include/nodes/plannodes.h b/foreign/libpg_query/src/postgres/include/nodes/plannodes.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/nodes/plannodes.h
@@ -0,0 +1,952 @@
+/*-------------------------------------------------------------------------
+ *
+ * plannodes.h
+ *	  definitions for query plan nodes
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/nodes/plannodes.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PLANNODES_H
+#define PLANNODES_H
+
+#include "access/sdir.h"
+#include "lib/stringinfo.h"
+#include "nodes/bitmapset.h"
+#include "nodes/lockoptions.h"
+#include "nodes/primnodes.h"
+
+
+/* ----------------------------------------------------------------
+ *						node definitions
+ * ----------------------------------------------------------------
+ */
+
+/* ----------------
+ *		PlannedStmt node
+ *
+ * The output of the planner is a Plan tree headed by a PlannedStmt node.
+ * PlannedStmt holds the "one time" information needed by the executor.
+ * ----------------
+ */
+typedef struct PlannedStmt
+{
+	NodeTag		type;
+
+	CmdType		commandType;	/* select|insert|update|delete */
+
+	uint32		queryId;		/* query identifier (copied from Query) */
+
+	bool		hasReturning;	/* is it insert|update|delete RETURNING? */
+
+	bool		hasModifyingCTE;	/* has insert|update|delete in WITH? */
+
+	bool		canSetTag;		/* do I set the command result tag? */
+
+	bool		transientPlan;	/* redo plan when TransactionXmin changes? */
+
+	struct Plan *planTree;		/* tree of Plan nodes */
+
+	List	   *rtable;			/* list of RangeTblEntry nodes */
+
+	/* rtable indexes of target relations for INSERT/UPDATE/DELETE */
+	List	   *resultRelations;	/* integer list of RT indexes, or NIL */
+
+	Node	   *utilityStmt;	/* non-null if this is DECLARE CURSOR */
+
+	List	   *subplans;		/* Plan trees for SubPlan expressions */
+
+	Bitmapset  *rewindPlanIDs;	/* indices of subplans that require REWIND */
+
+	List	   *rowMarks;		/* a list of PlanRowMark's */
+
+	List	   *relationOids;	/* OIDs of relations the plan depends on */
+
+	List	   *invalItems;		/* other dependencies, as PlanInvalItems */
+
+	int			nParamExec;		/* number of PARAM_EXEC Params used */
+
+	bool		hasRowSecurity; /* row security applied? */
+} PlannedStmt;
+
+/* macro for fetching the Plan associated with a SubPlan node */
+#define exec_subplan_get_plan(plannedstmt, subplan) \
+	((Plan *) list_nth((plannedstmt)->subplans, (subplan)->plan_id - 1))
+
+
+/* ----------------
+ *		Plan node
+ *
+ * All plan nodes "derive" from the Plan structure by having the
+ * Plan structure as the first field.  This ensures that everything works
+ * when nodes are cast to Plan's.  (node pointers are frequently cast to Plan*
+ * when passed around generically in the executor)
+ *
+ * We never actually instantiate any Plan nodes; this is just the common
+ * abstract superclass for all Plan-type nodes.
+ * ----------------
+ */
+typedef struct Plan
+{
+	NodeTag		type;
+
+	/*
+	 * estimated execution costs for plan (see costsize.c for more info)
+	 */
+	Cost		startup_cost;	/* cost expended before fetching any tuples */
+	Cost		total_cost;		/* total cost (assuming all tuples fetched) */
+
+	/*
+	 * planner's estimate of result size of this plan step
+	 */
+	double		plan_rows;		/* number of rows plan is expected to emit */
+	int			plan_width;		/* average row width in bytes */
+
+	/*
+	 * Common structural data for all Plan types.
+	 */
+	List	   *targetlist;		/* target list to be computed at this node */
+	List	   *qual;			/* implicitly-ANDed qual conditions */
+	struct Plan *lefttree;		/* input plan tree(s) */
+	struct Plan *righttree;
+	List	   *initPlan;		/* Init Plan nodes (un-correlated expr
+								 * subselects) */
+
+	/*
+	 * Information for management of parameter-change-driven rescanning
+	 *
+	 * extParam includes the paramIDs of all external PARAM_EXEC params
+	 * affecting this plan node or its children.  setParam params from the
+	 * node's initPlans are not included, but their extParams are.
+	 *
+	 * allParam includes all the extParam paramIDs, plus the IDs of local
+	 * params that affect the node (i.e., the setParams of its initplans).
+	 * These are _all_ the PARAM_EXEC params that affect this node.
+	 */
+	Bitmapset  *extParam;
+	Bitmapset  *allParam;
+} Plan;
+
+/* ----------------
+ *	these are defined to avoid confusion problems with "left"
+ *	and "right" and "inner" and "outer".  The convention is that
+ *	the "left" plan is the "outer" plan and the "right" plan is
+ *	the inner plan, but these make the code more readable.
+ * ----------------
+ */
+#define innerPlan(node)			(((Plan *)(node))->righttree)
+#define outerPlan(node)			(((Plan *)(node))->lefttree)
+
+
+/* ----------------
+ *	 Result node -
+ *		If no outer plan, evaluate a variable-free targetlist.
+ *		If outer plan, return tuples from outer plan (after a level of
+ *		projection as shown by targetlist).
+ *
+ * If resconstantqual isn't NULL, it represents a one-time qualification
+ * test (i.e., one that doesn't depend on any variables from the outer plan,
+ * so needs to be evaluated only once).
+ * ----------------
+ */
+typedef struct Result
+{
+	Plan		plan;
+	Node	   *resconstantqual;
+} Result;
+
+/* ----------------
+ *	 ModifyTable node -
+ *		Apply rows produced by subplan(s) to result table(s),
+ *		by inserting, updating, or deleting.
+ *
+ * Note that rowMarks and epqParam are presumed to be valid for all the
+ * subplan(s); they can't contain any info that varies across subplans.
+ * ----------------
+ */
+typedef struct ModifyTable
+{
+	Plan		plan;
+	CmdType		operation;		/* INSERT, UPDATE, or DELETE */
+	bool		canSetTag;		/* do we set the command tag/es_processed? */
+	Index		nominalRelation;	/* Parent RT index for use of EXPLAIN */
+	List	   *resultRelations;	/* integer list of RT indexes */
+	int			resultRelIndex; /* index of first resultRel in plan's list */
+	List	   *plans;			/* plan(s) producing source data */
+	List	   *withCheckOptionLists;	/* per-target-table WCO lists */
+	List	   *returningLists; /* per-target-table RETURNING tlists */
+	List	   *fdwPrivLists;	/* per-target-table FDW private data lists */
+	List	   *rowMarks;		/* PlanRowMarks (non-locking only) */
+	int			epqParam;		/* ID of Param for EvalPlanQual re-eval */
+	OnConflictAction onConflictAction;	/* ON CONFLICT action */
+	List	   *arbiterIndexes; /* List of ON CONFLICT arbiter index OIDs  */
+	List	   *onConflictSet;	/* SET for INSERT ON CONFLICT DO UPDATE */
+	Node	   *onConflictWhere;	/* WHERE for ON CONFLICT UPDATE */
+	Index		exclRelRTI;		/* RTI of the EXCLUDED pseudo relation */
+	List	   *exclRelTlist;	/* tlist of the EXCLUDED pseudo relation */
+} ModifyTable;
+
+/* ----------------
+ *	 Append node -
+ *		Generate the concatenation of the results of sub-plans.
+ * ----------------
+ */
+typedef struct Append
+{
+	Plan		plan;
+	List	   *appendplans;
+} Append;
+
+/* ----------------
+ *	 MergeAppend node -
+ *		Merge the results of pre-sorted sub-plans to preserve the ordering.
+ * ----------------
+ */
+typedef struct MergeAppend
+{
+	Plan		plan;
+	List	   *mergeplans;
+	/* remaining fields are just like the sort-key info in struct Sort */
+	int			numCols;		/* number of sort-key columns */
+	AttrNumber *sortColIdx;		/* their indexes in the target list */
+	Oid		   *sortOperators;	/* OIDs of operators to sort them by */
+	Oid		   *collations;		/* OIDs of collations */
+	bool	   *nullsFirst;		/* NULLS FIRST/LAST directions */
+} MergeAppend;
+
+/* ----------------
+ *	RecursiveUnion node -
+ *		Generate a recursive union of two subplans.
+ *
+ * The "outer" subplan is always the non-recursive term, and the "inner"
+ * subplan is the recursive term.
+ * ----------------
+ */
+typedef struct RecursiveUnion
+{
+	Plan		plan;
+	int			wtParam;		/* ID of Param representing work table */
+	/* Remaining fields are zero/null in UNION ALL case */
+	int			numCols;		/* number of columns to check for
+								 * duplicate-ness */
+	AttrNumber *dupColIdx;		/* their indexes in the target list */
+	Oid		   *dupOperators;	/* equality operators to compare with */
+	long		numGroups;		/* estimated number of groups in input */
+} RecursiveUnion;
+
+/* ----------------
+ *	 BitmapAnd node -
+ *		Generate the intersection of the results of sub-plans.
+ *
+ * The subplans must be of types that yield tuple bitmaps.  The targetlist
+ * and qual fields of the plan are unused and are always NIL.
+ * ----------------
+ */
+typedef struct BitmapAnd
+{
+	Plan		plan;
+	List	   *bitmapplans;
+} BitmapAnd;
+
+/* ----------------
+ *	 BitmapOr node -
+ *		Generate the union of the results of sub-plans.
+ *
+ * The subplans must be of types that yield tuple bitmaps.  The targetlist
+ * and qual fields of the plan are unused and are always NIL.
+ * ----------------
+ */
+typedef struct BitmapOr
+{
+	Plan		plan;
+	List	   *bitmapplans;
+} BitmapOr;
+
+/*
+ * ==========
+ * Scan nodes
+ * ==========
+ */
+typedef struct Scan
+{
+	Plan		plan;
+	Index		scanrelid;		/* relid is index into the range table */
+} Scan;
+
+/* ----------------
+ *		sequential scan node
+ * ----------------
+ */
+typedef Scan SeqScan;
+
+/* ----------------
+ *		table sample scan node
+ * ----------------
+ */
+typedef struct SampleScan
+{
+	Scan		scan;
+	/* use struct pointer to avoid including parsenodes.h here */
+	struct TableSampleClause *tablesample;
+} SampleScan;
+
+/* ----------------
+ *		index scan node
+ *
+ * indexqualorig is an implicitly-ANDed list of index qual expressions, each
+ * in the same form it appeared in the query WHERE condition.  Each should
+ * be of the form (indexkey OP comparisonval) or (comparisonval OP indexkey).
+ * The indexkey is a Var or expression referencing column(s) of the index's
+ * base table.  The comparisonval might be any expression, but it won't use
+ * any columns of the base table.  The expressions are ordered by index
+ * column position (but items referencing the same index column can appear
+ * in any order).  indexqualorig is used at runtime only if we have to recheck
+ * a lossy indexqual.
+ *
+ * indexqual has the same form, but the expressions have been commuted if
+ * necessary to put the indexkeys on the left, and the indexkeys are replaced
+ * by Var nodes identifying the index columns (their varno is INDEX_VAR and
+ * their varattno is the index column number).
+ *
+ * indexorderbyorig is similarly the original form of any ORDER BY expressions
+ * that are being implemented by the index, while indexorderby is modified to
+ * have index column Vars on the left-hand side.  Here, multiple expressions
+ * must appear in exactly the ORDER BY order, and this is not necessarily the
+ * index column order.  Only the expressions are provided, not the auxiliary
+ * sort-order information from the ORDER BY SortGroupClauses; it's assumed
+ * that the sort ordering is fully determinable from the top-level operators.
+ * indexorderbyorig is used at runtime to recheck the ordering, if the index
+ * cannot calculate an accurate ordering.  It is also needed for EXPLAIN.
+ *
+ * indexorderbyops is a list of the OIDs of the operators used to sort the
+ * ORDER BY expressions.  This is used together with indexorderbyorig to
+ * recheck ordering at run time.  (Note that indexorderby, indexorderbyorig,
+ * and indexorderbyops are used for amcanorderbyop cases, not amcanorder.)
+ *
+ * indexorderdir specifies the scan ordering, for indexscans on amcanorder
+ * indexes (for other indexes it should be "don't care").
+ * ----------------
+ */
+typedef struct IndexScan
+{
+	Scan		scan;
+	Oid			indexid;		/* OID of index to scan */
+	List	   *indexqual;		/* list of index quals (usually OpExprs) */
+	List	   *indexqualorig;	/* the same in original form */
+	List	   *indexorderby;	/* list of index ORDER BY exprs */
+	List	   *indexorderbyorig;		/* the same in original form */
+	List	   *indexorderbyops;	/* OIDs of sort ops for ORDER BY exprs */
+	ScanDirection indexorderdir;	/* forward or backward or don't care */
+} IndexScan;
+
+/* ----------------
+ *		index-only scan node
+ *
+ * IndexOnlyScan is very similar to IndexScan, but it specifies an
+ * index-only scan, in which the data comes from the index not the heap.
+ * Because of this, *all* Vars in the plan node's targetlist, qual, and
+ * index expressions reference index columns and have varno = INDEX_VAR.
+ * Hence we do not need separate indexqualorig and indexorderbyorig lists,
+ * since their contents would be equivalent to indexqual and indexorderby.
+ *
+ * To help EXPLAIN interpret the index Vars for display, we provide
+ * indextlist, which represents the contents of the index as a targetlist
+ * with one TLE per index column.  Vars appearing in this list reference
+ * the base table, and this is the only field in the plan node that may
+ * contain such Vars.
+ * ----------------
+ */
+typedef struct IndexOnlyScan
+{
+	Scan		scan;
+	Oid			indexid;		/* OID of index to scan */
+	List	   *indexqual;		/* list of index quals (usually OpExprs) */
+	List	   *indexorderby;	/* list of index ORDER BY exprs */
+	List	   *indextlist;		/* TargetEntry list describing index's cols */
+	ScanDirection indexorderdir;	/* forward or backward or don't care */
+} IndexOnlyScan;
+
+/* ----------------
+ *		bitmap index scan node
+ *
+ * BitmapIndexScan delivers a bitmap of potential tuple locations;
+ * it does not access the heap itself.  The bitmap is used by an
+ * ancestor BitmapHeapScan node, possibly after passing through
+ * intermediate BitmapAnd and/or BitmapOr nodes to combine it with
+ * the results of other BitmapIndexScans.
+ *
+ * The fields have the same meanings as for IndexScan, except we don't
+ * store a direction flag because direction is uninteresting.
+ *
+ * In a BitmapIndexScan plan node, the targetlist and qual fields are
+ * not used and are always NIL.  The indexqualorig field is unused at
+ * run time too, but is saved for the benefit of EXPLAIN.
+ * ----------------
+ */
+typedef struct BitmapIndexScan
+{
+	Scan		scan;
+	Oid			indexid;		/* OID of index to scan */
+	List	   *indexqual;		/* list of index quals (OpExprs) */
+	List	   *indexqualorig;	/* the same in original form */
+} BitmapIndexScan;
+
+/* ----------------
+ *		bitmap sequential scan node
+ *
+ * This needs a copy of the qual conditions being used by the input index
+ * scans because there are various cases where we need to recheck the quals;
+ * for example, when the bitmap is lossy about the specific rows on a page
+ * that meet the index condition.
+ * ----------------
+ */
+typedef struct BitmapHeapScan
+{
+	Scan		scan;
+	List	   *bitmapqualorig; /* index quals, in standard expr form */
+} BitmapHeapScan;
+
+/* ----------------
+ *		tid scan node
+ *
+ * tidquals is an implicitly OR'ed list of qual expressions of the form
+ * "CTID = pseudoconstant" or "CTID = ANY(pseudoconstant_array)".
+ * ----------------
+ */
+typedef struct TidScan
+{
+	Scan		scan;
+	List	   *tidquals;		/* qual(s) involving CTID = something */
+} TidScan;
+
+/* ----------------
+ *		subquery scan node
+ *
+ * SubqueryScan is for scanning the output of a sub-query in the range table.
+ * We often need an extra plan node above the sub-query's plan to perform
+ * expression evaluations (which we can't push into the sub-query without
+ * risking changing its semantics).  Although we are not scanning a physical
+ * relation, we make this a descendant of Scan anyway for code-sharing
+ * purposes.
+ *
+ * Note: we store the sub-plan in the type-specific subplan field, not in
+ * the generic lefttree field as you might expect.  This is because we do
+ * not want plan-tree-traversal routines to recurse into the subplan without
+ * knowing that they are changing Query contexts.
+ * ----------------
+ */
+typedef struct SubqueryScan
+{
+	Scan		scan;
+	Plan	   *subplan;
+} SubqueryScan;
+
+/* ----------------
+ *		FunctionScan node
+ * ----------------
+ */
+typedef struct FunctionScan
+{
+	Scan		scan;
+	List	   *functions;		/* list of RangeTblFunction nodes */
+	bool		funcordinality; /* WITH ORDINALITY */
+} FunctionScan;
+
+/* ----------------
+ *		ValuesScan node
+ * ----------------
+ */
+typedef struct ValuesScan
+{
+	Scan		scan;
+	List	   *values_lists;	/* list of expression lists */
+} ValuesScan;
+
+/* ----------------
+ *		CteScan node
+ * ----------------
+ */
+typedef struct CteScan
+{
+	Scan		scan;
+	int			ctePlanId;		/* ID of init SubPlan for CTE */
+	int			cteParam;		/* ID of Param representing CTE output */
+} CteScan;
+
+/* ----------------
+ *		WorkTableScan node
+ * ----------------
+ */
+typedef struct WorkTableScan
+{
+	Scan		scan;
+	int			wtParam;		/* ID of Param representing work table */
+} WorkTableScan;
+
+/* ----------------
+ *		ForeignScan node
+ *
+ * fdw_exprs and fdw_private are both under the control of the foreign-data
+ * wrapper, but fdw_exprs is presumed to contain expression trees and will
+ * be post-processed accordingly by the planner; fdw_private won't be.
+ * Note that everything in both lists must be copiable by copyObject().
+ * One way to store an arbitrary blob of bytes is to represent it as a bytea
+ * Const.  Usually, though, you'll be better off choosing a representation
+ * that can be dumped usefully by nodeToString().
+ *
+ * fdw_scan_tlist is a targetlist describing the contents of the scan tuple
+ * returned by the FDW; it can be NIL if the scan tuple matches the declared
+ * rowtype of the foreign table, which is the normal case for a simple foreign
+ * table scan.  (If the plan node represents a foreign join, fdw_scan_tlist
+ * is required since there is no rowtype available from the system catalogs.)
+ * When fdw_scan_tlist is provided, Vars in the node's tlist and quals must
+ * have varno INDEX_VAR, and their varattnos correspond to resnos in the
+ * fdw_scan_tlist (which are also column numbers in the actual scan tuple).
+ * fdw_scan_tlist is never actually executed; it just holds expression trees
+ * describing what is in the scan tuple's columns.
+ *
+ * fdw_recheck_quals should contain any quals which the core system passed to
+ * the FDW but which were not added to scan.plan.qual; that is, it should
+ * contain the quals being checked remotely.  This is needed for correct
+ * behavior during EvalPlanQual rechecks.
+ *
+ * When the plan node represents a foreign join, scan.scanrelid is zero and
+ * fs_relids must be consulted to identify the join relation.  (fs_relids
+ * is valid for simple scans as well, but will always match scan.scanrelid.)
+ * ----------------
+ */
+typedef struct ForeignScan
+{
+	Scan		scan;
+	Oid			fs_server;		/* OID of foreign server */
+	List	   *fdw_exprs;		/* expressions that FDW may evaluate */
+	List	   *fdw_private;	/* private data for FDW */
+	List	   *fdw_scan_tlist; /* optional tlist describing scan tuple */
+	List	   *fdw_recheck_quals;	/* original quals not in scan.plan.qual */
+	Bitmapset  *fs_relids;		/* RTIs generated by this scan */
+	bool		fsSystemCol;	/* true if any "system column" is needed */
+} ForeignScan;
+
+/* ----------------
+ *	   CustomScan node
+ *
+ * The comments for ForeignScan's fdw_exprs, fdw_private, fdw_scan_tlist,
+ * and fs_relids fields apply equally to CustomScan's custom_exprs,
+ * custom_private, custom_scan_tlist, and custom_relids fields.  The
+ * convention of setting scan.scanrelid to zero for joins applies as well.
+ *
+ * Note that since Plan trees can be copied, custom scan providers *must*
+ * fit all plan data they need into those fields; embedding CustomScan in
+ * a larger struct will not work.
+ * ----------------
+ */
+struct CustomScan;
+
+typedef struct CustomScanMethods
+{
+	const char *CustomName;
+
+	/* Create execution state (CustomScanState) from a CustomScan plan node */
+	Node	   *(*CreateCustomScanState) (struct CustomScan *cscan);
+	/* Optional: print custom_xxx fields in some special way */
+	void		(*TextOutCustomScan) (StringInfo str,
+											  const struct CustomScan *node);
+} CustomScanMethods;
+
+typedef struct CustomScan
+{
+	Scan		scan;
+	uint32		flags;			/* mask of CUSTOMPATH_* flags, see relation.h */
+	List	   *custom_plans;	/* list of Plan nodes, if any */
+	List	   *custom_exprs;	/* expressions that custom code may evaluate */
+	List	   *custom_private; /* private data for custom code */
+	List	   *custom_scan_tlist;		/* optional tlist describing scan
+										 * tuple */
+	Bitmapset  *custom_relids;	/* RTIs generated by this scan */
+	const CustomScanMethods *methods;
+} CustomScan;
+
+/*
+ * ==========
+ * Join nodes
+ * ==========
+ */
+
+/* ----------------
+ *		Join node
+ *
+ * jointype:	rule for joining tuples from left and right subtrees
+ * joinqual:	qual conditions that came from JOIN/ON or JOIN/USING
+ *				(plan.qual contains conditions that came from WHERE)
+ *
+ * When jointype is INNER, joinqual and plan.qual are semantically
+ * interchangeable.  For OUTER jointypes, the two are *not* interchangeable;
+ * only joinqual is used to determine whether a match has been found for
+ * the purpose of deciding whether to generate null-extended tuples.
+ * (But plan.qual is still applied before actually returning a tuple.)
+ * For an outer join, only joinquals are allowed to be used as the merge
+ * or hash condition of a merge or hash join.
+ * ----------------
+ */
+typedef struct Join
+{
+	Plan		plan;
+	JoinType	jointype;
+	List	   *joinqual;		/* JOIN quals (in addition to plan.qual) */
+} Join;
+
+/* ----------------
+ *		nest loop join node
+ *
+ * The nestParams list identifies any executor Params that must be passed
+ * into execution of the inner subplan carrying values from the current row
+ * of the outer subplan.  Currently we restrict these values to be simple
+ * Vars, but perhaps someday that'd be worth relaxing.  (Note: during plan
+ * creation, the paramval can actually be a PlaceHolderVar expression; but it
+ * must be a Var with varno OUTER_VAR by the time it gets to the executor.)
+ * ----------------
+ */
+typedef struct NestLoop
+{
+	Join		join;
+	List	   *nestParams;		/* list of NestLoopParam nodes */
+} NestLoop;
+
+typedef struct NestLoopParam
+{
+	NodeTag		type;
+	int			paramno;		/* number of the PARAM_EXEC Param to set */
+	Var		   *paramval;		/* outer-relation Var to assign to Param */
+} NestLoopParam;
+
+/* ----------------
+ *		merge join node
+ *
+ * The expected ordering of each mergeable column is described by a btree
+ * opfamily OID, a collation OID, a direction (BTLessStrategyNumber or
+ * BTGreaterStrategyNumber) and a nulls-first flag.  Note that the two sides
+ * of each mergeclause may be of different datatypes, but they are ordered the
+ * same way according to the common opfamily and collation.  The operator in
+ * each mergeclause must be an equality operator of the indicated opfamily.
+ * ----------------
+ */
+typedef struct MergeJoin
+{
+	Join		join;
+	List	   *mergeclauses;	/* mergeclauses as expression trees */
+	/* these are arrays, but have the same length as the mergeclauses list: */
+	Oid		   *mergeFamilies;	/* per-clause OIDs of btree opfamilies */
+	Oid		   *mergeCollations;	/* per-clause OIDs of collations */
+	int		   *mergeStrategies;	/* per-clause ordering (ASC or DESC) */
+	bool	   *mergeNullsFirst;	/* per-clause nulls ordering */
+} MergeJoin;
+
+/* ----------------
+ *		hash join node
+ * ----------------
+ */
+typedef struct HashJoin
+{
+	Join		join;
+	List	   *hashclauses;
+} HashJoin;
+
+/* ----------------
+ *		materialization node
+ * ----------------
+ */
+typedef struct Material
+{
+	Plan		plan;
+} Material;
+
+/* ----------------
+ *		sort node
+ * ----------------
+ */
+typedef struct Sort
+{
+	Plan		plan;
+	int			numCols;		/* number of sort-key columns */
+	AttrNumber *sortColIdx;		/* their indexes in the target list */
+	Oid		   *sortOperators;	/* OIDs of operators to sort them by */
+	Oid		   *collations;		/* OIDs of collations */
+	bool	   *nullsFirst;		/* NULLS FIRST/LAST directions */
+} Sort;
+
+/* ---------------
+ *	 group node -
+ *		Used for queries with GROUP BY (but no aggregates) specified.
+ *		The input must be presorted according to the grouping columns.
+ * ---------------
+ */
+typedef struct Group
+{
+	Plan		plan;
+	int			numCols;		/* number of grouping columns */
+	AttrNumber *grpColIdx;		/* their indexes in the target list */
+	Oid		   *grpOperators;	/* equality operators to compare with */
+} Group;
+
+/* ---------------
+ *		aggregate node
+ *
+ * An Agg node implements plain or grouped aggregation.  For grouped
+ * aggregation, we can work with presorted input or unsorted input;
+ * the latter strategy uses an internal hashtable.
+ *
+ * Notice the lack of any direct info about the aggregate functions to be
+ * computed.  They are found by scanning the node's tlist and quals during
+ * executor startup.  (It is possible that there are no aggregate functions;
+ * this could happen if they get optimized away by constant-folding, or if
+ * we are using the Agg node to implement hash-based grouping.)
+ * ---------------
+ */
+typedef enum AggStrategy
+{
+	AGG_PLAIN,					/* simple agg across all input rows */
+	AGG_SORTED,					/* grouped agg, input must be sorted */
+	AGG_HASHED					/* grouped agg, use internal hashtable */
+} AggStrategy;
+
+typedef struct Agg
+{
+	Plan		plan;
+	AggStrategy aggstrategy;
+	int			numCols;		/* number of grouping columns */
+	AttrNumber *grpColIdx;		/* their indexes in the target list */
+	Oid		   *grpOperators;	/* equality operators to compare with */
+	long		numGroups;		/* estimated number of groups in input */
+	List	   *groupingSets;	/* grouping sets to use */
+	List	   *chain;			/* chained Agg/Sort nodes */
+} Agg;
+
+/* ----------------
+ *		window aggregate node
+ * ----------------
+ */
+typedef struct WindowAgg
+{
+	Plan		plan;
+	Index		winref;			/* ID referenced by window functions */
+	int			partNumCols;	/* number of columns in partition clause */
+	AttrNumber *partColIdx;		/* their indexes in the target list */
+	Oid		   *partOperators;	/* equality operators for partition columns */
+	int			ordNumCols;		/* number of columns in ordering clause */
+	AttrNumber *ordColIdx;		/* their indexes in the target list */
+	Oid		   *ordOperators;	/* equality operators for ordering columns */
+	int			frameOptions;	/* frame_clause options, see WindowDef */
+	Node	   *startOffset;	/* expression for starting bound, if any */
+	Node	   *endOffset;		/* expression for ending bound, if any */
+} WindowAgg;
+
+/* ----------------
+ *		unique node
+ * ----------------
+ */
+typedef struct Unique
+{
+	Plan		plan;
+	int			numCols;		/* number of columns to check for uniqueness */
+	AttrNumber *uniqColIdx;		/* their indexes in the target list */
+	Oid		   *uniqOperators;	/* equality operators to compare with */
+} Unique;
+
+/* ----------------
+ *		hash build node
+ *
+ * If the executor is supposed to try to apply skew join optimization, then
+ * skewTable/skewColumn/skewInherit identify the outer relation's join key
+ * column, from which the relevant MCV statistics can be fetched.  Also, its
+ * type information is provided to save a lookup.
+ * ----------------
+ */
+typedef struct Hash
+{
+	Plan		plan;
+	Oid			skewTable;		/* outer join key's table OID, or InvalidOid */
+	AttrNumber	skewColumn;		/* outer join key's column #, or zero */
+	bool		skewInherit;	/* is outer join rel an inheritance tree? */
+	Oid			skewColType;	/* datatype of the outer key column */
+	int32		skewColTypmod;	/* typmod of the outer key column */
+	/* all other info is in the parent HashJoin node */
+} Hash;
+
+/* ----------------
+ *		setop node
+ * ----------------
+ */
+typedef enum SetOpCmd
+{
+	SETOPCMD_INTERSECT,
+	SETOPCMD_INTERSECT_ALL,
+	SETOPCMD_EXCEPT,
+	SETOPCMD_EXCEPT_ALL
+} SetOpCmd;
+
+typedef enum SetOpStrategy
+{
+	SETOP_SORTED,				/* input must be sorted */
+	SETOP_HASHED				/* use internal hashtable */
+} SetOpStrategy;
+
+typedef struct SetOp
+{
+	Plan		plan;
+	SetOpCmd	cmd;			/* what to do */
+	SetOpStrategy strategy;		/* how to do it */
+	int			numCols;		/* number of columns to check for
+								 * duplicate-ness */
+	AttrNumber *dupColIdx;		/* their indexes in the target list */
+	Oid		   *dupOperators;	/* equality operators to compare with */
+	AttrNumber	flagColIdx;		/* where is the flag column, if any */
+	int			firstFlag;		/* flag value for first input relation */
+	long		numGroups;		/* estimated number of groups in input */
+} SetOp;
+
+/* ----------------
+ *		lock-rows node
+ *
+ * rowMarks identifies the rels to be locked by this node; it should be
+ * a subset of the rowMarks listed in the top-level PlannedStmt.
+ * epqParam is a Param that all scan nodes below this one must depend on.
+ * It is used to force re-evaluation of the plan during EvalPlanQual.
+ * ----------------
+ */
+typedef struct LockRows
+{
+	Plan		plan;
+	List	   *rowMarks;		/* a list of PlanRowMark's */
+	int			epqParam;		/* ID of Param for EvalPlanQual re-eval */
+} LockRows;
+
+/* ----------------
+ *		limit node
+ *
+ * Note: as of Postgres 8.2, the offset and count expressions are expected
+ * to yield int8, rather than int4 as before.
+ * ----------------
+ */
+typedef struct Limit
+{
+	Plan		plan;
+	Node	   *limitOffset;	/* OFFSET parameter, or NULL if none */
+	Node	   *limitCount;		/* COUNT parameter, or NULL if none */
+} Limit;
+
+
+/*
+ * RowMarkType -
+ *	  enums for types of row-marking operations
+ *
+ * The first four of these values represent different lock strengths that
+ * we can take on tuples according to SELECT FOR [KEY] UPDATE/SHARE requests.
+ * We support these on regular tables, as well as on foreign tables whose FDWs
+ * report support for late locking.  For other foreign tables, any locking
+ * that might be done for such requests must happen during the initial row
+ * fetch; their FDWs provide no mechanism for going back to lock a row later.
+ * This means that the semantics will be a bit different than for a local
+ * table; in particular we are likely to lock more rows than would be locked
+ * locally, since remote rows will be locked even if they then fail
+ * locally-checked restriction or join quals.  However, the prospect of
+ * doing a separate remote query to lock each selected row is usually pretty
+ * unappealing, so early locking remains a credible design choice for FDWs.
+ *
+ * When doing UPDATE, DELETE, or SELECT FOR UPDATE/SHARE, we have to uniquely
+ * identify all the source rows, not only those from the target relations, so
+ * that we can perform EvalPlanQual rechecking at need.  For plain tables we
+ * can just fetch the TID, much as for a target relation; this case is
+ * represented by ROW_MARK_REFERENCE.  Otherwise (for example for VALUES or
+ * FUNCTION scans) we have to copy the whole row value.  ROW_MARK_COPY is
+ * pretty inefficient, since most of the time we'll never need the data; but
+ * fortunately the overhead is usually not performance-critical in practice.
+ * By default we use ROW_MARK_COPY for foreign tables, but if the FDW has
+ * a concept of rowid it can request to use ROW_MARK_REFERENCE instead.
+ * (Again, this probably doesn't make sense if a physical remote fetch is
+ * needed, but for FDWs that map to local storage it might be credible.)
+ */
+typedef enum RowMarkType
+{
+	ROW_MARK_EXCLUSIVE,			/* obtain exclusive tuple lock */
+	ROW_MARK_NOKEYEXCLUSIVE,	/* obtain no-key exclusive tuple lock */
+	ROW_MARK_SHARE,				/* obtain shared tuple lock */
+	ROW_MARK_KEYSHARE,			/* obtain keyshare tuple lock */
+	ROW_MARK_REFERENCE,			/* just fetch the TID, don't lock it */
+	ROW_MARK_COPY				/* physically copy the row value */
+} RowMarkType;
+
+#define RowMarkRequiresRowShareLock(marktype)  ((marktype) <= ROW_MARK_KEYSHARE)
+
+/*
+ * PlanRowMark -
+ *	   plan-time representation of FOR [KEY] UPDATE/SHARE clauses
+ *
+ * When doing UPDATE, DELETE, or SELECT FOR UPDATE/SHARE, we create a separate
+ * PlanRowMark node for each non-target relation in the query.  Relations that
+ * are not specified as FOR UPDATE/SHARE are marked ROW_MARK_REFERENCE (if
+ * regular tables or supported foreign tables) or ROW_MARK_COPY (if not).
+ *
+ * Initially all PlanRowMarks have rti == prti and isParent == false.
+ * When the planner discovers that a relation is the root of an inheritance
+ * tree, it sets isParent true, and adds an additional PlanRowMark to the
+ * list for each child relation (including the target rel itself in its role
+ * as a child).  The child entries have rti == child rel's RT index and
+ * prti == parent's RT index, and can therefore be recognized as children by
+ * the fact that prti != rti.  The parent's allMarkTypes field gets the OR
+ * of (1<<markType) across all its children (this definition allows children
+ * to use different markTypes).
+ *
+ * The planner also adds resjunk output columns to the plan that carry
+ * information sufficient to identify the locked or fetched rows.  When
+ * markType != ROW_MARK_COPY, these columns are named
+ *		tableoid%u			OID of table
+ *		ctid%u				TID of row
+ * The tableoid column is only present for an inheritance hierarchy.
+ * When markType == ROW_MARK_COPY, there is instead a single column named
+ *		wholerow%u			whole-row value of relation
+ * (An inheritance hierarchy could have all three resjunk output columns,
+ * if some children use a different markType than others.)
+ * In all three cases, %u represents the rowmark ID number (rowmarkId).
+ * This number is unique within a plan tree, except that child relation
+ * entries copy their parent's rowmarkId.  (Assigning unique numbers
+ * means we needn't renumber rowmarkIds when flattening subqueries, which
+ * would require finding and renaming the resjunk columns as well.)
+ * Note this means that all tables in an inheritance hierarchy share the
+ * same resjunk column names.  However, in an inherited UPDATE/DELETE the
+ * columns could have different physical column numbers in each subplan.
+ */
+typedef struct PlanRowMark
+{
+	NodeTag		type;
+	Index		rti;			/* range table index of markable relation */
+	Index		prti;			/* range table index of parent relation */
+	Index		rowmarkId;		/* unique identifier for resjunk columns */
+	RowMarkType markType;		/* see enum above */
+	int			allMarkTypes;	/* OR of (1<<markType) for all children */
+	LockClauseStrength strength;	/* LockingClause's strength, or LCS_NONE */
+	LockWaitPolicy waitPolicy;	/* NOWAIT and SKIP LOCKED options */
+	bool		isParent;		/* true if this is a "dummy" parent entry */
+} PlanRowMark;
+
+
+/*
+ * Plan invalidation info
+ *
+ * We track the objects on which a PlannedStmt depends in two ways:
+ * relations are recorded as a simple list of OIDs, and everything else
+ * is represented as a list of PlanInvalItems.  A PlanInvalItem is designed
+ * to be used with the syscache invalidation mechanism, so it identifies a
+ * system catalog entry by cache ID and hash value.
+ */
+typedef struct PlanInvalItem
+{
+	NodeTag		type;
+	int			cacheId;		/* a syscache ID, see utils/syscache.h */
+	uint32		hashValue;		/* hash value of object's cache lookup key */
+} PlanInvalItem;
+
+#endif   /* PLANNODES_H */
diff --git a/foreign/libpg_query/src/postgres/include/nodes/primnodes.h b/foreign/libpg_query/src/postgres/include/nodes/primnodes.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/nodes/primnodes.h
@@ -0,0 +1,1400 @@
+/*-------------------------------------------------------------------------
+ *
+ * primnodes.h
+ *	  Definitions for "primitive" node types, those that are used in more
+ *	  than one of the parse/plan/execute stages of the query pipeline.
+ *	  Currently, these are mostly nodes for executable expressions
+ *	  and join trees.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/nodes/primnodes.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PRIMNODES_H
+#define PRIMNODES_H
+
+#include "access/attnum.h"
+#include "nodes/pg_list.h"
+
+
+/* ----------------------------------------------------------------
+ *						node definitions
+ * ----------------------------------------------------------------
+ */
+
+/*
+ * Alias -
+ *	  specifies an alias for a range variable; the alias might also
+ *	  specify renaming of columns within the table.
+ *
+ * Note: colnames is a list of Value nodes (always strings).  In Alias structs
+ * associated with RTEs, there may be entries corresponding to dropped
+ * columns; these are normally empty strings ("").  See parsenodes.h for info.
+ */
+typedef struct Alias
+{
+	NodeTag		type;
+	char	   *aliasname;		/* aliased rel name (never qualified) */
+	List	   *colnames;		/* optional list of column aliases */
+} Alias;
+
+typedef enum InhOption
+{
+	INH_NO,						/* Do NOT scan child tables */
+	INH_YES,					/* DO scan child tables */
+	INH_DEFAULT					/* Use current SQL_inheritance option */
+} InhOption;
+
+/* What to do at commit time for temporary relations */
+typedef enum OnCommitAction
+{
+	ONCOMMIT_NOOP,				/* No ON COMMIT clause (do nothing) */
+	ONCOMMIT_PRESERVE_ROWS,		/* ON COMMIT PRESERVE ROWS (do nothing) */
+	ONCOMMIT_DELETE_ROWS,		/* ON COMMIT DELETE ROWS */
+	ONCOMMIT_DROP				/* ON COMMIT DROP */
+} OnCommitAction;
+
+/*
+ * RangeVar - range variable, used in FROM clauses
+ *
+ * Also used to represent table names in utility statements; there, the alias
+ * field is not used, and inhOpt shows whether to apply the operation
+ * recursively to child tables.  In some contexts it is also useful to carry
+ * a TEMP table indication here.
+ */
+typedef struct RangeVar
+{
+	NodeTag		type;
+	char	   *catalogname;	/* the catalog (database) name, or NULL */
+	char	   *schemaname;		/* the schema name, or NULL */
+	char	   *relname;		/* the relation/sequence name */
+	InhOption	inhOpt;			/* expand rel by inheritance? recursively act
+								 * on children? */
+	char		relpersistence; /* see RELPERSISTENCE_* in pg_class.h */
+	Alias	   *alias;			/* table alias & optional column aliases */
+	int			location;		/* token location, or -1 if unknown */
+} RangeVar;
+
+/*
+ * IntoClause - target information for SELECT INTO, CREATE TABLE AS, and
+ * CREATE MATERIALIZED VIEW
+ *
+ * For CREATE MATERIALIZED VIEW, viewQuery is the parsed-but-not-rewritten
+ * SELECT Query for the view; otherwise it's NULL.  (Although it's actually
+ * Query*, we declare it as Node* to avoid a forward reference.)
+ */
+typedef struct IntoClause
+{
+	NodeTag		type;
+
+	RangeVar   *rel;			/* target relation name */
+	List	   *colNames;		/* column names to assign, or NIL */
+	List	   *options;		/* options from WITH clause */
+	OnCommitAction onCommit;	/* what do we do at COMMIT? */
+	char	   *tableSpaceName; /* table space to use, or NULL */
+	Node	   *viewQuery;		/* materialized view's SELECT query */
+	bool		skipData;		/* true for WITH NO DATA */
+} IntoClause;
+
+
+/* ----------------------------------------------------------------
+ *					node types for executable expressions
+ * ----------------------------------------------------------------
+ */
+
+/*
+ * Expr - generic superclass for executable-expression nodes
+ *
+ * All node types that are used in executable expression trees should derive
+ * from Expr (that is, have Expr as their first field).  Since Expr only
+ * contains NodeTag, this is a formality, but it is an easy form of
+ * documentation.  See also the ExprState node types in execnodes.h.
+ */
+typedef struct Expr
+{
+	NodeTag		type;
+} Expr;
+
+/*
+ * Var - expression node representing a variable (ie, a table column)
+ *
+ * Note: during parsing/planning, varnoold/varoattno are always just copies
+ * of varno/varattno.  At the tail end of planning, Var nodes appearing in
+ * upper-level plan nodes are reassigned to point to the outputs of their
+ * subplans; for example, in a join node varno becomes INNER_VAR or OUTER_VAR
+ * and varattno becomes the index of the proper element of that subplan's
+ * target list.  Similarly, INDEX_VAR is used to identify Vars that reference
+ * an index column rather than a heap column.  (In ForeignScan and CustomScan
+ * plan nodes, INDEX_VAR is abused to signify references to columns of a
+ * custom scan tuple type.)  In all these cases, varnoold/varoattno hold the
+ * original values.  The code doesn't really need varnoold/varoattno, but they
+ * are very useful for debugging and interpreting completed plans, so we keep
+ * them around.
+ */
+#define    INNER_VAR		65000		/* reference to inner subplan */
+#define    OUTER_VAR		65001		/* reference to outer subplan */
+#define    INDEX_VAR		65002		/* reference to index column */
+
+#define IS_SPECIAL_VARNO(varno)		((varno) >= INNER_VAR)
+
+/* Symbols for the indexes of the special RTE entries in rules */
+#define    PRS2_OLD_VARNO			1
+#define    PRS2_NEW_VARNO			2
+
+typedef struct Var
+{
+	Expr		xpr;
+	Index		varno;			/* index of this var's relation in the range
+								 * table, or INNER_VAR/OUTER_VAR/INDEX_VAR */
+	AttrNumber	varattno;		/* attribute number of this var, or zero for
+								 * all */
+	Oid			vartype;		/* pg_type OID for the type of this var */
+	int32		vartypmod;		/* pg_attribute typmod value */
+	Oid			varcollid;		/* OID of collation, or InvalidOid if none */
+	Index		varlevelsup;	/* for subquery variables referencing outer
+								 * relations; 0 in a normal var, >0 means N
+								 * levels up */
+	Index		varnoold;		/* original value of varno, for debugging */
+	AttrNumber	varoattno;		/* original value of varattno */
+	int			location;		/* token location, or -1 if unknown */
+} Var;
+
+/*
+ * Const
+ *
+ * Note: for varlena data types, we make a rule that a Const node's value
+ * must be in non-extended form (4-byte header, no compression or external
+ * references).  This ensures that the Const node is self-contained and makes
+ * it more likely that equal() will see logically identical values as equal.
+ */
+typedef struct Const
+{
+	Expr		xpr;
+	Oid			consttype;		/* pg_type OID of the constant's datatype */
+	int32		consttypmod;	/* typmod value, if any */
+	Oid			constcollid;	/* OID of collation, or InvalidOid if none */
+	int			constlen;		/* typlen of the constant's datatype */
+	Datum		constvalue;		/* the constant's value */
+	bool		constisnull;	/* whether the constant is null (if true,
+								 * constvalue is undefined) */
+	bool		constbyval;		/* whether this datatype is passed by value.
+								 * If true, then all the information is stored
+								 * in the Datum. If false, then the Datum
+								 * contains a pointer to the information. */
+	int			location;		/* token location, or -1 if unknown */
+} Const;
+
+/*
+ * Param
+ *
+ *		paramkind specifies the kind of parameter. The possible values
+ *		for this field are:
+ *
+ *		PARAM_EXTERN:  The parameter value is supplied from outside the plan.
+ *				Such parameters are numbered from 1 to n.
+ *
+ *		PARAM_EXEC:  The parameter is an internal executor parameter, used
+ *				for passing values into and out of sub-queries or from
+ *				nestloop joins to their inner scans.
+ *				For historical reasons, such parameters are numbered from 0.
+ *				These numbers are independent of PARAM_EXTERN numbers.
+ *
+ *		PARAM_SUBLINK:	The parameter represents an output column of a SubLink
+ *				node's sub-select.  The column number is contained in the
+ *				`paramid' field.  (This type of Param is converted to
+ *				PARAM_EXEC during planning.)
+ *
+ *		PARAM_MULTIEXPR:  Like PARAM_SUBLINK, the parameter represents an
+ *				output column of a SubLink node's sub-select, but here, the
+ *				SubLink is always a MULTIEXPR SubLink.  The high-order 16 bits
+ *				of the `paramid' field contain the SubLink's subLinkId, and
+ *				the low-order 16 bits contain the column number.  (This type
+ *				of Param is also converted to PARAM_EXEC during planning.)
+ */
+typedef enum ParamKind
+{
+	PARAM_EXTERN,
+	PARAM_EXEC,
+	PARAM_SUBLINK,
+	PARAM_MULTIEXPR
+} ParamKind;
+
+typedef struct Param
+{
+	Expr		xpr;
+	ParamKind	paramkind;		/* kind of parameter. See above */
+	int			paramid;		/* numeric ID for parameter */
+	Oid			paramtype;		/* pg_type OID of parameter's datatype */
+	int32		paramtypmod;	/* typmod value, if known */
+	Oid			paramcollid;	/* OID of collation, or InvalidOid if none */
+	int			location;		/* token location, or -1 if unknown */
+} Param;
+
+/*
+ * Aggref
+ *
+ * The aggregate's args list is a targetlist, ie, a list of TargetEntry nodes.
+ *
+ * For a normal (non-ordered-set) aggregate, the non-resjunk TargetEntries
+ * represent the aggregate's regular arguments (if any) and resjunk TLEs can
+ * be added at the end to represent ORDER BY expressions that are not also
+ * arguments.  As in a top-level Query, the TLEs can be marked with
+ * ressortgroupref indexes to let them be referenced by SortGroupClause
+ * entries in the aggorder and/or aggdistinct lists.  This represents ORDER BY
+ * and DISTINCT operations to be applied to the aggregate input rows before
+ * they are passed to the transition function.  The grammar only allows a
+ * simple "DISTINCT" specifier for the arguments, but we use the full
+ * query-level representation to allow more code sharing.
+ *
+ * For an ordered-set aggregate, the args list represents the WITHIN GROUP
+ * (aggregated) arguments, all of which will be listed in the aggorder list.
+ * DISTINCT is not supported in this case, so aggdistinct will be NIL.
+ * The direct arguments appear in aggdirectargs (as a list of plain
+ * expressions, not TargetEntry nodes).
+ */
+typedef struct Aggref
+{
+	Expr		xpr;
+	Oid			aggfnoid;		/* pg_proc Oid of the aggregate */
+	Oid			aggtype;		/* type Oid of result of the aggregate */
+	Oid			aggcollid;		/* OID of collation of result */
+	Oid			inputcollid;	/* OID of collation that function should use */
+	List	   *aggdirectargs;	/* direct arguments, if an ordered-set agg */
+	List	   *args;			/* aggregated arguments and sort expressions */
+	List	   *aggorder;		/* ORDER BY (list of SortGroupClause) */
+	List	   *aggdistinct;	/* DISTINCT (list of SortGroupClause) */
+	Expr	   *aggfilter;		/* FILTER expression, if any */
+	bool		aggstar;		/* TRUE if argument list was really '*' */
+	bool		aggvariadic;	/* true if variadic arguments have been
+								 * combined into an array last argument */
+	char		aggkind;		/* aggregate kind (see pg_aggregate.h) */
+	Index		agglevelsup;	/* > 0 if agg belongs to outer query */
+	int			location;		/* token location, or -1 if unknown */
+} Aggref;
+
+/*
+ * GroupingFunc
+ *
+ * A GroupingFunc is a GROUPING(...) expression, which behaves in many ways
+ * like an aggregate function (e.g. it "belongs" to a specific query level,
+ * which might not be the one immediately containing it), but also differs in
+ * an important respect: it never evaluates its arguments, they merely
+ * designate expressions from the GROUP BY clause of the query level to which
+ * it belongs.
+ *
+ * The spec defines the evaluation of GROUPING() purely by syntactic
+ * replacement, but we make it a real expression for optimization purposes so
+ * that one Agg node can handle multiple grouping sets at once.  Evaluating the
+ * result only needs the column positions to check against the grouping set
+ * being projected.  However, for EXPLAIN to produce meaningful output, we have
+ * to keep the original expressions around, since expression deparse does not
+ * give us any feasible way to get at the GROUP BY clause.
+ *
+ * Also, we treat two GroupingFunc nodes as equal if they have equal arguments
+ * lists and agglevelsup, without comparing the refs and cols annotations.
+ *
+ * In raw parse output we have only the args list; parse analysis fills in the
+ * refs list, and the planner fills in the cols list.
+ */
+typedef struct GroupingFunc
+{
+	Expr		xpr;
+	List	   *args;			/* arguments, not evaluated but kept for
+								 * benefit of EXPLAIN etc. */
+	List	   *refs;			/* ressortgrouprefs of arguments */
+	List	   *cols;			/* actual column positions set by planner */
+	Index		agglevelsup;	/* same as Aggref.agglevelsup */
+	int			location;		/* token location */
+} GroupingFunc;
+
+/*
+ * WindowFunc
+ */
+typedef struct WindowFunc
+{
+	Expr		xpr;
+	Oid			winfnoid;		/* pg_proc Oid of the function */
+	Oid			wintype;		/* type Oid of result of the window function */
+	Oid			wincollid;		/* OID of collation of result */
+	Oid			inputcollid;	/* OID of collation that function should use */
+	List	   *args;			/* arguments to the window function */
+	Expr	   *aggfilter;		/* FILTER expression, if any */
+	Index		winref;			/* index of associated WindowClause */
+	bool		winstar;		/* TRUE if argument list was really '*' */
+	bool		winagg;			/* is function a simple aggregate? */
+	int			location;		/* token location, or -1 if unknown */
+} WindowFunc;
+
+/* ----------------
+ *	ArrayRef: describes an array subscripting operation
+ *
+ * An ArrayRef can describe fetching a single element from an array,
+ * fetching a subarray (array slice), storing a single element into
+ * an array, or storing a slice.  The "store" cases work with an
+ * initial array value and a source value that is inserted into the
+ * appropriate part of the array; the result of the operation is an
+ * entire new modified array value.
+ *
+ * If reflowerindexpr = NIL, then we are fetching or storing a single array
+ * element at the subscripts given by refupperindexpr.  Otherwise we are
+ * fetching or storing an array slice, that is a rectangular subarray
+ * with lower and upper bounds given by the index expressions.
+ * reflowerindexpr must be the same length as refupperindexpr when it
+ * is not NIL.
+ *
+ * Note: the result datatype is the element type when fetching a single
+ * element; but it is the array type when doing subarray fetch or either
+ * type of store.
+ *
+ * Note: for the cases where an array is returned, if refexpr yields a R/W
+ * expanded array, then the implementation is allowed to modify that object
+ * in-place and return the same object.)
+ * ----------------
+ */
+typedef struct ArrayRef
+{
+	Expr		xpr;
+	Oid			refarraytype;	/* type of the array proper */
+	Oid			refelemtype;	/* type of the array elements */
+	int32		reftypmod;		/* typmod of the array (and elements too) */
+	Oid			refcollid;		/* OID of collation, or InvalidOid if none */
+	List	   *refupperindexpr;/* expressions that evaluate to upper array
+								 * indexes */
+	List	   *reflowerindexpr;/* expressions that evaluate to lower array
+								 * indexes */
+	Expr	   *refexpr;		/* the expression that evaluates to an array
+								 * value */
+	Expr	   *refassgnexpr;	/* expression for the source value, or NULL if
+								 * fetch */
+} ArrayRef;
+
+/*
+ * CoercionContext - distinguishes the allowed set of type casts
+ *
+ * NB: ordering of the alternatives is significant; later (larger) values
+ * allow more casts than earlier ones.
+ */
+typedef enum CoercionContext
+{
+	COERCION_IMPLICIT,			/* coercion in context of expression */
+	COERCION_ASSIGNMENT,		/* coercion in context of assignment */
+	COERCION_EXPLICIT			/* explicit cast operation */
+} CoercionContext;
+
+/*
+ * CoercionForm - how to display a node that could have come from a cast
+ *
+ * NB: equal() ignores CoercionForm fields, therefore this *must* not carry
+ * any semantically significant information.  We need that behavior so that
+ * the planner will consider equivalent implicit and explicit casts to be
+ * equivalent.  In cases where those actually behave differently, the coercion
+ * function's arguments will be different.
+ */
+typedef enum CoercionForm
+{
+	COERCE_EXPLICIT_CALL,		/* display as a function call */
+	COERCE_EXPLICIT_CAST,		/* display as an explicit cast */
+	COERCE_IMPLICIT_CAST		/* implicit cast, so hide it */
+} CoercionForm;
+
+/*
+ * FuncExpr - expression node for a function call
+ */
+typedef struct FuncExpr
+{
+	Expr		xpr;
+	Oid			funcid;			/* PG_PROC OID of the function */
+	Oid			funcresulttype; /* PG_TYPE OID of result value */
+	bool		funcretset;		/* true if function returns set */
+	bool		funcvariadic;	/* true if variadic arguments have been
+								 * combined into an array last argument */
+	CoercionForm funcformat;	/* how to display this function call */
+	Oid			funccollid;		/* OID of collation of result */
+	Oid			inputcollid;	/* OID of collation that function should use */
+	List	   *args;			/* arguments to the function */
+	int			location;		/* token location, or -1 if unknown */
+} FuncExpr;
+
+/*
+ * NamedArgExpr - a named argument of a function
+ *
+ * This node type can only appear in the args list of a FuncCall or FuncExpr
+ * node.  We support pure positional call notation (no named arguments),
+ * named notation (all arguments are named), and mixed notation (unnamed
+ * arguments followed by named ones).
+ *
+ * Parse analysis sets argnumber to the positional index of the argument,
+ * but doesn't rearrange the argument list.
+ *
+ * The planner will convert argument lists to pure positional notation
+ * during expression preprocessing, so execution never sees a NamedArgExpr.
+ */
+typedef struct NamedArgExpr
+{
+	Expr		xpr;
+	Expr	   *arg;			/* the argument expression */
+	char	   *name;			/* the name */
+	int			argnumber;		/* argument's number in positional notation */
+	int			location;		/* argument name location, or -1 if unknown */
+} NamedArgExpr;
+
+/*
+ * OpExpr - expression node for an operator invocation
+ *
+ * Semantically, this is essentially the same as a function call.
+ *
+ * Note that opfuncid is not necessarily filled in immediately on creation
+ * of the node.  The planner makes sure it is valid before passing the node
+ * tree to the executor, but during parsing/planning opfuncid can be 0.
+ */
+typedef struct OpExpr
+{
+	Expr		xpr;
+	Oid			opno;			/* PG_OPERATOR OID of the operator */
+	Oid			opfuncid;		/* PG_PROC OID of underlying function */
+	Oid			opresulttype;	/* PG_TYPE OID of result value */
+	bool		opretset;		/* true if operator returns set */
+	Oid			opcollid;		/* OID of collation of result */
+	Oid			inputcollid;	/* OID of collation that operator should use */
+	List	   *args;			/* arguments to the operator (1 or 2) */
+	int			location;		/* token location, or -1 if unknown */
+} OpExpr;
+
+/*
+ * DistinctExpr - expression node for "x IS DISTINCT FROM y"
+ *
+ * Except for the nodetag, this is represented identically to an OpExpr
+ * referencing the "=" operator for x and y.
+ * We use "=", not the more obvious "<>", because more datatypes have "="
+ * than "<>".  This means the executor must invert the operator result.
+ * Note that the operator function won't be called at all if either input
+ * is NULL, since then the result can be determined directly.
+ */
+typedef OpExpr DistinctExpr;
+
+/*
+ * NullIfExpr - a NULLIF expression
+ *
+ * Like DistinctExpr, this is represented the same as an OpExpr referencing
+ * the "=" operator for x and y.
+ */
+typedef OpExpr NullIfExpr;
+
+/*
+ * ScalarArrayOpExpr - expression node for "scalar op ANY/ALL (array)"
+ *
+ * The operator must yield boolean.  It is applied to the left operand
+ * and each element of the righthand array, and the results are combined
+ * with OR or AND (for ANY or ALL respectively).  The node representation
+ * is almost the same as for the underlying operator, but we need a useOr
+ * flag to remember whether it's ANY or ALL, and we don't have to store
+ * the result type (or the collation) because it must be boolean.
+ */
+typedef struct ScalarArrayOpExpr
+{
+	Expr		xpr;
+	Oid			opno;			/* PG_OPERATOR OID of the operator */
+	Oid			opfuncid;		/* PG_PROC OID of underlying function */
+	bool		useOr;			/* true for ANY, false for ALL */
+	Oid			inputcollid;	/* OID of collation that operator should use */
+	List	   *args;			/* the scalar and array operands */
+	int			location;		/* token location, or -1 if unknown */
+} ScalarArrayOpExpr;
+
+/*
+ * BoolExpr - expression node for the basic Boolean operators AND, OR, NOT
+ *
+ * Notice the arguments are given as a List.  For NOT, of course the list
+ * must always have exactly one element.  For AND and OR, there can be two
+ * or more arguments.
+ */
+typedef enum BoolExprType
+{
+	AND_EXPR, OR_EXPR, NOT_EXPR
+} BoolExprType;
+
+typedef struct BoolExpr
+{
+	Expr		xpr;
+	BoolExprType boolop;
+	List	   *args;			/* arguments to this expression */
+	int			location;		/* token location, or -1 if unknown */
+} BoolExpr;
+
+/*
+ * SubLink
+ *
+ * A SubLink represents a subselect appearing in an expression, and in some
+ * cases also the combining operator(s) just above it.  The subLinkType
+ * indicates the form of the expression represented:
+ *	EXISTS_SUBLINK		EXISTS(SELECT ...)
+ *	ALL_SUBLINK			(lefthand) op ALL (SELECT ...)
+ *	ANY_SUBLINK			(lefthand) op ANY (SELECT ...)
+ *	ROWCOMPARE_SUBLINK	(lefthand) op (SELECT ...)
+ *	EXPR_SUBLINK		(SELECT with single targetlist item ...)
+ *	MULTIEXPR_SUBLINK	(SELECT with multiple targetlist items ...)
+ *	ARRAY_SUBLINK		ARRAY(SELECT with single targetlist item ...)
+ *	CTE_SUBLINK			WITH query (never actually part of an expression)
+ * For ALL, ANY, and ROWCOMPARE, the lefthand is a list of expressions of the
+ * same length as the subselect's targetlist.  ROWCOMPARE will *always* have
+ * a list with more than one entry; if the subselect has just one target
+ * then the parser will create an EXPR_SUBLINK instead (and any operator
+ * above the subselect will be represented separately).
+ * ROWCOMPARE, EXPR, and MULTIEXPR require the subselect to deliver at most
+ * one row (if it returns no rows, the result is NULL).
+ * ALL, ANY, and ROWCOMPARE require the combining operators to deliver boolean
+ * results.  ALL and ANY combine the per-row results using AND and OR
+ * semantics respectively.
+ * ARRAY requires just one target column, and creates an array of the target
+ * column's type using any number of rows resulting from the subselect.
+ *
+ * SubLink is classed as an Expr node, but it is not actually executable;
+ * it must be replaced in the expression tree by a SubPlan node during
+ * planning.
+ *
+ * NOTE: in the raw output of gram.y, testexpr contains just the raw form
+ * of the lefthand expression (if any), and operName is the String name of
+ * the combining operator.  Also, subselect is a raw parsetree.  During parse
+ * analysis, the parser transforms testexpr into a complete boolean expression
+ * that compares the lefthand value(s) to PARAM_SUBLINK nodes representing the
+ * output columns of the subselect.  And subselect is transformed to a Query.
+ * This is the representation seen in saved rules and in the rewriter.
+ *
+ * In EXISTS, EXPR, MULTIEXPR, and ARRAY SubLinks, testexpr and operName
+ * are unused and are always null.
+ *
+ * subLinkId is currently used only for MULTIEXPR SubLinks, and is zero in
+ * other SubLinks.  This number identifies different multiple-assignment
+ * subqueries within an UPDATE statement's SET list.  It is unique only
+ * within a particular targetlist.  The output column(s) of the MULTIEXPR
+ * are referenced by PARAM_MULTIEXPR Params appearing elsewhere in the tlist.
+ *
+ * The CTE_SUBLINK case never occurs in actual SubLink nodes, but it is used
+ * in SubPlans generated for WITH subqueries.
+ */
+typedef enum SubLinkType
+{
+	EXISTS_SUBLINK,
+	ALL_SUBLINK,
+	ANY_SUBLINK,
+	ROWCOMPARE_SUBLINK,
+	EXPR_SUBLINK,
+	MULTIEXPR_SUBLINK,
+	ARRAY_SUBLINK,
+	CTE_SUBLINK					/* for SubPlans only */
+} SubLinkType;
+
+
+typedef struct SubLink
+{
+	Expr		xpr;
+	SubLinkType subLinkType;	/* see above */
+	int			subLinkId;		/* ID (1..n); 0 if not MULTIEXPR */
+	Node	   *testexpr;		/* outer-query test for ALL/ANY/ROWCOMPARE */
+	List	   *operName;		/* originally specified operator name */
+	Node	   *subselect;		/* subselect as Query* or raw parsetree */
+	int			location;		/* token location, or -1 if unknown */
+} SubLink;
+
+/*
+ * SubPlan - executable expression node for a subplan (sub-SELECT)
+ *
+ * The planner replaces SubLink nodes in expression trees with SubPlan
+ * nodes after it has finished planning the subquery.  SubPlan references
+ * a sub-plantree stored in the subplans list of the toplevel PlannedStmt.
+ * (We avoid a direct link to make it easier to copy expression trees
+ * without causing multiple processing of the subplan.)
+ *
+ * In an ordinary subplan, testexpr points to an executable expression
+ * (OpExpr, an AND/OR tree of OpExprs, or RowCompareExpr) for the combining
+ * operator(s); the left-hand arguments are the original lefthand expressions,
+ * and the right-hand arguments are PARAM_EXEC Param nodes representing the
+ * outputs of the sub-select.  (NOTE: runtime coercion functions may be
+ * inserted as well.)  This is just the same expression tree as testexpr in
+ * the original SubLink node, but the PARAM_SUBLINK nodes are replaced by
+ * suitably numbered PARAM_EXEC nodes.
+ *
+ * If the sub-select becomes an initplan rather than a subplan, the executable
+ * expression is part of the outer plan's expression tree (and the SubPlan
+ * node itself is not, but rather is found in the outer plan's initPlan
+ * list).  In this case testexpr is NULL to avoid duplication.
+ *
+ * The planner also derives lists of the values that need to be passed into
+ * and out of the subplan.  Input values are represented as a list "args" of
+ * expressions to be evaluated in the outer-query context (currently these
+ * args are always just Vars, but in principle they could be any expression).
+ * The values are assigned to the global PARAM_EXEC params indexed by parParam
+ * (the parParam and args lists must have the same ordering).  setParam is a
+ * list of the PARAM_EXEC params that are computed by the sub-select, if it
+ * is an initplan; they are listed in order by sub-select output column
+ * position.  (parParam and setParam are integer Lists, not Bitmapsets,
+ * because their ordering is significant.)
+ *
+ * Also, the planner computes startup and per-call costs for use of the
+ * SubPlan.  Note that these include the cost of the subquery proper,
+ * evaluation of the testexpr if any, and any hashtable management overhead.
+ */
+typedef struct SubPlan
+{
+	Expr		xpr;
+	/* Fields copied from original SubLink: */
+	SubLinkType subLinkType;	/* see above */
+	/* The combining operators, transformed to an executable expression: */
+	Node	   *testexpr;		/* OpExpr or RowCompareExpr expression tree */
+	List	   *paramIds;		/* IDs of Params embedded in the above */
+	/* Identification of the Plan tree to use: */
+	int			plan_id;		/* Index (from 1) in PlannedStmt.subplans */
+	/* Identification of the SubPlan for EXPLAIN and debugging purposes: */
+	char	   *plan_name;		/* A name assigned during planning */
+	/* Extra data useful for determining subplan's output type: */
+	Oid			firstColType;	/* Type of first column of subplan result */
+	int32		firstColTypmod; /* Typmod of first column of subplan result */
+	Oid			firstColCollation;		/* Collation of first column of
+										 * subplan result */
+	/* Information about execution strategy: */
+	bool		useHashTable;	/* TRUE to store subselect output in a hash
+								 * table (implies we are doing "IN") */
+	bool		unknownEqFalse; /* TRUE if it's okay to return FALSE when the
+								 * spec result is UNKNOWN; this allows much
+								 * simpler handling of null values */
+	/* Information for passing params into and out of the subselect: */
+	/* setParam and parParam are lists of integers (param IDs) */
+	List	   *setParam;		/* initplan subqueries have to set these
+								 * Params for parent plan */
+	List	   *parParam;		/* indices of input Params from parent plan */
+	List	   *args;			/* exprs to pass as parParam values */
+	/* Estimated execution costs: */
+	Cost		startup_cost;	/* one-time setup cost */
+	Cost		per_call_cost;	/* cost for each subplan evaluation */
+} SubPlan;
+
+/*
+ * AlternativeSubPlan - expression node for a choice among SubPlans
+ *
+ * The subplans are given as a List so that the node definition need not
+ * change if there's ever more than two alternatives.  For the moment,
+ * though, there are always exactly two; and the first one is the fast-start
+ * plan.
+ */
+typedef struct AlternativeSubPlan
+{
+	Expr		xpr;
+	List	   *subplans;		/* SubPlan(s) with equivalent results */
+} AlternativeSubPlan;
+
+/* ----------------
+ * FieldSelect
+ *
+ * FieldSelect represents the operation of extracting one field from a tuple
+ * value.  At runtime, the input expression is expected to yield a rowtype
+ * Datum.  The specified field number is extracted and returned as a Datum.
+ * ----------------
+ */
+
+typedef struct FieldSelect
+{
+	Expr		xpr;
+	Expr	   *arg;			/* input expression */
+	AttrNumber	fieldnum;		/* attribute number of field to extract */
+	Oid			resulttype;		/* type of the field (result type of this
+								 * node) */
+	int32		resulttypmod;	/* output typmod (usually -1) */
+	Oid			resultcollid;	/* OID of collation of the field */
+} FieldSelect;
+
+/* ----------------
+ * FieldStore
+ *
+ * FieldStore represents the operation of modifying one field in a tuple
+ * value, yielding a new tuple value (the input is not touched!).  Like
+ * the assign case of ArrayRef, this is used to implement UPDATE of a
+ * portion of a column.
+ *
+ * A single FieldStore can actually represent updates of several different
+ * fields.  The parser only generates FieldStores with single-element lists,
+ * but the planner will collapse multiple updates of the same base column
+ * into one FieldStore.
+ * ----------------
+ */
+
+typedef struct FieldStore
+{
+	Expr		xpr;
+	Expr	   *arg;			/* input tuple value */
+	List	   *newvals;		/* new value(s) for field(s) */
+	List	   *fieldnums;		/* integer list of field attnums */
+	Oid			resulttype;		/* type of result (same as type of arg) */
+	/* Like RowExpr, we deliberately omit a typmod and collation here */
+} FieldStore;
+
+/* ----------------
+ * RelabelType
+ *
+ * RelabelType represents a "dummy" type coercion between two binary-
+ * compatible datatypes, such as reinterpreting the result of an OID
+ * expression as an int4.  It is a no-op at runtime; we only need it
+ * to provide a place to store the correct type to be attributed to
+ * the expression result during type resolution.  (We can't get away
+ * with just overwriting the type field of the input expression node,
+ * so we need a separate node to show the coercion's result type.)
+ * ----------------
+ */
+
+typedef struct RelabelType
+{
+	Expr		xpr;
+	Expr	   *arg;			/* input expression */
+	Oid			resulttype;		/* output type of coercion expression */
+	int32		resulttypmod;	/* output typmod (usually -1) */
+	Oid			resultcollid;	/* OID of collation, or InvalidOid if none */
+	CoercionForm relabelformat; /* how to display this node */
+	int			location;		/* token location, or -1 if unknown */
+} RelabelType;
+
+/* ----------------
+ * CoerceViaIO
+ *
+ * CoerceViaIO represents a type coercion between two types whose textual
+ * representations are compatible, implemented by invoking the source type's
+ * typoutput function then the destination type's typinput function.
+ * ----------------
+ */
+
+typedef struct CoerceViaIO
+{
+	Expr		xpr;
+	Expr	   *arg;			/* input expression */
+	Oid			resulttype;		/* output type of coercion */
+	/* output typmod is not stored, but is presumed -1 */
+	Oid			resultcollid;	/* OID of collation, or InvalidOid if none */
+	CoercionForm coerceformat;	/* how to display this node */
+	int			location;		/* token location, or -1 if unknown */
+} CoerceViaIO;
+
+/* ----------------
+ * ArrayCoerceExpr
+ *
+ * ArrayCoerceExpr represents a type coercion from one array type to another,
+ * which is implemented by applying the indicated element-type coercion
+ * function to each element of the source array.  If elemfuncid is InvalidOid
+ * then the element types are binary-compatible, but the coercion still
+ * requires some effort (we have to fix the element type ID stored in the
+ * array header).
+ * ----------------
+ */
+
+typedef struct ArrayCoerceExpr
+{
+	Expr		xpr;
+	Expr	   *arg;			/* input expression (yields an array) */
+	Oid			elemfuncid;		/* OID of element coercion function, or 0 */
+	Oid			resulttype;		/* output type of coercion (an array type) */
+	int32		resulttypmod;	/* output typmod (also element typmod) */
+	Oid			resultcollid;	/* OID of collation, or InvalidOid if none */
+	bool		isExplicit;		/* conversion semantics flag to pass to func */
+	CoercionForm coerceformat;	/* how to display this node */
+	int			location;		/* token location, or -1 if unknown */
+} ArrayCoerceExpr;
+
+/* ----------------
+ * ConvertRowtypeExpr
+ *
+ * ConvertRowtypeExpr represents a type coercion from one composite type
+ * to another, where the source type is guaranteed to contain all the columns
+ * needed for the destination type plus possibly others; the columns need not
+ * be in the same positions, but are matched up by name.  This is primarily
+ * used to convert a whole-row value of an inheritance child table into a
+ * valid whole-row value of its parent table's rowtype.
+ * ----------------
+ */
+
+typedef struct ConvertRowtypeExpr
+{
+	Expr		xpr;
+	Expr	   *arg;			/* input expression */
+	Oid			resulttype;		/* output type (always a composite type) */
+	/* Like RowExpr, we deliberately omit a typmod and collation here */
+	CoercionForm convertformat; /* how to display this node */
+	int			location;		/* token location, or -1 if unknown */
+} ConvertRowtypeExpr;
+
+/*----------
+ * CollateExpr - COLLATE
+ *
+ * The planner replaces CollateExpr with RelabelType during expression
+ * preprocessing, so execution never sees a CollateExpr.
+ *----------
+ */
+typedef struct CollateExpr
+{
+	Expr		xpr;
+	Expr	   *arg;			/* input expression */
+	Oid			collOid;		/* collation's OID */
+	int			location;		/* token location, or -1 if unknown */
+} CollateExpr;
+
+/*----------
+ * CaseExpr - a CASE expression
+ *
+ * We support two distinct forms of CASE expression:
+ *		CASE WHEN boolexpr THEN expr [ WHEN boolexpr THEN expr ... ]
+ *		CASE testexpr WHEN compexpr THEN expr [ WHEN compexpr THEN expr ... ]
+ * These are distinguishable by the "arg" field being NULL in the first case
+ * and the testexpr in the second case.
+ *
+ * In the raw grammar output for the second form, the condition expressions
+ * of the WHEN clauses are just the comparison values.  Parse analysis
+ * converts these to valid boolean expressions of the form
+ *		CaseTestExpr '=' compexpr
+ * where the CaseTestExpr node is a placeholder that emits the correct
+ * value at runtime.  This structure is used so that the testexpr need be
+ * evaluated only once.  Note that after parse analysis, the condition
+ * expressions always yield boolean.
+ *
+ * Note: we can test whether a CaseExpr has been through parse analysis
+ * yet by checking whether casetype is InvalidOid or not.
+ *----------
+ */
+typedef struct CaseExpr
+{
+	Expr		xpr;
+	Oid			casetype;		/* type of expression result */
+	Oid			casecollid;		/* OID of collation, or InvalidOid if none */
+	Expr	   *arg;			/* implicit equality comparison argument */
+	List	   *args;			/* the arguments (list of WHEN clauses) */
+	Expr	   *defresult;		/* the default result (ELSE clause) */
+	int			location;		/* token location, or -1 if unknown */
+} CaseExpr;
+
+/*
+ * CaseWhen - one arm of a CASE expression
+ */
+typedef struct CaseWhen
+{
+	Expr		xpr;
+	Expr	   *expr;			/* condition expression */
+	Expr	   *result;			/* substitution result */
+	int			location;		/* token location, or -1 if unknown */
+} CaseWhen;
+
+/*
+ * Placeholder node for the test value to be processed by a CASE expression.
+ * This is effectively like a Param, but can be implemented more simply
+ * since we need only one replacement value at a time.
+ *
+ * We also use this in nested UPDATE expressions.
+ * See transformAssignmentIndirection().
+ */
+typedef struct CaseTestExpr
+{
+	Expr		xpr;
+	Oid			typeId;			/* type for substituted value */
+	int32		typeMod;		/* typemod for substituted value */
+	Oid			collation;		/* collation for the substituted value */
+} CaseTestExpr;
+
+/*
+ * ArrayExpr - an ARRAY[] expression
+ *
+ * Note: if multidims is false, the constituent expressions all yield the
+ * scalar type identified by element_typeid.  If multidims is true, the
+ * constituent expressions all yield arrays of element_typeid (ie, the same
+ * type as array_typeid); at runtime we must check for compatible subscripts.
+ */
+typedef struct ArrayExpr
+{
+	Expr		xpr;
+	Oid			array_typeid;	/* type of expression result */
+	Oid			array_collid;	/* OID of collation, or InvalidOid if none */
+	Oid			element_typeid; /* common type of array elements */
+	List	   *elements;		/* the array elements or sub-arrays */
+	bool		multidims;		/* true if elements are sub-arrays */
+	int			location;		/* token location, or -1 if unknown */
+} ArrayExpr;
+
+/*
+ * RowExpr - a ROW() expression
+ *
+ * Note: the list of fields must have a one-for-one correspondence with
+ * physical fields of the associated rowtype, although it is okay for it
+ * to be shorter than the rowtype.  That is, the N'th list element must
+ * match up with the N'th physical field.  When the N'th physical field
+ * is a dropped column (attisdropped) then the N'th list element can just
+ * be a NULL constant.  (This case can only occur for named composite types,
+ * not RECORD types, since those are built from the RowExpr itself rather
+ * than vice versa.)  It is important not to assume that length(args) is
+ * the same as the number of columns logically present in the rowtype.
+ *
+ * colnames provides field names in cases where the names can't easily be
+ * obtained otherwise.  Names *must* be provided if row_typeid is RECORDOID.
+ * If row_typeid identifies a known composite type, colnames can be NIL to
+ * indicate the type's cataloged field names apply.  Note that colnames can
+ * be non-NIL even for a composite type, and typically is when the RowExpr
+ * was created by expanding a whole-row Var.  This is so that we can retain
+ * the column alias names of the RTE that the Var referenced (which would
+ * otherwise be very difficult to extract from the parsetree).  Like the
+ * args list, colnames is one-for-one with physical fields of the rowtype.
+ */
+typedef struct RowExpr
+{
+	Expr		xpr;
+	List	   *args;			/* the fields */
+	Oid			row_typeid;		/* RECORDOID or a composite type's ID */
+
+	/*
+	 * Note: we deliberately do NOT store a typmod.  Although a typmod will be
+	 * associated with specific RECORD types at runtime, it will differ for
+	 * different backends, and so cannot safely be stored in stored
+	 * parsetrees.  We must assume typmod -1 for a RowExpr node.
+	 *
+	 * We don't need to store a collation either.  The result type is
+	 * necessarily composite, and composite types never have a collation.
+	 */
+	CoercionForm row_format;	/* how to display this node */
+	List	   *colnames;		/* list of String, or NIL */
+	int			location;		/* token location, or -1 if unknown */
+} RowExpr;
+
+/*
+ * RowCompareExpr - row-wise comparison, such as (a, b) <= (1, 2)
+ *
+ * We support row comparison for any operator that can be determined to
+ * act like =, <>, <, <=, >, or >= (we determine this by looking for the
+ * operator in btree opfamilies).  Note that the same operator name might
+ * map to a different operator for each pair of row elements, since the
+ * element datatypes can vary.
+ *
+ * A RowCompareExpr node is only generated for the < <= > >= cases;
+ * the = and <> cases are translated to simple AND or OR combinations
+ * of the pairwise comparisons.  However, we include = and <> in the
+ * RowCompareType enum for the convenience of parser logic.
+ */
+typedef enum RowCompareType
+{
+	/* Values of this enum are chosen to match btree strategy numbers */
+	ROWCOMPARE_LT = 1,			/* BTLessStrategyNumber */
+	ROWCOMPARE_LE = 2,			/* BTLessEqualStrategyNumber */
+	ROWCOMPARE_EQ = 3,			/* BTEqualStrategyNumber */
+	ROWCOMPARE_GE = 4,			/* BTGreaterEqualStrategyNumber */
+	ROWCOMPARE_GT = 5,			/* BTGreaterStrategyNumber */
+	ROWCOMPARE_NE = 6			/* no such btree strategy */
+} RowCompareType;
+
+typedef struct RowCompareExpr
+{
+	Expr		xpr;
+	RowCompareType rctype;		/* LT LE GE or GT, never EQ or NE */
+	List	   *opnos;			/* OID list of pairwise comparison ops */
+	List	   *opfamilies;		/* OID list of containing operator families */
+	List	   *inputcollids;	/* OID list of collations for comparisons */
+	List	   *largs;			/* the left-hand input arguments */
+	List	   *rargs;			/* the right-hand input arguments */
+} RowCompareExpr;
+
+/*
+ * CoalesceExpr - a COALESCE expression
+ */
+typedef struct CoalesceExpr
+{
+	Expr		xpr;
+	Oid			coalescetype;	/* type of expression result */
+	Oid			coalescecollid; /* OID of collation, or InvalidOid if none */
+	List	   *args;			/* the arguments */
+	int			location;		/* token location, or -1 if unknown */
+} CoalesceExpr;
+
+/*
+ * MinMaxExpr - a GREATEST or LEAST function
+ */
+typedef enum MinMaxOp
+{
+	IS_GREATEST,
+	IS_LEAST
+} MinMaxOp;
+
+typedef struct MinMaxExpr
+{
+	Expr		xpr;
+	Oid			minmaxtype;		/* common type of arguments and result */
+	Oid			minmaxcollid;	/* OID of collation of result */
+	Oid			inputcollid;	/* OID of collation that function should use */
+	MinMaxOp	op;				/* function to execute */
+	List	   *args;			/* the arguments */
+	int			location;		/* token location, or -1 if unknown */
+} MinMaxExpr;
+
+/*
+ * XmlExpr - various SQL/XML functions requiring special grammar productions
+ *
+ * 'name' carries the "NAME foo" argument (already XML-escaped).
+ * 'named_args' and 'arg_names' represent an xml_attribute list.
+ * 'args' carries all other arguments.
+ *
+ * Note: result type/typmod/collation are not stored, but can be deduced
+ * from the XmlExprOp.  The type/typmod fields are just used for display
+ * purposes, and are NOT necessarily the true result type of the node.
+ */
+typedef enum XmlExprOp
+{
+	IS_XMLCONCAT,				/* XMLCONCAT(args) */
+	IS_XMLELEMENT,				/* XMLELEMENT(name, xml_attributes, args) */
+	IS_XMLFOREST,				/* XMLFOREST(xml_attributes) */
+	IS_XMLPARSE,				/* XMLPARSE(text, is_doc, preserve_ws) */
+	IS_XMLPI,					/* XMLPI(name [, args]) */
+	IS_XMLROOT,					/* XMLROOT(xml, version, standalone) */
+	IS_XMLSERIALIZE,			/* XMLSERIALIZE(is_document, xmlval) */
+	IS_DOCUMENT					/* xmlval IS DOCUMENT */
+} XmlExprOp;
+
+typedef enum
+{
+	XMLOPTION_DOCUMENT,
+	XMLOPTION_CONTENT
+} XmlOptionType;
+
+typedef struct XmlExpr
+{
+	Expr		xpr;
+	XmlExprOp	op;				/* xml function ID */
+	char	   *name;			/* name in xml(NAME foo ...) syntaxes */
+	List	   *named_args;		/* non-XML expressions for xml_attributes */
+	List	   *arg_names;		/* parallel list of Value strings */
+	List	   *args;			/* list of expressions */
+	XmlOptionType xmloption;	/* DOCUMENT or CONTENT */
+	Oid			type;			/* target type/typmod for XMLSERIALIZE */
+	int32		typmod;
+	int			location;		/* token location, or -1 if unknown */
+} XmlExpr;
+
+/* ----------------
+ * NullTest
+ *
+ * NullTest represents the operation of testing a value for NULLness.
+ * The appropriate test is performed and returned as a boolean Datum.
+ *
+ * NOTE: the semantics of this for rowtype inputs are noticeably different
+ * from the scalar case.  We provide an "argisrow" flag to reflect that.
+ * ----------------
+ */
+
+typedef enum NullTestType
+{
+	IS_NULL, IS_NOT_NULL
+} NullTestType;
+
+typedef struct NullTest
+{
+	Expr		xpr;
+	Expr	   *arg;			/* input expression */
+	NullTestType nulltesttype;	/* IS NULL, IS NOT NULL */
+	bool		argisrow;		/* T if input is of a composite type */
+	int			location;		/* token location, or -1 if unknown */
+} NullTest;
+
+/*
+ * BooleanTest
+ *
+ * BooleanTest represents the operation of determining whether a boolean
+ * is TRUE, FALSE, or UNKNOWN (ie, NULL).  All six meaningful combinations
+ * are supported.  Note that a NULL input does *not* cause a NULL result.
+ * The appropriate test is performed and returned as a boolean Datum.
+ */
+
+typedef enum BoolTestType
+{
+	IS_TRUE, IS_NOT_TRUE, IS_FALSE, IS_NOT_FALSE, IS_UNKNOWN, IS_NOT_UNKNOWN
+} BoolTestType;
+
+typedef struct BooleanTest
+{
+	Expr		xpr;
+	Expr	   *arg;			/* input expression */
+	BoolTestType booltesttype;	/* test type */
+	int			location;		/* token location, or -1 if unknown */
+} BooleanTest;
+
+/*
+ * CoerceToDomain
+ *
+ * CoerceToDomain represents the operation of coercing a value to a domain
+ * type.  At runtime (and not before) the precise set of constraints to be
+ * checked will be determined.  If the value passes, it is returned as the
+ * result; if not, an error is raised.  Note that this is equivalent to
+ * RelabelType in the scenario where no constraints are applied.
+ */
+typedef struct CoerceToDomain
+{
+	Expr		xpr;
+	Expr	   *arg;			/* input expression */
+	Oid			resulttype;		/* domain type ID (result type) */
+	int32		resulttypmod;	/* output typmod (currently always -1) */
+	Oid			resultcollid;	/* OID of collation, or InvalidOid if none */
+	CoercionForm coercionformat;	/* how to display this node */
+	int			location;		/* token location, or -1 if unknown */
+} CoerceToDomain;
+
+/*
+ * Placeholder node for the value to be processed by a domain's check
+ * constraint.  This is effectively like a Param, but can be implemented more
+ * simply since we need only one replacement value at a time.
+ *
+ * Note: the typeId/typeMod/collation will be set from the domain's base type,
+ * not the domain itself.  This is because we shouldn't consider the value
+ * to be a member of the domain if we haven't yet checked its constraints.
+ */
+typedef struct CoerceToDomainValue
+{
+	Expr		xpr;
+	Oid			typeId;			/* type for substituted value */
+	int32		typeMod;		/* typemod for substituted value */
+	Oid			collation;		/* collation for the substituted value */
+	int			location;		/* token location, or -1 if unknown */
+} CoerceToDomainValue;
+
+/*
+ * Placeholder node for a DEFAULT marker in an INSERT or UPDATE command.
+ *
+ * This is not an executable expression: it must be replaced by the actual
+ * column default expression during rewriting.  But it is convenient to
+ * treat it as an expression node during parsing and rewriting.
+ */
+typedef struct SetToDefault
+{
+	Expr		xpr;
+	Oid			typeId;			/* type for substituted value */
+	int32		typeMod;		/* typemod for substituted value */
+	Oid			collation;		/* collation for the substituted value */
+	int			location;		/* token location, or -1 if unknown */
+} SetToDefault;
+
+/*
+ * Node representing [WHERE] CURRENT OF cursor_name
+ *
+ * CURRENT OF is a bit like a Var, in that it carries the rangetable index
+ * of the target relation being constrained; this aids placing the expression
+ * correctly during planning.  We can assume however that its "levelsup" is
+ * always zero, due to the syntactic constraints on where it can appear.
+ *
+ * The referenced cursor can be represented either as a hardwired string
+ * or as a reference to a run-time parameter of type REFCURSOR.  The latter
+ * case is for the convenience of plpgsql.
+ */
+typedef struct CurrentOfExpr
+{
+	Expr		xpr;
+	Index		cvarno;			/* RT index of target relation */
+	char	   *cursor_name;	/* name of referenced cursor, or NULL */
+	int			cursor_param;	/* refcursor parameter number, or 0 */
+} CurrentOfExpr;
+
+/*
+ * InferenceElem - an element of a unique index inference specification
+ *
+ * This mostly matches the structure of IndexElems, but having a dedicated
+ * primnode allows for a clean separation between the use of index parameters
+ * by utility commands, and this node.
+ */
+typedef struct InferenceElem
+{
+	Expr		xpr;
+	Node	   *expr;			/* expression to infer from, or NULL */
+	Oid			infercollid;	/* OID of collation, or InvalidOid */
+	Oid			inferopclass;	/* OID of att opclass, or InvalidOid */
+} InferenceElem;
+
+/*--------------------
+ * TargetEntry -
+ *	   a target entry (used in query target lists)
+ *
+ * Strictly speaking, a TargetEntry isn't an expression node (since it can't
+ * be evaluated by ExecEvalExpr).  But we treat it as one anyway, since in
+ * very many places it's convenient to process a whole query targetlist as a
+ * single expression tree.
+ *
+ * In a SELECT's targetlist, resno should always be equal to the item's
+ * ordinal position (counting from 1).  However, in an INSERT or UPDATE
+ * targetlist, resno represents the attribute number of the destination
+ * column for the item; so there may be missing or out-of-order resnos.
+ * It is even legal to have duplicated resnos; consider
+ *		UPDATE table SET arraycol[1] = ..., arraycol[2] = ..., ...
+ * The two meanings come together in the executor, because the planner
+ * transforms INSERT/UPDATE tlists into a normalized form with exactly
+ * one entry for each column of the destination table.  Before that's
+ * happened, however, it is risky to assume that resno == position.
+ * Generally get_tle_by_resno() should be used rather than list_nth()
+ * to fetch tlist entries by resno, and only in SELECT should you assume
+ * that resno is a unique identifier.
+ *
+ * resname is required to represent the correct column name in non-resjunk
+ * entries of top-level SELECT targetlists, since it will be used as the
+ * column title sent to the frontend.  In most other contexts it is only
+ * a debugging aid, and may be wrong or even NULL.  (In particular, it may
+ * be wrong in a tlist from a stored rule, if the referenced column has been
+ * renamed by ALTER TABLE since the rule was made.  Also, the planner tends
+ * to store NULL rather than look up a valid name for tlist entries in
+ * non-toplevel plan nodes.)  In resjunk entries, resname should be either
+ * a specific system-generated name (such as "ctid") or NULL; anything else
+ * risks confusing ExecGetJunkAttribute!
+ *
+ * ressortgroupref is used in the representation of ORDER BY, GROUP BY, and
+ * DISTINCT items.  Targetlist entries with ressortgroupref=0 are not
+ * sort/group items.  If ressortgroupref>0, then this item is an ORDER BY,
+ * GROUP BY, and/or DISTINCT target value.  No two entries in a targetlist
+ * may have the same nonzero ressortgroupref --- but there is no particular
+ * meaning to the nonzero values, except as tags.  (For example, one must
+ * not assume that lower ressortgroupref means a more significant sort key.)
+ * The order of the associated SortGroupClause lists determine the semantics.
+ *
+ * resorigtbl/resorigcol identify the source of the column, if it is a
+ * simple reference to a column of a base table (or view).  If it is not
+ * a simple reference, these fields are zeroes.
+ *
+ * If resjunk is true then the column is a working column (such as a sort key)
+ * that should be removed from the final output of the query.  Resjunk columns
+ * must have resnos that cannot duplicate any regular column's resno.  Also
+ * note that there are places that assume resjunk columns come after non-junk
+ * columns.
+ *--------------------
+ */
+typedef struct TargetEntry
+{
+	Expr		xpr;
+	Expr	   *expr;			/* expression to evaluate */
+	AttrNumber	resno;			/* attribute number (see notes above) */
+	char	   *resname;		/* name of the column (could be NULL) */
+	Index		ressortgroupref;/* nonzero if referenced by a sort/group
+								 * clause */
+	Oid			resorigtbl;		/* OID of column's source table */
+	AttrNumber	resorigcol;		/* column's number in source table */
+	bool		resjunk;		/* set to true to eliminate the attribute from
+								 * final target list */
+} TargetEntry;
+
+
+/* ----------------------------------------------------------------
+ *					node types for join trees
+ *
+ * The leaves of a join tree structure are RangeTblRef nodes.  Above
+ * these, JoinExpr nodes can appear to denote a specific kind of join
+ * or qualified join.  Also, FromExpr nodes can appear to denote an
+ * ordinary cross-product join ("FROM foo, bar, baz WHERE ...").
+ * FromExpr is like a JoinExpr of jointype JOIN_INNER, except that it
+ * may have any number of child nodes, not just two.
+ *
+ * NOTE: the top level of a Query's jointree is always a FromExpr.
+ * Even if the jointree contains no rels, there will be a FromExpr.
+ *
+ * NOTE: the qualification expressions present in JoinExpr nodes are
+ * *in addition to* the query's main WHERE clause, which appears as the
+ * qual of the top-level FromExpr.  The reason for associating quals with
+ * specific nodes in the jointree is that the position of a qual is critical
+ * when outer joins are present.  (If we enforce a qual too soon or too late,
+ * that may cause the outer join to produce the wrong set of NULL-extended
+ * rows.)  If all joins are inner joins then all the qual positions are
+ * semantically interchangeable.
+ *
+ * NOTE: in the raw output of gram.y, a join tree contains RangeVar,
+ * RangeSubselect, and RangeFunction nodes, which are all replaced by
+ * RangeTblRef nodes during the parse analysis phase.  Also, the top-level
+ * FromExpr is added during parse analysis; the grammar regards FROM and
+ * WHERE as separate.
+ * ----------------------------------------------------------------
+ */
+
+/*
+ * RangeTblRef - reference to an entry in the query's rangetable
+ *
+ * We could use direct pointers to the RT entries and skip having these
+ * nodes, but multiple pointers to the same node in a querytree cause
+ * lots of headaches, so it seems better to store an index into the RT.
+ */
+typedef struct RangeTblRef
+{
+	NodeTag		type;
+	int			rtindex;
+} RangeTblRef;
+
+/*----------
+ * JoinExpr - for SQL JOIN expressions
+ *
+ * isNatural, usingClause, and quals are interdependent.  The user can write
+ * only one of NATURAL, USING(), or ON() (this is enforced by the grammar).
+ * If he writes NATURAL then parse analysis generates the equivalent USING()
+ * list, and from that fills in "quals" with the right equality comparisons.
+ * If he writes USING() then "quals" is filled with equality comparisons.
+ * If he writes ON() then only "quals" is set.  Note that NATURAL/USING
+ * are not equivalent to ON() since they also affect the output column list.
+ *
+ * alias is an Alias node representing the AS alias-clause attached to the
+ * join expression, or NULL if no clause.  NB: presence or absence of the
+ * alias has a critical impact on semantics, because a join with an alias
+ * restricts visibility of the tables/columns inside it.
+ *
+ * During parse analysis, an RTE is created for the Join, and its index
+ * is filled into rtindex.  This RTE is present mainly so that Vars can
+ * be created that refer to the outputs of the join.  The planner sometimes
+ * generates JoinExprs internally; these can have rtindex = 0 if there are
+ * no join alias variables referencing such joins.
+ *----------
+ */
+typedef struct JoinExpr
+{
+	NodeTag		type;
+	JoinType	jointype;		/* type of join */
+	bool		isNatural;		/* Natural join? Will need to shape table */
+	Node	   *larg;			/* left subtree */
+	Node	   *rarg;			/* right subtree */
+	List	   *usingClause;	/* USING clause, if any (list of String) */
+	Node	   *quals;			/* qualifiers on join, if any */
+	Alias	   *alias;			/* user-written alias clause, if any */
+	int			rtindex;		/* RT index assigned for join, or 0 */
+} JoinExpr;
+
+/*----------
+ * FromExpr - represents a FROM ... WHERE ... construct
+ *
+ * This is both more flexible than a JoinExpr (it can have any number of
+ * children, including zero) and less so --- we don't need to deal with
+ * aliases and so on.  The output column set is implicitly just the union
+ * of the outputs of the children.
+ *----------
+ */
+typedef struct FromExpr
+{
+	NodeTag		type;
+	List	   *fromlist;		/* List of join subtrees */
+	Node	   *quals;			/* qualifiers on join, if any */
+} FromExpr;
+
+/*----------
+ * OnConflictExpr - represents an ON CONFLICT DO ... expression
+ *
+ * The optimizer requires a list of inference elements, and optionally a WHERE
+ * clause to infer a unique index.  The unique index (or, occasionally,
+ * indexes) inferred are used to arbitrate whether or not the alternative ON
+ * CONFLICT path is taken.
+ *----------
+ */
+typedef struct OnConflictExpr
+{
+	NodeTag		type;
+	OnConflictAction action;	/* DO NOTHING or UPDATE? */
+
+	/* Arbiter */
+	List	   *arbiterElems;	/* unique index arbiter list (of
+								 * InferenceElem's) */
+	Node	   *arbiterWhere;	/* unique index arbiter WHERE clause */
+	Oid			constraint;		/* pg_constraint OID for arbiter */
+
+	/* ON CONFLICT UPDATE */
+	List	   *onConflictSet;	/* List of ON CONFLICT SET TargetEntrys */
+	Node	   *onConflictWhere;	/* qualifiers to restrict UPDATE to */
+	int			exclRelIndex;	/* RT index of 'excluded' relation */
+	List	   *exclRelTlist;	/* tlist of the EXCLUDED pseudo relation */
+} OnConflictExpr;
+
+#endif   /* PRIMNODES_H */
diff --git a/foreign/libpg_query/src/postgres/include/nodes/print.h b/foreign/libpg_query/src/postgres/include/nodes/print.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/nodes/print.h
@@ -0,0 +1,34 @@
+/*-------------------------------------------------------------------------
+ *
+ * print.h
+ *	  definitions for nodes/print.c
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/nodes/print.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PRINT_H
+#define PRINT_H
+
+#include "executor/tuptable.h"
+
+
+#define nodeDisplay(x)		pprint(x)
+
+extern void print(const void *obj);
+extern void pprint(const void *obj);
+extern void elog_node_display(int lev, const char *title,
+				  const void *obj, bool pretty);
+extern char *format_node_dump(const char *dump);
+extern char *pretty_format_node_dump(const char *dump);
+extern void print_rt(const List *rtable);
+extern void print_expr(const Node *expr, const List *rtable);
+extern void print_pathkeys(const List *pathkeys, const List *rtable);
+extern void print_tl(const List *tlist, const List *rtable);
+extern void print_slot(TupleTableSlot *slot);
+
+#endif   /* PRINT_H */
diff --git a/foreign/libpg_query/src/postgres/include/nodes/relation.h b/foreign/libpg_query/src/postgres/include/nodes/relation.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/nodes/relation.h
@@ -0,0 +1,1706 @@
+/*-------------------------------------------------------------------------
+ *
+ * relation.h
+ *	  Definitions for planner's internal data structures.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/nodes/relation.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef RELATION_H
+#define RELATION_H
+
+#include "access/sdir.h"
+#include "lib/stringinfo.h"
+#include "nodes/params.h"
+#include "nodes/parsenodes.h"
+#include "storage/block.h"
+
+
+/*
+ * Relids
+ *		Set of relation identifiers (indexes into the rangetable).
+ */
+typedef Bitmapset *Relids;
+
+/*
+ * When looking for a "cheapest path", this enum specifies whether we want
+ * cheapest startup cost or cheapest total cost.
+ */
+typedef enum CostSelector
+{
+	STARTUP_COST, TOTAL_COST
+} CostSelector;
+
+/*
+ * The cost estimate produced by cost_qual_eval() includes both a one-time
+ * (startup) cost, and a per-tuple cost.
+ */
+typedef struct QualCost
+{
+	Cost		startup;		/* one-time cost */
+	Cost		per_tuple;		/* per-evaluation cost */
+} QualCost;
+
+/*
+ * Costing aggregate function execution requires these statistics about
+ * the aggregates to be executed by a given Agg node.  Note that the costs
+ * include the execution costs of the aggregates' argument expressions as
+ * well as the aggregate functions themselves.
+ */
+typedef struct AggClauseCosts
+{
+	int			numAggs;		/* total number of aggregate functions */
+	int			numOrderedAggs; /* number w/ DISTINCT/ORDER BY/WITHIN GROUP */
+	QualCost	transCost;		/* total per-input-row execution costs */
+	Cost		finalCost;		/* total per-aggregated-row costs */
+	Size		transitionSpace;	/* space for pass-by-ref transition data */
+} AggClauseCosts;
+
+
+/*----------
+ * PlannerGlobal
+ *		Global information for planning/optimization
+ *
+ * PlannerGlobal holds state for an entire planner invocation; this state
+ * is shared across all levels of sub-Queries that exist in the command being
+ * planned.
+ *----------
+ */
+typedef struct PlannerGlobal
+{
+	NodeTag		type;
+
+	ParamListInfo boundParams;	/* Param values provided to planner() */
+
+	List	   *subplans;		/* Plans for SubPlan nodes */
+
+	List	   *subroots;		/* PlannerInfos for SubPlan nodes */
+
+	Bitmapset  *rewindPlanIDs;	/* indices of subplans that require REWIND */
+
+	List	   *finalrtable;	/* "flat" rangetable for executor */
+
+	List	   *finalrowmarks;	/* "flat" list of PlanRowMarks */
+
+	List	   *resultRelations;	/* "flat" list of integer RT indexes */
+
+	List	   *relationOids;	/* OIDs of relations the plan depends on */
+
+	List	   *invalItems;		/* other dependencies, as PlanInvalItems */
+
+	int			nParamExec;		/* number of PARAM_EXEC Params used */
+
+	Index		lastPHId;		/* highest PlaceHolderVar ID assigned */
+
+	Index		lastRowMarkId;	/* highest PlanRowMark ID assigned */
+
+	bool		transientPlan;	/* redo plan when TransactionXmin changes? */
+
+	bool		hasRowSecurity; /* row security applied? */
+} PlannerGlobal;
+
+/* macro for fetching the Plan associated with a SubPlan node */
+#define planner_subplan_get_plan(root, subplan) \
+	((Plan *) list_nth((root)->glob->subplans, (subplan)->plan_id - 1))
+
+
+/*----------
+ * PlannerInfo
+ *		Per-query information for planning/optimization
+ *
+ * This struct is conventionally called "root" in all the planner routines.
+ * It holds links to all of the planner's working state, in addition to the
+ * original Query.  Note that at present the planner extensively modifies
+ * the passed-in Query data structure; someday that should stop.
+ *----------
+ */
+typedef struct PlannerInfo
+{
+	NodeTag		type;
+
+	Query	   *parse;			/* the Query being planned */
+
+	PlannerGlobal *glob;		/* global info for current planner run */
+
+	Index		query_level;	/* 1 at the outermost Query */
+
+	struct PlannerInfo *parent_root;	/* NULL at outermost Query */
+
+	List	   *plan_params;	/* list of PlannerParamItems, see below */
+
+	/*
+	 * simple_rel_array holds pointers to "base rels" and "other rels" (see
+	 * comments for RelOptInfo for more info).  It is indexed by rangetable
+	 * index (so entry 0 is always wasted).  Entries can be NULL when an RTE
+	 * does not correspond to a base relation, such as a join RTE or an
+	 * unreferenced view RTE; or if the RelOptInfo hasn't been made yet.
+	 */
+	struct RelOptInfo **simple_rel_array;		/* All 1-rel RelOptInfos */
+	int			simple_rel_array_size;	/* allocated size of array */
+
+	/*
+	 * simple_rte_array is the same length as simple_rel_array and holds
+	 * pointers to the associated rangetable entries.  This lets us avoid
+	 * rt_fetch(), which can be a bit slow once large inheritance sets have
+	 * been expanded.
+	 */
+	RangeTblEntry **simple_rte_array;	/* rangetable as an array */
+
+	/*
+	 * all_baserels is a Relids set of all base relids (but not "other"
+	 * relids) in the query; that is, the Relids identifier of the final join
+	 * we need to form.  This is computed in make_one_rel, just before we
+	 * start making Paths.
+	 */
+	Relids		all_baserels;
+
+	/*
+	 * nullable_baserels is a Relids set of base relids that are nullable by
+	 * some outer join in the jointree; these are rels that are potentially
+	 * nullable below the WHERE clause, SELECT targetlist, etc.  This is
+	 * computed in deconstruct_jointree.
+	 */
+	Relids		nullable_baserels;
+
+	/*
+	 * join_rel_list is a list of all join-relation RelOptInfos we have
+	 * considered in this planning run.  For small problems we just scan the
+	 * list to do lookups, but when there are many join relations we build a
+	 * hash table for faster lookups.  The hash table is present and valid
+	 * when join_rel_hash is not NULL.  Note that we still maintain the list
+	 * even when using the hash table for lookups; this simplifies life for
+	 * GEQO.
+	 */
+	List	   *join_rel_list;	/* list of join-relation RelOptInfos */
+	struct HTAB *join_rel_hash; /* optional hashtable for join relations */
+
+	/*
+	 * When doing a dynamic-programming-style join search, join_rel_level[k]
+	 * is a list of all join-relation RelOptInfos of level k, and
+	 * join_cur_level is the current level.  New join-relation RelOptInfos are
+	 * automatically added to the join_rel_level[join_cur_level] list.
+	 * join_rel_level is NULL if not in use.
+	 */
+	List	  **join_rel_level; /* lists of join-relation RelOptInfos */
+	int			join_cur_level; /* index of list being extended */
+
+	List	   *init_plans;		/* init SubPlans for query */
+
+	List	   *cte_plan_ids;	/* per-CTE-item list of subplan IDs */
+
+	List	   *multiexpr_params;		/* List of Lists of Params for
+										 * MULTIEXPR subquery outputs */
+
+	List	   *eq_classes;		/* list of active EquivalenceClasses */
+
+	List	   *canon_pathkeys; /* list of "canonical" PathKeys */
+
+	List	   *left_join_clauses;		/* list of RestrictInfos for
+										 * mergejoinable outer join clauses
+										 * w/nonnullable var on left */
+
+	List	   *right_join_clauses;		/* list of RestrictInfos for
+										 * mergejoinable outer join clauses
+										 * w/nonnullable var on right */
+
+	List	   *full_join_clauses;		/* list of RestrictInfos for
+										 * mergejoinable full join clauses */
+
+	List	   *join_info_list; /* list of SpecialJoinInfos */
+
+	List	   *append_rel_list;	/* list of AppendRelInfos */
+
+	List	   *rowMarks;		/* list of PlanRowMarks */
+
+	List	   *placeholder_list;		/* list of PlaceHolderInfos */
+
+	List	   *query_pathkeys; /* desired pathkeys for query_planner(), and
+								 * actual pathkeys after planning */
+
+	List	   *group_pathkeys; /* groupClause pathkeys, if any */
+	List	   *window_pathkeys;	/* pathkeys of bottom window, if any */
+	List	   *distinct_pathkeys;		/* distinctClause pathkeys, if any */
+	List	   *sort_pathkeys;	/* sortClause pathkeys, if any */
+
+	List	   *minmax_aggs;	/* List of MinMaxAggInfos */
+
+	List	   *initial_rels;	/* RelOptInfos we are now trying to join */
+
+	MemoryContext planner_cxt;	/* context holding PlannerInfo */
+
+	double		total_table_pages;		/* # of pages in all tables of query */
+
+	double		tuple_fraction; /* tuple_fraction passed to query_planner */
+	double		limit_tuples;	/* limit_tuples passed to query_planner */
+
+	bool		hasInheritedTarget;		/* true if parse->resultRelation is an
+										 * inheritance child rel */
+	bool		hasJoinRTEs;	/* true if any RTEs are RTE_JOIN kind */
+	bool		hasLateralRTEs; /* true if any RTEs are marked LATERAL */
+	bool		hasDeletedRTEs; /* true if any RTE was deleted from jointree */
+	bool		hasHavingQual;	/* true if havingQual was non-null */
+	bool		hasPseudoConstantQuals; /* true if any RestrictInfo has
+										 * pseudoconstant = true */
+	bool		hasRecursion;	/* true if planning a recursive WITH item */
+
+	/* These fields are used only when hasRecursion is true: */
+	int			wt_param_id;	/* PARAM_EXEC ID for the work table */
+	struct Plan *non_recursive_plan;	/* plan for non-recursive term */
+
+	/* These fields are workspace for createplan.c */
+	Relids		curOuterRels;	/* outer rels above current node */
+	List	   *curOuterParams; /* not-yet-assigned NestLoopParams */
+
+	/* optional private data for join_search_hook, e.g., GEQO */
+	void	   *join_search_private;
+
+	/* for GroupingFunc fixup in setrefs */
+	AttrNumber *grouping_map;
+} PlannerInfo;
+
+
+/*
+ * In places where it's known that simple_rte_array[] must have been prepared
+ * already, we just index into it to fetch RTEs.  In code that might be
+ * executed before or after entering query_planner(), use this macro.
+ */
+#define planner_rt_fetch(rti, root) \
+	((root)->simple_rte_array ? (root)->simple_rte_array[rti] : \
+	 rt_fetch(rti, (root)->parse->rtable))
+
+
+/*----------
+ * RelOptInfo
+ *		Per-relation information for planning/optimization
+ *
+ * For planning purposes, a "base rel" is either a plain relation (a table)
+ * or the output of a sub-SELECT or function that appears in the range table.
+ * In either case it is uniquely identified by an RT index.  A "joinrel"
+ * is the joining of two or more base rels.  A joinrel is identified by
+ * the set of RT indexes for its component baserels.  We create RelOptInfo
+ * nodes for each baserel and joinrel, and store them in the PlannerInfo's
+ * simple_rel_array and join_rel_list respectively.
+ *
+ * Note that there is only one joinrel for any given set of component
+ * baserels, no matter what order we assemble them in; so an unordered
+ * set is the right datatype to identify it with.
+ *
+ * We also have "other rels", which are like base rels in that they refer to
+ * single RT indexes; but they are not part of the join tree, and are given
+ * a different RelOptKind to identify them.  Lastly, there is a RelOptKind
+ * for "dead" relations, which are base rels that we have proven we don't
+ * need to join after all.
+ *
+ * Currently the only kind of otherrels are those made for member relations
+ * of an "append relation", that is an inheritance set or UNION ALL subquery.
+ * An append relation has a parent RTE that is a base rel, which represents
+ * the entire append relation.  The member RTEs are otherrels.  The parent
+ * is present in the query join tree but the members are not.  The member
+ * RTEs and otherrels are used to plan the scans of the individual tables or
+ * subqueries of the append set; then the parent baserel is given Append
+ * and/or MergeAppend paths comprising the best paths for the individual
+ * member rels.  (See comments for AppendRelInfo for more information.)
+ *
+ * At one time we also made otherrels to represent join RTEs, for use in
+ * handling join alias Vars.  Currently this is not needed because all join
+ * alias Vars are expanded to non-aliased form during preprocess_expression.
+ *
+ * Parts of this data structure are specific to various scan and join
+ * mechanisms.  It didn't seem worth creating new node types for them.
+ *
+ *		relids - Set of base-relation identifiers; it is a base relation
+ *				if there is just one, a join relation if more than one
+ *		rows - estimated number of tuples in the relation after restriction
+ *			   clauses have been applied (ie, output rows of a plan for it)
+ *		width - avg. number of bytes per tuple in the relation after the
+ *				appropriate projections have been done (ie, output width)
+ *		consider_startup - true if there is any value in keeping plain paths for
+ *						   this rel on the basis of having cheap startup cost
+ *		consider_param_startup - the same for parameterized paths
+ *		reltargetlist - List of Var and PlaceHolderVar nodes for the values
+ *						we need to output from this relation.
+ *						List is in no particular order, but all rels of an
+ *						appendrel set must use corresponding orders.
+ *						NOTE: in an appendrel child relation, may contain
+ *						arbitrary expressions pulled up from a subquery!
+ *		pathlist - List of Path nodes, one for each potentially useful
+ *				   method of generating the relation
+ *		ppilist - ParamPathInfo nodes for parameterized Paths, if any
+ *		cheapest_startup_path - the pathlist member with lowest startup cost
+ *			(regardless of ordering) among the unparameterized paths;
+ *			or NULL if there is no unparameterized path
+ *		cheapest_total_path - the pathlist member with lowest total cost
+ *			(regardless of ordering) among the unparameterized paths;
+ *			or if there is no unparameterized path, the path with lowest
+ *			total cost among the paths with minimum parameterization
+ *		cheapest_unique_path - for caching cheapest path to produce unique
+ *			(no duplicates) output from relation; NULL if not yet requested
+ *		cheapest_parameterized_paths - best paths for their parameterizations;
+ *			always includes cheapest_total_path, even if that's unparameterized
+ *		direct_lateral_relids - rels this rel has direct LATERAL references to
+ *		lateral_relids - required outer rels for LATERAL, as a Relids set
+ *			(includes both direct and indirect lateral references)
+ *
+ * If the relation is a base relation it will have these fields set:
+ *
+ *		relid - RTE index (this is redundant with the relids field, but
+ *				is provided for convenience of access)
+ *		rtekind - distinguishes plain relation, subquery, or function RTE
+ *		min_attr, max_attr - range of valid AttrNumbers for rel
+ *		attr_needed - array of bitmapsets indicating the highest joinrel
+ *				in which each attribute is needed; if bit 0 is set then
+ *				the attribute is needed as part of final targetlist
+ *		attr_widths - cache space for per-attribute width estimates;
+ *					  zero means not computed yet
+ *		lateral_vars - lateral cross-references of rel, if any (list of
+ *					   Vars and PlaceHolderVars)
+ *		lateral_referencers - relids of rels that reference this one laterally
+ *				(includes both direct and indirect lateral references)
+ *		indexlist - list of IndexOptInfo nodes for relation's indexes
+ *					(always NIL if it's not a table)
+ *		pages - number of disk pages in relation (zero if not a table)
+ *		tuples - number of tuples in relation (not considering restrictions)
+ *		allvisfrac - fraction of disk pages that are marked all-visible
+ *		subplan - plan for subquery (NULL if it's not a subquery)
+ *		subroot - PlannerInfo for subquery (NULL if it's not a subquery)
+ *		subplan_params - list of PlannerParamItems to be passed to subquery
+ *
+ *		Note: for a subquery, tuples, subplan, subroot are not set immediately
+ *		upon creation of the RelOptInfo object; they are filled in when
+ *		set_subquery_pathlist processes the object.
+ *
+ *		For otherrels that are appendrel members, these fields are filled
+ *		in just as for a baserel, except we don't bother with lateral_vars.
+ *
+ * If the relation is either a foreign table or a join of foreign tables that
+ * all belong to the same foreign server, these fields will be set:
+ *
+ *		serverid - OID of foreign server, if foreign table (else InvalidOid)
+ *		fdwroutine - function hooks for FDW, if foreign table (else NULL)
+ *		fdw_private - private state for FDW, if foreign table (else NULL)
+ *
+ * The presence of the remaining fields depends on the restrictions
+ * and joins that the relation participates in:
+ *
+ *		baserestrictinfo - List of RestrictInfo nodes, containing info about
+ *					each non-join qualification clause in which this relation
+ *					participates (only used for base rels)
+ *		baserestrictcost - Estimated cost of evaluating the baserestrictinfo
+ *					clauses at a single tuple (only used for base rels)
+ *		joininfo  - List of RestrictInfo nodes, containing info about each
+ *					join clause in which this relation participates (but
+ *					note this excludes clauses that might be derivable from
+ *					EquivalenceClasses)
+ *		has_eclass_joins - flag that EquivalenceClass joins are possible
+ *
+ * Note: Keeping a restrictinfo list in the RelOptInfo is useful only for
+ * base rels, because for a join rel the set of clauses that are treated as
+ * restrict clauses varies depending on which sub-relations we choose to join.
+ * (For example, in a 3-base-rel join, a clause relating rels 1 and 2 must be
+ * treated as a restrictclause if we join {1} and {2 3} to make {1 2 3}; but
+ * if we join {1 2} and {3} then that clause will be a restrictclause in {1 2}
+ * and should not be processed again at the level of {1 2 3}.)	Therefore,
+ * the restrictinfo list in the join case appears in individual JoinPaths
+ * (field joinrestrictinfo), not in the parent relation.  But it's OK for
+ * the RelOptInfo to store the joininfo list, because that is the same
+ * for a given rel no matter how we form it.
+ *
+ * We store baserestrictcost in the RelOptInfo (for base relations) because
+ * we know we will need it at least once (to price the sequential scan)
+ * and may need it multiple times to price index scans.
+ *----------
+ */
+typedef enum RelOptKind
+{
+	RELOPT_BASEREL,
+	RELOPT_JOINREL,
+	RELOPT_OTHER_MEMBER_REL,
+	RELOPT_DEADREL
+} RelOptKind;
+
+typedef struct RelOptInfo
+{
+	NodeTag		type;
+
+	RelOptKind	reloptkind;
+
+	/* all relations included in this RelOptInfo */
+	Relids		relids;			/* set of base relids (rangetable indexes) */
+
+	/* size estimates generated by planner */
+	double		rows;			/* estimated number of result tuples */
+	int			width;			/* estimated avg width of result tuples */
+
+	/* per-relation planner control flags */
+	bool		consider_startup;		/* keep cheap-startup-cost paths? */
+	bool		consider_param_startup; /* ditto, for parameterized paths? */
+
+	/* materialization information */
+	List	   *reltargetlist;	/* Vars to be output by scan of relation */
+	List	   *pathlist;		/* Path structures */
+	List	   *ppilist;		/* ParamPathInfos used in pathlist */
+	struct Path *cheapest_startup_path;
+	struct Path *cheapest_total_path;
+	struct Path *cheapest_unique_path;
+	List	   *cheapest_parameterized_paths;
+
+	/* parameterization information needed for both base rels and join rels */
+	/* (see also lateral_vars and lateral_referencers) */
+	Relids		direct_lateral_relids;	/* rels directly laterally referenced */
+	Relids		lateral_relids; /* minimum parameterization of rel */
+
+	/* information about a base rel (not set for join rels!) */
+	Index		relid;
+	Oid			reltablespace;	/* containing tablespace */
+	RTEKind		rtekind;		/* RELATION, SUBQUERY, or FUNCTION */
+	AttrNumber	min_attr;		/* smallest attrno of rel (often <0) */
+	AttrNumber	max_attr;		/* largest attrno of rel */
+	Relids	   *attr_needed;	/* array indexed [min_attr .. max_attr] */
+	int32	   *attr_widths;	/* array indexed [min_attr .. max_attr] */
+	List	   *lateral_vars;	/* LATERAL Vars and PHVs referenced by rel */
+	Relids		lateral_referencers;	/* rels that reference me laterally */
+	List	   *indexlist;		/* list of IndexOptInfo */
+	BlockNumber pages;			/* size estimates derived from pg_class */
+	double		tuples;
+	double		allvisfrac;
+	/* use "struct Plan" to avoid including plannodes.h here */
+	struct Plan *subplan;		/* if subquery */
+	PlannerInfo *subroot;		/* if subquery */
+	List	   *subplan_params; /* if subquery */
+
+	/* Information about foreign tables and foreign joins */
+	Oid			serverid;		/* identifies server for the table or join */
+	/* use "struct FdwRoutine" to avoid including fdwapi.h here */
+	struct FdwRoutine *fdwroutine;
+	void	   *fdw_private;
+
+	/* used by various scans and joins: */
+	List	   *baserestrictinfo;		/* RestrictInfo structures (if base
+										 * rel) */
+	QualCost	baserestrictcost;		/* cost of evaluating the above */
+	List	   *joininfo;		/* RestrictInfo structures for join clauses
+								 * involving this rel */
+	bool		has_eclass_joins;		/* T means joininfo is incomplete */
+} RelOptInfo;
+
+/*
+ * IndexOptInfo
+ *		Per-index information for planning/optimization
+ *
+ *		indexkeys[], indexcollations[], opfamily[], and opcintype[]
+ *		each have ncolumns entries.
+ *
+ *		sortopfamily[], reverse_sort[], and nulls_first[] likewise have
+ *		ncolumns entries, if the index is ordered; but if it is unordered,
+ *		those pointers are NULL.
+ *
+ *		Zeroes in the indexkeys[] array indicate index columns that are
+ *		expressions; there is one element in indexprs for each such column.
+ *
+ *		For an ordered index, reverse_sort[] and nulls_first[] describe the
+ *		sort ordering of a forward indexscan; we can also consider a backward
+ *		indexscan, which will generate the reverse ordering.
+ *
+ *		The indexprs and indpred expressions have been run through
+ *		prepqual.c and eval_const_expressions() for ease of matching to
+ *		WHERE clauses. indpred is in implicit-AND form.
+ *
+ *		indextlist is a TargetEntry list representing the index columns.
+ *		It provides an equivalent base-relation Var for each simple column,
+ *		and links to the matching indexprs element for each expression column.
+ */
+typedef struct IndexOptInfo
+{
+	NodeTag		type;
+
+	Oid			indexoid;		/* OID of the index relation */
+	Oid			reltablespace;	/* tablespace of index (not table) */
+	RelOptInfo *rel;			/* back-link to index's table */
+
+	/* index-size statistics (from pg_class and elsewhere) */
+	BlockNumber pages;			/* number of disk pages in index */
+	double		tuples;			/* number of index tuples in index */
+	int			tree_height;	/* index tree height, or -1 if unknown */
+
+	/* index descriptor information */
+	int			ncolumns;		/* number of columns in index */
+	int		   *indexkeys;		/* column numbers of index's keys, or 0 */
+	Oid		   *indexcollations;	/* OIDs of collations of index columns */
+	Oid		   *opfamily;		/* OIDs of operator families for columns */
+	Oid		   *opcintype;		/* OIDs of opclass declared input data types */
+	Oid		   *sortopfamily;	/* OIDs of btree opfamilies, if orderable */
+	bool	   *reverse_sort;	/* is sort order descending? */
+	bool	   *nulls_first;	/* do NULLs come first in the sort order? */
+	bool	   *canreturn;		/* which index cols can be returned in an
+								 * index-only scan? */
+	Oid			relam;			/* OID of the access method (in pg_am) */
+
+	RegProcedure amcostestimate;	/* OID of the access method's cost fcn */
+
+	List	   *indexprs;		/* expressions for non-simple index columns */
+	List	   *indpred;		/* predicate if a partial index, else NIL */
+
+	List	   *indextlist;		/* targetlist representing index columns */
+
+	bool		predOK;			/* true if predicate matches query */
+	bool		unique;			/* true if a unique index */
+	bool		immediate;		/* is uniqueness enforced immediately? */
+	bool		hypothetical;	/* true if index doesn't really exist */
+	bool		amcanorderbyop; /* does AM support order by operator result? */
+	bool		amoptionalkey;	/* can query omit key for the first column? */
+	bool		amsearcharray;	/* can AM handle ScalarArrayOpExpr quals? */
+	bool		amsearchnulls;	/* can AM search for NULL/NOT NULL entries? */
+	bool		amhasgettuple;	/* does AM have amgettuple interface? */
+	bool		amhasgetbitmap; /* does AM have amgetbitmap interface? */
+} IndexOptInfo;
+
+
+/*
+ * EquivalenceClasses
+ *
+ * Whenever we can determine that a mergejoinable equality clause A = B is
+ * not delayed by any outer join, we create an EquivalenceClass containing
+ * the expressions A and B to record this knowledge.  If we later find another
+ * equivalence B = C, we add C to the existing EquivalenceClass; this may
+ * require merging two existing EquivalenceClasses.  At the end of the qual
+ * distribution process, we have sets of values that are known all transitively
+ * equal to each other, where "equal" is according to the rules of the btree
+ * operator family(s) shown in ec_opfamilies, as well as the collation shown
+ * by ec_collation.  (We restrict an EC to contain only equalities whose
+ * operators belong to the same set of opfamilies.  This could probably be
+ * relaxed, but for now it's not worth the trouble, since nearly all equality
+ * operators belong to only one btree opclass anyway.  Similarly, we suppose
+ * that all or none of the input datatypes are collatable, so that a single
+ * collation value is sufficient.)
+ *
+ * We also use EquivalenceClasses as the base structure for PathKeys, letting
+ * us represent knowledge about different sort orderings being equivalent.
+ * Since every PathKey must reference an EquivalenceClass, we will end up
+ * with single-member EquivalenceClasses whenever a sort key expression has
+ * not been equivalenced to anything else.  It is also possible that such an
+ * EquivalenceClass will contain a volatile expression ("ORDER BY random()"),
+ * which is a case that can't arise otherwise since clauses containing
+ * volatile functions are never considered mergejoinable.  We mark such
+ * EquivalenceClasses specially to prevent them from being merged with
+ * ordinary EquivalenceClasses.  Also, for volatile expressions we have
+ * to be careful to match the EquivalenceClass to the correct targetlist
+ * entry: consider SELECT random() AS a, random() AS b ... ORDER BY b,a.
+ * So we record the SortGroupRef of the originating sort clause.
+ *
+ * We allow equality clauses appearing below the nullable side of an outer join
+ * to form EquivalenceClasses, but these have a slightly different meaning:
+ * the included values might be all NULL rather than all the same non-null
+ * values.  See src/backend/optimizer/README for more on that point.
+ *
+ * NB: if ec_merged isn't NULL, this class has been merged into another, and
+ * should be ignored in favor of using the pointed-to class.
+ */
+typedef struct EquivalenceClass
+{
+	NodeTag		type;
+
+	List	   *ec_opfamilies;	/* btree operator family OIDs */
+	Oid			ec_collation;	/* collation, if datatypes are collatable */
+	List	   *ec_members;		/* list of EquivalenceMembers */
+	List	   *ec_sources;		/* list of generating RestrictInfos */
+	List	   *ec_derives;		/* list of derived RestrictInfos */
+	Relids		ec_relids;		/* all relids appearing in ec_members, except
+								 * for child members (see below) */
+	bool		ec_has_const;	/* any pseudoconstants in ec_members? */
+	bool		ec_has_volatile;	/* the (sole) member is a volatile expr */
+	bool		ec_below_outer_join;	/* equivalence applies below an OJ */
+	bool		ec_broken;		/* failed to generate needed clauses? */
+	Index		ec_sortref;		/* originating sortclause label, or 0 */
+	struct EquivalenceClass *ec_merged; /* set if merged into another EC */
+} EquivalenceClass;
+
+/*
+ * If an EC contains a const and isn't below-outer-join, any PathKey depending
+ * on it must be redundant, since there's only one possible value of the key.
+ */
+#define EC_MUST_BE_REDUNDANT(eclass)  \
+	((eclass)->ec_has_const && !(eclass)->ec_below_outer_join)
+
+/*
+ * EquivalenceMember - one member expression of an EquivalenceClass
+ *
+ * em_is_child signifies that this element was built by transposing a member
+ * for an appendrel parent relation to represent the corresponding expression
+ * for an appendrel child.  These members are used for determining the
+ * pathkeys of scans on the child relation and for explicitly sorting the
+ * child when necessary to build a MergeAppend path for the whole appendrel
+ * tree.  An em_is_child member has no impact on the properties of the EC as a
+ * whole; in particular the EC's ec_relids field does NOT include the child
+ * relation.  An em_is_child member should never be marked em_is_const nor
+ * cause ec_has_const or ec_has_volatile to be set, either.  Thus, em_is_child
+ * members are not really full-fledged members of the EC, but just reflections
+ * or doppelgangers of real members.  Most operations on EquivalenceClasses
+ * should ignore em_is_child members, and those that don't should test
+ * em_relids to make sure they only consider relevant members.
+ *
+ * em_datatype is usually the same as exprType(em_expr), but can be
+ * different when dealing with a binary-compatible opfamily; in particular
+ * anyarray_ops would never work without this.  Use em_datatype when
+ * looking up a specific btree operator to work with this expression.
+ */
+typedef struct EquivalenceMember
+{
+	NodeTag		type;
+
+	Expr	   *em_expr;		/* the expression represented */
+	Relids		em_relids;		/* all relids appearing in em_expr */
+	Relids		em_nullable_relids;		/* nullable by lower outer joins */
+	bool		em_is_const;	/* expression is pseudoconstant? */
+	bool		em_is_child;	/* derived version for a child relation? */
+	Oid			em_datatype;	/* the "nominal type" used by the opfamily */
+} EquivalenceMember;
+
+/*
+ * PathKeys
+ *
+ * The sort ordering of a path is represented by a list of PathKey nodes.
+ * An empty list implies no known ordering.  Otherwise the first item
+ * represents the primary sort key, the second the first secondary sort key,
+ * etc.  The value being sorted is represented by linking to an
+ * EquivalenceClass containing that value and including pk_opfamily among its
+ * ec_opfamilies.  The EquivalenceClass tells which collation to use, too.
+ * This is a convenient method because it makes it trivial to detect
+ * equivalent and closely-related orderings. (See optimizer/README for more
+ * information.)
+ *
+ * Note: pk_strategy is either BTLessStrategyNumber (for ASC) or
+ * BTGreaterStrategyNumber (for DESC).  We assume that all ordering-capable
+ * index types will use btree-compatible strategy numbers.
+ */
+typedef struct PathKey
+{
+	NodeTag		type;
+
+	EquivalenceClass *pk_eclass;	/* the value that is ordered */
+	Oid			pk_opfamily;	/* btree opfamily defining the ordering */
+	int			pk_strategy;	/* sort direction (ASC or DESC) */
+	bool		pk_nulls_first; /* do NULLs come before normal values? */
+} PathKey;
+
+
+/*
+ * ParamPathInfo
+ *
+ * All parameterized paths for a given relation with given required outer rels
+ * link to a single ParamPathInfo, which stores common information such as
+ * the estimated rowcount for this parameterization.  We do this partly to
+ * avoid recalculations, but mostly to ensure that the estimated rowcount
+ * is in fact the same for every such path.
+ *
+ * Note: ppi_clauses is only used in ParamPathInfos for base relation paths;
+ * in join cases it's NIL because the set of relevant clauses varies depending
+ * on how the join is formed.  The relevant clauses will appear in each
+ * parameterized join path's joinrestrictinfo list, instead.
+ */
+typedef struct ParamPathInfo
+{
+	NodeTag		type;
+
+	Relids		ppi_req_outer;	/* rels supplying parameters used by path */
+	double		ppi_rows;		/* estimated number of result tuples */
+	List	   *ppi_clauses;	/* join clauses available from outer rels */
+} ParamPathInfo;
+
+
+/*
+ * Type "Path" is used as-is for sequential-scan paths, as well as some other
+ * simple plan types that we don't need any extra information in the path for.
+ * For other path types it is the first component of a larger struct.
+ *
+ * "pathtype" is the NodeTag of the Plan node we could build from this Path.
+ * It is partially redundant with the Path's NodeTag, but allows us to use
+ * the same Path type for multiple Plan types when there is no need to
+ * distinguish the Plan type during path processing.
+ *
+ * "param_info", if not NULL, links to a ParamPathInfo that identifies outer
+ * relation(s) that provide parameter values to each scan of this path.
+ * That means this path can only be joined to those rels by means of nestloop
+ * joins with this path on the inside.  Also note that a parameterized path
+ * is responsible for testing all "movable" joinclauses involving this rel
+ * and the specified outer rel(s).
+ *
+ * "rows" is the same as parent->rows in simple paths, but in parameterized
+ * paths and UniquePaths it can be less than parent->rows, reflecting the
+ * fact that we've filtered by extra join conditions or removed duplicates.
+ *
+ * "pathkeys" is a List of PathKey nodes (see above), describing the sort
+ * ordering of the path's output rows.
+ */
+typedef struct Path
+{
+	NodeTag		type;
+
+	NodeTag		pathtype;		/* tag identifying scan/join method */
+
+	RelOptInfo *parent;			/* the relation this path can build */
+	ParamPathInfo *param_info;	/* parameterization info, or NULL if none */
+
+	/* estimated size/costs for path (see costsize.c for more info) */
+	double		rows;			/* estimated number of result tuples */
+	Cost		startup_cost;	/* cost expended before fetching any tuples */
+	Cost		total_cost;		/* total cost (assuming all tuples fetched) */
+
+	List	   *pathkeys;		/* sort ordering of path's output */
+	/* pathkeys is a List of PathKey nodes; see above */
+} Path;
+
+/* Macro for extracting a path's parameterization relids; beware double eval */
+#define PATH_REQ_OUTER(path)  \
+	((path)->param_info ? (path)->param_info->ppi_req_outer : (Relids) NULL)
+
+/*----------
+ * IndexPath represents an index scan over a single index.
+ *
+ * This struct is used for both regular indexscans and index-only scans;
+ * path.pathtype is T_IndexScan or T_IndexOnlyScan to show which is meant.
+ *
+ * 'indexinfo' is the index to be scanned.
+ *
+ * 'indexclauses' is a list of index qualification clauses, with implicit
+ * AND semantics across the list.  Each clause is a RestrictInfo node from
+ * the query's WHERE or JOIN conditions.  An empty list implies a full
+ * index scan.
+ *
+ * 'indexquals' has the same structure as 'indexclauses', but it contains
+ * the actual index qual conditions that can be used with the index.
+ * In simple cases this is identical to 'indexclauses', but when special
+ * indexable operators appear in 'indexclauses', they are replaced by the
+ * derived indexscannable conditions in 'indexquals'.
+ *
+ * 'indexqualcols' is an integer list of index column numbers (zero-based)
+ * of the same length as 'indexquals', showing which index column each qual
+ * is meant to be used with.  'indexquals' is required to be ordered by
+ * index column, so 'indexqualcols' must form a nondecreasing sequence.
+ * (The order of multiple quals for the same index column is unspecified.)
+ *
+ * 'indexorderbys', if not NIL, is a list of ORDER BY expressions that have
+ * been found to be usable as ordering operators for an amcanorderbyop index.
+ * The list must match the path's pathkeys, ie, one expression per pathkey
+ * in the same order.  These are not RestrictInfos, just bare expressions,
+ * since they generally won't yield booleans.  Also, unlike the case for
+ * quals, it's guaranteed that each expression has the index key on the left
+ * side of the operator.
+ *
+ * 'indexorderbycols' is an integer list of index column numbers (zero-based)
+ * of the same length as 'indexorderbys', showing which index column each
+ * ORDER BY expression is meant to be used with.  (There is no restriction
+ * on which index column each ORDER BY can be used with.)
+ *
+ * 'indexscandir' is one of:
+ *		ForwardScanDirection: forward scan of an ordered index
+ *		BackwardScanDirection: backward scan of an ordered index
+ *		NoMovementScanDirection: scan of an unordered index, or don't care
+ * (The executor doesn't care whether it gets ForwardScanDirection or
+ * NoMovementScanDirection for an indexscan, but the planner wants to
+ * distinguish ordered from unordered indexes for building pathkeys.)
+ *
+ * 'indextotalcost' and 'indexselectivity' are saved in the IndexPath so that
+ * we need not recompute them when considering using the same index in a
+ * bitmap index/heap scan (see BitmapHeapPath).  The costs of the IndexPath
+ * itself represent the costs of an IndexScan or IndexOnlyScan plan type.
+ *----------
+ */
+typedef struct IndexPath
+{
+	Path		path;
+	IndexOptInfo *indexinfo;
+	List	   *indexclauses;
+	List	   *indexquals;
+	List	   *indexqualcols;
+	List	   *indexorderbys;
+	List	   *indexorderbycols;
+	ScanDirection indexscandir;
+	Cost		indextotalcost;
+	Selectivity indexselectivity;
+} IndexPath;
+
+/*
+ * BitmapHeapPath represents one or more indexscans that generate TID bitmaps
+ * instead of directly accessing the heap, followed by AND/OR combinations
+ * to produce a single bitmap, followed by a heap scan that uses the bitmap.
+ * Note that the output is always considered unordered, since it will come
+ * out in physical heap order no matter what the underlying indexes did.
+ *
+ * The individual indexscans are represented by IndexPath nodes, and any
+ * logic on top of them is represented by a tree of BitmapAndPath and
+ * BitmapOrPath nodes.  Notice that we can use the same IndexPath node both
+ * to represent a regular (or index-only) index scan plan, and as the child
+ * of a BitmapHeapPath that represents scanning the same index using a
+ * BitmapIndexScan.  The startup_cost and total_cost figures of an IndexPath
+ * always represent the costs to use it as a regular (or index-only)
+ * IndexScan.  The costs of a BitmapIndexScan can be computed using the
+ * IndexPath's indextotalcost and indexselectivity.
+ */
+typedef struct BitmapHeapPath
+{
+	Path		path;
+	Path	   *bitmapqual;		/* IndexPath, BitmapAndPath, BitmapOrPath */
+} BitmapHeapPath;
+
+/*
+ * BitmapAndPath represents a BitmapAnd plan node; it can only appear as
+ * part of the substructure of a BitmapHeapPath.  The Path structure is
+ * a bit more heavyweight than we really need for this, but for simplicity
+ * we make it a derivative of Path anyway.
+ */
+typedef struct BitmapAndPath
+{
+	Path		path;
+	List	   *bitmapquals;	/* IndexPaths and BitmapOrPaths */
+	Selectivity bitmapselectivity;
+} BitmapAndPath;
+
+/*
+ * BitmapOrPath represents a BitmapOr plan node; it can only appear as
+ * part of the substructure of a BitmapHeapPath.  The Path structure is
+ * a bit more heavyweight than we really need for this, but for simplicity
+ * we make it a derivative of Path anyway.
+ */
+typedef struct BitmapOrPath
+{
+	Path		path;
+	List	   *bitmapquals;	/* IndexPaths and BitmapAndPaths */
+	Selectivity bitmapselectivity;
+} BitmapOrPath;
+
+/*
+ * TidPath represents a scan by TID
+ *
+ * tidquals is an implicitly OR'ed list of qual expressions of the form
+ * "CTID = pseudoconstant" or "CTID = ANY(pseudoconstant_array)".
+ * Note they are bare expressions, not RestrictInfos.
+ */
+typedef struct TidPath
+{
+	Path		path;
+	List	   *tidquals;		/* qual(s) involving CTID = something */
+} TidPath;
+
+/*
+ * ForeignPath represents a potential scan of a foreign table
+ *
+ * fdw_private stores FDW private data about the scan.  While fdw_private is
+ * not actually touched by the core code during normal operations, it's
+ * generally a good idea to use a representation that can be dumped by
+ * nodeToString(), so that you can examine the structure during debugging
+ * with tools like pprint().
+ */
+typedef struct ForeignPath
+{
+	Path		path;
+	Path	   *fdw_outerpath;
+	List	   *fdw_private;
+} ForeignPath;
+
+/*
+ * CustomPath represents a table scan done by some out-of-core extension.
+ *
+ * We provide a set of hooks here - which the provider must take care to set
+ * up correctly - to allow extensions to supply their own methods of scanning
+ * a relation.  For example, a provider might provide GPU acceleration, a
+ * cache-based scan, or some other kind of logic we haven't dreamed up yet.
+ *
+ * CustomPaths can be injected into the planning process for a relation by
+ * set_rel_pathlist_hook functions.
+ *
+ * Core code must avoid assuming that the CustomPath is only as large as
+ * the structure declared here; providers are allowed to make it the first
+ * element in a larger structure.  (Since the planner never copies Paths,
+ * this doesn't add any complication.)  However, for consistency with the
+ * FDW case, we provide a "custom_private" field in CustomPath; providers
+ * may prefer to use that rather than define another struct type.
+ */
+struct CustomPath;
+
+#define CUSTOMPATH_SUPPORT_BACKWARD_SCAN	0x0001
+#define CUSTOMPATH_SUPPORT_MARK_RESTORE		0x0002
+
+typedef struct CustomPathMethods
+{
+	const char *CustomName;
+
+	/* Convert Path to a Plan */
+	struct Plan *(*PlanCustomPath) (PlannerInfo *root,
+												RelOptInfo *rel,
+												struct CustomPath *best_path,
+												List *tlist,
+												List *clauses,
+												List *custom_plans);
+	/* Optional: print additional fields besides "private" */
+	void		(*TextOutCustomPath) (StringInfo str,
+											  const struct CustomPath *node);
+} CustomPathMethods;
+
+typedef struct CustomPath
+{
+	Path		path;
+	uint32		flags;			/* mask of CUSTOMPATH_* flags, see above */
+	List	   *custom_paths;	/* list of child Path nodes, if any */
+	List	   *custom_private;
+	const CustomPathMethods *methods;
+} CustomPath;
+
+/*
+ * AppendPath represents an Append plan, ie, successive execution of
+ * several member plans.
+ *
+ * Note: it is possible for "subpaths" to contain only one, or even no,
+ * elements.  These cases are optimized during create_append_plan.
+ * In particular, an AppendPath with no subpaths is a "dummy" path that
+ * is created to represent the case that a relation is provably empty.
+ */
+typedef struct AppendPath
+{
+	Path		path;
+	List	   *subpaths;		/* list of component Paths */
+} AppendPath;
+
+#define IS_DUMMY_PATH(p) \
+	(IsA((p), AppendPath) && ((AppendPath *) (p))->subpaths == NIL)
+
+/* A relation that's been proven empty will have one path that is dummy */
+#define IS_DUMMY_REL(r) \
+	((r)->cheapest_total_path != NULL && \
+	 IS_DUMMY_PATH((r)->cheapest_total_path))
+
+/*
+ * MergeAppendPath represents a MergeAppend plan, ie, the merging of sorted
+ * results from several member plans to produce similarly-sorted output.
+ */
+typedef struct MergeAppendPath
+{
+	Path		path;
+	List	   *subpaths;		/* list of component Paths */
+	double		limit_tuples;	/* hard limit on output tuples, or -1 */
+} MergeAppendPath;
+
+/*
+ * ResultPath represents use of a Result plan node to compute a variable-free
+ * targetlist with no underlying tables (a "SELECT expressions" query).
+ * The query could have a WHERE clause, too, represented by "quals".
+ *
+ * Note that quals is a list of bare clauses, not RestrictInfos.
+ */
+typedef struct ResultPath
+{
+	Path		path;
+	List	   *quals;
+} ResultPath;
+
+/*
+ * MaterialPath represents use of a Material plan node, i.e., caching of
+ * the output of its subpath.  This is used when the subpath is expensive
+ * and needs to be scanned repeatedly, or when we need mark/restore ability
+ * and the subpath doesn't have it.
+ */
+typedef struct MaterialPath
+{
+	Path		path;
+	Path	   *subpath;
+} MaterialPath;
+
+/*
+ * UniquePath represents elimination of distinct rows from the output of
+ * its subpath.
+ *
+ * This is unlike the other Path nodes in that it can actually generate
+ * different plans: either hash-based or sort-based implementation, or a
+ * no-op if the input path can be proven distinct already.  The decision
+ * is sufficiently localized that it's not worth having separate Path node
+ * types.  (Note: in the no-op case, we could eliminate the UniquePath node
+ * entirely and just return the subpath; but it's convenient to have a
+ * UniquePath in the path tree to signal upper-level routines that the input
+ * is known distinct.)
+ */
+typedef enum
+{
+	UNIQUE_PATH_NOOP,			/* input is known unique already */
+	UNIQUE_PATH_HASH,			/* use hashing */
+	UNIQUE_PATH_SORT			/* use sorting */
+} UniquePathMethod;
+
+typedef struct UniquePath
+{
+	Path		path;
+	Path	   *subpath;
+	UniquePathMethod umethod;
+	List	   *in_operators;	/* equality operators of the IN clause */
+	List	   *uniq_exprs;		/* expressions to be made unique */
+} UniquePath;
+
+/*
+ * All join-type paths share these fields.
+ */
+
+typedef struct JoinPath
+{
+	Path		path;
+
+	JoinType	jointype;
+
+	Path	   *outerjoinpath;	/* path for the outer side of the join */
+	Path	   *innerjoinpath;	/* path for the inner side of the join */
+
+	List	   *joinrestrictinfo;		/* RestrictInfos to apply to join */
+
+	/*
+	 * See the notes for RelOptInfo and ParamPathInfo to understand why
+	 * joinrestrictinfo is needed in JoinPath, and can't be merged into the
+	 * parent RelOptInfo.
+	 */
+} JoinPath;
+
+/*
+ * A nested-loop path needs no special fields.
+ */
+
+typedef JoinPath NestPath;
+
+/*
+ * A mergejoin path has these fields.
+ *
+ * Unlike other path types, a MergePath node doesn't represent just a single
+ * run-time plan node: it can represent up to four.  Aside from the MergeJoin
+ * node itself, there can be a Sort node for the outer input, a Sort node
+ * for the inner input, and/or a Material node for the inner input.  We could
+ * represent these nodes by separate path nodes, but considering how many
+ * different merge paths are investigated during a complex join problem,
+ * it seems better to avoid unnecessary palloc overhead.
+ *
+ * path_mergeclauses lists the clauses (in the form of RestrictInfos)
+ * that will be used in the merge.
+ *
+ * Note that the mergeclauses are a subset of the parent relation's
+ * restriction-clause list.  Any join clauses that are not mergejoinable
+ * appear only in the parent's restrict list, and must be checked by a
+ * qpqual at execution time.
+ *
+ * outersortkeys (resp. innersortkeys) is NIL if the outer path
+ * (resp. inner path) is already ordered appropriately for the
+ * mergejoin.  If it is not NIL then it is a PathKeys list describing
+ * the ordering that must be created by an explicit Sort node.
+ *
+ * materialize_inner is TRUE if a Material node should be placed atop the
+ * inner input.  This may appear with or without an inner Sort step.
+ */
+
+typedef struct MergePath
+{
+	JoinPath	jpath;
+	List	   *path_mergeclauses;		/* join clauses to be used for merge */
+	List	   *outersortkeys;	/* keys for explicit sort, if any */
+	List	   *innersortkeys;	/* keys for explicit sort, if any */
+	bool		materialize_inner;		/* add Materialize to inner? */
+} MergePath;
+
+/*
+ * A hashjoin path has these fields.
+ *
+ * The remarks above for mergeclauses apply for hashclauses as well.
+ *
+ * Hashjoin does not care what order its inputs appear in, so we have
+ * no need for sortkeys.
+ */
+
+typedef struct HashPath
+{
+	JoinPath	jpath;
+	List	   *path_hashclauses;		/* join clauses used for hashing */
+	int			num_batches;	/* number of batches expected */
+} HashPath;
+
+/*
+ * Restriction clause info.
+ *
+ * We create one of these for each AND sub-clause of a restriction condition
+ * (WHERE or JOIN/ON clause).  Since the restriction clauses are logically
+ * ANDed, we can use any one of them or any subset of them to filter out
+ * tuples, without having to evaluate the rest.  The RestrictInfo node itself
+ * stores data used by the optimizer while choosing the best query plan.
+ *
+ * If a restriction clause references a single base relation, it will appear
+ * in the baserestrictinfo list of the RelOptInfo for that base rel.
+ *
+ * If a restriction clause references more than one base rel, it will
+ * appear in the joininfo list of every RelOptInfo that describes a strict
+ * subset of the base rels mentioned in the clause.  The joininfo lists are
+ * used to drive join tree building by selecting plausible join candidates.
+ * The clause cannot actually be applied until we have built a join rel
+ * containing all the base rels it references, however.
+ *
+ * When we construct a join rel that includes all the base rels referenced
+ * in a multi-relation restriction clause, we place that clause into the
+ * joinrestrictinfo lists of paths for the join rel, if neither left nor
+ * right sub-path includes all base rels referenced in the clause.  The clause
+ * will be applied at that join level, and will not propagate any further up
+ * the join tree.  (Note: the "predicate migration" code was once intended to
+ * push restriction clauses up and down the plan tree based on evaluation
+ * costs, but it's dead code and is unlikely to be resurrected in the
+ * foreseeable future.)
+ *
+ * Note that in the presence of more than two rels, a multi-rel restriction
+ * might reach different heights in the join tree depending on the join
+ * sequence we use.  So, these clauses cannot be associated directly with
+ * the join RelOptInfo, but must be kept track of on a per-join-path basis.
+ *
+ * RestrictInfos that represent equivalence conditions (i.e., mergejoinable
+ * equalities that are not outerjoin-delayed) are handled a bit differently.
+ * Initially we attach them to the EquivalenceClasses that are derived from
+ * them.  When we construct a scan or join path, we look through all the
+ * EquivalenceClasses and generate derived RestrictInfos representing the
+ * minimal set of conditions that need to be checked for this particular scan
+ * or join to enforce that all members of each EquivalenceClass are in fact
+ * equal in all rows emitted by the scan or join.
+ *
+ * When dealing with outer joins we have to be very careful about pushing qual
+ * clauses up and down the tree.  An outer join's own JOIN/ON conditions must
+ * be evaluated exactly at that join node, unless they are "degenerate"
+ * conditions that reference only Vars from the nullable side of the join.
+ * Quals appearing in WHERE or in a JOIN above the outer join cannot be pushed
+ * down below the outer join, if they reference any nullable Vars.
+ * RestrictInfo nodes contain a flag to indicate whether a qual has been
+ * pushed down to a lower level than its original syntactic placement in the
+ * join tree would suggest.  If an outer join prevents us from pushing a qual
+ * down to its "natural" semantic level (the level associated with just the
+ * base rels used in the qual) then we mark the qual with a "required_relids"
+ * value including more than just the base rels it actually uses.  By
+ * pretending that the qual references all the rels required to form the outer
+ * join, we prevent it from being evaluated below the outer join's joinrel.
+ * When we do form the outer join's joinrel, we still need to distinguish
+ * those quals that are actually in that join's JOIN/ON condition from those
+ * that appeared elsewhere in the tree and were pushed down to the join rel
+ * because they used no other rels.  That's what the is_pushed_down flag is
+ * for; it tells us that a qual is not an OUTER JOIN qual for the set of base
+ * rels listed in required_relids.  A clause that originally came from WHERE
+ * or an INNER JOIN condition will *always* have its is_pushed_down flag set.
+ * It's possible for an OUTER JOIN clause to be marked is_pushed_down too,
+ * if we decide that it can be pushed down into the nullable side of the join.
+ * In that case it acts as a plain filter qual for wherever it gets evaluated.
+ * (In short, is_pushed_down is only false for non-degenerate outer join
+ * conditions.  Possibly we should rename it to reflect that meaning?)
+ *
+ * RestrictInfo nodes also contain an outerjoin_delayed flag, which is true
+ * if the clause's applicability must be delayed due to any outer joins
+ * appearing below it (ie, it has to be postponed to some join level higher
+ * than the set of relations it actually references).
+ *
+ * There is also an outer_relids field, which is NULL except for outer join
+ * clauses; for those, it is the set of relids on the outer side of the
+ * clause's outer join.  (These are rels that the clause cannot be applied to
+ * in parameterized scans, since pushing it into the join's outer side would
+ * lead to wrong answers.)
+ *
+ * There is also a nullable_relids field, which is the set of rels the clause
+ * references that can be forced null by some outer join below the clause.
+ *
+ * outerjoin_delayed = true is subtly different from nullable_relids != NULL:
+ * a clause might reference some nullable rels and yet not be
+ * outerjoin_delayed because it also references all the other rels of the
+ * outer join(s). A clause that is not outerjoin_delayed can be enforced
+ * anywhere it is computable.
+ *
+ * In general, the referenced clause might be arbitrarily complex.  The
+ * kinds of clauses we can handle as indexscan quals, mergejoin clauses,
+ * or hashjoin clauses are limited (e.g., no volatile functions).  The code
+ * for each kind of path is responsible for identifying the restrict clauses
+ * it can use and ignoring the rest.  Clauses not implemented by an indexscan,
+ * mergejoin, or hashjoin will be placed in the plan qual or joinqual field
+ * of the finished Plan node, where they will be enforced by general-purpose
+ * qual-expression-evaluation code.  (But we are still entitled to count
+ * their selectivity when estimating the result tuple count, if we
+ * can guess what it is...)
+ *
+ * When the referenced clause is an OR clause, we generate a modified copy
+ * in which additional RestrictInfo nodes are inserted below the top-level
+ * OR/AND structure.  This is a convenience for OR indexscan processing:
+ * indexquals taken from either the top level or an OR subclause will have
+ * associated RestrictInfo nodes.
+ *
+ * The can_join flag is set true if the clause looks potentially useful as
+ * a merge or hash join clause, that is if it is a binary opclause with
+ * nonoverlapping sets of relids referenced in the left and right sides.
+ * (Whether the operator is actually merge or hash joinable isn't checked,
+ * however.)
+ *
+ * The pseudoconstant flag is set true if the clause contains no Vars of
+ * the current query level and no volatile functions.  Such a clause can be
+ * pulled out and used as a one-time qual in a gating Result node.  We keep
+ * pseudoconstant clauses in the same lists as other RestrictInfos so that
+ * the regular clause-pushing machinery can assign them to the correct join
+ * level, but they need to be treated specially for cost and selectivity
+ * estimates.  Note that a pseudoconstant clause can never be an indexqual
+ * or merge or hash join clause, so it's of no interest to large parts of
+ * the planner.
+ *
+ * When join clauses are generated from EquivalenceClasses, there may be
+ * several equally valid ways to enforce join equivalence, of which we need
+ * apply only one.  We mark clauses of this kind by setting parent_ec to
+ * point to the generating EquivalenceClass.  Multiple clauses with the same
+ * parent_ec in the same join are redundant.
+ */
+
+typedef struct RestrictInfo
+{
+	NodeTag		type;
+
+	Expr	   *clause;			/* the represented clause of WHERE or JOIN */
+
+	bool		is_pushed_down; /* TRUE if clause was pushed down in level */
+
+	bool		outerjoin_delayed;		/* TRUE if delayed by lower outer join */
+
+	bool		can_join;		/* see comment above */
+
+	bool		pseudoconstant; /* see comment above */
+
+	/* The set of relids (varnos) actually referenced in the clause: */
+	Relids		clause_relids;
+
+	/* The set of relids required to evaluate the clause: */
+	Relids		required_relids;
+
+	/* If an outer-join clause, the outer-side relations, else NULL: */
+	Relids		outer_relids;
+
+	/* The relids used in the clause that are nullable by lower outer joins: */
+	Relids		nullable_relids;
+
+	/* These fields are set for any binary opclause: */
+	Relids		left_relids;	/* relids in left side of clause */
+	Relids		right_relids;	/* relids in right side of clause */
+
+	/* This field is NULL unless clause is an OR clause: */
+	Expr	   *orclause;		/* modified clause with RestrictInfos */
+
+	/* This field is NULL unless clause is potentially redundant: */
+	EquivalenceClass *parent_ec;	/* generating EquivalenceClass */
+
+	/* cache space for cost and selectivity */
+	QualCost	eval_cost;		/* eval cost of clause; -1 if not yet set */
+	Selectivity norm_selec;		/* selectivity for "normal" (JOIN_INNER)
+								 * semantics; -1 if not yet set; >1 means a
+								 * redundant clause */
+	Selectivity outer_selec;	/* selectivity for outer join semantics; -1 if
+								 * not yet set */
+
+	/* valid if clause is mergejoinable, else NIL */
+	List	   *mergeopfamilies;	/* opfamilies containing clause operator */
+
+	/* cache space for mergeclause processing; NULL if not yet set */
+	EquivalenceClass *left_ec;	/* EquivalenceClass containing lefthand */
+	EquivalenceClass *right_ec; /* EquivalenceClass containing righthand */
+	EquivalenceMember *left_em; /* EquivalenceMember for lefthand */
+	EquivalenceMember *right_em;	/* EquivalenceMember for righthand */
+	List	   *scansel_cache;	/* list of MergeScanSelCache structs */
+
+	/* transient workspace for use while considering a specific join path */
+	bool		outer_is_left;	/* T = outer var on left, F = on right */
+
+	/* valid if clause is hashjoinable, else InvalidOid: */
+	Oid			hashjoinoperator;		/* copy of clause operator */
+
+	/* cache space for hashclause processing; -1 if not yet set */
+	Selectivity left_bucketsize;	/* avg bucketsize of left side */
+	Selectivity right_bucketsize;		/* avg bucketsize of right side */
+} RestrictInfo;
+
+/*
+ * Since mergejoinscansel() is a relatively expensive function, and would
+ * otherwise be invoked many times while planning a large join tree,
+ * we go out of our way to cache its results.  Each mergejoinable
+ * RestrictInfo carries a list of the specific sort orderings that have
+ * been considered for use with it, and the resulting selectivities.
+ */
+typedef struct MergeScanSelCache
+{
+	/* Ordering details (cache lookup key) */
+	Oid			opfamily;		/* btree opfamily defining the ordering */
+	Oid			collation;		/* collation for the ordering */
+	int			strategy;		/* sort direction (ASC or DESC) */
+	bool		nulls_first;	/* do NULLs come before normal values? */
+	/* Results */
+	Selectivity leftstartsel;	/* first-join fraction for clause left side */
+	Selectivity leftendsel;		/* last-join fraction for clause left side */
+	Selectivity rightstartsel;	/* first-join fraction for clause right side */
+	Selectivity rightendsel;	/* last-join fraction for clause right side */
+} MergeScanSelCache;
+
+/*
+ * Placeholder node for an expression to be evaluated below the top level
+ * of a plan tree.  This is used during planning to represent the contained
+ * expression.  At the end of the planning process it is replaced by either
+ * the contained expression or a Var referring to a lower-level evaluation of
+ * the contained expression.  Typically the evaluation occurs below an outer
+ * join, and Var references above the outer join might thereby yield NULL
+ * instead of the expression value.
+ *
+ * Although the planner treats this as an expression node type, it is not
+ * recognized by the parser or executor, so we declare it here rather than
+ * in primnodes.h.
+ */
+
+typedef struct PlaceHolderVar
+{
+	Expr		xpr;
+	Expr	   *phexpr;			/* the represented expression */
+	Relids		phrels;			/* base relids syntactically within expr src */
+	Index		phid;			/* ID for PHV (unique within planner run) */
+	Index		phlevelsup;		/* > 0 if PHV belongs to outer query */
+} PlaceHolderVar;
+
+/*
+ * "Special join" info.
+ *
+ * One-sided outer joins constrain the order of joining partially but not
+ * completely.  We flatten such joins into the planner's top-level list of
+ * relations to join, but record information about each outer join in a
+ * SpecialJoinInfo struct.  These structs are kept in the PlannerInfo node's
+ * join_info_list.
+ *
+ * Similarly, semijoins and antijoins created by flattening IN (subselect)
+ * and EXISTS(subselect) clauses create partial constraints on join order.
+ * These are likewise recorded in SpecialJoinInfo structs.
+ *
+ * We make SpecialJoinInfos for FULL JOINs even though there is no flexibility
+ * of planning for them, because this simplifies make_join_rel()'s API.
+ *
+ * min_lefthand and min_righthand are the sets of base relids that must be
+ * available on each side when performing the special join.  lhs_strict is
+ * true if the special join's condition cannot succeed when the LHS variables
+ * are all NULL (this means that an outer join can commute with upper-level
+ * outer joins even if it appears in their RHS).  We don't bother to set
+ * lhs_strict for FULL JOINs, however.
+ *
+ * It is not valid for either min_lefthand or min_righthand to be empty sets;
+ * if they were, this would break the logic that enforces join order.
+ *
+ * syn_lefthand and syn_righthand are the sets of base relids that are
+ * syntactically below this special join.  (These are needed to help compute
+ * min_lefthand and min_righthand for higher joins.)
+ *
+ * delay_upper_joins is set TRUE if we detect a pushed-down clause that has
+ * to be evaluated after this join is formed (because it references the RHS).
+ * Any outer joins that have such a clause and this join in their RHS cannot
+ * commute with this join, because that would leave noplace to check the
+ * pushed-down clause.  (We don't track this for FULL JOINs, either.)
+ *
+ * For a semijoin, we also extract the join operators and their RHS arguments
+ * and set semi_operators, semi_rhs_exprs, semi_can_btree, and semi_can_hash.
+ * This is done in support of possibly unique-ifying the RHS, so we don't
+ * bother unless at least one of semi_can_btree and semi_can_hash can be set
+ * true.  (You might expect that this information would be computed during
+ * join planning; but it's helpful to have it available during planning of
+ * parameterized table scans, so we store it in the SpecialJoinInfo structs.)
+ *
+ * jointype is never JOIN_RIGHT; a RIGHT JOIN is handled by switching
+ * the inputs to make it a LEFT JOIN.  So the allowed values of jointype
+ * in a join_info_list member are only LEFT, FULL, SEMI, or ANTI.
+ *
+ * For purposes of join selectivity estimation, we create transient
+ * SpecialJoinInfo structures for regular inner joins; so it is possible
+ * to have jointype == JOIN_INNER in such a structure, even though this is
+ * not allowed within join_info_list.  We also create transient
+ * SpecialJoinInfos with jointype == JOIN_INNER for outer joins, since for
+ * cost estimation purposes it is sometimes useful to know the join size under
+ * plain innerjoin semantics.  Note that lhs_strict, delay_upper_joins, and
+ * of course the semi_xxx fields are not set meaningfully within such structs.
+ */
+
+typedef struct SpecialJoinInfo
+{
+	NodeTag		type;
+	Relids		min_lefthand;	/* base relids in minimum LHS for join */
+	Relids		min_righthand;	/* base relids in minimum RHS for join */
+	Relids		syn_lefthand;	/* base relids syntactically within LHS */
+	Relids		syn_righthand;	/* base relids syntactically within RHS */
+	JoinType	jointype;		/* always INNER, LEFT, FULL, SEMI, or ANTI */
+	bool		lhs_strict;		/* joinclause is strict for some LHS rel */
+	bool		delay_upper_joins;		/* can't commute with upper RHS */
+	/* Remaining fields are set only for JOIN_SEMI jointype: */
+	bool		semi_can_btree; /* true if semi_operators are all btree */
+	bool		semi_can_hash;	/* true if semi_operators are all hash */
+	List	   *semi_operators; /* OIDs of equality join operators */
+	List	   *semi_rhs_exprs; /* righthand-side expressions of these ops */
+} SpecialJoinInfo;
+
+/*
+ * Append-relation info.
+ *
+ * When we expand an inheritable table or a UNION-ALL subselect into an
+ * "append relation" (essentially, a list of child RTEs), we build an
+ * AppendRelInfo for each child RTE.  The list of AppendRelInfos indicates
+ * which child RTEs must be included when expanding the parent, and each
+ * node carries information needed to translate Vars referencing the parent
+ * into Vars referencing that child.
+ *
+ * These structs are kept in the PlannerInfo node's append_rel_list.
+ * Note that we just throw all the structs into one list, and scan the
+ * whole list when desiring to expand any one parent.  We could have used
+ * a more complex data structure (eg, one list per parent), but this would
+ * be harder to update during operations such as pulling up subqueries,
+ * and not really any easier to scan.  Considering that typical queries
+ * will not have many different append parents, it doesn't seem worthwhile
+ * to complicate things.
+ *
+ * Note: after completion of the planner prep phase, any given RTE is an
+ * append parent having entries in append_rel_list if and only if its
+ * "inh" flag is set.  We clear "inh" for plain tables that turn out not
+ * to have inheritance children, and (in an abuse of the original meaning
+ * of the flag) we set "inh" for subquery RTEs that turn out to be
+ * flattenable UNION ALL queries.  This lets us avoid useless searches
+ * of append_rel_list.
+ *
+ * Note: the data structure assumes that append-rel members are single
+ * baserels.  This is OK for inheritance, but it prevents us from pulling
+ * up a UNION ALL member subquery if it contains a join.  While that could
+ * be fixed with a more complex data structure, at present there's not much
+ * point because no improvement in the plan could result.
+ */
+
+typedef struct AppendRelInfo
+{
+	NodeTag		type;
+
+	/*
+	 * These fields uniquely identify this append relationship.  There can be
+	 * (in fact, always should be) multiple AppendRelInfos for the same
+	 * parent_relid, but never more than one per child_relid, since a given
+	 * RTE cannot be a child of more than one append parent.
+	 */
+	Index		parent_relid;	/* RT index of append parent rel */
+	Index		child_relid;	/* RT index of append child rel */
+
+	/*
+	 * For an inheritance appendrel, the parent and child are both regular
+	 * relations, and we store their rowtype OIDs here for use in translating
+	 * whole-row Vars.  For a UNION-ALL appendrel, the parent and child are
+	 * both subqueries with no named rowtype, and we store InvalidOid here.
+	 */
+	Oid			parent_reltype; /* OID of parent's composite type */
+	Oid			child_reltype;	/* OID of child's composite type */
+
+	/*
+	 * The N'th element of this list is a Var or expression representing the
+	 * child column corresponding to the N'th column of the parent. This is
+	 * used to translate Vars referencing the parent rel into references to
+	 * the child.  A list element is NULL if it corresponds to a dropped
+	 * column of the parent (this is only possible for inheritance cases, not
+	 * UNION ALL).  The list elements are always simple Vars for inheritance
+	 * cases, but can be arbitrary expressions in UNION ALL cases.
+	 *
+	 * Notice we only store entries for user columns (attno > 0).  Whole-row
+	 * Vars are special-cased, and system columns (attno < 0) need no special
+	 * translation since their attnos are the same for all tables.
+	 *
+	 * Caution: the Vars have varlevelsup = 0.  Be careful to adjust as needed
+	 * when copying into a subquery.
+	 */
+	List	   *translated_vars;	/* Expressions in the child's Vars */
+
+	/*
+	 * We store the parent table's OID here for inheritance, or InvalidOid for
+	 * UNION ALL.  This is only needed to help in generating error messages if
+	 * an attempt is made to reference a dropped parent column.
+	 */
+	Oid			parent_reloid;	/* OID of parent relation */
+} AppendRelInfo;
+
+/*
+ * For each distinct placeholder expression generated during planning, we
+ * store a PlaceHolderInfo node in the PlannerInfo node's placeholder_list.
+ * This stores info that is needed centrally rather than in each copy of the
+ * PlaceHolderVar.  The phid fields identify which PlaceHolderInfo goes with
+ * each PlaceHolderVar.  Note that phid is unique throughout a planner run,
+ * not just within a query level --- this is so that we need not reassign ID's
+ * when pulling a subquery into its parent.
+ *
+ * The idea is to evaluate the expression at (only) the ph_eval_at join level,
+ * then allow it to bubble up like a Var until the ph_needed join level.
+ * ph_needed has the same definition as attr_needed for a regular Var.
+ *
+ * The PlaceHolderVar's expression might contain LATERAL references to vars
+ * coming from outside its syntactic scope.  If so, those rels are *not*
+ * included in ph_eval_at, but they are recorded in ph_lateral.
+ *
+ * Notice that when ph_eval_at is a join rather than a single baserel, the
+ * PlaceHolderInfo may create constraints on join order: the ph_eval_at join
+ * has to be formed below any outer joins that should null the PlaceHolderVar.
+ *
+ * We create a PlaceHolderInfo only after determining that the PlaceHolderVar
+ * is actually referenced in the plan tree, so that unreferenced placeholders
+ * don't result in unnecessary constraints on join order.
+ */
+
+typedef struct PlaceHolderInfo
+{
+	NodeTag		type;
+
+	Index		phid;			/* ID for PH (unique within planner run) */
+	PlaceHolderVar *ph_var;		/* copy of PlaceHolderVar tree */
+	Relids		ph_eval_at;		/* lowest level we can evaluate value at */
+	Relids		ph_lateral;		/* relids of contained lateral refs, if any */
+	Relids		ph_needed;		/* highest level the value is needed at */
+	int32		ph_width;		/* estimated attribute width */
+} PlaceHolderInfo;
+
+/*
+ * For each potentially index-optimizable MIN/MAX aggregate function,
+ * root->minmax_aggs stores a MinMaxAggInfo describing it.
+ */
+typedef struct MinMaxAggInfo
+{
+	NodeTag		type;
+
+	Oid			aggfnoid;		/* pg_proc Oid of the aggregate */
+	Oid			aggsortop;		/* Oid of its sort operator */
+	Expr	   *target;			/* expression we are aggregating on */
+	PlannerInfo *subroot;		/* modified "root" for planning the subquery */
+	Path	   *path;			/* access path for subquery */
+	Cost		pathcost;		/* estimated cost to fetch first row */
+	Param	   *param;			/* param for subplan's output */
+} MinMaxAggInfo;
+
+/*
+ * At runtime, PARAM_EXEC slots are used to pass values around from one plan
+ * node to another.  They can be used to pass values down into subqueries (for
+ * outer references in subqueries), or up out of subqueries (for the results
+ * of a subplan), or from a NestLoop plan node into its inner relation (when
+ * the inner scan is parameterized with values from the outer relation).
+ * The planner is responsible for assigning nonconflicting PARAM_EXEC IDs to
+ * the PARAM_EXEC Params it generates.
+ *
+ * Outer references are managed via root->plan_params, which is a list of
+ * PlannerParamItems.  While planning a subquery, each parent query level's
+ * plan_params contains the values required from it by the current subquery.
+ * During create_plan(), we use plan_params to track values that must be
+ * passed from outer to inner sides of NestLoop plan nodes.
+ *
+ * The item a PlannerParamItem represents can be one of three kinds:
+ *
+ * A Var: the slot represents a variable of this level that must be passed
+ * down because subqueries have outer references to it, or must be passed
+ * from a NestLoop node to its inner scan.  The varlevelsup value in the Var
+ * will always be zero.
+ *
+ * A PlaceHolderVar: this works much like the Var case, except that the
+ * entry is a PlaceHolderVar node with a contained expression.  The PHV
+ * will have phlevelsup = 0, and the contained expression is adjusted
+ * to match in level.
+ *
+ * An Aggref (with an expression tree representing its argument): the slot
+ * represents an aggregate expression that is an outer reference for some
+ * subquery.  The Aggref itself has agglevelsup = 0, and its argument tree
+ * is adjusted to match in level.
+ *
+ * Note: we detect duplicate Var and PlaceHolderVar parameters and coalesce
+ * them into one slot, but we do not bother to do that for Aggrefs.
+ * The scope of duplicate-elimination only extends across the set of
+ * parameters passed from one query level into a single subquery, or for
+ * nestloop parameters across the set of nestloop parameters used in a single
+ * query level.  So there is no possibility of a PARAM_EXEC slot being used
+ * for conflicting purposes.
+ *
+ * In addition, PARAM_EXEC slots are assigned for Params representing outputs
+ * from subplans (values that are setParam items for those subplans).  These
+ * IDs need not be tracked via PlannerParamItems, since we do not need any
+ * duplicate-elimination nor later processing of the represented expressions.
+ * Instead, we just record the assignment of the slot number by incrementing
+ * root->glob->nParamExec.
+ */
+typedef struct PlannerParamItem
+{
+	NodeTag		type;
+
+	Node	   *item;			/* the Var, PlaceHolderVar, or Aggref */
+	int			paramId;		/* its assigned PARAM_EXEC slot number */
+} PlannerParamItem;
+
+/*
+ * When making cost estimates for a SEMI or ANTI join, there are some
+ * correction factors that are needed in both nestloop and hash joins
+ * to account for the fact that the executor can stop scanning inner rows
+ * as soon as it finds a match to the current outer row.  These numbers
+ * depend only on the selected outer and inner join relations, not on the
+ * particular paths used for them, so it's worthwhile to calculate them
+ * just once per relation pair not once per considered path.  This struct
+ * is filled by compute_semi_anti_join_factors and must be passed along
+ * to the join cost estimation functions.
+ *
+ * outer_match_frac is the fraction of the outer tuples that are
+ *		expected to have at least one match.
+ * match_count is the average number of matches expected for
+ *		outer tuples that have at least one match.
+ */
+typedef struct SemiAntiJoinFactors
+{
+	Selectivity outer_match_frac;
+	Selectivity match_count;
+} SemiAntiJoinFactors;
+
+/*
+ * Struct for extra information passed to subroutines of add_paths_to_joinrel
+ *
+ * restrictlist contains all of the RestrictInfo nodes for restriction
+ *		clauses that apply to this join
+ * mergeclause_list is a list of RestrictInfo nodes for available
+ *		mergejoin clauses in this join
+ * sjinfo is extra info about special joins for selectivity estimation
+ * semifactors is as shown above (only valid for SEMI or ANTI joins)
+ * param_source_rels are OK targets for parameterization of result paths
+ */
+typedef struct JoinPathExtraData
+{
+	List	   *restrictlist;
+	List	   *mergeclause_list;
+	SpecialJoinInfo *sjinfo;
+	SemiAntiJoinFactors semifactors;
+	Relids		param_source_rels;
+} JoinPathExtraData;
+
+/*
+ * For speed reasons, cost estimation for join paths is performed in two
+ * phases: the first phase tries to quickly derive a lower bound for the
+ * join cost, and then we check if that's sufficient to reject the path.
+ * If not, we come back for a more refined cost estimate.  The first phase
+ * fills a JoinCostWorkspace struct with its preliminary cost estimates
+ * and possibly additional intermediate values.  The second phase takes
+ * these values as inputs to avoid repeating work.
+ *
+ * (Ideally we'd declare this in cost.h, but it's also needed in pathnode.h,
+ * so seems best to put it here.)
+ */
+typedef struct JoinCostWorkspace
+{
+	/* Preliminary cost estimates --- must not be larger than final ones! */
+	Cost		startup_cost;	/* cost expended before fetching any tuples */
+	Cost		total_cost;		/* total cost (assuming all tuples fetched) */
+
+	/* Fields below here should be treated as private to costsize.c */
+	Cost		run_cost;		/* non-startup cost components */
+
+	/* private for cost_nestloop code */
+	Cost		inner_run_cost; /* also used by cost_mergejoin code */
+	Cost		inner_rescan_run_cost;
+
+	/* private for cost_mergejoin code */
+	double		outer_rows;
+	double		inner_rows;
+	double		outer_skip_rows;
+	double		inner_skip_rows;
+
+	/* private for cost_hashjoin code */
+	int			numbuckets;
+	int			numbatches;
+} JoinCostWorkspace;
+
+#endif   /* RELATION_H */
diff --git a/foreign/libpg_query/src/postgres/include/nodes/tidbitmap.h b/foreign/libpg_query/src/postgres/include/nodes/tidbitmap.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/nodes/tidbitmap.h
@@ -0,0 +1,66 @@
+/*-------------------------------------------------------------------------
+ *
+ * tidbitmap.h
+ *	  PostgreSQL tuple-id (TID) bitmap package
+ *
+ * This module provides bitmap data structures that are spiritually
+ * similar to Bitmapsets, but are specially adapted to store sets of
+ * tuple identifiers (TIDs), or ItemPointers.  In particular, the division
+ * of an ItemPointer into BlockNumber and OffsetNumber is catered for.
+ * Also, since we wish to be able to store very large tuple sets in
+ * memory with this data structure, we support "lossy" storage, in which
+ * we no longer remember individual tuple offsets on a page but only the
+ * fact that a particular page needs to be visited.
+ *
+ *
+ * Copyright (c) 2003-2015, PostgreSQL Global Development Group
+ *
+ * src/include/nodes/tidbitmap.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TIDBITMAP_H
+#define TIDBITMAP_H
+
+#include "storage/itemptr.h"
+
+
+/*
+ * Actual bitmap representation is private to tidbitmap.c.  Callers can
+ * do IsA(x, TIDBitmap) on it, but nothing else.
+ */
+typedef struct TIDBitmap TIDBitmap;
+
+/* Likewise, TBMIterator is private */
+typedef struct TBMIterator TBMIterator;
+
+/* Result structure for tbm_iterate */
+typedef struct
+{
+	BlockNumber blockno;		/* page number containing tuples */
+	int			ntuples;		/* -1 indicates lossy result */
+	bool		recheck;		/* should the tuples be rechecked? */
+	/* Note: recheck is always true if ntuples < 0 */
+	OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER];
+} TBMIterateResult;
+
+/* function prototypes in nodes/tidbitmap.c */
+
+extern TIDBitmap *tbm_create(long maxbytes);
+extern void tbm_free(TIDBitmap *tbm);
+
+extern void tbm_add_tuples(TIDBitmap *tbm,
+			   const ItemPointer tids, int ntids,
+			   bool recheck);
+extern void tbm_add_page(TIDBitmap *tbm, BlockNumber pageno);
+
+extern void tbm_union(TIDBitmap *a, const TIDBitmap *b);
+extern void tbm_intersect(TIDBitmap *a, const TIDBitmap *b);
+
+extern bool tbm_is_empty(const TIDBitmap *tbm);
+
+extern TBMIterator *tbm_begin_iterate(TIDBitmap *tbm);
+extern TBMIterateResult *tbm_iterate(TBMIterator *iterator);
+extern void tbm_end_iterate(TBMIterator *iterator);
+
+#endif   /* TIDBITMAP_H */
diff --git a/foreign/libpg_query/src/postgres/include/nodes/value.h b/foreign/libpg_query/src/postgres/include/nodes/value.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/nodes/value.h
@@ -0,0 +1,61 @@
+/*-------------------------------------------------------------------------
+ *
+ * value.h
+ *	  interface for Value nodes
+ *
+ *
+ * Copyright (c) 2003-2015, PostgreSQL Global Development Group
+ *
+ * src/include/nodes/value.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef VALUE_H
+#define VALUE_H
+
+#include "nodes/nodes.h"
+
+/*----------------------
+ *		Value node
+ *
+ * The same Value struct is used for five node types: T_Integer,
+ * T_Float, T_String, T_BitString, T_Null.
+ *
+ * Integral values are actually represented by a machine integer,
+ * but both floats and strings are represented as strings.
+ * Using T_Float as the node type simply indicates that
+ * the contents of the string look like a valid numeric literal.
+ *
+ * (Before Postgres 7.0, we used a double to represent T_Float,
+ * but that creates loss-of-precision problems when the value is
+ * ultimately destined to be converted to NUMERIC.  Since Value nodes
+ * are only used in the parsing process, not for runtime data, it's
+ * better to use the more general representation.)
+ *
+ * Note that an integer-looking string will get lexed as T_Float if
+ * the value is too large to fit in a 'long'.
+ *
+ * Nulls, of course, don't need the value part at all.
+ *----------------------
+ */
+typedef struct Value
+{
+	NodeTag		type;			/* tag appropriately (eg. T_String) */
+	union ValUnion
+	{
+		long		ival;		/* machine integer */
+		char	   *str;		/* string */
+	}			val;
+} Value;
+
+#define intVal(v)		(((Value *)(v))->val.ival)
+#define floatVal(v)		atof(((Value *)(v))->val.str)
+#define strVal(v)		(((Value *)(v))->val.str)
+
+extern Value *makeInteger(long i);
+extern Value *makeFloat(char *numericStr);
+extern Value *makeString(char *str);
+extern Value *makeBitString(char *str);
+
+#endif   /* VALUE_H */
diff --git a/foreign/libpg_query/src/postgres/include/optimizer/cost.h b/foreign/libpg_query/src/postgres/include/optimizer/cost.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/optimizer/cost.h
@@ -0,0 +1,194 @@
+/*-------------------------------------------------------------------------
+ *
+ * cost.h
+ *	  prototypes for costsize.c and clausesel.c.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/optimizer/cost.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef COST_H
+#define COST_H
+
+#include "nodes/plannodes.h"
+#include "nodes/relation.h"
+
+
+/* defaults for costsize.c's Cost parameters */
+/* NB: cost-estimation code should use the variables, not these constants! */
+/* If you change these, update backend/utils/misc/postgresql.sample.conf */
+#define DEFAULT_SEQ_PAGE_COST  1.0
+#define DEFAULT_RANDOM_PAGE_COST  4.0
+#define DEFAULT_CPU_TUPLE_COST	0.01
+#define DEFAULT_CPU_INDEX_TUPLE_COST 0.005
+#define DEFAULT_CPU_OPERATOR_COST  0.0025
+
+#define DEFAULT_EFFECTIVE_CACHE_SIZE  524288	/* measured in pages */
+
+typedef enum
+{
+	CONSTRAINT_EXCLUSION_OFF,	/* do not use c_e */
+	CONSTRAINT_EXCLUSION_ON,	/* apply c_e to all rels */
+	CONSTRAINT_EXCLUSION_PARTITION		/* apply c_e to otherrels only */
+}	ConstraintExclusionType;
+
+
+/*
+ * prototypes for costsize.c
+ *	  routines to compute costs and sizes
+ */
+
+/* parameter variables and flags */
+extern PGDLLIMPORT double seq_page_cost;
+extern PGDLLIMPORT double random_page_cost;
+extern PGDLLIMPORT double cpu_tuple_cost;
+extern PGDLLIMPORT double cpu_index_tuple_cost;
+extern PGDLLIMPORT double cpu_operator_cost;
+extern PGDLLIMPORT int effective_cache_size;
+extern Cost disable_cost;
+extern bool enable_seqscan;
+extern bool enable_indexscan;
+extern bool enable_indexonlyscan;
+extern bool enable_bitmapscan;
+extern bool enable_tidscan;
+extern bool enable_sort;
+extern bool enable_hashagg;
+extern bool enable_nestloop;
+extern bool enable_material;
+extern bool enable_mergejoin;
+extern bool enable_hashjoin;
+extern int	constraint_exclusion;
+
+extern double clamp_row_est(double nrows);
+extern double index_pages_fetched(double tuples_fetched, BlockNumber pages,
+					double index_pages, PlannerInfo *root);
+extern void cost_seqscan(Path *path, PlannerInfo *root, RelOptInfo *baserel,
+			 ParamPathInfo *param_info);
+extern void cost_samplescan(Path *path, PlannerInfo *root, RelOptInfo *baserel,
+				ParamPathInfo *param_info);
+extern void cost_index(IndexPath *path, PlannerInfo *root,
+		   double loop_count);
+extern void cost_bitmap_heap_scan(Path *path, PlannerInfo *root, RelOptInfo *baserel,
+					  ParamPathInfo *param_info,
+					  Path *bitmapqual, double loop_count);
+extern void cost_bitmap_and_node(BitmapAndPath *path, PlannerInfo *root);
+extern void cost_bitmap_or_node(BitmapOrPath *path, PlannerInfo *root);
+extern void cost_bitmap_tree_node(Path *path, Cost *cost, Selectivity *selec);
+extern void cost_tidscan(Path *path, PlannerInfo *root,
+			 RelOptInfo *baserel, List *tidquals, ParamPathInfo *param_info);
+extern void cost_subqueryscan(Path *path, PlannerInfo *root,
+				  RelOptInfo *baserel, ParamPathInfo *param_info);
+extern void cost_functionscan(Path *path, PlannerInfo *root,
+				  RelOptInfo *baserel, ParamPathInfo *param_info);
+extern void cost_valuesscan(Path *path, PlannerInfo *root,
+				RelOptInfo *baserel, ParamPathInfo *param_info);
+extern void cost_ctescan(Path *path, PlannerInfo *root,
+			 RelOptInfo *baserel, ParamPathInfo *param_info);
+extern void cost_recursive_union(Plan *runion, Plan *nrterm, Plan *rterm);
+extern void cost_sort(Path *path, PlannerInfo *root,
+		  List *pathkeys, Cost input_cost, double tuples, int width,
+		  Cost comparison_cost, int sort_mem,
+		  double limit_tuples);
+extern void cost_merge_append(Path *path, PlannerInfo *root,
+				  List *pathkeys, int n_streams,
+				  Cost input_startup_cost, Cost input_total_cost,
+				  double tuples);
+extern void cost_material(Path *path,
+			  Cost input_startup_cost, Cost input_total_cost,
+			  double tuples, int width);
+extern void cost_agg(Path *path, PlannerInfo *root,
+		 AggStrategy aggstrategy, const AggClauseCosts *aggcosts,
+		 int numGroupCols, double numGroups,
+		 Cost input_startup_cost, Cost input_total_cost,
+		 double input_tuples);
+extern void cost_windowagg(Path *path, PlannerInfo *root,
+			   List *windowFuncs, int numPartCols, int numOrderCols,
+			   Cost input_startup_cost, Cost input_total_cost,
+			   double input_tuples);
+extern void cost_group(Path *path, PlannerInfo *root,
+		   int numGroupCols, double numGroups,
+		   Cost input_startup_cost, Cost input_total_cost,
+		   double input_tuples);
+extern void initial_cost_nestloop(PlannerInfo *root,
+					  JoinCostWorkspace *workspace,
+					  JoinType jointype,
+					  Path *outer_path, Path *inner_path,
+					  SpecialJoinInfo *sjinfo,
+					  SemiAntiJoinFactors *semifactors);
+extern void final_cost_nestloop(PlannerInfo *root, NestPath *path,
+					JoinCostWorkspace *workspace,
+					SpecialJoinInfo *sjinfo,
+					SemiAntiJoinFactors *semifactors);
+extern void initial_cost_mergejoin(PlannerInfo *root,
+					   JoinCostWorkspace *workspace,
+					   JoinType jointype,
+					   List *mergeclauses,
+					   Path *outer_path, Path *inner_path,
+					   List *outersortkeys, List *innersortkeys,
+					   SpecialJoinInfo *sjinfo);
+extern void final_cost_mergejoin(PlannerInfo *root, MergePath *path,
+					 JoinCostWorkspace *workspace,
+					 SpecialJoinInfo *sjinfo);
+extern void initial_cost_hashjoin(PlannerInfo *root,
+					  JoinCostWorkspace *workspace,
+					  JoinType jointype,
+					  List *hashclauses,
+					  Path *outer_path, Path *inner_path,
+					  SpecialJoinInfo *sjinfo,
+					  SemiAntiJoinFactors *semifactors);
+extern void final_cost_hashjoin(PlannerInfo *root, HashPath *path,
+					JoinCostWorkspace *workspace,
+					SpecialJoinInfo *sjinfo,
+					SemiAntiJoinFactors *semifactors);
+extern void cost_subplan(PlannerInfo *root, SubPlan *subplan, Plan *plan);
+extern void cost_qual_eval(QualCost *cost, List *quals, PlannerInfo *root);
+extern void cost_qual_eval_node(QualCost *cost, Node *qual, PlannerInfo *root);
+extern void compute_semi_anti_join_factors(PlannerInfo *root,
+							   RelOptInfo *outerrel,
+							   RelOptInfo *innerrel,
+							   JoinType jointype,
+							   SpecialJoinInfo *sjinfo,
+							   List *restrictlist,
+							   SemiAntiJoinFactors *semifactors);
+extern void set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel);
+extern double get_parameterized_baserel_size(PlannerInfo *root,
+							   RelOptInfo *rel,
+							   List *param_clauses);
+extern double get_parameterized_joinrel_size(PlannerInfo *root,
+							   RelOptInfo *rel,
+							   double outer_rows,
+							   double inner_rows,
+							   SpecialJoinInfo *sjinfo,
+							   List *restrict_clauses);
+extern void set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
+						   RelOptInfo *outer_rel,
+						   RelOptInfo *inner_rel,
+						   SpecialJoinInfo *sjinfo,
+						   List *restrictlist);
+extern void set_subquery_size_estimates(PlannerInfo *root, RelOptInfo *rel);
+extern void set_function_size_estimates(PlannerInfo *root, RelOptInfo *rel);
+extern void set_values_size_estimates(PlannerInfo *root, RelOptInfo *rel);
+extern void set_cte_size_estimates(PlannerInfo *root, RelOptInfo *rel,
+					   Plan *cteplan);
+extern void set_foreign_size_estimates(PlannerInfo *root, RelOptInfo *rel);
+
+/*
+ * prototypes for clausesel.c
+ *	  routines to compute clause selectivities
+ */
+extern Selectivity clauselist_selectivity(PlannerInfo *root,
+					   List *clauses,
+					   int varRelid,
+					   JoinType jointype,
+					   SpecialJoinInfo *sjinfo);
+extern Selectivity clause_selectivity(PlannerInfo *root,
+				   Node *clause,
+				   int varRelid,
+				   JoinType jointype,
+				   SpecialJoinInfo *sjinfo);
+
+#endif   /* COST_H */
diff --git a/foreign/libpg_query/src/postgres/include/optimizer/geqo.h b/foreign/libpg_query/src/postgres/include/optimizer/geqo.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/optimizer/geqo.h
@@ -0,0 +1,88 @@
+/*-------------------------------------------------------------------------
+ *
+ * geqo.h
+ *	  prototypes for various files in optimizer/geqo
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/optimizer/geqo.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/* contributed by:
+   =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
+   *  Martin Utesch				 * Institute of Automatic Control	   *
+   =							 = University of Mining and Technology =
+   *  utesch@aut.tu-freiberg.de  * Freiberg, Germany				   *
+   =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
+ */
+
+#ifndef GEQO_H
+#define GEQO_H
+
+#include "nodes/relation.h"
+#include "optimizer/geqo_gene.h"
+
+
+/* GEQO debug flag */
+/*
+ #define GEQO_DEBUG
+ */
+
+/* recombination mechanism */
+/*
+ #define ERX
+ #define PMX
+ #define CX
+ #define PX
+ #define OX1
+ #define OX2
+ */
+#define ERX
+
+
+/*
+ * Configuration options
+ *
+ * If you change these, update backend/utils/misc/postgresql.conf.sample
+ */
+extern int	Geqo_effort;		/* 1 .. 10, knob for adjustment of defaults */
+
+#define DEFAULT_GEQO_EFFORT 5
+#define MIN_GEQO_EFFORT 1
+#define MAX_GEQO_EFFORT 10
+
+extern int	Geqo_pool_size;		/* 2 .. inf, or 0 to use default */
+
+extern int	Geqo_generations;	/* 1 .. inf, or 0 to use default */
+
+extern double Geqo_selection_bias;
+
+#define DEFAULT_GEQO_SELECTION_BIAS 2.0
+#define MIN_GEQO_SELECTION_BIAS 1.5
+#define MAX_GEQO_SELECTION_BIAS 2.0
+
+extern double Geqo_seed;		/* 0 .. 1 */
+
+
+/*
+ * Private state for a GEQO run --- accessible via root->join_search_private
+ */
+typedef struct
+{
+	List	   *initial_rels;	/* the base relations we are joining */
+	unsigned short random_state[3];		/* state for pg_erand48() */
+} GeqoPrivateData;
+
+
+/* routines in geqo_main.c */
+extern RelOptInfo *geqo(PlannerInfo *root,
+	 int number_of_rels, List *initial_rels);
+
+/* routines in geqo_eval.c */
+extern Cost geqo_eval(PlannerInfo *root, Gene *tour, int num_gene);
+extern RelOptInfo *gimme_tree(PlannerInfo *root, Gene *tour, int num_gene);
+
+#endif   /* GEQO_H */
diff --git a/foreign/libpg_query/src/postgres/include/optimizer/geqo_gene.h b/foreign/libpg_query/src/postgres/include/optimizer/geqo_gene.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/optimizer/geqo_gene.h
@@ -0,0 +1,45 @@
+/*-------------------------------------------------------------------------
+ *
+ * geqo_gene.h
+ *	  genome representation in optimizer/geqo
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/optimizer/geqo_gene.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/* contributed by:
+   =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
+   *  Martin Utesch				 * Institute of Automatic Control	   *
+   =							 = University of Mining and Technology =
+   *  utesch@aut.tu-freiberg.de  * Freiberg, Germany				   *
+   =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
+ */
+
+
+#ifndef GEQO_GENE_H
+#define GEQO_GENE_H
+
+#include "nodes/nodes.h"
+
+/* we presume that int instead of Relid
+   is o.k. for Gene; so don't change it! */
+typedef int Gene;
+
+typedef struct Chromosome
+{
+	Gene	   *string;
+	Cost		worth;
+} Chromosome;
+
+typedef struct Pool
+{
+	Chromosome *data;
+	int			size;
+	int			string_length;
+} Pool;
+
+#endif   /* GEQO_GENE_H */
diff --git a/foreign/libpg_query/src/postgres/include/optimizer/paths.h b/foreign/libpg_query/src/postgres/include/optimizer/paths.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/optimizer/paths.h
@@ -0,0 +1,215 @@
+/*-------------------------------------------------------------------------
+ *
+ * paths.h
+ *	  prototypes for various files in optimizer/path
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/optimizer/paths.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PATHS_H
+#define PATHS_H
+
+#include "nodes/relation.h"
+
+
+/*
+ * allpaths.c
+ */
+extern bool enable_geqo;
+extern int	geqo_threshold;
+
+/* Hook for plugins to get control in set_rel_pathlist() */
+typedef void (*set_rel_pathlist_hook_type) (PlannerInfo *root,
+														RelOptInfo *rel,
+														Index rti,
+														RangeTblEntry *rte);
+extern PGDLLIMPORT set_rel_pathlist_hook_type set_rel_pathlist_hook;
+
+/* Hook for plugins to get control in add_paths_to_joinrel() */
+typedef void (*set_join_pathlist_hook_type) (PlannerInfo *root,
+														 RelOptInfo *joinrel,
+														 RelOptInfo *outerrel,
+														 RelOptInfo *innerrel,
+														 JoinType jointype,
+												   JoinPathExtraData *extra);
+extern PGDLLIMPORT set_join_pathlist_hook_type set_join_pathlist_hook;
+
+/* Hook for plugins to replace standard_join_search() */
+typedef RelOptInfo *(*join_search_hook_type) (PlannerInfo *root,
+														  int levels_needed,
+														  List *initial_rels);
+extern PGDLLIMPORT join_search_hook_type join_search_hook;
+
+
+extern RelOptInfo *make_one_rel(PlannerInfo *root, List *joinlist);
+extern RelOptInfo *standard_join_search(PlannerInfo *root, int levels_needed,
+					 List *initial_rels);
+
+#ifdef OPTIMIZER_DEBUG
+extern void debug_print_rel(PlannerInfo *root, RelOptInfo *rel);
+#endif
+
+/*
+ * indxpath.c
+ *	  routines to generate index paths
+ */
+extern void create_index_paths(PlannerInfo *root, RelOptInfo *rel);
+extern bool relation_has_unique_index_for(PlannerInfo *root, RelOptInfo *rel,
+							  List *restrictlist,
+							  List *exprlist, List *oprlist);
+extern bool match_index_to_operand(Node *operand, int indexcol,
+					   IndexOptInfo *index);
+extern void expand_indexqual_conditions(IndexOptInfo *index,
+							List *indexclauses, List *indexclausecols,
+							List **indexquals_p, List **indexqualcols_p);
+extern void check_partial_indexes(PlannerInfo *root, RelOptInfo *rel);
+extern Expr *adjust_rowcompare_for_index(RowCompareExpr *clause,
+							IndexOptInfo *index,
+							int indexcol,
+							List **indexcolnos,
+							bool *var_on_left_p);
+
+/*
+ * tidpath.h
+ *	  routines to generate tid paths
+ */
+extern void create_tidscan_paths(PlannerInfo *root, RelOptInfo *rel);
+
+/*
+ * joinpath.c
+ *	   routines to create join paths
+ */
+extern void add_paths_to_joinrel(PlannerInfo *root, RelOptInfo *joinrel,
+					 RelOptInfo *outerrel, RelOptInfo *innerrel,
+					 JoinType jointype, SpecialJoinInfo *sjinfo,
+					 List *restrictlist);
+
+/*
+ * joinrels.c
+ *	  routines to determine which relations to join
+ */
+extern void join_search_one_level(PlannerInfo *root, int level);
+extern RelOptInfo *make_join_rel(PlannerInfo *root,
+			  RelOptInfo *rel1, RelOptInfo *rel2);
+extern bool have_join_order_restriction(PlannerInfo *root,
+							RelOptInfo *rel1, RelOptInfo *rel2);
+extern bool have_dangerous_phv(PlannerInfo *root,
+				   Relids outer_relids, Relids inner_params);
+
+/*
+ * equivclass.c
+ *	  routines for managing EquivalenceClasses
+ */
+typedef bool (*ec_matches_callback_type) (PlannerInfo *root,
+													  RelOptInfo *rel,
+													  EquivalenceClass *ec,
+													  EquivalenceMember *em,
+													  void *arg);
+
+extern bool process_equivalence(PlannerInfo *root, RestrictInfo *restrictinfo,
+					bool below_outer_join);
+extern Expr *canonicalize_ec_expression(Expr *expr,
+						   Oid req_type, Oid req_collation);
+extern void reconsider_outer_join_clauses(PlannerInfo *root);
+extern EquivalenceClass *get_eclass_for_sort_expr(PlannerInfo *root,
+						 Expr *expr,
+						 Relids nullable_relids,
+						 List *opfamilies,
+						 Oid opcintype,
+						 Oid collation,
+						 Index sortref,
+						 Relids rel,
+						 bool create_it);
+extern void generate_base_implied_equalities(PlannerInfo *root);
+extern List *generate_join_implied_equalities(PlannerInfo *root,
+								 Relids join_relids,
+								 Relids outer_relids,
+								 RelOptInfo *inner_rel);
+extern List *generate_join_implied_equalities_for_ecs(PlannerInfo *root,
+										 List *eclasses,
+										 Relids join_relids,
+										 Relids outer_relids,
+										 RelOptInfo *inner_rel);
+extern bool exprs_known_equal(PlannerInfo *root, Node *item1, Node *item2);
+extern void add_child_rel_equivalences(PlannerInfo *root,
+						   AppendRelInfo *appinfo,
+						   RelOptInfo *parent_rel,
+						   RelOptInfo *child_rel);
+extern void mutate_eclass_expressions(PlannerInfo *root,
+						  Node *(*mutator) (),
+						  void *context,
+						  bool include_child_exprs);
+extern List *generate_implied_equalities_for_column(PlannerInfo *root,
+									   RelOptInfo *rel,
+									   ec_matches_callback_type callback,
+									   void *callback_arg,
+									   Relids prohibited_rels);
+extern bool have_relevant_eclass_joinclause(PlannerInfo *root,
+								RelOptInfo *rel1, RelOptInfo *rel2);
+extern bool has_relevant_eclass_joinclause(PlannerInfo *root,
+							   RelOptInfo *rel1);
+extern bool eclass_useful_for_merging(PlannerInfo *root,
+						  EquivalenceClass *eclass,
+						  RelOptInfo *rel);
+extern bool is_redundant_derived_clause(RestrictInfo *rinfo, List *clauselist);
+
+/*
+ * pathkeys.c
+ *	  utilities for matching and building path keys
+ */
+typedef enum
+{
+	PATHKEYS_EQUAL,				/* pathkeys are identical */
+	PATHKEYS_BETTER1,			/* pathkey 1 is a superset of pathkey 2 */
+	PATHKEYS_BETTER2,			/* vice versa */
+	PATHKEYS_DIFFERENT			/* neither pathkey includes the other */
+} PathKeysComparison;
+
+extern PathKeysComparison compare_pathkeys(List *keys1, List *keys2);
+extern bool pathkeys_contained_in(List *keys1, List *keys2);
+extern Path *get_cheapest_path_for_pathkeys(List *paths, List *pathkeys,
+							   Relids required_outer,
+							   CostSelector cost_criterion);
+extern Path *get_cheapest_fractional_path_for_pathkeys(List *paths,
+										  List *pathkeys,
+										  Relids required_outer,
+										  double fraction);
+extern List *build_index_pathkeys(PlannerInfo *root, IndexOptInfo *index,
+					 ScanDirection scandir);
+extern List *build_expression_pathkey(PlannerInfo *root, Expr *expr,
+						 Relids nullable_relids, Oid opno,
+						 Relids rel, bool create_it);
+extern List *convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel,
+						  List *subquery_pathkeys);
+extern List *build_join_pathkeys(PlannerInfo *root,
+					RelOptInfo *joinrel,
+					JoinType jointype,
+					List *outer_pathkeys);
+extern List *make_pathkeys_for_sortclauses(PlannerInfo *root,
+							  List *sortclauses,
+							  List *tlist);
+extern void initialize_mergeclause_eclasses(PlannerInfo *root,
+								RestrictInfo *restrictinfo);
+extern void update_mergeclause_eclasses(PlannerInfo *root,
+							RestrictInfo *restrictinfo);
+extern List *find_mergeclauses_for_pathkeys(PlannerInfo *root,
+							   List *pathkeys,
+							   bool outer_keys,
+							   List *restrictinfos);
+extern List *select_outer_pathkeys_for_merge(PlannerInfo *root,
+								List *mergeclauses,
+								RelOptInfo *joinrel);
+extern List *make_inner_pathkeys_for_merge(PlannerInfo *root,
+							  List *mergeclauses,
+							  List *outer_pathkeys);
+extern List *truncate_useless_pathkeys(PlannerInfo *root,
+						  RelOptInfo *rel,
+						  List *pathkeys);
+extern bool has_useful_pathkeys(PlannerInfo *root, RelOptInfo *rel);
+
+#endif   /* PATHS_H */
diff --git a/foreign/libpg_query/src/postgres/include/optimizer/planmain.h b/foreign/libpg_query/src/postgres/include/optimizer/planmain.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/optimizer/planmain.h
@@ -0,0 +1,145 @@
+/*-------------------------------------------------------------------------
+ *
+ * planmain.h
+ *	  prototypes for various files in optimizer/plan
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/optimizer/planmain.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PLANMAIN_H
+#define PLANMAIN_H
+
+#include "nodes/plannodes.h"
+#include "nodes/relation.h"
+
+/* GUC parameters */
+#define DEFAULT_CURSOR_TUPLE_FRACTION 0.1
+extern double cursor_tuple_fraction;
+
+/* query_planner callback to compute query_pathkeys */
+typedef void (*query_pathkeys_callback) (PlannerInfo *root, void *extra);
+
+/*
+ * prototypes for plan/planmain.c
+ */
+extern RelOptInfo *query_planner(PlannerInfo *root, List *tlist,
+			  query_pathkeys_callback qp_callback, void *qp_extra);
+
+/*
+ * prototypes for plan/planagg.c
+ */
+extern void preprocess_minmax_aggregates(PlannerInfo *root, List *tlist);
+extern Plan *optimize_minmax_aggregates(PlannerInfo *root, List *tlist,
+						   const AggClauseCosts *aggcosts, Path *best_path);
+
+/*
+ * prototypes for plan/createplan.c
+ */
+extern Plan *create_plan(PlannerInfo *root, Path *best_path);
+extern SubqueryScan *make_subqueryscan(List *qptlist, List *qpqual,
+				  Index scanrelid, Plan *subplan);
+extern ForeignScan *make_foreignscan(List *qptlist, List *qpqual,
+				 Index scanrelid, List *fdw_exprs, List *fdw_private,
+				 List *fdw_scan_tlist, List *fdw_recheck_quals,
+				 Plan *outer_plan);
+extern Append *make_append(List *appendplans, List *tlist);
+extern RecursiveUnion *make_recursive_union(List *tlist,
+					 Plan *lefttree, Plan *righttree, int wtParam,
+					 List *distinctList, long numGroups);
+extern Sort *make_sort_from_pathkeys(PlannerInfo *root, Plan *lefttree,
+						List *pathkeys, double limit_tuples);
+extern Sort *make_sort_from_sortclauses(PlannerInfo *root, List *sortcls,
+						   Plan *lefttree);
+extern Sort *make_sort_from_groupcols(PlannerInfo *root, List *groupcls,
+						 AttrNumber *grpColIdx, Plan *lefttree);
+extern Agg *make_agg(PlannerInfo *root, List *tlist, List *qual,
+		 AggStrategy aggstrategy, const AggClauseCosts *aggcosts,
+		 int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators,
+		 List *groupingSets,
+		 long numGroups,
+		 Plan *lefttree);
+extern WindowAgg *make_windowagg(PlannerInfo *root, List *tlist,
+			   List *windowFuncs, Index winref,
+			   int partNumCols, AttrNumber *partColIdx, Oid *partOperators,
+			   int ordNumCols, AttrNumber *ordColIdx, Oid *ordOperators,
+			   int frameOptions, Node *startOffset, Node *endOffset,
+			   Plan *lefttree);
+extern Group *make_group(PlannerInfo *root, List *tlist, List *qual,
+		   int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators,
+		   double numGroups,
+		   Plan *lefttree);
+extern Plan *materialize_finished_plan(Plan *subplan);
+extern Unique *make_unique(Plan *lefttree, List *distinctList);
+extern LockRows *make_lockrows(Plan *lefttree, List *rowMarks, int epqParam);
+extern Limit *make_limit(Plan *lefttree, Node *limitOffset, Node *limitCount,
+		   int64 offset_est, int64 count_est);
+extern SetOp *make_setop(SetOpCmd cmd, SetOpStrategy strategy, Plan *lefttree,
+		   List *distinctList, AttrNumber flagColIdx, int firstFlag,
+		   long numGroups, double outputRows);
+extern Result *make_result(PlannerInfo *root, List *tlist,
+			Node *resconstantqual, Plan *subplan);
+extern ModifyTable *make_modifytable(PlannerInfo *root,
+				 CmdType operation, bool canSetTag,
+				 Index nominalRelation,
+				 List *resultRelations, List *subplans,
+				 List *withCheckOptionLists, List *returningLists,
+				 List *rowMarks, OnConflictExpr *onconflict, int epqParam);
+extern bool is_projection_capable_plan(Plan *plan);
+
+/*
+ * prototypes for plan/initsplan.c
+ */
+extern int	from_collapse_limit;
+extern int	join_collapse_limit;
+
+extern void add_base_rels_to_query(PlannerInfo *root, Node *jtnode);
+extern void build_base_rel_tlists(PlannerInfo *root, List *final_tlist);
+extern void add_vars_to_targetlist(PlannerInfo *root, List *vars,
+					   Relids where_needed, bool create_new_ph);
+extern void find_lateral_references(PlannerInfo *root);
+extern void create_lateral_join_info(PlannerInfo *root);
+extern List *deconstruct_jointree(PlannerInfo *root);
+extern void distribute_restrictinfo_to_rels(PlannerInfo *root,
+								RestrictInfo *restrictinfo);
+extern void process_implied_equality(PlannerInfo *root,
+						 Oid opno,
+						 Oid collation,
+						 Expr *item1,
+						 Expr *item2,
+						 Relids qualscope,
+						 Relids nullable_relids,
+						 bool below_outer_join,
+						 bool both_const);
+extern RestrictInfo *build_implied_join_equality(Oid opno,
+							Oid collation,
+							Expr *item1,
+							Expr *item2,
+							Relids qualscope,
+							Relids nullable_relids);
+
+/*
+ * prototypes for plan/analyzejoins.c
+ */
+extern List *remove_useless_joins(PlannerInfo *root, List *joinlist);
+extern bool query_supports_distinctness(Query *query);
+extern bool query_is_distinct_for(Query *query, List *colnos, List *opids);
+
+/*
+ * prototypes for plan/setrefs.c
+ */
+extern Plan *set_plan_references(PlannerInfo *root, Plan *plan);
+extern void fix_opfuncids(Node *node);
+extern void set_opfuncid(OpExpr *opexpr);
+extern void set_sa_opfuncid(ScalarArrayOpExpr *opexpr);
+extern void record_plan_function_dependency(PlannerInfo *root, Oid funcid);
+extern void extract_query_dependencies(Node *query,
+						   List **relationOids,
+						   List **invalItems,
+						   bool *hasRowSecurity);
+
+#endif   /* PLANMAIN_H */
diff --git a/foreign/libpg_query/src/postgres/include/optimizer/planner.h b/foreign/libpg_query/src/postgres/include/optimizer/planner.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/optimizer/planner.h
@@ -0,0 +1,52 @@
+/*-------------------------------------------------------------------------
+ *
+ * planner.h
+ *	  prototypes for planner.c.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/optimizer/planner.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PLANNER_H
+#define PLANNER_H
+
+#include "nodes/plannodes.h"
+#include "nodes/relation.h"
+
+
+/* Hook for plugins to get control in planner() */
+typedef PlannedStmt *(*planner_hook_type) (Query *parse,
+													   int cursorOptions,
+												  ParamListInfo boundParams);
+extern PGDLLIMPORT planner_hook_type planner_hook;
+
+
+extern PlannedStmt *planner(Query *parse, int cursorOptions,
+		ParamListInfo boundParams);
+extern PlannedStmt *standard_planner(Query *parse, int cursorOptions,
+				 ParamListInfo boundParams);
+
+extern Plan *subquery_planner(PlannerGlobal *glob, Query *parse,
+				 PlannerInfo *parent_root,
+				 bool hasRecursion, double tuple_fraction,
+				 PlannerInfo **subroot);
+
+extern void add_tlist_costs_to_plan(PlannerInfo *root, Plan *plan,
+						List *tlist);
+
+extern bool is_dummy_plan(Plan *plan);
+
+extern RowMarkType select_rowmark_type(RangeTblEntry *rte,
+					LockClauseStrength strength);
+
+extern Expr *expression_planner(Expr *expr);
+
+extern Expr *preprocess_phv_expression(PlannerInfo *root, Expr *expr);
+
+extern bool plan_cluster_use_sort(Oid tableOid, Oid indexOid);
+
+#endif   /* PLANNER_H */
diff --git a/foreign/libpg_query/src/postgres/include/optimizer/tlist.h b/foreign/libpg_query/src/postgres/include/optimizer/tlist.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/optimizer/tlist.h
@@ -0,0 +1,54 @@
+/*-------------------------------------------------------------------------
+ *
+ * tlist.h
+ *	  prototypes for tlist.c.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/optimizer/tlist.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TLIST_H
+#define TLIST_H
+
+#include "optimizer/var.h"
+
+
+extern TargetEntry *tlist_member(Node *node, List *targetlist);
+extern TargetEntry *tlist_member_ignore_relabel(Node *node, List *targetlist);
+extern TargetEntry *tlist_member_match_var(Var *var, List *targetlist);
+
+extern List *flatten_tlist(List *tlist, PVCAggregateBehavior aggbehavior,
+			  PVCPlaceHolderBehavior phbehavior);
+extern List *add_to_flat_tlist(List *tlist, List *exprs);
+
+extern List *get_tlist_exprs(List *tlist, bool includeJunk);
+
+extern int	count_nonjunk_tlist_entries(List *tlist);
+
+extern bool tlist_same_exprs(List *tlist1, List *tlist2);
+
+extern bool tlist_same_datatypes(List *tlist, List *colTypes, bool junkOK);
+extern bool tlist_same_collations(List *tlist, List *colCollations, bool junkOK);
+
+extern TargetEntry *get_sortgroupref_tle(Index sortref,
+					 List *targetList);
+extern TargetEntry *get_sortgroupclause_tle(SortGroupClause *sgClause,
+						List *targetList);
+extern Node *get_sortgroupclause_expr(SortGroupClause *sgClause,
+						 List *targetList);
+extern List *get_sortgrouplist_exprs(List *sgClauses,
+						List *targetList);
+
+extern SortGroupClause *get_sortgroupref_clause(Index sortref,
+						List *clauses);
+
+extern Oid *extract_grouping_ops(List *groupClause);
+extern AttrNumber *extract_grouping_cols(List *groupClause, List *tlist);
+extern bool grouping_is_sortable(List *groupClause);
+extern bool grouping_is_hashable(List *groupClause);
+
+#endif   /* TLIST_H */
diff --git a/foreign/libpg_query/src/postgres/include/optimizer/var.h b/foreign/libpg_query/src/postgres/include/optimizer/var.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/optimizer/var.h
@@ -0,0 +1,44 @@
+/*-------------------------------------------------------------------------
+ *
+ * var.h
+ *	  prototypes for optimizer/util/var.c.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/optimizer/var.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef VAR_H
+#define VAR_H
+
+#include "nodes/relation.h"
+
+typedef enum
+{
+	PVC_REJECT_AGGREGATES,		/* throw error if Aggref found */
+	PVC_INCLUDE_AGGREGATES,		/* include Aggrefs in output list */
+	PVC_RECURSE_AGGREGATES		/* recurse into Aggref arguments */
+} PVCAggregateBehavior;
+
+typedef enum
+{
+	PVC_REJECT_PLACEHOLDERS,	/* throw error if PlaceHolderVar found */
+	PVC_INCLUDE_PLACEHOLDERS,	/* include PlaceHolderVars in output list */
+	PVC_RECURSE_PLACEHOLDERS	/* recurse into PlaceHolderVar arguments */
+} PVCPlaceHolderBehavior;
+
+extern Relids pull_varnos(Node *node);
+extern Relids pull_varnos_of_level(Node *node, int levelsup);
+extern void pull_varattnos(Node *node, Index varno, Bitmapset **varattnos);
+extern List *pull_vars_of_level(Node *node, int levelsup);
+extern bool contain_var_clause(Node *node);
+extern bool contain_vars_of_level(Node *node, int levelsup);
+extern int	locate_var_of_level(Node *node, int levelsup);
+extern List *pull_var_clause(Node *node, PVCAggregateBehavior aggbehavior,
+				PVCPlaceHolderBehavior phbehavior);
+extern Node *flatten_join_alias_vars(PlannerInfo *root, Node *node);
+
+#endif   /* VAR_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/analyze.h b/foreign/libpg_query/src/postgres/include/parser/analyze.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/analyze.h
@@ -0,0 +1,45 @@
+/*-------------------------------------------------------------------------
+ *
+ * analyze.h
+ *		parse analysis for optimizable statements
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/analyze.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef ANALYZE_H
+#define ANALYZE_H
+
+#include "parser/parse_node.h"
+
+/* Hook for plugins to get control at end of parse analysis */
+typedef void (*post_parse_analyze_hook_type) (ParseState *pstate,
+														  Query *query);
+extern PGDLLIMPORT post_parse_analyze_hook_type post_parse_analyze_hook;
+
+
+extern Query *parse_analyze(Node *parseTree, const char *sourceText,
+			  Oid *paramTypes, int numParams);
+extern Query *parse_analyze_varparams(Node *parseTree, const char *sourceText,
+						Oid **paramTypes, int *numParams);
+
+extern Query *parse_sub_analyze(Node *parseTree, ParseState *parentParseState,
+				  CommonTableExpr *parentCTE,
+				  bool locked_from_parent);
+
+extern Query *transformTopLevelStmt(ParseState *pstate, Node *parseTree);
+extern Query *transformStmt(ParseState *pstate, Node *parseTree);
+
+extern bool analyze_requires_snapshot(Node *parseTree);
+
+extern const char *LCS_asString(LockClauseStrength strength);
+extern void CheckSelectLocking(Query *qry, LockClauseStrength strength);
+extern void applyLockingClause(Query *qry, Index rtindex,
+				   LockClauseStrength strength,
+				   LockWaitPolicy waitPolicy, bool pushedDown);
+
+#endif   /* ANALYZE_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/gram.h b/foreign/libpg_query/src/postgres/include/parser/gram.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/gram.h
@@ -0,0 +1,986 @@
+/* A Bison parser, made by GNU Bison 2.3.  */
+
+/* Skeleton interface for Bison's Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     IDENT = 258,
+     FCONST = 259,
+     SCONST = 260,
+     BCONST = 261,
+     XCONST = 262,
+     Op = 263,
+     ICONST = 264,
+     PARAM = 265,
+     TYPECAST = 266,
+     DOT_DOT = 267,
+     COLON_EQUALS = 268,
+     EQUALS_GREATER = 269,
+     LESS_EQUALS = 270,
+     GREATER_EQUALS = 271,
+     NOT_EQUALS = 272,
+     ABORT_P = 273,
+     ABSOLUTE_P = 274,
+     ACCESS = 275,
+     ACTION = 276,
+     ADD_P = 277,
+     ADMIN = 278,
+     AFTER = 279,
+     AGGREGATE = 280,
+     ALL = 281,
+     ALSO = 282,
+     ALTER = 283,
+     ALWAYS = 284,
+     ANALYSE = 285,
+     ANALYZE = 286,
+     AND = 287,
+     ANY = 288,
+     ARRAY = 289,
+     AS = 290,
+     ASC = 291,
+     ASSERTION = 292,
+     ASSIGNMENT = 293,
+     ASYMMETRIC = 294,
+     AT = 295,
+     ATTRIBUTE = 296,
+     AUTHORIZATION = 297,
+     BACKWARD = 298,
+     BEFORE = 299,
+     BEGIN_P = 300,
+     BETWEEN = 301,
+     BIGINT = 302,
+     BINARY = 303,
+     BIT = 304,
+     BOOLEAN_P = 305,
+     BOTH = 306,
+     BY = 307,
+     CACHE = 308,
+     CALLED = 309,
+     CASCADE = 310,
+     CASCADED = 311,
+     CASE = 312,
+     CAST = 313,
+     CATALOG_P = 314,
+     CHAIN = 315,
+     CHAR_P = 316,
+     CHARACTER = 317,
+     CHARACTERISTICS = 318,
+     CHECK = 319,
+     CHECKPOINT = 320,
+     CLASS = 321,
+     CLOSE = 322,
+     CLUSTER = 323,
+     COALESCE = 324,
+     COLLATE = 325,
+     COLLATION = 326,
+     COLUMN = 327,
+     COMMENT = 328,
+     COMMENTS = 329,
+     COMMIT = 330,
+     COMMITTED = 331,
+     CONCURRENTLY = 332,
+     CONFIGURATION = 333,
+     CONFLICT = 334,
+     CONNECTION = 335,
+     CONSTRAINT = 336,
+     CONSTRAINTS = 337,
+     CONTENT_P = 338,
+     CONTINUE_P = 339,
+     CONVERSION_P = 340,
+     COPY = 341,
+     COST = 342,
+     CREATE = 343,
+     CROSS = 344,
+     CSV = 345,
+     CUBE = 346,
+     CURRENT_P = 347,
+     CURRENT_CATALOG = 348,
+     CURRENT_DATE = 349,
+     CURRENT_ROLE = 350,
+     CURRENT_SCHEMA = 351,
+     CURRENT_TIME = 352,
+     CURRENT_TIMESTAMP = 353,
+     CURRENT_USER = 354,
+     CURSOR = 355,
+     CYCLE = 356,
+     DATA_P = 357,
+     DATABASE = 358,
+     DAY_P = 359,
+     DEALLOCATE = 360,
+     DEC = 361,
+     DECIMAL_P = 362,
+     DECLARE = 363,
+     DEFAULT = 364,
+     DEFAULTS = 365,
+     DEFERRABLE = 366,
+     DEFERRED = 367,
+     DEFINER = 368,
+     DELETE_P = 369,
+     DELIMITER = 370,
+     DELIMITERS = 371,
+     DESC = 372,
+     DICTIONARY = 373,
+     DISABLE_P = 374,
+     DISCARD = 375,
+     DISTINCT = 376,
+     DO = 377,
+     DOCUMENT_P = 378,
+     DOMAIN_P = 379,
+     DOUBLE_P = 380,
+     DROP = 381,
+     EACH = 382,
+     ELSE = 383,
+     ENABLE_P = 384,
+     ENCODING = 385,
+     ENCRYPTED = 386,
+     END_P = 387,
+     ENUM_P = 388,
+     ESCAPE = 389,
+     EVENT = 390,
+     EXCEPT = 391,
+     EXCLUDE = 392,
+     EXCLUDING = 393,
+     EXCLUSIVE = 394,
+     EXECUTE = 395,
+     EXISTS = 396,
+     EXPLAIN = 397,
+     EXTENSION = 398,
+     EXTERNAL = 399,
+     EXTRACT = 400,
+     FALSE_P = 401,
+     FAMILY = 402,
+     FETCH = 403,
+     FILTER = 404,
+     FIRST_P = 405,
+     FLOAT_P = 406,
+     FOLLOWING = 407,
+     FOR = 408,
+     FORCE = 409,
+     FOREIGN = 410,
+     FORWARD = 411,
+     FREEZE = 412,
+     FROM = 413,
+     FULL = 414,
+     FUNCTION = 415,
+     FUNCTIONS = 416,
+     GLOBAL = 417,
+     GRANT = 418,
+     GRANTED = 419,
+     GREATEST = 420,
+     GROUP_P = 421,
+     GROUPING = 422,
+     HANDLER = 423,
+     HAVING = 424,
+     HEADER_P = 425,
+     HOLD = 426,
+     HOUR_P = 427,
+     IDENTITY_P = 428,
+     IF_P = 429,
+     ILIKE = 430,
+     IMMEDIATE = 431,
+     IMMUTABLE = 432,
+     IMPLICIT_P = 433,
+     IMPORT_P = 434,
+     IN_P = 435,
+     INCLUDING = 436,
+     INCREMENT = 437,
+     INDEX = 438,
+     INDEXES = 439,
+     INHERIT = 440,
+     INHERITS = 441,
+     INITIALLY = 442,
+     INLINE_P = 443,
+     INNER_P = 444,
+     INOUT = 445,
+     INPUT_P = 446,
+     INSENSITIVE = 447,
+     INSERT = 448,
+     INSTEAD = 449,
+     INT_P = 450,
+     INTEGER = 451,
+     INTERSECT = 452,
+     INTERVAL = 453,
+     INTO = 454,
+     INVOKER = 455,
+     IS = 456,
+     ISNULL = 457,
+     ISOLATION = 458,
+     JOIN = 459,
+     KEY = 460,
+     LABEL = 461,
+     LANGUAGE = 462,
+     LARGE_P = 463,
+     LAST_P = 464,
+     LATERAL_P = 465,
+     LEADING = 466,
+     LEAKPROOF = 467,
+     LEAST = 468,
+     LEFT = 469,
+     LEVEL = 470,
+     LIKE = 471,
+     LIMIT = 472,
+     LISTEN = 473,
+     LOAD = 474,
+     LOCAL = 475,
+     LOCALTIME = 476,
+     LOCALTIMESTAMP = 477,
+     LOCATION = 478,
+     LOCK_P = 479,
+     LOCKED = 480,
+     LOGGED = 481,
+     MAPPING = 482,
+     MATCH = 483,
+     MATERIALIZED = 484,
+     MAXVALUE = 485,
+     MINUTE_P = 486,
+     MINVALUE = 487,
+     MODE = 488,
+     MONTH_P = 489,
+     MOVE = 490,
+     NAME_P = 491,
+     NAMES = 492,
+     NATIONAL = 493,
+     NATURAL = 494,
+     NCHAR = 495,
+     NEXT = 496,
+     NO = 497,
+     NONE = 498,
+     NOT = 499,
+     NOTHING = 500,
+     NOTIFY = 501,
+     NOTNULL = 502,
+     NOWAIT = 503,
+     NULL_P = 504,
+     NULLIF = 505,
+     NULLS_P = 506,
+     NUMERIC = 507,
+     OBJECT_P = 508,
+     OF = 509,
+     OFF = 510,
+     OFFSET = 511,
+     OIDS = 512,
+     ON = 513,
+     ONLY = 514,
+     OPERATOR = 515,
+     OPTION = 516,
+     OPTIONS = 517,
+     OR = 518,
+     ORDER = 519,
+     ORDINALITY = 520,
+     OUT_P = 521,
+     OUTER_P = 522,
+     OVER = 523,
+     OVERLAPS = 524,
+     OVERLAY = 525,
+     OWNED = 526,
+     OWNER = 527,
+     PARSER = 528,
+     PARTIAL = 529,
+     PARTITION = 530,
+     PASSING = 531,
+     PASSWORD = 532,
+     PLACING = 533,
+     PLANS = 534,
+     POLICY = 535,
+     POSITION = 536,
+     PRECEDING = 537,
+     PRECISION = 538,
+     PRESERVE = 539,
+     PREPARE = 540,
+     PREPARED = 541,
+     PRIMARY = 542,
+     PRIOR = 543,
+     PRIVILEGES = 544,
+     PROCEDURAL = 545,
+     PROCEDURE = 546,
+     PROGRAM = 547,
+     QUOTE = 548,
+     RANGE = 549,
+     READ = 550,
+     REAL = 551,
+     REASSIGN = 552,
+     RECHECK = 553,
+     RECURSIVE = 554,
+     REF = 555,
+     REFERENCES = 556,
+     REFRESH = 557,
+     REINDEX = 558,
+     RELATIVE_P = 559,
+     RELEASE = 560,
+     RENAME = 561,
+     REPEATABLE = 562,
+     REPLACE = 563,
+     REPLICA = 564,
+     RESET = 565,
+     RESTART = 566,
+     RESTRICT = 567,
+     RETURNING = 568,
+     RETURNS = 569,
+     REVOKE = 570,
+     RIGHT = 571,
+     ROLE = 572,
+     ROLLBACK = 573,
+     ROLLUP = 574,
+     ROW = 575,
+     ROWS = 576,
+     RULE = 577,
+     SAVEPOINT = 578,
+     SCHEMA = 579,
+     SCROLL = 580,
+     SEARCH = 581,
+     SECOND_P = 582,
+     SECURITY = 583,
+     SELECT = 584,
+     SEQUENCE = 585,
+     SEQUENCES = 586,
+     SERIALIZABLE = 587,
+     SERVER = 588,
+     SESSION = 589,
+     SESSION_USER = 590,
+     SET = 591,
+     SETS = 592,
+     SETOF = 593,
+     SHARE = 594,
+     SHOW = 595,
+     SIMILAR = 596,
+     SIMPLE = 597,
+     SKIP = 598,
+     SMALLINT = 599,
+     SNAPSHOT = 600,
+     SOME = 601,
+     SQL_P = 602,
+     STABLE = 603,
+     STANDALONE_P = 604,
+     START = 605,
+     STATEMENT = 606,
+     STATISTICS = 607,
+     STDIN = 608,
+     STDOUT = 609,
+     STORAGE = 610,
+     STRICT_P = 611,
+     STRIP_P = 612,
+     SUBSTRING = 613,
+     SYMMETRIC = 614,
+     SYSID = 615,
+     SYSTEM_P = 616,
+     TABLE = 617,
+     TABLES = 618,
+     TABLESAMPLE = 619,
+     TABLESPACE = 620,
+     TEMP = 621,
+     TEMPLATE = 622,
+     TEMPORARY = 623,
+     TEXT_P = 624,
+     THEN = 625,
+     TIME = 626,
+     TIMESTAMP = 627,
+     TO = 628,
+     TRAILING = 629,
+     TRANSACTION = 630,
+     TRANSFORM = 631,
+     TREAT = 632,
+     TRIGGER = 633,
+     TRIM = 634,
+     TRUE_P = 635,
+     TRUNCATE = 636,
+     TRUSTED = 637,
+     TYPE_P = 638,
+     TYPES_P = 639,
+     UNBOUNDED = 640,
+     UNCOMMITTED = 641,
+     UNENCRYPTED = 642,
+     UNION = 643,
+     UNIQUE = 644,
+     UNKNOWN = 645,
+     UNLISTEN = 646,
+     UNLOGGED = 647,
+     UNTIL = 648,
+     UPDATE = 649,
+     USER = 650,
+     USING = 651,
+     VACUUM = 652,
+     VALID = 653,
+     VALIDATE = 654,
+     VALIDATOR = 655,
+     VALUE_P = 656,
+     VALUES = 657,
+     VARCHAR = 658,
+     VARIADIC = 659,
+     VARYING = 660,
+     VERBOSE = 661,
+     VERSION_P = 662,
+     VIEW = 663,
+     VIEWS = 664,
+     VOLATILE = 665,
+     WHEN = 666,
+     WHERE = 667,
+     WHITESPACE_P = 668,
+     WINDOW = 669,
+     WITH = 670,
+     WITHIN = 671,
+     WITHOUT = 672,
+     WORK = 673,
+     WRAPPER = 674,
+     WRITE = 675,
+     XML_P = 676,
+     XMLATTRIBUTES = 677,
+     XMLCONCAT = 678,
+     XMLELEMENT = 679,
+     XMLEXISTS = 680,
+     XMLFOREST = 681,
+     XMLPARSE = 682,
+     XMLPI = 683,
+     XMLROOT = 684,
+     XMLSERIALIZE = 685,
+     YEAR_P = 686,
+     YES_P = 687,
+     ZONE = 688,
+     NOT_LA = 689,
+     NULLS_LA = 690,
+     WITH_LA = 691,
+     POSTFIXOP = 692,
+     UMINUS = 693
+   };
+#endif
+/* Tokens.  */
+#define IDENT 258
+#define FCONST 259
+#define SCONST 260
+#define BCONST 261
+#define XCONST 262
+#define Op 263
+#define ICONST 264
+#define PARAM 265
+#define TYPECAST 266
+#define DOT_DOT 267
+#define COLON_EQUALS 268
+#define EQUALS_GREATER 269
+#define LESS_EQUALS 270
+#define GREATER_EQUALS 271
+#define NOT_EQUALS 272
+#define ABORT_P 273
+#define ABSOLUTE_P 274
+#define ACCESS 275
+#define ACTION 276
+#define ADD_P 277
+#define ADMIN 278
+#define AFTER 279
+#define AGGREGATE 280
+#define ALL 281
+#define ALSO 282
+#define ALTER 283
+#define ALWAYS 284
+#define ANALYSE 285
+#define ANALYZE 286
+#define AND 287
+#define ANY 288
+#define ARRAY 289
+#define AS 290
+#define ASC 291
+#define ASSERTION 292
+#define ASSIGNMENT 293
+#define ASYMMETRIC 294
+#define AT 295
+#define ATTRIBUTE 296
+#define AUTHORIZATION 297
+#define BACKWARD 298
+#define BEFORE 299
+#define BEGIN_P 300
+#define BETWEEN 301
+#define BIGINT 302
+#define BINARY 303
+#define BIT 304
+#define BOOLEAN_P 305
+#define BOTH 306
+#define BY 307
+#define CACHE 308
+#define CALLED 309
+#define CASCADE 310
+#define CASCADED 311
+#define CASE 312
+#define CAST 313
+#define CATALOG_P 314
+#define CHAIN 315
+#define CHAR_P 316
+#define CHARACTER 317
+#define CHARACTERISTICS 318
+#define CHECK 319
+#define CHECKPOINT 320
+#define CLASS 321
+#define CLOSE 322
+#define CLUSTER 323
+#define COALESCE 324
+#define COLLATE 325
+#define COLLATION 326
+#define COLUMN 327
+#define COMMENT 328
+#define COMMENTS 329
+#define COMMIT 330
+#define COMMITTED 331
+#define CONCURRENTLY 332
+#define CONFIGURATION 333
+#define CONFLICT 334
+#define CONNECTION 335
+#define CONSTRAINT 336
+#define CONSTRAINTS 337
+#define CONTENT_P 338
+#define CONTINUE_P 339
+#define CONVERSION_P 340
+#define COPY 341
+#define COST 342
+#define CREATE 343
+#define CROSS 344
+#define CSV 345
+#define CUBE 346
+#define CURRENT_P 347
+#define CURRENT_CATALOG 348
+#define CURRENT_DATE 349
+#define CURRENT_ROLE 350
+#define CURRENT_SCHEMA 351
+#define CURRENT_TIME 352
+#define CURRENT_TIMESTAMP 353
+#define CURRENT_USER 354
+#define CURSOR 355
+#define CYCLE 356
+#define DATA_P 357
+#define DATABASE 358
+#define DAY_P 359
+#define DEALLOCATE 360
+#define DEC 361
+#define DECIMAL_P 362
+#define DECLARE 363
+#define DEFAULT 364
+#define DEFAULTS 365
+#define DEFERRABLE 366
+#define DEFERRED 367
+#define DEFINER 368
+#define DELETE_P 369
+#define DELIMITER 370
+#define DELIMITERS 371
+#define DESC 372
+#define DICTIONARY 373
+#define DISABLE_P 374
+#define DISCARD 375
+#define DISTINCT 376
+#define DO 377
+#define DOCUMENT_P 378
+#define DOMAIN_P 379
+#define DOUBLE_P 380
+#define DROP 381
+#define EACH 382
+#define ELSE 383
+#define ENABLE_P 384
+#define ENCODING 385
+#define ENCRYPTED 386
+#define END_P 387
+#define ENUM_P 388
+#define ESCAPE 389
+#define EVENT 390
+#define EXCEPT 391
+#define EXCLUDE 392
+#define EXCLUDING 393
+#define EXCLUSIVE 394
+#define EXECUTE 395
+#define EXISTS 396
+#define EXPLAIN 397
+#define EXTENSION 398
+#define EXTERNAL 399
+#define EXTRACT 400
+#define FALSE_P 401
+#define FAMILY 402
+#define FETCH 403
+#define FILTER 404
+#define FIRST_P 405
+#define FLOAT_P 406
+#define FOLLOWING 407
+#define FOR 408
+#define FORCE 409
+#define FOREIGN 410
+#define FORWARD 411
+#define FREEZE 412
+#define FROM 413
+#define FULL 414
+#define FUNCTION 415
+#define FUNCTIONS 416
+#define GLOBAL 417
+#define GRANT 418
+#define GRANTED 419
+#define GREATEST 420
+#define GROUP_P 421
+#define GROUPING 422
+#define HANDLER 423
+#define HAVING 424
+#define HEADER_P 425
+#define HOLD 426
+#define HOUR_P 427
+#define IDENTITY_P 428
+#define IF_P 429
+#define ILIKE 430
+#define IMMEDIATE 431
+#define IMMUTABLE 432
+#define IMPLICIT_P 433
+#define IMPORT_P 434
+#define IN_P 435
+#define INCLUDING 436
+#define INCREMENT 437
+#define INDEX 438
+#define INDEXES 439
+#define INHERIT 440
+#define INHERITS 441
+#define INITIALLY 442
+#define INLINE_P 443
+#define INNER_P 444
+#define INOUT 445
+#define INPUT_P 446
+#define INSENSITIVE 447
+#define INSERT 448
+#define INSTEAD 449
+#define INT_P 450
+#define INTEGER 451
+#define INTERSECT 452
+#define INTERVAL 453
+#define INTO 454
+#define INVOKER 455
+#define IS 456
+#define ISNULL 457
+#define ISOLATION 458
+#define JOIN 459
+#define KEY 460
+#define LABEL 461
+#define LANGUAGE 462
+#define LARGE_P 463
+#define LAST_P 464
+#define LATERAL_P 465
+#define LEADING 466
+#define LEAKPROOF 467
+#define LEAST 468
+#define LEFT 469
+#define LEVEL 470
+#define LIKE 471
+#define LIMIT 472
+#define LISTEN 473
+#define LOAD 474
+#define LOCAL 475
+#define LOCALTIME 476
+#define LOCALTIMESTAMP 477
+#define LOCATION 478
+#define LOCK_P 479
+#define LOCKED 480
+#define LOGGED 481
+#define MAPPING 482
+#define MATCH 483
+#define MATERIALIZED 484
+#define MAXVALUE 485
+#define MINUTE_P 486
+#define MINVALUE 487
+#define MODE 488
+#define MONTH_P 489
+#define MOVE 490
+#define NAME_P 491
+#define NAMES 492
+#define NATIONAL 493
+#define NATURAL 494
+#define NCHAR 495
+#define NEXT 496
+#define NO 497
+#define NONE 498
+#define NOT 499
+#define NOTHING 500
+#define NOTIFY 501
+#define NOTNULL 502
+#define NOWAIT 503
+#define NULL_P 504
+#define NULLIF 505
+#define NULLS_P 506
+#define NUMERIC 507
+#define OBJECT_P 508
+#define OF 509
+#define OFF 510
+#define OFFSET 511
+#define OIDS 512
+#define ON 513
+#define ONLY 514
+#define OPERATOR 515
+#define OPTION 516
+#define OPTIONS 517
+#define OR 518
+#define ORDER 519
+#define ORDINALITY 520
+#define OUT_P 521
+#define OUTER_P 522
+#define OVER 523
+#define OVERLAPS 524
+#define OVERLAY 525
+#define OWNED 526
+#define OWNER 527
+#define PARSER 528
+#define PARTIAL 529
+#define PARTITION 530
+#define PASSING 531
+#define PASSWORD 532
+#define PLACING 533
+#define PLANS 534
+#define POLICY 535
+#define POSITION 536
+#define PRECEDING 537
+#define PRECISION 538
+#define PRESERVE 539
+#define PREPARE 540
+#define PREPARED 541
+#define PRIMARY 542
+#define PRIOR 543
+#define PRIVILEGES 544
+#define PROCEDURAL 545
+#define PROCEDURE 546
+#define PROGRAM 547
+#define QUOTE 548
+#define RANGE 549
+#define READ 550
+#define REAL 551
+#define REASSIGN 552
+#define RECHECK 553
+#define RECURSIVE 554
+#define REF 555
+#define REFERENCES 556
+#define REFRESH 557
+#define REINDEX 558
+#define RELATIVE_P 559
+#define RELEASE 560
+#define RENAME 561
+#define REPEATABLE 562
+#define REPLACE 563
+#define REPLICA 564
+#define RESET 565
+#define RESTART 566
+#define RESTRICT 567
+#define RETURNING 568
+#define RETURNS 569
+#define REVOKE 570
+#define RIGHT 571
+#define ROLE 572
+#define ROLLBACK 573
+#define ROLLUP 574
+#define ROW 575
+#define ROWS 576
+#define RULE 577
+#define SAVEPOINT 578
+#define SCHEMA 579
+#define SCROLL 580
+#define SEARCH 581
+#define SECOND_P 582
+#define SECURITY 583
+#define SELECT 584
+#define SEQUENCE 585
+#define SEQUENCES 586
+#define SERIALIZABLE 587
+#define SERVER 588
+#define SESSION 589
+#define SESSION_USER 590
+#define SET 591
+#define SETS 592
+#define SETOF 593
+#define SHARE 594
+#define SHOW 595
+#define SIMILAR 596
+#define SIMPLE 597
+#define SKIP 598
+#define SMALLINT 599
+#define SNAPSHOT 600
+#define SOME 601
+#define SQL_P 602
+#define STABLE 603
+#define STANDALONE_P 604
+#define START 605
+#define STATEMENT 606
+#define STATISTICS 607
+#define STDIN 608
+#define STDOUT 609
+#define STORAGE 610
+#define STRICT_P 611
+#define STRIP_P 612
+#define SUBSTRING 613
+#define SYMMETRIC 614
+#define SYSID 615
+#define SYSTEM_P 616
+#define TABLE 617
+#define TABLES 618
+#define TABLESAMPLE 619
+#define TABLESPACE 620
+#define TEMP 621
+#define TEMPLATE 622
+#define TEMPORARY 623
+#define TEXT_P 624
+#define THEN 625
+#define TIME 626
+#define TIMESTAMP 627
+#define TO 628
+#define TRAILING 629
+#define TRANSACTION 630
+#define TRANSFORM 631
+#define TREAT 632
+#define TRIGGER 633
+#define TRIM 634
+#define TRUE_P 635
+#define TRUNCATE 636
+#define TRUSTED 637
+#define TYPE_P 638
+#define TYPES_P 639
+#define UNBOUNDED 640
+#define UNCOMMITTED 641
+#define UNENCRYPTED 642
+#define UNION 643
+#define UNIQUE 644
+#define UNKNOWN 645
+#define UNLISTEN 646
+#define UNLOGGED 647
+#define UNTIL 648
+#define UPDATE 649
+#define USER 650
+#define USING 651
+#define VACUUM 652
+#define VALID 653
+#define VALIDATE 654
+#define VALIDATOR 655
+#define VALUE_P 656
+#define VALUES 657
+#define VARCHAR 658
+#define VARIADIC 659
+#define VARYING 660
+#define VERBOSE 661
+#define VERSION_P 662
+#define VIEW 663
+#define VIEWS 664
+#define VOLATILE 665
+#define WHEN 666
+#define WHERE 667
+#define WHITESPACE_P 668
+#define WINDOW 669
+#define WITH 670
+#define WITHIN 671
+#define WITHOUT 672
+#define WORK 673
+#define WRAPPER 674
+#define WRITE 675
+#define XML_P 676
+#define XMLATTRIBUTES 677
+#define XMLCONCAT 678
+#define XMLELEMENT 679
+#define XMLEXISTS 680
+#define XMLFOREST 681
+#define XMLPARSE 682
+#define XMLPI 683
+#define XMLROOT 684
+#define XMLSERIALIZE 685
+#define YEAR_P 686
+#define YES_P 687
+#define ZONE 688
+#define NOT_LA 689
+#define NULLS_LA 690
+#define WITH_LA 691
+#define POSTFIXOP 692
+#define UMINUS 693
+
+
+
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+#line 194 "gram.y"
+{
+	core_YYSTYPE		core_yystype;
+	/* these fields must match core_YYSTYPE: */
+	int					ival;
+	char				*str;
+	const char			*keyword;
+
+	char				chr;
+	bool				boolean;
+	JoinType			jtype;
+	DropBehavior		dbehavior;
+	OnCommitAction		oncommit;
+	List				*list;
+	Node				*node;
+	Value				*value;
+	ObjectType			objtype;
+	TypeName			*typnam;
+	FunctionParameter   *fun_param;
+	FunctionParameterMode fun_param_mode;
+	FuncWithArgs		*funwithargs;
+	DefElem				*defelt;
+	SortBy				*sortby;
+	WindowDef			*windef;
+	JoinExpr			*jexpr;
+	IndexElem			*ielem;
+	Alias				*alias;
+	RangeVar			*range;
+	IntoClause			*into;
+	WithClause			*with;
+	InferClause			*infer;
+	OnConflictClause	*onconflict;
+	A_Indices			*aind;
+	ResTarget			*target;
+	struct PrivTarget	*privtarget;
+	AccessPriv			*accesspriv;
+	struct ImportQual	*importqual;
+	InsertStmt			*istmt;
+	VariableSetStmt		*vsetstmt;
+}
+/* Line 1529 of yacc.c.  */
+#line 965 "gram.h"
+	YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+
+
+#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
+typedef struct YYLTYPE
+{
+  int first_line;
+  int first_column;
+  int last_line;
+  int last_column;
+} YYLTYPE;
+# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
+# define YYLTYPE_IS_DECLARED 1
+# define YYLTYPE_IS_TRIVIAL 1
+#endif
+
+
diff --git a/foreign/libpg_query/src/postgres/include/parser/gramparse.h b/foreign/libpg_query/src/postgres/include/parser/gramparse.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/gramparse.h
@@ -0,0 +1,75 @@
+/*-------------------------------------------------------------------------
+ *
+ * gramparse.h
+ *		Shared definitions for the "raw" parser (flex and bison phases only)
+ *
+ * NOTE: this file is only meant to be included in the core parsing files,
+ * ie, parser.c, gram.y, scan.l, and keywords.c.  Definitions that are needed
+ * outside the core parser should be in parser.h.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/gramparse.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef GRAMPARSE_H
+#define GRAMPARSE_H
+
+#include "nodes/parsenodes.h"
+#include "parser/scanner.h"
+
+/*
+ * NB: include gram.h only AFTER including scanner.h, because scanner.h
+ * is what #defines YYLTYPE.
+ */
+#include "parser/gram.h"
+
+/*
+ * The YY_EXTRA data that a flex scanner allows us to pass around.  Private
+ * state needed for raw parsing/lexing goes here.
+ */
+typedef struct base_yy_extra_type
+{
+	/*
+	 * Fields used by the core scanner.
+	 */
+	core_yy_extra_type core_yy_extra;
+
+	/*
+	 * State variables for base_yylex().
+	 */
+	bool		have_lookahead; /* is lookahead info valid? */
+	int			lookahead_token;	/* one-token lookahead */
+	core_YYSTYPE lookahead_yylval;		/* yylval for lookahead token */
+	YYLTYPE		lookahead_yylloc;		/* yylloc for lookahead token */
+	char	   *lookahead_end;	/* end of current token */
+	char		lookahead_hold_char;	/* to be put back at *lookahead_end */
+
+	/*
+	 * State variables that belong to the grammar.
+	 */
+	List	   *parsetree;		/* final parse result is delivered here */
+} base_yy_extra_type;
+
+/*
+ * In principle we should use yyget_extra() to fetch the yyextra field
+ * from a yyscanner struct.  However, flex always puts that field first,
+ * and this is sufficiently performance-critical to make it seem worth
+ * cheating a bit to use an inline macro.
+ */
+#define pg_yyget_extra(yyscanner) (*((base_yy_extra_type **) (yyscanner)))
+
+
+/* from parser.c */
+extern int base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp,
+		   core_yyscan_t yyscanner);
+
+/* from gram.y */
+extern void parser_init(base_yy_extra_type *yyext);
+extern int	base_yyparse(core_yyscan_t yyscanner);
+
+#endif   /* GRAMPARSE_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/keywords.h b/foreign/libpg_query/src/postgres/include/parser/keywords.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/keywords.h
@@ -0,0 +1,38 @@
+/*-------------------------------------------------------------------------
+ *
+ * keywords.h
+ *	  lexical token lookup for key words in PostgreSQL
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/keywords.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef KEYWORDS_H
+#define KEYWORDS_H
+
+/* Keyword categories --- should match lists in gram.y */
+#define UNRESERVED_KEYWORD		0
+#define COL_NAME_KEYWORD		1
+#define TYPE_FUNC_NAME_KEYWORD	2
+#define RESERVED_KEYWORD		3
+
+
+typedef struct ScanKeyword
+{
+	const char *name;			/* in lower case */
+	int16		value;			/* grammar's token code */
+	int16		category;		/* see codes above */
+} ScanKeyword;
+
+extern PGDLLIMPORT const ScanKeyword ScanKeywords[];
+extern PGDLLIMPORT const int NumScanKeywords;
+
+extern const ScanKeyword *ScanKeywordLookup(const char *text,
+				  const ScanKeyword *keywords,
+				  int num_keywords);
+
+#endif   /* KEYWORDS_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/kwlist.h b/foreign/libpg_query/src/postgres/include/parser/kwlist.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/kwlist.h
@@ -0,0 +1,444 @@
+/*-------------------------------------------------------------------------
+ *
+ * kwlist.h
+ *
+ * The keyword list is kept in its own source file for possible use by
+ * automatic tools.  The exact representation of a keyword is determined
+ * by the PG_KEYWORD macro, which is not defined in this file; it can
+ * be defined by the caller for special purposes.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ *	  src/include/parser/kwlist.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/* there is deliberately not an #ifndef KWLIST_H here */
+
+/*
+ * List of keyword (name, token-value, category) entries.
+ *
+ * !!WARNING!!: This list must be sorted by ASCII name, because binary
+ *		 search is used to locate entries.
+ */
+
+/* name, value, category */
+PG_KEYWORD("abort", ABORT_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("absolute", ABSOLUTE_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("access", ACCESS, UNRESERVED_KEYWORD)
+PG_KEYWORD("action", ACTION, UNRESERVED_KEYWORD)
+PG_KEYWORD("add", ADD_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("admin", ADMIN, UNRESERVED_KEYWORD)
+PG_KEYWORD("after", AFTER, UNRESERVED_KEYWORD)
+PG_KEYWORD("aggregate", AGGREGATE, UNRESERVED_KEYWORD)
+PG_KEYWORD("all", ALL, RESERVED_KEYWORD)
+PG_KEYWORD("also", ALSO, UNRESERVED_KEYWORD)
+PG_KEYWORD("alter", ALTER, UNRESERVED_KEYWORD)
+PG_KEYWORD("always", ALWAYS, UNRESERVED_KEYWORD)
+PG_KEYWORD("analyse", ANALYSE, RESERVED_KEYWORD)		/* British spelling */
+PG_KEYWORD("analyze", ANALYZE, RESERVED_KEYWORD)
+PG_KEYWORD("and", AND, RESERVED_KEYWORD)
+PG_KEYWORD("any", ANY, RESERVED_KEYWORD)
+PG_KEYWORD("array", ARRAY, RESERVED_KEYWORD)
+PG_KEYWORD("as", AS, RESERVED_KEYWORD)
+PG_KEYWORD("asc", ASC, RESERVED_KEYWORD)
+PG_KEYWORD("assertion", ASSERTION, UNRESERVED_KEYWORD)
+PG_KEYWORD("assignment", ASSIGNMENT, UNRESERVED_KEYWORD)
+PG_KEYWORD("asymmetric", ASYMMETRIC, RESERVED_KEYWORD)
+PG_KEYWORD("at", AT, UNRESERVED_KEYWORD)
+PG_KEYWORD("attribute", ATTRIBUTE, UNRESERVED_KEYWORD)
+PG_KEYWORD("authorization", AUTHORIZATION, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("backward", BACKWARD, UNRESERVED_KEYWORD)
+PG_KEYWORD("before", BEFORE, UNRESERVED_KEYWORD)
+PG_KEYWORD("begin", BEGIN_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("between", BETWEEN, COL_NAME_KEYWORD)
+PG_KEYWORD("bigint", BIGINT, COL_NAME_KEYWORD)
+PG_KEYWORD("binary", BINARY, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("bit", BIT, COL_NAME_KEYWORD)
+PG_KEYWORD("boolean", BOOLEAN_P, COL_NAME_KEYWORD)
+PG_KEYWORD("both", BOTH, RESERVED_KEYWORD)
+PG_KEYWORD("by", BY, UNRESERVED_KEYWORD)
+PG_KEYWORD("cache", CACHE, UNRESERVED_KEYWORD)
+PG_KEYWORD("called", CALLED, UNRESERVED_KEYWORD)
+PG_KEYWORD("cascade", CASCADE, UNRESERVED_KEYWORD)
+PG_KEYWORD("cascaded", CASCADED, UNRESERVED_KEYWORD)
+PG_KEYWORD("case", CASE, RESERVED_KEYWORD)
+PG_KEYWORD("cast", CAST, RESERVED_KEYWORD)
+PG_KEYWORD("catalog", CATALOG_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("chain", CHAIN, UNRESERVED_KEYWORD)
+PG_KEYWORD("char", CHAR_P, COL_NAME_KEYWORD)
+PG_KEYWORD("character", CHARACTER, COL_NAME_KEYWORD)
+PG_KEYWORD("characteristics", CHARACTERISTICS, UNRESERVED_KEYWORD)
+PG_KEYWORD("check", CHECK, RESERVED_KEYWORD)
+PG_KEYWORD("checkpoint", CHECKPOINT, UNRESERVED_KEYWORD)
+PG_KEYWORD("class", CLASS, UNRESERVED_KEYWORD)
+PG_KEYWORD("close", CLOSE, UNRESERVED_KEYWORD)
+PG_KEYWORD("cluster", CLUSTER, UNRESERVED_KEYWORD)
+PG_KEYWORD("coalesce", COALESCE, COL_NAME_KEYWORD)
+PG_KEYWORD("collate", COLLATE, RESERVED_KEYWORD)
+PG_KEYWORD("collation", COLLATION, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("column", COLUMN, RESERVED_KEYWORD)
+PG_KEYWORD("comment", COMMENT, UNRESERVED_KEYWORD)
+PG_KEYWORD("comments", COMMENTS, UNRESERVED_KEYWORD)
+PG_KEYWORD("commit", COMMIT, UNRESERVED_KEYWORD)
+PG_KEYWORD("committed", COMMITTED, UNRESERVED_KEYWORD)
+PG_KEYWORD("concurrently", CONCURRENTLY, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("configuration", CONFIGURATION, UNRESERVED_KEYWORD)
+PG_KEYWORD("conflict", CONFLICT, UNRESERVED_KEYWORD)
+PG_KEYWORD("connection", CONNECTION, UNRESERVED_KEYWORD)
+PG_KEYWORD("constraint", CONSTRAINT, RESERVED_KEYWORD)
+PG_KEYWORD("constraints", CONSTRAINTS, UNRESERVED_KEYWORD)
+PG_KEYWORD("content", CONTENT_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("continue", CONTINUE_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("conversion", CONVERSION_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("copy", COPY, UNRESERVED_KEYWORD)
+PG_KEYWORD("cost", COST, UNRESERVED_KEYWORD)
+PG_KEYWORD("create", CREATE, RESERVED_KEYWORD)
+PG_KEYWORD("cross", CROSS, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("csv", CSV, UNRESERVED_KEYWORD)
+PG_KEYWORD("cube", CUBE, UNRESERVED_KEYWORD)
+PG_KEYWORD("current", CURRENT_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("current_catalog", CURRENT_CATALOG, RESERVED_KEYWORD)
+PG_KEYWORD("current_date", CURRENT_DATE, RESERVED_KEYWORD)
+PG_KEYWORD("current_role", CURRENT_ROLE, RESERVED_KEYWORD)
+PG_KEYWORD("current_schema", CURRENT_SCHEMA, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("current_time", CURRENT_TIME, RESERVED_KEYWORD)
+PG_KEYWORD("current_timestamp", CURRENT_TIMESTAMP, RESERVED_KEYWORD)
+PG_KEYWORD("current_user", CURRENT_USER, RESERVED_KEYWORD)
+PG_KEYWORD("cursor", CURSOR, UNRESERVED_KEYWORD)
+PG_KEYWORD("cycle", CYCLE, UNRESERVED_KEYWORD)
+PG_KEYWORD("data", DATA_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("database", DATABASE, UNRESERVED_KEYWORD)
+PG_KEYWORD("day", DAY_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("deallocate", DEALLOCATE, UNRESERVED_KEYWORD)
+PG_KEYWORD("dec", DEC, COL_NAME_KEYWORD)
+PG_KEYWORD("decimal", DECIMAL_P, COL_NAME_KEYWORD)
+PG_KEYWORD("declare", DECLARE, UNRESERVED_KEYWORD)
+PG_KEYWORD("default", DEFAULT, RESERVED_KEYWORD)
+PG_KEYWORD("defaults", DEFAULTS, UNRESERVED_KEYWORD)
+PG_KEYWORD("deferrable", DEFERRABLE, RESERVED_KEYWORD)
+PG_KEYWORD("deferred", DEFERRED, UNRESERVED_KEYWORD)
+PG_KEYWORD("definer", DEFINER, UNRESERVED_KEYWORD)
+PG_KEYWORD("delete", DELETE_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("delimiter", DELIMITER, UNRESERVED_KEYWORD)
+PG_KEYWORD("delimiters", DELIMITERS, UNRESERVED_KEYWORD)
+PG_KEYWORD("desc", DESC, RESERVED_KEYWORD)
+PG_KEYWORD("dictionary", DICTIONARY, UNRESERVED_KEYWORD)
+PG_KEYWORD("disable", DISABLE_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("discard", DISCARD, UNRESERVED_KEYWORD)
+PG_KEYWORD("distinct", DISTINCT, RESERVED_KEYWORD)
+PG_KEYWORD("do", DO, RESERVED_KEYWORD)
+PG_KEYWORD("document", DOCUMENT_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("domain", DOMAIN_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("double", DOUBLE_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("drop", DROP, UNRESERVED_KEYWORD)
+PG_KEYWORD("each", EACH, UNRESERVED_KEYWORD)
+PG_KEYWORD("else", ELSE, RESERVED_KEYWORD)
+PG_KEYWORD("enable", ENABLE_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("encoding", ENCODING, UNRESERVED_KEYWORD)
+PG_KEYWORD("encrypted", ENCRYPTED, UNRESERVED_KEYWORD)
+PG_KEYWORD("end", END_P, RESERVED_KEYWORD)
+PG_KEYWORD("enum", ENUM_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("escape", ESCAPE, UNRESERVED_KEYWORD)
+PG_KEYWORD("event", EVENT, UNRESERVED_KEYWORD)
+PG_KEYWORD("except", EXCEPT, RESERVED_KEYWORD)
+PG_KEYWORD("exclude", EXCLUDE, UNRESERVED_KEYWORD)
+PG_KEYWORD("excluding", EXCLUDING, UNRESERVED_KEYWORD)
+PG_KEYWORD("exclusive", EXCLUSIVE, UNRESERVED_KEYWORD)
+PG_KEYWORD("execute", EXECUTE, UNRESERVED_KEYWORD)
+PG_KEYWORD("exists", EXISTS, COL_NAME_KEYWORD)
+PG_KEYWORD("explain", EXPLAIN, UNRESERVED_KEYWORD)
+PG_KEYWORD("extension", EXTENSION, UNRESERVED_KEYWORD)
+PG_KEYWORD("external", EXTERNAL, UNRESERVED_KEYWORD)
+PG_KEYWORD("extract", EXTRACT, COL_NAME_KEYWORD)
+PG_KEYWORD("false", FALSE_P, RESERVED_KEYWORD)
+PG_KEYWORD("family", FAMILY, UNRESERVED_KEYWORD)
+PG_KEYWORD("fetch", FETCH, RESERVED_KEYWORD)
+PG_KEYWORD("filter", FILTER, UNRESERVED_KEYWORD)
+PG_KEYWORD("first", FIRST_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("float", FLOAT_P, COL_NAME_KEYWORD)
+PG_KEYWORD("following", FOLLOWING, UNRESERVED_KEYWORD)
+PG_KEYWORD("for", FOR, RESERVED_KEYWORD)
+PG_KEYWORD("force", FORCE, UNRESERVED_KEYWORD)
+PG_KEYWORD("foreign", FOREIGN, RESERVED_KEYWORD)
+PG_KEYWORD("forward", FORWARD, UNRESERVED_KEYWORD)
+PG_KEYWORD("freeze", FREEZE, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("from", FROM, RESERVED_KEYWORD)
+PG_KEYWORD("full", FULL, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("function", FUNCTION, UNRESERVED_KEYWORD)
+PG_KEYWORD("functions", FUNCTIONS, UNRESERVED_KEYWORD)
+PG_KEYWORD("global", GLOBAL, UNRESERVED_KEYWORD)
+PG_KEYWORD("grant", GRANT, RESERVED_KEYWORD)
+PG_KEYWORD("granted", GRANTED, UNRESERVED_KEYWORD)
+PG_KEYWORD("greatest", GREATEST, COL_NAME_KEYWORD)
+PG_KEYWORD("group", GROUP_P, RESERVED_KEYWORD)
+PG_KEYWORD("grouping", GROUPING, COL_NAME_KEYWORD)
+PG_KEYWORD("handler", HANDLER, UNRESERVED_KEYWORD)
+PG_KEYWORD("having", HAVING, RESERVED_KEYWORD)
+PG_KEYWORD("header", HEADER_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("hold", HOLD, UNRESERVED_KEYWORD)
+PG_KEYWORD("hour", HOUR_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("identity", IDENTITY_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("if", IF_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("ilike", ILIKE, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("immediate", IMMEDIATE, UNRESERVED_KEYWORD)
+PG_KEYWORD("immutable", IMMUTABLE, UNRESERVED_KEYWORD)
+PG_KEYWORD("implicit", IMPLICIT_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("import", IMPORT_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("in", IN_P, RESERVED_KEYWORD)
+PG_KEYWORD("including", INCLUDING, UNRESERVED_KEYWORD)
+PG_KEYWORD("increment", INCREMENT, UNRESERVED_KEYWORD)
+PG_KEYWORD("index", INDEX, UNRESERVED_KEYWORD)
+PG_KEYWORD("indexes", INDEXES, UNRESERVED_KEYWORD)
+PG_KEYWORD("inherit", INHERIT, UNRESERVED_KEYWORD)
+PG_KEYWORD("inherits", INHERITS, UNRESERVED_KEYWORD)
+PG_KEYWORD("initially", INITIALLY, RESERVED_KEYWORD)
+PG_KEYWORD("inline", INLINE_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("inner", INNER_P, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("inout", INOUT, COL_NAME_KEYWORD)
+PG_KEYWORD("input", INPUT_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("insensitive", INSENSITIVE, UNRESERVED_KEYWORD)
+PG_KEYWORD("insert", INSERT, UNRESERVED_KEYWORD)
+PG_KEYWORD("instead", INSTEAD, UNRESERVED_KEYWORD)
+PG_KEYWORD("int", INT_P, COL_NAME_KEYWORD)
+PG_KEYWORD("integer", INTEGER, COL_NAME_KEYWORD)
+PG_KEYWORD("intersect", INTERSECT, RESERVED_KEYWORD)
+PG_KEYWORD("interval", INTERVAL, COL_NAME_KEYWORD)
+PG_KEYWORD("into", INTO, RESERVED_KEYWORD)
+PG_KEYWORD("invoker", INVOKER, UNRESERVED_KEYWORD)
+PG_KEYWORD("is", IS, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("isnull", ISNULL, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("isolation", ISOLATION, UNRESERVED_KEYWORD)
+PG_KEYWORD("join", JOIN, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("key", KEY, UNRESERVED_KEYWORD)
+PG_KEYWORD("label", LABEL, UNRESERVED_KEYWORD)
+PG_KEYWORD("language", LANGUAGE, UNRESERVED_KEYWORD)
+PG_KEYWORD("large", LARGE_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("last", LAST_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("lateral", LATERAL_P, RESERVED_KEYWORD)
+PG_KEYWORD("leading", LEADING, RESERVED_KEYWORD)
+PG_KEYWORD("leakproof", LEAKPROOF, UNRESERVED_KEYWORD)
+PG_KEYWORD("least", LEAST, COL_NAME_KEYWORD)
+PG_KEYWORD("left", LEFT, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("level", LEVEL, UNRESERVED_KEYWORD)
+PG_KEYWORD("like", LIKE, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("limit", LIMIT, RESERVED_KEYWORD)
+PG_KEYWORD("listen", LISTEN, UNRESERVED_KEYWORD)
+PG_KEYWORD("load", LOAD, UNRESERVED_KEYWORD)
+PG_KEYWORD("local", LOCAL, UNRESERVED_KEYWORD)
+PG_KEYWORD("localtime", LOCALTIME, RESERVED_KEYWORD)
+PG_KEYWORD("localtimestamp", LOCALTIMESTAMP, RESERVED_KEYWORD)
+PG_KEYWORD("location", LOCATION, UNRESERVED_KEYWORD)
+PG_KEYWORD("lock", LOCK_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("locked", LOCKED, UNRESERVED_KEYWORD)
+PG_KEYWORD("logged", LOGGED, UNRESERVED_KEYWORD)
+PG_KEYWORD("mapping", MAPPING, UNRESERVED_KEYWORD)
+PG_KEYWORD("match", MATCH, UNRESERVED_KEYWORD)
+PG_KEYWORD("materialized", MATERIALIZED, UNRESERVED_KEYWORD)
+PG_KEYWORD("maxvalue", MAXVALUE, UNRESERVED_KEYWORD)
+PG_KEYWORD("minute", MINUTE_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("minvalue", MINVALUE, UNRESERVED_KEYWORD)
+PG_KEYWORD("mode", MODE, UNRESERVED_KEYWORD)
+PG_KEYWORD("month", MONTH_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("move", MOVE, UNRESERVED_KEYWORD)
+PG_KEYWORD("name", NAME_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("names", NAMES, UNRESERVED_KEYWORD)
+PG_KEYWORD("national", NATIONAL, COL_NAME_KEYWORD)
+PG_KEYWORD("natural", NATURAL, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("nchar", NCHAR, COL_NAME_KEYWORD)
+PG_KEYWORD("next", NEXT, UNRESERVED_KEYWORD)
+PG_KEYWORD("no", NO, UNRESERVED_KEYWORD)
+PG_KEYWORD("none", NONE, COL_NAME_KEYWORD)
+PG_KEYWORD("not", NOT, RESERVED_KEYWORD)
+PG_KEYWORD("nothing", NOTHING, UNRESERVED_KEYWORD)
+PG_KEYWORD("notify", NOTIFY, UNRESERVED_KEYWORD)
+PG_KEYWORD("notnull", NOTNULL, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("nowait", NOWAIT, UNRESERVED_KEYWORD)
+PG_KEYWORD("null", NULL_P, RESERVED_KEYWORD)
+PG_KEYWORD("nullif", NULLIF, COL_NAME_KEYWORD)
+PG_KEYWORD("nulls", NULLS_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("numeric", NUMERIC, COL_NAME_KEYWORD)
+PG_KEYWORD("object", OBJECT_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("of", OF, UNRESERVED_KEYWORD)
+PG_KEYWORD("off", OFF, UNRESERVED_KEYWORD)
+PG_KEYWORD("offset", OFFSET, RESERVED_KEYWORD)
+PG_KEYWORD("oids", OIDS, UNRESERVED_KEYWORD)
+PG_KEYWORD("on", ON, RESERVED_KEYWORD)
+PG_KEYWORD("only", ONLY, RESERVED_KEYWORD)
+PG_KEYWORD("operator", OPERATOR, UNRESERVED_KEYWORD)
+PG_KEYWORD("option", OPTION, UNRESERVED_KEYWORD)
+PG_KEYWORD("options", OPTIONS, UNRESERVED_KEYWORD)
+PG_KEYWORD("or", OR, RESERVED_KEYWORD)
+PG_KEYWORD("order", ORDER, RESERVED_KEYWORD)
+PG_KEYWORD("ordinality", ORDINALITY, UNRESERVED_KEYWORD)
+PG_KEYWORD("out", OUT_P, COL_NAME_KEYWORD)
+PG_KEYWORD("outer", OUTER_P, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("over", OVER, UNRESERVED_KEYWORD)
+PG_KEYWORD("overlaps", OVERLAPS, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("overlay", OVERLAY, COL_NAME_KEYWORD)
+PG_KEYWORD("owned", OWNED, UNRESERVED_KEYWORD)
+PG_KEYWORD("owner", OWNER, UNRESERVED_KEYWORD)
+PG_KEYWORD("parser", PARSER, UNRESERVED_KEYWORD)
+PG_KEYWORD("partial", PARTIAL, UNRESERVED_KEYWORD)
+PG_KEYWORD("partition", PARTITION, UNRESERVED_KEYWORD)
+PG_KEYWORD("passing", PASSING, UNRESERVED_KEYWORD)
+PG_KEYWORD("password", PASSWORD, UNRESERVED_KEYWORD)
+PG_KEYWORD("placing", PLACING, RESERVED_KEYWORD)
+PG_KEYWORD("plans", PLANS, UNRESERVED_KEYWORD)
+PG_KEYWORD("policy", POLICY, UNRESERVED_KEYWORD)
+PG_KEYWORD("position", POSITION, COL_NAME_KEYWORD)
+PG_KEYWORD("preceding", PRECEDING, UNRESERVED_KEYWORD)
+PG_KEYWORD("precision", PRECISION, COL_NAME_KEYWORD)
+PG_KEYWORD("prepare", PREPARE, UNRESERVED_KEYWORD)
+PG_KEYWORD("prepared", PREPARED, UNRESERVED_KEYWORD)
+PG_KEYWORD("preserve", PRESERVE, UNRESERVED_KEYWORD)
+PG_KEYWORD("primary", PRIMARY, RESERVED_KEYWORD)
+PG_KEYWORD("prior", PRIOR, UNRESERVED_KEYWORD)
+PG_KEYWORD("privileges", PRIVILEGES, UNRESERVED_KEYWORD)
+PG_KEYWORD("procedural", PROCEDURAL, UNRESERVED_KEYWORD)
+PG_KEYWORD("procedure", PROCEDURE, UNRESERVED_KEYWORD)
+PG_KEYWORD("program", PROGRAM, UNRESERVED_KEYWORD)
+PG_KEYWORD("quote", QUOTE, UNRESERVED_KEYWORD)
+PG_KEYWORD("range", RANGE, UNRESERVED_KEYWORD)
+PG_KEYWORD("read", READ, UNRESERVED_KEYWORD)
+PG_KEYWORD("real", REAL, COL_NAME_KEYWORD)
+PG_KEYWORD("reassign", REASSIGN, UNRESERVED_KEYWORD)
+PG_KEYWORD("recheck", RECHECK, UNRESERVED_KEYWORD)
+PG_KEYWORD("recursive", RECURSIVE, UNRESERVED_KEYWORD)
+PG_KEYWORD("ref", REF, UNRESERVED_KEYWORD)
+PG_KEYWORD("references", REFERENCES, RESERVED_KEYWORD)
+PG_KEYWORD("refresh", REFRESH, UNRESERVED_KEYWORD)
+PG_KEYWORD("reindex", REINDEX, UNRESERVED_KEYWORD)
+PG_KEYWORD("relative", RELATIVE_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("release", RELEASE, UNRESERVED_KEYWORD)
+PG_KEYWORD("rename", RENAME, UNRESERVED_KEYWORD)
+PG_KEYWORD("repeatable", REPEATABLE, UNRESERVED_KEYWORD)
+PG_KEYWORD("replace", REPLACE, UNRESERVED_KEYWORD)
+PG_KEYWORD("replica", REPLICA, UNRESERVED_KEYWORD)
+PG_KEYWORD("reset", RESET, UNRESERVED_KEYWORD)
+PG_KEYWORD("restart", RESTART, UNRESERVED_KEYWORD)
+PG_KEYWORD("restrict", RESTRICT, UNRESERVED_KEYWORD)
+PG_KEYWORD("returning", RETURNING, RESERVED_KEYWORD)
+PG_KEYWORD("returns", RETURNS, UNRESERVED_KEYWORD)
+PG_KEYWORD("revoke", REVOKE, UNRESERVED_KEYWORD)
+PG_KEYWORD("right", RIGHT, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("role", ROLE, UNRESERVED_KEYWORD)
+PG_KEYWORD("rollback", ROLLBACK, UNRESERVED_KEYWORD)
+PG_KEYWORD("rollup", ROLLUP, UNRESERVED_KEYWORD)
+PG_KEYWORD("row", ROW, COL_NAME_KEYWORD)
+PG_KEYWORD("rows", ROWS, UNRESERVED_KEYWORD)
+PG_KEYWORD("rule", RULE, UNRESERVED_KEYWORD)
+PG_KEYWORD("savepoint", SAVEPOINT, UNRESERVED_KEYWORD)
+PG_KEYWORD("schema", SCHEMA, UNRESERVED_KEYWORD)
+PG_KEYWORD("scroll", SCROLL, UNRESERVED_KEYWORD)
+PG_KEYWORD("search", SEARCH, UNRESERVED_KEYWORD)
+PG_KEYWORD("second", SECOND_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("security", SECURITY, UNRESERVED_KEYWORD)
+PG_KEYWORD("select", SELECT, RESERVED_KEYWORD)
+PG_KEYWORD("sequence", SEQUENCE, UNRESERVED_KEYWORD)
+PG_KEYWORD("sequences", SEQUENCES, UNRESERVED_KEYWORD)
+PG_KEYWORD("serializable", SERIALIZABLE, UNRESERVED_KEYWORD)
+PG_KEYWORD("server", SERVER, UNRESERVED_KEYWORD)
+PG_KEYWORD("session", SESSION, UNRESERVED_KEYWORD)
+PG_KEYWORD("session_user", SESSION_USER, RESERVED_KEYWORD)
+PG_KEYWORD("set", SET, UNRESERVED_KEYWORD)
+PG_KEYWORD("setof", SETOF, COL_NAME_KEYWORD)
+PG_KEYWORD("sets", SETS, UNRESERVED_KEYWORD)
+PG_KEYWORD("share", SHARE, UNRESERVED_KEYWORD)
+PG_KEYWORD("show", SHOW, UNRESERVED_KEYWORD)
+PG_KEYWORD("similar", SIMILAR, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("simple", SIMPLE, UNRESERVED_KEYWORD)
+PG_KEYWORD("skip", SKIP, UNRESERVED_KEYWORD)
+PG_KEYWORD("smallint", SMALLINT, COL_NAME_KEYWORD)
+PG_KEYWORD("snapshot", SNAPSHOT, UNRESERVED_KEYWORD)
+PG_KEYWORD("some", SOME, RESERVED_KEYWORD)
+PG_KEYWORD("sql", SQL_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("stable", STABLE, UNRESERVED_KEYWORD)
+PG_KEYWORD("standalone", STANDALONE_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("start", START, UNRESERVED_KEYWORD)
+PG_KEYWORD("statement", STATEMENT, UNRESERVED_KEYWORD)
+PG_KEYWORD("statistics", STATISTICS, UNRESERVED_KEYWORD)
+PG_KEYWORD("stdin", STDIN, UNRESERVED_KEYWORD)
+PG_KEYWORD("stdout", STDOUT, UNRESERVED_KEYWORD)
+PG_KEYWORD("storage", STORAGE, UNRESERVED_KEYWORD)
+PG_KEYWORD("strict", STRICT_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("strip", STRIP_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("substring", SUBSTRING, COL_NAME_KEYWORD)
+PG_KEYWORD("symmetric", SYMMETRIC, RESERVED_KEYWORD)
+PG_KEYWORD("sysid", SYSID, UNRESERVED_KEYWORD)
+PG_KEYWORD("system", SYSTEM_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("table", TABLE, RESERVED_KEYWORD)
+PG_KEYWORD("tables", TABLES, UNRESERVED_KEYWORD)
+PG_KEYWORD("tablesample", TABLESAMPLE, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("tablespace", TABLESPACE, UNRESERVED_KEYWORD)
+PG_KEYWORD("temp", TEMP, UNRESERVED_KEYWORD)
+PG_KEYWORD("template", TEMPLATE, UNRESERVED_KEYWORD)
+PG_KEYWORD("temporary", TEMPORARY, UNRESERVED_KEYWORD)
+PG_KEYWORD("text", TEXT_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("then", THEN, RESERVED_KEYWORD)
+PG_KEYWORD("time", TIME, COL_NAME_KEYWORD)
+PG_KEYWORD("timestamp", TIMESTAMP, COL_NAME_KEYWORD)
+PG_KEYWORD("to", TO, RESERVED_KEYWORD)
+PG_KEYWORD("trailing", TRAILING, RESERVED_KEYWORD)
+PG_KEYWORD("transaction", TRANSACTION, UNRESERVED_KEYWORD)
+PG_KEYWORD("transform", TRANSFORM, UNRESERVED_KEYWORD)
+PG_KEYWORD("treat", TREAT, COL_NAME_KEYWORD)
+PG_KEYWORD("trigger", TRIGGER, UNRESERVED_KEYWORD)
+PG_KEYWORD("trim", TRIM, COL_NAME_KEYWORD)
+PG_KEYWORD("true", TRUE_P, RESERVED_KEYWORD)
+PG_KEYWORD("truncate", TRUNCATE, UNRESERVED_KEYWORD)
+PG_KEYWORD("trusted", TRUSTED, UNRESERVED_KEYWORD)
+PG_KEYWORD("type", TYPE_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("types", TYPES_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("unbounded", UNBOUNDED, UNRESERVED_KEYWORD)
+PG_KEYWORD("uncommitted", UNCOMMITTED, UNRESERVED_KEYWORD)
+PG_KEYWORD("unencrypted", UNENCRYPTED, UNRESERVED_KEYWORD)
+PG_KEYWORD("union", UNION, RESERVED_KEYWORD)
+PG_KEYWORD("unique", UNIQUE, RESERVED_KEYWORD)
+PG_KEYWORD("unknown", UNKNOWN, UNRESERVED_KEYWORD)
+PG_KEYWORD("unlisten", UNLISTEN, UNRESERVED_KEYWORD)
+PG_KEYWORD("unlogged", UNLOGGED, UNRESERVED_KEYWORD)
+PG_KEYWORD("until", UNTIL, UNRESERVED_KEYWORD)
+PG_KEYWORD("update", UPDATE, UNRESERVED_KEYWORD)
+PG_KEYWORD("user", USER, RESERVED_KEYWORD)
+PG_KEYWORD("using", USING, RESERVED_KEYWORD)
+PG_KEYWORD("vacuum", VACUUM, UNRESERVED_KEYWORD)
+PG_KEYWORD("valid", VALID, UNRESERVED_KEYWORD)
+PG_KEYWORD("validate", VALIDATE, UNRESERVED_KEYWORD)
+PG_KEYWORD("validator", VALIDATOR, UNRESERVED_KEYWORD)
+PG_KEYWORD("value", VALUE_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("values", VALUES, COL_NAME_KEYWORD)
+PG_KEYWORD("varchar", VARCHAR, COL_NAME_KEYWORD)
+PG_KEYWORD("variadic", VARIADIC, RESERVED_KEYWORD)
+PG_KEYWORD("varying", VARYING, UNRESERVED_KEYWORD)
+PG_KEYWORD("verbose", VERBOSE, TYPE_FUNC_NAME_KEYWORD)
+PG_KEYWORD("version", VERSION_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("view", VIEW, UNRESERVED_KEYWORD)
+PG_KEYWORD("views", VIEWS, UNRESERVED_KEYWORD)
+PG_KEYWORD("volatile", VOLATILE, UNRESERVED_KEYWORD)
+PG_KEYWORD("when", WHEN, RESERVED_KEYWORD)
+PG_KEYWORD("where", WHERE, RESERVED_KEYWORD)
+PG_KEYWORD("whitespace", WHITESPACE_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("window", WINDOW, RESERVED_KEYWORD)
+PG_KEYWORD("with", WITH, RESERVED_KEYWORD)
+PG_KEYWORD("within", WITHIN, UNRESERVED_KEYWORD)
+PG_KEYWORD("without", WITHOUT, UNRESERVED_KEYWORD)
+PG_KEYWORD("work", WORK, UNRESERVED_KEYWORD)
+PG_KEYWORD("wrapper", WRAPPER, UNRESERVED_KEYWORD)
+PG_KEYWORD("write", WRITE, UNRESERVED_KEYWORD)
+PG_KEYWORD("xml", XML_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("xmlattributes", XMLATTRIBUTES, COL_NAME_KEYWORD)
+PG_KEYWORD("xmlconcat", XMLCONCAT, COL_NAME_KEYWORD)
+PG_KEYWORD("xmlelement", XMLELEMENT, COL_NAME_KEYWORD)
+PG_KEYWORD("xmlexists", XMLEXISTS, COL_NAME_KEYWORD)
+PG_KEYWORD("xmlforest", XMLFOREST, COL_NAME_KEYWORD)
+PG_KEYWORD("xmlparse", XMLPARSE, COL_NAME_KEYWORD)
+PG_KEYWORD("xmlpi", XMLPI, COL_NAME_KEYWORD)
+PG_KEYWORD("xmlroot", XMLROOT, COL_NAME_KEYWORD)
+PG_KEYWORD("xmlserialize", XMLSERIALIZE, COL_NAME_KEYWORD)
+PG_KEYWORD("year", YEAR_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("yes", YES_P, UNRESERVED_KEYWORD)
+PG_KEYWORD("zone", ZONE, UNRESERVED_KEYWORD)
diff --git a/foreign/libpg_query/src/postgres/include/parser/parse_agg.h b/foreign/libpg_query/src/postgres/include/parser/parse_agg.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/parse_agg.h
@@ -0,0 +1,53 @@
+/*-------------------------------------------------------------------------
+ *
+ * parse_agg.h
+ *	  handle aggregates and window functions in parser
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/parse_agg.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PARSE_AGG_H
+#define PARSE_AGG_H
+
+#include "parser/parse_node.h"
+
+extern void transformAggregateCall(ParseState *pstate, Aggref *agg,
+					   List *args, List *aggorder,
+					   bool agg_distinct);
+
+extern Node *transformGroupingFunc(ParseState *pstate, GroupingFunc *g);
+
+extern void transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc,
+						WindowDef *windef);
+
+extern void parseCheckAggregates(ParseState *pstate, Query *qry);
+
+extern List *expand_grouping_sets(List *groupingSets, int limit);
+
+extern int	get_aggregate_argtypes(Aggref *aggref, Oid *inputTypes);
+
+extern Oid resolve_aggregate_transtype(Oid aggfuncid,
+							Oid aggtranstype,
+							Oid *inputTypes,
+							int numArguments);
+
+extern void build_aggregate_fnexprs(Oid *agg_input_types,
+						int agg_num_inputs,
+						int agg_num_direct_inputs,
+						int num_finalfn_inputs,
+						bool agg_variadic,
+						Oid agg_state_type,
+						Oid agg_result_type,
+						Oid agg_input_collation,
+						Oid transfn_oid,
+						Oid invtransfn_oid,
+						Oid finalfn_oid,
+						Expr **transfnexpr,
+						Expr **invtransfnexpr,
+						Expr **finalfnexpr);
+
+#endif   /* PARSE_AGG_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/parse_clause.h b/foreign/libpg_query/src/postgres/include/parser/parse_clause.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/parse_clause.h
@@ -0,0 +1,56 @@
+/*-------------------------------------------------------------------------
+ *
+ * parse_clause.h
+ *	  handle clauses in parser
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/parse_clause.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PARSE_CLAUSE_H
+#define PARSE_CLAUSE_H
+
+#include "parser/parse_node.h"
+
+extern void transformFromClause(ParseState *pstate, List *frmList);
+extern int setTargetTable(ParseState *pstate, RangeVar *relation,
+			   bool inh, bool alsoSource, AclMode requiredPerms);
+extern bool interpretInhOption(InhOption inhOpt);
+extern bool interpretOidsOption(List *defList, bool allowOids);
+
+extern Node *transformWhereClause(ParseState *pstate, Node *clause,
+					 ParseExprKind exprKind, const char *constructName);
+extern Node *transformLimitClause(ParseState *pstate, Node *clause,
+					 ParseExprKind exprKind, const char *constructName);
+extern List *transformGroupClause(ParseState *pstate, List *grouplist,
+					 List **groupingSets,
+					 List **targetlist, List *sortClause,
+					 ParseExprKind exprKind, bool useSQL99);
+extern List *transformSortClause(ParseState *pstate, List *orderlist,
+					List **targetlist, ParseExprKind exprKind,
+					bool resolveUnknown, bool useSQL99);
+
+extern List *transformWindowDefinitions(ParseState *pstate,
+						   List *windowdefs,
+						   List **targetlist);
+
+extern List *transformDistinctClause(ParseState *pstate,
+						List **targetlist, List *sortClause, bool is_agg);
+extern List *transformDistinctOnClause(ParseState *pstate, List *distinctlist,
+						  List **targetlist, List *sortClause);
+extern void transformOnConflictArbiter(ParseState *pstate,
+						   OnConflictClause *onConflictClause,
+						   List **arbiterExpr, Node **arbiterWhere,
+						   Oid *constraint);
+
+extern List *addTargetToSortList(ParseState *pstate, TargetEntry *tle,
+					List *sortlist, List *targetlist, SortBy *sortby,
+					bool resolveUnknown);
+extern Index assignSortGroupRef(TargetEntry *tle, List *tlist);
+extern bool targetIsInSortList(TargetEntry *tle, Oid sortop, List *sortList);
+
+#endif   /* PARSE_CLAUSE_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/parse_coerce.h b/foreign/libpg_query/src/postgres/include/parser/parse_coerce.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/parse_coerce.h
@@ -0,0 +1,90 @@
+/*-------------------------------------------------------------------------
+ *
+ * parse_coerce.h
+ *	Routines for type coercion.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/parse_coerce.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PARSE_COERCE_H
+#define PARSE_COERCE_H
+
+#include "parser/parse_node.h"
+
+
+/* Type categories (see TYPCATEGORY_xxx symbols in catalog/pg_type.h) */
+typedef char TYPCATEGORY;
+
+/* Result codes for find_coercion_pathway */
+typedef enum CoercionPathType
+{
+	COERCION_PATH_NONE,			/* failed to find any coercion pathway */
+	COERCION_PATH_FUNC,			/* apply the specified coercion function */
+	COERCION_PATH_RELABELTYPE,	/* binary-compatible cast, no function */
+	COERCION_PATH_ARRAYCOERCE,	/* need an ArrayCoerceExpr node */
+	COERCION_PATH_COERCEVIAIO	/* need a CoerceViaIO node */
+} CoercionPathType;
+
+
+extern bool IsBinaryCoercible(Oid srctype, Oid targettype);
+extern bool IsPreferredType(TYPCATEGORY category, Oid type);
+extern TYPCATEGORY TypeCategory(Oid type);
+
+extern Node *coerce_to_target_type(ParseState *pstate,
+					  Node *expr, Oid exprtype,
+					  Oid targettype, int32 targettypmod,
+					  CoercionContext ccontext,
+					  CoercionForm cformat,
+					  int location);
+extern bool can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids,
+				CoercionContext ccontext);
+extern Node *coerce_type(ParseState *pstate, Node *node,
+			Oid inputTypeId, Oid targetTypeId, int32 targetTypeMod,
+			CoercionContext ccontext, CoercionForm cformat, int location);
+extern Node *coerce_to_domain(Node *arg, Oid baseTypeId, int32 baseTypeMod,
+				 Oid typeId,
+				 CoercionForm cformat, int location,
+				 bool hideInputCoercion,
+				 bool lengthCoercionDone);
+
+extern Node *coerce_to_boolean(ParseState *pstate, Node *node,
+				  const char *constructName);
+extern Node *coerce_to_specific_type(ParseState *pstate, Node *node,
+						Oid targetTypeId,
+						const char *constructName);
+
+extern int parser_coercion_errposition(ParseState *pstate,
+							int coerce_location,
+							Node *input_expr);
+
+extern Oid select_common_type(ParseState *pstate, List *exprs,
+				   const char *context, Node **which_expr);
+extern Node *coerce_to_common_type(ParseState *pstate, Node *node,
+					  Oid targetTypeId,
+					  const char *context);
+
+extern bool check_generic_type_consistency(Oid *actual_arg_types,
+							   Oid *declared_arg_types,
+							   int nargs);
+extern Oid enforce_generic_type_consistency(Oid *actual_arg_types,
+								 Oid *declared_arg_types,
+								 int nargs,
+								 Oid rettype,
+								 bool allow_poly);
+extern Oid resolve_generic_type(Oid declared_type,
+					 Oid context_actual_type,
+					 Oid context_declared_type);
+
+extern CoercionPathType find_coercion_pathway(Oid targetTypeId,
+					  Oid sourceTypeId,
+					  CoercionContext ccontext,
+					  Oid *funcid);
+extern CoercionPathType find_typmod_coercion_function(Oid typeId,
+							  Oid *funcid);
+
+#endif   /* PARSE_COERCE_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/parse_collate.h b/foreign/libpg_query/src/postgres/include/parser/parse_collate.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/parse_collate.h
@@ -0,0 +1,27 @@
+/*-------------------------------------------------------------------------
+ *
+ * parse_collate.h
+ *	Routines for assigning collation information.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/parse_collate.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PARSE_COLLATE_H
+#define PARSE_COLLATE_H
+
+#include "parser/parse_node.h"
+
+extern void assign_query_collations(ParseState *pstate, Query *query);
+
+extern void assign_list_collations(ParseState *pstate, List *exprs);
+
+extern void assign_expr_collations(ParseState *pstate, Node *expr);
+
+extern Oid	select_common_collation(ParseState *pstate, List *exprs, bool none_ok);
+
+#endif   /* PARSE_COLLATE_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/parse_expr.h b/foreign/libpg_query/src/postgres/include/parser/parse_expr.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/parse_expr.h
@@ -0,0 +1,26 @@
+/*-------------------------------------------------------------------------
+ *
+ * parse_expr.h
+ *	  handle expressions in parser
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/parse_expr.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PARSE_EXPR_H
+#define PARSE_EXPR_H
+
+#include "parser/parse_node.h"
+
+/* GUC parameters */
+extern __thread  bool operator_precedence_warning;
+extern bool Transform_null_equals;
+
+extern Node *transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind);
+
+extern const char *ParseExprKindName(ParseExprKind exprKind);
+
+#endif   /* PARSE_EXPR_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/parse_func.h b/foreign/libpg_query/src/postgres/include/parser/parse_func.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/parse_func.h
@@ -0,0 +1,70 @@
+/*-------------------------------------------------------------------------
+ *
+ * parse_func.h
+ *
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/parse_func.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PARSER_FUNC_H
+#define PARSER_FUNC_H
+
+#include "catalog/namespace.h"
+#include "parser/parse_node.h"
+
+
+/* Result codes for func_get_detail */
+typedef enum
+{
+	FUNCDETAIL_NOTFOUND,		/* no matching function */
+	FUNCDETAIL_MULTIPLE,		/* too many matching functions */
+	FUNCDETAIL_NORMAL,			/* found a matching regular function */
+	FUNCDETAIL_AGGREGATE,		/* found a matching aggregate function */
+	FUNCDETAIL_WINDOWFUNC,		/* found a matching window function */
+	FUNCDETAIL_COERCION			/* it's a type coercion request */
+} FuncDetailCode;
+
+
+extern Node *ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
+				  FuncCall *fn, int location);
+
+extern FuncDetailCode func_get_detail(List *funcname,
+				List *fargs, List *fargnames,
+				int nargs, Oid *argtypes,
+				bool expand_variadic, bool expand_defaults,
+				Oid *funcid, Oid *rettype,
+				bool *retset, int *nvargs, Oid *vatype,
+				Oid **true_typeids, List **argdefaults);
+
+extern int func_match_argtypes(int nargs,
+					Oid *input_typeids,
+					FuncCandidateList raw_candidates,
+					FuncCandidateList *candidates);
+
+extern FuncCandidateList func_select_candidate(int nargs,
+					  Oid *input_typeids,
+					  FuncCandidateList candidates);
+
+extern void make_fn_arguments(ParseState *pstate,
+				  List *fargs,
+				  Oid *actual_arg_types,
+				  Oid *declared_arg_types);
+
+extern const char *funcname_signature_string(const char *funcname, int nargs,
+						  List *argnames, const Oid *argtypes);
+extern const char *func_signature_string(List *funcname, int nargs,
+					  List *argnames, const Oid *argtypes);
+
+extern Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes,
+			   bool noError);
+extern Oid LookupFuncNameTypeNames(List *funcname, List *argtypes,
+						bool noError);
+extern Oid LookupAggNameTypeNames(List *aggname, List *argtypes,
+					   bool noError);
+
+#endif   /* PARSE_FUNC_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/parse_node.h b/foreign/libpg_query/src/postgres/include/parser/parse_node.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/parse_node.h
@@ -0,0 +1,236 @@
+/*-------------------------------------------------------------------------
+ *
+ * parse_node.h
+ *		Internal definitions for parser
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/parse_node.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PARSE_NODE_H
+#define PARSE_NODE_H
+
+#include "nodes/parsenodes.h"
+#include "utils/relcache.h"
+
+
+/*
+ * Expression kinds distinguished by transformExpr().  Many of these are not
+ * semantically distinct so far as expression transformation goes; rather,
+ * we distinguish them so that context-specific error messages can be printed.
+ *
+ * Note: EXPR_KIND_OTHER is not used in the core code, but is left for use
+ * by extension code that might need to call transformExpr().  The core code
+ * will not enforce any context-driven restrictions on EXPR_KIND_OTHER
+ * expressions, so the caller would have to check for sub-selects, aggregates,
+ * and window functions if those need to be disallowed.
+ */
+typedef enum ParseExprKind
+{
+	EXPR_KIND_NONE = 0,			/* "not in an expression" */
+	EXPR_KIND_OTHER,			/* reserved for extensions */
+	EXPR_KIND_JOIN_ON,			/* JOIN ON */
+	EXPR_KIND_JOIN_USING,		/* JOIN USING */
+	EXPR_KIND_FROM_SUBSELECT,	/* sub-SELECT in FROM clause */
+	EXPR_KIND_FROM_FUNCTION,	/* function in FROM clause */
+	EXPR_KIND_WHERE,			/* WHERE */
+	EXPR_KIND_HAVING,			/* HAVING */
+	EXPR_KIND_FILTER,			/* FILTER */
+	EXPR_KIND_WINDOW_PARTITION, /* window definition PARTITION BY */
+	EXPR_KIND_WINDOW_ORDER,		/* window definition ORDER BY */
+	EXPR_KIND_WINDOW_FRAME_RANGE,		/* window frame clause with RANGE */
+	EXPR_KIND_WINDOW_FRAME_ROWS,	/* window frame clause with ROWS */
+	EXPR_KIND_SELECT_TARGET,	/* SELECT target list item */
+	EXPR_KIND_INSERT_TARGET,	/* INSERT target list item */
+	EXPR_KIND_UPDATE_SOURCE,	/* UPDATE assignment source item */
+	EXPR_KIND_UPDATE_TARGET,	/* UPDATE assignment target item */
+	EXPR_KIND_GROUP_BY,			/* GROUP BY */
+	EXPR_KIND_ORDER_BY,			/* ORDER BY */
+	EXPR_KIND_DISTINCT_ON,		/* DISTINCT ON */
+	EXPR_KIND_LIMIT,			/* LIMIT */
+	EXPR_KIND_OFFSET,			/* OFFSET */
+	EXPR_KIND_RETURNING,		/* RETURNING */
+	EXPR_KIND_VALUES,			/* VALUES */
+	EXPR_KIND_CHECK_CONSTRAINT, /* CHECK constraint for a table */
+	EXPR_KIND_DOMAIN_CHECK,		/* CHECK constraint for a domain */
+	EXPR_KIND_COLUMN_DEFAULT,	/* default value for a table column */
+	EXPR_KIND_FUNCTION_DEFAULT, /* default parameter value for function */
+	EXPR_KIND_INDEX_EXPRESSION, /* index expression */
+	EXPR_KIND_INDEX_PREDICATE,	/* index predicate */
+	EXPR_KIND_ALTER_COL_TRANSFORM,		/* transform expr in ALTER COLUMN TYPE */
+	EXPR_KIND_EXECUTE_PARAMETER,	/* parameter value in EXECUTE */
+	EXPR_KIND_TRIGGER_WHEN,		/* WHEN condition in CREATE TRIGGER */
+	EXPR_KIND_POLICY			/* USING or WITH CHECK expr in policy */
+} ParseExprKind;
+
+
+/*
+ * Function signatures for parser hooks
+ */
+typedef struct ParseState ParseState;
+
+typedef Node *(*PreParseColumnRefHook) (ParseState *pstate, ColumnRef *cref);
+typedef Node *(*PostParseColumnRefHook) (ParseState *pstate, ColumnRef *cref, Node *var);
+typedef Node *(*ParseParamRefHook) (ParseState *pstate, ParamRef *pref);
+typedef Node *(*CoerceParamHook) (ParseState *pstate, Param *param,
+									   Oid targetTypeId, int32 targetTypeMod,
+											  int location);
+
+
+/*
+ * State information used during parse analysis
+ *
+ * parentParseState: NULL in a top-level ParseState.  When parsing a subquery,
+ * links to current parse state of outer query.
+ *
+ * p_sourcetext: source string that generated the raw parsetree being
+ * analyzed, or NULL if not available.  (The string is used only to
+ * generate cursor positions in error messages: we need it to convert
+ * byte-wise locations in parse structures to character-wise cursor
+ * positions.)
+ *
+ * p_rtable: list of RTEs that will become the rangetable of the query.
+ * Note that neither relname nor refname of these entries are necessarily
+ * unique; searching the rtable by name is a bad idea.
+ *
+ * p_joinexprs: list of JoinExpr nodes associated with p_rtable entries.
+ * This is one-for-one with p_rtable, but contains NULLs for non-join
+ * RTEs, and may be shorter than p_rtable if the last RTE(s) aren't joins.
+ *
+ * p_joinlist: list of join items (RangeTblRef and JoinExpr nodes) that
+ * will become the fromlist of the query's top-level FromExpr node.
+ *
+ * p_namespace: list of ParseNamespaceItems that represents the current
+ * namespace for table and column lookup.  (The RTEs listed here may be just
+ * a subset of the whole rtable.  See ParseNamespaceItem comments below.)
+ *
+ * p_lateral_active: TRUE if we are currently parsing a LATERAL subexpression
+ * of this parse level.  This makes p_lateral_only namespace items visible,
+ * whereas they are not visible when p_lateral_active is FALSE.
+ *
+ * p_ctenamespace: list of CommonTableExprs (WITH items) that are visible
+ * at the moment.  This is entirely different from p_namespace because a CTE
+ * is not an RTE, rather "visibility" means you could make an RTE from it.
+ *
+ * p_future_ctes: list of CommonTableExprs (WITH items) that are not yet
+ * visible due to scope rules.  This is used to help improve error messages.
+ *
+ * p_parent_cte: CommonTableExpr that immediately contains the current query,
+ * if any.
+ *
+ * p_windowdefs: list of WindowDefs representing WINDOW and OVER clauses.
+ * We collect these while transforming expressions and then transform them
+ * afterwards (so that any resjunk tlist items needed for the sort/group
+ * clauses end up at the end of the query tlist).  A WindowDef's location in
+ * this list, counting from 1, is the winref number to use to reference it.
+ */
+struct ParseState
+{
+	struct ParseState *parentParseState;		/* stack link */
+	const char *p_sourcetext;	/* source text, or NULL if not available */
+	List	   *p_rtable;		/* range table so far */
+	List	   *p_joinexprs;	/* JoinExprs for RTE_JOIN p_rtable entries */
+	List	   *p_joinlist;		/* join items so far (will become FromExpr
+								 * node's fromlist) */
+	List	   *p_namespace;	/* currently-referenceable RTEs (List of
+								 * ParseNamespaceItem) */
+	bool		p_lateral_active;		/* p_lateral_only items visible? */
+	List	   *p_ctenamespace; /* current namespace for common table exprs */
+	List	   *p_future_ctes;	/* common table exprs not yet in namespace */
+	CommonTableExpr *p_parent_cte;		/* this query's containing CTE */
+	List	   *p_windowdefs;	/* raw representations of window clauses */
+	ParseExprKind p_expr_kind;	/* what kind of expression we're parsing */
+	int			p_next_resno;	/* next targetlist resno to assign */
+	List	   *p_multiassign_exprs;	/* junk tlist entries for multiassign */
+	List	   *p_locking_clause;		/* raw FOR UPDATE/FOR SHARE info */
+	Node	   *p_value_substitute;		/* what to replace VALUE with, if any */
+	bool		p_hasAggs;
+	bool		p_hasWindowFuncs;
+	bool		p_hasSubLinks;
+	bool		p_hasModifyingCTE;
+	bool		p_is_insert;
+	bool		p_locked_from_parent;
+	Relation	p_target_relation;
+	RangeTblEntry *p_target_rangetblentry;
+
+	/*
+	 * Optional hook functions for parser callbacks.  These are null unless
+	 * set up by the caller of make_parsestate.
+	 */
+	PreParseColumnRefHook p_pre_columnref_hook;
+	PostParseColumnRefHook p_post_columnref_hook;
+	ParseParamRefHook p_paramref_hook;
+	CoerceParamHook p_coerce_param_hook;
+	void	   *p_ref_hook_state;		/* common passthrough link for above */
+};
+
+/*
+ * An element of a namespace list.
+ *
+ * Namespace items with p_rel_visible set define which RTEs are accessible by
+ * qualified names, while those with p_cols_visible set define which RTEs are
+ * accessible by unqualified names.  These sets are different because a JOIN
+ * without an alias does not hide the contained tables (so they must be
+ * visible for qualified references) but it does hide their columns
+ * (unqualified references to the columns refer to the JOIN, not the member
+ * tables, so we must not complain that such a reference is ambiguous).
+ * Various special RTEs such as NEW/OLD for rules may also appear with only
+ * one flag set.
+ *
+ * While processing the FROM clause, namespace items may appear with
+ * p_lateral_only set, meaning they are visible only to LATERAL
+ * subexpressions.  (The pstate's p_lateral_active flag tells whether we are
+ * inside such a subexpression at the moment.)	If p_lateral_ok is not set,
+ * it's an error to actually use such a namespace item.  One might think it
+ * would be better to just exclude such items from visibility, but the wording
+ * of SQL:2008 requires us to do it this way.  We also use p_lateral_ok to
+ * forbid LATERAL references to an UPDATE/DELETE target table.
+ *
+ * At no time should a namespace list contain two entries that conflict
+ * according to the rules in checkNameSpaceConflicts; but note that those
+ * are more complicated than "must have different alias names", so in practice
+ * code searching a namespace list has to check for ambiguous references.
+ */
+typedef struct ParseNamespaceItem
+{
+	RangeTblEntry *p_rte;		/* The relation's rangetable entry */
+	bool		p_rel_visible;	/* Relation name is visible? */
+	bool		p_cols_visible; /* Column names visible as unqualified refs? */
+	bool		p_lateral_only; /* Is only visible to LATERAL expressions? */
+	bool		p_lateral_ok;	/* If so, does join type allow use? */
+} ParseNamespaceItem;
+
+/* Support for parser_errposition_callback function */
+typedef struct ParseCallbackState
+{
+	ParseState *pstate;
+	int			location;
+	ErrorContextCallback errcallback;
+} ParseCallbackState;
+
+
+extern ParseState *make_parsestate(ParseState *parentParseState);
+extern void free_parsestate(ParseState *pstate);
+extern int	parser_errposition(ParseState *pstate, int location);
+
+extern void setup_parser_errposition_callback(ParseCallbackState *pcbstate,
+								  ParseState *pstate, int location);
+extern void cancel_parser_errposition_callback(ParseCallbackState *pcbstate);
+
+extern Var *make_var(ParseState *pstate, RangeTblEntry *rte, int attrno,
+		 int location);
+extern Oid	transformArrayType(Oid *arrayType, int32 *arrayTypmod);
+extern ArrayRef *transformArraySubscripts(ParseState *pstate,
+						 Node *arrayBase,
+						 Oid arrayType,
+						 Oid elementType,
+						 int32 arrayTypMod,
+						 List *indirection,
+						 Node *assignFrom);
+extern Const *make_const(ParseState *pstate, Value *value, int location);
+
+#endif   /* PARSE_NODE_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/parse_oper.h b/foreign/libpg_query/src/postgres/include/parser/parse_oper.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/parse_oper.h
@@ -0,0 +1,68 @@
+/*-------------------------------------------------------------------------
+ *
+ * parse_oper.h
+ *		handle operator things for parser
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/parse_oper.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PARSE_OPER_H
+#define PARSE_OPER_H
+
+#include "access/htup.h"
+#include "parser/parse_node.h"
+
+
+typedef HeapTuple Operator;
+
+/* Routines to look up an operator given name and exact input type(s) */
+extern Oid LookupOperName(ParseState *pstate, List *opername,
+			   Oid oprleft, Oid oprright,
+			   bool noError, int location);
+extern Oid LookupOperNameTypeNames(ParseState *pstate, List *opername,
+						TypeName *oprleft, TypeName *oprright,
+						bool noError, int location);
+
+/* Routines to find operators matching a name and given input types */
+/* NB: the selected operator may require coercion of the input types! */
+extern Operator oper(ParseState *pstate, List *op, Oid arg1, Oid arg2,
+	 bool noError, int location);
+extern Operator right_oper(ParseState *pstate, List *op, Oid arg,
+		   bool noError, int location);
+extern Operator left_oper(ParseState *pstate, List *op, Oid arg,
+		  bool noError, int location);
+
+/* Routines to find operators that DO NOT require coercion --- ie, their */
+/* input types are either exactly as given, or binary-compatible */
+extern Operator compatible_oper(ParseState *pstate, List *op,
+				Oid arg1, Oid arg2,
+				bool noError, int location);
+
+/* currently no need for compatible_left_oper/compatible_right_oper */
+
+/* Routines for identifying "<", "=", ">" operators for a type */
+extern void get_sort_group_operators(Oid argtype,
+						 bool needLT, bool needEQ, bool needGT,
+						 Oid *ltOpr, Oid *eqOpr, Oid *gtOpr,
+						 bool *isHashable);
+
+/* Convenience routines for common calls on the above */
+extern Oid	compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError);
+
+/* Extract operator OID or underlying-function OID from an Operator tuple */
+extern Oid	oprid(Operator op);
+extern Oid	oprfuncid(Operator op);
+
+/* Build expression tree for an operator invocation */
+extern Expr *make_op(ParseState *pstate, List *opname,
+		Node *ltree, Node *rtree, int location);
+extern Expr *make_scalar_array_op(ParseState *pstate, List *opname,
+					 bool useOr,
+					 Node *ltree, Node *rtree, int location);
+
+#endif   /* PARSE_OPER_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/parse_relation.h b/foreign/libpg_query/src/postgres/include/parser/parse_relation.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/parse_relation.h
@@ -0,0 +1,121 @@
+/*-------------------------------------------------------------------------
+ *
+ * parse_relation.h
+ *	  prototypes for parse_relation.c.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/parse_relation.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PARSE_RELATION_H
+#define PARSE_RELATION_H
+
+#include "parser/parse_node.h"
+
+
+/*
+ * Support for fuzzily matching column.
+ *
+ * This is for building diagnostic messages, where non-exact matching
+ * attributes are suggested to the user.  The struct's fields may be facets of
+ * a particular RTE, or of an entire range table, depending on context.
+ */
+typedef struct
+{
+	int			distance;		/* Weighted distance (lowest so far) */
+	RangeTblEntry *rfirst;		/* RTE of first */
+	AttrNumber	first;			/* Closest attribute so far */
+	RangeTblEntry *rsecond;		/* RTE of second */
+	AttrNumber	second;			/* Second closest attribute so far */
+} FuzzyAttrMatchState;
+
+
+extern RangeTblEntry *refnameRangeTblEntry(ParseState *pstate,
+					 const char *schemaname,
+					 const char *refname,
+					 int location,
+					 int *sublevels_up);
+extern CommonTableExpr *scanNameSpaceForCTE(ParseState *pstate,
+					const char *refname,
+					Index *ctelevelsup);
+extern void checkNameSpaceConflicts(ParseState *pstate, List *namespace1,
+						List *namespace2);
+extern int RTERangeTablePosn(ParseState *pstate,
+				  RangeTblEntry *rte,
+				  int *sublevels_up);
+extern RangeTblEntry *GetRTEByRangeTablePosn(ParseState *pstate,
+					   int varno,
+					   int sublevels_up);
+extern CommonTableExpr *GetCTEForRTE(ParseState *pstate, RangeTblEntry *rte,
+			 int rtelevelsup);
+extern Node *scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte,
+				 char *colname, int location,
+				 int fuzzy_rte_penalty, FuzzyAttrMatchState *fuzzystate);
+extern Node *colNameToVar(ParseState *pstate, char *colname, bool localonly,
+			 int location);
+extern void markVarForSelectPriv(ParseState *pstate, Var *var,
+					 RangeTblEntry *rte);
+extern Relation parserOpenTable(ParseState *pstate, const RangeVar *relation,
+				int lockmode);
+extern RangeTblEntry *addRangeTableEntry(ParseState *pstate,
+				   RangeVar *relation,
+				   Alias *alias,
+				   bool inh,
+				   bool inFromCl);
+extern RangeTblEntry *addRangeTableEntryForRelation(ParseState *pstate,
+							  Relation rel,
+							  Alias *alias,
+							  bool inh,
+							  bool inFromCl);
+extern RangeTblEntry *addRangeTableEntryForSubquery(ParseState *pstate,
+							  Query *subquery,
+							  Alias *alias,
+							  bool lateral,
+							  bool inFromCl);
+extern RangeTblEntry *addRangeTableEntryForFunction(ParseState *pstate,
+							  List *funcnames,
+							  List *funcexprs,
+							  List *coldeflists,
+							  RangeFunction *rangefunc,
+							  bool lateral,
+							  bool inFromCl);
+extern RangeTblEntry *addRangeTableEntryForValues(ParseState *pstate,
+							List *exprs,
+							List *collations,
+							Alias *alias,
+							bool lateral,
+							bool inFromCl);
+extern RangeTblEntry *addRangeTableEntryForJoin(ParseState *pstate,
+						  List *colnames,
+						  JoinType jointype,
+						  List *aliasvars,
+						  Alias *alias,
+						  bool inFromCl);
+extern RangeTblEntry *addRangeTableEntryForCTE(ParseState *pstate,
+						 CommonTableExpr *cte,
+						 Index levelsup,
+						 RangeVar *rv,
+						 bool inFromCl);
+extern bool isLockedRefname(ParseState *pstate, const char *refname);
+extern void addRTEtoQuery(ParseState *pstate, RangeTblEntry *rte,
+			  bool addToJoinList,
+			  bool addToRelNameSpace, bool addToVarNameSpace);
+extern void errorMissingRTE(ParseState *pstate, RangeVar *relation) pg_attribute_noreturn();
+extern void errorMissingColumn(ParseState *pstate,
+		 char *relname, char *colname, int location) pg_attribute_noreturn();
+extern void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up,
+		  int location, bool include_dropped,
+		  List **colnames, List **colvars);
+extern List *expandRelAttrs(ParseState *pstate, RangeTblEntry *rte,
+			   int rtindex, int sublevels_up, int location);
+extern int	attnameAttNum(Relation rd, const char *attname, bool sysColOK);
+extern Name attnumAttName(Relation rd, int attid);
+extern Oid	attnumTypeId(Relation rd, int attid);
+extern Oid	attnumCollationId(Relation rd, int attid);
+extern bool isQueryUsingTempRelation(Query *query);
+
+#endif   /* PARSE_RELATION_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/parse_target.h b/foreign/libpg_query/src/postgres/include/parser/parse_target.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/parse_target.h
@@ -0,0 +1,45 @@
+/*-------------------------------------------------------------------------
+ *
+ * parse_target.h
+ *	  handle target lists
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/parse_target.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PARSE_TARGET_H
+#define PARSE_TARGET_H
+
+#include "parser/parse_node.h"
+
+
+extern List *transformTargetList(ParseState *pstate, List *targetlist,
+					ParseExprKind exprKind);
+extern List *transformExpressionList(ParseState *pstate, List *exprlist,
+						ParseExprKind exprKind);
+extern void markTargetListOrigins(ParseState *pstate, List *targetlist);
+extern TargetEntry *transformTargetEntry(ParseState *pstate,
+					 Node *node, Node *expr, ParseExprKind exprKind,
+					 char *colname, bool resjunk);
+extern Expr *transformAssignedExpr(ParseState *pstate, Expr *expr,
+					  ParseExprKind exprKind,
+					  char *colname,
+					  int attrno,
+					  List *indirection,
+					  int location);
+extern void updateTargetListEntry(ParseState *pstate, TargetEntry *tle,
+					  char *colname, int attrno,
+					  List *indirection,
+					  int location);
+extern List *checkInsertTargets(ParseState *pstate, List *cols,
+				   List **attrnos);
+extern TupleDesc expandRecordVariable(ParseState *pstate, Var *var,
+					 int levelsup);
+extern char *FigureColname(Node *node);
+extern char *FigureIndexColname(Node *node);
+
+#endif   /* PARSE_TARGET_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/parse_type.h b/foreign/libpg_query/src/postgres/include/parser/parse_type.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/parse_type.h
@@ -0,0 +1,55 @@
+/*-------------------------------------------------------------------------
+ *
+ * parse_type.h
+ *		handle type operations for parser
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/parse_type.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PARSE_TYPE_H
+#define PARSE_TYPE_H
+
+#include "access/htup.h"
+#include "parser/parse_node.h"
+
+
+typedef HeapTuple Type;
+
+extern Type LookupTypeName(ParseState *pstate, const TypeName *typeName,
+			   int32 *typmod_p, bool missing_ok);
+extern Oid LookupTypeNameOid(ParseState *pstate, const TypeName *typeName,
+				  bool missing_ok);
+extern Type typenameType(ParseState *pstate, const TypeName *typeName,
+			 int32 *typmod_p);
+extern Oid	typenameTypeId(ParseState *pstate, const TypeName *typeName);
+extern void typenameTypeIdAndMod(ParseState *pstate, const TypeName *typeName,
+					 Oid *typeid_p, int32 *typmod_p);
+
+extern char *TypeNameToString(const TypeName *typeName);
+extern char *TypeNameListToString(List *typenames);
+
+extern Oid	LookupCollation(ParseState *pstate, List *collnames, int location);
+extern Oid	GetColumnDefCollation(ParseState *pstate, ColumnDef *coldef, Oid typeOid);
+
+extern Type typeidType(Oid id);
+
+extern Oid	typeTypeId(Type tp);
+extern int16 typeLen(Type t);
+extern bool typeByVal(Type t);
+extern char *typeTypeName(Type t);
+extern Oid	typeTypeRelid(Type typ);
+extern Oid	typeTypeCollation(Type typ);
+extern Datum stringTypeDatum(Type tp, char *string, int32 atttypmod);
+
+extern Oid	typeidTypeRelid(Oid type_id);
+
+extern TypeName *typeStringToTypeName(const char *str);
+extern void parseTypeString(const char *str, Oid *typeid_p, int32 *typmod_p, bool missing_ok);
+
+#define ISCOMPLEX(typeid) (typeidTypeRelid(typeid) != InvalidOid)
+
+#endif   /* PARSE_TYPE_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/parser.h b/foreign/libpg_query/src/postgres/include/parser/parser.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/parser.h
@@ -0,0 +1,41 @@
+/*-------------------------------------------------------------------------
+ *
+ * parser.h
+ *		Definitions for the "raw" parser (flex and bison phases only)
+ *
+ * This is the external API for the raw lexing/parsing functions.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/parser.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PARSER_H
+#define PARSER_H
+
+#include "nodes/parsenodes.h"
+
+
+typedef enum
+{
+	BACKSLASH_QUOTE_OFF,
+	BACKSLASH_QUOTE_ON,
+	BACKSLASH_QUOTE_SAFE_ENCODING
+}	BackslashQuoteType;
+
+/* GUC variables in scan.l (every one of these is a bad idea :-() */
+extern __thread  int backslash_quote;
+extern __thread  bool escape_string_warning;
+extern PGDLLIMPORT __thread  bool standard_conforming_strings;
+
+
+/* Primary entry point for the raw parsing functions */
+extern List *raw_parser(const char *str);
+
+/* Utility functions exported by gram.y (perhaps these should be elsewhere) */
+extern List *SystemFuncName(char *name);
+extern TypeName *SystemTypeName(char *name);
+
+#endif   /* PARSER_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/parsetree.h b/foreign/libpg_query/src/postgres/include/parser/parsetree.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/parsetree.h
@@ -0,0 +1,79 @@
+/*-------------------------------------------------------------------------
+ *
+ * parsetree.h
+ *	  Routines to access various components and subcomponents of
+ *	  parse trees.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/parsetree.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PARSETREE_H
+#define PARSETREE_H
+
+#include "nodes/parsenodes.h"
+
+
+/* ----------------
+ *		range table operations
+ * ----------------
+ */
+
+/*
+ *		rt_fetch
+ *
+ * NB: this will crash and burn if handed an out-of-range RT index
+ */
+#define rt_fetch(rangetable_index, rangetable) \
+	((RangeTblEntry *) list_nth(rangetable, (rangetable_index)-1))
+
+/*
+ *		getrelid
+ *
+ *		Given the range index of a relation, return the corresponding
+ *		relation OID.  Note that InvalidOid will be returned if the
+ *		RTE is for a non-relation-type RTE.
+ */
+#define getrelid(rangeindex,rangetable) \
+	(rt_fetch(rangeindex, rangetable)->relid)
+
+/*
+ * Given an RTE and an attribute number, return the appropriate
+ * variable name or alias for that attribute of that RTE.
+ */
+extern char *get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum);
+
+/*
+ * Given an RTE and an attribute number, return the appropriate
+ * type and typemod info for that attribute of that RTE.
+ */
+extern void get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
+					   Oid *vartype, int32 *vartypmod, Oid *varcollid);
+
+/*
+ * Check whether an attribute of an RTE has been dropped (note that
+ * get_rte_attribute_type will fail on such an attr)
+ */
+extern bool get_rte_attribute_is_dropped(RangeTblEntry *rte,
+							 AttrNumber attnum);
+
+
+/* ----------------
+ *		target list operations
+ * ----------------
+ */
+
+extern TargetEntry *get_tle_by_resno(List *tlist, AttrNumber resno);
+
+/* ----------------
+ *		FOR UPDATE/SHARE info
+ * ----------------
+ */
+
+extern RowMarkClause *get_parse_rowmark(Query *qry, Index rtindex);
+
+#endif   /* PARSETREE_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/scanner.h b/foreign/libpg_query/src/postgres/include/parser/scanner.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/scanner.h
@@ -0,0 +1,130 @@
+/*-------------------------------------------------------------------------
+ *
+ * scanner.h
+ *		API for the core scanner (flex machine)
+ *
+ * The core scanner is also used by PL/pgsql, so we provide a public API
+ * for it.  However, the rest of the backend is only expected to use the
+ * higher-level API provided by parser.h.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/scanner.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef SCANNER_H
+#define SCANNER_H
+
+#include "parser/keywords.h"
+
+/*
+ * The scanner returns extra data about scanned tokens in this union type.
+ * Note that this is a subset of the fields used in YYSTYPE of the bison
+ * parsers built atop the scanner.
+ */
+typedef union core_YYSTYPE
+{
+	int			ival;			/* for integer literals */
+	char	   *str;			/* for identifiers and non-integer literals */
+	const char *keyword;		/* canonical spelling of keywords */
+} core_YYSTYPE;
+
+/*
+ * We track token locations in terms of byte offsets from the start of the
+ * source string, not the column number/line number representation that
+ * bison uses by default.  Also, to minimize overhead we track only one
+ * location (usually the first token location) for each construct, not
+ * the beginning and ending locations as bison does by default.  It's
+ * therefore sufficient to make YYLTYPE an int.
+ */
+#define YYLTYPE  int
+
+/*
+ * Another important component of the scanner's API is the token code numbers.
+ * However, those are not defined in this file, because bison insists on
+ * defining them for itself.  The token codes used by the core scanner are
+ * the ASCII characters plus these:
+ *	%token <str>	IDENT FCONST SCONST BCONST XCONST Op
+ *	%token <ival>	ICONST PARAM
+ *	%token			TYPECAST DOT_DOT COLON_EQUALS EQUALS_GREATER
+ *	%token			LESS_EQUALS GREATER_EQUALS NOT_EQUALS
+ * The above token definitions *must* be the first ones declared in any
+ * bison parser built atop this scanner, so that they will have consistent
+ * numbers assigned to them (specifically, IDENT = 258 and so on).
+ */
+
+/*
+ * The YY_EXTRA data that a flex scanner allows us to pass around.
+ * Private state needed by the core scanner goes here.  Note that the actual
+ * yy_extra struct may be larger and have this as its first component, thus
+ * allowing the calling parser to keep some fields of its own in YY_EXTRA.
+ */
+typedef struct core_yy_extra_type
+{
+	/*
+	 * The string the scanner is physically scanning.  We keep this mainly so
+	 * that we can cheaply compute the offset of the current token (yytext).
+	 */
+	char	   *scanbuf;
+	Size		scanbuflen;
+
+	/*
+	 * The keyword list to use.
+	 */
+	const ScanKeyword *keywords;
+	int			num_keywords;
+
+	/*
+	 * Scanner settings to use.  These are initialized from the corresponding
+	 * GUC variables by scanner_init().  Callers can modify them after
+	 * scanner_init() if they don't want the scanner's behavior to follow the
+	 * prevailing GUC settings.
+	 */
+	int			backslash_quote;
+	bool		escape_string_warning;
+	bool		standard_conforming_strings;
+
+	/*
+	 * literalbuf is used to accumulate literal values when multiple rules are
+	 * needed to parse a single literal.  Call startlit() to reset buffer to
+	 * empty, addlit() to add text.  NOTE: the string in literalbuf is NOT
+	 * necessarily null-terminated, but there always IS room to add a trailing
+	 * null at offset literallen.  We store a null only when we need it.
+	 */
+	char	   *literalbuf;		/* palloc'd expandable buffer */
+	int			literallen;		/* actual current string length */
+	int			literalalloc;	/* current allocated buffer size */
+
+	int			xcdepth;		/* depth of nesting in slash-star comments */
+	char	   *dolqstart;		/* current $foo$ quote start string */
+
+	/* first part of UTF16 surrogate pair for Unicode escapes */
+	int32		utf16_first_part;
+
+	/* state variables for literal-lexing warnings */
+	bool		warn_on_first_escape;
+	bool		saw_non_ascii;
+} core_yy_extra_type;
+
+/*
+ * The type of yyscanner is opaque outside scan.l.
+ */
+typedef void *core_yyscan_t;
+
+
+/* Entry points in parser/scan.l */
+extern core_yyscan_t scanner_init(const char *str,
+			 core_yy_extra_type *yyext,
+			 const ScanKeyword *keywords,
+			 int num_keywords);
+extern void scanner_finish(core_yyscan_t yyscanner);
+extern int core_yylex(core_YYSTYPE *lvalp, YYLTYPE *llocp,
+		   core_yyscan_t yyscanner);
+extern int	scanner_errposition(int location, core_yyscan_t yyscanner);
+extern void scanner_yyerror(const char *message, core_yyscan_t yyscanner) pg_attribute_noreturn();
+
+#endif   /* SCANNER_H */
diff --git a/foreign/libpg_query/src/postgres/include/parser/scansup.h b/foreign/libpg_query/src/postgres/include/parser/scansup.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/parser/scansup.h
@@ -0,0 +1,27 @@
+/*-------------------------------------------------------------------------
+ *
+ * scansup.h
+ *	  scanner support routines.  used by both the bootstrap lexer
+ * as well as the normal lexer
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/parser/scansup.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef SCANSUP_H
+#define SCANSUP_H
+
+extern char *scanstr(const char *s);
+
+extern char *downcase_truncate_identifier(const char *ident, int len,
+							 bool warn);
+
+extern void truncate_identifier(char *ident, int len, bool warn);
+
+extern bool scanner_isspace(char ch);
+
+#endif   /* SCANSUP_H */
diff --git a/foreign/libpg_query/src/postgres/include/pg_config.h b/foreign/libpg_query/src/postgres/include/pg_config.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/pg_config.h
@@ -0,0 +1,911 @@
+/* src/include/pg_config.h.  Generated from pg_config.h.in by configure.  */
+/* src/include/pg_config.h.in.  Generated from configure.in by autoheader.  */
+
+/* Define to the type of arg 1 of 'accept' */
+#define ACCEPT_TYPE_ARG1 int
+
+/* Define to the type of arg 2 of 'accept' */
+#define ACCEPT_TYPE_ARG2 struct sockaddr *
+
+/* Define to the type of arg 3 of 'accept' */
+#define ACCEPT_TYPE_ARG3 socklen_t
+
+/* Define to the return type of 'accept' */
+#define ACCEPT_TYPE_RETURN int
+
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* The normal alignment of `double', in bytes. */
+#define ALIGNOF_DOUBLE 8
+
+/* The normal alignment of `int', in bytes. */
+#define ALIGNOF_INT 4
+
+/* The normal alignment of `long', in bytes. */
+#define ALIGNOF_LONG 8
+
+/* The normal alignment of `long long int', in bytes. */
+/* #undef ALIGNOF_LONG_LONG_INT */
+
+/* The normal alignment of `short', in bytes. */
+#define ALIGNOF_SHORT 2
+
+/* Size of a disk block --- this also limits the size of a tuple. You can set
+   it bigger if you need bigger tuples (although TOAST should reduce the need
+   to have large tuples, since fields can be spread across multiple tuples).
+   BLCKSZ must be a power of 2. The maximum possible value of BLCKSZ is
+   currently 2^15 (32768). This is determined by the 15-bit widths of the
+   lp_off and lp_len fields in ItemIdData (see include/storage/itemid.h).
+   Changing BLCKSZ requires an initdb. */
+#define BLCKSZ 8192
+
+/* Define to the default TCP port number on which the server listens and to
+   which clients will try to connect. This can be overridden at run-time, but
+   it's convenient if your clients have the right default compiled in.
+   (--with-pgport=PORTNUM) */
+#define DEF_PGPORT 5432
+
+/* Define to the default TCP port number as a string constant. */
+#define DEF_PGPORT_STR "5432"
+
+/* Define to build with GSSAPI support. (--with-gssapi) */
+/* #undef ENABLE_GSS */
+
+/* Define to 1 if you want National Language Support. (--enable-nls) */
+/* #undef ENABLE_NLS */
+
+/* Define to 1 to build client libraries as thread-safe code.
+   (--enable-thread-safety) */
+#define ENABLE_THREAD_SAFETY 1
+
+/* Define to nothing if C supports flexible array members, and to 1 if it does
+   not. That way, with a declaration like `struct s { int n; double
+   d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99
+   compilers. When computing the size of such an object, don't use 'sizeof
+   (struct s)' as it overestimates the size. Use 'offsetof (struct s, d)'
+   instead. Don't use 'offsetof (struct s, d[0])', as this doesn't work with
+   MSVC and with C++ compilers. */
+#define FLEXIBLE_ARRAY_MEMBER /**/
+
+/* float4 values are passed by value if 'true', by reference if 'false' */
+#define FLOAT4PASSBYVAL true
+
+/* float8, int8, and related values are passed by value if 'true', by
+   reference if 'false' */
+#define FLOAT8PASSBYVAL true
+
+/* Define to 1 if gettimeofday() takes only 1 argument. */
+/* #undef GETTIMEOFDAY_1ARG */
+
+#ifdef GETTIMEOFDAY_1ARG
+# define gettimeofday(a,b) gettimeofday(a)
+#endif
+
+/* Define to 1 if you have the `append_history' function. */
+/* #undef HAVE_APPEND_HISTORY */
+
+/* Define to 1 if you want to use atomics if available. */
+#define HAVE_ATOMICS 1
+
+/* Define to 1 if you have the <atomic.h> header file. */
+/* #undef HAVE_ATOMIC_H */
+
+/* Define to 1 if you have the `cbrt' function. */
+#define HAVE_CBRT 1
+
+/* Define to 1 if you have the `class' function. */
+/* #undef HAVE_CLASS */
+
+/* Define to 1 if you have the <crtdefs.h> header file. */
+/* #undef HAVE_CRTDEFS_H */
+
+/* Define to 1 if you have the `crypt' function. */
+#define HAVE_CRYPT 1
+
+/* Define to 1 if you have the <crypt.h> header file. */
+/* #undef HAVE_CRYPT_H */
+
+/* Define to 1 if you have the declaration of `fdatasync', and to 0 if you
+   don't. */
+#define HAVE_DECL_FDATASYNC 0
+
+/* Define to 1 if you have the declaration of `F_FULLFSYNC', and to 0 if you
+   don't. */
+#define HAVE_DECL_F_FULLFSYNC 1
+
+/* Define to 1 if you have the declaration of `posix_fadvise', and to 0 if you
+   don't. */
+#define HAVE_DECL_POSIX_FADVISE 0
+
+/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
+   don't. */
+#define HAVE_DECL_SNPRINTF 1
+
+/* Define to 1 if you have the declaration of `strlcat', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRLCAT 1
+
+/* Define to 1 if you have the declaration of `strlcpy', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRLCPY 1
+
+/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
+   don't. */
+#define HAVE_DECL_SYS_SIGLIST 1
+
+/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
+   don't. */
+#define HAVE_DECL_VSNPRINTF 1
+
+/* Define to 1 if you have the <dld.h> header file. */
+/* #undef HAVE_DLD_H */
+
+/* Define to 1 if you have the `dlopen' function. */
+#define HAVE_DLOPEN 1
+
+/* Define to 1 if you have the <editline/history.h> header file. */
+/* #undef HAVE_EDITLINE_HISTORY_H */
+
+/* Define to 1 if you have the <editline/readline.h> header file. */
+/* #undef HAVE_EDITLINE_READLINE_H */
+
+/* Define to 1 if you have the `fdatasync' function. */
+#define HAVE_FDATASYNC 1
+
+/* Define to 1 if you have the `fls' function. */
+#define HAVE_FLS 1
+
+/* Define to 1 if you have the `fpclass' function. */
+/* #undef HAVE_FPCLASS */
+
+/* Define to 1 if you have the `fp_class' function. */
+/* #undef HAVE_FP_CLASS */
+
+/* Define to 1 if you have the `fp_class_d' function. */
+/* #undef HAVE_FP_CLASS_D */
+
+/* Define to 1 if you have the <fp_class.h> header file. */
+/* #undef HAVE_FP_CLASS_H */
+
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#define HAVE_FSEEKO 1
+
+/* Define to 1 if your compiler understands __func__. */
+#define HAVE_FUNCNAME__FUNC 1
+
+/* Define to 1 if your compiler understands __FUNCTION__. */
+/* #undef HAVE_FUNCNAME__FUNCTION */
+
+/* Define to 1 if you have __atomic_compare_exchange_n(int *, int *, int). */
+#define HAVE_GCC__ATOMIC_INT32_CAS 1
+
+/* Define to 1 if you have __atomic_compare_exchange_n(int64 *, int *, int64).
+   */
+#define HAVE_GCC__ATOMIC_INT64_CAS 1
+
+/* Define to 1 if you have __sync_lock_test_and_set(char *) and friends. */
+#define HAVE_GCC__SYNC_CHAR_TAS 1
+
+/* Define to 1 if you have __sync_compare_and_swap(int *, int, int). */
+#define HAVE_GCC__SYNC_INT32_CAS 1
+
+/* Define to 1 if you have __sync_lock_test_and_set(int *) and friends. */
+#define HAVE_GCC__SYNC_INT32_TAS 1
+
+/* Define to 1 if you have __sync_compare_and_swap(int64 *, int64, int64). */
+#define HAVE_GCC__SYNC_INT64_CAS 1
+
+/* Define to 1 if you have the `getaddrinfo' function. */
+#define HAVE_GETADDRINFO 1
+
+/* Define to 1 if you have the `gethostbyname_r' function. */
+/* #undef HAVE_GETHOSTBYNAME_R */
+
+/* Define to 1 if you have the `getifaddrs' function. */
+#define HAVE_GETIFADDRS 1
+
+/* Define to 1 if you have the `getopt' function. */
+#define HAVE_GETOPT 1
+
+/* Define to 1 if you have the <getopt.h> header file. */
+#define HAVE_GETOPT_H 1
+
+/* Define to 1 if you have the `getopt_long' function. */
+#define HAVE_GETOPT_LONG 1
+
+/* Define to 1 if you have the `getpeereid' function. */
+#define HAVE_GETPEEREID 1
+
+/* Define to 1 if you have the `getpeerucred' function. */
+/* #undef HAVE_GETPEERUCRED */
+
+/* Define to 1 if you have the `getpwuid_r' function. */
+#define HAVE_GETPWUID_R 1
+
+/* Define to 1 if you have the `getrlimit' function. */
+#define HAVE_GETRLIMIT 1
+
+/* Define to 1 if you have the `getrusage' function. */
+#define HAVE_GETRUSAGE 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+/* #undef HAVE_GETTIMEOFDAY */
+
+/* Define to 1 if you have the <gssapi/gssapi.h> header file. */
+/* #undef HAVE_GSSAPI_GSSAPI_H */
+
+/* Define to 1 if you have the <gssapi.h> header file. */
+/* #undef HAVE_GSSAPI_H */
+
+/* Define to 1 if you have the <history.h> header file. */
+/* #undef HAVE_HISTORY_H */
+
+/* Define to 1 if you have the `history_truncate_file' function. */
+/* #undef HAVE_HISTORY_TRUNCATE_FILE */
+
+/* Define to 1 if you have the <ieeefp.h> header file. */
+/* #undef HAVE_IEEEFP_H */
+
+/* Define to 1 if you have the <ifaddrs.h> header file. */
+#define HAVE_IFADDRS_H 1
+
+/* Define to 1 if you have the `inet_aton' function. */
+#define HAVE_INET_ATON 1
+
+/* Define to 1 if the system has the type `int64'. */
+/* #undef HAVE_INT64 */
+
+/* Define to 1 if the system has the type `int8'. */
+/* #undef HAVE_INT8 */
+
+/* Define to 1 if the system has the type `intptr_t'. */
+#define HAVE_INTPTR_T 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the global variable 'int opterr'. */
+#define HAVE_INT_OPTERR 1
+
+/* Define to 1 if you have the global variable 'int optreset'. */
+#define HAVE_INT_OPTRESET 1
+
+/* Define to 1 if you have the global variable 'int timezone'. */
+#define HAVE_INT_TIMEZONE 1
+
+/* Define to 1 if you have support for IPv6. */
+#define HAVE_IPV6 1
+
+/* Define to 1 if you have isinf(). */
+#define HAVE_ISINF 1
+
+/* Define to 1 if you have the <langinfo.h> header file. */
+#define HAVE_LANGINFO_H 1
+
+/* Define to 1 if you have the <ldap.h> header file. */
+/* #undef HAVE_LDAP_H */
+
+/* Define to 1 if you have the `crypto' library (-lcrypto). */
+/* #undef HAVE_LIBCRYPTO */
+
+/* Define to 1 if you have the `ldap' library (-lldap). */
+/* #undef HAVE_LIBLDAP */
+
+/* Define to 1 if you have the `ldap_r' library (-lldap_r). */
+/* #undef HAVE_LIBLDAP_R */
+
+/* Define to 1 if you have the `m' library (-lm). */
+#define HAVE_LIBM 1
+
+/* Define to 1 if you have the `pam' library (-lpam). */
+/* #undef HAVE_LIBPAM */
+
+/* Define if you have a function readline library */
+/* #undef HAVE_LIBREADLINE */
+
+/* Define to 1 if you have the `selinux' library (-lselinux). */
+/* #undef HAVE_LIBSELINUX */
+
+/* Define to 1 if you have the `ssl' library (-lssl). */
+/* #undef HAVE_LIBSSL */
+
+/* Define to 1 if you have the `wldap32' library (-lwldap32). */
+/* #undef HAVE_LIBWLDAP32 */
+
+/* Define to 1 if you have the `xml2' library (-lxml2). */
+/* #undef HAVE_LIBXML2 */
+
+/* Define to 1 if you have the `xslt' library (-lxslt). */
+/* #undef HAVE_LIBXSLT */
+
+/* Define to 1 if you have the `z' library (-lz). */
+/* #undef HAVE_LIBZ */
+
+/* Define to 1 if constants of type 'long long int' should have the suffix LL.
+   */
+/* #undef HAVE_LL_CONSTANTS */
+
+/* Define to 1 if the system has the type `locale_t'. */
+#define HAVE_LOCALE_T 1
+
+/* Define to 1 if `long int' works and is 64 bits. */
+#define HAVE_LONG_INT_64 1
+
+/* Define to 1 if the system has the type `long long int'. */
+#define HAVE_LONG_LONG_INT 1
+
+/* Define to 1 if `long long int' works and is 64 bits. */
+/* #undef HAVE_LONG_LONG_INT_64 */
+
+/* Define to 1 if you have the <mbarrier.h> header file. */
+/* #undef HAVE_MBARRIER_H */
+
+/* Define to 1 if you have the `mbstowcs_l' function. */
+#define HAVE_MBSTOWCS_L 1
+
+/* Define to 1 if you have the `memmove' function. */
+#define HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if the system has the type `MINIDUMP_TYPE'. */
+/* #undef HAVE_MINIDUMP_TYPE */
+
+/* Define to 1 if you have the `mkdtemp' function. */
+#define HAVE_MKDTEMP 1
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the <netinet/tcp.h> header file. */
+#define HAVE_NETINET_TCP_H 1
+
+/* Define to 1 if you have the <net/if.h> header file. */
+#define HAVE_NET_IF_H 1
+
+/* Define to 1 if you have the <ossp/uuid.h> header file. */
+/* #undef HAVE_OSSP_UUID_H */
+
+/* Define to 1 if you have the <pam/pam_appl.h> header file. */
+/* #undef HAVE_PAM_PAM_APPL_H */
+
+/* Define to 1 if you have the `poll' function. */
+#define HAVE_POLL 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define HAVE_POLL_H 1
+
+/* Define to 1 if you have the `posix_fadvise' function. */
+/* #undef HAVE_POSIX_FADVISE */
+
+/* Define to 1 if you have the POSIX signal interface. */
+#define HAVE_POSIX_SIGNALS 1
+
+/* Define to 1 if the assembler supports PPC's LWARX mutex hint bit. */
+/* #undef HAVE_PPC_LWARX_MUTEX_HINT */
+
+/* Define to 1 if you have the `pstat' function. */
+/* #undef HAVE_PSTAT */
+
+/* Define to 1 if the PS_STRINGS thing exists. */
+/* #undef HAVE_PS_STRINGS */
+
+/* Define to 1 if you have the `pthread_is_threaded_np' function. */
+#define HAVE_PTHREAD_IS_THREADED_NP 1
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#define HAVE_PWD_H 1
+
+/* Define to 1 if you have the `random' function. */
+#define HAVE_RANDOM 1
+
+/* Define to 1 if you have the <readline.h> header file. */
+/* #undef HAVE_READLINE_H */
+
+/* Define to 1 if you have the <readline/history.h> header file. */
+/* #undef HAVE_READLINE_HISTORY_H */
+
+/* Define to 1 if you have the <readline/readline.h> header file. */
+/* #undef HAVE_READLINE_READLINE_H */
+
+/* Define to 1 if you have the `readlink' function. */
+#define HAVE_READLINK 1
+
+/* Define to 1 if you have the `rint' function. */
+#define HAVE_RINT 1
+
+/* Define to 1 if you have the global variable
+   'rl_completion_append_character'. */
+/* #undef HAVE_RL_COMPLETION_APPEND_CHARACTER */
+
+/* Define to 1 if you have the `rl_completion_matches' function. */
+/* #undef HAVE_RL_COMPLETION_MATCHES */
+
+/* Define to 1 if you have the `rl_filename_completion_function' function. */
+/* #undef HAVE_RL_FILENAME_COMPLETION_FUNCTION */
+
+/* Define to 1 if you have the `rl_reset_screen_size' function. */
+/* #undef HAVE_RL_RESET_SCREEN_SIZE */
+
+/* Define to 1 if you have the <security/pam_appl.h> header file. */
+/* #undef HAVE_SECURITY_PAM_APPL_H */
+
+/* Define to 1 if you have the `setproctitle' function. */
+/* #undef HAVE_SETPROCTITLE */
+
+/* Define to 1 if you have the `setsid' function. */
+#define HAVE_SETSID 1
+
+/* Define to 1 if you have the `shm_open' function. */
+#define HAVE_SHM_OPEN 1
+
+/* Define to 1 if you have the `sigprocmask' function. */
+#define HAVE_SIGPROCMASK 1
+
+/* Define to 1 if you have sigsetjmp(). */
+#define HAVE_SIGSETJMP 1
+
+/* Define to 1 if the system has the type `sig_atomic_t'. */
+#define HAVE_SIG_ATOMIC_T 1
+
+/* Define to 1 if you have the `snprintf' function. */
+#define HAVE_SNPRINTF 1
+
+/* Define to 1 if you have spinlocks. */
+#define HAVE_SPINLOCKS 1
+
+/* Define to 1 if you have the `srandom' function. */
+#define HAVE_SRANDOM 1
+
+/* Define to 1 if you have the `SSL_get_current_compression' function. */
+/* #undef HAVE_SSL_GET_CURRENT_COMPRESSION */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the `strerror_r' function. */
+#define HAVE_STRERROR_R 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcat' function. */
+#define HAVE_STRLCAT 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+#define HAVE_STRLCPY 1
+
+/* Define to 1 if you have the `strtoll' function. */
+#define HAVE_STRTOLL 1
+
+/* Define to 1 if you have the `strtoq' function. */
+/* #undef HAVE_STRTOQ */
+
+/* Define to 1 if you have the `strtoull' function. */
+#define HAVE_STRTOULL 1
+
+/* Define to 1 if you have the `strtouq' function. */
+/* #undef HAVE_STRTOUQ */
+
+/* Define to 1 if the system has the type `struct addrinfo'. */
+#define HAVE_STRUCT_ADDRINFO 1
+
+/* Define to 1 if the system has the type `struct cmsgcred'. */
+/* #undef HAVE_STRUCT_CMSGCRED */
+
+/* Define to 1 if the system has the type `struct option'. */
+#define HAVE_STRUCT_OPTION 1
+
+/* Define to 1 if `sa_len' is a member of `struct sockaddr'. */
+#define HAVE_STRUCT_SOCKADDR_SA_LEN 1
+
+/* Define to 1 if the system has the type `struct sockaddr_storage'. */
+#define HAVE_STRUCT_SOCKADDR_STORAGE 1
+
+/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */
+#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
+
+/* Define to 1 if `ss_len' is a member of `struct sockaddr_storage'. */
+#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN 1
+
+/* Define to 1 if `__ss_family' is a member of `struct sockaddr_storage'. */
+/* #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */
+
+/* Define to 1 if `__ss_len' is a member of `struct sockaddr_storage'. */
+/* #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_LEN */
+
+/* Define to 1 if `tm_zone' is a member of `struct tm'. */
+#define HAVE_STRUCT_TM_TM_ZONE 1
+
+/* Define to 1 if you have the `symlink' function. */
+#define HAVE_SYMLINK 1
+
+/* Define to 1 if you have the `sync_file_range' function. */
+/* #undef HAVE_SYNC_FILE_RANGE */
+
+/* Define to 1 if you have the syslog interface. */
+#define HAVE_SYSLOG 1
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/ipc.h> header file. */
+#define HAVE_SYS_IPC_H 1
+
+/* Define to 1 if you have the <sys/poll.h> header file. */
+#define HAVE_SYS_POLL_H 1
+
+/* Define to 1 if you have the <sys/pstat.h> header file. */
+/* #undef HAVE_SYS_PSTAT_H */
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#define HAVE_SYS_RESOURCE_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/sem.h> header file. */
+#define HAVE_SYS_SEM_H 1
+
+/* Define to 1 if you have the <sys/shm.h> header file. */
+#define HAVE_SYS_SHM_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/sockio.h> header file. */
+#define HAVE_SYS_SOCKIO_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/tas.h> header file. */
+/* #undef HAVE_SYS_TAS_H */
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/ucred.h> header file. */
+#define HAVE_SYS_UCRED_H 1
+
+/* Define to 1 if you have the <sys/un.h> header file. */
+#define HAVE_SYS_UN_H 1
+
+/* Define to 1 if you have the <termios.h> header file. */
+#define HAVE_TERMIOS_H 1
+
+/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
+   `HAVE_STRUCT_TM_TM_ZONE' instead. */
+#define HAVE_TM_ZONE 1
+
+/* Define to 1 if you have the `towlower' function. */
+#define HAVE_TOWLOWER 1
+
+/* Define to 1 if you have the external array `tzname'. */
+#define HAVE_TZNAME 1
+
+/* Define to 1 if you have the <ucred.h> header file. */
+/* #undef HAVE_UCRED_H */
+
+/* Define to 1 if the system has the type `uint64'. */
+/* #undef HAVE_UINT64 */
+
+/* Define to 1 if the system has the type `uint8'. */
+/* #undef HAVE_UINT8 */
+
+/* Define to 1 if the system has the type `uintptr_t'. */
+#define HAVE_UINTPTR_T 1
+
+/* Define to 1 if the system has the type `union semun'. */
+#define HAVE_UNION_SEMUN 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have unix sockets. */
+#define HAVE_UNIX_SOCKETS 1
+
+/* Define to 1 if you have the `unsetenv' function. */
+#define HAVE_UNSETENV 1
+
+/* Define to 1 if the system has the type `unsigned long long int'. */
+#define HAVE_UNSIGNED_LONG_LONG_INT 1
+
+/* Define to 1 if you have the `utime' function. */
+#define HAVE_UTIME 1
+
+/* Define to 1 if you have the `utimes' function. */
+#define HAVE_UTIMES 1
+
+/* Define to 1 if you have the <utime.h> header file. */
+#define HAVE_UTIME_H 1
+
+/* Define to 1 if you have BSD UUID support. */
+/* #undef HAVE_UUID_BSD */
+
+/* Define to 1 if you have E2FS UUID support. */
+/* #undef HAVE_UUID_E2FS */
+
+/* Define to 1 if you have the <uuid.h> header file. */
+/* #undef HAVE_UUID_H */
+
+/* Define to 1 if you have OSSP UUID support. */
+/* #undef HAVE_UUID_OSSP */
+
+/* Define to 1 if you have the <uuid/uuid.h> header file. */
+/* #undef HAVE_UUID_UUID_H */
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#define HAVE_WCHAR_H 1
+
+/* Define to 1 if you have the `wcstombs' function. */
+#define HAVE_WCSTOMBS 1
+
+/* Define to 1 if you have the `wcstombs_l' function. */
+#define HAVE_WCSTOMBS_L 1
+
+/* Define to 1 if you have the <wctype.h> header file. */
+#define HAVE_WCTYPE_H 1
+
+/* Define to 1 if you have the <winldap.h> header file. */
+/* #undef HAVE_WINLDAP_H */
+
+/* Define to 1 if your compiler understands __builtin_bswap32. */
+#define HAVE__BUILTIN_BSWAP32 1
+
+/* Define to 1 if your compiler understands __builtin_constant_p. */
+#define HAVE__BUILTIN_CONSTANT_P 1
+
+/* Define to 1 if your compiler understands __builtin_types_compatible_p. */
+#define HAVE__BUILTIN_TYPES_COMPATIBLE_P 1
+
+/* Define to 1 if your compiler understands __builtin_unreachable. */
+#define HAVE__BUILTIN_UNREACHABLE 1
+
+/* Define to 1 if you have __cpuid. */
+/* #undef HAVE__CPUID */
+
+/* Define to 1 if you have __get_cpuid. */
+#define HAVE__GET_CPUID 1
+
+/* Define to 1 if your compiler understands _Static_assert. */
+#define HAVE__STATIC_ASSERT 1
+
+/* Define to 1 if your compiler understands __VA_ARGS__ in macros. */
+#define HAVE__VA_ARGS 1
+
+/* Define to the appropriate snprintf length modifier for 64-bit ints. */
+#define INT64_MODIFIER "l"
+
+/* Define to 1 if `locale_t' requires <xlocale.h>. */
+#define LOCALE_T_IN_XLOCALE 1
+
+/* Define as the maximum alignment requirement of any C data type. */
+#define MAXIMUM_ALIGNOF 8
+
+/* Define bytes to use libc memset(). */
+#define MEMSET_LOOP_LIMIT 1024
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "pgsql-bugs@postgresql.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "PostgreSQL"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "PostgreSQL 9.5.3"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "postgresql"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "9.5.3"
+
+/* Define to the name of a signed 128-bit integer type. */
+#define PG_INT128_TYPE __int128
+
+/* Define to the name of a signed 64-bit integer type. */
+#define PG_INT64_TYPE long int
+
+/* Define to the name of the default PostgreSQL service principal in Kerberos
+   (GSSAPI). (--with-krb-srvnam=NAME) */
+#define PG_KRB_SRVNAM "postgres"
+
+/* PostgreSQL major version as a string */
+#define PG_MAJORVERSION "9.5"
+
+/* Define to gnu_printf if compiler supports it, else printf. */
+#define PG_PRINTF_ATTRIBUTE printf
+
+/* Define to 1 if "static inline" works without unwanted warnings from
+   compilations where static inline functions are defined but not called. */
+#define PG_USE_INLINE 1
+
+/* PostgreSQL version as a string */
+#define PG_VERSION "9.5.3"
+
+/* PostgreSQL version as a number */
+#define PG_VERSION_NUM 90503
+
+/* A string containing the version number, platform, and C compiler */
+#define PG_VERSION_STR "PostgreSQL 9.5.3 on x86_64-apple-darwin14.5.0, compiled by Apple LLVM version 7.0.2 (clang-700.1.81), 64-bit"
+
+/* Define to 1 to allow profiling output to be saved separately for each
+   process. */
+/* #undef PROFILE_PID_DIR */
+
+/* RELSEG_SIZE is the maximum number of blocks allowed in one disk file. Thus,
+   the maximum size of a single file is RELSEG_SIZE * BLCKSZ; relations bigger
+   than that are divided into multiple files. RELSEG_SIZE * BLCKSZ must be
+   less than your OS' limit on file size. This is often 2 GB or 4GB in a
+   32-bit operating system, unless you have large file support enabled. By
+   default, we make the limit 1 GB to avoid any possible integer-overflow
+   problems within the OS. A limit smaller than necessary only means we divide
+   a large relation into more chunks than necessary, so it seems best to err
+   in the direction of a small limit. A power-of-2 value is recommended to
+   save a few cycles in md.c, but is not absolutely required. Changing
+   RELSEG_SIZE requires an initdb. */
+#define RELSEG_SIZE 131072
+
+/* The size of `long', as computed by sizeof. */
+#define SIZEOF_LONG 8
+
+/* The size of `off_t', as computed by sizeof. */
+#define SIZEOF_OFF_T 8
+
+/* The size of `size_t', as computed by sizeof. */
+#define SIZEOF_SIZE_T 8
+
+/* The size of `void *', as computed by sizeof. */
+#define SIZEOF_VOID_P 8
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if strerror_r() returns a int. */
+#define STRERROR_R_INT 1
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+/* #undef TM_IN_SYS_TIME */
+
+/* Define to 1 to build with assertion checks. (--enable-cassert) */
+/* #undef USE_ASSERT_CHECKING */
+
+/* Define to 1 to build with Bonjour support. (--with-bonjour) */
+/* #undef USE_BONJOUR */
+
+/* Define to 1 if you want float4 values to be passed by value.
+   (--enable-float4-byval) */
+#define USE_FLOAT4_BYVAL 1
+
+/* Define to 1 if you want float8, int8, etc values to be passed by value.
+   (--enable-float8-byval) */
+#define USE_FLOAT8_BYVAL 1
+
+/* Define to 1 if you want 64-bit integer timestamp and interval support.
+   (--enable-integer-datetimes) */
+#define USE_INTEGER_DATETIMES 1
+
+/* Define to 1 to build with LDAP support. (--with-ldap) */
+/* #undef USE_LDAP */
+
+/* Define to 1 to build with XML support. (--with-libxml) */
+/* #undef USE_LIBXML */
+
+/* Define to 1 to use XSLT support when building contrib/xml2.
+   (--with-libxslt) */
+/* #undef USE_LIBXSLT */
+
+/* Define to select named POSIX semaphores. */
+/* #undef USE_NAMED_POSIX_SEMAPHORES */
+
+/* Define to build with OpenSSL support. (--with-openssl) */
+/* #undef USE_OPENSSL */
+
+/* Define to 1 to build with PAM support. (--with-pam) */
+/* #undef USE_PAM */
+
+/* Use replacement snprintf() functions. */
+/* #undef USE_REPL_SNPRINTF */
+
+/* Define to 1 to use Intel SSE 4.2 CRC instructions with a runtime check. */
+/* #undef USE_SLICING_BY_8_CRC32C */
+
+/* Define to 1 use Intel SSE 4.2 CRC instructions. */
+/* #undef USE_SSE42_CRC32C */
+
+/* Define to 1 to use Intel SSSE 4.2 CRC instructions with a runtime check. */
+#define USE_SSE42_CRC32C_WITH_RUNTIME_CHECK 1
+
+/* Define to select SysV-style semaphores. */
+#define USE_SYSV_SEMAPHORES 1
+
+/* Define to select SysV-style shared memory. */
+#define USE_SYSV_SHARED_MEMORY 1
+
+/* Define to select unnamed POSIX semaphores. */
+/* #undef USE_UNNAMED_POSIX_SEMAPHORES */
+
+/* Define to select Win32-style semaphores. */
+/* #undef USE_WIN32_SEMAPHORES */
+
+/* Define to select Win32-style shared memory. */
+/* #undef USE_WIN32_SHARED_MEMORY */
+
+/* Define to 1 if `wcstombs_l' requires <xlocale.h>. */
+#define WCSTOMBS_L_IN_XLOCALE 1
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* #  undef WORDS_BIGENDIAN */
+# endif
+#endif
+
+/* Size of a WAL file block. This need have no particular relation to BLCKSZ.
+   XLOG_BLCKSZ must be a power of 2, and if your system supports O_DIRECT I/O,
+   XLOG_BLCKSZ must be a multiple of the alignment requirement for direct-I/O
+   buffers, else direct I/O may fail. Changing XLOG_BLCKSZ requires an initdb.
+   */
+#define XLOG_BLCKSZ 8192
+
+/* XLOG_SEG_SIZE is the size of a single WAL file. This must be a power of 2
+   and larger than XLOG_BLCKSZ (preferably, a great deal larger than
+   XLOG_BLCKSZ). Changing XLOG_SEG_SIZE requires an initdb. */
+#define XLOG_SEG_SIZE (16 * 1024 * 1024)
+
+
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+/* #undef _LARGEFILE_SOURCE */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to the type of a signed integer type wide enough to hold a pointer,
+   if such a type exists, and if the system does not define it. */
+/* #undef intptr_t */
+
+/* Define to empty if the C compiler does not understand signed types. */
+/* #undef signed */
+
+/* Define to the type of an unsigned integer type wide enough to hold a
+   pointer, if such a type exists, and if the system does not define it. */
+/* #undef uintptr_t */
+#undef HAVE_LOCALE_T
+#undef LOCALE_T_IN_XLOCALE
+#undef WCSTOMBS_L_IN_XLOCALE
diff --git a/foreign/libpg_query/src/postgres/include/pg_config_ext.h b/foreign/libpg_query/src/postgres/include/pg_config_ext.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/pg_config_ext.h
@@ -0,0 +1,8 @@
+/* src/include/pg_config_ext.h.  Generated from pg_config_ext.h.in by configure.  */
+/*
+ * src/include/pg_config_ext.h.in.  This is generated manually, not by
+ * autoheader, since we want to limit which symbols get defined here.
+ */
+
+/* Define to the name of a signed 64-bit integer type. */
+#define PG_INT64_TYPE long int
diff --git a/foreign/libpg_query/src/postgres/include/pg_config_manual.h b/foreign/libpg_query/src/postgres/include/pg_config_manual.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/pg_config_manual.h
@@ -0,0 +1,307 @@
+/*------------------------------------------------------------------------
+ * PostgreSQL manual configuration settings
+ *
+ * This file contains various configuration symbols and limits.  In
+ * all cases, changing them is only useful in very rare situations or
+ * for developers.  If you edit any of these, be sure to do a *full*
+ * rebuild (and an initdb if noted).
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/pg_config_manual.h
+ *------------------------------------------------------------------------
+ */
+
+/*
+ * Maximum length for identifiers (e.g. table names, column names,
+ * function names).  Names actually are limited to one less byte than this,
+ * because the length must include a trailing zero byte.
+ *
+ * Changing this requires an initdb.
+ */
+#define NAMEDATALEN 64
+
+/*
+ * Maximum number of arguments to a function.
+ *
+ * The minimum value is 8 (GIN indexes use 8-argument support functions).
+ * The maximum possible value is around 600 (limited by index tuple size in
+ * pg_proc's index; BLCKSZ larger than 8K would allow more).  Values larger
+ * than needed will waste memory and processing time, but do not directly
+ * cost disk space.
+ *
+ * Changing this does not require an initdb, but it does require a full
+ * backend recompile (including any user-defined C functions).
+ */
+#define FUNC_MAX_ARGS		100
+
+/*
+ * Maximum number of columns in an index.  There is little point in making
+ * this anything but a multiple of 32, because the main cost is associated
+ * with index tuple header size (see access/itup.h).
+ *
+ * Changing this requires an initdb.
+ */
+#define INDEX_MAX_KEYS		32
+
+/*
+ * Set the upper and lower bounds of sequence values.
+ */
+#define SEQ_MAXVALUE	PG_INT64_MAX
+#define SEQ_MINVALUE	(-SEQ_MAXVALUE)
+
+/*
+ * Number of spare LWLocks to allocate for user-defined add-on code.
+ */
+#define NUM_USER_DEFINED_LWLOCKS	4
+
+/*
+ * When we don't have native spinlocks, we use semaphores to simulate them.
+ * Decreasing this value reduces consumption of OS resources; increasing it
+ * may improve performance, but supplying a real spinlock implementation is
+ * probably far better.
+ */
+#define NUM_SPINLOCK_SEMAPHORES		128
+
+/*
+ * When we have neither spinlocks nor atomic operations support we're
+ * implementing atomic operations on top of spinlock on top of semaphores. To
+ * be safe against atomic operations while holding a spinlock separate
+ * semaphores have to be used.
+ */
+#define NUM_ATOMICS_SEMAPHORES		64
+
+/*
+ * Define this if you want to allow the lo_import and lo_export SQL
+ * functions to be executed by ordinary users.  By default these
+ * functions are only available to the Postgres superuser.  CAUTION:
+ * These functions are SECURITY HOLES since they can read and write
+ * any file that the PostgreSQL server has permission to access.  If
+ * you turn this on, don't say we didn't warn you.
+ */
+/* #define ALLOW_DANGEROUS_LO_FUNCTIONS */
+
+/*
+ * MAXPGPATH: standard size of a pathname buffer in PostgreSQL (hence,
+ * maximum usable pathname length is one less).
+ *
+ * We'd use a standard system header symbol for this, if there weren't
+ * so many to choose from: MAXPATHLEN, MAX_PATH, PATH_MAX are all
+ * defined by different "standards", and often have different values
+ * on the same platform!  So we just punt and use a reasonably
+ * generous setting here.
+ */
+#define MAXPGPATH		1024
+
+/*
+ * PG_SOMAXCONN: maximum accept-queue length limit passed to
+ * listen(2).  You'd think we should use SOMAXCONN from
+ * <sys/socket.h>, but on many systems that symbol is much smaller
+ * than the kernel's actual limit.  In any case, this symbol need be
+ * twiddled only if you have a kernel that refuses large limit values,
+ * rather than silently reducing the value to what it can handle
+ * (which is what most if not all Unixen do).
+ */
+#define PG_SOMAXCONN	10000
+
+/*
+ * You can try changing this if you have a machine with bytes of
+ * another size, but no guarantee...
+ */
+#define BITS_PER_BYTE		8
+
+/*
+ * Preferred alignment for disk I/O buffers.  On some CPUs, copies between
+ * user space and kernel space are significantly faster if the user buffer
+ * is aligned on a larger-than-MAXALIGN boundary.  Ideally this should be
+ * a platform-dependent value, but for now we just hard-wire it.
+ */
+#define ALIGNOF_BUFFER	32
+
+/*
+ * Disable UNIX sockets for certain operating systems.
+ */
+#if defined(WIN32)
+#undef HAVE_UNIX_SOCKETS
+#endif
+
+/*
+ * Define this if your operating system supports link()
+ */
+#if !defined(WIN32) && !defined(__CYGWIN__)
+#define HAVE_WORKING_LINK 1
+#endif
+
+/*
+ * USE_POSIX_FADVISE controls whether Postgres will attempt to use the
+ * posix_fadvise() kernel call.  Usually the automatic configure tests are
+ * sufficient, but some older Linux distributions had broken versions of
+ * posix_fadvise().  If necessary you can remove the #define here.
+ */
+#if HAVE_DECL_POSIX_FADVISE && defined(HAVE_POSIX_FADVISE)
+#define USE_POSIX_FADVISE
+#endif
+
+/*
+ * USE_PREFETCH code should be compiled only if we have a way to implement
+ * prefetching.  (This is decoupled from USE_POSIX_FADVISE because there
+ * might in future be support for alternative low-level prefetch APIs.)
+ */
+#ifdef USE_POSIX_FADVISE
+#define USE_PREFETCH
+#endif
+
+/*
+ * USE_SSL code should be compiled only when compiling with an SSL
+ * implementation.  (Currently, only OpenSSL is supported, but we might add
+ * more implementations in the future.)
+ */
+#ifdef USE_OPENSSL
+#define USE_SSL
+#endif
+
+/*
+ * This is the default directory in which AF_UNIX socket files are
+ * placed.  Caution: changing this risks breaking your existing client
+ * applications, which are likely to continue to look in the old
+ * directory.  But if you just hate the idea of sockets in /tmp,
+ * here's where to twiddle it.  You can also override this at runtime
+ * with the postmaster's -k switch.
+ */
+#define DEFAULT_PGSOCKET_DIR  "/tmp"
+
+/*
+ * This is the default event source for Windows event log.
+ */
+#define DEFAULT_EVENT_SOURCE  "PostgreSQL"
+
+/*
+ * The random() function is expected to yield values between 0 and
+ * MAX_RANDOM_VALUE.  Currently, all known implementations yield
+ * 0..2^31-1, so we just hardwire this constant.  We could do a
+ * configure test if it proves to be necessary.  CAUTION: Think not to
+ * replace this with RAND_MAX.  RAND_MAX defines the maximum value of
+ * the older rand() function, which is often different from --- and
+ * considerably inferior to --- random().
+ */
+#define MAX_RANDOM_VALUE  PG_INT32_MAX
+
+/*
+ * On PPC machines, decide whether to use the mutex hint bit in LWARX
+ * instructions.  Setting the hint bit will slightly improve spinlock
+ * performance on POWER6 and later machines, but does nothing before that,
+ * and will result in illegal-instruction failures on some pre-POWER4
+ * machines.  By default we use the hint bit when building for 64-bit PPC,
+ * which should be safe in nearly all cases.  You might want to override
+ * this if you are building 32-bit code for a known-recent PPC machine.
+ */
+#ifdef HAVE_PPC_LWARX_MUTEX_HINT	/* must have assembler support in any case */
+#if defined(__ppc64__) || defined(__powerpc64__)
+#define USE_PPC_LWARX_MUTEX_HINT
+#endif
+#endif
+
+/*
+ * On PPC machines, decide whether to use LWSYNC instructions in place of
+ * ISYNC and SYNC.  This provides slightly better performance, but will
+ * result in illegal-instruction failures on some pre-POWER4 machines.
+ * By default we use LWSYNC when building for 64-bit PPC, which should be
+ * safe in nearly all cases.
+ */
+#if defined(__ppc64__) || defined(__powerpc64__)
+#define USE_PPC_LWSYNC
+#endif
+
+/*
+ * Assumed cache line size. This doesn't affect correctness, but can be used
+ * for low-level optimizations. Currently, this is used to pad some data
+ * structures in xlog.c, to ensure that highly-contended fields are on
+ * different cache lines. Too small a value can hurt performance due to false
+ * sharing, while the only downside of too large a value is a few bytes of
+ * wasted memory. The default is 128, which should be large enough for all
+ * supported platforms.
+ */
+#define PG_CACHE_LINE_SIZE		128
+
+/*
+ *------------------------------------------------------------------------
+ * The following symbols are for enabling debugging code, not for
+ * controlling user-visible features or resource limits.
+ *------------------------------------------------------------------------
+ */
+
+/*
+ * Include Valgrind "client requests", mostly in the memory allocator, so
+ * Valgrind understands PostgreSQL memory contexts.  This permits detecting
+ * memory errors that Valgrind would not detect on a vanilla build.  See also
+ * src/tools/valgrind.supp.  "make installcheck" runs 20-30x longer under
+ * Valgrind.  Note that USE_VALGRIND slowed older versions of Valgrind by an
+ * additional order of magnitude; Valgrind 3.8.1 does not have this problem.
+ * The client requests fall in hot code paths, so USE_VALGRIND also slows
+ * native execution by a few percentage points.
+ *
+ * You should normally use MEMORY_CONTEXT_CHECKING with USE_VALGRIND;
+ * instrumentation of repalloc() is inferior without it.
+ */
+/* #define USE_VALGRIND */
+
+/*
+ * Define this to cause pfree()'d memory to be cleared immediately, to
+ * facilitate catching bugs that refer to already-freed values.
+ * Right now, this gets defined automatically if --enable-cassert.
+ */
+#ifdef USE_ASSERT_CHECKING
+#define CLOBBER_FREED_MEMORY
+#endif
+
+/*
+ * Define this to check memory allocation errors (scribbling on more
+ * bytes than were allocated).  Right now, this gets defined
+ * automatically if --enable-cassert or USE_VALGRIND.
+ */
+#if defined(USE_ASSERT_CHECKING) || defined(USE_VALGRIND)
+#define MEMORY_CONTEXT_CHECKING
+#endif
+
+/*
+ * Define this to cause palloc()'d memory to be filled with random data, to
+ * facilitate catching code that depends on the contents of uninitialized
+ * memory.  Caution: this is horrendously expensive.
+ */
+/* #define RANDOMIZE_ALLOCATED_MEMORY */
+
+/*
+ * Define this to force all parse and plan trees to be passed through
+ * copyObject(), to facilitate catching errors and omissions in
+ * copyObject().
+ */
+/* #define COPY_PARSE_PLAN_TREES */
+
+/*
+ * Enable debugging print statements for lock-related operations.
+ */
+/* #define LOCK_DEBUG */
+
+/*
+ * Enable debugging print statements for WAL-related operations; see
+ * also the wal_debug GUC var.
+ */
+/* #define WAL_DEBUG */
+
+/*
+ * Enable tracing of resource consumption during sort operations;
+ * see also the trace_sort GUC var.  For 8.1 this is enabled by default.
+ */
+#define TRACE_SORT 1
+
+/*
+ * Enable tracing of syncscan operations (see also the trace_syncscan GUC var).
+ */
+/* #define TRACE_SYNCSCAN */
+
+/*
+ * Other debug #defines (documentation, anyone?)
+ */
+/* #define HEAPDEBUGALL */
+/* #define ACLDEBUG */
diff --git a/foreign/libpg_query/src/postgres/include/pg_config_os.h b/foreign/libpg_query/src/postgres/include/pg_config_os.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/pg_config_os.h
@@ -0,0 +1,8 @@
+/* src/include/port/darwin.h */
+
+#define __darwin__	1
+
+#if HAVE_DECL_F_FULLFSYNC		/* not present before OS X 10.3 */
+#define HAVE_FSYNC_WRITETHROUGH
+
+#endif
diff --git a/foreign/libpg_query/src/postgres/include/pg_getopt.h b/foreign/libpg_query/src/postgres/include/pg_getopt.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/pg_getopt.h
@@ -0,0 +1,46 @@
+/*
+ * Portions Copyright (c) 1987, 1993, 1994
+ * The Regents of the University of California.  All rights reserved.
+ *
+ * Portions Copyright (c) 2003-2015, PostgreSQL Global Development Group
+ *
+ * src/include/pg_getopt.h
+ */
+#ifndef PG_GETOPT_H
+#define PG_GETOPT_H
+
+/* POSIX says getopt() is provided by unistd.h */
+#include <unistd.h>
+
+/* rely on the system's getopt.h if present */
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+
+/*
+ * If we have <getopt.h>, assume it declares these variables, else do that
+ * ourselves.  (We used to just declare them unconditionally, but Cygwin
+ * doesn't like that.)
+ */
+#ifndef HAVE_GETOPT_H
+
+extern char *optarg;
+extern int	optind;
+extern int	opterr;
+extern int	optopt;
+
+#endif   /* HAVE_GETOPT_H */
+
+/*
+ * Some platforms have optreset but fail to declare it in <getopt.h>, so cope.
+ * Cygwin, however, doesn't like this either.
+ */
+#if defined(HAVE_INT_OPTRESET) && !defined(__CYGWIN__)
+extern int	optreset;
+#endif
+
+#ifndef HAVE_GETOPT
+extern int	getopt(int nargc, char *const * nargv, const char *ostr);
+#endif
+
+#endif   /* PG_GETOPT_H */
diff --git a/foreign/libpg_query/src/postgres/include/pg_trace.h b/foreign/libpg_query/src/postgres/include/pg_trace.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/pg_trace.h
@@ -0,0 +1,17 @@
+/* ----------
+ *	pg_trace.h
+ *
+ *	Definitions for the PostgreSQL tracing framework
+ *
+ *	Copyright (c) 2006-2015, PostgreSQL Global Development Group
+ *
+ *	src/include/pg_trace.h
+ * ----------
+ */
+
+#ifndef PG_TRACE_H
+#define PG_TRACE_H
+
+#include "utils/probes.h"		/* pgrminclude ignore */
+
+#endif   /* PG_TRACE_H */
diff --git a/foreign/libpg_query/src/postgres/include/pgstat.h b/foreign/libpg_query/src/postgres/include/pgstat.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/pgstat.h
@@ -0,0 +1,1025 @@
+/* ----------
+ *	pgstat.h
+ *
+ *	Definitions for the PostgreSQL statistics collector daemon.
+ *
+ *	Copyright (c) 2001-2015, PostgreSQL Global Development Group
+ *
+ *	src/include/pgstat.h
+ * ----------
+ */
+#ifndef PGSTAT_H
+#define PGSTAT_H
+
+#include "datatype/timestamp.h"
+#include "fmgr.h"
+#include "libpq/pqcomm.h"
+#include "portability/instr_time.h"
+#include "postmaster/pgarch.h"
+#include "storage/barrier.h"
+#include "utils/hsearch.h"
+#include "utils/relcache.h"
+
+
+/* ----------
+ * Paths for the statistics files (relative to installation's $PGDATA).
+ * ----------
+ */
+#define PGSTAT_STAT_PERMANENT_DIRECTORY		"pg_stat"
+#define PGSTAT_STAT_PERMANENT_FILENAME		"pg_stat/global.stat"
+#define PGSTAT_STAT_PERMANENT_TMPFILE		"pg_stat/global.tmp"
+
+/* Default directory to store temporary statistics data in */
+#define PG_STAT_TMP_DIR		"pg_stat_tmp"
+
+/* Values for track_functions GUC variable --- order is significant! */
+typedef enum TrackFunctionsLevel
+{
+	TRACK_FUNC_OFF,
+	TRACK_FUNC_PL,
+	TRACK_FUNC_ALL
+}	TrackFunctionsLevel;
+
+/* ----------
+ * The types of backend -> collector messages
+ * ----------
+ */
+typedef enum StatMsgType
+{
+	PGSTAT_MTYPE_DUMMY,
+	PGSTAT_MTYPE_INQUIRY,
+	PGSTAT_MTYPE_TABSTAT,
+	PGSTAT_MTYPE_TABPURGE,
+	PGSTAT_MTYPE_DROPDB,
+	PGSTAT_MTYPE_RESETCOUNTER,
+	PGSTAT_MTYPE_RESETSHAREDCOUNTER,
+	PGSTAT_MTYPE_RESETSINGLECOUNTER,
+	PGSTAT_MTYPE_AUTOVAC_START,
+	PGSTAT_MTYPE_VACUUM,
+	PGSTAT_MTYPE_ANALYZE,
+	PGSTAT_MTYPE_ARCHIVER,
+	PGSTAT_MTYPE_BGWRITER,
+	PGSTAT_MTYPE_FUNCSTAT,
+	PGSTAT_MTYPE_FUNCPURGE,
+	PGSTAT_MTYPE_RECOVERYCONFLICT,
+	PGSTAT_MTYPE_TEMPFILE,
+	PGSTAT_MTYPE_DEADLOCK
+} StatMsgType;
+
+/* ----------
+ * The data type used for counters.
+ * ----------
+ */
+typedef int64 PgStat_Counter;
+
+/* ----------
+ * PgStat_TableCounts			The actual per-table counts kept by a backend
+ *
+ * This struct should contain only actual event counters, because we memcmp
+ * it against zeroes to detect whether there are any counts to transmit.
+ * It is a component of PgStat_TableStatus (within-backend state) and
+ * PgStat_TableEntry (the transmitted message format).
+ *
+ * Note: for a table, tuples_returned is the number of tuples successfully
+ * fetched by heap_getnext, while tuples_fetched is the number of tuples
+ * successfully fetched by heap_fetch under the control of bitmap indexscans.
+ * For an index, tuples_returned is the number of index entries returned by
+ * the index AM, while tuples_fetched is the number of tuples successfully
+ * fetched by heap_fetch under the control of simple indexscans for this index.
+ *
+ * tuples_inserted/updated/deleted/hot_updated count attempted actions,
+ * regardless of whether the transaction committed.  delta_live_tuples,
+ * delta_dead_tuples, and changed_tuples are set depending on commit or abort.
+ * Note that delta_live_tuples and delta_dead_tuples can be negative!
+ * ----------
+ */
+typedef struct PgStat_TableCounts
+{
+	PgStat_Counter t_numscans;
+
+	PgStat_Counter t_tuples_returned;
+	PgStat_Counter t_tuples_fetched;
+
+	PgStat_Counter t_tuples_inserted;
+	PgStat_Counter t_tuples_updated;
+	PgStat_Counter t_tuples_deleted;
+	PgStat_Counter t_tuples_hot_updated;
+	bool		t_truncated;
+
+	PgStat_Counter t_delta_live_tuples;
+	PgStat_Counter t_delta_dead_tuples;
+	PgStat_Counter t_changed_tuples;
+
+	PgStat_Counter t_blocks_fetched;
+	PgStat_Counter t_blocks_hit;
+} PgStat_TableCounts;
+
+/* Possible targets for resetting cluster-wide shared values */
+typedef enum PgStat_Shared_Reset_Target
+{
+	RESET_ARCHIVER,
+	RESET_BGWRITER
+} PgStat_Shared_Reset_Target;
+
+/* Possible object types for resetting single counters */
+typedef enum PgStat_Single_Reset_Type
+{
+	RESET_TABLE,
+	RESET_FUNCTION
+} PgStat_Single_Reset_Type;
+
+/* ------------------------------------------------------------
+ * Structures kept in backend local memory while accumulating counts
+ * ------------------------------------------------------------
+ */
+
+
+/* ----------
+ * PgStat_TableStatus			Per-table status within a backend
+ *
+ * Many of the event counters are nontransactional, ie, we count events
+ * in committed and aborted transactions alike.  For these, we just count
+ * directly in the PgStat_TableStatus.  However, delta_live_tuples,
+ * delta_dead_tuples, and changed_tuples must be derived from event counts
+ * with awareness of whether the transaction or subtransaction committed or
+ * aborted.  Hence, we also keep a stack of per-(sub)transaction status
+ * records for every table modified in the current transaction.  At commit
+ * or abort, we propagate tuples_inserted/updated/deleted up to the
+ * parent subtransaction level, or out to the parent PgStat_TableStatus,
+ * as appropriate.
+ * ----------
+ */
+typedef struct PgStat_TableStatus
+{
+	Oid			t_id;			/* table's OID */
+	bool		t_shared;		/* is it a shared catalog? */
+	struct PgStat_TableXactStatus *trans;		/* lowest subxact's counts */
+	PgStat_TableCounts t_counts;	/* event counts to be sent */
+} PgStat_TableStatus;
+
+/* ----------
+ * PgStat_TableXactStatus		Per-table, per-subtransaction status
+ * ----------
+ */
+typedef struct PgStat_TableXactStatus
+{
+	PgStat_Counter tuples_inserted;		/* tuples inserted in (sub)xact */
+	PgStat_Counter tuples_updated;		/* tuples updated in (sub)xact */
+	PgStat_Counter tuples_deleted;		/* tuples deleted in (sub)xact */
+	bool		truncated;		/* relation truncated in this (sub)xact */
+	PgStat_Counter inserted_pre_trunc;	/* tuples inserted prior to truncate */
+	PgStat_Counter updated_pre_trunc;	/* tuples updated prior to truncate */
+	PgStat_Counter deleted_pre_trunc;	/* tuples deleted prior to truncate */
+	int			nest_level;		/* subtransaction nest level */
+	/* links to other structs for same relation: */
+	struct PgStat_TableXactStatus *upper;		/* next higher subxact if any */
+	PgStat_TableStatus *parent; /* per-table status */
+	/* structs of same subxact level are linked here: */
+	struct PgStat_TableXactStatus *next;		/* next of same subxact */
+} PgStat_TableXactStatus;
+
+
+/* ------------------------------------------------------------
+ * Message formats follow
+ * ------------------------------------------------------------
+ */
+
+
+/* ----------
+ * PgStat_MsgHdr				The common message header
+ * ----------
+ */
+typedef struct PgStat_MsgHdr
+{
+	StatMsgType m_type;
+	int			m_size;
+} PgStat_MsgHdr;
+
+/* ----------
+ * Space available in a message.  This will keep the UDP packets below 1K,
+ * which should fit unfragmented into the MTU of the loopback interface.
+ * (Larger values of PGSTAT_MAX_MSG_SIZE would work for that on most
+ * platforms, but we're being conservative here.)
+ * ----------
+ */
+#define PGSTAT_MAX_MSG_SIZE 1000
+#define PGSTAT_MSG_PAYLOAD	(PGSTAT_MAX_MSG_SIZE - sizeof(PgStat_MsgHdr))
+
+
+/* ----------
+ * PgStat_MsgDummy				A dummy message, ignored by the collector
+ * ----------
+ */
+typedef struct PgStat_MsgDummy
+{
+	PgStat_MsgHdr m_hdr;
+} PgStat_MsgDummy;
+
+
+/* ----------
+ * PgStat_MsgInquiry			Sent by a backend to ask the collector
+ *								to write the stats file.
+ * ----------
+ */
+
+typedef struct PgStat_MsgInquiry
+{
+	PgStat_MsgHdr m_hdr;
+	TimestampTz clock_time;		/* observed local clock time */
+	TimestampTz cutoff_time;	/* minimum acceptable file timestamp */
+	Oid			databaseid;		/* requested DB (InvalidOid => all DBs) */
+} PgStat_MsgInquiry;
+
+
+/* ----------
+ * PgStat_TableEntry			Per-table info in a MsgTabstat
+ * ----------
+ */
+typedef struct PgStat_TableEntry
+{
+	Oid			t_id;
+	PgStat_TableCounts t_counts;
+} PgStat_TableEntry;
+
+/* ----------
+ * PgStat_MsgTabstat			Sent by the backend to report table
+ *								and buffer access statistics.
+ * ----------
+ */
+#define PGSTAT_NUM_TABENTRIES  \
+	((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - 3 * sizeof(int) - 2 * sizeof(PgStat_Counter))	\
+	 / sizeof(PgStat_TableEntry))
+
+typedef struct PgStat_MsgTabstat
+{
+	PgStat_MsgHdr m_hdr;
+	Oid			m_databaseid;
+	int			m_nentries;
+	int			m_xact_commit;
+	int			m_xact_rollback;
+	PgStat_Counter m_block_read_time;	/* times in microseconds */
+	PgStat_Counter m_block_write_time;
+	PgStat_TableEntry m_entry[PGSTAT_NUM_TABENTRIES];
+} PgStat_MsgTabstat;
+
+
+/* ----------
+ * PgStat_MsgTabpurge			Sent by the backend to tell the collector
+ *								about dead tables.
+ * ----------
+ */
+#define PGSTAT_NUM_TABPURGE  \
+	((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int))  \
+	 / sizeof(Oid))
+
+typedef struct PgStat_MsgTabpurge
+{
+	PgStat_MsgHdr m_hdr;
+	Oid			m_databaseid;
+	int			m_nentries;
+	Oid			m_tableid[PGSTAT_NUM_TABPURGE];
+} PgStat_MsgTabpurge;
+
+
+/* ----------
+ * PgStat_MsgDropdb				Sent by the backend to tell the collector
+ *								about a dropped database
+ * ----------
+ */
+typedef struct PgStat_MsgDropdb
+{
+	PgStat_MsgHdr m_hdr;
+	Oid			m_databaseid;
+} PgStat_MsgDropdb;
+
+
+/* ----------
+ * PgStat_MsgResetcounter		Sent by the backend to tell the collector
+ *								to reset counters
+ * ----------
+ */
+typedef struct PgStat_MsgResetcounter
+{
+	PgStat_MsgHdr m_hdr;
+	Oid			m_databaseid;
+} PgStat_MsgResetcounter;
+
+/* ----------
+ * PgStat_MsgResetsharedcounter Sent by the backend to tell the collector
+ *								to reset a shared counter
+ * ----------
+ */
+typedef struct PgStat_MsgResetsharedcounter
+{
+	PgStat_MsgHdr m_hdr;
+	PgStat_Shared_Reset_Target m_resettarget;
+} PgStat_MsgResetsharedcounter;
+
+/* ----------
+ * PgStat_MsgResetsinglecounter Sent by the backend to tell the collector
+ *								to reset a single counter
+ * ----------
+ */
+typedef struct PgStat_MsgResetsinglecounter
+{
+	PgStat_MsgHdr m_hdr;
+	Oid			m_databaseid;
+	PgStat_Single_Reset_Type m_resettype;
+	Oid			m_objectid;
+} PgStat_MsgResetsinglecounter;
+
+/* ----------
+ * PgStat_MsgAutovacStart		Sent by the autovacuum daemon to signal
+ *								that a database is going to be processed
+ * ----------
+ */
+typedef struct PgStat_MsgAutovacStart
+{
+	PgStat_MsgHdr m_hdr;
+	Oid			m_databaseid;
+	TimestampTz m_start_time;
+} PgStat_MsgAutovacStart;
+
+
+/* ----------
+ * PgStat_MsgVacuum				Sent by the backend or autovacuum daemon
+ *								after VACUUM
+ * ----------
+ */
+typedef struct PgStat_MsgVacuum
+{
+	PgStat_MsgHdr m_hdr;
+	Oid			m_databaseid;
+	Oid			m_tableoid;
+	bool		m_autovacuum;
+	TimestampTz m_vacuumtime;
+	PgStat_Counter m_live_tuples;
+	PgStat_Counter m_dead_tuples;
+} PgStat_MsgVacuum;
+
+
+/* ----------
+ * PgStat_MsgAnalyze			Sent by the backend or autovacuum daemon
+ *								after ANALYZE
+ * ----------
+ */
+typedef struct PgStat_MsgAnalyze
+{
+	PgStat_MsgHdr m_hdr;
+	Oid			m_databaseid;
+	Oid			m_tableoid;
+	bool		m_autovacuum;
+	TimestampTz m_analyzetime;
+	PgStat_Counter m_live_tuples;
+	PgStat_Counter m_dead_tuples;
+} PgStat_MsgAnalyze;
+
+
+/* ----------
+ * PgStat_MsgArchiver			Sent by the archiver to update statistics.
+ * ----------
+ */
+typedef struct PgStat_MsgArchiver
+{
+	PgStat_MsgHdr m_hdr;
+	bool		m_failed;		/* Failed attempt */
+	char		m_xlog[MAX_XFN_CHARS + 1];
+	TimestampTz m_timestamp;
+} PgStat_MsgArchiver;
+
+/* ----------
+ * PgStat_MsgBgWriter			Sent by the bgwriter to update statistics.
+ * ----------
+ */
+typedef struct PgStat_MsgBgWriter
+{
+	PgStat_MsgHdr m_hdr;
+
+	PgStat_Counter m_timed_checkpoints;
+	PgStat_Counter m_requested_checkpoints;
+	PgStat_Counter m_buf_written_checkpoints;
+	PgStat_Counter m_buf_written_clean;
+	PgStat_Counter m_maxwritten_clean;
+	PgStat_Counter m_buf_written_backend;
+	PgStat_Counter m_buf_fsync_backend;
+	PgStat_Counter m_buf_alloc;
+	PgStat_Counter m_checkpoint_write_time;		/* times in milliseconds */
+	PgStat_Counter m_checkpoint_sync_time;
+} PgStat_MsgBgWriter;
+
+/* ----------
+ * PgStat_MsgRecoveryConflict	Sent by the backend upon recovery conflict
+ * ----------
+ */
+typedef struct PgStat_MsgRecoveryConflict
+{
+	PgStat_MsgHdr m_hdr;
+
+	Oid			m_databaseid;
+	int			m_reason;
+} PgStat_MsgRecoveryConflict;
+
+/* ----------
+ * PgStat_MsgTempFile	Sent by the backend upon creating a temp file
+ * ----------
+ */
+typedef struct PgStat_MsgTempFile
+{
+	PgStat_MsgHdr m_hdr;
+
+	Oid			m_databaseid;
+	size_t		m_filesize;
+} PgStat_MsgTempFile;
+
+/* ----------
+ * PgStat_FunctionCounts	The actual per-function counts kept by a backend
+ *
+ * This struct should contain only actual event counters, because we memcmp
+ * it against zeroes to detect whether there are any counts to transmit.
+ *
+ * Note that the time counters are in instr_time format here.  We convert to
+ * microseconds in PgStat_Counter format when transmitting to the collector.
+ * ----------
+ */
+typedef struct PgStat_FunctionCounts
+{
+	PgStat_Counter f_numcalls;
+	instr_time	f_total_time;
+	instr_time	f_self_time;
+} PgStat_FunctionCounts;
+
+/* ----------
+ * PgStat_BackendFunctionEntry	Entry in backend's per-function hash table
+ * ----------
+ */
+typedef struct PgStat_BackendFunctionEntry
+{
+	Oid			f_id;
+	PgStat_FunctionCounts f_counts;
+} PgStat_BackendFunctionEntry;
+
+/* ----------
+ * PgStat_FunctionEntry			Per-function info in a MsgFuncstat
+ * ----------
+ */
+typedef struct PgStat_FunctionEntry
+{
+	Oid			f_id;
+	PgStat_Counter f_numcalls;
+	PgStat_Counter f_total_time;	/* times in microseconds */
+	PgStat_Counter f_self_time;
+} PgStat_FunctionEntry;
+
+/* ----------
+ * PgStat_MsgFuncstat			Sent by the backend to report function
+ *								usage statistics.
+ * ----------
+ */
+#define PGSTAT_NUM_FUNCENTRIES	\
+	((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int))  \
+	 / sizeof(PgStat_FunctionEntry))
+
+typedef struct PgStat_MsgFuncstat
+{
+	PgStat_MsgHdr m_hdr;
+	Oid			m_databaseid;
+	int			m_nentries;
+	PgStat_FunctionEntry m_entry[PGSTAT_NUM_FUNCENTRIES];
+} PgStat_MsgFuncstat;
+
+/* ----------
+ * PgStat_MsgFuncpurge			Sent by the backend to tell the collector
+ *								about dead functions.
+ * ----------
+ */
+#define PGSTAT_NUM_FUNCPURGE  \
+	((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int))  \
+	 / sizeof(Oid))
+
+typedef struct PgStat_MsgFuncpurge
+{
+	PgStat_MsgHdr m_hdr;
+	Oid			m_databaseid;
+	int			m_nentries;
+	Oid			m_functionid[PGSTAT_NUM_FUNCPURGE];
+} PgStat_MsgFuncpurge;
+
+/* ----------
+ * PgStat_MsgDeadlock			Sent by the backend to tell the collector
+ *								about a deadlock that occurred.
+ * ----------
+ */
+typedef struct PgStat_MsgDeadlock
+{
+	PgStat_MsgHdr m_hdr;
+	Oid			m_databaseid;
+} PgStat_MsgDeadlock;
+
+
+/* ----------
+ * PgStat_Msg					Union over all possible messages.
+ * ----------
+ */
+typedef union PgStat_Msg
+{
+	PgStat_MsgHdr msg_hdr;
+	PgStat_MsgDummy msg_dummy;
+	PgStat_MsgInquiry msg_inquiry;
+	PgStat_MsgTabstat msg_tabstat;
+	PgStat_MsgTabpurge msg_tabpurge;
+	PgStat_MsgDropdb msg_dropdb;
+	PgStat_MsgResetcounter msg_resetcounter;
+	PgStat_MsgResetsharedcounter msg_resetsharedcounter;
+	PgStat_MsgResetsinglecounter msg_resetsinglecounter;
+	PgStat_MsgAutovacStart msg_autovacuum;
+	PgStat_MsgVacuum msg_vacuum;
+	PgStat_MsgAnalyze msg_analyze;
+	PgStat_MsgArchiver msg_archiver;
+	PgStat_MsgBgWriter msg_bgwriter;
+	PgStat_MsgFuncstat msg_funcstat;
+	PgStat_MsgFuncpurge msg_funcpurge;
+	PgStat_MsgRecoveryConflict msg_recoveryconflict;
+	PgStat_MsgDeadlock msg_deadlock;
+} PgStat_Msg;
+
+
+/* ------------------------------------------------------------
+ * Statistic collector data structures follow
+ *
+ * PGSTAT_FILE_FORMAT_ID should be changed whenever any of these
+ * data structures change.
+ * ------------------------------------------------------------
+ */
+
+#define PGSTAT_FILE_FORMAT_ID	0x01A5BC9D
+
+/* ----------
+ * PgStat_StatDBEntry			The collector's data per database
+ * ----------
+ */
+typedef struct PgStat_StatDBEntry
+{
+	Oid			databaseid;
+	PgStat_Counter n_xact_commit;
+	PgStat_Counter n_xact_rollback;
+	PgStat_Counter n_blocks_fetched;
+	PgStat_Counter n_blocks_hit;
+	PgStat_Counter n_tuples_returned;
+	PgStat_Counter n_tuples_fetched;
+	PgStat_Counter n_tuples_inserted;
+	PgStat_Counter n_tuples_updated;
+	PgStat_Counter n_tuples_deleted;
+	TimestampTz last_autovac_time;
+	PgStat_Counter n_conflict_tablespace;
+	PgStat_Counter n_conflict_lock;
+	PgStat_Counter n_conflict_snapshot;
+	PgStat_Counter n_conflict_bufferpin;
+	PgStat_Counter n_conflict_startup_deadlock;
+	PgStat_Counter n_temp_files;
+	PgStat_Counter n_temp_bytes;
+	PgStat_Counter n_deadlocks;
+	PgStat_Counter n_block_read_time;	/* times in microseconds */
+	PgStat_Counter n_block_write_time;
+
+	TimestampTz stat_reset_timestamp;
+	TimestampTz stats_timestamp;	/* time of db stats file update */
+
+	/*
+	 * tables and functions must be last in the struct, because we don't write
+	 * the pointers out to the stats file.
+	 */
+	HTAB	   *tables;
+	HTAB	   *functions;
+} PgStat_StatDBEntry;
+
+
+/* ----------
+ * PgStat_StatTabEntry			The collector's data per table (or index)
+ * ----------
+ */
+typedef struct PgStat_StatTabEntry
+{
+	Oid			tableid;
+
+	PgStat_Counter numscans;
+
+	PgStat_Counter tuples_returned;
+	PgStat_Counter tuples_fetched;
+
+	PgStat_Counter tuples_inserted;
+	PgStat_Counter tuples_updated;
+	PgStat_Counter tuples_deleted;
+	PgStat_Counter tuples_hot_updated;
+
+	PgStat_Counter n_live_tuples;
+	PgStat_Counter n_dead_tuples;
+	PgStat_Counter changes_since_analyze;
+
+	PgStat_Counter blocks_fetched;
+	PgStat_Counter blocks_hit;
+
+	TimestampTz vacuum_timestamp;		/* user initiated vacuum */
+	PgStat_Counter vacuum_count;
+	TimestampTz autovac_vacuum_timestamp;		/* autovacuum initiated */
+	PgStat_Counter autovac_vacuum_count;
+	TimestampTz analyze_timestamp;		/* user initiated */
+	PgStat_Counter analyze_count;
+	TimestampTz autovac_analyze_timestamp;		/* autovacuum initiated */
+	PgStat_Counter autovac_analyze_count;
+} PgStat_StatTabEntry;
+
+
+/* ----------
+ * PgStat_StatFuncEntry			The collector's data per function
+ * ----------
+ */
+typedef struct PgStat_StatFuncEntry
+{
+	Oid			functionid;
+
+	PgStat_Counter f_numcalls;
+
+	PgStat_Counter f_total_time;	/* times in microseconds */
+	PgStat_Counter f_self_time;
+} PgStat_StatFuncEntry;
+
+
+/*
+ * Archiver statistics kept in the stats collector
+ */
+typedef struct PgStat_ArchiverStats
+{
+	PgStat_Counter archived_count;		/* archival successes */
+	char		last_archived_wal[MAX_XFN_CHARS + 1];	/* last WAL file
+														 * archived */
+	TimestampTz last_archived_timestamp;		/* last archival success time */
+	PgStat_Counter failed_count;	/* failed archival attempts */
+	char		last_failed_wal[MAX_XFN_CHARS + 1];		/* WAL file involved in
+														 * last failure */
+	TimestampTz last_failed_timestamp;	/* last archival failure time */
+	TimestampTz stat_reset_timestamp;
+} PgStat_ArchiverStats;
+
+/*
+ * Global statistics kept in the stats collector
+ */
+typedef struct PgStat_GlobalStats
+{
+	TimestampTz stats_timestamp;	/* time of stats file update */
+	PgStat_Counter timed_checkpoints;
+	PgStat_Counter requested_checkpoints;
+	PgStat_Counter checkpoint_write_time;		/* times in milliseconds */
+	PgStat_Counter checkpoint_sync_time;
+	PgStat_Counter buf_written_checkpoints;
+	PgStat_Counter buf_written_clean;
+	PgStat_Counter maxwritten_clean;
+	PgStat_Counter buf_written_backend;
+	PgStat_Counter buf_fsync_backend;
+	PgStat_Counter buf_alloc;
+	TimestampTz stat_reset_timestamp;
+} PgStat_GlobalStats;
+
+
+/* ----------
+ * Backend states
+ * ----------
+ */
+typedef enum BackendState
+{
+	STATE_UNDEFINED,
+	STATE_IDLE,
+	STATE_RUNNING,
+	STATE_IDLEINTRANSACTION,
+	STATE_FASTPATH,
+	STATE_IDLEINTRANSACTION_ABORTED,
+	STATE_DISABLED
+} BackendState;
+
+/* ----------
+ * Shared-memory data structures
+ * ----------
+ */
+
+
+/*
+ * PgBackendSSLStatus
+ *
+ * For each backend, we keep the SSL status in a separate struct, that
+ * is only filled in if SSL is enabled.
+ */
+typedef struct PgBackendSSLStatus
+{
+	/* Information about SSL connection */
+	int			ssl_bits;
+	bool		ssl_compression;
+	char		ssl_version[NAMEDATALEN];		/* MUST be null-terminated */
+	char		ssl_cipher[NAMEDATALEN];		/* MUST be null-terminated */
+	char		ssl_clientdn[NAMEDATALEN];		/* MUST be null-terminated */
+} PgBackendSSLStatus;
+
+
+/* ----------
+ * PgBackendStatus
+ *
+ * Each live backend maintains a PgBackendStatus struct in shared memory
+ * showing its current activity.  (The structs are allocated according to
+ * BackendId, but that is not critical.)  Note that the collector process
+ * has no involvement in, or even access to, these structs.
+ * ----------
+ */
+typedef struct PgBackendStatus
+{
+	/*
+	 * To avoid locking overhead, we use the following protocol: a backend
+	 * increments st_changecount before modifying its entry, and again after
+	 * finishing a modification.  A would-be reader should note the value of
+	 * st_changecount, copy the entry into private memory, then check
+	 * st_changecount again.  If the value hasn't changed, and if it's even,
+	 * the copy is valid; otherwise start over.  This makes updates cheap
+	 * while reads are potentially expensive, but that's the tradeoff we want.
+	 *
+	 * The above protocol needs the memory barriers to ensure that the
+	 * apparent order of execution is as it desires. Otherwise, for example,
+	 * the CPU might rearrange the code so that st_changecount is incremented
+	 * twice before the modification on a machine with weak memory ordering.
+	 * This surprising result can lead to bugs.
+	 */
+	int			st_changecount;
+
+	/* The entry is valid iff st_procpid > 0, unused if st_procpid == 0 */
+	int			st_procpid;
+
+	/* Times when current backend, transaction, and activity started */
+	TimestampTz st_proc_start_timestamp;
+	TimestampTz st_xact_start_timestamp;
+	TimestampTz st_activity_start_timestamp;
+	TimestampTz st_state_start_timestamp;
+
+	/* Database OID, owning user's OID, connection client address */
+	Oid			st_databaseid;
+	Oid			st_userid;
+	SockAddr	st_clientaddr;
+	char	   *st_clienthostname;		/* MUST be null-terminated */
+
+	/* Information about SSL connection */
+	bool		st_ssl;
+	PgBackendSSLStatus *st_sslstatus;
+
+	/* Is backend currently waiting on an lmgr lock? */
+	bool		st_waiting;
+
+	/* current state */
+	BackendState st_state;
+
+	/* application name; MUST be null-terminated */
+	char	   *st_appname;
+
+	/* current command string; MUST be null-terminated */
+	char	   *st_activity;
+} PgBackendStatus;
+
+/*
+ * Macros to load and store st_changecount with the memory barriers.
+ *
+ * pgstat_increment_changecount_before() and
+ * pgstat_increment_changecount_after() need to be called before and after
+ * PgBackendStatus entries are modified, respectively. This makes sure that
+ * st_changecount is incremented around the modification.
+ *
+ * Also pgstat_save_changecount_before() and pgstat_save_changecount_after()
+ * need to be called before and after PgBackendStatus entries are copied into
+ * private memory, respectively.
+ */
+#define pgstat_increment_changecount_before(beentry)	\
+	do {	\
+		beentry->st_changecount++;	\
+		pg_write_barrier(); \
+	} while (0)
+
+#define pgstat_increment_changecount_after(beentry) \
+	do {	\
+		pg_write_barrier(); \
+		beentry->st_changecount++;	\
+		Assert((beentry->st_changecount & 1) == 0); \
+	} while (0)
+
+#define pgstat_save_changecount_before(beentry, save_changecount)	\
+	do {	\
+		save_changecount = beentry->st_changecount; \
+		pg_read_barrier();	\
+	} while (0)
+
+#define pgstat_save_changecount_after(beentry, save_changecount)	\
+	do {	\
+		pg_read_barrier();	\
+		save_changecount = beentry->st_changecount; \
+	} while (0)
+
+/* ----------
+ * LocalPgBackendStatus
+ *
+ * When we build the backend status array, we use LocalPgBackendStatus to be
+ * able to add new values to the struct when needed without adding new fields
+ * to the shared memory. It contains the backend status as a first member.
+ * ----------
+ */
+typedef struct LocalPgBackendStatus
+{
+	/*
+	 * Local version of the backend status entry.
+	 */
+	PgBackendStatus backendStatus;
+
+	/*
+	 * The xid of the current transaction if available, InvalidTransactionId
+	 * if not.
+	 */
+	TransactionId backend_xid;
+
+	/*
+	 * The xmin of the current session if available, InvalidTransactionId if
+	 * not.
+	 */
+	TransactionId backend_xmin;
+} LocalPgBackendStatus;
+
+/*
+ * Working state needed to accumulate per-function-call timing statistics.
+ */
+typedef struct PgStat_FunctionCallUsage
+{
+	/* Link to function's hashtable entry (must still be there at exit!) */
+	/* NULL means we are not tracking the current function call */
+	PgStat_FunctionCounts *fs;
+	/* Total time previously charged to function, as of function start */
+	instr_time	save_f_total_time;
+	/* Backend-wide total time as of function start */
+	instr_time	save_total;
+	/* system clock as of function start */
+	instr_time	f_start;
+} PgStat_FunctionCallUsage;
+
+
+/* ----------
+ * GUC parameters
+ * ----------
+ */
+extern bool pgstat_track_activities;
+extern bool pgstat_track_counts;
+extern int	pgstat_track_functions;
+extern PGDLLIMPORT int pgstat_track_activity_query_size;
+extern char *pgstat_stat_directory;
+extern char *pgstat_stat_tmpname;
+extern char *pgstat_stat_filename;
+
+/*
+ * BgWriter statistics counters are updated directly by bgwriter and bufmgr
+ */
+extern PgStat_MsgBgWriter BgWriterStats;
+
+/*
+ * Updated by pgstat_count_buffer_*_time macros
+ */
+extern PgStat_Counter pgStatBlockReadTime;
+extern PgStat_Counter pgStatBlockWriteTime;
+
+/* ----------
+ * Functions called from postmaster
+ * ----------
+ */
+extern Size BackendStatusShmemSize(void);
+extern void CreateSharedBackendStatus(void);
+
+extern void pgstat_init(void);
+extern int	pgstat_start(void);
+extern void pgstat_reset_all(void);
+extern void allow_immediate_pgstat_restart(void);
+
+#ifdef EXEC_BACKEND
+extern void PgstatCollectorMain(int argc, char *argv[]) pg_attribute_noreturn();
+#endif
+
+
+/* ----------
+ * Functions called from backends
+ * ----------
+ */
+extern void pgstat_ping(void);
+
+extern void pgstat_report_stat(bool force);
+extern void pgstat_vacuum_stat(void);
+extern void pgstat_drop_database(Oid databaseid);
+
+extern void pgstat_clear_snapshot(void);
+extern void pgstat_reset_counters(void);
+extern void pgstat_reset_shared_counters(const char *);
+extern void pgstat_reset_single_counter(Oid objectid, PgStat_Single_Reset_Type type);
+
+extern void pgstat_report_autovac(Oid dboid);
+extern void pgstat_report_vacuum(Oid tableoid, bool shared,
+					 PgStat_Counter livetuples, PgStat_Counter deadtuples);
+extern void pgstat_report_analyze(Relation rel,
+					  PgStat_Counter livetuples, PgStat_Counter deadtuples);
+
+extern void pgstat_report_recovery_conflict(int reason);
+extern void pgstat_report_deadlock(void);
+
+extern void pgstat_initialize(void);
+extern void pgstat_bestart(void);
+
+extern void pgstat_report_activity(BackendState state, const char *cmd_str);
+extern void pgstat_report_tempfile(size_t filesize);
+extern void pgstat_report_appname(const char *appname);
+extern void pgstat_report_xact_timestamp(TimestampTz tstamp);
+extern void pgstat_report_waiting(bool waiting);
+extern const char *pgstat_get_backend_current_activity(int pid, bool checkUser);
+extern const char *pgstat_get_crashed_backend_activity(int pid, char *buffer,
+									int buflen);
+
+extern PgStat_TableStatus *find_tabstat_entry(Oid rel_id);
+extern PgStat_BackendFunctionEntry *find_funcstat_entry(Oid func_id);
+
+extern void pgstat_initstats(Relation rel);
+
+/* nontransactional event counts are simple enough to inline */
+
+#define pgstat_count_heap_scan(rel)									\
+	do {															\
+		if ((rel)->pgstat_info != NULL)								\
+			(rel)->pgstat_info->t_counts.t_numscans++;				\
+	} while (0)
+#define pgstat_count_heap_getnext(rel)								\
+	do {															\
+		if ((rel)->pgstat_info != NULL)								\
+			(rel)->pgstat_info->t_counts.t_tuples_returned++;		\
+	} while (0)
+#define pgstat_count_heap_fetch(rel)								\
+	do {															\
+		if ((rel)->pgstat_info != NULL)								\
+			(rel)->pgstat_info->t_counts.t_tuples_fetched++;		\
+	} while (0)
+#define pgstat_count_index_scan(rel)								\
+	do {															\
+		if ((rel)->pgstat_info != NULL)								\
+			(rel)->pgstat_info->t_counts.t_numscans++;				\
+	} while (0)
+#define pgstat_count_index_tuples(rel, n)							\
+	do {															\
+		if ((rel)->pgstat_info != NULL)								\
+			(rel)->pgstat_info->t_counts.t_tuples_returned += (n);	\
+	} while (0)
+#define pgstat_count_buffer_read(rel)								\
+	do {															\
+		if ((rel)->pgstat_info != NULL)								\
+			(rel)->pgstat_info->t_counts.t_blocks_fetched++;		\
+	} while (0)
+#define pgstat_count_buffer_hit(rel)								\
+	do {															\
+		if ((rel)->pgstat_info != NULL)								\
+			(rel)->pgstat_info->t_counts.t_blocks_hit++;			\
+	} while (0)
+#define pgstat_count_buffer_read_time(n)							\
+	(pgStatBlockReadTime += (n))
+#define pgstat_count_buffer_write_time(n)							\
+	(pgStatBlockWriteTime += (n))
+
+extern void pgstat_count_heap_insert(Relation rel, int n);
+extern void pgstat_count_heap_update(Relation rel, bool hot);
+extern void pgstat_count_heap_delete(Relation rel);
+extern void pgstat_count_truncate(Relation rel);
+extern void pgstat_update_heap_dead_tuples(Relation rel, int delta);
+
+extern void pgstat_init_function_usage(FunctionCallInfoData *fcinfo,
+						   PgStat_FunctionCallUsage *fcu);
+extern void pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu,
+						  bool finalize);
+
+extern void AtEOXact_PgStat(bool isCommit);
+extern void AtEOSubXact_PgStat(bool isCommit, int nestDepth);
+
+extern void AtPrepare_PgStat(void);
+extern void PostPrepare_PgStat(void);
+
+extern void pgstat_twophase_postcommit(TransactionId xid, uint16 info,
+						   void *recdata, uint32 len);
+extern void pgstat_twophase_postabort(TransactionId xid, uint16 info,
+						  void *recdata, uint32 len);
+
+extern void pgstat_send_archiver(const char *xlog, bool failed);
+extern void pgstat_send_bgwriter(void);
+
+/* ----------
+ * Support functions for the SQL-callable functions to
+ * generate the pgstat* views.
+ * ----------
+ */
+extern PgStat_StatDBEntry *pgstat_fetch_stat_dbentry(Oid dbid);
+extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry(Oid relid);
+extern PgBackendStatus *pgstat_fetch_stat_beentry(int beid);
+extern LocalPgBackendStatus *pgstat_fetch_stat_local_beentry(int beid);
+extern PgStat_StatFuncEntry *pgstat_fetch_stat_funcentry(Oid funcid);
+extern int	pgstat_fetch_stat_numbackends(void);
+extern PgStat_ArchiverStats *pgstat_fetch_stat_archiver(void);
+extern PgStat_GlobalStats *pgstat_fetch_global(void);
+
+#endif   /* PGSTAT_H */
diff --git a/foreign/libpg_query/src/postgres/include/pgtime.h b/foreign/libpg_query/src/postgres/include/pgtime.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/pgtime.h
@@ -0,0 +1,84 @@
+/*-------------------------------------------------------------------------
+ *
+ * pgtime.h
+ *	  PostgreSQL internal timezone library
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ *
+ * IDENTIFICATION
+ *	  src/include/pgtime.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef _PGTIME_H
+#define _PGTIME_H
+
+
+/*
+ * The API of this library is generally similar to the corresponding
+ * C library functions, except that we use pg_time_t which (we hope) is
+ * 64 bits wide, and which is most definitely signed not unsigned.
+ */
+
+typedef int64 pg_time_t;
+
+struct pg_tm
+{
+	int			tm_sec;
+	int			tm_min;
+	int			tm_hour;
+	int			tm_mday;
+	int			tm_mon;			/* origin 0, not 1 */
+	int			tm_year;		/* relative to 1900 */
+	int			tm_wday;
+	int			tm_yday;
+	int			tm_isdst;
+	long int	tm_gmtoff;
+	const char *tm_zone;
+};
+
+typedef struct pg_tz pg_tz;
+typedef struct pg_tzenum pg_tzenum;
+
+/* Maximum length of a timezone name (not including trailing null) */
+#define TZ_STRLEN_MAX 255
+
+/* these functions are in localtime.c */
+
+extern struct pg_tm *pg_localtime(const pg_time_t *timep, const pg_tz *tz);
+extern struct pg_tm *pg_gmtime(const pg_time_t *timep);
+extern int pg_next_dst_boundary(const pg_time_t *timep,
+					 long int *before_gmtoff,
+					 int *before_isdst,
+					 pg_time_t *boundary,
+					 long int *after_gmtoff,
+					 int *after_isdst,
+					 const pg_tz *tz);
+extern bool pg_interpret_timezone_abbrev(const char *abbrev,
+							 const pg_time_t *timep,
+							 long int *gmtoff,
+							 int *isdst,
+							 const pg_tz *tz);
+extern bool pg_get_timezone_offset(const pg_tz *tz, long int *gmtoff);
+extern const char *pg_get_timezone_name(pg_tz *tz);
+extern bool pg_tz_acceptable(pg_tz *tz);
+
+/* these functions are in strftime.c */
+
+extern size_t pg_strftime(char *s, size_t max, const char *format,
+			const struct pg_tm * tm);
+
+/* these functions and variables are in pgtz.c */
+
+extern pg_tz *session_timezone;
+extern pg_tz *log_timezone;
+
+extern void pg_timezone_initialize(void);
+extern pg_tz *pg_tzset(const char *tzname);
+extern pg_tz *pg_tzset_offset(long gmtoffset);
+
+extern pg_tzenum *pg_tzenumerate_start(void);
+extern pg_tz *pg_tzenumerate_next(pg_tzenum *dir);
+extern void pg_tzenumerate_end(pg_tzenum *dir);
+
+#endif   /* _PGTIME_H */
diff --git a/foreign/libpg_query/src/postgres/include/pl_gram.h b/foreign/libpg_query/src/postgres/include/pl_gram.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/pl_gram.h
@@ -0,0 +1,251 @@
+/* A Bison parser, made by GNU Bison 3.0.2.  */
+
+/* Bison interface for Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+#ifndef YY_PLPGSQL_YY_PL_GRAM_H_INCLUDED
+# define YY_PLPGSQL_YY_PL_GRAM_H_INCLUDED
+/* Debug traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int plpgsql_yydebug;
+#endif
+
+/* Token type.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+  enum yytokentype
+  {
+    IDENT = 258,
+    FCONST = 259,
+    SCONST = 260,
+    BCONST = 261,
+    XCONST = 262,
+    Op = 263,
+    ICONST = 264,
+    PARAM = 265,
+    TYPECAST = 266,
+    DOT_DOT = 267,
+    COLON_EQUALS = 268,
+    EQUALS_GREATER = 269,
+    LESS_EQUALS = 270,
+    GREATER_EQUALS = 271,
+    NOT_EQUALS = 272,
+    T_WORD = 273,
+    T_CWORD = 274,
+    T_DATUM = 275,
+    LESS_LESS = 276,
+    GREATER_GREATER = 277,
+    K_ABSOLUTE = 278,
+    K_ALIAS = 279,
+    K_ALL = 280,
+    K_ARRAY = 281,
+    K_ASSERT = 282,
+    K_BACKWARD = 283,
+    K_BEGIN = 284,
+    K_BY = 285,
+    K_CASE = 286,
+    K_CLOSE = 287,
+    K_COLLATE = 288,
+    K_COLUMN = 289,
+    K_COLUMN_NAME = 290,
+    K_CONSTANT = 291,
+    K_CONSTRAINT = 292,
+    K_CONSTRAINT_NAME = 293,
+    K_CONTINUE = 294,
+    K_CURRENT = 295,
+    K_CURSOR = 296,
+    K_DATATYPE = 297,
+    K_DEBUG = 298,
+    K_DECLARE = 299,
+    K_DEFAULT = 300,
+    K_DETAIL = 301,
+    K_DIAGNOSTICS = 302,
+    K_DUMP = 303,
+    K_ELSE = 304,
+    K_ELSIF = 305,
+    K_END = 306,
+    K_ERRCODE = 307,
+    K_ERROR = 308,
+    K_EXCEPTION = 309,
+    K_EXECUTE = 310,
+    K_EXIT = 311,
+    K_FETCH = 312,
+    K_FIRST = 313,
+    K_FOR = 314,
+    K_FOREACH = 315,
+    K_FORWARD = 316,
+    K_FROM = 317,
+    K_GET = 318,
+    K_HINT = 319,
+    K_IF = 320,
+    K_IN = 321,
+    K_INFO = 322,
+    K_INSERT = 323,
+    K_INTO = 324,
+    K_IS = 325,
+    K_LAST = 326,
+    K_LOG = 327,
+    K_LOOP = 328,
+    K_MESSAGE = 329,
+    K_MESSAGE_TEXT = 330,
+    K_MOVE = 331,
+    K_NEXT = 332,
+    K_NO = 333,
+    K_NOT = 334,
+    K_NOTICE = 335,
+    K_NULL = 336,
+    K_OPEN = 337,
+    K_OPTION = 338,
+    K_OR = 339,
+    K_PERFORM = 340,
+    K_PG_CONTEXT = 341,
+    K_PG_DATATYPE_NAME = 342,
+    K_PG_EXCEPTION_CONTEXT = 343,
+    K_PG_EXCEPTION_DETAIL = 344,
+    K_PG_EXCEPTION_HINT = 345,
+    K_PRINT_STRICT_PARAMS = 346,
+    K_PRIOR = 347,
+    K_QUERY = 348,
+    K_RAISE = 349,
+    K_RELATIVE = 350,
+    K_RESULT_OID = 351,
+    K_RETURN = 352,
+    K_RETURNED_SQLSTATE = 353,
+    K_REVERSE = 354,
+    K_ROW_COUNT = 355,
+    K_ROWTYPE = 356,
+    K_SCHEMA = 357,
+    K_SCHEMA_NAME = 358,
+    K_SCROLL = 359,
+    K_SLICE = 360,
+    K_SQLSTATE = 361,
+    K_STACKED = 362,
+    K_STRICT = 363,
+    K_TABLE = 364,
+    K_TABLE_NAME = 365,
+    K_THEN = 366,
+    K_TO = 367,
+    K_TYPE = 368,
+    K_USE_COLUMN = 369,
+    K_USE_VARIABLE = 370,
+    K_USING = 371,
+    K_VARIABLE_CONFLICT = 372,
+    K_WARNING = 373,
+    K_WHEN = 374,
+    K_WHILE = 375
+  };
+#endif
+
+/* Value type.  */
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE YYSTYPE;
+union YYSTYPE
+{
+#line 117 "pl_gram.y" /* yacc.c:1909  */
+
+		core_YYSTYPE			core_yystype;
+		/* these fields must match core_YYSTYPE: */
+		int						ival;
+		char					*str;
+		const char				*keyword;
+
+		PLword					word;
+		PLcword					cword;
+		PLwdatum				wdatum;
+		bool					boolean;
+		Oid						oid;
+		struct
+		{
+			char *name;
+			int  lineno;
+		}						varname;
+		struct
+		{
+			char *name;
+			int  lineno;
+			PLpgSQL_datum   *scalar;
+			PLpgSQL_rec		*rec;
+			PLpgSQL_row		*row;
+		}						forvariable;
+		struct
+		{
+			char *label;
+			int  n_initvars;
+			int  *initvarnos;
+		}						declhdr;
+		struct
+		{
+			List *stmts;
+			char *end_label;
+			int   end_label_location;
+		}						loop_body;
+		List					*list;
+		PLpgSQL_type			*dtype;
+		PLpgSQL_datum			*datum;
+		PLpgSQL_var				*var;
+		PLpgSQL_expr			*expr;
+		PLpgSQL_stmt			*stmt;
+		PLpgSQL_condition		*condition;
+		PLpgSQL_exception		*exception;
+		PLpgSQL_exception_block	*exception_block;
+		PLpgSQL_nsitem			*nsitem;
+		PLpgSQL_diag_item		*diagitem;
+		PLpgSQL_stmt_fetch		*fetch;
+		PLpgSQL_case_when		*casewhen;
+
+#line 227 "pl_gram.h" /* yacc.c:1909  */
+};
+# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* Location type.  */
+#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
+typedef struct YYLTYPE YYLTYPE;
+struct YYLTYPE
+{
+  int first_line;
+  int first_column;
+  int last_line;
+  int last_column;
+};
+# define YYLTYPE_IS_DECLARED 1
+# define YYLTYPE_IS_TRIVIAL 1
+#endif
+
+
+extern __thread  YYSTYPE plpgsql_yylval;
+extern __thread  YYLTYPE plpgsql_yylloc;
+int plpgsql_yyparse (void);
+
+#endif /* !YY_PLPGSQL_YY_PL_GRAM_H_INCLUDED  */
diff --git a/foreign/libpg_query/src/postgres/include/plerrcodes.h b/foreign/libpg_query/src/postgres/include/plerrcodes.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/plerrcodes.h
@@ -0,0 +1,902 @@
+/* autogenerated from src/backend/utils/errcodes.txt, do not edit */
+/* there is deliberately not an #ifndef PLERRCODES_H here */
+{
+	"sql_statement_not_yet_complete", ERRCODE_SQL_STATEMENT_NOT_YET_COMPLETE
+},
+
+{
+	"connection_exception", ERRCODE_CONNECTION_EXCEPTION
+},
+
+{
+	"connection_does_not_exist", ERRCODE_CONNECTION_DOES_NOT_EXIST
+},
+
+{
+	"connection_failure", ERRCODE_CONNECTION_FAILURE
+},
+
+{
+	"sqlclient_unable_to_establish_sqlconnection", ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION
+},
+
+{
+	"sqlserver_rejected_establishment_of_sqlconnection", ERRCODE_SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION
+},
+
+{
+	"transaction_resolution_unknown", ERRCODE_TRANSACTION_RESOLUTION_UNKNOWN
+},
+
+{
+	"protocol_violation", ERRCODE_PROTOCOL_VIOLATION
+},
+
+{
+	"triggered_action_exception", ERRCODE_TRIGGERED_ACTION_EXCEPTION
+},
+
+{
+	"feature_not_supported", ERRCODE_FEATURE_NOT_SUPPORTED
+},
+
+{
+	"invalid_transaction_initiation", ERRCODE_INVALID_TRANSACTION_INITIATION
+},
+
+{
+	"locator_exception", ERRCODE_LOCATOR_EXCEPTION
+},
+
+{
+	"invalid_locator_specification", ERRCODE_L_E_INVALID_SPECIFICATION
+},
+
+{
+	"invalid_grantor", ERRCODE_INVALID_GRANTOR
+},
+
+{
+	"invalid_grant_operation", ERRCODE_INVALID_GRANT_OPERATION
+},
+
+{
+	"invalid_role_specification", ERRCODE_INVALID_ROLE_SPECIFICATION
+},
+
+{
+	"diagnostics_exception", ERRCODE_DIAGNOSTICS_EXCEPTION
+},
+
+{
+	"stacked_diagnostics_accessed_without_active_handler", ERRCODE_STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER
+},
+
+{
+	"case_not_found", ERRCODE_CASE_NOT_FOUND
+},
+
+{
+	"cardinality_violation", ERRCODE_CARDINALITY_VIOLATION
+},
+
+{
+	"data_exception", ERRCODE_DATA_EXCEPTION
+},
+
+{
+	"array_subscript_error", ERRCODE_ARRAY_SUBSCRIPT_ERROR
+},
+
+{
+	"character_not_in_repertoire", ERRCODE_CHARACTER_NOT_IN_REPERTOIRE
+},
+
+{
+	"datetime_field_overflow", ERRCODE_DATETIME_FIELD_OVERFLOW
+},
+
+{
+	"division_by_zero", ERRCODE_DIVISION_BY_ZERO
+},
+
+{
+	"error_in_assignment", ERRCODE_ERROR_IN_ASSIGNMENT
+},
+
+{
+	"escape_character_conflict", ERRCODE_ESCAPE_CHARACTER_CONFLICT
+},
+
+{
+	"indicator_overflow", ERRCODE_INDICATOR_OVERFLOW
+},
+
+{
+	"interval_field_overflow", ERRCODE_INTERVAL_FIELD_OVERFLOW
+},
+
+{
+	"invalid_argument_for_logarithm", ERRCODE_INVALID_ARGUMENT_FOR_LOG
+},
+
+{
+	"invalid_argument_for_ntile_function", ERRCODE_INVALID_ARGUMENT_FOR_NTILE
+},
+
+{
+	"invalid_argument_for_nth_value_function", ERRCODE_INVALID_ARGUMENT_FOR_NTH_VALUE
+},
+
+{
+	"invalid_argument_for_power_function", ERRCODE_INVALID_ARGUMENT_FOR_POWER_FUNCTION
+},
+
+{
+	"invalid_argument_for_width_bucket_function", ERRCODE_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION
+},
+
+{
+	"invalid_character_value_for_cast", ERRCODE_INVALID_CHARACTER_VALUE_FOR_CAST
+},
+
+{
+	"invalid_datetime_format", ERRCODE_INVALID_DATETIME_FORMAT
+},
+
+{
+	"invalid_escape_character", ERRCODE_INVALID_ESCAPE_CHARACTER
+},
+
+{
+	"invalid_escape_octet", ERRCODE_INVALID_ESCAPE_OCTET
+},
+
+{
+	"invalid_escape_sequence", ERRCODE_INVALID_ESCAPE_SEQUENCE
+},
+
+{
+	"nonstandard_use_of_escape_character", ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER
+},
+
+{
+	"invalid_indicator_parameter_value", ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE
+},
+
+{
+	"invalid_parameter_value", ERRCODE_INVALID_PARAMETER_VALUE
+},
+
+{
+	"invalid_regular_expression", ERRCODE_INVALID_REGULAR_EXPRESSION
+},
+
+{
+	"invalid_row_count_in_limit_clause", ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE
+},
+
+{
+	"invalid_row_count_in_result_offset_clause", ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE
+},
+
+{
+	"invalid_tablesample_argument", ERRCODE_INVALID_TABLESAMPLE_ARGUMENT
+},
+
+{
+	"invalid_tablesample_repeat", ERRCODE_INVALID_TABLESAMPLE_REPEAT
+},
+
+{
+	"invalid_time_zone_displacement_value", ERRCODE_INVALID_TIME_ZONE_DISPLACEMENT_VALUE
+},
+
+{
+	"invalid_use_of_escape_character", ERRCODE_INVALID_USE_OF_ESCAPE_CHARACTER
+},
+
+{
+	"most_specific_type_mismatch", ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH
+},
+
+{
+	"null_value_not_allowed", ERRCODE_NULL_VALUE_NOT_ALLOWED
+},
+
+{
+	"null_value_no_indicator_parameter", ERRCODE_NULL_VALUE_NO_INDICATOR_PARAMETER
+},
+
+{
+	"numeric_value_out_of_range", ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE
+},
+
+{
+	"string_data_length_mismatch", ERRCODE_STRING_DATA_LENGTH_MISMATCH
+},
+
+{
+	"string_data_right_truncation", ERRCODE_STRING_DATA_RIGHT_TRUNCATION
+},
+
+{
+	"substring_error", ERRCODE_SUBSTRING_ERROR
+},
+
+{
+	"trim_error", ERRCODE_TRIM_ERROR
+},
+
+{
+	"unterminated_c_string", ERRCODE_UNTERMINATED_C_STRING
+},
+
+{
+	"zero_length_character_string", ERRCODE_ZERO_LENGTH_CHARACTER_STRING
+},
+
+{
+	"floating_point_exception", ERRCODE_FLOATING_POINT_EXCEPTION
+},
+
+{
+	"invalid_text_representation", ERRCODE_INVALID_TEXT_REPRESENTATION
+},
+
+{
+	"invalid_binary_representation", ERRCODE_INVALID_BINARY_REPRESENTATION
+},
+
+{
+	"bad_copy_file_format", ERRCODE_BAD_COPY_FILE_FORMAT
+},
+
+{
+	"untranslatable_character", ERRCODE_UNTRANSLATABLE_CHARACTER
+},
+
+{
+	"not_an_xml_document", ERRCODE_NOT_AN_XML_DOCUMENT
+},
+
+{
+	"invalid_xml_document", ERRCODE_INVALID_XML_DOCUMENT
+},
+
+{
+	"invalid_xml_content", ERRCODE_INVALID_XML_CONTENT
+},
+
+{
+	"invalid_xml_comment", ERRCODE_INVALID_XML_COMMENT
+},
+
+{
+	"invalid_xml_processing_instruction", ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION
+},
+
+{
+	"integrity_constraint_violation", ERRCODE_INTEGRITY_CONSTRAINT_VIOLATION
+},
+
+{
+	"restrict_violation", ERRCODE_RESTRICT_VIOLATION
+},
+
+{
+	"not_null_violation", ERRCODE_NOT_NULL_VIOLATION
+},
+
+{
+	"foreign_key_violation", ERRCODE_FOREIGN_KEY_VIOLATION
+},
+
+{
+	"unique_violation", ERRCODE_UNIQUE_VIOLATION
+},
+
+{
+	"check_violation", ERRCODE_CHECK_VIOLATION
+},
+
+{
+	"exclusion_violation", ERRCODE_EXCLUSION_VIOLATION
+},
+
+{
+	"invalid_cursor_state", ERRCODE_INVALID_CURSOR_STATE
+},
+
+{
+	"invalid_transaction_state", ERRCODE_INVALID_TRANSACTION_STATE
+},
+
+{
+	"active_sql_transaction", ERRCODE_ACTIVE_SQL_TRANSACTION
+},
+
+{
+	"branch_transaction_already_active", ERRCODE_BRANCH_TRANSACTION_ALREADY_ACTIVE
+},
+
+{
+	"held_cursor_requires_same_isolation_level", ERRCODE_HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL
+},
+
+{
+	"inappropriate_access_mode_for_branch_transaction", ERRCODE_INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION
+},
+
+{
+	"inappropriate_isolation_level_for_branch_transaction", ERRCODE_INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION
+},
+
+{
+	"no_active_sql_transaction_for_branch_transaction", ERRCODE_NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION
+},
+
+{
+	"read_only_sql_transaction", ERRCODE_READ_ONLY_SQL_TRANSACTION
+},
+
+{
+	"schema_and_data_statement_mixing_not_supported", ERRCODE_SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED
+},
+
+{
+	"no_active_sql_transaction", ERRCODE_NO_ACTIVE_SQL_TRANSACTION
+},
+
+{
+	"in_failed_sql_transaction", ERRCODE_IN_FAILED_SQL_TRANSACTION
+},
+
+{
+	"invalid_sql_statement_name", ERRCODE_INVALID_SQL_STATEMENT_NAME
+},
+
+{
+	"triggered_data_change_violation", ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION
+},
+
+{
+	"invalid_authorization_specification", ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION
+},
+
+{
+	"invalid_password", ERRCODE_INVALID_PASSWORD
+},
+
+{
+	"dependent_privilege_descriptors_still_exist", ERRCODE_DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST
+},
+
+{
+	"dependent_objects_still_exist", ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST
+},
+
+{
+	"invalid_transaction_termination", ERRCODE_INVALID_TRANSACTION_TERMINATION
+},
+
+{
+	"sql_routine_exception", ERRCODE_SQL_ROUTINE_EXCEPTION
+},
+
+{
+	"function_executed_no_return_statement", ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT
+},
+
+{
+	"modifying_sql_data_not_permitted", ERRCODE_S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED
+},
+
+{
+	"prohibited_sql_statement_attempted", ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED
+},
+
+{
+	"reading_sql_data_not_permitted", ERRCODE_S_R_E_READING_SQL_DATA_NOT_PERMITTED
+},
+
+{
+	"invalid_cursor_name", ERRCODE_INVALID_CURSOR_NAME
+},
+
+{
+	"external_routine_exception", ERRCODE_EXTERNAL_ROUTINE_EXCEPTION
+},
+
+{
+	"containing_sql_not_permitted", ERRCODE_E_R_E_CONTAINING_SQL_NOT_PERMITTED
+},
+
+{
+	"modifying_sql_data_not_permitted", ERRCODE_E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED
+},
+
+{
+	"prohibited_sql_statement_attempted", ERRCODE_E_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED
+},
+
+{
+	"reading_sql_data_not_permitted", ERRCODE_E_R_E_READING_SQL_DATA_NOT_PERMITTED
+},
+
+{
+	"external_routine_invocation_exception", ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION
+},
+
+{
+	"invalid_sqlstate_returned", ERRCODE_E_R_I_E_INVALID_SQLSTATE_RETURNED
+},
+
+{
+	"null_value_not_allowed", ERRCODE_E_R_I_E_NULL_VALUE_NOT_ALLOWED
+},
+
+{
+	"trigger_protocol_violated", ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED
+},
+
+{
+	"srf_protocol_violated", ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED
+},
+
+{
+	"event_trigger_protocol_violated", ERRCODE_E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED
+},
+
+{
+	"savepoint_exception", ERRCODE_SAVEPOINT_EXCEPTION
+},
+
+{
+	"invalid_savepoint_specification", ERRCODE_S_E_INVALID_SPECIFICATION
+},
+
+{
+	"invalid_catalog_name", ERRCODE_INVALID_CATALOG_NAME
+},
+
+{
+	"invalid_schema_name", ERRCODE_INVALID_SCHEMA_NAME
+},
+
+{
+	"transaction_rollback", ERRCODE_TRANSACTION_ROLLBACK
+},
+
+{
+	"transaction_integrity_constraint_violation", ERRCODE_T_R_INTEGRITY_CONSTRAINT_VIOLATION
+},
+
+{
+	"serialization_failure", ERRCODE_T_R_SERIALIZATION_FAILURE
+},
+
+{
+	"statement_completion_unknown", ERRCODE_T_R_STATEMENT_COMPLETION_UNKNOWN
+},
+
+{
+	"deadlock_detected", ERRCODE_T_R_DEADLOCK_DETECTED
+},
+
+{
+	"syntax_error_or_access_rule_violation", ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION
+},
+
+{
+	"syntax_error", ERRCODE_SYNTAX_ERROR
+},
+
+{
+	"insufficient_privilege", ERRCODE_INSUFFICIENT_PRIVILEGE
+},
+
+{
+	"cannot_coerce", ERRCODE_CANNOT_COERCE
+},
+
+{
+	"grouping_error", ERRCODE_GROUPING_ERROR
+},
+
+{
+	"windowing_error", ERRCODE_WINDOWING_ERROR
+},
+
+{
+	"invalid_recursion", ERRCODE_INVALID_RECURSION
+},
+
+{
+	"invalid_foreign_key", ERRCODE_INVALID_FOREIGN_KEY
+},
+
+{
+	"invalid_name", ERRCODE_INVALID_NAME
+},
+
+{
+	"name_too_long", ERRCODE_NAME_TOO_LONG
+},
+
+{
+	"reserved_name", ERRCODE_RESERVED_NAME
+},
+
+{
+	"datatype_mismatch", ERRCODE_DATATYPE_MISMATCH
+},
+
+{
+	"indeterminate_datatype", ERRCODE_INDETERMINATE_DATATYPE
+},
+
+{
+	"collation_mismatch", ERRCODE_COLLATION_MISMATCH
+},
+
+{
+	"indeterminate_collation", ERRCODE_INDETERMINATE_COLLATION
+},
+
+{
+	"wrong_object_type", ERRCODE_WRONG_OBJECT_TYPE
+},
+
+{
+	"undefined_column", ERRCODE_UNDEFINED_COLUMN
+},
+
+{
+	"undefined_function", ERRCODE_UNDEFINED_FUNCTION
+},
+
+{
+	"undefined_table", ERRCODE_UNDEFINED_TABLE
+},
+
+{
+	"undefined_parameter", ERRCODE_UNDEFINED_PARAMETER
+},
+
+{
+	"undefined_object", ERRCODE_UNDEFINED_OBJECT
+},
+
+{
+	"duplicate_column", ERRCODE_DUPLICATE_COLUMN
+},
+
+{
+	"duplicate_cursor", ERRCODE_DUPLICATE_CURSOR
+},
+
+{
+	"duplicate_database", ERRCODE_DUPLICATE_DATABASE
+},
+
+{
+	"duplicate_function", ERRCODE_DUPLICATE_FUNCTION
+},
+
+{
+	"duplicate_prepared_statement", ERRCODE_DUPLICATE_PSTATEMENT
+},
+
+{
+	"duplicate_schema", ERRCODE_DUPLICATE_SCHEMA
+},
+
+{
+	"duplicate_table", ERRCODE_DUPLICATE_TABLE
+},
+
+{
+	"duplicate_alias", ERRCODE_DUPLICATE_ALIAS
+},
+
+{
+	"duplicate_object", ERRCODE_DUPLICATE_OBJECT
+},
+
+{
+	"ambiguous_column", ERRCODE_AMBIGUOUS_COLUMN
+},
+
+{
+	"ambiguous_function", ERRCODE_AMBIGUOUS_FUNCTION
+},
+
+{
+	"ambiguous_parameter", ERRCODE_AMBIGUOUS_PARAMETER
+},
+
+{
+	"ambiguous_alias", ERRCODE_AMBIGUOUS_ALIAS
+},
+
+{
+	"invalid_column_reference", ERRCODE_INVALID_COLUMN_REFERENCE
+},
+
+{
+	"invalid_column_definition", ERRCODE_INVALID_COLUMN_DEFINITION
+},
+
+{
+	"invalid_cursor_definition", ERRCODE_INVALID_CURSOR_DEFINITION
+},
+
+{
+	"invalid_database_definition", ERRCODE_INVALID_DATABASE_DEFINITION
+},
+
+{
+	"invalid_function_definition", ERRCODE_INVALID_FUNCTION_DEFINITION
+},
+
+{
+	"invalid_prepared_statement_definition", ERRCODE_INVALID_PSTATEMENT_DEFINITION
+},
+
+{
+	"invalid_schema_definition", ERRCODE_INVALID_SCHEMA_DEFINITION
+},
+
+{
+	"invalid_table_definition", ERRCODE_INVALID_TABLE_DEFINITION
+},
+
+{
+	"invalid_object_definition", ERRCODE_INVALID_OBJECT_DEFINITION
+},
+
+{
+	"with_check_option_violation", ERRCODE_WITH_CHECK_OPTION_VIOLATION
+},
+
+{
+	"insufficient_resources", ERRCODE_INSUFFICIENT_RESOURCES
+},
+
+{
+	"disk_full", ERRCODE_DISK_FULL
+},
+
+{
+	"out_of_memory", ERRCODE_OUT_OF_MEMORY
+},
+
+{
+	"too_many_connections", ERRCODE_TOO_MANY_CONNECTIONS
+},
+
+{
+	"configuration_limit_exceeded", ERRCODE_CONFIGURATION_LIMIT_EXCEEDED
+},
+
+{
+	"program_limit_exceeded", ERRCODE_PROGRAM_LIMIT_EXCEEDED
+},
+
+{
+	"statement_too_complex", ERRCODE_STATEMENT_TOO_COMPLEX
+},
+
+{
+	"too_many_columns", ERRCODE_TOO_MANY_COLUMNS
+},
+
+{
+	"too_many_arguments", ERRCODE_TOO_MANY_ARGUMENTS
+},
+
+{
+	"object_not_in_prerequisite_state", ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE
+},
+
+{
+	"object_in_use", ERRCODE_OBJECT_IN_USE
+},
+
+{
+	"cant_change_runtime_param", ERRCODE_CANT_CHANGE_RUNTIME_PARAM
+},
+
+{
+	"lock_not_available", ERRCODE_LOCK_NOT_AVAILABLE
+},
+
+{
+	"operator_intervention", ERRCODE_OPERATOR_INTERVENTION
+},
+
+{
+	"query_canceled", ERRCODE_QUERY_CANCELED
+},
+
+{
+	"admin_shutdown", ERRCODE_ADMIN_SHUTDOWN
+},
+
+{
+	"crash_shutdown", ERRCODE_CRASH_SHUTDOWN
+},
+
+{
+	"cannot_connect_now", ERRCODE_CANNOT_CONNECT_NOW
+},
+
+{
+	"database_dropped", ERRCODE_DATABASE_DROPPED
+},
+
+{
+	"system_error", ERRCODE_SYSTEM_ERROR
+},
+
+{
+	"io_error", ERRCODE_IO_ERROR
+},
+
+{
+	"undefined_file", ERRCODE_UNDEFINED_FILE
+},
+
+{
+	"duplicate_file", ERRCODE_DUPLICATE_FILE
+},
+
+{
+	"config_file_error", ERRCODE_CONFIG_FILE_ERROR
+},
+
+{
+	"lock_file_exists", ERRCODE_LOCK_FILE_EXISTS
+},
+
+{
+	"fdw_error", ERRCODE_FDW_ERROR
+},
+
+{
+	"fdw_column_name_not_found", ERRCODE_FDW_COLUMN_NAME_NOT_FOUND
+},
+
+{
+	"fdw_dynamic_parameter_value_needed", ERRCODE_FDW_DYNAMIC_PARAMETER_VALUE_NEEDED
+},
+
+{
+	"fdw_function_sequence_error", ERRCODE_FDW_FUNCTION_SEQUENCE_ERROR
+},
+
+{
+	"fdw_inconsistent_descriptor_information", ERRCODE_FDW_INCONSISTENT_DESCRIPTOR_INFORMATION
+},
+
+{
+	"fdw_invalid_attribute_value", ERRCODE_FDW_INVALID_ATTRIBUTE_VALUE
+},
+
+{
+	"fdw_invalid_column_name", ERRCODE_FDW_INVALID_COLUMN_NAME
+},
+
+{
+	"fdw_invalid_column_number", ERRCODE_FDW_INVALID_COLUMN_NUMBER
+},
+
+{
+	"fdw_invalid_data_type", ERRCODE_FDW_INVALID_DATA_TYPE
+},
+
+{
+	"fdw_invalid_data_type_descriptors", ERRCODE_FDW_INVALID_DATA_TYPE_DESCRIPTORS
+},
+
+{
+	"fdw_invalid_descriptor_field_identifier", ERRCODE_FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER
+},
+
+{
+	"fdw_invalid_handle", ERRCODE_FDW_INVALID_HANDLE
+},
+
+{
+	"fdw_invalid_option_index", ERRCODE_FDW_INVALID_OPTION_INDEX
+},
+
+{
+	"fdw_invalid_option_name", ERRCODE_FDW_INVALID_OPTION_NAME
+},
+
+{
+	"fdw_invalid_string_length_or_buffer_length", ERRCODE_FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH
+},
+
+{
+	"fdw_invalid_string_format", ERRCODE_FDW_INVALID_STRING_FORMAT
+},
+
+{
+	"fdw_invalid_use_of_null_pointer", ERRCODE_FDW_INVALID_USE_OF_NULL_POINTER
+},
+
+{
+	"fdw_too_many_handles", ERRCODE_FDW_TOO_MANY_HANDLES
+},
+
+{
+	"fdw_out_of_memory", ERRCODE_FDW_OUT_OF_MEMORY
+},
+
+{
+	"fdw_no_schemas", ERRCODE_FDW_NO_SCHEMAS
+},
+
+{
+	"fdw_option_name_not_found", ERRCODE_FDW_OPTION_NAME_NOT_FOUND
+},
+
+{
+	"fdw_reply_handle", ERRCODE_FDW_REPLY_HANDLE
+},
+
+{
+	"fdw_schema_not_found", ERRCODE_FDW_SCHEMA_NOT_FOUND
+},
+
+{
+	"fdw_table_not_found", ERRCODE_FDW_TABLE_NOT_FOUND
+},
+
+{
+	"fdw_unable_to_create_execution", ERRCODE_FDW_UNABLE_TO_CREATE_EXECUTION
+},
+
+{
+	"fdw_unable_to_create_reply", ERRCODE_FDW_UNABLE_TO_CREATE_REPLY
+},
+
+{
+	"fdw_unable_to_establish_connection", ERRCODE_FDW_UNABLE_TO_ESTABLISH_CONNECTION
+},
+
+{
+	"plpgsql_error", ERRCODE_PLPGSQL_ERROR
+},
+
+{
+	"raise_exception", ERRCODE_RAISE_EXCEPTION
+},
+
+{
+	"no_data_found", ERRCODE_NO_DATA_FOUND
+},
+
+{
+	"too_many_rows", ERRCODE_TOO_MANY_ROWS
+},
+
+{
+	"assert_failure", ERRCODE_ASSERT_FAILURE
+},
+
+{
+	"internal_error", ERRCODE_INTERNAL_ERROR
+},
+
+{
+	"data_corrupted", ERRCODE_DATA_CORRUPTED
+},
+
+{
+	"index_corrupted", ERRCODE_INDEX_CORRUPTED
+},
+
diff --git a/foreign/libpg_query/src/postgres/include/plpgsql.h b/foreign/libpg_query/src/postgres/include/plpgsql.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/plpgsql.h
@@ -0,0 +1,1040 @@
+/*-------------------------------------------------------------------------
+ *
+ * plpgsql.h		- Definitions for the PL/pgSQL
+ *			  procedural language
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/pl/plpgsql/src/plpgsql.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef PLPGSQL_H
+#define PLPGSQL_H
+
+#include "postgres.h"
+
+#include "access/xact.h"
+#include "commands/event_trigger.h"
+#include "commands/trigger.h"
+#include "executor/spi.h"
+
+/**********************************************************************
+ * Definitions
+ **********************************************************************/
+
+/* define our text domain for translations */
+#undef TEXTDOMAIN
+#define TEXTDOMAIN PG_TEXTDOMAIN("plpgsql")
+
+#undef _
+#define _(x) dgettext(TEXTDOMAIN, x)
+
+/* ----------
+ * Compiler's namespace item types
+ * ----------
+ */
+enum
+{
+	PLPGSQL_NSTYPE_LABEL,
+	PLPGSQL_NSTYPE_VAR,
+	PLPGSQL_NSTYPE_ROW,
+	PLPGSQL_NSTYPE_REC
+};
+
+/* ----------
+ * Datum array node types
+ * ----------
+ */
+enum
+{
+	PLPGSQL_DTYPE_VAR,
+	PLPGSQL_DTYPE_ROW,
+	PLPGSQL_DTYPE_REC,
+	PLPGSQL_DTYPE_RECFIELD,
+	PLPGSQL_DTYPE_ARRAYELEM,
+	PLPGSQL_DTYPE_EXPR
+};
+
+/* ----------
+ * Variants distinguished in PLpgSQL_type structs
+ * ----------
+ */
+enum
+{
+	PLPGSQL_TTYPE_SCALAR,		/* scalar types and domains */
+	PLPGSQL_TTYPE_ROW,			/* composite types */
+	PLPGSQL_TTYPE_REC,			/* RECORD pseudotype */
+	PLPGSQL_TTYPE_PSEUDO		/* other pseudotypes */
+};
+
+/* ----------
+ * Execution tree node types
+ * ----------
+ */
+enum PLpgSQL_stmt_types
+{
+	PLPGSQL_STMT_BLOCK,
+	PLPGSQL_STMT_ASSIGN,
+	PLPGSQL_STMT_IF,
+	PLPGSQL_STMT_CASE,
+	PLPGSQL_STMT_LOOP,
+	PLPGSQL_STMT_WHILE,
+	PLPGSQL_STMT_FORI,
+	PLPGSQL_STMT_FORS,
+	PLPGSQL_STMT_FORC,
+	PLPGSQL_STMT_FOREACH_A,
+	PLPGSQL_STMT_EXIT,
+	PLPGSQL_STMT_RETURN,
+	PLPGSQL_STMT_RETURN_NEXT,
+	PLPGSQL_STMT_RETURN_QUERY,
+	PLPGSQL_STMT_RAISE,
+	PLPGSQL_STMT_ASSERT,
+	PLPGSQL_STMT_EXECSQL,
+	PLPGSQL_STMT_DYNEXECUTE,
+	PLPGSQL_STMT_DYNFORS,
+	PLPGSQL_STMT_GETDIAG,
+	PLPGSQL_STMT_OPEN,
+	PLPGSQL_STMT_FETCH,
+	PLPGSQL_STMT_CLOSE,
+	PLPGSQL_STMT_PERFORM
+};
+
+
+/* ----------
+ * Execution node return codes
+ * ----------
+ */
+enum
+{
+	PLPGSQL_RC_OK,
+	PLPGSQL_RC_EXIT,
+	PLPGSQL_RC_RETURN,
+	PLPGSQL_RC_CONTINUE
+};
+
+/* ----------
+ * GET DIAGNOSTICS information items
+ * ----------
+ */
+enum
+{
+	PLPGSQL_GETDIAG_ROW_COUNT,
+	PLPGSQL_GETDIAG_RESULT_OID,
+	PLPGSQL_GETDIAG_CONTEXT,
+	PLPGSQL_GETDIAG_ERROR_CONTEXT,
+	PLPGSQL_GETDIAG_ERROR_DETAIL,
+	PLPGSQL_GETDIAG_ERROR_HINT,
+	PLPGSQL_GETDIAG_RETURNED_SQLSTATE,
+	PLPGSQL_GETDIAG_COLUMN_NAME,
+	PLPGSQL_GETDIAG_CONSTRAINT_NAME,
+	PLPGSQL_GETDIAG_DATATYPE_NAME,
+	PLPGSQL_GETDIAG_MESSAGE_TEXT,
+	PLPGSQL_GETDIAG_TABLE_NAME,
+	PLPGSQL_GETDIAG_SCHEMA_NAME
+};
+
+/* --------
+ * RAISE statement options
+ * --------
+ */
+enum
+{
+	PLPGSQL_RAISEOPTION_ERRCODE,
+	PLPGSQL_RAISEOPTION_MESSAGE,
+	PLPGSQL_RAISEOPTION_DETAIL,
+	PLPGSQL_RAISEOPTION_HINT,
+	PLPGSQL_RAISEOPTION_COLUMN,
+	PLPGSQL_RAISEOPTION_CONSTRAINT,
+	PLPGSQL_RAISEOPTION_DATATYPE,
+	PLPGSQL_RAISEOPTION_TABLE,
+	PLPGSQL_RAISEOPTION_SCHEMA
+};
+
+/* --------
+ * Behavioral modes for plpgsql variable resolution
+ * --------
+ */
+typedef enum
+{
+	PLPGSQL_RESOLVE_ERROR,		/* throw error if ambiguous */
+	PLPGSQL_RESOLVE_VARIABLE,	/* prefer plpgsql var to table column */
+	PLPGSQL_RESOLVE_COLUMN		/* prefer table column to plpgsql var */
+} PLpgSQL_resolve_option;
+
+
+/**********************************************************************
+ * Node and structure definitions
+ **********************************************************************/
+
+
+typedef struct
+{								/* Postgres data type */
+	char	   *typname;		/* (simple) name of the type */
+	Oid			typoid;			/* OID of the data type */
+	int			ttype;			/* PLPGSQL_TTYPE_ code */
+	int16		typlen;			/* stuff copied from its pg_type entry */
+	bool		typbyval;
+	char		typtype;
+	Oid			typrelid;
+	Oid			collation;		/* from pg_type, but can be overridden */
+	bool		typisarray;		/* is "true" array, or domain over one */
+	int32		atttypmod;		/* typmod (taken from someplace else) */
+} PLpgSQL_type;
+
+
+/*
+ * PLpgSQL_datum is the common supertype for PLpgSQL_expr, PLpgSQL_var,
+ * PLpgSQL_row, PLpgSQL_rec, PLpgSQL_recfield, and PLpgSQL_arrayelem
+ */
+typedef struct
+{								/* Generic datum array item		*/
+	int			dtype;
+	int			dno;
+} PLpgSQL_datum;
+
+/*
+ * The variants PLpgSQL_var, PLpgSQL_row, and PLpgSQL_rec share these
+ * fields
+ */
+typedef struct
+{								/* Scalar or composite variable */
+	int			dtype;
+	int			dno;
+	char	   *refname;
+	int			lineno;
+} PLpgSQL_variable;
+
+typedef struct PLpgSQL_expr
+{								/* SQL Query to plan and execute	*/
+	int			dtype;
+	int			dno;
+	char	   *query;
+	SPIPlanPtr	plan;
+	Bitmapset  *paramnos;		/* all dnos referenced by this query */
+	int			rwparam;		/* dno of read/write param, or -1 if none */
+
+	/* function containing this expr (not set until we first parse query) */
+	struct PLpgSQL_function *func;
+
+	/* namespace chain visible to this expr */
+	struct PLpgSQL_nsitem *ns;
+
+	/* fields for "simple expression" fast-path execution: */
+	Expr	   *expr_simple_expr;		/* NULL means not a simple expr */
+	int			expr_simple_generation; /* plancache generation we checked */
+	Oid			expr_simple_type;		/* result type Oid, if simple */
+	int32		expr_simple_typmod;		/* result typmod, if simple */
+
+	/*
+	 * if expr is simple AND prepared in current transaction,
+	 * expr_simple_state and expr_simple_in_use are valid. Test validity by
+	 * seeing if expr_simple_lxid matches current LXID.  (If not,
+	 * expr_simple_state probably points at garbage!)
+	 */
+	ExprState  *expr_simple_state;		/* eval tree for expr_simple_expr */
+	bool		expr_simple_in_use;		/* true if eval tree is active */
+	LocalTransactionId expr_simple_lxid;
+} PLpgSQL_expr;
+
+
+typedef struct
+{								/* Scalar variable */
+	int			dtype;
+	int			dno;
+	char	   *refname;
+	int			lineno;
+
+	PLpgSQL_type *datatype;
+	int			isconst;
+	int			notnull;
+	PLpgSQL_expr *default_val;
+	PLpgSQL_expr *cursor_explicit_expr;
+	int			cursor_explicit_argrow;
+	int			cursor_options;
+
+	Datum		value;
+	bool		isnull;
+	bool		freeval;
+} PLpgSQL_var;
+
+
+typedef struct
+{								/* Row variable */
+	int			dtype;
+	int			dno;
+	char	   *refname;
+	int			lineno;
+
+	TupleDesc	rowtupdesc;
+
+	/*
+	 * Note: TupleDesc is only set up for named rowtypes, else it is NULL.
+	 *
+	 * Note: if the underlying rowtype contains a dropped column, the
+	 * corresponding fieldnames[] entry will be NULL, and there is no
+	 * corresponding var (varnos[] will be -1).
+	 */
+	int			nfields;
+	char	  **fieldnames;
+	int		   *varnos;
+} PLpgSQL_row;
+
+
+typedef struct
+{								/* Record variable (non-fixed structure) */
+	int			dtype;
+	int			dno;
+	char	   *refname;
+	int			lineno;
+
+	HeapTuple	tup;
+	TupleDesc	tupdesc;
+	bool		freetup;
+	bool		freetupdesc;
+} PLpgSQL_rec;
+
+
+typedef struct
+{								/* Field in record */
+	int			dtype;
+	int			dno;
+	char	   *fieldname;
+	int			recparentno;	/* dno of parent record */
+} PLpgSQL_recfield;
+
+
+typedef struct
+{								/* Element of array variable */
+	int			dtype;
+	int			dno;
+	PLpgSQL_expr *subscript;
+	int			arrayparentno;	/* dno of parent array variable */
+	/* Remaining fields are cached info about the array variable's type */
+	Oid			parenttypoid;	/* type of array variable; 0 if not yet set */
+	int32		parenttypmod;	/* typmod of array variable */
+	Oid			arraytypoid;	/* OID of actual array type */
+	int32		arraytypmod;	/* typmod of array (and its elements too) */
+	int16		arraytyplen;	/* typlen of array type */
+	Oid			elemtypoid;		/* OID of array element type */
+	int16		elemtyplen;		/* typlen of element type */
+	bool		elemtypbyval;	/* element type is pass-by-value? */
+	char		elemtypalign;	/* typalign of element type */
+} PLpgSQL_arrayelem;
+
+
+typedef struct PLpgSQL_nsitem
+{								/* Item in the compilers namespace tree */
+	int			itemtype;
+	int			itemno;
+	struct PLpgSQL_nsitem *prev;
+	char		name[FLEXIBLE_ARRAY_MEMBER];	/* nul-terminated string */
+} PLpgSQL_nsitem;
+
+
+typedef struct
+{								/* Generic execution node		*/
+	int			cmd_type;
+	int			lineno;
+} PLpgSQL_stmt;
+
+
+typedef struct PLpgSQL_condition
+{								/* One EXCEPTION condition name */
+	int			sqlerrstate;	/* SQLSTATE code */
+	char	   *condname;		/* condition name (for debugging) */
+	struct PLpgSQL_condition *next;
+} PLpgSQL_condition;
+
+typedef struct
+{
+	int			sqlstate_varno;
+	int			sqlerrm_varno;
+	List	   *exc_list;		/* List of WHEN clauses */
+} PLpgSQL_exception_block;
+
+typedef struct
+{								/* One EXCEPTION ... WHEN clause */
+	int			lineno;
+	PLpgSQL_condition *conditions;
+	List	   *action;			/* List of statements */
+} PLpgSQL_exception;
+
+
+typedef struct
+{								/* Block of statements			*/
+	int			cmd_type;
+	int			lineno;
+	char	   *label;
+	List	   *body;			/* List of statements */
+	int			n_initvars;
+	int		   *initvarnos;
+	PLpgSQL_exception_block *exceptions;
+} PLpgSQL_stmt_block;
+
+
+typedef struct
+{								/* Assign statement			*/
+	int			cmd_type;
+	int			lineno;
+	int			varno;
+	PLpgSQL_expr *expr;
+} PLpgSQL_stmt_assign;
+
+typedef struct
+{								/* PERFORM statement		*/
+	int			cmd_type;
+	int			lineno;
+	PLpgSQL_expr *expr;
+} PLpgSQL_stmt_perform;
+
+typedef struct
+{								/* Get Diagnostics item		*/
+	int			kind;			/* id for diagnostic value desired */
+	int			target;			/* where to assign it */
+} PLpgSQL_diag_item;
+
+typedef struct
+{								/* Get Diagnostics statement		*/
+	int			cmd_type;
+	int			lineno;
+	bool		is_stacked;		/* STACKED or CURRENT diagnostics area? */
+	List	   *diag_items;		/* List of PLpgSQL_diag_item */
+} PLpgSQL_stmt_getdiag;
+
+
+typedef struct
+{								/* IF statement				*/
+	int			cmd_type;
+	int			lineno;
+	PLpgSQL_expr *cond;			/* boolean expression for THEN */
+	List	   *then_body;		/* List of statements */
+	List	   *elsif_list;		/* List of PLpgSQL_if_elsif structs */
+	List	   *else_body;		/* List of statements */
+} PLpgSQL_stmt_if;
+
+typedef struct					/* one ELSIF arm of IF statement */
+{
+	int			lineno;
+	PLpgSQL_expr *cond;			/* boolean expression for this case */
+	List	   *stmts;			/* List of statements */
+} PLpgSQL_if_elsif;
+
+
+typedef struct					/* CASE statement */
+{
+	int			cmd_type;
+	int			lineno;
+	PLpgSQL_expr *t_expr;		/* test expression, or NULL if none */
+	int			t_varno;		/* var to store test expression value into */
+	List	   *case_when_list; /* List of PLpgSQL_case_when structs */
+	bool		have_else;		/* flag needed because list could be empty */
+	List	   *else_stmts;		/* List of statements */
+} PLpgSQL_stmt_case;
+
+typedef struct					/* one arm of CASE statement */
+{
+	int			lineno;
+	PLpgSQL_expr *expr;			/* boolean expression for this case */
+	List	   *stmts;			/* List of statements */
+} PLpgSQL_case_when;
+
+
+typedef struct
+{								/* Unconditional LOOP statement		*/
+	int			cmd_type;
+	int			lineno;
+	char	   *label;
+	List	   *body;			/* List of statements */
+} PLpgSQL_stmt_loop;
+
+
+typedef struct
+{								/* WHILE cond LOOP statement		*/
+	int			cmd_type;
+	int			lineno;
+	char	   *label;
+	PLpgSQL_expr *cond;
+	List	   *body;			/* List of statements */
+} PLpgSQL_stmt_while;
+
+
+typedef struct
+{								/* FOR statement with integer loopvar	*/
+	int			cmd_type;
+	int			lineno;
+	char	   *label;
+	PLpgSQL_var *var;
+	PLpgSQL_expr *lower;
+	PLpgSQL_expr *upper;
+	PLpgSQL_expr *step;			/* NULL means default (ie, BY 1) */
+	int			reverse;
+	List	   *body;			/* List of statements */
+} PLpgSQL_stmt_fori;
+
+
+/*
+ * PLpgSQL_stmt_forq represents a FOR statement running over a SQL query.
+ * It is the common supertype of PLpgSQL_stmt_fors, PLpgSQL_stmt_forc
+ * and PLpgSQL_dynfors.
+ */
+typedef struct
+{
+	int			cmd_type;
+	int			lineno;
+	char	   *label;
+	PLpgSQL_rec *rec;
+	PLpgSQL_row *row;
+	List	   *body;			/* List of statements */
+} PLpgSQL_stmt_forq;
+
+typedef struct
+{								/* FOR statement running over SELECT	*/
+	int			cmd_type;
+	int			lineno;
+	char	   *label;
+	PLpgSQL_rec *rec;
+	PLpgSQL_row *row;
+	List	   *body;			/* List of statements */
+	/* end of fields that must match PLpgSQL_stmt_forq */
+	PLpgSQL_expr *query;
+} PLpgSQL_stmt_fors;
+
+typedef struct
+{								/* FOR statement running over cursor	*/
+	int			cmd_type;
+	int			lineno;
+	char	   *label;
+	PLpgSQL_rec *rec;
+	PLpgSQL_row *row;
+	List	   *body;			/* List of statements */
+	/* end of fields that must match PLpgSQL_stmt_forq */
+	int			curvar;
+	PLpgSQL_expr *argquery;		/* cursor arguments if any */
+} PLpgSQL_stmt_forc;
+
+typedef struct
+{								/* FOR statement running over EXECUTE	*/
+	int			cmd_type;
+	int			lineno;
+	char	   *label;
+	PLpgSQL_rec *rec;
+	PLpgSQL_row *row;
+	List	   *body;			/* List of statements */
+	/* end of fields that must match PLpgSQL_stmt_forq */
+	PLpgSQL_expr *query;
+	List	   *params;			/* USING expressions */
+} PLpgSQL_stmt_dynfors;
+
+
+typedef struct
+{								/* FOREACH item in array loop */
+	int			cmd_type;
+	int			lineno;
+	char	   *label;
+	int			varno;			/* loop target variable */
+	int			slice;			/* slice dimension, or 0 */
+	PLpgSQL_expr *expr;			/* array expression */
+	List	   *body;			/* List of statements */
+} PLpgSQL_stmt_foreach_a;
+
+
+typedef struct
+{								/* OPEN a curvar					*/
+	int			cmd_type;
+	int			lineno;
+	int			curvar;
+	int			cursor_options;
+	PLpgSQL_row *returntype;
+	PLpgSQL_expr *argquery;
+	PLpgSQL_expr *query;
+	PLpgSQL_expr *dynquery;
+	List	   *params;			/* USING expressions */
+} PLpgSQL_stmt_open;
+
+
+typedef struct
+{								/* FETCH or MOVE statement */
+	int			cmd_type;
+	int			lineno;
+	PLpgSQL_rec *rec;			/* target, as record or row */
+	PLpgSQL_row *row;
+	int			curvar;			/* cursor variable to fetch from */
+	FetchDirection direction;	/* fetch direction */
+	long		how_many;		/* count, if constant (expr is NULL) */
+	PLpgSQL_expr *expr;			/* count, if expression */
+	bool		is_move;		/* is this a fetch or move? */
+	bool		returns_multiple_rows;	/* can return more than one row? */
+} PLpgSQL_stmt_fetch;
+
+
+typedef struct
+{								/* CLOSE curvar						*/
+	int			cmd_type;
+	int			lineno;
+	int			curvar;
+} PLpgSQL_stmt_close;
+
+
+typedef struct
+{								/* EXIT or CONTINUE statement			*/
+	int			cmd_type;
+	int			lineno;
+	bool		is_exit;		/* Is this an exit or a continue? */
+	char	   *label;			/* NULL if it's an unlabelled EXIT/CONTINUE */
+	PLpgSQL_expr *cond;
+} PLpgSQL_stmt_exit;
+
+
+typedef struct
+{								/* RETURN statement			*/
+	int			cmd_type;
+	int			lineno;
+	PLpgSQL_expr *expr;
+	int			retvarno;
+} PLpgSQL_stmt_return;
+
+typedef struct
+{								/* RETURN NEXT statement */
+	int			cmd_type;
+	int			lineno;
+	PLpgSQL_expr *expr;
+	int			retvarno;
+} PLpgSQL_stmt_return_next;
+
+typedef struct
+{								/* RETURN QUERY statement */
+	int			cmd_type;
+	int			lineno;
+	PLpgSQL_expr *query;		/* if static query */
+	PLpgSQL_expr *dynquery;		/* if dynamic query (RETURN QUERY EXECUTE) */
+	List	   *params;			/* USING arguments for dynamic query */
+} PLpgSQL_stmt_return_query;
+
+typedef struct
+{								/* RAISE statement			*/
+	int			cmd_type;
+	int			lineno;
+	int			elog_level;
+	char	   *condname;		/* condition name, SQLSTATE, or NULL */
+	char	   *message;		/* old-style message format literal, or NULL */
+	List	   *params;			/* list of expressions for old-style message */
+	List	   *options;		/* list of PLpgSQL_raise_option */
+} PLpgSQL_stmt_raise;
+
+typedef struct
+{								/* RAISE statement option */
+	int			opt_type;
+	PLpgSQL_expr *expr;
+} PLpgSQL_raise_option;
+
+typedef struct
+{								/* ASSERT statement */
+	int			cmd_type;
+	int			lineno;
+	PLpgSQL_expr *cond;
+	PLpgSQL_expr *message;
+} PLpgSQL_stmt_assert;
+
+typedef struct
+{								/* Generic SQL statement to execute */
+	int			cmd_type;
+	int			lineno;
+	PLpgSQL_expr *sqlstmt;
+	bool		mod_stmt;		/* is the stmt INSERT/UPDATE/DELETE? */
+	/* note: mod_stmt is set when we plan the query */
+	bool		into;			/* INTO supplied? */
+	bool		strict;			/* INTO STRICT flag */
+	PLpgSQL_rec *rec;			/* INTO target, if record */
+	PLpgSQL_row *row;			/* INTO target, if row */
+} PLpgSQL_stmt_execsql;
+
+
+typedef struct
+{								/* Dynamic SQL string to execute */
+	int			cmd_type;
+	int			lineno;
+	PLpgSQL_expr *query;		/* string expression */
+	bool		into;			/* INTO supplied? */
+	bool		strict;			/* INTO STRICT flag */
+	PLpgSQL_rec *rec;			/* INTO target, if record */
+	PLpgSQL_row *row;			/* INTO target, if row */
+	List	   *params;			/* USING expressions */
+} PLpgSQL_stmt_dynexecute;
+
+
+typedef struct PLpgSQL_func_hashkey
+{								/* Hash lookup key for functions */
+	Oid			funcOid;
+
+	bool		isTrigger;		/* true if called as a trigger */
+
+	/* be careful that pad bytes in this struct get zeroed! */
+
+	/*
+	 * For a trigger function, the OID of the relation triggered on is part of
+	 * the hash key --- we want to compile the trigger separately for each
+	 * relation it is used with, in case the rowtype is different.  Zero if
+	 * not called as a trigger.
+	 */
+	Oid			trigrelOid;
+
+	/*
+	 * We must include the input collation as part of the hash key too,
+	 * because we have to generate different plans (with different Param
+	 * collations) for different collation settings.
+	 */
+	Oid			inputCollation;
+
+	/*
+	 * We include actual argument types in the hash key to support polymorphic
+	 * PLpgSQL functions.  Be careful that extra positions are zeroed!
+	 */
+	Oid			argtypes[FUNC_MAX_ARGS];
+} PLpgSQL_func_hashkey;
+
+typedef enum PLpgSQL_trigtype
+{
+	PLPGSQL_DML_TRIGGER,
+	PLPGSQL_EVENT_TRIGGER,
+	PLPGSQL_NOT_TRIGGER
+} PLpgSQL_trigtype;
+
+typedef struct PLpgSQL_function
+{								/* Complete compiled function	  */
+	char	   *fn_signature;
+	Oid			fn_oid;
+	TransactionId fn_xmin;
+	ItemPointerData fn_tid;
+	PLpgSQL_trigtype fn_is_trigger;
+	Oid			fn_input_collation;
+	PLpgSQL_func_hashkey *fn_hashkey;	/* back-link to hashtable key */
+	MemoryContext fn_cxt;
+
+	Oid			fn_rettype;
+	int			fn_rettyplen;
+	bool		fn_retbyval;
+	bool		fn_retistuple;
+	bool		fn_retset;
+	bool		fn_readonly;
+
+	int			fn_nargs;
+	int			fn_argvarnos[FUNC_MAX_ARGS];
+	int			out_param_varno;
+	int			found_varno;
+	int			new_varno;
+	int			old_varno;
+	int			tg_name_varno;
+	int			tg_when_varno;
+	int			tg_level_varno;
+	int			tg_op_varno;
+	int			tg_relid_varno;
+	int			tg_relname_varno;
+	int			tg_table_name_varno;
+	int			tg_table_schema_varno;
+	int			tg_nargs_varno;
+	int			tg_argv_varno;
+
+	/* for event triggers */
+	int			tg_event_varno;
+	int			tg_tag_varno;
+
+	PLpgSQL_resolve_option resolve_option;
+
+	bool		print_strict_params;
+
+	/* extra checks */
+	int			extra_warnings;
+	int			extra_errors;
+
+	int			ndatums;
+	PLpgSQL_datum **datums;
+	PLpgSQL_stmt_block *action;
+
+	/* these fields change when the function is used */
+	struct PLpgSQL_execstate *cur_estate;
+	unsigned long use_count;
+} PLpgSQL_function;
+
+
+typedef struct PLpgSQL_execstate
+{								/* Runtime execution data	*/
+	PLpgSQL_function *func;		/* function being executed */
+
+	Datum		retval;
+	bool		retisnull;
+	Oid			rettype;		/* type of current retval */
+
+	Oid			fn_rettype;		/* info about declared function rettype */
+	bool		retistuple;
+	bool		retisset;
+
+	bool		readonly_func;
+
+	TupleDesc	rettupdesc;
+	char	   *exitlabel;		/* the "target" label of the current EXIT or
+								 * CONTINUE stmt, if any */
+	ErrorData  *cur_error;		/* current exception handler's error */
+
+	Tuplestorestate *tuple_store;		/* SRFs accumulate results here */
+	MemoryContext tuple_store_cxt;
+	ResourceOwner tuple_store_owner;
+	ReturnSetInfo *rsi;
+
+	/* the datums representing the function's local variables */
+	int			found_varno;
+	int			ndatums;
+	PLpgSQL_datum **datums;
+
+	/* we pass datums[i] to the executor, when needed, in paramLI->params[i] */
+	ParamListInfo paramLI;
+
+	/* EState to use for "simple" expression evaluation */
+	EState	   *simple_eval_estate;
+
+	/* Lookup table to use for executing type casts */
+	HTAB	   *cast_hash;
+	MemoryContext cast_hash_context;
+
+	/* temporary state for results from evaluation of query or expr */
+	SPITupleTable *eval_tuptable;
+	uint32		eval_processed;
+	Oid			eval_lastoid;
+	ExprContext *eval_econtext; /* for executing simple expressions */
+
+	/* status information for error context reporting */
+	PLpgSQL_stmt *err_stmt;		/* current stmt */
+	const char *err_text;		/* additional state info */
+
+	void	   *plugin_info;	/* reserved for use by optional plugin */
+} PLpgSQL_execstate;
+
+
+/*
+ * A PLpgSQL_plugin structure represents an instrumentation plugin.
+ * To instrument PL/pgSQL, a plugin library must access the rendezvous
+ * variable "PLpgSQL_plugin" and set it to point to a PLpgSQL_plugin struct.
+ * Typically the struct could just be static data in the plugin library.
+ * We expect that a plugin would do this at library load time (_PG_init()).
+ * It must also be careful to set the rendezvous variable back to NULL
+ * if it is unloaded (_PG_fini()).
+ *
+ * This structure is basically a collection of function pointers --- at
+ * various interesting points in pl_exec.c, we call these functions
+ * (if the pointers are non-NULL) to give the plugin a chance to watch
+ * what we are doing.
+ *
+ *	func_setup is called when we start a function, before we've initialized
+ *	the local variables defined by the function.
+ *
+ *	func_beg is called when we start a function, after we've initialized
+ *	the local variables.
+ *
+ *	func_end is called at the end of a function.
+ *
+ *	stmt_beg and stmt_end are called before and after (respectively) each
+ *	statement.
+ *
+ * Also, immediately before any call to func_setup, PL/pgSQL fills in the
+ * error_callback and assign_expr fields with pointers to its own
+ * plpgsql_exec_error_callback and exec_assign_expr functions.  This is
+ * a somewhat ad-hoc expedient to simplify life for debugger plugins.
+ */
+
+typedef struct
+{
+	/* Function pointers set up by the plugin */
+	void		(*func_setup) (PLpgSQL_execstate *estate, PLpgSQL_function *func);
+	void		(*func_beg) (PLpgSQL_execstate *estate, PLpgSQL_function *func);
+	void		(*func_end) (PLpgSQL_execstate *estate, PLpgSQL_function *func);
+	void		(*stmt_beg) (PLpgSQL_execstate *estate, PLpgSQL_stmt *stmt);
+	void		(*stmt_end) (PLpgSQL_execstate *estate, PLpgSQL_stmt *stmt);
+
+	/* Function pointers set by PL/pgSQL itself */
+	void		(*error_callback) (void *arg);
+	void		(*assign_expr) (PLpgSQL_execstate *estate, PLpgSQL_datum *target,
+											PLpgSQL_expr *expr);
+} PLpgSQL_plugin;
+
+
+/* Struct types used during parsing */
+
+typedef struct
+{
+	char	   *ident;			/* palloc'd converted identifier */
+	bool		quoted;			/* Was it double-quoted? */
+} PLword;
+
+typedef struct
+{
+	List	   *idents;			/* composite identifiers (list of String) */
+} PLcword;
+
+typedef struct
+{
+	PLpgSQL_datum *datum;		/* referenced variable */
+	char	   *ident;			/* valid if simple name */
+	bool		quoted;
+	List	   *idents;			/* valid if composite name */
+} PLwdatum;
+
+/**********************************************************************
+ * Global variable declarations
+ **********************************************************************/
+
+typedef enum
+{
+	IDENTIFIER_LOOKUP_NORMAL,	/* normal processing of var names */
+	IDENTIFIER_LOOKUP_DECLARE,	/* In DECLARE --- don't look up names */
+	IDENTIFIER_LOOKUP_EXPR		/* In SQL expression --- special case */
+} IdentifierLookup;
+
+extern __thread  IdentifierLookup plpgsql_IdentifierLookup;
+
+extern __thread  int plpgsql_variable_conflict;
+
+extern __thread  bool plpgsql_print_strict_params;
+
+extern bool plpgsql_check_asserts;
+
+/* extra compile-time checks */
+#define PLPGSQL_XCHECK_NONE			0
+#define PLPGSQL_XCHECK_SHADOWVAR	1
+#define PLPGSQL_XCHECK_ALL			((int) ~0)
+
+extern int	plpgsql_extra_warnings;
+extern int	plpgsql_extra_errors;
+
+extern __thread  bool plpgsql_check_syntax;
+extern __thread  bool plpgsql_DumpExecTree;
+
+extern __thread  PLpgSQL_stmt_block *plpgsql_parse_result;
+
+extern __thread  int plpgsql_nDatums;
+extern __thread  PLpgSQL_datum **plpgsql_Datums;
+
+extern __thread  char *plpgsql_error_funcname;
+
+extern __thread  PLpgSQL_function *plpgsql_curr_compile;
+extern __thread  MemoryContext compile_tmp_cxt;
+
+extern PLpgSQL_plugin **plugin_ptr;
+
+/**********************************************************************
+ * Function declarations
+ **********************************************************************/
+
+/* ----------
+ * Functions in pl_comp.c
+ * ----------
+ */
+extern PLpgSQL_function *plpgsql_compile(FunctionCallInfo fcinfo,
+				bool forValidator);
+extern PLpgSQL_function *plpgsql_compile_inline(char *proc_source);
+extern void plpgsql_parser_setup(struct ParseState *pstate,
+					 PLpgSQL_expr *expr);
+extern bool plpgsql_parse_word(char *word1, const char *yytxt,
+				   PLwdatum *wdatum, PLword *word);
+extern bool plpgsql_parse_dblword(char *word1, char *word2,
+					  PLwdatum *wdatum, PLcword *cword);
+extern bool plpgsql_parse_tripword(char *word1, char *word2, char *word3,
+					   PLwdatum *wdatum, PLcword *cword);
+extern PLpgSQL_type *plpgsql_parse_wordtype(char *ident);
+extern PLpgSQL_type *plpgsql_parse_cwordtype(List *idents);
+extern PLpgSQL_type *plpgsql_parse_wordrowtype(char *ident);
+extern PLpgSQL_type *plpgsql_parse_cwordrowtype(List *idents);
+extern PLpgSQL_type *plpgsql_build_datatype(Oid typeOid, int32 typmod,
+					   Oid collation);
+extern PLpgSQL_variable *plpgsql_build_variable(const char *refname, int lineno,
+					   PLpgSQL_type *dtype,
+					   bool add2namespace);
+extern PLpgSQL_rec *plpgsql_build_record(const char *refname, int lineno,
+					 bool add2namespace);
+extern int plpgsql_recognize_err_condition(const char *condname,
+								bool allow_sqlstate);
+extern PLpgSQL_condition *plpgsql_parse_err_condition(char *condname);
+extern void plpgsql_adddatum(PLpgSQL_datum *new);
+extern int	plpgsql_add_initdatums(int **varnos);
+extern void plpgsql_HashTableInit(void);
+
+/* ----------
+ * Functions in pl_handler.c
+ * ----------
+ */
+extern void _PG_init(void);
+
+/* ----------
+ * Functions in pl_exec.c
+ * ----------
+ */
+extern Datum plpgsql_exec_function(PLpgSQL_function *func,
+					  FunctionCallInfo fcinfo,
+					  EState *simple_eval_estate);
+extern HeapTuple plpgsql_exec_trigger(PLpgSQL_function *func,
+					 TriggerData *trigdata);
+extern void plpgsql_exec_event_trigger(PLpgSQL_function *func,
+						   EventTriggerData *trigdata);
+extern void plpgsql_xact_cb(XactEvent event, void *arg);
+extern void plpgsql_subxact_cb(SubXactEvent event, SubTransactionId mySubid,
+				   SubTransactionId parentSubid, void *arg);
+extern Oid exec_get_datum_type(PLpgSQL_execstate *estate,
+					PLpgSQL_datum *datum);
+extern void exec_get_datum_type_info(PLpgSQL_execstate *estate,
+						 PLpgSQL_datum *datum,
+						 Oid *typeid, int32 *typmod, Oid *collation);
+
+/* ----------
+ * Functions for namespace handling in pl_funcs.c
+ * ----------
+ */
+extern void plpgsql_ns_init(void);
+extern void plpgsql_ns_push(const char *label);
+extern void plpgsql_ns_pop(void);
+extern PLpgSQL_nsitem *plpgsql_ns_top(void);
+extern void plpgsql_ns_additem(int itemtype, int itemno, const char *name);
+extern PLpgSQL_nsitem *plpgsql_ns_lookup(PLpgSQL_nsitem *ns_cur, bool localmode,
+				  const char *name1, const char *name2,
+				  const char *name3, int *names_used);
+extern PLpgSQL_nsitem *plpgsql_ns_lookup_label(PLpgSQL_nsitem *ns_cur,
+						const char *name);
+
+/* ----------
+ * Other functions in pl_funcs.c
+ * ----------
+ */
+extern const char *plpgsql_stmt_typename(PLpgSQL_stmt *stmt);
+extern const char *plpgsql_getdiag_kindname(int kind);
+extern void plpgsql_free_function_memory(PLpgSQL_function *func);
+extern void plpgsql_dumptree(PLpgSQL_function *func);
+
+/* ----------
+ * Scanner functions in pl_scanner.c
+ * ----------
+ */
+extern int	plpgsql_base_yylex(void);
+extern int	plpgsql_yylex(void);
+extern void plpgsql_push_back_token(int token);
+extern bool plpgsql_token_is_unreserved_keyword(int token);
+extern void plpgsql_append_source_text(StringInfo buf,
+						   int startlocation, int endlocation);
+extern int	plpgsql_peek(void);
+extern void plpgsql_peek2(int *tok1_p, int *tok2_p, int *tok1_loc,
+			  int *tok2_loc);
+extern int	plpgsql_scanner_errposition(int location);
+extern void plpgsql_yyerror(const char *message) pg_attribute_noreturn();
+extern int	plpgsql_location_to_lineno(int location);
+extern int	plpgsql_latest_lineno(void);
+extern void plpgsql_scanner_init(const char *str);
+extern void plpgsql_scanner_finish(void);
+
+/* ----------
+ * Externs in gram.y
+ * ----------
+ */
+extern int	plpgsql_yyparse(void);
+
+#endif   /* PLPGSQL_H */
diff --git a/foreign/libpg_query/src/postgres/include/port.h b/foreign/libpg_query/src/postgres/include/port.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/port.h
@@ -0,0 +1,471 @@
+/*-------------------------------------------------------------------------
+ *
+ * port.h
+ *	  Header for src/port/ compatibility functions.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/port.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_PORT_H
+#define PG_PORT_H
+
+#include <ctype.h>
+#include <netdb.h>
+#include <pwd.h>
+
+/* socket has a different definition on WIN32 */
+#ifndef WIN32
+typedef int pgsocket;
+
+#define PGINVALID_SOCKET (-1)
+#else
+typedef SOCKET pgsocket;
+
+#define PGINVALID_SOCKET INVALID_SOCKET
+#endif
+
+/* non-blocking */
+extern bool pg_set_noblock(pgsocket sock);
+extern bool pg_set_block(pgsocket sock);
+
+/* Portable path handling for Unix/Win32 (in path.c) */
+
+extern bool has_drive_prefix(const char *filename);
+extern char *first_dir_separator(const char *filename);
+extern char *last_dir_separator(const char *filename);
+extern char *first_path_var_separator(const char *pathlist);
+extern void join_path_components(char *ret_path,
+					 const char *head, const char *tail);
+extern void canonicalize_path(char *path);
+extern void make_native_path(char *path);
+extern bool path_contains_parent_reference(const char *path);
+extern bool path_is_relative_and_below_cwd(const char *path);
+extern bool path_is_prefix_of_path(const char *path1, const char *path2);
+extern char *make_absolute_path(const char *path);
+extern const char *get_progname(const char *argv0);
+extern void get_share_path(const char *my_exec_path, char *ret_path);
+extern void get_etc_path(const char *my_exec_path, char *ret_path);
+extern void get_include_path(const char *my_exec_path, char *ret_path);
+extern void get_pkginclude_path(const char *my_exec_path, char *ret_path);
+extern void get_includeserver_path(const char *my_exec_path, char *ret_path);
+extern void get_lib_path(const char *my_exec_path, char *ret_path);
+extern void get_pkglib_path(const char *my_exec_path, char *ret_path);
+extern void get_locale_path(const char *my_exec_path, char *ret_path);
+extern void get_doc_path(const char *my_exec_path, char *ret_path);
+extern void get_html_path(const char *my_exec_path, char *ret_path);
+extern void get_man_path(const char *my_exec_path, char *ret_path);
+extern bool get_home_path(char *ret_path);
+extern void get_parent_directory(char *path);
+
+/* common/pgfnames.c */
+extern char **pgfnames(const char *path);
+extern void pgfnames_cleanup(char **filenames);
+
+/*
+ *	is_absolute_path
+ *
+ *	By making this a macro we avoid needing to include path.c in libpq.
+ */
+#ifndef WIN32
+#define IS_DIR_SEP(ch)	((ch) == '/')
+
+#define is_absolute_path(filename) \
+( \
+	IS_DIR_SEP((filename)[0]) \
+)
+#else
+#define IS_DIR_SEP(ch)	((ch) == '/' || (ch) == '\\')
+
+/* See path_is_relative_and_below_cwd() for how we handle 'E:abc'. */
+#define is_absolute_path(filename) \
+( \
+	IS_DIR_SEP((filename)[0]) || \
+	(isalpha((unsigned char) ((filename)[0])) && (filename)[1] == ':' && \
+	 IS_DIR_SEP((filename)[2])) \
+)
+#endif
+
+/* Portable locale initialization (in exec.c) */
+extern void set_pglocale_pgservice(const char *argv0, const char *app);
+
+/* Portable way to find binaries (in exec.c) */
+extern int	find_my_exec(const char *argv0, char *retpath);
+extern int find_other_exec(const char *argv0, const char *target,
+				const char *versionstr, char *retpath);
+
+/* Windows security token manipulation (in exec.c) */
+#ifdef WIN32
+extern BOOL AddUserToTokenDacl(HANDLE hToken);
+#endif
+
+
+#if defined(WIN32) || defined(__CYGWIN__)
+#define EXE ".exe"
+#else
+#define EXE ""
+#endif
+
+#if defined(WIN32) && !defined(__CYGWIN__)
+#define DEVNULL "nul"
+#else
+#define DEVNULL "/dev/null"
+#endif
+
+/* Portable delay handling */
+extern void pg_usleep(long microsec);
+
+/* Portable SQL-like case-independent comparisons and conversions */
+extern int	pg_strcasecmp(const char *s1, const char *s2);
+extern int	pg_strncasecmp(const char *s1, const char *s2, size_t n);
+extern unsigned char pg_toupper(unsigned char ch);
+extern unsigned char pg_tolower(unsigned char ch);
+extern unsigned char pg_ascii_toupper(unsigned char ch);
+extern unsigned char pg_ascii_tolower(unsigned char ch);
+
+#ifdef USE_REPL_SNPRINTF
+
+/*
+ * Versions of libintl >= 0.13 try to replace printf() and friends with
+ * macros to their own versions that understand the %$ format.  We do the
+ * same, so disable their macros, if they exist.
+ */
+#ifdef vsnprintf
+#undef vsnprintf
+#endif
+#ifdef snprintf
+#undef snprintf
+#endif
+#ifdef sprintf
+#undef sprintf
+#endif
+#ifdef vfprintf
+#undef vfprintf
+#endif
+#ifdef fprintf
+#undef fprintf
+#endif
+#ifdef printf
+#undef printf
+#endif
+
+extern int	pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
+extern int	pg_snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3, 4);
+extern int	pg_sprintf(char *str, const char *fmt,...) pg_attribute_printf(2, 3);
+extern int	pg_vfprintf(FILE *stream, const char *fmt, va_list args);
+extern int	pg_fprintf(FILE *stream, const char *fmt,...) pg_attribute_printf(2, 3);
+extern int	pg_printf(const char *fmt,...) pg_attribute_printf(1, 2);
+
+/*
+ *	The GCC-specific code below prevents the pg_attribute_printf above from
+ *	being replaced, and this is required because gcc doesn't know anything
+ *	about pg_printf.
+ */
+#ifdef __GNUC__
+#define vsnprintf(...)	pg_vsnprintf(__VA_ARGS__)
+#define snprintf(...)	pg_snprintf(__VA_ARGS__)
+#define sprintf(...)	pg_sprintf(__VA_ARGS__)
+#define vfprintf(...)	pg_vfprintf(__VA_ARGS__)
+#define fprintf(...)	pg_fprintf(__VA_ARGS__)
+#define printf(...)		pg_printf(__VA_ARGS__)
+#else
+#define vsnprintf		pg_vsnprintf
+#define snprintf		pg_snprintf
+#define sprintf			pg_sprintf
+#define vfprintf		pg_vfprintf
+#define fprintf			pg_fprintf
+#define printf			pg_printf
+#endif
+#endif   /* USE_REPL_SNPRINTF */
+
+#if defined(WIN32)
+/*
+ * Versions of libintl >= 0.18? try to replace setlocale() with a macro
+ * to their own versions.  Remove the macro, if it exists, because it
+ * ends up calling the wrong version when the backend and libintl use
+ * different versions of msvcrt.
+ */
+#if defined(setlocale)
+#undef setlocale
+#endif
+
+/*
+ * Define our own wrapper macro around setlocale() to work around bugs in
+ * Windows' native setlocale() function.
+ */
+extern char *pgwin32_setlocale(int category, const char *locale);
+
+#define setlocale(a,b) pgwin32_setlocale(a,b)
+#endif   /* WIN32 */
+
+/* Portable prompt handling */
+extern char *simple_prompt(const char *prompt, int maxlen, bool echo);
+
+#ifdef WIN32
+#define PG_SIGNAL_COUNT 32
+#define kill(pid,sig)	pgkill(pid,sig)
+extern int	pgkill(int pid, int sig);
+#endif
+
+extern int	pclose_check(FILE *stream);
+
+/* Global variable holding time zone information. */
+#ifndef __CYGWIN__
+#define TIMEZONE_GLOBAL timezone
+#define TZNAME_GLOBAL tzname
+#else
+#define TIMEZONE_GLOBAL _timezone
+#define TZNAME_GLOBAL _tzname
+#endif
+
+#if defined(WIN32) || defined(__CYGWIN__)
+/*
+ *	Win32 doesn't have reliable rename/unlink during concurrent access.
+ */
+extern int	pgrename(const char *from, const char *to);
+extern int	pgunlink(const char *path);
+
+/* Include this first so later includes don't see these defines */
+#ifdef WIN32_ONLY_COMPILER
+#include <io.h>
+#endif
+
+#define rename(from, to)		pgrename(from, to)
+#define unlink(path)			pgunlink(path)
+#endif   /* defined(WIN32) || defined(__CYGWIN__) */
+
+/*
+ *	Win32 also doesn't have symlinks, but we can emulate them with
+ *	junction points on newer Win32 versions.
+ *
+ *	Cygwin has its own symlinks which work on Win95/98/ME where
+ *	junction points don't, so use those instead.  We have no way of
+ *	knowing what type of system Cygwin binaries will be run on.
+ *		Note: Some CYGWIN includes might #define WIN32.
+ */
+#if defined(WIN32) && !defined(__CYGWIN__)
+extern int	pgsymlink(const char *oldpath, const char *newpath);
+extern int	pgreadlink(const char *path, char *buf, size_t size);
+extern bool pgwin32_is_junction(char *path);
+
+#define symlink(oldpath, newpath)	pgsymlink(oldpath, newpath)
+#define readlink(path, buf, size)	pgreadlink(path, buf, size)
+#endif
+
+extern bool rmtree(const char *path, bool rmtopdir);
+
+/*
+ * stat() is not guaranteed to set the st_size field on win32, so we
+ * redefine it to our own implementation that is.
+ *
+ * We must pull in sys/stat.h here so the system header definition
+ * goes in first, and we redefine that, and not the other way around.
+ *
+ * Some frontends don't need the size from stat, so if UNSAFE_STAT_OK
+ * is defined we don't bother with this.
+ */
+#if defined(WIN32) && !defined(__CYGWIN__) && !defined(UNSAFE_STAT_OK)
+#include <sys/stat.h>
+extern int	pgwin32_safestat(const char *path, struct stat * buf);
+
+#define stat(a,b) pgwin32_safestat(a,b)
+#endif
+
+#if defined(WIN32) && !defined(__CYGWIN__)
+
+/*
+ * open() and fopen() replacements to allow deletion of open files and
+ * passing of other special options.
+ */
+#define		O_DIRECT	0x80000000
+extern int	pgwin32_open(const char *, int,...);
+extern FILE *pgwin32_fopen(const char *, const char *);
+
+#ifndef FRONTEND
+#define		open(a,b,c) pgwin32_open(a,b,c)
+#define		fopen(a,b) pgwin32_fopen(a,b)
+#endif
+
+/*
+ * Mingw-w64 headers #define popen and pclose to _popen and _pclose.  We want
+ * to use our popen wrapper, rather than plain _popen, so override that.  For
+ * consistency, use our version of pclose, too.
+ */
+#ifdef popen
+#undef popen
+#endif
+#ifdef pclose
+#undef pclose
+#endif
+
+/*
+ * system() and popen() replacements to enclose the command in an extra
+ * pair of quotes.
+ */
+extern int	pgwin32_system(const char *command);
+extern FILE *pgwin32_popen(const char *command, const char *type);
+
+#define system(a) pgwin32_system(a)
+#define popen(a,b) pgwin32_popen(a,b)
+#define pclose(a) _pclose(a)
+
+/* New versions of MingW have gettimeofday, old mingw and msvc don't */
+#ifndef HAVE_GETTIMEOFDAY
+/* Last parameter not used */
+extern int	gettimeofday(struct timeval * tp, struct timezone * tzp);
+#endif
+#else							/* !WIN32 */
+
+/*
+ *	Win32 requires a special close for sockets and pipes, while on Unix
+ *	close() does them all.
+ */
+#define closesocket close
+#endif   /* WIN32 */
+
+/*
+ * On Windows, setvbuf() does not support _IOLBF mode, and interprets that
+ * as _IOFBF.  To add insult to injury, setvbuf(file, NULL, _IOFBF, 0)
+ * crashes outright if "parameter validation" is enabled.  Therefore, in
+ * places where we'd like to select line-buffered mode, we fall back to
+ * unbuffered mode instead on Windows.  Always use PG_IOLBF not _IOLBF
+ * directly in order to implement this behavior.
+ */
+#ifndef WIN32
+#define PG_IOLBF	_IOLBF
+#else
+#define PG_IOLBF	_IONBF
+#endif
+
+/*
+ * Default "extern" declarations or macro substitutes for library routines.
+ * When necessary, these routines are provided by files in src/port/.
+ */
+#ifndef HAVE_CRYPT
+extern char *crypt(const char *key, const char *setting);
+#endif
+
+/* WIN32 handled in port/win32.h */
+#ifndef WIN32
+#define pgoff_t off_t
+#ifdef __NetBSD__
+extern int	fseeko(FILE *stream, off_t offset, int whence);
+extern off_t ftello(FILE *stream);
+#endif
+#endif
+
+extern double pg_erand48(unsigned short xseed[3]);
+extern long pg_lrand48(void);
+extern void pg_srand48(long seed);
+
+#ifndef HAVE_FLS
+extern int	fls(int mask);
+#endif
+
+#ifndef HAVE_FSEEKO
+#define fseeko(a, b, c) fseek(a, b, c)
+#define ftello(a)		ftell(a)
+#endif
+
+#if !defined(HAVE_GETPEEREID) && !defined(WIN32)
+extern int	getpeereid(int sock, uid_t *uid, gid_t *gid);
+#endif
+
+#ifndef HAVE_ISINF
+extern int	isinf(double x);
+#endif
+
+#ifndef HAVE_MKDTEMP
+extern char *mkdtemp(char *path);
+#endif
+
+#ifndef HAVE_RINT
+extern double rint(double x);
+#endif
+
+#ifndef HAVE_INET_ATON
+#include <netinet/in.h>
+#include <arpa/inet.h>
+extern int	inet_aton(const char *cp, struct in_addr * addr);
+#endif
+
+#if !HAVE_DECL_STRLCAT
+extern size_t strlcat(char *dst, const char *src, size_t siz);
+#endif
+
+#if !HAVE_DECL_STRLCPY
+extern size_t strlcpy(char *dst, const char *src, size_t siz);
+#endif
+
+#if !defined(HAVE_RANDOM) && !defined(__BORLANDC__)
+extern long random(void);
+#endif
+
+#ifndef HAVE_UNSETENV
+extern void unsetenv(const char *name);
+#endif
+
+#ifndef HAVE_SRANDOM
+extern void srandom(unsigned int seed);
+#endif
+
+#ifndef HAVE_SSL_GET_CURRENT_COMPRESSION
+#define SSL_get_current_compression(x) 0
+#endif
+
+/* thread.h */
+extern char *pqStrerror(int errnum, char *strerrbuf, size_t buflen);
+
+#ifndef WIN32
+extern int pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer,
+		   size_t buflen, struct passwd ** result);
+#endif
+
+extern int pqGethostbyname(const char *name,
+				struct hostent * resultbuf,
+				char *buffer, size_t buflen,
+				struct hostent ** result,
+				int *herrno);
+
+extern void pg_qsort(void *base, size_t nel, size_t elsize,
+		 int (*cmp) (const void *, const void *));
+extern int	pg_qsort_strcmp(const void *a, const void *b);
+
+#define qsort(a,b,c,d) pg_qsort(a,b,c,d)
+
+typedef int (*qsort_arg_comparator) (const void *a, const void *b, void *arg);
+
+extern void qsort_arg(void *base, size_t nel, size_t elsize,
+		  qsort_arg_comparator cmp, void *arg);
+
+/* port/chklocale.c */
+extern int	pg_get_encoding_from_locale(const char *ctype, bool write_message);
+
+#if defined(WIN32) && !defined(FRONTEND)
+extern int	pg_codepage_to_encoding(UINT cp);
+#endif
+
+/* port/inet_net_ntop.c */
+extern char *inet_net_ntop(int af, const void *src, int bits,
+			  char *dst, size_t size);
+
+/* port/pgcheckdir.c */
+extern int	pg_check_dir(const char *dir);
+
+/* port/pgmkdirp.c */
+extern int	pg_mkdir_p(char *path, int omode);
+
+/* port/pqsignal.c */
+typedef void (*pqsigfunc) (int signo);
+extern pqsigfunc pqsignal(int signo, pqsigfunc func);
+
+/* port/quotes.c */
+extern char *escape_single_quotes_ascii(const char *src);
+
+/* port/wait_error.c */
+extern char *wait_result_to_str(int exit_status);
+
+#endif   /* PG_PORT_H */
diff --git a/foreign/libpg_query/src/postgres/include/port/atomics.h b/foreign/libpg_query/src/postgres/include/port/atomics.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/port/atomics.h
@@ -0,0 +1,537 @@
+/*-------------------------------------------------------------------------
+ *
+ * atomics.h
+ *	  Atomic operations.
+ *
+ * Hardware and compiler dependent functions for manipulating memory
+ * atomically and dealing with cache coherency. Used to implement locking
+ * facilities and lockless algorithms/data structures.
+ *
+ * To bring up postgres on a platform/compiler at the very least
+ * implementations for the following operations should be provided:
+ * * pg_compiler_barrier(), pg_write_barrier(), pg_read_barrier()
+ * * pg_atomic_compare_exchange_u32(), pg_atomic_fetch_add_u32()
+ * * pg_atomic_test_set_flag(), pg_atomic_init_flag(), pg_atomic_clear_flag()
+ *
+ * There exist generic, hardware independent, implementations for several
+ * compilers which might be sufficient, although possibly not optimal, for a
+ * new platform. If no such generic implementation is available spinlocks (or
+ * even OS provided semaphores) will be used to implement the API.
+ *
+ * Implement the _u64 variants if and only if your platform can use them
+ * efficiently (and obviously correctly).
+ *
+ * Use higher level functionality (lwlocks, spinlocks, heavyweight locks)
+ * whenever possible. Writing correct code using these facilities is hard.
+ *
+ * For an introduction to using memory barriers within the PostgreSQL backend,
+ * see src/backend/storage/lmgr/README.barrier
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/port/atomics.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef ATOMICS_H
+#define ATOMICS_H
+
+#define INSIDE_ATOMICS_H
+
+#include <limits.h>
+
+/*
+ * First a set of architecture specific files is included.
+ *
+ * These files can provide the full set of atomics or can do pretty much
+ * nothing if all the compilers commonly used on these platforms provide
+ * usable generics.
+ *
+ * Don't add an inline assembly of the actual atomic operations if all the
+ * common implementations of your platform provide intrinsics. Intrinsics are
+ * much easier to understand and potentially support more architectures.
+ *
+ * It will often make sense to define memory barrier semantics here, since
+ * e.g. generic compiler intrinsics for x86 memory barriers can't know that
+ * postgres doesn't need x86 read/write barriers do anything more than a
+ * compiler barrier.
+ *
+ */
+#if defined(__arm__) || defined(__arm) || \
+	defined(__aarch64__) || defined(__aarch64)
+#include "port/atomics/arch-arm.h"
+#elif defined(__i386__) || defined(__i386) || defined(__x86_64__)
+#include "port/atomics/arch-x86.h"
+#elif defined(__ia64__) || defined(__ia64)
+#include "port/atomics/arch-ia64.h"
+#elif defined(__ppc__) || defined(__powerpc__) || defined(__ppc64__) || defined(__powerpc64__)
+#include "port/atomics/arch-ppc.h"
+#elif defined(__hppa) || defined(__hppa__)
+#include "port/atomics/arch-hppa.h"
+#endif
+
+/*
+ * Compiler specific, but architecture independent implementations.
+ *
+ * Provide architecture independent implementations of the atomic
+ * facilities. At the very least compiler barriers should be provided, but a
+ * full implementation of
+ * * pg_compiler_barrier(), pg_write_barrier(), pg_read_barrier()
+ * * pg_atomic_compare_exchange_u32(), pg_atomic_fetch_add_u32()
+ * using compiler intrinsics are a good idea.
+ */
+/*
+ * Given a gcc-compatible xlc compiler, prefer the xlc implementation.  The
+ * ppc64le "IBM XL C/C++ for Linux, V13.1.2" implements both interfaces, but
+ * __sync_lock_test_and_set() of one-byte types elicits SIGSEGV.
+ */
+#if defined(__IBMC__) || defined(__IBMCPP__)
+#include "port/atomics/generic-xlc.h"
+/* gcc or compatible, including clang and icc */
+#elif defined(__GNUC__) || defined(__INTEL_COMPILER)
+#include "port/atomics/generic-gcc.h"
+#elif defined(WIN32_ONLY_COMPILER)
+#include "port/atomics/generic-msvc.h"
+#elif defined(__hpux) && defined(__ia64) && !defined(__GNUC__)
+#include "port/atomics/generic-acc.h"
+#elif defined(__SUNPRO_C) && !defined(__GNUC__)
+#include "port/atomics/generic-sunpro.h"
+#else
+/*
+ * Unsupported compiler, we'll likely use slower fallbacks... At least
+ * compiler barriers should really be provided.
+ */
+#endif
+
+/*
+ * Provide a full fallback of the pg_*_barrier(), pg_atomic**_flag and
+ * pg_atomic_*_u32 APIs for platforms without sufficient spinlock and/or
+ * atomics support. In the case of spinlock backed atomics the emulation is
+ * expected to be efficient, although less so than native atomics support.
+ */
+#include "port/atomics/fallback.h"
+
+/*
+ * Provide additional operations using supported infrastructure. These are
+ * expected to be efficient if the underlying atomic operations are efficient.
+ */
+#include "port/atomics/generic.h"
+
+/*
+ * Provide declarations for all functions here - on most platforms static
+ * inlines are used and these aren't necessary, but when static inline is
+ * unsupported these will be external functions.
+ */
+STATIC_IF_INLINE_DECLARE void pg_atomic_init_flag(volatile pg_atomic_flag *ptr);
+STATIC_IF_INLINE_DECLARE bool pg_atomic_test_set_flag(volatile pg_atomic_flag *ptr);
+STATIC_IF_INLINE_DECLARE bool pg_atomic_unlocked_test_flag(volatile pg_atomic_flag *ptr);
+STATIC_IF_INLINE_DECLARE void pg_atomic_clear_flag(volatile pg_atomic_flag *ptr);
+
+STATIC_IF_INLINE_DECLARE void pg_atomic_init_u32(volatile pg_atomic_uint32 *ptr, uint32 val);
+STATIC_IF_INLINE_DECLARE uint32 pg_atomic_read_u32(volatile pg_atomic_uint32 *ptr);
+STATIC_IF_INLINE_DECLARE void pg_atomic_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val);
+STATIC_IF_INLINE_DECLARE uint32 pg_atomic_exchange_u32(volatile pg_atomic_uint32 *ptr, uint32 newval);
+STATIC_IF_INLINE_DECLARE bool pg_atomic_compare_exchange_u32(volatile pg_atomic_uint32 *ptr,
+							   uint32 *expected, uint32 newval);
+STATIC_IF_INLINE_DECLARE uint32 pg_atomic_fetch_add_u32(volatile pg_atomic_uint32 *ptr, int32 add_);
+STATIC_IF_INLINE_DECLARE uint32 pg_atomic_fetch_sub_u32(volatile pg_atomic_uint32 *ptr, int32 sub_);
+STATIC_IF_INLINE_DECLARE uint32 pg_atomic_fetch_and_u32(volatile pg_atomic_uint32 *ptr, uint32 and_);
+STATIC_IF_INLINE_DECLARE uint32 pg_atomic_fetch_or_u32(volatile pg_atomic_uint32 *ptr, uint32 or_);
+STATIC_IF_INLINE_DECLARE uint32 pg_atomic_add_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 add_);
+STATIC_IF_INLINE_DECLARE uint32 pg_atomic_sub_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 sub_);
+
+#ifdef PG_HAVE_ATOMIC_U64_SUPPORT
+
+STATIC_IF_INLINE_DECLARE void pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val_);
+STATIC_IF_INLINE_DECLARE uint64 pg_atomic_read_u64(volatile pg_atomic_uint64 *ptr);
+STATIC_IF_INLINE_DECLARE void pg_atomic_write_u64(volatile pg_atomic_uint64 *ptr, uint64 val);
+STATIC_IF_INLINE_DECLARE uint64 pg_atomic_exchange_u64(volatile pg_atomic_uint64 *ptr, uint64 newval);
+STATIC_IF_INLINE_DECLARE bool pg_atomic_compare_exchange_u64(volatile pg_atomic_uint64 *ptr,
+							   uint64 *expected, uint64 newval);
+STATIC_IF_INLINE_DECLARE uint64 pg_atomic_fetch_add_u64(volatile pg_atomic_uint64 *ptr, int64 add_);
+STATIC_IF_INLINE_DECLARE uint64 pg_atomic_fetch_sub_u64(volatile pg_atomic_uint64 *ptr, int64 sub_);
+STATIC_IF_INLINE_DECLARE uint64 pg_atomic_fetch_and_u64(volatile pg_atomic_uint64 *ptr, uint64 and_);
+STATIC_IF_INLINE_DECLARE uint64 pg_atomic_fetch_or_u64(volatile pg_atomic_uint64 *ptr, uint64 or_);
+STATIC_IF_INLINE_DECLARE uint64 pg_atomic_add_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 add_);
+STATIC_IF_INLINE_DECLARE uint64 pg_atomic_sub_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 sub_);
+
+#endif   /* PG_HAVE_64_BIT_ATOMICS */
+
+
+/*
+ * pg_compiler_barrier - prevent the compiler from moving code across
+ *
+ * A compiler barrier need not (and preferably should not) emit any actual
+ * machine code, but must act as an optimization fence: the compiler must not
+ * reorder loads or stores to main memory around the barrier.  However, the
+ * CPU may still reorder loads or stores at runtime, if the architecture's
+ * memory model permits this.
+ */
+#define pg_compiler_barrier()	pg_compiler_barrier_impl()
+
+/*
+ * pg_memory_barrier - prevent the CPU from reordering memory access
+ *
+ * A memory barrier must act as a compiler barrier, and in addition must
+ * guarantee that all loads and stores issued prior to the barrier are
+ * completed before any loads or stores issued after the barrier.  Unless
+ * loads and stores are totally ordered (which is not the case on most
+ * architectures) this requires issuing some sort of memory fencing
+ * instruction.
+ */
+#define pg_memory_barrier() pg_memory_barrier_impl()
+
+/*
+ * pg_(read|write)_barrier - prevent the CPU from reordering memory access
+ *
+ * A read barrier must act as a compiler barrier, and in addition must
+ * guarantee that any loads issued prior to the barrier are completed before
+ * any loads issued after the barrier.  Similarly, a write barrier acts
+ * as a compiler barrier, and also orders stores.  Read and write barriers
+ * are thus weaker than a full memory barrier, but stronger than a compiler
+ * barrier.  In practice, on machines with strong memory ordering, read and
+ * write barriers may require nothing more than a compiler barrier.
+ */
+#define pg_read_barrier()	pg_read_barrier_impl()
+#define pg_write_barrier()	pg_write_barrier_impl()
+
+/*
+ * Spinloop delay - Allow CPU to relax in busy loops
+ */
+#define pg_spin_delay() pg_spin_delay_impl()
+
+/*
+ * The following functions are wrapper functions around the platform specific
+ * implementation of the atomic operations performing common checks.
+ */
+#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
+
+/*
+ * pg_atomic_init_flag - initialize atomic flag.
+ *
+ * No barrier semantics.
+ */
+STATIC_IF_INLINE_DECLARE void
+pg_atomic_init_flag(volatile pg_atomic_flag *ptr)
+{
+	AssertPointerAlignment(ptr, sizeof(*ptr));
+
+	pg_atomic_init_flag_impl(ptr);
+}
+
+/*
+ * pg_atomic_test_and_set_flag - TAS()
+ *
+ * Returns true if the flag has successfully been set, false otherwise.
+ *
+ * Acquire (including read barrier) semantics.
+ */
+STATIC_IF_INLINE_DECLARE bool
+pg_atomic_test_set_flag(volatile pg_atomic_flag *ptr)
+{
+	AssertPointerAlignment(ptr, sizeof(*ptr));
+
+	return pg_atomic_test_set_flag_impl(ptr);
+}
+
+/*
+ * pg_atomic_unlocked_test_flag - Check if the lock is free
+ *
+ * Returns true if the flag currently is not set, false otherwise.
+ *
+ * No barrier semantics.
+ */
+STATIC_IF_INLINE_DECLARE bool
+pg_atomic_unlocked_test_flag(volatile pg_atomic_flag *ptr)
+{
+	AssertPointerAlignment(ptr, sizeof(*ptr));
+
+	return pg_atomic_unlocked_test_flag_impl(ptr);
+}
+
+/*
+ * pg_atomic_clear_flag - release lock set by TAS()
+ *
+ * Release (including write barrier) semantics.
+ */
+STATIC_IF_INLINE_DECLARE void
+pg_atomic_clear_flag(volatile pg_atomic_flag *ptr)
+{
+	AssertPointerAlignment(ptr, sizeof(*ptr));
+
+	pg_atomic_clear_flag_impl(ptr);
+}
+
+
+/*
+ * pg_atomic_init_u32 - initialize atomic variable
+ *
+ * Has to be done before any concurrent usage..
+ *
+ * No barrier semantics.
+ */
+STATIC_IF_INLINE_DECLARE void
+pg_atomic_init_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
+{
+	AssertPointerAlignment(ptr, 4);
+
+	pg_atomic_init_u32_impl(ptr, val);
+}
+
+/*
+ * pg_atomic_read_u32 - unlocked read from atomic variable.
+ *
+ * The read is guaranteed to return a value as it has been written by this or
+ * another process at some point in the past. There's however no cache
+ * coherency interaction guaranteeing the value hasn't since been written to
+ * again.
+ *
+ * No barrier semantics.
+ */
+STATIC_IF_INLINE uint32
+pg_atomic_read_u32(volatile pg_atomic_uint32 *ptr)
+{
+	AssertPointerAlignment(ptr, 4);
+	return pg_atomic_read_u32_impl(ptr);
+}
+
+/*
+ * pg_atomic_write_u32 - unlocked write to atomic variable.
+ *
+ * The write is guaranteed to succeed as a whole, i.e. it's not possible to
+ * observe a partial write for any reader.
+ *
+ * No barrier semantics.
+ */
+STATIC_IF_INLINE_DECLARE void
+pg_atomic_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
+{
+	AssertPointerAlignment(ptr, 4);
+
+	pg_atomic_write_u32_impl(ptr, val);
+}
+
+/*
+ * pg_atomic_exchange_u32 - exchange newval with current value
+ *
+ * Returns the old value of 'ptr' before the swap.
+ *
+ * Full barrier semantics.
+ */
+STATIC_IF_INLINE uint32
+pg_atomic_exchange_u32(volatile pg_atomic_uint32 *ptr, uint32 newval)
+{
+	AssertPointerAlignment(ptr, 4);
+
+	return pg_atomic_exchange_u32_impl(ptr, newval);
+}
+
+/*
+ * pg_atomic_compare_exchange_u32 - CAS operation
+ *
+ * Atomically compare the current value of ptr with *expected and store newval
+ * iff ptr and *expected have the same value. The current value of *ptr will
+ * always be stored in *expected.
+ *
+ * Return true if values have been exchanged, false otherwise.
+ *
+ * Full barrier semantics.
+ */
+STATIC_IF_INLINE bool
+pg_atomic_compare_exchange_u32(volatile pg_atomic_uint32 *ptr,
+							   uint32 *expected, uint32 newval)
+{
+	AssertPointerAlignment(ptr, 4);
+	AssertPointerAlignment(expected, 4);
+
+	return pg_atomic_compare_exchange_u32_impl(ptr, expected, newval);
+}
+
+/*
+ * pg_atomic_fetch_add_u32 - atomically add to variable
+ *
+ * Returns the value of ptr before the arithmetic operation.
+ *
+ * Full barrier semantics.
+ */
+STATIC_IF_INLINE uint32
+pg_atomic_fetch_add_u32(volatile pg_atomic_uint32 *ptr, int32 add_)
+{
+	AssertPointerAlignment(ptr, 4);
+	return pg_atomic_fetch_add_u32_impl(ptr, add_);
+}
+
+/*
+ * pg_atomic_fetch_sub_u32 - atomically subtract from variable
+ *
+ * Returns the value of ptr before the arithmetic operation. Note that sub_
+ * may not be INT_MIN due to platform limitations.
+ *
+ * Full barrier semantics.
+ */
+STATIC_IF_INLINE uint32
+pg_atomic_fetch_sub_u32(volatile pg_atomic_uint32 *ptr, int32 sub_)
+{
+	AssertPointerAlignment(ptr, 4);
+	Assert(sub_ != INT_MIN);
+	return pg_atomic_fetch_sub_u32_impl(ptr, sub_);
+}
+
+/*
+ * pg_atomic_fetch_and_u32 - atomically bit-and and_ with variable
+ *
+ * Returns the value of ptr before the arithmetic operation.
+ *
+ * Full barrier semantics.
+ */
+STATIC_IF_INLINE uint32
+pg_atomic_fetch_and_u32(volatile pg_atomic_uint32 *ptr, uint32 and_)
+{
+	AssertPointerAlignment(ptr, 4);
+	return pg_atomic_fetch_and_u32_impl(ptr, and_);
+}
+
+/*
+ * pg_atomic_fetch_or_u32 - atomically bit-or or_ with variable
+ *
+ * Returns the value of ptr before the arithmetic operation.
+ *
+ * Full barrier semantics.
+ */
+STATIC_IF_INLINE uint32
+pg_atomic_fetch_or_u32(volatile pg_atomic_uint32 *ptr, uint32 or_)
+{
+	AssertPointerAlignment(ptr, 4);
+	return pg_atomic_fetch_or_u32_impl(ptr, or_);
+}
+
+/*
+ * pg_atomic_add_fetch_u32 - atomically add to variable
+ *
+ * Returns the value of ptr after the arithmetic operation.
+ *
+ * Full barrier semantics.
+ */
+STATIC_IF_INLINE uint32
+pg_atomic_add_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 add_)
+{
+	AssertPointerAlignment(ptr, 4);
+	return pg_atomic_add_fetch_u32_impl(ptr, add_);
+}
+
+/*
+ * pg_atomic_sub_fetch_u32 - atomically subtract from variable
+ *
+ * Returns the value of ptr after the arithmetic operation. Note that sub_ may
+ * not be INT_MIN due to platform limitations.
+ *
+ * Full barrier semantics.
+ */
+STATIC_IF_INLINE uint32
+pg_atomic_sub_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 sub_)
+{
+	AssertPointerAlignment(ptr, 4);
+	Assert(sub_ != INT_MIN);
+	return pg_atomic_sub_fetch_u32_impl(ptr, sub_);
+}
+
+/* ----
+ * The 64 bit operations have the same semantics as their 32bit counterparts
+ * if they are available. Check the corresponding 32bit function for
+ * documentation.
+ * ----
+ */
+#ifdef PG_HAVE_ATOMIC_U64_SUPPORT
+
+STATIC_IF_INLINE_DECLARE void
+pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
+{
+	AssertPointerAlignment(ptr, 8);
+
+	pg_atomic_init_u64_impl(ptr, val);
+}
+
+STATIC_IF_INLINE uint64
+pg_atomic_read_u64(volatile pg_atomic_uint64 *ptr)
+{
+	AssertPointerAlignment(ptr, 8);
+	return pg_atomic_read_u64_impl(ptr);
+}
+
+STATIC_IF_INLINE void
+pg_atomic_write_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
+{
+	AssertPointerAlignment(ptr, 8);
+	pg_atomic_write_u64_impl(ptr, val);
+}
+
+STATIC_IF_INLINE uint64
+pg_atomic_exchange_u64(volatile pg_atomic_uint64 *ptr, uint64 newval)
+{
+	AssertPointerAlignment(ptr, 8);
+
+	return pg_atomic_exchange_u64_impl(ptr, newval);
+}
+
+STATIC_IF_INLINE bool
+pg_atomic_compare_exchange_u64(volatile pg_atomic_uint64 *ptr,
+							   uint64 *expected, uint64 newval)
+{
+	AssertPointerAlignment(ptr, 8);
+	AssertPointerAlignment(expected, 8);
+	return pg_atomic_compare_exchange_u64_impl(ptr, expected, newval);
+}
+
+STATIC_IF_INLINE uint64
+pg_atomic_fetch_add_u64(volatile pg_atomic_uint64 *ptr, int64 add_)
+{
+	AssertPointerAlignment(ptr, 8);
+	return pg_atomic_fetch_add_u64_impl(ptr, add_);
+}
+
+STATIC_IF_INLINE uint64
+pg_atomic_fetch_sub_u64(volatile pg_atomic_uint64 *ptr, int64 sub_)
+{
+	AssertPointerAlignment(ptr, 8);
+	Assert(sub_ != PG_INT64_MIN);
+	return pg_atomic_fetch_sub_u64_impl(ptr, sub_);
+}
+
+STATIC_IF_INLINE uint64
+pg_atomic_fetch_and_u64(volatile pg_atomic_uint64 *ptr, uint64 and_)
+{
+	AssertPointerAlignment(ptr, 8);
+	return pg_atomic_fetch_and_u64_impl(ptr, and_);
+}
+
+STATIC_IF_INLINE uint64
+pg_atomic_fetch_or_u64(volatile pg_atomic_uint64 *ptr, uint64 or_)
+{
+	AssertPointerAlignment(ptr, 8);
+	return pg_atomic_fetch_or_u64_impl(ptr, or_);
+}
+
+STATIC_IF_INLINE uint64
+pg_atomic_add_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 add_)
+{
+	AssertPointerAlignment(ptr, 8);
+	return pg_atomic_add_fetch_u64_impl(ptr, add_);
+}
+
+STATIC_IF_INLINE uint64
+pg_atomic_sub_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 sub_)
+{
+	AssertPointerAlignment(ptr, 8);
+	Assert(sub_ != PG_INT64_MIN);
+	return pg_atomic_sub_fetch_u64_impl(ptr, sub_);
+}
+
+#endif   /* PG_HAVE_64_BIT_ATOMICS */
+
+#endif   /* defined(PG_USE_INLINE) ||
+								 * defined(ATOMICS_INCLUDE_DEFINITIONS) */
+
+#undef INSIDE_ATOMICS_H
+
+#endif   /* ATOMICS_H */
diff --git a/foreign/libpg_query/src/postgres/include/port/atomics/arch-x86.h b/foreign/libpg_query/src/postgres/include/port/atomics/arch-x86.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/port/atomics/arch-x86.h
@@ -0,0 +1,255 @@
+/*-------------------------------------------------------------------------
+ *
+ * arch-x86.h
+ *	  Atomic operations considerations specific to intel x86
+ *
+ * Note that we actually require a 486 upwards because the 386 doesn't have
+ * support for xadd and cmpxchg. Given that the 386 isn't supported anywhere
+ * anymore that's not much of restriction luckily.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * NOTES:
+ *
+ * src/include/port/atomics/arch-x86.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/*
+ * Both 32 and 64 bit x86 do not allow loads to be reordered with other loads,
+ * or stores to be reordered with other stores, but a load can be performed
+ * before a subsequent store.
+ *
+ * Technically, some x86-ish chips support uncached memory access and/or
+ * special instructions that are weakly ordered.  In those cases we'd need
+ * the read and write barriers to be lfence and sfence.  But since we don't
+ * do those things, a compiler barrier should be enough.
+ *
+ * "lock; addl" has worked for longer than "mfence". It's also rumored to be
+ * faster in many scenarios
+ */
+
+#if defined(__INTEL_COMPILER)
+#define pg_memory_barrier_impl()		_mm_mfence()
+#elif defined(__GNUC__) && (defined(__i386__) || defined(__i386))
+#define pg_memory_barrier_impl()		\
+	__asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory", "cc")
+#elif defined(__GNUC__) && defined(__x86_64__)
+#define pg_memory_barrier_impl()		\
+	__asm__ __volatile__ ("lock; addl $0,0(%%rsp)" : : : "memory", "cc")
+#endif
+
+#define pg_read_barrier_impl()		pg_compiler_barrier_impl()
+#define pg_write_barrier_impl()		pg_compiler_barrier_impl()
+
+/*
+ * Provide implementation for atomics using inline assembly on x86 gcc. It's
+ * nice to support older gcc's and the compare/exchange implementation here is
+ * actually more efficient than the * __sync variant.
+ */
+#if defined(HAVE_ATOMICS)
+
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
+
+#define PG_HAVE_ATOMIC_FLAG_SUPPORT
+typedef struct pg_atomic_flag
+{
+	volatile char value;
+} pg_atomic_flag;
+
+#define PG_HAVE_ATOMIC_U32_SUPPORT
+typedef struct pg_atomic_uint32
+{
+	volatile uint32 value;
+} pg_atomic_uint32;
+
+/*
+ * It's too complicated to write inline asm for 64bit types on 32bit and the
+ * 486 can't do it.
+ */
+#ifdef __x86_64__
+#define PG_HAVE_ATOMIC_U64_SUPPORT
+typedef struct pg_atomic_uint64
+{
+	/* alignment guaranteed due to being on a 64bit platform */
+	volatile uint64 value;
+} pg_atomic_uint64;
+#endif
+
+#endif /* defined(HAVE_ATOMICS) */
+
+#endif /* defined(__GNUC__) && !defined(__INTEL_COMPILER) */
+
+#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
+
+#if !defined(PG_HAVE_SPIN_DELAY)
+/*
+ * This sequence is equivalent to the PAUSE instruction ("rep" is
+ * ignored by old IA32 processors if the following instruction is
+ * not a string operation); the IA-32 Architecture Software
+ * Developer's Manual, Vol. 3, Section 7.7.2 describes why using
+ * PAUSE in the inner loop of a spin lock is necessary for good
+ * performance:
+ *
+ *     The PAUSE instruction improves the performance of IA-32
+ *     processors supporting Hyper-Threading Technology when
+ *     executing spin-wait loops and other routines where one
+ *     thread is accessing a shared lock or semaphore in a tight
+ *     polling loop. When executing a spin-wait loop, the
+ *     processor can suffer a severe performance penalty when
+ *     exiting the loop because it detects a possible memory order
+ *     violation and flushes the core processor's pipeline. The
+ *     PAUSE instruction provides a hint to the processor that the
+ *     code sequence is a spin-wait loop. The processor uses this
+ *     hint to avoid the memory order violation and prevent the
+ *     pipeline flush. In addition, the PAUSE instruction
+ *     de-pipelines the spin-wait loop to prevent it from
+ *     consuming execution resources excessively.
+ */
+#if defined(__INTEL_COMPILER)
+#define PG_HAVE_SPIN_DELAY
+static inline
+pg_spin_delay_impl(void)
+{
+	_mm_pause();
+}
+#elif defined(__GNUC__)
+#define PG_HAVE_SPIN_DELAY
+static __inline__ void
+pg_spin_delay_impl(void)
+{
+	__asm__ __volatile__(
+		" rep; nop			\n");
+}
+#elif defined(WIN32_ONLY_COMPILER) && defined(__x86_64__)
+#define PG_HAVE_SPIN_DELAY
+static __forceinline void
+pg_spin_delay_impl(void)
+{
+	_mm_pause();
+}
+#elif defined(WIN32_ONLY_COMPILER)
+#define PG_HAVE_SPIN_DELAY
+static __forceinline void
+pg_spin_delay_impl(void)
+{
+	/* See comment for gcc code. Same code, MASM syntax */
+	__asm rep nop;
+}
+#endif
+#endif /* !defined(PG_HAVE_SPIN_DELAY) */
+
+
+#if defined(HAVE_ATOMICS)
+
+/* inline assembly implementation for gcc */
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
+
+#define PG_HAVE_ATOMIC_TEST_SET_FLAG
+static inline bool
+pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr)
+{
+	register char _res = 1;
+
+	__asm__ __volatile__(
+		"	lock			\n"
+		"	xchgb	%0,%1	\n"
+:		"+q"(_res), "+m"(ptr->value)
+:
+:		"memory");
+	return _res == 0;
+}
+
+#define PG_HAVE_ATOMIC_CLEAR_FLAG
+static inline void
+pg_atomic_clear_flag_impl(volatile pg_atomic_flag *ptr)
+{
+	/*
+	 * On a TSO architecture like x86 it's sufficient to use a compiler
+	 * barrier to achieve release semantics.
+	 */
+	__asm__ __volatile__("" ::: "memory");
+	ptr->value = 0;
+}
+
+#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32
+static inline bool
+pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr,
+									uint32 *expected, uint32 newval)
+{
+	char	ret;
+
+	/*
+	 * Perform cmpxchg and use the zero flag which it implicitly sets when
+	 * equal to measure the success.
+	 */
+	__asm__ __volatile__(
+		"	lock				\n"
+		"	cmpxchgl	%4,%5	\n"
+		"   setz		%2		\n"
+:		"=a" (*expected), "=m"(ptr->value), "=q" (ret)
+:		"a" (*expected), "r" (newval), "m"(ptr->value)
+:		"memory", "cc");
+	return (bool) ret;
+}
+
+#define PG_HAVE_ATOMIC_FETCH_ADD_U32
+static inline uint32
+pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_)
+{
+	uint32 res;
+	__asm__ __volatile__(
+		"	lock				\n"
+		"	xaddl	%0,%1		\n"
+:		"=q"(res), "=m"(ptr->value)
+:		"0" (add_), "m"(ptr->value)
+:		"memory", "cc");
+	return res;
+}
+
+#ifdef __x86_64__
+
+#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64
+static inline bool
+pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr,
+									uint64 *expected, uint64 newval)
+{
+	char	ret;
+
+	/*
+	 * Perform cmpxchg and use the zero flag which it implicitly sets when
+	 * equal to measure the success.
+	 */
+	__asm__ __volatile__(
+		"	lock				\n"
+		"	cmpxchgq	%4,%5	\n"
+		"   setz		%2		\n"
+:		"=a" (*expected), "=m"(ptr->value), "=q" (ret)
+:		"a" (*expected), "r" (newval), "m"(ptr->value)
+:		"memory", "cc");
+	return (bool) ret;
+}
+
+#define PG_HAVE_ATOMIC_FETCH_ADD_U64
+static inline uint64
+pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_)
+{
+	uint64 res;
+	__asm__ __volatile__(
+		"	lock				\n"
+		"	xaddq	%0,%1		\n"
+:		"=q"(res), "=m"(ptr->value)
+:		"0" (add_), "m"(ptr->value)
+:		"memory", "cc");
+	return res;
+}
+
+#endif /* __x86_64__ */
+
+#endif /* defined(__GNUC__) && !defined(__INTEL_COMPILER) */
+
+#endif /* HAVE_ATOMICS */
+
+#endif /* defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS) */
diff --git a/foreign/libpg_query/src/postgres/include/port/atomics/fallback.h b/foreign/libpg_query/src/postgres/include/port/atomics/fallback.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/port/atomics/fallback.h
@@ -0,0 +1,148 @@
+/*-------------------------------------------------------------------------
+ *
+ * fallback.h
+ *    Fallback for platforms without spinlock and/or atomics support. Slower
+ *    than native atomics support, but not unusably slow.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/port/atomics/fallback.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/* intentionally no include guards, should only be included by atomics.h */
+#ifndef INSIDE_ATOMICS_H
+#	error "should be included via atomics.h"
+#endif
+
+#ifndef pg_memory_barrier_impl
+/*
+ * If we have no memory barrier implementation for this architecture, we
+ * fall back to acquiring and releasing a spinlock.  This might, in turn,
+ * fall back to the semaphore-based spinlock implementation, which will be
+ * amazingly slow.
+ *
+ * It's not self-evident that every possible legal implementation of a
+ * spinlock acquire-and-release would be equivalent to a full memory barrier.
+ * For example, I'm not sure that Itanium's acq and rel add up to a full
+ * fence.  But all of our actual implementations seem OK in this regard.
+ */
+#define PG_HAVE_MEMORY_BARRIER_EMULATION
+
+extern void pg_spinlock_barrier(void);
+#define pg_memory_barrier_impl pg_spinlock_barrier
+#endif
+
+#ifndef pg_compiler_barrier_impl
+/*
+ * If the compiler/arch combination does not provide compiler barriers,
+ * provide a fallback.  The fallback simply consists of a function call into
+ * an externally defined function.  That should guarantee compiler barrier
+ * semantics except for compilers that do inter translation unit/global
+ * optimization - those better provide an actual compiler barrier.
+ *
+ * A native compiler barrier for sure is a lot faster than this...
+ */
+#define PG_HAVE_COMPILER_BARRIER_EMULATION
+extern void pg_extern_compiler_barrier(void);
+#define pg_compiler_barrier_impl pg_extern_compiler_barrier
+#endif
+
+
+/*
+ * If we have atomics implementation for this platform, fall back to providing
+ * the atomics API using a spinlock to protect the internal state. Possibly
+ * the spinlock implementation uses semaphores internally...
+ *
+ * We have to be a bit careful here, as it's not guaranteed that atomic
+ * variables are mapped to the same address in every process (e.g. dynamic
+ * shared memory segments). We can't just hash the address and use that to map
+ * to a spinlock. Instead assign a spinlock on initialization of the atomic
+ * variable.
+ */
+#if !defined(PG_HAVE_ATOMIC_FLAG_SUPPORT) && !defined(PG_HAVE_ATOMIC_U32_SUPPORT)
+
+#define PG_HAVE_ATOMIC_FLAG_SIMULATION
+#define PG_HAVE_ATOMIC_FLAG_SUPPORT
+
+typedef struct pg_atomic_flag
+{
+	/*
+	 * To avoid circular includes we can't use s_lock as a type here. Instead
+	 * just reserve enough space for all spinlock types. Some platforms would
+	 * be content with just one byte instead of 4, but that's not too much
+	 * waste.
+	 */
+#if defined(__hppa) || defined(__hppa__)	/* HP PA-RISC, GCC and HP compilers */
+	int			sema[4];
+#else
+	int			sema;
+#endif
+} pg_atomic_flag;
+
+#endif /* PG_HAVE_ATOMIC_FLAG_SUPPORT */
+
+#if !defined(PG_HAVE_ATOMIC_U32_SUPPORT)
+
+#define PG_HAVE_ATOMIC_U32_SIMULATION
+
+#define PG_HAVE_ATOMIC_U32_SUPPORT
+typedef struct pg_atomic_uint32
+{
+	/* Check pg_atomic_flag's definition above for an explanation */
+#if defined(__hppa) || defined(__hppa__)	/* HP PA-RISC, GCC and HP compilers */
+	int			sema[4];
+#else
+	int			sema;
+#endif
+	volatile uint32 value;
+} pg_atomic_uint32;
+
+#endif /* PG_HAVE_ATOMIC_U32_SUPPORT */
+
+#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
+
+#ifdef PG_HAVE_ATOMIC_FLAG_SIMULATION
+
+#define PG_HAVE_ATOMIC_INIT_FLAG
+extern void pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr);
+
+#define PG_HAVE_ATOMIC_TEST_SET_FLAG
+extern bool pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr);
+
+#define PG_HAVE_ATOMIC_CLEAR_FLAG
+extern void pg_atomic_clear_flag_impl(volatile pg_atomic_flag *ptr);
+
+#define PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG
+static inline bool
+pg_atomic_unlocked_test_flag_impl(volatile pg_atomic_flag *ptr)
+{
+	/*
+	 * Can't do this efficiently in the semaphore based implementation - we'd
+	 * have to try to acquire the semaphore - so always return true. That's
+	 * correct, because this is only an unlocked test anyway. Do this in the
+	 * header so compilers can optimize the test away.
+	 */
+	return true;
+}
+
+#endif /* PG_HAVE_ATOMIC_FLAG_SIMULATION */
+
+#ifdef PG_HAVE_ATOMIC_U32_SIMULATION
+
+#define PG_HAVE_ATOMIC_INIT_U32
+extern void pg_atomic_init_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val_);
+
+#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32
+extern bool pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr,
+												uint32 *expected, uint32 newval);
+
+#define PG_HAVE_ATOMIC_FETCH_ADD_U32
+extern uint32 pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_);
+
+#endif /* PG_HAVE_ATOMIC_U32_SIMULATION */
+
+
+#endif /* defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS) */
diff --git a/foreign/libpg_query/src/postgres/include/port/atomics/generic-gcc.h b/foreign/libpg_query/src/postgres/include/port/atomics/generic-gcc.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/port/atomics/generic-gcc.h
@@ -0,0 +1,236 @@
+/*-------------------------------------------------------------------------
+ *
+ * generic-gcc.h
+ *	  Atomic operations, implemented using gcc (or compatible) intrinsics.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * NOTES:
+ *
+ * Documentation:
+ * * Legacy __sync Built-in Functions for Atomic Memory Access
+ *   http://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/_005f_005fsync-Builtins.html
+ * * Built-in functions for memory model aware atomic operations
+ *   http://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/_005f_005fatomic-Builtins.html
+ *
+ * src/include/port/atomics/generic-gcc.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/* intentionally no include guards, should only be included by atomics.h */
+#ifndef INSIDE_ATOMICS_H
+#error "should be included via atomics.h"
+#endif
+
+/*
+ * icc provides all the same intrinsics but doesn't understand gcc's inline asm
+ */
+#if defined(__INTEL_COMPILER)
+/* NB: Yes, __memory_barrier() is actually just a compiler barrier */
+#define pg_compiler_barrier_impl()	__memory_barrier()
+#else
+#define pg_compiler_barrier_impl()	__asm__ __volatile__("" ::: "memory")
+#endif
+
+/*
+ * If we're on GCC 4.1.0 or higher, we should be able to get a memory barrier
+ * out of this compiler built-in.  But we prefer to rely on platform specific
+ * definitions where possible, and use this only as a fallback.
+ */
+#if !defined(pg_memory_barrier_impl)
+#	if defined(HAVE_GCC__ATOMIC_INT32_CAS)
+#		define pg_memory_barrier_impl()		__atomic_thread_fence(__ATOMIC_SEQ_CST)
+#	elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
+#		define pg_memory_barrier_impl()		__sync_synchronize()
+#	endif
+#endif /* !defined(pg_memory_barrier_impl) */
+
+#if !defined(pg_read_barrier_impl) && defined(HAVE_GCC__ATOMIC_INT32_CAS)
+/* acquire semantics include read barrier semantics */
+#		define pg_read_barrier_impl()		__atomic_thread_fence(__ATOMIC_ACQUIRE)
+#endif
+
+#if !defined(pg_write_barrier_impl) && defined(HAVE_GCC__ATOMIC_INT32_CAS)
+/* release semantics include write barrier semantics */
+#		define pg_write_barrier_impl()		__atomic_thread_fence(__ATOMIC_RELEASE)
+#endif
+
+#ifdef HAVE_ATOMICS
+
+/* generic gcc based atomic flag implementation */
+#if !defined(PG_HAVE_ATOMIC_FLAG_SUPPORT) \
+	&& (defined(HAVE_GCC__SYNC_INT32_TAS) || defined(HAVE_GCC__SYNC_CHAR_TAS))
+
+#define PG_HAVE_ATOMIC_FLAG_SUPPORT
+typedef struct pg_atomic_flag
+{
+	/* some platforms only have a 8 bit wide TAS */
+#ifdef HAVE_GCC__SYNC_CHAR_TAS
+	volatile char value;
+#else
+	/* but an int works on more platforms */
+	volatile int value;
+#endif
+} pg_atomic_flag;
+
+#endif /* !ATOMIC_FLAG_SUPPORT && SYNC_INT32_TAS */
+
+/* generic gcc based atomic uint32 implementation */
+#if !defined(PG_HAVE_ATOMIC_U32_SUPPORT) \
+	&& (defined(HAVE_GCC__ATOMIC_INT32_CAS) || defined(HAVE_GCC__SYNC_INT32_CAS))
+
+#define PG_HAVE_ATOMIC_U32_SUPPORT
+typedef struct pg_atomic_uint32
+{
+	volatile uint32 value;
+} pg_atomic_uint32;
+
+#endif /* defined(HAVE_GCC__ATOMIC_INT32_CAS) || defined(HAVE_GCC__SYNC_INT32_CAS) */
+
+/* generic gcc based atomic uint64 implementation */
+#if !defined(PG_HAVE_ATOMIC_U64_SUPPORT) \
+	&& !defined(PG_DISABLE_64_BIT_ATOMICS) \
+	&& (defined(HAVE_GCC__ATOMIC_INT64_CAS) || defined(HAVE_GCC__SYNC_INT64_CAS))
+
+#define PG_HAVE_ATOMIC_U64_SUPPORT
+
+typedef struct pg_atomic_uint64
+{
+	volatile uint64 value pg_attribute_aligned(8);
+} pg_atomic_uint64;
+
+#endif /* defined(HAVE_GCC__ATOMIC_INT64_CAS) || defined(HAVE_GCC__SYNC_INT64_CAS) */
+
+/*
+ * Implementation follows. Inlined or directly included from atomics.c
+ */
+#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
+
+#ifdef PG_HAVE_ATOMIC_FLAG_SUPPORT
+
+#if defined(HAVE_GCC__SYNC_CHAR_TAS) || defined(HAVE_GCC__SYNC_INT32_TAS)
+
+#ifndef PG_HAVE_ATOMIC_TEST_SET_FLAG
+#define PG_HAVE_ATOMIC_TEST_SET_FLAG
+static inline bool
+pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr)
+{
+	/* NB: only an acquire barrier, not a full one */
+	/* some platform only support a 1 here */
+	return __sync_lock_test_and_set(&ptr->value, 1) == 0;
+}
+#endif
+
+#endif /* defined(HAVE_GCC__SYNC_*_TAS) */
+
+#ifndef PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG
+#define PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG
+static inline bool
+pg_atomic_unlocked_test_flag_impl(volatile pg_atomic_flag *ptr)
+{
+	return ptr->value == 0;
+}
+#endif
+
+#ifndef PG_HAVE_ATOMIC_CLEAR_FLAG
+#define PG_HAVE_ATOMIC_CLEAR_FLAG
+static inline void
+pg_atomic_clear_flag_impl(volatile pg_atomic_flag *ptr)
+{
+	__sync_lock_release(&ptr->value);
+}
+#endif
+
+#ifndef PG_HAVE_ATOMIC_INIT_FLAG
+#define PG_HAVE_ATOMIC_INIT_FLAG
+static inline void
+pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr)
+{
+	pg_atomic_clear_flag_impl(ptr);
+}
+#endif
+
+#endif /* defined(PG_HAVE_ATOMIC_FLAG_SUPPORT) */
+
+/* prefer __atomic, it has a better API */
+#if !defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) && defined(HAVE_GCC__ATOMIC_INT32_CAS)
+#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32
+static inline bool
+pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr,
+									uint32 *expected, uint32 newval)
+{
+	/* FIXME: we can probably use a lower consistency model */
+	return __atomic_compare_exchange_n(&ptr->value, expected, newval, false,
+									   __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) && defined(HAVE_GCC__SYNC_INT32_CAS)
+#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32
+static inline bool
+pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr,
+									uint32 *expected, uint32 newval)
+{
+	bool	ret;
+	uint32	current;
+	current = __sync_val_compare_and_swap(&ptr->value, *expected, newval);
+	ret = current == *expected;
+	*expected = current;
+	return ret;
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_FETCH_ADD_U32) && defined(HAVE_GCC__SYNC_INT32_CAS)
+#define PG_HAVE_ATOMIC_FETCH_ADD_U32
+static inline uint32
+pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_)
+{
+	return __sync_fetch_and_add(&ptr->value, add_);
+}
+#endif
+
+
+#if !defined(PG_DISABLE_64_BIT_ATOMICS)
+
+#if !defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64) && defined(HAVE_GCC__ATOMIC_INT64_CAS)
+#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64
+static inline bool
+pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr,
+									uint64 *expected, uint64 newval)
+{
+	return __atomic_compare_exchange_n(&ptr->value, expected, newval, false,
+									   __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64) && defined(HAVE_GCC__SYNC_INT64_CAS)
+#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64
+static inline bool
+pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr,
+									uint64 *expected, uint64 newval)
+{
+	bool	ret;
+	uint64	current;
+	current = __sync_val_compare_and_swap(&ptr->value, *expected, newval);
+	ret = current == *expected;
+	*expected = current;
+	return ret;
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_FETCH_ADD_U64) && defined(HAVE_GCC__SYNC_INT64_CAS)
+#define PG_HAVE_ATOMIC_FETCH_ADD_U64
+static inline uint64
+pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_)
+{
+	return __sync_fetch_and_add(&ptr->value, add_);
+}
+#endif
+
+#endif /* !defined(PG_DISABLE_64_BIT_ATOMICS) */
+
+#endif /* defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS) */
+
+#endif /* defined(HAVE_ATOMICS) */
diff --git a/foreign/libpg_query/src/postgres/include/port/atomics/generic.h b/foreign/libpg_query/src/postgres/include/port/atomics/generic.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/port/atomics/generic.h
@@ -0,0 +1,387 @@
+/*-------------------------------------------------------------------------
+ *
+ * generic.h
+ *	  Implement higher level operations based on some lower level tomic
+ *	  operations.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/port/atomics/generic.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/* intentionally no include guards, should only be included by atomics.h */
+#ifndef INSIDE_ATOMICS_H
+#	error "should be included via atomics.h"
+#endif
+
+/*
+ * If read or write barriers are undefined, we upgrade them to full memory
+ * barriers.
+ */
+#if !defined(pg_read_barrier_impl)
+#	define pg_read_barrier_impl pg_memory_barrier_impl
+#endif
+#if !defined(pg_write_barrier_impl)
+#	define pg_write_barrier_impl pg_memory_barrier_impl
+#endif
+
+#ifndef PG_HAVE_SPIN_DELAY
+#define PG_HAVE_SPIN_DELAY
+#define pg_spin_delay_impl()	((void)0)
+#endif
+
+
+/* provide fallback */
+#if !defined(PG_HAVE_ATOMIC_FLAG_SUPPORT) && defined(PG_HAVE_ATOMIC_U32_SUPPORT)
+#define PG_HAVE_ATOMIC_FLAG_SUPPORT
+typedef pg_atomic_uint32 pg_atomic_flag;
+#endif
+
+#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
+
+#ifndef PG_HAVE_ATOMIC_READ_U32
+#define PG_HAVE_ATOMIC_READ_U32
+static inline uint32
+pg_atomic_read_u32_impl(volatile pg_atomic_uint32 *ptr)
+{
+	return *(&ptr->value);
+}
+#endif
+
+#ifndef PG_HAVE_ATOMIC_WRITE_U32
+#define PG_HAVE_ATOMIC_WRITE_U32
+static inline void
+pg_atomic_write_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val)
+{
+	ptr->value = val;
+}
+#endif
+
+/*
+ * provide fallback for test_and_set using atomic_exchange if available
+ */
+#if !defined(PG_HAVE_ATOMIC_TEST_SET_FLAG) && defined(PG_HAVE_ATOMIC_EXCHANGE_U32)
+
+#define PG_HAVE_ATOMIC_INIT_FLAG
+static inline void
+pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr)
+{
+	pg_atomic_write_u32_impl(ptr, 0);
+}
+
+#define PG_HAVE_ATOMIC_TEST_SET_FLAG
+static inline bool
+pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr)
+{
+	return pg_atomic_exchange_u32_impl(ptr, &value, 1) == 0;
+}
+
+#define PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG
+static inline bool
+pg_atomic_unlocked_test_flag_impl(volatile pg_atomic_flag *ptr)
+{
+	return pg_atomic_read_u32_impl(ptr) == 0;
+}
+
+
+#define PG_HAVE_ATOMIC_CLEAR_FLAG
+static inline void
+pg_atomic_clear_flag_impl(volatile pg_atomic_flag *ptr)
+{
+	/* XXX: release semantics suffice? */
+	pg_memory_barrier_impl();
+	pg_atomic_write_u32_impl(ptr, 0);
+}
+
+/*
+ * provide fallback for test_and_set using atomic_compare_exchange if
+ * available.
+ */
+#elif !defined(PG_HAVE_ATOMIC_TEST_SET_FLAG) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32)
+
+#define PG_HAVE_ATOMIC_INIT_FLAG
+static inline void
+pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr)
+{
+	pg_atomic_write_u32_impl(ptr, 0);
+}
+
+#define PG_HAVE_ATOMIC_TEST_SET_FLAG
+static inline bool
+pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr)
+{
+	uint32 value = 0;
+	return pg_atomic_compare_exchange_u32_impl(ptr, &value, 1);
+}
+
+#define PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG
+static inline bool
+pg_atomic_unlocked_test_flag_impl(volatile pg_atomic_flag *ptr)
+{
+	return pg_atomic_read_u32_impl(ptr) == 0;
+}
+
+#define PG_HAVE_ATOMIC_CLEAR_FLAG
+static inline void
+pg_atomic_clear_flag_impl(volatile pg_atomic_flag *ptr)
+{
+	/*
+	 * Use a memory barrier + plain write if we have a native memory
+	 * barrier. But don't do so if memory barriers use spinlocks - that'd lead
+	 * to circularity if flags are used to implement spinlocks.
+	 */
+#ifndef PG_HAVE_MEMORY_BARRIER_EMULATION
+	/* XXX: release semantics suffice? */
+	pg_memory_barrier_impl();
+	pg_atomic_write_u32_impl(ptr, 0);
+#else
+	uint32 value = 1;
+	pg_atomic_compare_exchange_u32_impl(ptr, &value, 0);
+#endif
+}
+
+#elif !defined(PG_HAVE_ATOMIC_TEST_SET_FLAG)
+#	error "No pg_atomic_test_and_set provided"
+#endif /* !defined(PG_HAVE_ATOMIC_TEST_SET_FLAG) */
+
+
+#ifndef PG_HAVE_ATOMIC_INIT_U32
+#define PG_HAVE_ATOMIC_INIT_U32
+static inline void
+pg_atomic_init_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val_)
+{
+	pg_atomic_write_u32_impl(ptr, val_);
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_EXCHANGE_U32) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32)
+#define PG_HAVE_ATOMIC_EXCHANGE_U32
+static inline uint32
+pg_atomic_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 xchg_)
+{
+	uint32 old;
+	while (true)
+	{
+		old = pg_atomic_read_u32_impl(ptr);
+		if (pg_atomic_compare_exchange_u32_impl(ptr, &old, xchg_))
+			break;
+	}
+	return old;
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_FETCH_ADD_U32) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32)
+#define PG_HAVE_ATOMIC_FETCH_ADD_U32
+static inline uint32
+pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_)
+{
+	uint32 old;
+	while (true)
+	{
+		old = pg_atomic_read_u32_impl(ptr);
+		if (pg_atomic_compare_exchange_u32_impl(ptr, &old, old + add_))
+			break;
+	}
+	return old;
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_FETCH_SUB_U32) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32)
+#define PG_HAVE_ATOMIC_FETCH_SUB_U32
+static inline uint32
+pg_atomic_fetch_sub_u32_impl(volatile pg_atomic_uint32 *ptr, int32 sub_)
+{
+	return pg_atomic_fetch_add_u32_impl(ptr, -sub_);
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_FETCH_AND_U32) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32)
+#define PG_HAVE_ATOMIC_FETCH_AND_U32
+static inline uint32
+pg_atomic_fetch_and_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 and_)
+{
+	uint32 old;
+	while (true)
+	{
+		old = pg_atomic_read_u32_impl(ptr);
+		if (pg_atomic_compare_exchange_u32_impl(ptr, &old, old & and_))
+			break;
+	}
+	return old;
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_FETCH_OR_U32) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32)
+#define PG_HAVE_ATOMIC_FETCH_OR_U32
+static inline uint32
+pg_atomic_fetch_or_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 or_)
+{
+	uint32 old;
+	while (true)
+	{
+		old = pg_atomic_read_u32_impl(ptr);
+		if (pg_atomic_compare_exchange_u32_impl(ptr, &old, old | or_))
+			break;
+	}
+	return old;
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_ADD_FETCH_U32) && defined(PG_HAVE_ATOMIC_FETCH_ADD_U32)
+#define PG_HAVE_ATOMIC_ADD_FETCH_U32
+static inline uint32
+pg_atomic_add_fetch_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_)
+{
+	return pg_atomic_fetch_add_u32_impl(ptr, add_) + add_;
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_SUB_FETCH_U32) && defined(PG_HAVE_ATOMIC_FETCH_SUB_U32)
+#define PG_HAVE_ATOMIC_SUB_FETCH_U32
+static inline uint32
+pg_atomic_sub_fetch_u32_impl(volatile pg_atomic_uint32 *ptr, int32 sub_)
+{
+	return pg_atomic_fetch_sub_u32_impl(ptr, sub_) - sub_;
+}
+#endif
+
+#ifdef PG_HAVE_ATOMIC_U64_SUPPORT
+
+#if !defined(PG_HAVE_ATOMIC_EXCHANGE_U64) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64)
+#define PG_HAVE_ATOMIC_EXCHANGE_U64
+static inline uint64
+pg_atomic_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 xchg_)
+{
+	uint64 old;
+	while (true)
+	{
+		old = ptr->value;
+		if (pg_atomic_compare_exchange_u64_impl(ptr, &old, xchg_))
+			break;
+	}
+	return old;
+}
+#endif
+
+#ifndef PG_HAVE_ATOMIC_WRITE_U64
+#define PG_HAVE_ATOMIC_WRITE_U64
+static inline void
+pg_atomic_write_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val)
+{
+	/*
+	 * 64 bit writes aren't safe on all platforms. In the generic
+	 * implementation implement them as an atomic exchange.
+	 */
+	pg_atomic_exchange_u64_impl(ptr, val);
+}
+#endif
+
+#ifndef PG_HAVE_ATOMIC_READ_U64
+#define PG_HAVE_ATOMIC_READ_U64
+static inline uint64
+pg_atomic_read_u64_impl(volatile pg_atomic_uint64 *ptr)
+{
+	uint64 old = 0;
+
+	/*
+	 * 64 bit reads aren't safe on all platforms. In the generic
+	 * implementation implement them as a compare/exchange with 0. That'll
+	 * fail or succeed, but always return the old value. Possible might store
+	 * a 0, but only if the prev. value also was a 0 - i.e. harmless.
+	 */
+	pg_atomic_compare_exchange_u64_impl(ptr, &old, 0);
+
+	return old;
+}
+#endif
+
+#ifndef PG_HAVE_ATOMIC_INIT_U64
+#define PG_HAVE_ATOMIC_INIT_U64
+static inline void
+pg_atomic_init_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val_)
+{
+	pg_atomic_write_u64_impl(ptr, val_);
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_FETCH_ADD_U64) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64)
+#define PG_HAVE_ATOMIC_FETCH_ADD_U64
+static inline uint64
+pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_)
+{
+	uint64 old;
+	while (true)
+	{
+		old = pg_atomic_read_u64_impl(ptr);
+		if (pg_atomic_compare_exchange_u64_impl(ptr, &old, old + add_))
+			break;
+	}
+	return old;
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_FETCH_SUB_U64) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64)
+#define PG_HAVE_ATOMIC_FETCH_SUB_U64
+static inline uint64
+pg_atomic_fetch_sub_u64_impl(volatile pg_atomic_uint64 *ptr, int64 sub_)
+{
+	return pg_atomic_fetch_add_u64_impl(ptr, -sub_);
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_FETCH_AND_U64) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64)
+#define PG_HAVE_ATOMIC_FETCH_AND_U64
+static inline uint64
+pg_atomic_fetch_and_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 and_)
+{
+	uint64 old;
+	while (true)
+	{
+		old = pg_atomic_read_u64_impl(ptr);
+		if (pg_atomic_compare_exchange_u64_impl(ptr, &old, old & and_))
+			break;
+	}
+	return old;
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_FETCH_OR_U64) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64)
+#define PG_HAVE_ATOMIC_FETCH_OR_U64
+static inline uint64
+pg_atomic_fetch_or_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 or_)
+{
+	uint64 old;
+	while (true)
+	{
+		old = pg_atomic_read_u64_impl(ptr);
+		if (pg_atomic_compare_exchange_u64_impl(ptr, &old, old | or_))
+			break;
+	}
+	return old;
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_ADD_FETCH_U64) && defined(PG_HAVE_ATOMIC_FETCH_ADD_U64)
+#define PG_HAVE_ATOMIC_ADD_FETCH_U64
+static inline uint64
+pg_atomic_add_fetch_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_)
+{
+	return pg_atomic_fetch_add_u64_impl(ptr, add_) + add_;
+}
+#endif
+
+#if !defined(PG_HAVE_ATOMIC_SUB_FETCH_U64) && defined(PG_HAVE_ATOMIC_FETCH_SUB_U64)
+#define PG_HAVE_ATOMIC_SUB_FETCH_U64
+static inline uint64
+pg_atomic_sub_fetch_u64_impl(volatile pg_atomic_uint64 *ptr, int64 sub_)
+{
+	return pg_atomic_fetch_sub_u64_impl(ptr, sub_) - sub_;
+}
+#endif
+
+#endif /* PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64 */
+
+#endif /* defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS) */
diff --git a/foreign/libpg_query/src/postgres/include/port/pg_crc32c.h b/foreign/libpg_query/src/postgres/include/port/pg_crc32c.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/port/pg_crc32c.h
@@ -0,0 +1,93 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_crc32c.h
+ *	  Routines for computing CRC-32C checksums.
+ *
+ * The speed of CRC-32C calculation has a big impact on performance, so we
+ * jump through some hoops to get the best implementation for each
+ * platform. Some CPU architectures have special instructions for speeding
+ * up CRC calculations (e.g. Intel SSE 4.2), on other platforms we use the
+ * Slicing-by-8 algorithm which uses lookup tables.
+ *
+ * The public interface consists of four macros:
+ *
+ * INIT_CRC32C(crc)
+ *		Initialize a CRC accumulator
+ *
+ * COMP_CRC32C(crc, data, len)
+ *		Accumulate some (more) bytes into a CRC
+ *
+ * FIN_CRC32C(crc)
+ *		Finish a CRC calculation
+ *
+ * EQ_CRC32C(c1, c2)
+ *		Check for equality of two CRCs.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/port/pg_crc32c.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_CRC32C_H
+#define PG_CRC32C_H
+
+typedef uint32 pg_crc32c;
+
+/* The INIT and EQ macros are the same for all implementations. */
+#define INIT_CRC32C(crc) ((crc) = 0xFFFFFFFF)
+#define EQ_CRC32C(c1, c2) ((c1) == (c2))
+
+#if defined(USE_SSE42_CRC32C)
+/* Use SSE4.2 instructions. */
+#define COMP_CRC32C(crc, data, len) \
+	((crc) = pg_comp_crc32c_sse42((crc), (data), (len)))
+#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF)
+
+extern pg_crc32c pg_comp_crc32c_sse42(pg_crc32c crc, const void *data, size_t len);
+
+#elif defined(USE_SSE42_CRC32C_WITH_RUNTIME_CHECK)
+/*
+ * Use SSE4.2 instructions, but perform a runtime check first to check that
+ * they are available.
+ */
+#define COMP_CRC32C(crc, data, len) \
+	((crc) = pg_comp_crc32c((crc), (data), (len)))
+#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF)
+
+extern pg_crc32c pg_comp_crc32c_sse42(pg_crc32c crc, const void *data, size_t len);
+extern pg_crc32c pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len);
+extern pg_crc32c (*pg_comp_crc32c) (pg_crc32c crc, const void *data, size_t len);
+
+#else
+/*
+ * Use slicing-by-8 algorithm.
+ *
+ * On big-endian systems, the intermediate value is kept in reverse byte
+ * order, to avoid byte-swapping during the calculation. FIN_CRC32C reverses
+ * the bytes to the final order.
+ */
+#define COMP_CRC32C(crc, data, len) \
+	((crc) = pg_comp_crc32c_sb8((crc), (data), (len)))
+#ifdef WORDS_BIGENDIAN
+
+#ifdef HAVE__BUILTIN_BSWAP32
+#define BSWAP32(x) __builtin_bswap32(x)
+#else
+#define BSWAP32(x) (((x << 24) & 0xff000000) | \
+					((x << 8) & 0x00ff0000) | \
+					((x >> 8) & 0x0000ff00) | \
+					((x >> 24) & 0x000000ff))
+#endif
+
+#define FIN_CRC32C(crc) ((crc) = BSWAP32(crc) ^ 0xFFFFFFFF)
+#else
+#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF)
+#endif
+
+extern pg_crc32c pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len);
+
+#endif
+
+#endif   /* PG_CRC32C_H */
diff --git a/foreign/libpg_query/src/postgres/include/portability/instr_time.h b/foreign/libpg_query/src/postgres/include/portability/instr_time.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/portability/instr_time.h
@@ -0,0 +1,154 @@
+/*-------------------------------------------------------------------------
+ *
+ * instr_time.h
+ *	  portable high-precision interval timing
+ *
+ * This file provides an abstraction layer to hide portability issues in
+ * interval timing.  On Unix we use gettimeofday(), but on Windows that
+ * gives a low-precision result so we must use QueryPerformanceCounter()
+ * instead.  These macros also give some breathing room to use other
+ * high-precision-timing APIs on yet other platforms.
+ *
+ * The basic data type is instr_time, which all callers should treat as an
+ * opaque typedef.  instr_time can store either an absolute time (of
+ * unspecified reference time) or an interval.  The operations provided
+ * for it are:
+ *
+ * INSTR_TIME_IS_ZERO(t)			is t equal to zero?
+ *
+ * INSTR_TIME_SET_ZERO(t)			set t to zero (memset is acceptable too)
+ *
+ * INSTR_TIME_SET_CURRENT(t)		set t to current time
+ *
+ * INSTR_TIME_ADD(x, y)				x += y
+ *
+ * INSTR_TIME_SUBTRACT(x, y)		x -= y
+ *
+ * INSTR_TIME_ACCUM_DIFF(x, y, z)	x += (y - z)
+ *
+ * INSTR_TIME_GET_DOUBLE(t)			convert t to double (in seconds)
+ *
+ * INSTR_TIME_GET_MILLISEC(t)		convert t to double (in milliseconds)
+ *
+ * INSTR_TIME_GET_MICROSEC(t)		convert t to uint64 (in microseconds)
+ *
+ * Note that INSTR_TIME_SUBTRACT and INSTR_TIME_ACCUM_DIFF convert
+ * absolute times to intervals.  The INSTR_TIME_GET_xxx operations are
+ * only useful on intervals.
+ *
+ * When summing multiple measurements, it's recommended to leave the
+ * running sum in instr_time form (ie, use INSTR_TIME_ADD or
+ * INSTR_TIME_ACCUM_DIFF) and convert to a result format only at the end.
+ *
+ * Beware of multiple evaluations of the macro arguments.
+ *
+ *
+ * Copyright (c) 2001-2015, PostgreSQL Global Development Group
+ *
+ * src/include/portability/instr_time.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef INSTR_TIME_H
+#define INSTR_TIME_H
+
+#ifndef WIN32
+
+#include <sys/time.h>
+
+typedef struct timeval instr_time;
+
+#define INSTR_TIME_IS_ZERO(t)	((t).tv_usec == 0 && (t).tv_sec == 0)
+
+#define INSTR_TIME_SET_ZERO(t)	((t).tv_sec = 0, (t).tv_usec = 0)
+
+#define INSTR_TIME_SET_CURRENT(t)	gettimeofday(&(t), NULL)
+
+#define INSTR_TIME_ADD(x,y) \
+	do { \
+		(x).tv_sec += (y).tv_sec; \
+		(x).tv_usec += (y).tv_usec; \
+		/* Normalize */ \
+		while ((x).tv_usec >= 1000000) \
+		{ \
+			(x).tv_usec -= 1000000; \
+			(x).tv_sec++; \
+		} \
+	} while (0)
+
+#define INSTR_TIME_SUBTRACT(x,y) \
+	do { \
+		(x).tv_sec -= (y).tv_sec; \
+		(x).tv_usec -= (y).tv_usec; \
+		/* Normalize */ \
+		while ((x).tv_usec < 0) \
+		{ \
+			(x).tv_usec += 1000000; \
+			(x).tv_sec--; \
+		} \
+	} while (0)
+
+#define INSTR_TIME_ACCUM_DIFF(x,y,z) \
+	do { \
+		(x).tv_sec += (y).tv_sec - (z).tv_sec; \
+		(x).tv_usec += (y).tv_usec - (z).tv_usec; \
+		/* Normalize after each add to avoid overflow/underflow of tv_usec */ \
+		while ((x).tv_usec < 0) \
+		{ \
+			(x).tv_usec += 1000000; \
+			(x).tv_sec--; \
+		} \
+		while ((x).tv_usec >= 1000000) \
+		{ \
+			(x).tv_usec -= 1000000; \
+			(x).tv_sec++; \
+		} \
+	} while (0)
+
+#define INSTR_TIME_GET_DOUBLE(t) \
+	(((double) (t).tv_sec) + ((double) (t).tv_usec) / 1000000.0)
+
+#define INSTR_TIME_GET_MILLISEC(t) \
+	(((double) (t).tv_sec * 1000.0) + ((double) (t).tv_usec) / 1000.0)
+
+#define INSTR_TIME_GET_MICROSEC(t) \
+	(((uint64) (t).tv_sec * (uint64) 1000000) + (uint64) (t).tv_usec)
+#else							/* WIN32 */
+
+typedef LARGE_INTEGER instr_time;
+
+#define INSTR_TIME_IS_ZERO(t)	((t).QuadPart == 0)
+
+#define INSTR_TIME_SET_ZERO(t)	((t).QuadPart = 0)
+
+#define INSTR_TIME_SET_CURRENT(t)	QueryPerformanceCounter(&(t))
+
+#define INSTR_TIME_ADD(x,y) \
+	((x).QuadPart += (y).QuadPart)
+
+#define INSTR_TIME_SUBTRACT(x,y) \
+	((x).QuadPart -= (y).QuadPart)
+
+#define INSTR_TIME_ACCUM_DIFF(x,y,z) \
+	((x).QuadPart += (y).QuadPart - (z).QuadPart)
+
+#define INSTR_TIME_GET_DOUBLE(t) \
+	(((double) (t).QuadPart) / GetTimerFrequency())
+
+#define INSTR_TIME_GET_MILLISEC(t) \
+	(((double) (t).QuadPart * 1000.0) / GetTimerFrequency())
+
+#define INSTR_TIME_GET_MICROSEC(t) \
+	((uint64) (((double) (t).QuadPart * 1000000.0) / GetTimerFrequency()))
+
+static inline double
+GetTimerFrequency(void)
+{
+	LARGE_INTEGER f;
+
+	QueryPerformanceFrequency(&f);
+	return (double) f.QuadPart;
+}
+#endif   /* WIN32 */
+
+#endif   /* INSTR_TIME_H */
diff --git a/foreign/libpg_query/src/postgres/include/postgres.h b/foreign/libpg_query/src/postgres/include/postgres.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/postgres.h
@@ -0,0 +1,722 @@
+/*-------------------------------------------------------------------------
+ *
+ * postgres.h
+ *	  Primary include file for PostgreSQL server .c files
+ *
+ * This should be the first file included by PostgreSQL backend modules.
+ * Client-side code should include postgres_fe.h instead.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1995, Regents of the University of California
+ *
+ * src/include/postgres.h
+ *
+ *-------------------------------------------------------------------------
+ */
+/*
+ *----------------------------------------------------------------
+ *	 TABLE OF CONTENTS
+ *
+ *		When adding stuff to this file, please try to put stuff
+ *		into the relevant section, or add new sections as appropriate.
+ *
+ *	  section	description
+ *	  -------	------------------------------------------------
+ *		1)		variable-length datatypes (TOAST support)
+ *		2)		datum type + support macros
+ *		3)		exception handling backend support
+ *
+ *	 NOTES
+ *
+ *	In general, this file should contain declarations that are widely needed
+ *	in the backend environment, but are of no interest outside the backend.
+ *
+ *	Simple type definitions live in c.h, where they are shared with
+ *	postgres_fe.h.  We do that since those type definitions are needed by
+ *	frontend modules that want to deal with binary data transmission to or
+ *	from the backend.  Type definitions in this file should be for
+ *	representations that never escape the backend, such as Datum or
+ *	TOASTed varlena objects.
+ *
+ *----------------------------------------------------------------
+ */
+#ifndef POSTGRES_H
+#define POSTGRES_H
+
+#include "c.h"
+#include "utils/elog.h"
+#include "utils/palloc.h"
+
+/* ----------------------------------------------------------------
+ *				Section 1:	variable-length datatypes (TOAST support)
+ * ----------------------------------------------------------------
+ */
+
+/*
+ * struct varatt_external is a traditional "TOAST pointer", that is, the
+ * information needed to fetch a Datum stored out-of-line in a TOAST table.
+ * The data is compressed if and only if va_extsize < va_rawsize - VARHDRSZ.
+ * This struct must not contain any padding, because we sometimes compare
+ * these pointers using memcmp.
+ *
+ * Note that this information is stored unaligned within actual tuples, so
+ * you need to memcpy from the tuple into a local struct variable before
+ * you can look at these fields!  (The reason we use memcmp is to avoid
+ * having to do that just to detect equality of two TOAST pointers...)
+ */
+typedef struct varatt_external
+{
+	int32		va_rawsize;		/* Original data size (includes header) */
+	int32		va_extsize;		/* External saved size (doesn't) */
+	Oid			va_valueid;		/* Unique ID of value within TOAST table */
+	Oid			va_toastrelid;	/* RelID of TOAST table containing it */
+}	varatt_external;
+
+/*
+ * struct varatt_indirect is a "TOAST pointer" representing an out-of-line
+ * Datum that's stored in memory, not in an external toast relation.
+ * The creator of such a Datum is entirely responsible that the referenced
+ * storage survives for as long as referencing pointer Datums can exist.
+ *
+ * Note that just as for struct varatt_external, this struct is stored
+ * unaligned within any containing tuple.
+ */
+typedef struct varatt_indirect
+{
+	struct varlena *pointer;	/* Pointer to in-memory varlena */
+}	varatt_indirect;
+
+/*
+ * struct varatt_expanded is a "TOAST pointer" representing an out-of-line
+ * Datum that is stored in memory, in some type-specific, not necessarily
+ * physically contiguous format that is convenient for computation not
+ * storage.  APIs for this, in particular the definition of struct
+ * ExpandedObjectHeader, are in src/include/utils/expandeddatum.h.
+ *
+ * Note that just as for struct varatt_external, this struct is stored
+ * unaligned within any containing tuple.
+ */
+typedef struct ExpandedObjectHeader ExpandedObjectHeader;
+
+typedef struct varatt_expanded
+{
+	ExpandedObjectHeader *eohptr;
+} varatt_expanded;
+
+/*
+ * Type tag for the various sorts of "TOAST pointer" datums.  The peculiar
+ * value for VARTAG_ONDISK comes from a requirement for on-disk compatibility
+ * with a previous notion that the tag field was the pointer datum's length.
+ */
+typedef enum vartag_external
+{
+	VARTAG_INDIRECT = 1,
+	VARTAG_EXPANDED_RO = 2,
+	VARTAG_EXPANDED_RW = 3,
+	VARTAG_ONDISK = 18
+} vartag_external;
+
+/* this test relies on the specific tag values above */
+#define VARTAG_IS_EXPANDED(tag) \
+	(((tag) & ~1) == VARTAG_EXPANDED_RO)
+
+#define VARTAG_SIZE(tag) \
+	((tag) == VARTAG_INDIRECT ? sizeof(varatt_indirect) : \
+	 VARTAG_IS_EXPANDED(tag) ? sizeof(varatt_expanded) : \
+	 (tag) == VARTAG_ONDISK ? sizeof(varatt_external) : \
+	 TrapMacro(true, "unrecognized TOAST vartag"))
+
+/*
+ * These structs describe the header of a varlena object that may have been
+ * TOASTed.  Generally, don't reference these structs directly, but use the
+ * macros below.
+ *
+ * We use separate structs for the aligned and unaligned cases because the
+ * compiler might otherwise think it could generate code that assumes
+ * alignment while touching fields of a 1-byte-header varlena.
+ */
+typedef union
+{
+	struct						/* Normal varlena (4-byte length) */
+	{
+		uint32		va_header;
+		char		va_data[FLEXIBLE_ARRAY_MEMBER];
+	}			va_4byte;
+	struct						/* Compressed-in-line format */
+	{
+		uint32		va_header;
+		uint32		va_rawsize; /* Original data size (excludes header) */
+		char		va_data[FLEXIBLE_ARRAY_MEMBER];		/* Compressed data */
+	}			va_compressed;
+} varattrib_4b;
+
+typedef struct
+{
+	uint8		va_header;
+	char		va_data[FLEXIBLE_ARRAY_MEMBER]; /* Data begins here */
+} varattrib_1b;
+
+/* TOAST pointers are a subset of varattrib_1b with an identifying tag byte */
+typedef struct
+{
+	uint8		va_header;		/* Always 0x80 or 0x01 */
+	uint8		va_tag;			/* Type of datum */
+	char		va_data[FLEXIBLE_ARRAY_MEMBER]; /* Type-specific data */
+} varattrib_1b_e;
+
+/*
+ * Bit layouts for varlena headers on big-endian machines:
+ *
+ * 00xxxxxx 4-byte length word, aligned, uncompressed data (up to 1G)
+ * 01xxxxxx 4-byte length word, aligned, *compressed* data (up to 1G)
+ * 10000000 1-byte length word, unaligned, TOAST pointer
+ * 1xxxxxxx 1-byte length word, unaligned, uncompressed data (up to 126b)
+ *
+ * Bit layouts for varlena headers on little-endian machines:
+ *
+ * xxxxxx00 4-byte length word, aligned, uncompressed data (up to 1G)
+ * xxxxxx10 4-byte length word, aligned, *compressed* data (up to 1G)
+ * 00000001 1-byte length word, unaligned, TOAST pointer
+ * xxxxxxx1 1-byte length word, unaligned, uncompressed data (up to 126b)
+ *
+ * The "xxx" bits are the length field (which includes itself in all cases).
+ * In the big-endian case we mask to extract the length, in the little-endian
+ * case we shift.  Note that in both cases the flag bits are in the physically
+ * first byte.  Also, it is not possible for a 1-byte length word to be zero;
+ * this lets us disambiguate alignment padding bytes from the start of an
+ * unaligned datum.  (We now *require* pad bytes to be filled with zero!)
+ *
+ * In TOAST pointers the va_tag field (see varattrib_1b_e) is used to discern
+ * the specific type and length of the pointer datum.
+ */
+
+/*
+ * Endian-dependent macros.  These are considered internal --- use the
+ * external macros below instead of using these directly.
+ *
+ * Note: IS_1B is true for external toast records but VARSIZE_1B will return 0
+ * for such records. Hence you should usually check for IS_EXTERNAL before
+ * checking for IS_1B.
+ */
+
+#ifdef WORDS_BIGENDIAN
+
+#define VARATT_IS_4B(PTR) \
+	((((varattrib_1b *) (PTR))->va_header & 0x80) == 0x00)
+#define VARATT_IS_4B_U(PTR) \
+	((((varattrib_1b *) (PTR))->va_header & 0xC0) == 0x00)
+#define VARATT_IS_4B_C(PTR) \
+	((((varattrib_1b *) (PTR))->va_header & 0xC0) == 0x40)
+#define VARATT_IS_1B(PTR) \
+	((((varattrib_1b *) (PTR))->va_header & 0x80) == 0x80)
+#define VARATT_IS_1B_E(PTR) \
+	((((varattrib_1b *) (PTR))->va_header) == 0x80)
+#define VARATT_NOT_PAD_BYTE(PTR) \
+	(*((uint8 *) (PTR)) != 0)
+
+/* VARSIZE_4B() should only be used on known-aligned data */
+#define VARSIZE_4B(PTR) \
+	(((varattrib_4b *) (PTR))->va_4byte.va_header & 0x3FFFFFFF)
+#define VARSIZE_1B(PTR) \
+	(((varattrib_1b *) (PTR))->va_header & 0x7F)
+#define VARTAG_1B_E(PTR) \
+	(((varattrib_1b_e *) (PTR))->va_tag)
+
+#define SET_VARSIZE_4B(PTR,len) \
+	(((varattrib_4b *) (PTR))->va_4byte.va_header = (len) & 0x3FFFFFFF)
+#define SET_VARSIZE_4B_C(PTR,len) \
+	(((varattrib_4b *) (PTR))->va_4byte.va_header = ((len) & 0x3FFFFFFF) | 0x40000000)
+#define SET_VARSIZE_1B(PTR,len) \
+	(((varattrib_1b *) (PTR))->va_header = (len) | 0x80)
+#define SET_VARTAG_1B_E(PTR,tag) \
+	(((varattrib_1b_e *) (PTR))->va_header = 0x80, \
+	 ((varattrib_1b_e *) (PTR))->va_tag = (tag))
+#else							/* !WORDS_BIGENDIAN */
+
+#define VARATT_IS_4B(PTR) \
+	((((varattrib_1b *) (PTR))->va_header & 0x01) == 0x00)
+#define VARATT_IS_4B_U(PTR) \
+	((((varattrib_1b *) (PTR))->va_header & 0x03) == 0x00)
+#define VARATT_IS_4B_C(PTR) \
+	((((varattrib_1b *) (PTR))->va_header & 0x03) == 0x02)
+#define VARATT_IS_1B(PTR) \
+	((((varattrib_1b *) (PTR))->va_header & 0x01) == 0x01)
+#define VARATT_IS_1B_E(PTR) \
+	((((varattrib_1b *) (PTR))->va_header) == 0x01)
+#define VARATT_NOT_PAD_BYTE(PTR) \
+	(*((uint8 *) (PTR)) != 0)
+
+/* VARSIZE_4B() should only be used on known-aligned data */
+#define VARSIZE_4B(PTR) \
+	((((varattrib_4b *) (PTR))->va_4byte.va_header >> 2) & 0x3FFFFFFF)
+#define VARSIZE_1B(PTR) \
+	((((varattrib_1b *) (PTR))->va_header >> 1) & 0x7F)
+#define VARTAG_1B_E(PTR) \
+	(((varattrib_1b_e *) (PTR))->va_tag)
+
+#define SET_VARSIZE_4B(PTR,len) \
+	(((varattrib_4b *) (PTR))->va_4byte.va_header = (((uint32) (len)) << 2))
+#define SET_VARSIZE_4B_C(PTR,len) \
+	(((varattrib_4b *) (PTR))->va_4byte.va_header = (((uint32) (len)) << 2) | 0x02)
+#define SET_VARSIZE_1B(PTR,len) \
+	(((varattrib_1b *) (PTR))->va_header = (((uint8) (len)) << 1) | 0x01)
+#define SET_VARTAG_1B_E(PTR,tag) \
+	(((varattrib_1b_e *) (PTR))->va_header = 0x01, \
+	 ((varattrib_1b_e *) (PTR))->va_tag = (tag))
+#endif   /* WORDS_BIGENDIAN */
+
+#define VARHDRSZ_SHORT			offsetof(varattrib_1b, va_data)
+#define VARATT_SHORT_MAX		0x7F
+#define VARATT_CAN_MAKE_SHORT(PTR) \
+	(VARATT_IS_4B_U(PTR) && \
+	 (VARSIZE(PTR) - VARHDRSZ + VARHDRSZ_SHORT) <= VARATT_SHORT_MAX)
+#define VARATT_CONVERTED_SHORT_SIZE(PTR) \
+	(VARSIZE(PTR) - VARHDRSZ + VARHDRSZ_SHORT)
+
+#define VARHDRSZ_EXTERNAL		offsetof(varattrib_1b_e, va_data)
+
+#define VARDATA_4B(PTR)		(((varattrib_4b *) (PTR))->va_4byte.va_data)
+#define VARDATA_4B_C(PTR)	(((varattrib_4b *) (PTR))->va_compressed.va_data)
+#define VARDATA_1B(PTR)		(((varattrib_1b *) (PTR))->va_data)
+#define VARDATA_1B_E(PTR)	(((varattrib_1b_e *) (PTR))->va_data)
+
+#define VARRAWSIZE_4B_C(PTR) \
+	(((varattrib_4b *) (PTR))->va_compressed.va_rawsize)
+
+/* Externally visible macros */
+
+/*
+ * VARDATA, VARSIZE, and SET_VARSIZE are the recommended API for most code
+ * for varlena datatypes.  Note that they only work on untoasted,
+ * 4-byte-header Datums!
+ *
+ * Code that wants to use 1-byte-header values without detoasting should
+ * use VARSIZE_ANY/VARSIZE_ANY_EXHDR/VARDATA_ANY.  The other macros here
+ * should usually be used only by tuple assembly/disassembly code and
+ * code that specifically wants to work with still-toasted Datums.
+ *
+ * WARNING: It is only safe to use VARDATA_ANY() -- typically with
+ * PG_DETOAST_DATUM_PACKED() -- if you really don't care about the alignment.
+ * Either because you're working with something like text where the alignment
+ * doesn't matter or because you're not going to access its constituent parts
+ * and just use things like memcpy on it anyways.
+ */
+#define VARDATA(PTR)						VARDATA_4B(PTR)
+#define VARSIZE(PTR)						VARSIZE_4B(PTR)
+
+#define VARSIZE_SHORT(PTR)					VARSIZE_1B(PTR)
+#define VARDATA_SHORT(PTR)					VARDATA_1B(PTR)
+
+#define VARTAG_EXTERNAL(PTR)				VARTAG_1B_E(PTR)
+#define VARSIZE_EXTERNAL(PTR)				(VARHDRSZ_EXTERNAL + VARTAG_SIZE(VARTAG_EXTERNAL(PTR)))
+#define VARDATA_EXTERNAL(PTR)				VARDATA_1B_E(PTR)
+
+#define VARATT_IS_COMPRESSED(PTR)			VARATT_IS_4B_C(PTR)
+#define VARATT_IS_EXTERNAL(PTR)				VARATT_IS_1B_E(PTR)
+#define VARATT_IS_EXTERNAL_ONDISK(PTR) \
+	(VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_ONDISK)
+#define VARATT_IS_EXTERNAL_INDIRECT(PTR) \
+	(VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_INDIRECT)
+#define VARATT_IS_EXTERNAL_EXPANDED_RO(PTR) \
+	(VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_EXPANDED_RO)
+#define VARATT_IS_EXTERNAL_EXPANDED_RW(PTR) \
+	(VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_EXPANDED_RW)
+#define VARATT_IS_EXTERNAL_EXPANDED(PTR) \
+	(VARATT_IS_EXTERNAL(PTR) && VARTAG_IS_EXPANDED(VARTAG_EXTERNAL(PTR)))
+#define VARATT_IS_SHORT(PTR)				VARATT_IS_1B(PTR)
+#define VARATT_IS_EXTENDED(PTR)				(!VARATT_IS_4B_U(PTR))
+
+#define SET_VARSIZE(PTR, len)				SET_VARSIZE_4B(PTR, len)
+#define SET_VARSIZE_SHORT(PTR, len)			SET_VARSIZE_1B(PTR, len)
+#define SET_VARSIZE_COMPRESSED(PTR, len)	SET_VARSIZE_4B_C(PTR, len)
+
+#define SET_VARTAG_EXTERNAL(PTR, tag)		SET_VARTAG_1B_E(PTR, tag)
+
+#define VARSIZE_ANY(PTR) \
+	(VARATT_IS_1B_E(PTR) ? VARSIZE_EXTERNAL(PTR) : \
+	 (VARATT_IS_1B(PTR) ? VARSIZE_1B(PTR) : \
+	  VARSIZE_4B(PTR)))
+
+/* Size of a varlena data, excluding header */
+#define VARSIZE_ANY_EXHDR(PTR) \
+	(VARATT_IS_1B_E(PTR) ? VARSIZE_EXTERNAL(PTR)-VARHDRSZ_EXTERNAL : \
+	 (VARATT_IS_1B(PTR) ? VARSIZE_1B(PTR)-VARHDRSZ_SHORT : \
+	  VARSIZE_4B(PTR)-VARHDRSZ))
+
+/* caution: this will not work on an external or compressed-in-line Datum */
+/* caution: this will return a possibly unaligned pointer */
+#define VARDATA_ANY(PTR) \
+	 (VARATT_IS_1B(PTR) ? VARDATA_1B(PTR) : VARDATA_4B(PTR))
+
+
+/* ----------------------------------------------------------------
+ *				Section 2:	datum type + support macros
+ * ----------------------------------------------------------------
+ */
+
+/*
+ * Port Notes:
+ *	Postgres makes the following assumptions about datatype sizes:
+ *
+ *	sizeof(Datum) == sizeof(void *) == 4 or 8
+ *	sizeof(char) == 1
+ *	sizeof(short) == 2
+ *
+ * When a type narrower than Datum is stored in a Datum, we place it in the
+ * low-order bits and are careful that the DatumGetXXX macro for it discards
+ * the unused high-order bits (as opposed to, say, assuming they are zero).
+ * This is needed to support old-style user-defined functions, since depending
+ * on architecture and compiler, the return value of a function returning char
+ * or short may contain garbage when called as if it returned Datum.
+ */
+
+typedef uintptr_t Datum;
+
+#define SIZEOF_DATUM SIZEOF_VOID_P
+
+typedef Datum *DatumPtr;
+
+#define GET_1_BYTE(datum)	(((Datum) (datum)) & 0x000000ff)
+#define GET_2_BYTES(datum)	(((Datum) (datum)) & 0x0000ffff)
+#define GET_4_BYTES(datum)	(((Datum) (datum)) & 0xffffffff)
+#if SIZEOF_DATUM == 8
+#define GET_8_BYTES(datum)	((Datum) (datum))
+#endif
+#define SET_1_BYTE(value)	(((Datum) (value)) & 0x000000ff)
+#define SET_2_BYTES(value)	(((Datum) (value)) & 0x0000ffff)
+#define SET_4_BYTES(value)	(((Datum) (value)) & 0xffffffff)
+#if SIZEOF_DATUM == 8
+#define SET_8_BYTES(value)	((Datum) (value))
+#endif
+
+/*
+ * DatumGetBool
+ *		Returns boolean value of a datum.
+ *
+ * Note: any nonzero value will be considered TRUE, but we ignore bits to
+ * the left of the width of bool, per comment above.
+ */
+
+#define DatumGetBool(X) ((bool) (GET_1_BYTE(X) != 0))
+
+/*
+ * BoolGetDatum
+ *		Returns datum representation for a boolean.
+ *
+ * Note: any nonzero value will be considered TRUE.
+ */
+
+#define BoolGetDatum(X) ((Datum) ((X) ? 1 : 0))
+
+/*
+ * DatumGetChar
+ *		Returns character value of a datum.
+ */
+
+#define DatumGetChar(X) ((char) GET_1_BYTE(X))
+
+/*
+ * CharGetDatum
+ *		Returns datum representation for a character.
+ */
+
+#define CharGetDatum(X) ((Datum) SET_1_BYTE(X))
+
+/*
+ * Int8GetDatum
+ *		Returns datum representation for an 8-bit integer.
+ */
+
+#define Int8GetDatum(X) ((Datum) SET_1_BYTE(X))
+
+/*
+ * DatumGetUInt8
+ *		Returns 8-bit unsigned integer value of a datum.
+ */
+
+#define DatumGetUInt8(X) ((uint8) GET_1_BYTE(X))
+
+/*
+ * UInt8GetDatum
+ *		Returns datum representation for an 8-bit unsigned integer.
+ */
+
+#define UInt8GetDatum(X) ((Datum) SET_1_BYTE(X))
+
+/*
+ * DatumGetInt16
+ *		Returns 16-bit integer value of a datum.
+ */
+
+#define DatumGetInt16(X) ((int16) GET_2_BYTES(X))
+
+/*
+ * Int16GetDatum
+ *		Returns datum representation for a 16-bit integer.
+ */
+
+#define Int16GetDatum(X) ((Datum) SET_2_BYTES(X))
+
+/*
+ * DatumGetUInt16
+ *		Returns 16-bit unsigned integer value of a datum.
+ */
+
+#define DatumGetUInt16(X) ((uint16) GET_2_BYTES(X))
+
+/*
+ * UInt16GetDatum
+ *		Returns datum representation for a 16-bit unsigned integer.
+ */
+
+#define UInt16GetDatum(X) ((Datum) SET_2_BYTES(X))
+
+/*
+ * DatumGetInt32
+ *		Returns 32-bit integer value of a datum.
+ */
+
+#define DatumGetInt32(X) ((int32) GET_4_BYTES(X))
+
+/*
+ * Int32GetDatum
+ *		Returns datum representation for a 32-bit integer.
+ */
+
+#define Int32GetDatum(X) ((Datum) SET_4_BYTES(X))
+
+/*
+ * DatumGetUInt32
+ *		Returns 32-bit unsigned integer value of a datum.
+ */
+
+#define DatumGetUInt32(X) ((uint32) GET_4_BYTES(X))
+
+/*
+ * UInt32GetDatum
+ *		Returns datum representation for a 32-bit unsigned integer.
+ */
+
+#define UInt32GetDatum(X) ((Datum) SET_4_BYTES(X))
+
+/*
+ * DatumGetObjectId
+ *		Returns object identifier value of a datum.
+ */
+
+#define DatumGetObjectId(X) ((Oid) GET_4_BYTES(X))
+
+/*
+ * ObjectIdGetDatum
+ *		Returns datum representation for an object identifier.
+ */
+
+#define ObjectIdGetDatum(X) ((Datum) SET_4_BYTES(X))
+
+/*
+ * DatumGetTransactionId
+ *		Returns transaction identifier value of a datum.
+ */
+
+#define DatumGetTransactionId(X) ((TransactionId) GET_4_BYTES(X))
+
+/*
+ * TransactionIdGetDatum
+ *		Returns datum representation for a transaction identifier.
+ */
+
+#define TransactionIdGetDatum(X) ((Datum) SET_4_BYTES((X)))
+
+/*
+ * MultiXactIdGetDatum
+ *		Returns datum representation for a multixact identifier.
+ */
+
+#define MultiXactIdGetDatum(X) ((Datum) SET_4_BYTES((X)))
+
+/*
+ * DatumGetCommandId
+ *		Returns command identifier value of a datum.
+ */
+
+#define DatumGetCommandId(X) ((CommandId) GET_4_BYTES(X))
+
+/*
+ * CommandIdGetDatum
+ *		Returns datum representation for a command identifier.
+ */
+
+#define CommandIdGetDatum(X) ((Datum) SET_4_BYTES(X))
+
+/*
+ * DatumGetPointer
+ *		Returns pointer value of a datum.
+ */
+
+#define DatumGetPointer(X) ((Pointer) (X))
+
+/*
+ * PointerGetDatum
+ *		Returns datum representation for a pointer.
+ */
+
+#define PointerGetDatum(X) ((Datum) (X))
+
+/*
+ * DatumGetCString
+ *		Returns C string (null-terminated string) value of a datum.
+ *
+ * Note: C string is not a full-fledged Postgres type at present,
+ * but type input functions use this conversion for their inputs.
+ */
+
+#define DatumGetCString(X) ((char *) DatumGetPointer(X))
+
+/*
+ * CStringGetDatum
+ *		Returns datum representation for a C string (null-terminated string).
+ *
+ * Note: C string is not a full-fledged Postgres type at present,
+ * but type output functions use this conversion for their outputs.
+ * Note: CString is pass-by-reference; caller must ensure the pointed-to
+ * value has adequate lifetime.
+ */
+
+#define CStringGetDatum(X) PointerGetDatum(X)
+
+/*
+ * DatumGetName
+ *		Returns name value of a datum.
+ */
+
+#define DatumGetName(X) ((Name) DatumGetPointer(X))
+
+/*
+ * NameGetDatum
+ *		Returns datum representation for a name.
+ *
+ * Note: Name is pass-by-reference; caller must ensure the pointed-to
+ * value has adequate lifetime.
+ */
+
+#define NameGetDatum(X) PointerGetDatum(X)
+
+/*
+ * DatumGetInt64
+ *		Returns 64-bit integer value of a datum.
+ *
+ * Note: this macro hides whether int64 is pass by value or by reference.
+ */
+
+#ifdef USE_FLOAT8_BYVAL
+#define DatumGetInt64(X) ((int64) GET_8_BYTES(X))
+#else
+#define DatumGetInt64(X) (* ((int64 *) DatumGetPointer(X)))
+#endif
+
+/*
+ * Int64GetDatum
+ *		Returns datum representation for a 64-bit integer.
+ *
+ * Note: if int64 is pass by reference, this function returns a reference
+ * to palloc'd space.
+ */
+
+#ifdef USE_FLOAT8_BYVAL
+#define Int64GetDatum(X) ((Datum) SET_8_BYTES(X))
+#else
+extern Datum Int64GetDatum(int64 X);
+#endif
+
+/*
+ * DatumGetFloat4
+ *		Returns 4-byte floating point value of a datum.
+ *
+ * Note: this macro hides whether float4 is pass by value or by reference.
+ */
+
+#ifdef USE_FLOAT4_BYVAL
+extern float4 DatumGetFloat4(Datum X);
+#else
+#define DatumGetFloat4(X) (* ((float4 *) DatumGetPointer(X)))
+#endif
+
+/*
+ * Float4GetDatum
+ *		Returns datum representation for a 4-byte floating point number.
+ *
+ * Note: if float4 is pass by reference, this function returns a reference
+ * to palloc'd space.
+ */
+
+extern Datum Float4GetDatum(float4 X);
+
+/*
+ * DatumGetFloat8
+ *		Returns 8-byte floating point value of a datum.
+ *
+ * Note: this macro hides whether float8 is pass by value or by reference.
+ */
+
+#ifdef USE_FLOAT8_BYVAL
+extern float8 DatumGetFloat8(Datum X);
+#else
+#define DatumGetFloat8(X) (* ((float8 *) DatumGetPointer(X)))
+#endif
+
+/*
+ * Float8GetDatum
+ *		Returns datum representation for an 8-byte floating point number.
+ *
+ * Note: if float8 is pass by reference, this function returns a reference
+ * to palloc'd space.
+ */
+
+extern Datum Float8GetDatum(float8 X);
+
+
+/*
+ * Int64GetDatumFast
+ * Float8GetDatumFast
+ * Float4GetDatumFast
+ *
+ * These macros are intended to allow writing code that does not depend on
+ * whether int64, float8, float4 are pass-by-reference types, while not
+ * sacrificing performance when they are.  The argument must be a variable
+ * that will exist and have the same value for as long as the Datum is needed.
+ * In the pass-by-ref case, the address of the variable is taken to use as
+ * the Datum.  In the pass-by-val case, these will be the same as the non-Fast
+ * macros.
+ */
+
+#ifdef USE_FLOAT8_BYVAL
+#define Int64GetDatumFast(X)  Int64GetDatum(X)
+#define Float8GetDatumFast(X) Float8GetDatum(X)
+#else
+#define Int64GetDatumFast(X)  PointerGetDatum(&(X))
+#define Float8GetDatumFast(X) PointerGetDatum(&(X))
+#endif
+
+#ifdef USE_FLOAT4_BYVAL
+#define Float4GetDatumFast(X) Float4GetDatum(X)
+#else
+#define Float4GetDatumFast(X) PointerGetDatum(&(X))
+#endif
+
+
+/* ----------------------------------------------------------------
+ *				Section 3:	exception handling backend support
+ * ----------------------------------------------------------------
+ */
+
+/*
+ * Backend only infrastructure for the assertion-related macros in c.h.
+ *
+ * ExceptionalCondition must be present even when assertions are not enabled.
+ */
+extern void ExceptionalCondition(const char *conditionName,
+					 const char *errorType,
+			   const char *fileName, int lineNumber) pg_attribute_noreturn();
+
+#endif   /* POSTGRES_H */
diff --git a/foreign/libpg_query/src/postgres/include/postgres_ext.h b/foreign/libpg_query/src/postgres/include/postgres_ext.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/postgres_ext.h
@@ -0,0 +1,69 @@
+/*-------------------------------------------------------------------------
+ *
+ * postgres_ext.h
+ *
+ *	   This file contains declarations of things that are visible everywhere
+ *	in PostgreSQL *and* are visible to clients of frontend interface libraries.
+ *	For example, the Oid type is part of the API of libpq and other libraries.
+ *
+ *	   Declarations which are specific to a particular interface should
+ *	go in the header file for that interface (such as libpq-fe.h).  This
+ *	file is only for fundamental Postgres declarations.
+ *
+ *	   User-written C functions don't count as "external to Postgres."
+ *	Those function much as local modifications to the backend itself, and
+ *	use header files that are otherwise internal to Postgres to interface
+ *	with the backend.
+ *
+ * src/include/postgres_ext.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef POSTGRES_EXT_H
+#define POSTGRES_EXT_H
+
+#include "pg_config_ext.h"
+
+/*
+ * Object ID is a fundamental type in Postgres.
+ */
+typedef unsigned int Oid;
+
+#ifdef __cplusplus
+#define InvalidOid		(Oid(0))
+#else
+#define InvalidOid		((Oid) 0)
+#endif
+
+#define OID_MAX  UINT_MAX
+/* you will need to include <limits.h> to use the above #define */
+
+/* Define a signed 64-bit integer type for use in client API declarations. */
+typedef PG_INT64_TYPE pg_int64;
+
+
+/*
+ * Identifiers of error message fields.  Kept here to keep common
+ * between frontend and backend, and also to export them to libpq
+ * applications.
+ */
+#define PG_DIAG_SEVERITY		'S'
+#define PG_DIAG_SQLSTATE		'C'
+#define PG_DIAG_MESSAGE_PRIMARY 'M'
+#define PG_DIAG_MESSAGE_DETAIL	'D'
+#define PG_DIAG_MESSAGE_HINT	'H'
+#define PG_DIAG_STATEMENT_POSITION 'P'
+#define PG_DIAG_INTERNAL_POSITION 'p'
+#define PG_DIAG_INTERNAL_QUERY	'q'
+#define PG_DIAG_CONTEXT			'W'
+#define PG_DIAG_SCHEMA_NAME		's'
+#define PG_DIAG_TABLE_NAME		't'
+#define PG_DIAG_COLUMN_NAME		'c'
+#define PG_DIAG_DATATYPE_NAME	'd'
+#define PG_DIAG_CONSTRAINT_NAME 'n'
+#define PG_DIAG_SOURCE_FILE		'F'
+#define PG_DIAG_SOURCE_LINE		'L'
+#define PG_DIAG_SOURCE_FUNCTION 'R'
+
+#endif   /* POSTGRES_EXT_H */
diff --git a/foreign/libpg_query/src/postgres/include/postmaster/autovacuum.h b/foreign/libpg_query/src/postgres/include/postmaster/autovacuum.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/postmaster/autovacuum.h
@@ -0,0 +1,67 @@
+/*-------------------------------------------------------------------------
+ *
+ * autovacuum.h
+ *	  header file for integrated autovacuum daemon
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/postmaster/autovacuum.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef AUTOVACUUM_H
+#define AUTOVACUUM_H
+
+
+/* GUC variables */
+extern bool autovacuum_start_daemon;
+extern int	autovacuum_max_workers;
+extern int	autovacuum_work_mem;
+extern int	autovacuum_naptime;
+extern int	autovacuum_vac_thresh;
+extern double autovacuum_vac_scale;
+extern int	autovacuum_anl_thresh;
+extern double autovacuum_anl_scale;
+extern int	autovacuum_freeze_max_age;
+extern int	autovacuum_multixact_freeze_max_age;
+extern int	autovacuum_vac_cost_delay;
+extern int	autovacuum_vac_cost_limit;
+
+/* autovacuum launcher PID, only valid when worker is shutting down */
+extern int	AutovacuumLauncherPid;
+
+extern int	Log_autovacuum_min_duration;
+
+/* Status inquiry functions */
+extern bool AutoVacuumingActive(void);
+extern bool IsAutoVacuumLauncherProcess(void);
+extern bool IsAutoVacuumWorkerProcess(void);
+
+#define IsAnyAutoVacuumProcess() \
+	(IsAutoVacuumLauncherProcess() || IsAutoVacuumWorkerProcess())
+
+/* Functions to start autovacuum process, called from postmaster */
+extern void autovac_init(void);
+extern int	StartAutoVacLauncher(void);
+extern int	StartAutoVacWorker(void);
+
+/* called from postmaster when a worker could not be forked */
+extern void AutoVacWorkerFailed(void);
+
+/* autovacuum cost-delay balancer */
+extern void AutoVacuumUpdateDelay(void);
+
+#ifdef EXEC_BACKEND
+extern void AutoVacLauncherMain(int argc, char *argv[]) pg_attribute_noreturn();
+extern void AutoVacWorkerMain(int argc, char *argv[]) pg_attribute_noreturn();
+extern void AutovacuumWorkerIAm(void);
+extern void AutovacuumLauncherIAm(void);
+#endif
+
+/* shared memory stuff */
+extern Size AutoVacuumShmemSize(void);
+extern void AutoVacuumShmemInit(void);
+
+#endif   /* AUTOVACUUM_H */
diff --git a/foreign/libpg_query/src/postgres/include/postmaster/bgworker.h b/foreign/libpg_query/src/postgres/include/postmaster/bgworker.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/postmaster/bgworker.h
@@ -0,0 +1,144 @@
+/*--------------------------------------------------------------------
+ * bgworker.h
+ *		POSTGRES pluggable background workers interface
+ *
+ * A background worker is a process able to run arbitrary, user-supplied code,
+ * including normal transactions.
+ *
+ * Any external module loaded via shared_preload_libraries can register a
+ * worker.  Workers can also be registered dynamically at runtime.  In either
+ * case, the worker process is forked from the postmaster and runs the
+ * user-supplied "main" function.  This code may connect to a database and
+ * run transactions.  Workers can remain active indefinitely, but will be
+ * terminated if a shutdown or crash occurs.
+ *
+ * If the fork() call fails in the postmaster, it will try again later.  Note
+ * that the failure can only be transient (fork failure due to high load,
+ * memory pressure, too many processes, etc); more permanent problems, like
+ * failure to connect to a database, are detected later in the worker and dealt
+ * with just by having the worker exit normally. A worker which exits with
+ * a return code of 0 will never be restarted and will be removed from worker
+ * list. A worker which exits with a return code of 1 will be restarted after
+ * the configured restart interval (unless that interval is BGW_NEVER_RESTART).
+ * The TerminateBackgroundWorker() function can be used to terminate a
+ * dynamically registered background worker; the worker will be sent a SIGTERM
+ * and will not be restarted after it exits.  Whenever the postmaster knows
+ * that a worker will not be restarted, it unregisters the worker, freeing up
+ * that worker's slot for use by a new worker.
+ *
+ * Note that there might be more than one worker in a database concurrently,
+ * and the same module may request more than one worker running the same (or
+ * different) code.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ *		src/include/postmaster/bgworker.h
+ *--------------------------------------------------------------------
+ */
+#ifndef BGWORKER_H
+#define BGWORKER_H
+
+/*---------------------------------------------------------------------
+ * External module API.
+ *---------------------------------------------------------------------
+ */
+
+/*
+ * Pass this flag to have your worker be able to connect to shared memory.
+ */
+#define BGWORKER_SHMEM_ACCESS						0x0001
+
+/*
+ * This flag means the bgworker requires a database connection.  The connection
+ * is not established automatically; the worker must establish it later.
+ * It requires that BGWORKER_SHMEM_ACCESS was passed too.
+ */
+#define BGWORKER_BACKEND_DATABASE_CONNECTION		0x0002
+
+
+typedef void (*bgworker_main_type) (Datum main_arg);
+
+/*
+ * Points in time at which a bgworker can request to be started
+ */
+typedef enum
+{
+	BgWorkerStart_PostmasterStart,
+	BgWorkerStart_ConsistentState,
+	BgWorkerStart_RecoveryFinished
+} BgWorkerStartTime;
+
+#define BGW_DEFAULT_RESTART_INTERVAL	60
+#define BGW_NEVER_RESTART				-1
+#define BGW_MAXLEN						64
+#define BGW_EXTRALEN					128
+
+typedef struct BackgroundWorker
+{
+	char		bgw_name[BGW_MAXLEN];
+	int			bgw_flags;
+	BgWorkerStartTime bgw_start_time;
+	int			bgw_restart_time;		/* in seconds, or BGW_NEVER_RESTART */
+	bgworker_main_type bgw_main;
+	char		bgw_library_name[BGW_MAXLEN];	/* only if bgw_main is NULL */
+	char		bgw_function_name[BGW_MAXLEN];	/* only if bgw_main is NULL */
+	Datum		bgw_main_arg;
+	char		bgw_extra[BGW_EXTRALEN];
+	pid_t		bgw_notify_pid; /* SIGUSR1 this backend on start/stop */
+} BackgroundWorker;
+
+typedef enum BgwHandleStatus
+{
+	BGWH_STARTED,				/* worker is running */
+	BGWH_NOT_YET_STARTED,		/* worker hasn't been started yet */
+	BGWH_STOPPED,				/* worker has exited */
+	BGWH_POSTMASTER_DIED		/* postmaster died; worker status unclear */
+} BgwHandleStatus;
+
+struct BackgroundWorkerHandle;
+typedef struct BackgroundWorkerHandle BackgroundWorkerHandle;
+
+/* Register a new bgworker during shared_preload_libraries */
+extern void RegisterBackgroundWorker(BackgroundWorker *worker);
+
+/* Register a new bgworker from a regular backend */
+extern bool RegisterDynamicBackgroundWorker(BackgroundWorker *worker,
+								BackgroundWorkerHandle **handle);
+
+/* Query the status of a bgworker */
+extern BgwHandleStatus GetBackgroundWorkerPid(BackgroundWorkerHandle *handle,
+					   pid_t *pidp);
+extern BgwHandleStatus
+WaitForBackgroundWorkerStartup(BackgroundWorkerHandle *
+							   handle, pid_t *pid);
+extern BgwHandleStatus
+			WaitForBackgroundWorkerShutdown(BackgroundWorkerHandle *);
+
+/* Terminate a bgworker */
+extern void TerminateBackgroundWorker(BackgroundWorkerHandle *handle);
+
+/* This is valid in a running worker */
+extern PGDLLIMPORT BackgroundWorker *MyBgworkerEntry;
+
+/*
+ * Connect to the specified database, as the specified user.  Only a worker
+ * that passed BGWORKER_BACKEND_DATABASE_CONNECTION during registration may
+ * call this.
+ *
+ * If username is NULL, bootstrapping superuser is used.
+ * If dbname is NULL, connection is made to no specific database;
+ * only shared catalogs can be accessed.
+ */
+extern void BackgroundWorkerInitializeConnection(char *dbname, char *username);
+
+/* Just like the above, but specifying database and user by OID. */
+extern void BackgroundWorkerInitializeConnectionByOid(Oid dboid, Oid useroid);
+
+/* Block/unblock signals in a background worker process */
+extern void BackgroundWorkerBlockSignals(void);
+extern void BackgroundWorkerUnblockSignals(void);
+
+#endif   /* BGWORKER_H */
diff --git a/foreign/libpg_query/src/postgres/include/postmaster/bgworker_internals.h b/foreign/libpg_query/src/postgres/include/postmaster/bgworker_internals.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/postmaster/bgworker_internals.h
@@ -0,0 +1,55 @@
+/*--------------------------------------------------------------------
+ * bgworker_internals.h
+ *		POSTGRES pluggable background workers internals
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ *		src/include/postmaster/bgworker_internals.h
+ *--------------------------------------------------------------------
+ */
+#ifndef BGWORKER_INTERNALS_H
+#define BGWORKER_INTERNALS_H
+
+#include "datatype/timestamp.h"
+#include "lib/ilist.h"
+#include "postmaster/bgworker.h"
+
+/*
+ * List of background workers, private to postmaster.
+ *
+ * A worker that requests a database connection during registration will have
+ * rw_backend set, and will be present in BackendList.  Note: do not rely on
+ * rw_backend being non-NULL for shmem-connected workers!
+ */
+typedef struct RegisteredBgWorker
+{
+	BackgroundWorker rw_worker; /* its registry entry */
+	struct bkend *rw_backend;	/* its BackendList entry, or NULL */
+	pid_t		rw_pid;			/* 0 if not running */
+	int			rw_child_slot;
+	TimestampTz rw_crashed_at;	/* if not 0, time it last crashed */
+	int			rw_shmem_slot;
+	bool		rw_terminate;
+	slist_node	rw_lnode;		/* list link */
+} RegisteredBgWorker;
+
+extern slist_head BackgroundWorkerList;
+
+extern Size BackgroundWorkerShmemSize(void);
+extern void BackgroundWorkerShmemInit(void);
+extern void BackgroundWorkerStateChange(void);
+extern void ForgetBackgroundWorker(slist_mutable_iter *cur);
+extern void ReportBackgroundWorkerPID(RegisteredBgWorker *);
+extern void BackgroundWorkerStopNotifications(pid_t pid);
+extern void ResetBackgroundWorkerCrashTimes(void);
+
+/* Function to start a background worker, called from postmaster.c */
+extern void StartBackgroundWorker(void) pg_attribute_noreturn();
+
+#ifdef EXEC_BACKEND
+extern BackgroundWorker *BackgroundWorkerEntry(int slotno);
+#endif
+
+#endif   /* BGWORKER_INTERNALS_H */
diff --git a/foreign/libpg_query/src/postgres/include/postmaster/bgwriter.h b/foreign/libpg_query/src/postgres/include/postmaster/bgwriter.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/postmaster/bgwriter.h
@@ -0,0 +1,43 @@
+/*-------------------------------------------------------------------------
+ *
+ * bgwriter.h
+ *	  Exports from postmaster/bgwriter.c and postmaster/checkpointer.c.
+ *
+ * The bgwriter process used to handle checkpointing duties too.  Now
+ * there is a separate process, but we did not bother to split this header.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ *
+ * src/include/postmaster/bgwriter.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef _BGWRITER_H
+#define _BGWRITER_H
+
+#include "storage/block.h"
+#include "storage/relfilenode.h"
+
+
+/* GUC options */
+extern int	BgWriterDelay;
+extern int	CheckPointTimeout;
+extern int	CheckPointWarning;
+extern double CheckPointCompletionTarget;
+
+extern void BackgroundWriterMain(void) pg_attribute_noreturn();
+extern void CheckpointerMain(void) pg_attribute_noreturn();
+
+extern void RequestCheckpoint(int flags);
+extern void CheckpointWriteDelay(int flags, double progress);
+
+extern bool ForwardFsyncRequest(RelFileNode rnode, ForkNumber forknum,
+					BlockNumber segno);
+extern void AbsorbFsyncRequests(void);
+
+extern Size CheckpointerShmemSize(void);
+extern void CheckpointerShmemInit(void);
+
+extern bool FirstCallSinceLastCheckpoint(void);
+
+#endif   /* _BGWRITER_H */
diff --git a/foreign/libpg_query/src/postgres/include/postmaster/fork_process.h b/foreign/libpg_query/src/postgres/include/postmaster/fork_process.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/postmaster/fork_process.h
@@ -0,0 +1,17 @@
+/*-------------------------------------------------------------------------
+ *
+ * fork_process.h
+ *	  Exports from postmaster/fork_process.c.
+ *
+ * Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ *
+ * src/include/postmaster/fork_process.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef FORK_PROCESS_H
+#define FORK_PROCESS_H
+
+extern pid_t fork_process(void);
+
+#endif   /* FORK_PROCESS_H */
diff --git a/foreign/libpg_query/src/postgres/include/postmaster/pgarch.h b/foreign/libpg_query/src/postgres/include/postmaster/pgarch.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/postmaster/pgarch.h
@@ -0,0 +1,39 @@
+/*-------------------------------------------------------------------------
+ *
+ * pgarch.h
+ *	  Exports from postmaster/pgarch.c.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/postmaster/pgarch.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef _PGARCH_H
+#define _PGARCH_H
+
+/* ----------
+ * Archiver control info.
+ *
+ * We expect that archivable files within pg_xlog will have names between
+ * MIN_XFN_CHARS and MAX_XFN_CHARS in length, consisting only of characters
+ * appearing in VALID_XFN_CHARS.  The status files in archive_status have
+ * corresponding names with ".ready" or ".done" appended.
+ * ----------
+ */
+#define MIN_XFN_CHARS	16
+#define MAX_XFN_CHARS	40
+#define VALID_XFN_CHARS "0123456789ABCDEF.history.backup.partial"
+
+/* ----------
+ * Functions called from postmaster
+ * ----------
+ */
+extern int	pgarch_start(void);
+
+#ifdef EXEC_BACKEND
+extern void PgArchiverMain(int argc, char *argv[]) pg_attribute_noreturn();
+#endif
+
+#endif   /* _PGARCH_H */
diff --git a/foreign/libpg_query/src/postgres/include/postmaster/postmaster.h b/foreign/libpg_query/src/postgres/include/postmaster/postmaster.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/postmaster/postmaster.h
@@ -0,0 +1,74 @@
+/*-------------------------------------------------------------------------
+ *
+ * postmaster.h
+ *	  Exports from postmaster/postmaster.c.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/postmaster/postmaster.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef _POSTMASTER_H
+#define _POSTMASTER_H
+
+/* GUC options */
+extern bool EnableSSL;
+extern int	ReservedBackends;
+extern int	PostPortNumber;
+extern int	Unix_socket_permissions;
+extern char *Unix_socket_group;
+extern char *Unix_socket_directories;
+extern char *ListenAddresses;
+extern __thread  bool ClientAuthInProgress;
+extern int	PreAuthDelay;
+extern int	AuthenticationTimeout;
+extern bool Log_connections;
+extern bool log_hostname;
+extern bool enable_bonjour;
+extern char *bonjour_name;
+extern bool restart_after_crash;
+
+#ifdef WIN32
+extern HANDLE PostmasterHandle;
+#else
+extern int	postmaster_alive_fds[2];
+
+/*
+ * Constants that represent which of postmaster_alive_fds is held by
+ * postmaster, and which is used in children to check for postmaster death.
+ */
+#define POSTMASTER_FD_WATCH		0		/* used in children to check for
+										 * postmaster death */
+#define POSTMASTER_FD_OWN		1		/* kept open by postmaster only */
+#endif
+
+extern const char *progname;
+
+extern void PostmasterMain(int argc, char *argv[]) pg_attribute_noreturn();
+extern void ClosePostmasterPorts(bool am_syslogger);
+
+extern int	MaxLivePostmasterChildren(void);
+
+extern int	GetNumShmemAttachedBgworkers(void);
+extern bool PostmasterMarkPIDForWorkerNotify(int);
+
+#ifdef EXEC_BACKEND
+extern pid_t postmaster_forkexec(int argc, char *argv[]);
+extern void SubPostmasterMain(int argc, char *argv[]) pg_attribute_noreturn();
+
+extern Size ShmemBackendArraySize(void);
+extern void ShmemBackendArrayAllocation(void);
+#endif
+
+/*
+ * Note: MAX_BACKENDS is limited to 2^23-1 because inval.c stores the
+ * backend ID as a 3-byte signed integer.  Even if that limitation were
+ * removed, we still could not exceed INT_MAX/4 because some places compute
+ * 4*MaxBackends without any overflow check.  This is rechecked in the relevant
+ * GUC check hooks and in RegisterBackgroundWorker().
+ */
+#define MAX_BACKENDS	0x7fffff
+
+#endif   /* _POSTMASTER_H */
diff --git a/foreign/libpg_query/src/postgres/include/postmaster/syslogger.h b/foreign/libpg_query/src/postgres/include/postmaster/syslogger.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/postmaster/syslogger.h
@@ -0,0 +1,90 @@
+/*-------------------------------------------------------------------------
+ *
+ * syslogger.h
+ *	  Exports from postmaster/syslogger.c.
+ *
+ * Copyright (c) 2004-2015, PostgreSQL Global Development Group
+ *
+ * src/include/postmaster/syslogger.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef _SYSLOGGER_H
+#define _SYSLOGGER_H
+
+#include <limits.h>				/* for PIPE_BUF */
+
+
+/*
+ * Primitive protocol structure for writing to syslogger pipe(s).  The idea
+ * here is to divide long messages into chunks that are not more than
+ * PIPE_BUF bytes long, which according to POSIX spec must be written into
+ * the pipe atomically.  The pipe reader then uses the protocol headers to
+ * reassemble the parts of a message into a single string.  The reader can
+ * also cope with non-protocol data coming down the pipe, though we cannot
+ * guarantee long strings won't get split apart.
+ *
+ * We use non-nul bytes in is_last to make the protocol a tiny bit
+ * more robust against finding a false double nul byte prologue. But
+ * we still might find it in the len and/or pid bytes unless we're careful.
+ */
+
+#ifdef PIPE_BUF
+/* Are there any systems with PIPE_BUF > 64K?  Unlikely, but ... */
+#if PIPE_BUF > 65536
+#define PIPE_CHUNK_SIZE  65536
+#else
+#define PIPE_CHUNK_SIZE  ((int) PIPE_BUF)
+#endif
+#else							/* not defined */
+/* POSIX says the value of PIPE_BUF must be at least 512, so use that */
+#define PIPE_CHUNK_SIZE  512
+#endif
+
+typedef struct
+{
+	char		nuls[2];		/* always \0\0 */
+	uint16		len;			/* size of this chunk (counts data only) */
+	int32		pid;			/* writer's pid */
+	char		is_last;		/* last chunk of message? 't' or 'f' ('T' or
+								 * 'F' for CSV case) */
+	char		data[FLEXIBLE_ARRAY_MEMBER];	/* data payload starts here */
+} PipeProtoHeader;
+
+typedef union
+{
+	PipeProtoHeader proto;
+	char		filler[PIPE_CHUNK_SIZE];
+} PipeProtoChunk;
+
+#define PIPE_HEADER_SIZE  offsetof(PipeProtoHeader, data)
+#define PIPE_MAX_PAYLOAD  ((int) (PIPE_CHUNK_SIZE - PIPE_HEADER_SIZE))
+
+
+/* GUC options */
+extern bool Logging_collector;
+extern int	Log_RotationAge;
+extern int	Log_RotationSize;
+extern PGDLLIMPORT char *Log_directory;
+extern PGDLLIMPORT char *Log_filename;
+extern bool Log_truncate_on_rotation;
+extern int	Log_file_mode;
+
+extern bool am_syslogger;
+
+#ifndef WIN32
+extern int	syslogPipe[2];
+#else
+extern HANDLE syslogPipe[2];
+#endif
+
+
+extern int	SysLogger_Start(void);
+
+extern void write_syslogger_file(const char *buffer, int count, int dest);
+
+#ifdef EXEC_BACKEND
+extern void SysLoggerMain(int argc, char *argv[]) pg_attribute_noreturn();
+#endif
+
+#endif   /* _SYSLOGGER_H */
diff --git a/foreign/libpg_query/src/postgres/include/postmaster/walwriter.h b/foreign/libpg_query/src/postgres/include/postmaster/walwriter.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/postmaster/walwriter.h
@@ -0,0 +1,20 @@
+/*-------------------------------------------------------------------------
+ *
+ * walwriter.h
+ *	  Exports from postmaster/walwriter.c.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ *
+ * src/include/postmaster/walwriter.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef _WALWRITER_H
+#define _WALWRITER_H
+
+/* GUC options */
+extern int	WalWriterDelay;
+
+extern void WalWriterMain(void) pg_attribute_noreturn();
+
+#endif   /* _WALWRITER_H */
diff --git a/foreign/libpg_query/src/postgres/include/regex/regex.h b/foreign/libpg_query/src/postgres/include/regex/regex.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/regex/regex.h
@@ -0,0 +1,177 @@
+#ifndef _REGEX_H_
+#define _REGEX_H_				/* never again */
+/*
+ * regular expressions
+ *
+ * Copyright (c) 1998, 1999 Henry Spencer.  All rights reserved.
+ *
+ * Development of this software was funded, in part, by Cray Research Inc.,
+ * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics
+ * Corporation, none of whom are responsible for the results.  The author
+ * thanks all of them.
+ *
+ * Redistribution and use in source and binary forms -- with or without
+ * modification -- are permitted for any purpose, provided that
+ * redistributions in source form retain this entire copyright notice and
+ * indicate the origin and nature of any modifications.
+ *
+ * I'd appreciate being given credit for this package in the documentation
+ * of software which uses it, but that is not a requirement.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
+ * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * src/include/regex/regex.h
+ */
+
+/*
+ * Add your own defines, if needed, here.
+ */
+#include "mb/pg_wchar.h"
+
+/*
+ * interface types etc.
+ */
+
+/*
+ * regoff_t has to be large enough to hold either off_t or ssize_t,
+ * and must be signed; it's only a guess that long is suitable.
+ */
+typedef long regoff_t;
+
+/*
+ * other interface types
+ */
+
+/* the biggie, a compiled RE (or rather, a front end to same) */
+typedef struct
+{
+	int			re_magic;		/* magic number */
+	size_t		re_nsub;		/* number of subexpressions */
+	long		re_info;		/* information about RE */
+#define  REG_UBACKREF		 000001
+#define  REG_ULOOKAHEAD		 000002
+#define  REG_UBOUNDS	 000004
+#define  REG_UBRACES	 000010
+#define  REG_UBSALNUM		 000020
+#define  REG_UPBOTCH	 000040
+#define  REG_UBBS		 000100
+#define  REG_UNONPOSIX		 000200
+#define  REG_UUNSPEC	 000400
+#define  REG_UUNPORT	 001000
+#define  REG_ULOCALE	 002000
+#define  REG_UEMPTYMATCH	 004000
+#define  REG_UIMPOSSIBLE	 010000
+#define  REG_USHORTEST		 020000
+	int			re_csize;		/* sizeof(character) */
+	char	   *re_endp;		/* backward compatibility kludge */
+	Oid			re_collation;	/* Collation that defines LC_CTYPE behavior */
+	/* the rest is opaque pointers to hidden innards */
+	char	   *re_guts;		/* `char *' is more portable than `void *' */
+	char	   *re_fns;
+} regex_t;
+
+/* result reporting (may acquire more fields later) */
+typedef struct
+{
+	regoff_t	rm_so;			/* start of substring */
+	regoff_t	rm_eo;			/* end of substring */
+} regmatch_t;
+
+/* supplementary control and reporting */
+typedef struct
+{
+	regmatch_t	rm_extend;		/* see REG_EXPECT */
+} rm_detail_t;
+
+
+
+/*
+ * regex compilation flags
+ */
+#define REG_BASIC	000000		/* BREs (convenience) */
+#define REG_EXTENDED	000001	/* EREs */
+#define REG_ADVF	000002		/* advanced features in EREs */
+#define REG_ADVANCED	000003	/* AREs (which are also EREs) */
+#define REG_QUOTE	000004		/* no special characters, none */
+#define REG_NOSPEC	REG_QUOTE	/* historical synonym */
+#define REG_ICASE	000010		/* ignore case */
+#define REG_NOSUB	000020		/* don't care about subexpressions */
+#define REG_EXPANDED	000040	/* expanded format, white space & comments */
+#define REG_NLSTOP	000100		/* \n doesn't match . or [^ ] */
+#define REG_NLANCH	000200		/* ^ matches after \n, $ before */
+#define REG_NEWLINE 000300		/* newlines are line terminators */
+#define REG_PEND	000400		/* ugh -- backward-compatibility hack */
+#define REG_EXPECT	001000		/* report details on partial/limited matches */
+#define REG_BOSONLY 002000		/* temporary kludge for BOS-only matches */
+#define REG_DUMP	004000		/* none of your business :-) */
+#define REG_FAKE	010000		/* none of your business :-) */
+#define REG_PROGRESS	020000	/* none of your business :-) */
+
+
+
+/*
+ * regex execution flags
+ */
+#define REG_NOTBOL	0001		/* BOS is not BOL */
+#define REG_NOTEOL	0002		/* EOS is not EOL */
+#define REG_STARTEND	0004	/* backward compatibility kludge */
+#define REG_FTRACE	0010		/* none of your business */
+#define REG_MTRACE	0020		/* none of your business */
+#define REG_SMALL	0040		/* none of your business */
+
+
+/*
+ * error reporting
+ * Be careful if modifying the list of error codes -- the table used by
+ * regerror() is generated automatically from this file!
+ */
+#define REG_OKAY	 0			/* no errors detected */
+#define REG_NOMATCH  1			/* failed to match */
+#define REG_BADPAT	 2			/* invalid regexp */
+#define REG_ECOLLATE	 3		/* invalid collating element */
+#define REG_ECTYPE	 4			/* invalid character class */
+#define REG_EESCAPE  5			/* invalid escape \ sequence */
+#define REG_ESUBREG  6			/* invalid backreference number */
+#define REG_EBRACK	 7			/* brackets [] not balanced */
+#define REG_EPAREN	 8			/* parentheses () not balanced */
+#define REG_EBRACE	 9			/* braces {} not balanced */
+#define REG_BADBR	10			/* invalid repetition count(s) */
+#define REG_ERANGE	11			/* invalid character range */
+#define REG_ESPACE	12			/* out of memory */
+#define REG_BADRPT	13			/* quantifier operand invalid */
+#define REG_ASSERT	15			/* "can't happen" -- you found a bug */
+#define REG_INVARG	16			/* invalid argument to regex function */
+#define REG_MIXED	17			/* character widths of regex and string differ */
+#define REG_BADOPT	18			/* invalid embedded option */
+#define REG_ETOOBIG 19			/* regular expression is too complex */
+#define REG_ECOLORS 20			/* too many colors */
+#define REG_CANCEL	21			/* operation cancelled */
+/* two specials for debugging and testing */
+#define REG_ATOI	101			/* convert error-code name to number */
+#define REG_ITOA	102			/* convert error-code number to name */
+/* non-error result codes for pg_regprefix */
+#define REG_PREFIX	(-1)		/* identified a common prefix */
+#define REG_EXACT	(-2)		/* identified an exact match */
+
+
+
+/*
+ * the prototypes for exported functions
+ */
+extern int	pg_regcomp(regex_t *, const pg_wchar *, size_t, int, Oid);
+extern int	pg_regexec(regex_t *, const pg_wchar *, size_t, size_t, rm_detail_t *, size_t, regmatch_t[], int);
+extern int	pg_regprefix(regex_t *, pg_wchar **, size_t *);
+extern void pg_regfree(regex_t *);
+extern size_t pg_regerror(int, const regex_t *, char *, size_t);
+extern void pg_set_regex_collation(Oid collation);
+
+#endif   /* _REGEX_H_ */
diff --git a/foreign/libpg_query/src/postgres/include/replication/origin.h b/foreign/libpg_query/src/postgres/include/replication/origin.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/replication/origin.h
@@ -0,0 +1,88 @@
+/*-------------------------------------------------------------------------
+ * origin.h
+ *	   Exports from replication/logical/origin.c
+ *
+ * Copyright (c) 2013-2015, PostgreSQL Global Development Group
+ *
+ * src/include/replication/origin.h
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_ORIGIN_H
+#define PG_ORIGIN_H
+
+#include "fmgr.h"
+#include "access/xlog.h"
+#include "access/xlogdefs.h"
+#include "access/xlogreader.h"
+#include "catalog/pg_replication_origin.h"
+
+typedef struct xl_replorigin_set
+{
+	XLogRecPtr	remote_lsn;
+	RepOriginId node_id;
+	bool		force;
+} xl_replorigin_set;
+
+typedef struct xl_replorigin_drop
+{
+	RepOriginId node_id;
+} xl_replorigin_drop;
+
+#define XLOG_REPLORIGIN_SET		0x00
+#define XLOG_REPLORIGIN_DROP		0x10
+
+#define InvalidRepOriginId 0
+#define DoNotReplicateId PG_UINT16_MAX
+
+extern PGDLLIMPORT RepOriginId replorigin_session_origin;
+extern PGDLLIMPORT XLogRecPtr replorigin_session_origin_lsn;
+extern PGDLLIMPORT TimestampTz replorigin_session_origin_timestamp;
+
+/* API for querying & manipulating replication origins */
+extern RepOriginId replorigin_by_name(char *name, bool missing_ok);
+extern RepOriginId replorigin_create(char *name);
+extern void replorigin_drop(RepOriginId roident);
+extern bool replorigin_by_oid(RepOriginId roident, bool missing_ok,
+				  char **roname);
+
+/* API for querying & manipulating replication progress tracking */
+extern void replorigin_advance(RepOriginId node,
+				   XLogRecPtr remote_commit,
+				   XLogRecPtr local_commit,
+				   bool go_backward, bool wal_log);
+extern XLogRecPtr replorigin_get_progress(RepOriginId node, bool flush);
+
+extern void replorigin_session_advance(XLogRecPtr remote_commit,
+						   XLogRecPtr local_commit);
+extern void replorigin_session_setup(RepOriginId node);
+extern void replorigin_session_reset(void);
+extern XLogRecPtr replorigin_session_get_progress(bool flush);
+
+/* Checkpoint/Startup integration */
+extern void CheckPointReplicationOrigin(void);
+extern void StartupReplicationOrigin(void);
+
+/* WAL logging */
+void		replorigin_redo(XLogReaderState *record);
+void		replorigin_desc(StringInfo buf, XLogReaderState *record);
+const char *replorigin_identify(uint8 info);
+
+/* shared memory allocation */
+extern Size ReplicationOriginShmemSize(void);
+extern void ReplicationOriginShmemInit(void);
+
+/* SQL callable functions */
+extern Datum pg_replication_origin_create(PG_FUNCTION_ARGS);
+extern Datum pg_replication_origin_drop(PG_FUNCTION_ARGS);
+extern Datum pg_replication_origin_oid(PG_FUNCTION_ARGS);
+extern Datum pg_replication_origin_session_setup(PG_FUNCTION_ARGS);
+extern Datum pg_replication_origin_session_reset(PG_FUNCTION_ARGS);
+extern Datum pg_replication_origin_session_is_setup(PG_FUNCTION_ARGS);
+extern Datum pg_replication_origin_session_progress(PG_FUNCTION_ARGS);
+extern Datum pg_replication_origin_xact_setup(PG_FUNCTION_ARGS);
+extern Datum pg_replication_origin_xact_reset(PG_FUNCTION_ARGS);
+extern Datum pg_replication_origin_advance(PG_FUNCTION_ARGS);
+extern Datum pg_replication_origin_progress(PG_FUNCTION_ARGS);
+extern Datum pg_show_replication_origin_status(PG_FUNCTION_ARGS);
+
+#endif   /* PG_ORIGIN_H */
diff --git a/foreign/libpg_query/src/postgres/include/replication/slot.h b/foreign/libpg_query/src/postgres/include/replication/slot.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/replication/slot.h
@@ -0,0 +1,182 @@
+/*-------------------------------------------------------------------------
+ * slot.h
+ *	   Replication slot management.
+ *
+ * Copyright (c) 2012-2015, PostgreSQL Global Development Group
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef SLOT_H
+#define SLOT_H
+
+#include "fmgr.h"
+#include "access/xlog.h"
+#include "access/xlogreader.h"
+#include "storage/lwlock.h"
+#include "storage/shmem.h"
+#include "storage/spin.h"
+
+/*
+ * Behaviour of replication slots, upon release or crash.
+ *
+ * Slots marked as PERSISTENT are crashsafe and will not be dropped when
+ * released. Slots marked as EPHEMERAL will be dropped when released or after
+ * restarts.
+ *
+ * EPHEMERAL slots can be made PERSISTENT by calling ReplicationSlotPersist().
+ */
+typedef enum ReplicationSlotPersistency
+{
+	RS_PERSISTENT,
+	RS_EPHEMERAL
+} ReplicationSlotPersistency;
+
+/*
+ * On-Disk data of a replication slot, preserved across restarts.
+ */
+typedef struct ReplicationSlotPersistentData
+{
+	/* The slot's identifier */
+	NameData	name;
+
+	/* database the slot is active on */
+	Oid			database;
+
+	/*
+	 * The slot's behaviour when being dropped (or restored after a crash).
+	 */
+	ReplicationSlotPersistency persistency;
+
+	/*
+	 * xmin horizon for data
+	 *
+	 * NB: This may represent a value that hasn't been written to disk yet;
+	 * see notes for effective_xmin, below.
+	 */
+	TransactionId xmin;
+
+	/*
+	 * xmin horizon for catalog tuples
+	 *
+	 * NB: This may represent a value that hasn't been written to disk yet;
+	 * see notes for effective_xmin, below.
+	 */
+	TransactionId catalog_xmin;
+
+	/* oldest LSN that might be required by this replication slot */
+	XLogRecPtr	restart_lsn;
+
+	/* oldest LSN that the client has acked receipt for */
+	XLogRecPtr	confirmed_flush;
+
+	/* plugin name */
+	NameData	plugin;
+} ReplicationSlotPersistentData;
+
+/*
+ * Shared memory state of a single replication slot.
+ */
+typedef struct ReplicationSlot
+{
+	/* lock, on same cacheline as effective_xmin */
+	slock_t		mutex;
+
+	/* is this slot defined */
+	bool		in_use;
+
+	/* Who is streaming out changes for this slot? 0 in unused slots. */
+	pid_t		active_pid;
+
+	/* any outstanding modifications? */
+	bool		just_dirtied;
+	bool		dirty;
+
+	/*
+	 * For logical decoding, it's extremely important that we never remove any
+	 * data that's still needed for decoding purposes, even after a crash;
+	 * otherwise, decoding will produce wrong answers.  Ordinary streaming
+	 * replication also needs to prevent old row versions from being removed
+	 * too soon, but the worst consequence we might encounter there is
+	 * unwanted query cancellations on the standby.  Thus, for logical
+	 * decoding, this value represents the latest xmin that has actually been
+	 * written to disk, whereas for streaming replication, it's just the same
+	 * as the persistent value (data.xmin).
+	 */
+	TransactionId effective_xmin;
+	TransactionId effective_catalog_xmin;
+
+	/* data surviving shutdowns and crashes */
+	ReplicationSlotPersistentData data;
+
+	/* is somebody performing io on this slot? */
+	LWLock	   *io_in_progress_lock;
+
+	/* all the remaining data is only used for logical slots */
+
+	/* ----
+	 * When the client has confirmed flushes >= candidate_xmin_lsn we can
+	 * advance the catalog xmin, when restart_valid has been passed,
+	 * restart_lsn can be increased.
+	 * ----
+	 */
+	TransactionId candidate_catalog_xmin;
+	XLogRecPtr	candidate_xmin_lsn;
+	XLogRecPtr	candidate_restart_valid;
+	XLogRecPtr	candidate_restart_lsn;
+} ReplicationSlot;
+
+/*
+ * Shared memory control area for all of replication slots.
+ */
+typedef struct ReplicationSlotCtlData
+{
+	/*
+	 * This array should be declared [FLEXIBLE_ARRAY_MEMBER], but for some
+	 * reason you can't do that in an otherwise-empty struct.
+	 */
+	ReplicationSlot replication_slots[1];
+} ReplicationSlotCtlData;
+
+/*
+ * Pointers to shared memory
+ */
+extern ReplicationSlotCtlData *ReplicationSlotCtl;
+extern ReplicationSlot *MyReplicationSlot;
+
+/* GUCs */
+extern PGDLLIMPORT int max_replication_slots;
+
+/* shmem initialization functions */
+extern Size ReplicationSlotsShmemSize(void);
+extern void ReplicationSlotsShmemInit(void);
+
+/* management of individual slots */
+extern void ReplicationSlotCreate(const char *name, bool db_specific,
+					  ReplicationSlotPersistency p);
+extern void ReplicationSlotPersist(void);
+extern void ReplicationSlotDrop(const char *name);
+
+extern void ReplicationSlotAcquire(const char *name);
+extern void ReplicationSlotRelease(void);
+extern void ReplicationSlotSave(void);
+extern void ReplicationSlotMarkDirty(void);
+
+/* misc stuff */
+extern bool ReplicationSlotValidateName(const char *name, int elevel);
+extern void ReplicationSlotsComputeRequiredXmin(bool already_locked);
+extern void ReplicationSlotsComputeRequiredLSN(void);
+extern XLogRecPtr ReplicationSlotsComputeLogicalRestartLSN(void);
+extern bool ReplicationSlotsCountDBSlots(Oid dboid, int *nslots, int *nactive);
+
+extern void StartupReplicationSlots(void);
+extern void CheckPointReplicationSlots(void);
+
+extern void CheckSlotRequirements(void);
+
+/* SQL callable functions */
+extern Datum pg_create_physical_replication_slot(PG_FUNCTION_ARGS);
+extern Datum pg_create_logical_replication_slot(PG_FUNCTION_ARGS);
+extern Datum pg_drop_replication_slot(PG_FUNCTION_ARGS);
+extern Datum pg_get_replication_slots(PG_FUNCTION_ARGS);
+
+#endif   /* SLOT_H */
diff --git a/foreign/libpg_query/src/postgres/include/replication/syncrep.h b/foreign/libpg_query/src/postgres/include/replication/syncrep.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/replication/syncrep.h
@@ -0,0 +1,57 @@
+/*-------------------------------------------------------------------------
+ *
+ * syncrep.h
+ *	  Exports from replication/syncrep.c.
+ *
+ * Portions Copyright (c) 2010-2015, PostgreSQL Global Development Group
+ *
+ * IDENTIFICATION
+ *		src/include/replication/syncrep.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef _SYNCREP_H
+#define _SYNCREP_H
+
+#include "access/xlogdefs.h"
+#include "utils/guc.h"
+
+#define SyncRepRequested() \
+	(max_wal_senders > 0 && synchronous_commit > SYNCHRONOUS_COMMIT_LOCAL_FLUSH)
+
+/* SyncRepWaitMode */
+#define SYNC_REP_NO_WAIT		-1
+#define SYNC_REP_WAIT_WRITE		0
+#define SYNC_REP_WAIT_FLUSH		1
+
+#define NUM_SYNC_REP_WAIT_MODE	2
+
+/* syncRepState */
+#define SYNC_REP_NOT_WAITING		0
+#define SYNC_REP_WAITING			1
+#define SYNC_REP_WAIT_COMPLETE		2
+
+/* user-settable parameters for synchronous replication */
+extern char *SyncRepStandbyNames;
+
+/* called by user backend */
+extern void SyncRepWaitForLSN(XLogRecPtr XactCommitLSN);
+
+/* called at backend exit */
+extern void SyncRepCleanupAtProcExit(void);
+
+/* called by wal sender */
+extern void SyncRepInitConfig(void);
+extern void SyncRepReleaseWaiters(void);
+
+/* called by checkpointer */
+extern void SyncRepUpdateSyncStandbysDefined(void);
+
+/* forward declaration to avoid pulling in walsender_private.h */
+struct WalSnd;
+extern struct WalSnd *SyncRepGetSynchronousStandby(void);
+
+extern bool check_synchronous_standby_names(char **newval, void **extra, GucSource source);
+extern void assign_synchronous_commit(int newval, void *extra);
+
+#endif   /* _SYNCREP_H */
diff --git a/foreign/libpg_query/src/postgres/include/replication/walreceiver.h b/foreign/libpg_query/src/postgres/include/replication/walreceiver.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/replication/walreceiver.h
@@ -0,0 +1,164 @@
+/*-------------------------------------------------------------------------
+ *
+ * walreceiver.h
+ *	  Exports from replication/walreceiverfuncs.c.
+ *
+ * Portions Copyright (c) 2010-2015, PostgreSQL Global Development Group
+ *
+ * src/include/replication/walreceiver.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef _WALRECEIVER_H
+#define _WALRECEIVER_H
+
+#include "access/xlog.h"
+#include "access/xlogdefs.h"
+#include "storage/latch.h"
+#include "storage/spin.h"
+#include "pgtime.h"
+
+/* user-settable parameters */
+extern int	wal_receiver_status_interval;
+extern int	wal_receiver_timeout;
+extern bool hot_standby_feedback;
+
+/*
+ * MAXCONNINFO: maximum size of a connection string.
+ *
+ * XXX: Should this move to pg_config_manual.h?
+ */
+#define MAXCONNINFO		1024
+
+/* Can we allow the standby to accept replication connection from another standby? */
+#define AllowCascadeReplication() (EnableHotStandby && max_wal_senders > 0)
+
+/*
+ * Values for WalRcv->walRcvState.
+ */
+typedef enum
+{
+	WALRCV_STOPPED,				/* stopped and mustn't start up again */
+	WALRCV_STARTING,			/* launched, but the process hasn't
+								 * initialized yet */
+	WALRCV_STREAMING,			/* walreceiver is streaming */
+	WALRCV_WAITING,				/* stopped streaming, waiting for orders */
+	WALRCV_RESTARTING,			/* asked to restart streaming */
+	WALRCV_STOPPING				/* requested to stop, but still running */
+} WalRcvState;
+
+/* Shared memory area for management of walreceiver process */
+typedef struct
+{
+	/*
+	 * PID of currently active walreceiver process, its current state and
+	 * start time (actually, the time at which it was requested to be
+	 * started).
+	 */
+	pid_t		pid;
+	WalRcvState walRcvState;
+	pg_time_t	startTime;
+
+	/*
+	 * receiveStart and receiveStartTLI indicate the first byte position and
+	 * timeline that will be received. When startup process starts the
+	 * walreceiver, it sets these to the point where it wants the streaming to
+	 * begin.
+	 */
+	XLogRecPtr	receiveStart;
+	TimeLineID	receiveStartTLI;
+
+	/*
+	 * receivedUpto-1 is the last byte position that has already been
+	 * received, and receivedTLI is the timeline it came from.  At the first
+	 * startup of walreceiver, these are set to receiveStart and
+	 * receiveStartTLI. After that, walreceiver updates these whenever it
+	 * flushes the received WAL to disk.
+	 */
+	XLogRecPtr	receivedUpto;
+	TimeLineID	receivedTLI;
+
+	/*
+	 * latestChunkStart is the starting byte position of the current "batch"
+	 * of received WAL.  It's actually the same as the previous value of
+	 * receivedUpto before the last flush to disk.  Startup process can use
+	 * this to detect whether it's keeping up or not.
+	 */
+	XLogRecPtr	latestChunkStart;
+
+	/*
+	 * Time of send and receive of any message received.
+	 */
+	TimestampTz lastMsgSendTime;
+	TimestampTz lastMsgReceiptTime;
+
+	/*
+	 * Latest reported end of WAL on the sender
+	 */
+	XLogRecPtr	latestWalEnd;
+	TimestampTz latestWalEndTime;
+
+	/*
+	 * connection string; is used for walreceiver to connect with the primary.
+	 */
+	char		conninfo[MAXCONNINFO];
+
+	/*
+	 * replication slot name; is also used for walreceiver to connect with the
+	 * primary
+	 */
+	char		slotname[NAMEDATALEN];
+
+	slock_t		mutex;			/* locks shared variables shown above */
+
+	/*
+	 * Latch used by startup process to wake up walreceiver after telling it
+	 * where to start streaming (after setting receiveStart and
+	 * receiveStartTLI).
+	 */
+	Latch		latch;
+} WalRcvData;
+
+extern WalRcvData *WalRcv;
+
+/* libpqwalreceiver hooks */
+typedef void (*walrcv_connect_type) (char *conninfo);
+extern PGDLLIMPORT walrcv_connect_type walrcv_connect;
+
+typedef void (*walrcv_identify_system_type) (TimeLineID *primary_tli);
+extern PGDLLIMPORT walrcv_identify_system_type walrcv_identify_system;
+
+typedef void (*walrcv_readtimelinehistoryfile_type) (TimeLineID tli, char **filename, char **content, int *size);
+extern PGDLLIMPORT walrcv_readtimelinehistoryfile_type walrcv_readtimelinehistoryfile;
+
+typedef bool (*walrcv_startstreaming_type) (TimeLineID tli, XLogRecPtr startpoint, char *slotname);
+extern PGDLLIMPORT walrcv_startstreaming_type walrcv_startstreaming;
+
+typedef void (*walrcv_endstreaming_type) (TimeLineID *next_tli);
+extern PGDLLIMPORT walrcv_endstreaming_type walrcv_endstreaming;
+
+typedef int (*walrcv_receive_type) (int timeout, char **buffer);
+extern PGDLLIMPORT walrcv_receive_type walrcv_receive;
+
+typedef void (*walrcv_send_type) (const char *buffer, int nbytes);
+extern PGDLLIMPORT walrcv_send_type walrcv_send;
+
+typedef void (*walrcv_disconnect_type) (void);
+extern PGDLLIMPORT walrcv_disconnect_type walrcv_disconnect;
+
+/* prototypes for functions in walreceiver.c */
+extern void WalReceiverMain(void) pg_attribute_noreturn();
+
+/* prototypes for functions in walreceiverfuncs.c */
+extern Size WalRcvShmemSize(void);
+extern void WalRcvShmemInit(void);
+extern void ShutdownWalRcv(void);
+extern bool WalRcvStreaming(void);
+extern bool WalRcvRunning(void);
+extern void RequestXLogStreaming(TimeLineID tli, XLogRecPtr recptr,
+					 const char *conninfo, const char *slotname);
+extern XLogRecPtr GetWalRcvWriteRecPtr(XLogRecPtr *latestChunkStart, TimeLineID *receiveTLI);
+extern int	GetReplicationApplyDelay(void);
+extern int	GetReplicationTransferLatency(void);
+
+#endif   /* _WALRECEIVER_H */
diff --git a/foreign/libpg_query/src/postgres/include/replication/walsender.h b/foreign/libpg_query/src/postgres/include/replication/walsender.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/replication/walsender.h
@@ -0,0 +1,64 @@
+/*-------------------------------------------------------------------------
+ *
+ * walsender.h
+ *	  Exports from replication/walsender.c.
+ *
+ * Portions Copyright (c) 2010-2015, PostgreSQL Global Development Group
+ *
+ * src/include/replication/walsender.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef _WALSENDER_H
+#define _WALSENDER_H
+
+#include <signal.h>
+
+#include "fmgr.h"
+
+/* global state */
+extern bool am_walsender;
+extern bool am_cascading_walsender;
+extern bool am_db_walsender;
+extern bool wake_wal_senders;
+
+/* user-settable parameters */
+extern int	max_wal_senders;
+extern int	wal_sender_timeout;
+extern bool log_replication_commands;
+
+extern void InitWalSender(void);
+extern void exec_replication_command(const char *query_string);
+extern void WalSndErrorCleanup(void);
+extern void WalSndSignals(void);
+extern Size WalSndShmemSize(void);
+extern void WalSndShmemInit(void);
+extern void WalSndWakeup(void);
+extern void WalSndRqstFileReload(void);
+
+extern Datum pg_stat_get_wal_senders(PG_FUNCTION_ARGS);
+
+/*
+ * Remember that we want to wakeup walsenders later
+ *
+ * This is separated from doing the actual wakeup because the writeout is done
+ * while holding contended locks.
+ */
+#define WalSndWakeupRequest() \
+	do { wake_wal_senders = true; } while (0)
+
+/*
+ * wakeup walsenders if there is work to be done
+ */
+#define WalSndWakeupProcessRequests()		\
+	do										\
+	{										\
+		if (wake_wal_senders)				\
+		{									\
+			wake_wal_senders = false;		\
+			if (max_wal_senders > 0)		\
+				WalSndWakeup();				\
+		}									\
+	} while (0)
+
+#endif   /* _WALSENDER_H */
diff --git a/foreign/libpg_query/src/postgres/include/rewrite/prs2lock.h b/foreign/libpg_query/src/postgres/include/rewrite/prs2lock.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/rewrite/prs2lock.h
@@ -0,0 +1,46 @@
+/*-------------------------------------------------------------------------
+ *
+ * prs2lock.h
+ *	  data structures for POSTGRES Rule System II (rewrite rules only)
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/rewrite/prs2lock.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PRS2LOCK_H
+#define PRS2LOCK_H
+
+#include "access/attnum.h"
+#include "nodes/pg_list.h"
+
+/*
+ * RewriteRule -
+ *	  holds an info for a rewrite rule
+ *
+ */
+typedef struct RewriteRule
+{
+	Oid			ruleId;
+	CmdType		event;
+	Node	   *qual;
+	List	   *actions;
+	char		enabled;
+	bool		isInstead;
+} RewriteRule;
+
+/*
+ * RuleLock -
+ *	  all rules that apply to a particular relation. Even though we only
+ *	  have the rewrite rule system left and these are not really "locks",
+ *	  the name is kept for historical reasons.
+ */
+typedef struct RuleLock
+{
+	int			numLocks;
+	RewriteRule **rules;
+} RuleLock;
+
+#endif   /* REWRITE_H */
diff --git a/foreign/libpg_query/src/postgres/include/rewrite/rewriteHandler.h b/foreign/libpg_query/src/postgres/include/rewrite/rewriteHandler.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/rewrite/rewriteHandler.h
@@ -0,0 +1,33 @@
+/*-------------------------------------------------------------------------
+ *
+ * rewriteHandler.h
+ *		External interface to query rewriter.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/rewrite/rewriteHandler.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef REWRITEHANDLER_H
+#define REWRITEHANDLER_H
+
+#include "utils/relcache.h"
+#include "nodes/parsenodes.h"
+
+extern List *QueryRewrite(Query *parsetree);
+extern void AcquireRewriteLocks(Query *parsetree,
+					bool forExecute,
+					bool forUpdatePushedDown);
+
+extern Node *build_column_default(Relation rel, int attrno);
+extern Query *get_view_query(Relation view);
+extern const char *view_query_is_auto_updatable(Query *viewquery,
+							 bool check_cols);
+extern int relation_is_updatable(Oid reloid,
+					  bool include_triggers,
+					  Bitmapset *include_cols);
+
+#endif   /* REWRITEHANDLER_H */
diff --git a/foreign/libpg_query/src/postgres/include/rewrite/rewriteManip.h b/foreign/libpg_query/src/postgres/include/rewrite/rewriteManip.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/rewrite/rewriteManip.h
@@ -0,0 +1,85 @@
+/*-------------------------------------------------------------------------
+ *
+ * rewriteManip.h
+ *		Querytree manipulation subroutines for query rewriter.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/rewrite/rewriteManip.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef REWRITEMANIP_H
+#define REWRITEMANIP_H
+
+#include "nodes/parsenodes.h"
+
+
+typedef struct replace_rte_variables_context replace_rte_variables_context;
+
+typedef Node *(*replace_rte_variables_callback) (Var *var,
+									 replace_rte_variables_context *context);
+
+struct replace_rte_variables_context
+{
+	replace_rte_variables_callback callback;	/* callback function */
+	void	   *callback_arg;	/* context data for callback function */
+	int			target_varno;	/* RTE index to search for */
+	int			sublevels_up;	/* (current) nesting depth */
+	bool		inserted_sublink;		/* have we inserted a SubLink? */
+};
+
+typedef enum ReplaceVarsNoMatchOption
+{
+	REPLACEVARS_REPORT_ERROR,	/* throw error if no match */
+	REPLACEVARS_CHANGE_VARNO,	/* change the Var's varno, nothing else */
+	REPLACEVARS_SUBSTITUTE_NULL /* replace with a NULL Const */
+} ReplaceVarsNoMatchOption;
+
+
+extern void OffsetVarNodes(Node *node, int offset, int sublevels_up);
+extern void ChangeVarNodes(Node *node, int old_varno, int new_varno,
+			   int sublevels_up);
+extern void IncrementVarSublevelsUp(Node *node, int delta_sublevels_up,
+						int min_sublevels_up);
+extern void IncrementVarSublevelsUp_rtable(List *rtable,
+							   int delta_sublevels_up, int min_sublevels_up);
+
+extern bool rangeTableEntry_used(Node *node, int rt_index,
+					 int sublevels_up);
+
+extern Query *getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr);
+
+extern void AddQual(Query *parsetree, Node *qual);
+extern void AddInvertedQual(Query *parsetree, Node *qual);
+
+extern bool contain_aggs_of_level(Node *node, int levelsup);
+extern int	locate_agg_of_level(Node *node, int levelsup);
+extern bool contain_windowfuncs(Node *node);
+extern int	locate_windowfunc(Node *node);
+extern bool checkExprHasSubLink(Node *node);
+
+extern Node *replace_rte_variables(Node *node,
+					  int target_varno, int sublevels_up,
+					  replace_rte_variables_callback callback,
+					  void *callback_arg,
+					  bool *outer_hasSubLinks);
+extern Node *replace_rte_variables_mutator(Node *node,
+							  replace_rte_variables_context *context);
+
+extern Node *map_variable_attnos(Node *node,
+					int target_varno, int sublevels_up,
+					const AttrNumber *attno_map, int map_length,
+					bool *found_whole_row);
+
+extern Node *ReplaceVarsFromTargetList(Node *node,
+						  int target_varno, int sublevels_up,
+						  RangeTblEntry *target_rte,
+						  List *targetlist,
+						  ReplaceVarsNoMatchOption nomatch_option,
+						  int nomatch_varno,
+						  bool *outer_hasSubLinks);
+
+#endif   /* REWRITEMANIP_H */
diff --git a/foreign/libpg_query/src/postgres/include/rewrite/rewriteSupport.h b/foreign/libpg_query/src/postgres/include/rewrite/rewriteSupport.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/rewrite/rewriteSupport.h
@@ -0,0 +1,28 @@
+/*-------------------------------------------------------------------------
+ *
+ * rewriteSupport.h
+ *
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/rewrite/rewriteSupport.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef REWRITESUPPORT_H
+#define REWRITESUPPORT_H
+
+/* The ON SELECT rule of a view is always named this: */
+#define ViewSelectRuleName	"_RETURN"
+
+extern bool IsDefinedRewriteRule(Oid owningRel, const char *ruleName);
+
+extern void SetRelationRuleStatus(Oid relationId, bool relHasRules);
+
+extern Oid	get_rewrite_oid(Oid relid, const char *rulename, bool missing_ok);
+extern Oid get_rewrite_oid_without_relid(const char *rulename,
+							  Oid *relid, bool missing_ok);
+
+#endif   /* REWRITESUPPORT_H */
diff --git a/foreign/libpg_query/src/postgres/include/sha1.h b/foreign/libpg_query/src/postgres/include/sha1.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/sha1.h
@@ -0,0 +1,75 @@
+/*	contrib/pgcrypto/sha1.h */
+/*	   $KAME: sha1.h,v 1.4 2000/02/22 14:01:18 itojun Exp $    */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *	  notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *	  notice, this list of conditions and the following disclaimer in the
+ *	  documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *	  may be used to endorse or promote products derived from this software
+ *	  without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
+ * FIPS pub 180-1: Secure Hash Algorithm (SHA-1)
+ * based on: http://www.itl.nist.gov/fipspubs/fip180-1.htm
+ * implemented by Jun-ichiro itojun Itoh <itojun@itojun.org>
+ */
+
+#ifndef _NETINET6_SHA1_H_
+#define _NETINET6_SHA1_H_
+
+struct sha1_ctxt
+{
+	union
+	{
+		uint8		b8[20];
+		uint32		b32[5];
+	}			h;
+	union
+	{
+		uint8		b8[8];
+		uint64		b64[1];
+	}			c;
+	union
+	{
+		uint8		b8[64];
+		uint32		b32[16];
+	}			m;
+	uint8		count;
+};
+
+extern void sha1_init(struct sha1_ctxt *);
+extern void sha1_pad(struct sha1_ctxt *);
+extern void sha1_loop(struct sha1_ctxt *, const uint8 *, size_t);
+extern void sha1_result(struct sha1_ctxt *, uint8 *);
+
+/* compatibilty with other SHA1 source codes */
+typedef struct sha1_ctxt SHA1_CTX;
+
+#define SHA1Init(x)		sha1_init((x))
+#define SHA1Update(x, y, z) sha1_loop((x), (y), (z))
+#define SHA1Final(x, y)		sha1_result((y), (x))
+
+#define SHA1_RESULTLEN	(160/8)
+
+#endif   /* _NETINET6_SHA1_H_ */
diff --git a/foreign/libpg_query/src/postgres/include/storage/backendid.h b/foreign/libpg_query/src/postgres/include/storage/backendid.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/backendid.h
@@ -0,0 +1,27 @@
+/*-------------------------------------------------------------------------
+ *
+ * backendid.h
+ *	  POSTGRES backend id communication definitions
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/backendid.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef BACKENDID_H
+#define BACKENDID_H
+
+/* ----------------
+ *		-cim 8/17/90
+ * ----------------
+ */
+typedef int BackendId;			/* unique currently active backend identifier */
+
+#define InvalidBackendId		(-1)
+
+extern PGDLLIMPORT BackendId MyBackendId;		/* backend id of this backend */
+
+#endif   /* BACKENDID_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/barrier.h b/foreign/libpg_query/src/postgres/include/storage/barrier.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/barrier.h
@@ -0,0 +1,23 @@
+/*-------------------------------------------------------------------------
+ *
+ * barrier.h
+ *	  Memory barrier operations.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/barrier.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef BARRIER_H
+#define BARRIER_H
+
+/*
+ * This used to be a separate file, full of compiler/architecture
+ * dependent defines, but it's not included in the atomics.h
+ * infrastructure and just kept for backward compatibility.
+ */
+#include "port/atomics.h"
+
+#endif   /* BARRIER_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/block.h b/foreign/libpg_query/src/postgres/include/storage/block.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/block.h
@@ -0,0 +1,121 @@
+/*-------------------------------------------------------------------------
+ *
+ * block.h
+ *	  POSTGRES disk block definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/block.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef BLOCK_H
+#define BLOCK_H
+
+/*
+ * BlockNumber:
+ *
+ * each data file (heap or index) is divided into postgres disk blocks
+ * (which may be thought of as the unit of i/o -- a postgres buffer
+ * contains exactly one disk block).  the blocks are numbered
+ * sequentially, 0 to 0xFFFFFFFE.
+ *
+ * InvalidBlockNumber is the same thing as P_NEW in buf.h.
+ *
+ * the access methods, the buffer manager and the storage manager are
+ * more or less the only pieces of code that should be accessing disk
+ * blocks directly.
+ */
+typedef uint32 BlockNumber;
+
+#define InvalidBlockNumber		((BlockNumber) 0xFFFFFFFF)
+
+#define MaxBlockNumber			((BlockNumber) 0xFFFFFFFE)
+
+/*
+ * BlockId:
+ *
+ * this is a storage type for BlockNumber.  in other words, this type
+ * is used for on-disk structures (e.g., in HeapTupleData) whereas
+ * BlockNumber is the type on which calculations are performed (e.g.,
+ * in access method code).
+ *
+ * there doesn't appear to be any reason to have separate types except
+ * for the fact that BlockIds can be SHORTALIGN'd (and therefore any
+ * structures that contains them, such as ItemPointerData, can also be
+ * SHORTALIGN'd).  this is an important consideration for reducing the
+ * space requirements of the line pointer (ItemIdData) array on each
+ * page and the header of each heap or index tuple, so it doesn't seem
+ * wise to change this without good reason.
+ */
+typedef struct BlockIdData
+{
+	uint16		bi_hi;
+	uint16		bi_lo;
+} BlockIdData;
+
+typedef BlockIdData *BlockId;	/* block identifier */
+
+/* ----------------
+ *		support macros
+ * ----------------
+ */
+
+/*
+ * BlockNumberIsValid
+ *		True iff blockNumber is valid.
+ */
+#define BlockNumberIsValid(blockNumber) \
+	((bool) ((BlockNumber) (blockNumber) != InvalidBlockNumber))
+
+/*
+ * BlockIdIsValid
+ *		True iff the block identifier is valid.
+ */
+#define BlockIdIsValid(blockId) \
+	((bool) PointerIsValid(blockId))
+
+/*
+ * BlockIdSet
+ *		Sets a block identifier to the specified value.
+ */
+#define BlockIdSet(blockId, blockNumber) \
+( \
+	AssertMacro(PointerIsValid(blockId)), \
+	(blockId)->bi_hi = (blockNumber) >> 16, \
+	(blockId)->bi_lo = (blockNumber) & 0xffff \
+)
+
+/*
+ * BlockIdCopy
+ *		Copy a block identifier.
+ */
+#define BlockIdCopy(toBlockId, fromBlockId) \
+( \
+	AssertMacro(PointerIsValid(toBlockId)), \
+	AssertMacro(PointerIsValid(fromBlockId)), \
+	(toBlockId)->bi_hi = (fromBlockId)->bi_hi, \
+	(toBlockId)->bi_lo = (fromBlockId)->bi_lo \
+)
+
+/*
+ * BlockIdEquals
+ *		Check for block number equality.
+ */
+#define BlockIdEquals(blockId1, blockId2) \
+	((blockId1)->bi_hi == (blockId2)->bi_hi && \
+	 (blockId1)->bi_lo == (blockId2)->bi_lo)
+
+/*
+ * BlockIdGetBlockNumber
+ *		Retrieve the block number from a block identifier.
+ */
+#define BlockIdGetBlockNumber(blockId) \
+( \
+	AssertMacro(BlockIdIsValid(blockId)), \
+	(BlockNumber) (((blockId)->bi_hi << 16) | ((uint16) (blockId)->bi_lo)) \
+)
+
+#endif   /* BLOCK_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/buf.h b/foreign/libpg_query/src/postgres/include/storage/buf.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/buf.h
@@ -0,0 +1,46 @@
+/*-------------------------------------------------------------------------
+ *
+ * buf.h
+ *	  Basic buffer manager data types.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/buf.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef BUF_H
+#define BUF_H
+
+/*
+ * Buffer identifiers.
+ *
+ * Zero is invalid, positive is the index of a shared buffer (1..NBuffers),
+ * negative is the index of a local buffer (-1 .. -NLocBuffer).
+ */
+typedef int Buffer;
+
+#define InvalidBuffer	0
+
+/*
+ * BufferIsInvalid
+ *		True iff the buffer is invalid.
+ */
+#define BufferIsInvalid(buffer) ((buffer) == InvalidBuffer)
+
+/*
+ * BufferIsLocal
+ *		True iff the buffer is local (not visible to other backends).
+ */
+#define BufferIsLocal(buffer)	((buffer) < 0)
+
+/*
+ * Buffer access strategy objects.
+ *
+ * BufferAccessStrategyData is private to freelist.c
+ */
+typedef struct BufferAccessStrategyData *BufferAccessStrategy;
+
+#endif   /* BUF_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/bufmgr.h b/foreign/libpg_query/src/postgres/include/storage/bufmgr.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/bufmgr.h
@@ -0,0 +1,213 @@
+/*-------------------------------------------------------------------------
+ *
+ * bufmgr.h
+ *	  POSTGRES buffer manager definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/bufmgr.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef BUFMGR_H
+#define BUFMGR_H
+
+#include "storage/block.h"
+#include "storage/buf.h"
+#include "storage/bufpage.h"
+#include "storage/relfilenode.h"
+#include "utils/relcache.h"
+
+typedef void *Block;
+
+/* Possible arguments for GetAccessStrategy() */
+typedef enum BufferAccessStrategyType
+{
+	BAS_NORMAL,					/* Normal random access */
+	BAS_BULKREAD,				/* Large read-only scan (hint bit updates are
+								 * ok) */
+	BAS_BULKWRITE,				/* Large multi-block write (e.g. COPY IN) */
+	BAS_VACUUM					/* VACUUM */
+} BufferAccessStrategyType;
+
+/* Possible modes for ReadBufferExtended() */
+typedef enum
+{
+	RBM_NORMAL,					/* Normal read */
+	RBM_ZERO_AND_LOCK,			/* Don't read from disk, caller will
+								 * initialize. Also locks the page. */
+	RBM_ZERO_AND_CLEANUP_LOCK,	/* Like RBM_ZERO_AND_LOCK, but locks the page
+								 * in "cleanup" mode */
+	RBM_ZERO_ON_ERROR,			/* Read, but return an all-zeros page on error */
+	RBM_NORMAL_NO_LOG			/* Don't log page as invalid during WAL
+								 * replay; otherwise same as RBM_NORMAL */
+} ReadBufferMode;
+
+/* in globals.c ... this duplicates miscadmin.h */
+extern PGDLLIMPORT int NBuffers;
+
+/* in bufmgr.c */
+extern bool zero_damaged_pages;
+extern int	bgwriter_lru_maxpages;
+extern double bgwriter_lru_multiplier;
+extern bool track_io_timing;
+extern int	target_prefetch_pages;
+
+/* in buf_init.c */
+extern PGDLLIMPORT char *BufferBlocks;
+
+/* in localbuf.c */
+extern PGDLLIMPORT int NLocBuffer;
+extern PGDLLIMPORT Block *LocalBufferBlockPointers;
+extern PGDLLIMPORT int32 *LocalRefCount;
+
+/* special block number for ReadBuffer() */
+#define P_NEW	InvalidBlockNumber		/* grow the file to get a new page */
+
+/*
+ * Buffer content lock modes (mode argument for LockBuffer())
+ */
+#define BUFFER_LOCK_UNLOCK		0
+#define BUFFER_LOCK_SHARE		1
+#define BUFFER_LOCK_EXCLUSIVE	2
+
+/*
+ * These routines are beaten on quite heavily, hence the macroization.
+ */
+
+/*
+ * BufferIsValid
+ *		True iff the given buffer number is valid (either as a shared
+ *		or local buffer).
+ *
+ * Note: For a long time this was defined the same as BufferIsPinned,
+ * that is it would say False if you didn't hold a pin on the buffer.
+ * I believe this was bogus and served only to mask logic errors.
+ * Code should always know whether it has a buffer reference,
+ * independently of the pin state.
+ *
+ * Note: For a further long time this was not quite the inverse of the
+ * BufferIsInvalid() macro, in that it also did sanity checks to verify
+ * that the buffer number was in range.  Most likely, this macro was
+ * originally intended only to be used in assertions, but its use has
+ * since expanded quite a bit, and the overhead of making those checks
+ * even in non-assert-enabled builds can be significant.  Thus, we've
+ * now demoted the range checks to assertions within the macro itself.
+ */
+#define BufferIsValid(bufnum) \
+( \
+	AssertMacro((bufnum) <= NBuffers && (bufnum) >= -NLocBuffer), \
+	(bufnum) != InvalidBuffer  \
+)
+
+/*
+ * BufferGetBlock
+ *		Returns a reference to a disk page image associated with a buffer.
+ *
+ * Note:
+ *		Assumes buffer is valid.
+ */
+#define BufferGetBlock(buffer) \
+( \
+	AssertMacro(BufferIsValid(buffer)), \
+	BufferIsLocal(buffer) ? \
+		LocalBufferBlockPointers[-(buffer) - 1] \
+	: \
+		(Block) (BufferBlocks + ((Size) ((buffer) - 1)) * BLCKSZ) \
+)
+
+/*
+ * BufferGetPageSize
+ *		Returns the page size within a buffer.
+ *
+ * Notes:
+ *		Assumes buffer is valid.
+ *
+ *		The buffer can be a raw disk block and need not contain a valid
+ *		(formatted) disk page.
+ */
+/* XXX should dig out of buffer descriptor */
+#define BufferGetPageSize(buffer) \
+( \
+	AssertMacro(BufferIsValid(buffer)), \
+	(Size)BLCKSZ \
+)
+
+/*
+ * BufferGetPage
+ *		Returns the page associated with a buffer.
+ */
+#define BufferGetPage(buffer) ((Page)BufferGetBlock(buffer))
+
+/*
+ * prototypes for functions in bufmgr.c
+ */
+extern void PrefetchBuffer(Relation reln, ForkNumber forkNum,
+			   BlockNumber blockNum);
+extern Buffer ReadBuffer(Relation reln, BlockNumber blockNum);
+extern Buffer ReadBufferExtended(Relation reln, ForkNumber forkNum,
+				   BlockNumber blockNum, ReadBufferMode mode,
+				   BufferAccessStrategy strategy);
+extern Buffer ReadBufferWithoutRelcache(RelFileNode rnode,
+						  ForkNumber forkNum, BlockNumber blockNum,
+						  ReadBufferMode mode, BufferAccessStrategy strategy);
+extern void ReleaseBuffer(Buffer buffer);
+extern void UnlockReleaseBuffer(Buffer buffer);
+extern void MarkBufferDirty(Buffer buffer);
+extern void IncrBufferRefCount(Buffer buffer);
+extern Buffer ReleaseAndReadBuffer(Buffer buffer, Relation relation,
+					 BlockNumber blockNum);
+
+extern void InitBufferPool(void);
+extern void InitBufferPoolAccess(void);
+extern void InitBufferPoolBackend(void);
+extern void AtEOXact_Buffers(bool isCommit);
+extern void PrintBufferLeakWarning(Buffer buffer);
+extern void CheckPointBuffers(int flags);
+extern BlockNumber BufferGetBlockNumber(Buffer buffer);
+extern BlockNumber RelationGetNumberOfBlocksInFork(Relation relation,
+								ForkNumber forkNum);
+extern void FlushOneBuffer(Buffer buffer);
+extern void FlushRelationBuffers(Relation rel);
+extern void FlushDatabaseBuffers(Oid dbid);
+extern void DropRelFileNodeBuffers(RelFileNodeBackend rnode,
+					   ForkNumber forkNum, BlockNumber firstDelBlock);
+extern void DropRelFileNodesAllBuffers(RelFileNodeBackend *rnodes, int nnodes);
+extern void DropDatabaseBuffers(Oid dbid);
+
+#define RelationGetNumberOfBlocks(reln) \
+	RelationGetNumberOfBlocksInFork(reln, MAIN_FORKNUM)
+
+extern bool BufferIsPermanent(Buffer buffer);
+extern XLogRecPtr BufferGetLSNAtomic(Buffer buffer);
+
+#ifdef NOT_USED
+extern void PrintPinnedBufs(void);
+#endif
+extern Size BufferShmemSize(void);
+extern void BufferGetTag(Buffer buffer, RelFileNode *rnode,
+			 ForkNumber *forknum, BlockNumber *blknum);
+
+extern void MarkBufferDirtyHint(Buffer buffer, bool buffer_std);
+
+extern void UnlockBuffers(void);
+extern void LockBuffer(Buffer buffer, int mode);
+extern bool ConditionalLockBuffer(Buffer buffer);
+extern void LockBufferForCleanup(Buffer buffer);
+extern bool ConditionalLockBufferForCleanup(Buffer buffer);
+extern bool HoldingBufferPinThatDelaysRecovery(void);
+
+extern void AbortBufferIO(void);
+
+extern void BufmgrCommit(void);
+extern bool BgBufferSync(void);
+
+extern void AtProcExit_LocalBuffers(void);
+
+/* in freelist.c */
+extern BufferAccessStrategy GetAccessStrategy(BufferAccessStrategyType btype);
+extern void FreeAccessStrategy(BufferAccessStrategy strategy);
+
+#endif
diff --git a/foreign/libpg_query/src/postgres/include/storage/bufpage.h b/foreign/libpg_query/src/postgres/include/storage/bufpage.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/bufpage.h
@@ -0,0 +1,413 @@
+/*-------------------------------------------------------------------------
+ *
+ * bufpage.h
+ *	  Standard POSTGRES buffer page definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/bufpage.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef BUFPAGE_H
+#define BUFPAGE_H
+
+#include "access/xlogdefs.h"
+#include "storage/block.h"
+#include "storage/item.h"
+#include "storage/off.h"
+
+/*
+ * A postgres disk page is an abstraction layered on top of a postgres
+ * disk block (which is simply a unit of i/o, see block.h).
+ *
+ * specifically, while a disk block can be unformatted, a postgres
+ * disk page is always a slotted page of the form:
+ *
+ * +----------------+---------------------------------+
+ * | PageHeaderData | linp1 linp2 linp3 ...           |
+ * +-----------+----+---------------------------------+
+ * | ... linpN |									  |
+ * +-----------+--------------------------------------+
+ * |		   ^ pd_lower							  |
+ * |												  |
+ * |			 v pd_upper							  |
+ * +-------------+------------------------------------+
+ * |			 | tupleN ...                         |
+ * +-------------+------------------+-----------------+
+ * |	   ... tuple3 tuple2 tuple1 | "special space" |
+ * +--------------------------------+-----------------+
+ *									^ pd_special
+ *
+ * a page is full when nothing can be added between pd_lower and
+ * pd_upper.
+ *
+ * all blocks written out by an access method must be disk pages.
+ *
+ * EXCEPTIONS:
+ *
+ * obviously, a page is not formatted before it is initialized by
+ * a call to PageInit.
+ *
+ * NOTES:
+ *
+ * linp1..N form an ItemId array.  ItemPointers point into this array
+ * rather than pointing directly to a tuple.  Note that OffsetNumbers
+ * conventionally start at 1, not 0.
+ *
+ * tuple1..N are added "backwards" on the page.  because a tuple's
+ * ItemPointer points to its ItemId entry rather than its actual
+ * byte-offset position, tuples can be physically shuffled on a page
+ * whenever the need arises.
+ *
+ * AM-generic per-page information is kept in PageHeaderData.
+ *
+ * AM-specific per-page data (if any) is kept in the area marked "special
+ * space"; each AM has an "opaque" structure defined somewhere that is
+ * stored as the page trailer.  an access method should always
+ * initialize its pages with PageInit and then set its own opaque
+ * fields.
+ */
+
+typedef Pointer Page;
+
+
+/*
+ * location (byte offset) within a page.
+ *
+ * note that this is actually limited to 2^15 because we have limited
+ * ItemIdData.lp_off and ItemIdData.lp_len to 15 bits (see itemid.h).
+ */
+typedef uint16 LocationIndex;
+
+
+/*
+ * For historical reasons, the 64-bit LSN value is stored as two 32-bit
+ * values.
+ */
+typedef struct
+{
+	uint32		xlogid;			/* high bits */
+	uint32		xrecoff;		/* low bits */
+} PageXLogRecPtr;
+
+#define PageXLogRecPtrGet(val) \
+	((uint64) (val).xlogid << 32 | (val).xrecoff)
+#define PageXLogRecPtrSet(ptr, lsn) \
+	((ptr).xlogid = (uint32) ((lsn) >> 32), (ptr).xrecoff = (uint32) (lsn))
+
+/*
+ * disk page organization
+ *
+ * space management information generic to any page
+ *
+ *		pd_lsn		- identifies xlog record for last change to this page.
+ *		pd_checksum - page checksum, if set.
+ *		pd_flags	- flag bits.
+ *		pd_lower	- offset to start of free space.
+ *		pd_upper	- offset to end of free space.
+ *		pd_special	- offset to start of special space.
+ *		pd_pagesize_version - size in bytes and page layout version number.
+ *		pd_prune_xid - oldest XID among potentially prunable tuples on page.
+ *
+ * The LSN is used by the buffer manager to enforce the basic rule of WAL:
+ * "thou shalt write xlog before data".  A dirty buffer cannot be dumped
+ * to disk until xlog has been flushed at least as far as the page's LSN.
+ *
+ * pd_checksum stores the page checksum, if it has been set for this page;
+ * zero is a valid value for a checksum. If a checksum is not in use then
+ * we leave the field unset. This will typically mean the field is zero
+ * though non-zero values may also be present if databases have been
+ * pg_upgraded from releases prior to 9.3, when the same byte offset was
+ * used to store the current timelineid when the page was last updated.
+ * Note that there is no indication on a page as to whether the checksum
+ * is valid or not, a deliberate design choice which avoids the problem
+ * of relying on the page contents to decide whether to verify it. Hence
+ * there are no flag bits relating to checksums.
+ *
+ * pd_prune_xid is a hint field that helps determine whether pruning will be
+ * useful.  It is currently unused in index pages.
+ *
+ * The page version number and page size are packed together into a single
+ * uint16 field.  This is for historical reasons: before PostgreSQL 7.3,
+ * there was no concept of a page version number, and doing it this way
+ * lets us pretend that pre-7.3 databases have page version number zero.
+ * We constrain page sizes to be multiples of 256, leaving the low eight
+ * bits available for a version number.
+ *
+ * Minimum possible page size is perhaps 64B to fit page header, opaque space
+ * and a minimal tuple; of course, in reality you want it much bigger, so
+ * the constraint on pagesize mod 256 is not an important restriction.
+ * On the high end, we can only support pages up to 32KB because lp_off/lp_len
+ * are 15 bits.
+ */
+
+typedef struct PageHeaderData
+{
+	/* XXX LSN is member of *any* block, not only page-organized ones */
+	PageXLogRecPtr pd_lsn;		/* LSN: next byte after last byte of xlog
+								 * record for last change to this page */
+	uint16		pd_checksum;	/* checksum */
+	uint16		pd_flags;		/* flag bits, see below */
+	LocationIndex pd_lower;		/* offset to start of free space */
+	LocationIndex pd_upper;		/* offset to end of free space */
+	LocationIndex pd_special;	/* offset to start of special space */
+	uint16		pd_pagesize_version;
+	TransactionId pd_prune_xid; /* oldest prunable XID, or zero if none */
+	ItemIdData	pd_linp[FLEXIBLE_ARRAY_MEMBER]; /* line pointer array */
+} PageHeaderData;
+
+typedef PageHeaderData *PageHeader;
+
+/*
+ * pd_flags contains the following flag bits.  Undefined bits are initialized
+ * to zero and may be used in the future.
+ *
+ * PD_HAS_FREE_LINES is set if there are any LP_UNUSED line pointers before
+ * pd_lower.  This should be considered a hint rather than the truth, since
+ * changes to it are not WAL-logged.
+ *
+ * PD_PAGE_FULL is set if an UPDATE doesn't find enough free space in the
+ * page for its new tuple version; this suggests that a prune is needed.
+ * Again, this is just a hint.
+ */
+#define PD_HAS_FREE_LINES	0x0001		/* are there any unused line pointers? */
+#define PD_PAGE_FULL		0x0002		/* not enough free space for new
+										 * tuple? */
+#define PD_ALL_VISIBLE		0x0004		/* all tuples on page are visible to
+										 * everyone */
+
+#define PD_VALID_FLAG_BITS	0x0007		/* OR of all valid pd_flags bits */
+
+/*
+ * Page layout version number 0 is for pre-7.3 Postgres releases.
+ * Releases 7.3 and 7.4 use 1, denoting a new HeapTupleHeader layout.
+ * Release 8.0 uses 2; it changed the HeapTupleHeader layout again.
+ * Release 8.1 uses 3; it redefined HeapTupleHeader infomask bits.
+ * Release 8.3 uses 4; it changed the HeapTupleHeader layout again, and
+ *		added the pd_flags field (by stealing some bits from pd_tli),
+ *		as well as adding the pd_prune_xid field (which enlarges the header).
+ *
+ * As of Release 9.3, the checksum version must also be considered when
+ * handling pages.
+ */
+#define PG_PAGE_LAYOUT_VERSION		4
+#define PG_DATA_CHECKSUM_VERSION	1
+
+/* ----------------------------------------------------------------
+ *						page support macros
+ * ----------------------------------------------------------------
+ */
+
+/*
+ * PageIsValid
+ *		True iff page is valid.
+ */
+#define PageIsValid(page) PointerIsValid(page)
+
+/*
+ * line pointer(s) do not count as part of header
+ */
+#define SizeOfPageHeaderData (offsetof(PageHeaderData, pd_linp))
+
+/*
+ * PageIsEmpty
+ *		returns true iff no itemid has been allocated on the page
+ */
+#define PageIsEmpty(page) \
+	(((PageHeader) (page))->pd_lower <= SizeOfPageHeaderData)
+
+/*
+ * PageIsNew
+ *		returns true iff page has not been initialized (by PageInit)
+ */
+#define PageIsNew(page) (((PageHeader) (page))->pd_upper == 0)
+
+/*
+ * PageGetItemId
+ *		Returns an item identifier of a page.
+ */
+#define PageGetItemId(page, offsetNumber) \
+	((ItemId) (&((PageHeader) (page))->pd_linp[(offsetNumber) - 1]))
+
+/*
+ * PageGetContents
+ *		To be used in case the page does not contain item pointers.
+ *
+ * Note: prior to 8.3 this was not guaranteed to yield a MAXALIGN'd result.
+ * Now it is.  Beware of old code that might think the offset to the contents
+ * is just SizeOfPageHeaderData rather than MAXALIGN(SizeOfPageHeaderData).
+ */
+#define PageGetContents(page) \
+	((char *) (page) + MAXALIGN(SizeOfPageHeaderData))
+
+/* ----------------
+ *		macros to access page size info
+ * ----------------
+ */
+
+/*
+ * PageSizeIsValid
+ *		True iff the page size is valid.
+ */
+#define PageSizeIsValid(pageSize) ((pageSize) == BLCKSZ)
+
+/*
+ * PageGetPageSize
+ *		Returns the page size of a page.
+ *
+ * this can only be called on a formatted page (unlike
+ * BufferGetPageSize, which can be called on an unformatted page).
+ * however, it can be called on a page that is not stored in a buffer.
+ */
+#define PageGetPageSize(page) \
+	((Size) (((PageHeader) (page))->pd_pagesize_version & (uint16) 0xFF00))
+
+/*
+ * PageGetPageLayoutVersion
+ *		Returns the page layout version of a page.
+ */
+#define PageGetPageLayoutVersion(page) \
+	(((PageHeader) (page))->pd_pagesize_version & 0x00FF)
+
+/*
+ * PageSetPageSizeAndVersion
+ *		Sets the page size and page layout version number of a page.
+ *
+ * We could support setting these two values separately, but there's
+ * no real need for it at the moment.
+ */
+#define PageSetPageSizeAndVersion(page, size, version) \
+( \
+	AssertMacro(((size) & 0xFF00) == (size)), \
+	AssertMacro(((version) & 0x00FF) == (version)), \
+	((PageHeader) (page))->pd_pagesize_version = (size) | (version) \
+)
+
+/* ----------------
+ *		page special data macros
+ * ----------------
+ */
+/*
+ * PageGetSpecialSize
+ *		Returns size of special space on a page.
+ */
+#define PageGetSpecialSize(page) \
+	((uint16) (PageGetPageSize(page) - ((PageHeader)(page))->pd_special))
+
+/*
+ * PageGetSpecialPointer
+ *		Returns pointer to special space on a page.
+ */
+#define PageGetSpecialPointer(page) \
+( \
+	AssertMacro(PageIsValid(page)), \
+	AssertMacro(((PageHeader) (page))->pd_special <= BLCKSZ), \
+	AssertMacro(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData), \
+	(char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \
+)
+
+/*
+ * PageGetItem
+ *		Retrieves an item on the given page.
+ *
+ * Note:
+ *		This does not change the status of any of the resources passed.
+ *		The semantics may change in the future.
+ */
+#define PageGetItem(page, itemId) \
+( \
+	AssertMacro(PageIsValid(page)), \
+	AssertMacro(ItemIdHasStorage(itemId)), \
+	(Item)(((char *)(page)) + ItemIdGetOffset(itemId)) \
+)
+
+/*
+ * PageGetMaxOffsetNumber
+ *		Returns the maximum offset number used by the given page.
+ *		Since offset numbers are 1-based, this is also the number
+ *		of items on the page.
+ *
+ *		NOTE: if the page is not initialized (pd_lower == 0), we must
+ *		return zero to ensure sane behavior.  Accept double evaluation
+ *		of the argument so that we can ensure this.
+ */
+#define PageGetMaxOffsetNumber(page) \
+	(((PageHeader) (page))->pd_lower <= SizeOfPageHeaderData ? 0 : \
+	 ((((PageHeader) (page))->pd_lower - SizeOfPageHeaderData) \
+	  / sizeof(ItemIdData)))
+
+/*
+ * Additional macros for access to page headers. (Beware multiple evaluation
+ * of the arguments!)
+ */
+#define PageGetLSN(page) \
+	PageXLogRecPtrGet(((PageHeader) (page))->pd_lsn)
+#define PageSetLSN(page, lsn) \
+	PageXLogRecPtrSet(((PageHeader) (page))->pd_lsn, lsn)
+
+#define PageHasFreeLinePointers(page) \
+	(((PageHeader) (page))->pd_flags & PD_HAS_FREE_LINES)
+#define PageSetHasFreeLinePointers(page) \
+	(((PageHeader) (page))->pd_flags |= PD_HAS_FREE_LINES)
+#define PageClearHasFreeLinePointers(page) \
+	(((PageHeader) (page))->pd_flags &= ~PD_HAS_FREE_LINES)
+
+#define PageIsFull(page) \
+	(((PageHeader) (page))->pd_flags & PD_PAGE_FULL)
+#define PageSetFull(page) \
+	(((PageHeader) (page))->pd_flags |= PD_PAGE_FULL)
+#define PageClearFull(page) \
+	(((PageHeader) (page))->pd_flags &= ~PD_PAGE_FULL)
+
+#define PageIsAllVisible(page) \
+	(((PageHeader) (page))->pd_flags & PD_ALL_VISIBLE)
+#define PageSetAllVisible(page) \
+	(((PageHeader) (page))->pd_flags |= PD_ALL_VISIBLE)
+#define PageClearAllVisible(page) \
+	(((PageHeader) (page))->pd_flags &= ~PD_ALL_VISIBLE)
+
+#define PageIsPrunable(page, oldestxmin) \
+( \
+	AssertMacro(TransactionIdIsNormal(oldestxmin)), \
+	TransactionIdIsValid(((PageHeader) (page))->pd_prune_xid) && \
+	TransactionIdPrecedes(((PageHeader) (page))->pd_prune_xid, oldestxmin) \
+)
+#define PageSetPrunable(page, xid) \
+do { \
+	Assert(TransactionIdIsNormal(xid)); \
+	if (!TransactionIdIsValid(((PageHeader) (page))->pd_prune_xid) || \
+		TransactionIdPrecedes(xid, ((PageHeader) (page))->pd_prune_xid)) \
+		((PageHeader) (page))->pd_prune_xid = (xid); \
+} while (0)
+#define PageClearPrunable(page) \
+	(((PageHeader) (page))->pd_prune_xid = InvalidTransactionId)
+
+
+/* ----------------------------------------------------------------
+ *		extern declarations
+ * ----------------------------------------------------------------
+ */
+
+extern void PageInit(Page page, Size pageSize, Size specialSize);
+extern bool PageIsVerified(Page page, BlockNumber blkno);
+extern OffsetNumber PageAddItem(Page page, Item item, Size size,
+			OffsetNumber offsetNumber, bool overwrite, bool is_heap);
+extern Page PageGetTempPage(Page page);
+extern Page PageGetTempPageCopy(Page page);
+extern Page PageGetTempPageCopySpecial(Page page);
+extern void PageRestoreTempPage(Page tempPage, Page oldPage);
+extern void PageRepairFragmentation(Page page);
+extern Size PageGetFreeSpace(Page page);
+extern Size PageGetExactFreeSpace(Page page);
+extern Size PageGetHeapFreeSpace(Page page);
+extern void PageIndexTupleDelete(Page page, OffsetNumber offset);
+extern void PageIndexMultiDelete(Page page, OffsetNumber *itemnos, int nitems);
+extern void PageIndexDeleteNoCompact(Page page, OffsetNumber *itemnos,
+						 int nitems);
+extern char *PageSetChecksumCopy(Page page, BlockNumber blkno);
+extern void PageSetChecksumInplace(Page page, BlockNumber blkno);
+
+#endif   /* BUFPAGE_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/dsm.h b/foreign/libpg_query/src/postgres/include/storage/dsm.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/dsm.h
@@ -0,0 +1,59 @@
+/*-------------------------------------------------------------------------
+ *
+ * dsm.h
+ *	  manage dynamic shared memory segments
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/dsm.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef DSM_H
+#define DSM_H
+
+#include "storage/dsm_impl.h"
+
+typedef struct dsm_segment dsm_segment;
+
+#define DSM_CREATE_NULL_IF_MAXSEGMENTS			0x0001
+
+/* Startup and shutdown functions. */
+struct PGShmemHeader;			/* avoid including pg_shmem.h */
+extern void dsm_cleanup_using_control_segment(dsm_handle old_control_handle);
+extern void dsm_postmaster_startup(struct PGShmemHeader *);
+extern void dsm_backend_shutdown(void);
+extern void dsm_detach_all(void);
+
+#ifdef EXEC_BACKEND
+extern void dsm_set_control_handle(dsm_handle h);
+#endif
+
+/* Functions that create, update, or remove mappings. */
+extern dsm_segment *dsm_create(Size size, int flags);
+extern dsm_segment *dsm_attach(dsm_handle h);
+extern void *dsm_resize(dsm_segment *seg, Size size);
+extern void *dsm_remap(dsm_segment *seg);
+extern void dsm_detach(dsm_segment *seg);
+
+/* Resource management functions. */
+extern void dsm_pin_mapping(dsm_segment *seg);
+extern void dsm_unpin_mapping(dsm_segment *seg);
+extern void dsm_pin_segment(dsm_segment *seg);
+extern dsm_segment *dsm_find_mapping(dsm_handle h);
+
+/* Informational functions. */
+extern void *dsm_segment_address(dsm_segment *seg);
+extern Size dsm_segment_map_length(dsm_segment *seg);
+extern dsm_handle dsm_segment_handle(dsm_segment *seg);
+
+/* Cleanup hooks. */
+typedef void (*on_dsm_detach_callback) (dsm_segment *, Datum arg);
+extern void on_dsm_detach(dsm_segment *seg,
+			  on_dsm_detach_callback function, Datum arg);
+extern void cancel_on_dsm_detach(dsm_segment *seg,
+					 on_dsm_detach_callback function, Datum arg);
+extern void reset_on_dsm_detach(void);
+
+#endif   /* DSM_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/dsm_impl.h b/foreign/libpg_query/src/postgres/include/storage/dsm_impl.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/dsm_impl.h
@@ -0,0 +1,78 @@
+/*-------------------------------------------------------------------------
+ *
+ * dsm_impl.h
+ *	  low-level dynamic shared memory primitives
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/dsm_impl.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef DSM_IMPL_H
+#define DSM_IMPL_H
+
+/* Dynamic shared memory implementations. */
+#define DSM_IMPL_NONE			0
+#define DSM_IMPL_POSIX			1
+#define DSM_IMPL_SYSV			2
+#define DSM_IMPL_WINDOWS		3
+#define DSM_IMPL_MMAP			4
+
+/*
+ * Determine which dynamic shared memory implementations will be supported
+ * on this platform, and which one will be the default.
+ */
+#ifdef WIN32
+#define USE_DSM_WINDOWS
+#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE		DSM_IMPL_WINDOWS
+#else
+#ifdef HAVE_SHM_OPEN
+#define USE_DSM_POSIX
+#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE		DSM_IMPL_POSIX
+#endif
+#define USE_DSM_SYSV
+#ifndef DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE
+#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE		DSM_IMPL_SYSV
+#endif
+#define USE_DSM_MMAP
+#endif
+
+/* GUC. */
+extern int	dynamic_shared_memory_type;
+
+/*
+ * Directory for on-disk state.
+ *
+ * This is used by all implementations for crash recovery and by the mmap
+ * implementation for storage.
+ */
+#define PG_DYNSHMEM_DIR					"pg_dynshmem"
+#define PG_DYNSHMEM_MMAP_FILE_PREFIX	"mmap."
+
+/* A "name" for a dynamic shared memory segment. */
+typedef uint32 dsm_handle;
+
+/* All the shared-memory operations we know about. */
+typedef enum
+{
+	DSM_OP_CREATE,
+	DSM_OP_ATTACH,
+	DSM_OP_DETACH,
+	DSM_OP_RESIZE,
+	DSM_OP_DESTROY
+} dsm_op;
+
+/* Create, attach to, detach from, resize, or destroy a segment. */
+extern bool dsm_impl_op(dsm_op op, dsm_handle handle, Size request_size,
+			void **impl_private, void **mapped_address, Size *mapped_size,
+			int elevel);
+
+/* Some implementations cannot resize segments.  Can this one? */
+extern bool dsm_impl_can_resize(void);
+
+/* Implementation-dependent actions required to keep segment until shudown. */
+extern void dsm_impl_pin_segment(dsm_handle handle, void *impl_private);
+
+#endif   /* DSM_IMPL_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/fd.h b/foreign/libpg_query/src/postgres/include/storage/fd.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/fd.h
@@ -0,0 +1,125 @@
+/*-------------------------------------------------------------------------
+ *
+ * fd.h
+ *	  Virtual file descriptor definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/fd.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/*
+ * calls:
+ *
+ *	File {Close, Read, Write, Seek, Tell, Sync}
+ *	{Path Name Open, Allocate, Free} File
+ *
+ * These are NOT JUST RENAMINGS OF THE UNIX ROUTINES.
+ * Use them for all file activity...
+ *
+ *	File fd;
+ *	fd = PathNameOpenFile("foo", O_RDONLY, 0600);
+ *
+ *	AllocateFile();
+ *	FreeFile();
+ *
+ * Use AllocateFile, not fopen, if you need a stdio file (FILE*); then
+ * use FreeFile, not fclose, to close it.  AVOID using stdio for files
+ * that you intend to hold open for any length of time, since there is
+ * no way for them to share kernel file descriptors with other files.
+ *
+ * Likewise, use AllocateDir/FreeDir, not opendir/closedir, to allocate
+ * open directories (DIR*), and OpenTransientFile/CloseTransient File for an
+ * unbuffered file descriptor.
+ */
+#ifndef FD_H
+#define FD_H
+
+#include <dirent.h>
+
+
+/*
+ * FileSeek uses the standard UNIX lseek(2) flags.
+ */
+
+typedef char *FileName;
+
+typedef int File;
+
+
+/* GUC parameter */
+extern int	max_files_per_process;
+
+/*
+ * This is private to fd.c, but exported for save/restore_backend_variables()
+ */
+extern int	max_safe_fds;
+
+
+/*
+ * prototypes for functions in fd.c
+ */
+
+/* Operations on virtual Files --- equivalent to Unix kernel file ops */
+extern File PathNameOpenFile(FileName fileName, int fileFlags, int fileMode);
+extern File OpenTemporaryFile(bool interXact);
+extern void FileClose(File file);
+extern int	FilePrefetch(File file, off_t offset, int amount);
+extern int	FileRead(File file, char *buffer, int amount);
+extern int	FileWrite(File file, char *buffer, int amount);
+extern int	FileSync(File file);
+extern off_t FileSeek(File file, off_t offset, int whence);
+extern int	FileTruncate(File file, off_t offset);
+extern char *FilePathName(File file);
+
+/* Operations that allow use of regular stdio --- USE WITH CAUTION */
+extern FILE *AllocateFile(const char *name, const char *mode);
+extern int	FreeFile(FILE *file);
+
+/* Operations that allow use of pipe streams (popen/pclose) */
+extern FILE *OpenPipeStream(const char *command, const char *mode);
+extern int	ClosePipeStream(FILE *file);
+
+/* Operations to allow use of the <dirent.h> library routines */
+extern DIR *AllocateDir(const char *dirname);
+extern struct dirent *ReadDir(DIR *dir, const char *dirname);
+extern int	FreeDir(DIR *dir);
+
+/* Operations to allow use of a plain kernel FD, with automatic cleanup */
+extern int	OpenTransientFile(FileName fileName, int fileFlags, int fileMode);
+extern int	CloseTransientFile(int fd);
+
+/* If you've really really gotta have a plain kernel FD, use this */
+extern int	BasicOpenFile(FileName fileName, int fileFlags, int fileMode);
+
+/* Miscellaneous support routines */
+extern void InitFileAccess(void);
+extern void set_max_safe_fds(void);
+extern void closeAllVfds(void);
+extern void SetTempTablespaces(Oid *tableSpaces, int numSpaces);
+extern bool TempTablespacesAreSet(void);
+extern Oid	GetNextTempTableSpace(void);
+extern void AtEOXact_Files(void);
+extern void AtEOSubXact_Files(bool isCommit, SubTransactionId mySubid,
+				  SubTransactionId parentSubid);
+extern void RemovePgTempFiles(void);
+
+extern int	pg_fsync(int fd);
+extern int	pg_fsync_no_writethrough(int fd);
+extern int	pg_fsync_writethrough(int fd);
+extern int	pg_fdatasync(int fd);
+extern int	pg_flush_data(int fd, off_t offset, off_t amount);
+extern void fsync_fname(const char *fname, bool isdir);
+extern int	durable_rename(const char *oldfile, const char *newfile, int loglevel);
+extern int	durable_link_or_rename(const char *oldfile, const char *newfile, int loglevel);
+extern void SyncDataDirectory(void);
+
+/* Filename components for OpenTemporaryFile */
+#define PG_TEMP_FILES_DIR "pgsql_tmp"
+#define PG_TEMP_FILE_PREFIX "pgsql_tmp"
+
+#endif   /* FD_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/ipc.h b/foreign/libpg_query/src/postgres/include/storage/ipc.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/ipc.h
@@ -0,0 +1,80 @@
+/*-------------------------------------------------------------------------
+ *
+ * ipc.h
+ *	  POSTGRES inter-process communication definitions.
+ *
+ * This file is misnamed, as it no longer has much of anything directly
+ * to do with IPC.  The functionality here is concerned with managing
+ * exit-time cleanup for either a postmaster or a backend.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/ipc.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef IPC_H
+#define IPC_H
+
+typedef void (*pg_on_exit_callback) (int code, Datum arg);
+typedef void (*shmem_startup_hook_type) (void);
+
+/*----------
+ * API for handling cleanup that must occur during either ereport(ERROR)
+ * or ereport(FATAL) exits from a block of code.  (Typical examples are
+ * undoing transient changes to shared-memory state.)
+ *
+ *		PG_ENSURE_ERROR_CLEANUP(cleanup_function, arg);
+ *		{
+ *			... code that might throw ereport(ERROR) or ereport(FATAL) ...
+ *		}
+ *		PG_END_ENSURE_ERROR_CLEANUP(cleanup_function, arg);
+ *
+ * where the cleanup code is in a function declared per pg_on_exit_callback.
+ * The Datum value "arg" can carry any information the cleanup function
+ * needs.
+ *
+ * This construct ensures that cleanup_function() will be called during
+ * either ERROR or FATAL exits.  It will not be called on successful
+ * exit from the controlled code.  (If you want it to happen then too,
+ * call the function yourself from just after the construct.)
+ *
+ * Note: the macro arguments are multiply evaluated, so avoid side-effects.
+ *----------
+ */
+#define PG_ENSURE_ERROR_CLEANUP(cleanup_function, arg)	\
+	do { \
+		before_shmem_exit(cleanup_function, arg); \
+		PG_TRY()
+
+#define PG_END_ENSURE_ERROR_CLEANUP(cleanup_function, arg)	\
+		cancel_before_shmem_exit(cleanup_function, arg); \
+		PG_CATCH(); \
+		{ \
+			cancel_before_shmem_exit(cleanup_function, arg); \
+			cleanup_function (0, arg); \
+			PG_RE_THROW(); \
+		} \
+		PG_END_TRY(); \
+	} while (0)
+
+
+/* ipc.c */
+extern PGDLLIMPORT __thread  bool proc_exit_inprogress;
+
+extern void proc_exit(int code) pg_attribute_noreturn();
+extern void shmem_exit(int code);
+extern void on_proc_exit(pg_on_exit_callback function, Datum arg);
+extern void on_shmem_exit(pg_on_exit_callback function, Datum arg);
+extern void before_shmem_exit(pg_on_exit_callback function, Datum arg);
+extern void cancel_before_shmem_exit(pg_on_exit_callback function, Datum arg);
+extern void on_exit_reset(void);
+
+/* ipci.c */
+extern PGDLLIMPORT shmem_startup_hook_type shmem_startup_hook;
+
+extern void CreateSharedMemoryAndSemaphores(bool makePrivate, int port);
+
+#endif   /* IPC_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/item.h b/foreign/libpg_query/src/postgres/include/storage/item.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/item.h
@@ -0,0 +1,19 @@
+/*-------------------------------------------------------------------------
+ *
+ * item.h
+ *	  POSTGRES disk item definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/item.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef ITEM_H
+#define ITEM_H
+
+typedef Pointer Item;
+
+#endif   /* ITEM_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/itemid.h b/foreign/libpg_query/src/postgres/include/storage/itemid.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/itemid.h
@@ -0,0 +1,183 @@
+/*-------------------------------------------------------------------------
+ *
+ * itemid.h
+ *	  Standard POSTGRES buffer page item identifier definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/itemid.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef ITEMID_H
+#define ITEMID_H
+
+/*
+ * An item pointer (also called line pointer) on a buffer page
+ *
+ * In some cases an item pointer is "in use" but does not have any associated
+ * storage on the page.  By convention, lp_len == 0 in every item pointer
+ * that does not have storage, independently of its lp_flags state.
+ */
+typedef struct ItemIdData
+{
+	unsigned	lp_off:15,		/* offset to tuple (from start of page) */
+				lp_flags:2,		/* state of item pointer, see below */
+				lp_len:15;		/* byte length of tuple */
+} ItemIdData;
+
+typedef ItemIdData *ItemId;
+
+/*
+ * lp_flags has these possible states.  An UNUSED line pointer is available
+ * for immediate re-use, the other states are not.
+ */
+#define LP_UNUSED		0		/* unused (should always have lp_len=0) */
+#define LP_NORMAL		1		/* used (should always have lp_len>0) */
+#define LP_REDIRECT		2		/* HOT redirect (should have lp_len=0) */
+#define LP_DEAD			3		/* dead, may or may not have storage */
+
+/*
+ * Item offsets and lengths are represented by these types when
+ * they're not actually stored in an ItemIdData.
+ */
+typedef uint16 ItemOffset;
+typedef uint16 ItemLength;
+
+
+/* ----------------
+ *		support macros
+ * ----------------
+ */
+
+/*
+ *		ItemIdGetLength
+ */
+#define ItemIdGetLength(itemId) \
+   ((itemId)->lp_len)
+
+/*
+ *		ItemIdGetOffset
+ */
+#define ItemIdGetOffset(itemId) \
+   ((itemId)->lp_off)
+
+/*
+ *		ItemIdGetFlags
+ */
+#define ItemIdGetFlags(itemId) \
+   ((itemId)->lp_flags)
+
+/*
+ *		ItemIdGetRedirect
+ * In a REDIRECT pointer, lp_off holds the link to the next item pointer
+ */
+#define ItemIdGetRedirect(itemId) \
+   ((itemId)->lp_off)
+
+/*
+ * ItemIdIsValid
+ *		True iff item identifier is valid.
+ *		This is a pretty weak test, probably useful only in Asserts.
+ */
+#define ItemIdIsValid(itemId)	PointerIsValid(itemId)
+
+/*
+ * ItemIdIsUsed
+ *		True iff item identifier is in use.
+ */
+#define ItemIdIsUsed(itemId) \
+	((itemId)->lp_flags != LP_UNUSED)
+
+/*
+ * ItemIdIsNormal
+ *		True iff item identifier is in state NORMAL.
+ */
+#define ItemIdIsNormal(itemId) \
+	((itemId)->lp_flags == LP_NORMAL)
+
+/*
+ * ItemIdIsRedirected
+ *		True iff item identifier is in state REDIRECT.
+ */
+#define ItemIdIsRedirected(itemId) \
+	((itemId)->lp_flags == LP_REDIRECT)
+
+/*
+ * ItemIdIsDead
+ *		True iff item identifier is in state DEAD.
+ */
+#define ItemIdIsDead(itemId) \
+	((itemId)->lp_flags == LP_DEAD)
+
+/*
+ * ItemIdHasStorage
+ *		True iff item identifier has associated storage.
+ */
+#define ItemIdHasStorage(itemId) \
+	((itemId)->lp_len != 0)
+
+/*
+ * ItemIdSetUnused
+ *		Set the item identifier to be UNUSED, with no storage.
+ *		Beware of multiple evaluations of itemId!
+ */
+#define ItemIdSetUnused(itemId) \
+( \
+	(itemId)->lp_flags = LP_UNUSED, \
+	(itemId)->lp_off = 0, \
+	(itemId)->lp_len = 0 \
+)
+
+/*
+ * ItemIdSetNormal
+ *		Set the item identifier to be NORMAL, with the specified storage.
+ *		Beware of multiple evaluations of itemId!
+ */
+#define ItemIdSetNormal(itemId, off, len) \
+( \
+	(itemId)->lp_flags = LP_NORMAL, \
+	(itemId)->lp_off = (off), \
+	(itemId)->lp_len = (len) \
+)
+
+/*
+ * ItemIdSetRedirect
+ *		Set the item identifier to be REDIRECT, with the specified link.
+ *		Beware of multiple evaluations of itemId!
+ */
+#define ItemIdSetRedirect(itemId, link) \
+( \
+	(itemId)->lp_flags = LP_REDIRECT, \
+	(itemId)->lp_off = (link), \
+	(itemId)->lp_len = 0 \
+)
+
+/*
+ * ItemIdSetDead
+ *		Set the item identifier to be DEAD, with no storage.
+ *		Beware of multiple evaluations of itemId!
+ */
+#define ItemIdSetDead(itemId) \
+( \
+	(itemId)->lp_flags = LP_DEAD, \
+	(itemId)->lp_off = 0, \
+	(itemId)->lp_len = 0 \
+)
+
+/*
+ * ItemIdMarkDead
+ *		Set the item identifier to be DEAD, keeping its existing storage.
+ *
+ * Note: in indexes, this is used as if it were a hint-bit mechanism;
+ * we trust that multiple processors can do this in parallel and get
+ * the same result.
+ */
+#define ItemIdMarkDead(itemId) \
+( \
+	(itemId)->lp_flags = LP_DEAD \
+)
+
+#endif   /* ITEMID_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/itemptr.h b/foreign/libpg_query/src/postgres/include/storage/itemptr.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/itemptr.h
@@ -0,0 +1,150 @@
+/*-------------------------------------------------------------------------
+ *
+ * itemptr.h
+ *	  POSTGRES disk item pointer definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/itemptr.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef ITEMPTR_H
+#define ITEMPTR_H
+
+#include "storage/block.h"
+#include "storage/off.h"
+
+/*
+ * ItemPointer:
+ *
+ * This is a pointer to an item within a disk page of a known file
+ * (for example, a cross-link from an index to its parent table).
+ * blkid tells us which block, posid tells us which entry in the linp
+ * (ItemIdData) array we want.
+ *
+ * Note: because there is an item pointer in each tuple header and index
+ * tuple header on disk, it's very important not to waste space with
+ * structure padding bytes.  The struct is designed to be six bytes long
+ * (it contains three int16 fields) but a few compilers will pad it to
+ * eight bytes unless coerced.  We apply appropriate persuasion where
+ * possible, and to cope with unpersuadable compilers, we try to use
+ * "SizeOfIptrData" rather than "sizeof(ItemPointerData)" when computing
+ * on-disk sizes.
+ */
+typedef struct ItemPointerData
+{
+	BlockIdData ip_blkid;
+	OffsetNumber ip_posid;
+}
+/* If compiler understands packed and aligned pragmas, use those */
+#if defined(pg_attribute_packed) && defined(pg_attribute_aligned)
+pg_attribute_packed()
+pg_attribute_aligned(2)
+#endif
+ItemPointerData;
+
+#define SizeOfIptrData	\
+	(offsetof(ItemPointerData, ip_posid) + sizeof(OffsetNumber))
+
+typedef ItemPointerData *ItemPointer;
+
+/* ----------------
+ *		support macros
+ * ----------------
+ */
+
+/*
+ * ItemPointerIsValid
+ *		True iff the disk item pointer is not NULL.
+ */
+#define ItemPointerIsValid(pointer) \
+	((bool) (PointerIsValid(pointer) && ((pointer)->ip_posid != 0)))
+
+/*
+ * ItemPointerGetBlockNumber
+ *		Returns the block number of a disk item pointer.
+ */
+#define ItemPointerGetBlockNumber(pointer) \
+( \
+	AssertMacro(ItemPointerIsValid(pointer)), \
+	BlockIdGetBlockNumber(&(pointer)->ip_blkid) \
+)
+
+/*
+ * ItemPointerGetOffsetNumber
+ *		Returns the offset number of a disk item pointer.
+ */
+#define ItemPointerGetOffsetNumber(pointer) \
+( \
+	AssertMacro(ItemPointerIsValid(pointer)), \
+	(pointer)->ip_posid \
+)
+
+/*
+ * ItemPointerSet
+ *		Sets a disk item pointer to the specified block and offset.
+ */
+#define ItemPointerSet(pointer, blockNumber, offNum) \
+( \
+	AssertMacro(PointerIsValid(pointer)), \
+	BlockIdSet(&((pointer)->ip_blkid), blockNumber), \
+	(pointer)->ip_posid = offNum \
+)
+
+/*
+ * ItemPointerSetBlockNumber
+ *		Sets a disk item pointer to the specified block.
+ */
+#define ItemPointerSetBlockNumber(pointer, blockNumber) \
+( \
+	AssertMacro(PointerIsValid(pointer)), \
+	BlockIdSet(&((pointer)->ip_blkid), blockNumber) \
+)
+
+/*
+ * ItemPointerSetOffsetNumber
+ *		Sets a disk item pointer to the specified offset.
+ */
+#define ItemPointerSetOffsetNumber(pointer, offsetNumber) \
+( \
+	AssertMacro(PointerIsValid(pointer)), \
+	(pointer)->ip_posid = (offsetNumber) \
+)
+
+/*
+ * ItemPointerCopy
+ *		Copies the contents of one disk item pointer to another.
+ *
+ * Should there ever be padding in an ItemPointer this would need to be handled
+ * differently as it's used as hash key.
+ */
+#define ItemPointerCopy(fromPointer, toPointer) \
+( \
+	AssertMacro(PointerIsValid(toPointer)), \
+	AssertMacro(PointerIsValid(fromPointer)), \
+	*(toPointer) = *(fromPointer) \
+)
+
+/*
+ * ItemPointerSetInvalid
+ *		Sets a disk item pointer to be invalid.
+ */
+#define ItemPointerSetInvalid(pointer) \
+( \
+	AssertMacro(PointerIsValid(pointer)), \
+	BlockIdSet(&((pointer)->ip_blkid), InvalidBlockNumber), \
+	(pointer)->ip_posid = InvalidOffsetNumber \
+)
+
+/* ----------------
+ *		externs
+ * ----------------
+ */
+
+extern bool ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2);
+extern int32 ItemPointerCompare(ItemPointer arg1, ItemPointer arg2);
+
+#endif   /* ITEMPTR_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/latch.h b/foreign/libpg_query/src/postgres/include/storage/latch.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/latch.h
@@ -0,0 +1,132 @@
+/*-------------------------------------------------------------------------
+ *
+ * latch.h
+ *	  Routines for interprocess latches
+ *
+ * A latch is a boolean variable, with operations that let processes sleep
+ * until it is set. A latch can be set from another process, or a signal
+ * handler within the same process.
+ *
+ * The latch interface is a reliable replacement for the common pattern of
+ * using pg_usleep() or select() to wait until a signal arrives, where the
+ * signal handler sets a flag variable. Because on some platforms an
+ * incoming signal doesn't interrupt sleep, and even on platforms where it
+ * does there is a race condition if the signal arrives just before
+ * entering the sleep, the common pattern must periodically wake up and
+ * poll the flag variable. The pselect() system call was invented to solve
+ * this problem, but it is not portable enough. Latches are designed to
+ * overcome these limitations, allowing you to sleep without polling and
+ * ensuring quick response to signals from other processes.
+ *
+ * There are two kinds of latches: local and shared. A local latch is
+ * initialized by InitLatch, and can only be set from the same process.
+ * A local latch can be used to wait for a signal to arrive, by calling
+ * SetLatch in the signal handler. A shared latch resides in shared memory,
+ * and must be initialized at postmaster startup by InitSharedLatch. Before
+ * a shared latch can be waited on, it must be associated with a process
+ * with OwnLatch. Only the process owning the latch can wait on it, but any
+ * process can set it.
+ *
+ * There are three basic operations on a latch:
+ *
+ * SetLatch		- Sets the latch
+ * ResetLatch	- Clears the latch, allowing it to be set again
+ * WaitLatch	- Waits for the latch to become set
+ *
+ * WaitLatch includes a provision for timeouts (which should be avoided
+ * when possible, as they incur extra overhead) and a provision for
+ * postmaster child processes to wake up immediately on postmaster death.
+ * See unix_latch.c for detailed specifications for the exported functions.
+ *
+ * The correct pattern to wait for event(s) is:
+ *
+ * for (;;)
+ * {
+ *	   ResetLatch();
+ *	   if (work to do)
+ *		   Do Stuff();
+ *	   WaitLatch();
+ * }
+ *
+ * It's important to reset the latch *before* checking if there's work to
+ * do. Otherwise, if someone sets the latch between the check and the
+ * ResetLatch call, you will miss it and Wait will incorrectly block.
+ *
+ * To wake up the waiter, you must first set a global flag or something
+ * else that the wait loop tests in the "if (work to do)" part, and call
+ * SetLatch *after* that. SetLatch is designed to return quickly if the
+ * latch is already set.
+ *
+ * On some platforms, signals will not interrupt the latch wait primitive
+ * by themselves.  Therefore, it is critical that any signal handler that
+ * is meant to terminate a WaitLatch wait calls SetLatch.
+ *
+ * Note that use of the process latch (PGPROC.procLatch) is generally better
+ * than an ad-hoc shared latch for signaling auxiliary processes.  This is
+ * because generic signal handlers will call SetLatch on the process latch
+ * only, so using any latch other than the process latch effectively precludes
+ * use of any generic handler.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/latch.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef LATCH_H
+#define LATCH_H
+
+#include <signal.h>
+
+/*
+ * Latch structure should be treated as opaque and only accessed through
+ * the public functions. It is defined here to allow embedding Latches as
+ * part of bigger structs.
+ */
+typedef struct Latch
+{
+	sig_atomic_t is_set;
+	bool		is_shared;
+	int			owner_pid;
+#ifdef WIN32
+	HANDLE		event;
+#endif
+} Latch;
+
+/* Bitmasks for events that may wake-up WaitLatch() clients */
+#define WL_LATCH_SET		 (1 << 0)
+#define WL_SOCKET_READABLE	 (1 << 1)
+#define WL_SOCKET_WRITEABLE  (1 << 2)
+#define WL_TIMEOUT			 (1 << 3)
+#define WL_POSTMASTER_DEATH  (1 << 4)
+
+/*
+ * prototypes for functions in latch.c
+ */
+extern void InitializeLatchSupport(void);
+extern void InitLatch(volatile Latch *latch);
+extern void InitSharedLatch(volatile Latch *latch);
+extern void OwnLatch(volatile Latch *latch);
+extern void DisownLatch(volatile Latch *latch);
+extern int	WaitLatch(volatile Latch *latch, int wakeEvents, long timeout);
+extern int WaitLatchOrSocket(volatile Latch *latch, int wakeEvents,
+				  pgsocket sock, long timeout);
+extern void SetLatch(volatile Latch *latch);
+extern void ResetLatch(volatile Latch *latch);
+
+/* beware of memory ordering issues if you use this macro! */
+#define TestLatch(latch) (((volatile Latch *) (latch))->is_set)
+
+/*
+ * Unix implementation uses SIGUSR1 for inter-process signaling.
+ * Win32 doesn't need this.
+ */
+#ifndef WIN32
+extern void latch_sigusr1_handler(void);
+#else
+#define latch_sigusr1_handler()  ((void) 0)
+#endif
+
+#endif   /* LATCH_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/lmgr.h b/foreign/libpg_query/src/postgres/include/storage/lmgr.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/lmgr.h
@@ -0,0 +1,104 @@
+/*-------------------------------------------------------------------------
+ *
+ * lmgr.h
+ *	  POSTGRES lock manager definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/lmgr.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef LMGR_H
+#define LMGR_H
+
+#include "lib/stringinfo.h"
+#include "storage/itemptr.h"
+#include "storage/lock.h"
+#include "utils/rel.h"
+
+
+/* XactLockTableWait operations */
+typedef enum XLTW_Oper
+{
+	XLTW_None,
+	XLTW_Update,
+	XLTW_Delete,
+	XLTW_Lock,
+	XLTW_LockUpdated,
+	XLTW_InsertIndex,
+	XLTW_InsertIndexUnique,
+	XLTW_FetchUpdated,
+	XLTW_RecheckExclusionConstr
+} XLTW_Oper;
+
+extern void RelationInitLockInfo(Relation relation);
+
+/* Lock a relation */
+extern void LockRelationOid(Oid relid, LOCKMODE lockmode);
+extern bool ConditionalLockRelationOid(Oid relid, LOCKMODE lockmode);
+extern void UnlockRelationId(LockRelId *relid, LOCKMODE lockmode);
+extern void UnlockRelationOid(Oid relid, LOCKMODE lockmode);
+
+extern void LockRelation(Relation relation, LOCKMODE lockmode);
+extern bool ConditionalLockRelation(Relation relation, LOCKMODE lockmode);
+extern void UnlockRelation(Relation relation, LOCKMODE lockmode);
+extern bool LockHasWaitersRelation(Relation relation, LOCKMODE lockmode);
+
+extern void LockRelationIdForSession(LockRelId *relid, LOCKMODE lockmode);
+extern void UnlockRelationIdForSession(LockRelId *relid, LOCKMODE lockmode);
+
+/* Lock a relation for extension */
+extern void LockRelationForExtension(Relation relation, LOCKMODE lockmode);
+extern void UnlockRelationForExtension(Relation relation, LOCKMODE lockmode);
+
+/* Lock a page (currently only used within indexes) */
+extern void LockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode);
+extern bool ConditionalLockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode);
+extern void UnlockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode);
+
+/* Lock a tuple (see heap_lock_tuple before assuming you understand this) */
+extern void LockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode);
+extern bool ConditionalLockTuple(Relation relation, ItemPointer tid,
+					 LOCKMODE lockmode);
+extern void UnlockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode);
+
+/* Lock an XID (used to wait for a transaction to finish) */
+extern void XactLockTableInsert(TransactionId xid);
+extern void XactLockTableDelete(TransactionId xid);
+extern void XactLockTableWait(TransactionId xid, Relation rel,
+				  ItemPointer ctid, XLTW_Oper oper);
+extern bool ConditionalXactLockTableWait(TransactionId xid);
+
+/* Lock VXIDs, specified by conflicting locktags */
+extern void WaitForLockers(LOCKTAG heaplocktag, LOCKMODE lockmode);
+extern void WaitForLockersMultiple(List *locktags, LOCKMODE lockmode);
+
+/* Lock an XID for tuple insertion (used to wait for an insertion to finish) */
+extern uint32 SpeculativeInsertionLockAcquire(TransactionId xid);
+extern void SpeculativeInsertionLockRelease(TransactionId xid);
+extern void SpeculativeInsertionWait(TransactionId xid, uint32 token);
+
+/* Lock a general object (other than a relation) of the current database */
+extern void LockDatabaseObject(Oid classid, Oid objid, uint16 objsubid,
+				   LOCKMODE lockmode);
+extern void UnlockDatabaseObject(Oid classid, Oid objid, uint16 objsubid,
+					 LOCKMODE lockmode);
+
+/* Lock a shared-across-databases object (other than a relation) */
+extern void LockSharedObject(Oid classid, Oid objid, uint16 objsubid,
+				 LOCKMODE lockmode);
+extern void UnlockSharedObject(Oid classid, Oid objid, uint16 objsubid,
+				   LOCKMODE lockmode);
+
+extern void LockSharedObjectForSession(Oid classid, Oid objid, uint16 objsubid,
+						   LOCKMODE lockmode);
+extern void UnlockSharedObjectForSession(Oid classid, Oid objid, uint16 objsubid,
+							 LOCKMODE lockmode);
+
+/* Describe a locktag for error messages */
+extern void DescribeLockTag(StringInfo buf, const LOCKTAG *tag);
+
+#endif   /* LMGR_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/lock.h b/foreign/libpg_query/src/postgres/include/storage/lock.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/lock.h
@@ -0,0 +1,577 @@
+/*-------------------------------------------------------------------------
+ *
+ * lock.h
+ *	  POSTGRES low-level lock mechanism
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/lock.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef LOCK_H_
+#define LOCK_H_
+
+#include "storage/backendid.h"
+#include "storage/lwlock.h"
+#include "storage/shmem.h"
+
+
+/* struct PGPROC is declared in proc.h, but must forward-reference it */
+typedef struct PGPROC PGPROC;
+
+typedef struct PROC_QUEUE
+{
+	SHM_QUEUE	links;			/* head of list of PGPROC objects */
+	int			size;			/* number of entries in list */
+} PROC_QUEUE;
+
+/* GUC variables */
+extern int	max_locks_per_xact;
+
+#ifdef LOCK_DEBUG
+extern int	Trace_lock_oidmin;
+extern bool Trace_locks;
+extern bool Trace_userlocks;
+extern int	Trace_lock_table;
+extern bool Debug_deadlocks;
+#endif   /* LOCK_DEBUG */
+
+
+/*
+ * Top-level transactions are identified by VirtualTransactionIDs comprising
+ * the BackendId of the backend running the xact, plus a locally-assigned
+ * LocalTransactionId.  These are guaranteed unique over the short term,
+ * but will be reused after a database restart; hence they should never
+ * be stored on disk.
+ *
+ * Note that struct VirtualTransactionId can not be assumed to be atomically
+ * assignable as a whole.  However, type LocalTransactionId is assumed to
+ * be atomically assignable, and the backend ID doesn't change often enough
+ * to be a problem, so we can fetch or assign the two fields separately.
+ * We deliberately refrain from using the struct within PGPROC, to prevent
+ * coding errors from trying to use struct assignment with it; instead use
+ * GET_VXID_FROM_PGPROC().
+ */
+typedef struct
+{
+	BackendId	backendId;		/* determined at backend startup */
+	LocalTransactionId localTransactionId;		/* backend-local transaction
+												 * id */
+} VirtualTransactionId;
+
+#define InvalidLocalTransactionId		0
+#define LocalTransactionIdIsValid(lxid) ((lxid) != InvalidLocalTransactionId)
+#define VirtualTransactionIdIsValid(vxid) \
+	(((vxid).backendId != InvalidBackendId) && \
+	 LocalTransactionIdIsValid((vxid).localTransactionId))
+#define VirtualTransactionIdEquals(vxid1, vxid2) \
+	((vxid1).backendId == (vxid2).backendId && \
+	 (vxid1).localTransactionId == (vxid2).localTransactionId)
+#define SetInvalidVirtualTransactionId(vxid) \
+	((vxid).backendId = InvalidBackendId, \
+	 (vxid).localTransactionId = InvalidLocalTransactionId)
+#define GET_VXID_FROM_PGPROC(vxid, proc) \
+	((vxid).backendId = (proc).backendId, \
+	 (vxid).localTransactionId = (proc).lxid)
+
+
+/*
+ * LOCKMODE is an integer (1..N) indicating a lock type.  LOCKMASK is a bit
+ * mask indicating a set of held or requested lock types (the bit 1<<mode
+ * corresponds to a particular lock mode).
+ */
+typedef int LOCKMASK;
+typedef int LOCKMODE;
+
+/* MAX_LOCKMODES cannot be larger than the # of bits in LOCKMASK */
+#define MAX_LOCKMODES		10
+
+#define LOCKBIT_ON(lockmode) (1 << (lockmode))
+#define LOCKBIT_OFF(lockmode) (~(1 << (lockmode)))
+
+
+/*
+ * This data structure defines the locking semantics associated with a
+ * "lock method".  The semantics specify the meaning of each lock mode
+ * (by defining which lock modes it conflicts with).
+ * All of this data is constant and is kept in const tables.
+ *
+ * numLockModes -- number of lock modes (READ,WRITE,etc) that
+ *		are defined in this lock method.  Must be less than MAX_LOCKMODES.
+ *
+ * conflictTab -- this is an array of bitmasks showing lock
+ *		mode conflicts.  conflictTab[i] is a mask with the j-th bit
+ *		turned on if lock modes i and j conflict.  Lock modes are
+ *		numbered 1..numLockModes; conflictTab[0] is unused.
+ *
+ * lockModeNames -- ID strings for debug printouts.
+ *
+ * trace_flag -- pointer to GUC trace flag for this lock method.  (The
+ * GUC variable is not constant, but we use "const" here to denote that
+ * it can't be changed through this reference.)
+ */
+typedef struct LockMethodData
+{
+	int			numLockModes;
+	const LOCKMASK *conflictTab;
+	const char *const * lockModeNames;
+	const bool *trace_flag;
+} LockMethodData;
+
+typedef const LockMethodData *LockMethod;
+
+/*
+ * Lock methods are identified by LOCKMETHODID.  (Despite the declaration as
+ * uint16, we are constrained to 256 lockmethods by the layout of LOCKTAG.)
+ */
+typedef uint16 LOCKMETHODID;
+
+/* These identify the known lock methods */
+#define DEFAULT_LOCKMETHOD	1
+#define USER_LOCKMETHOD		2
+
+/*
+ * These are the valid values of type LOCKMODE for all the standard lock
+ * methods (both DEFAULT and USER).
+ */
+
+/* NoLock is not a lock mode, but a flag value meaning "don't get a lock" */
+#define NoLock					0
+
+#define AccessShareLock			1		/* SELECT */
+#define RowShareLock			2		/* SELECT FOR UPDATE/FOR SHARE */
+#define RowExclusiveLock		3		/* INSERT, UPDATE, DELETE */
+#define ShareUpdateExclusiveLock 4		/* VACUUM (non-FULL),ANALYZE, CREATE
+										 * INDEX CONCURRENTLY */
+#define ShareLock				5		/* CREATE INDEX (WITHOUT CONCURRENTLY) */
+#define ShareRowExclusiveLock	6		/* like EXCLUSIVE MODE, but allows ROW
+										 * SHARE */
+#define ExclusiveLock			7		/* blocks ROW SHARE/SELECT...FOR
+										 * UPDATE */
+#define AccessExclusiveLock		8		/* ALTER TABLE, DROP TABLE, VACUUM
+										 * FULL, and unqualified LOCK TABLE */
+
+
+/*
+ * LOCKTAG is the key information needed to look up a LOCK item in the
+ * lock hashtable.  A LOCKTAG value uniquely identifies a lockable object.
+ *
+ * The LockTagType enum defines the different kinds of objects we can lock.
+ * We can handle up to 256 different LockTagTypes.
+ */
+typedef enum LockTagType
+{
+	LOCKTAG_RELATION,			/* whole relation */
+	/* ID info for a relation is DB OID + REL OID; DB OID = 0 if shared */
+	LOCKTAG_RELATION_EXTEND,	/* the right to extend a relation */
+	/* same ID info as RELATION */
+	LOCKTAG_PAGE,				/* one page of a relation */
+	/* ID info for a page is RELATION info + BlockNumber */
+	LOCKTAG_TUPLE,				/* one physical tuple */
+	/* ID info for a tuple is PAGE info + OffsetNumber */
+	LOCKTAG_TRANSACTION,		/* transaction (for waiting for xact done) */
+	/* ID info for a transaction is its TransactionId */
+	LOCKTAG_VIRTUALTRANSACTION, /* virtual transaction (ditto) */
+	/* ID info for a virtual transaction is its VirtualTransactionId */
+	LOCKTAG_SPECULATIVE_TOKEN,	/* speculative insertion Xid and token */
+	/* ID info for a transaction is its TransactionId */
+	LOCKTAG_OBJECT,				/* non-relation database object */
+	/* ID info for an object is DB OID + CLASS OID + OBJECT OID + SUBID */
+
+	/*
+	 * Note: object ID has same representation as in pg_depend and
+	 * pg_description, but notice that we are constraining SUBID to 16 bits.
+	 * Also, we use DB OID = 0 for shared objects such as tablespaces.
+	 */
+	LOCKTAG_USERLOCK,			/* reserved for old contrib/userlock code */
+	LOCKTAG_ADVISORY			/* advisory user locks */
+} LockTagType;
+
+#define LOCKTAG_LAST_TYPE	LOCKTAG_ADVISORY
+
+/*
+ * The LOCKTAG struct is defined with malice aforethought to fit into 16
+ * bytes with no padding.  Note that this would need adjustment if we were
+ * to widen Oid, BlockNumber, or TransactionId to more than 32 bits.
+ *
+ * We include lockmethodid in the locktag so that a single hash table in
+ * shared memory can store locks of different lockmethods.
+ */
+typedef struct LOCKTAG
+{
+	uint32		locktag_field1; /* a 32-bit ID field */
+	uint32		locktag_field2; /* a 32-bit ID field */
+	uint32		locktag_field3; /* a 32-bit ID field */
+	uint16		locktag_field4; /* a 16-bit ID field */
+	uint8		locktag_type;	/* see enum LockTagType */
+	uint8		locktag_lockmethodid;	/* lockmethod indicator */
+} LOCKTAG;
+
+/*
+ * These macros define how we map logical IDs of lockable objects into
+ * the physical fields of LOCKTAG.  Use these to set up LOCKTAG values,
+ * rather than accessing the fields directly.  Note multiple eval of target!
+ */
+#define SET_LOCKTAG_RELATION(locktag,dboid,reloid) \
+	((locktag).locktag_field1 = (dboid), \
+	 (locktag).locktag_field2 = (reloid), \
+	 (locktag).locktag_field3 = 0, \
+	 (locktag).locktag_field4 = 0, \
+	 (locktag).locktag_type = LOCKTAG_RELATION, \
+	 (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
+
+#define SET_LOCKTAG_RELATION_EXTEND(locktag,dboid,reloid) \
+	((locktag).locktag_field1 = (dboid), \
+	 (locktag).locktag_field2 = (reloid), \
+	 (locktag).locktag_field3 = 0, \
+	 (locktag).locktag_field4 = 0, \
+	 (locktag).locktag_type = LOCKTAG_RELATION_EXTEND, \
+	 (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
+
+#define SET_LOCKTAG_PAGE(locktag,dboid,reloid,blocknum) \
+	((locktag).locktag_field1 = (dboid), \
+	 (locktag).locktag_field2 = (reloid), \
+	 (locktag).locktag_field3 = (blocknum), \
+	 (locktag).locktag_field4 = 0, \
+	 (locktag).locktag_type = LOCKTAG_PAGE, \
+	 (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
+
+#define SET_LOCKTAG_TUPLE(locktag,dboid,reloid,blocknum,offnum) \
+	((locktag).locktag_field1 = (dboid), \
+	 (locktag).locktag_field2 = (reloid), \
+	 (locktag).locktag_field3 = (blocknum), \
+	 (locktag).locktag_field4 = (offnum), \
+	 (locktag).locktag_type = LOCKTAG_TUPLE, \
+	 (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
+
+#define SET_LOCKTAG_TRANSACTION(locktag,xid) \
+	((locktag).locktag_field1 = (xid), \
+	 (locktag).locktag_field2 = 0, \
+	 (locktag).locktag_field3 = 0, \
+	 (locktag).locktag_field4 = 0, \
+	 (locktag).locktag_type = LOCKTAG_TRANSACTION, \
+	 (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
+
+#define SET_LOCKTAG_VIRTUALTRANSACTION(locktag,vxid) \
+	((locktag).locktag_field1 = (vxid).backendId, \
+	 (locktag).locktag_field2 = (vxid).localTransactionId, \
+	 (locktag).locktag_field3 = 0, \
+	 (locktag).locktag_field4 = 0, \
+	 (locktag).locktag_type = LOCKTAG_VIRTUALTRANSACTION, \
+	 (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
+
+#define SET_LOCKTAG_SPECULATIVE_INSERTION(locktag,xid,token) \
+	((locktag).locktag_field1 = (xid), \
+	 (locktag).locktag_field2 = (token),		\
+	 (locktag).locktag_field3 = 0, \
+	 (locktag).locktag_field4 = 0, \
+	 (locktag).locktag_type = LOCKTAG_SPECULATIVE_TOKEN, \
+	 (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
+
+#define SET_LOCKTAG_OBJECT(locktag,dboid,classoid,objoid,objsubid) \
+	((locktag).locktag_field1 = (dboid), \
+	 (locktag).locktag_field2 = (classoid), \
+	 (locktag).locktag_field3 = (objoid), \
+	 (locktag).locktag_field4 = (objsubid), \
+	 (locktag).locktag_type = LOCKTAG_OBJECT, \
+	 (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
+
+#define SET_LOCKTAG_ADVISORY(locktag,id1,id2,id3,id4) \
+	((locktag).locktag_field1 = (id1), \
+	 (locktag).locktag_field2 = (id2), \
+	 (locktag).locktag_field3 = (id3), \
+	 (locktag).locktag_field4 = (id4), \
+	 (locktag).locktag_type = LOCKTAG_ADVISORY, \
+	 (locktag).locktag_lockmethodid = USER_LOCKMETHOD)
+
+
+/*
+ * Per-locked-object lock information:
+ *
+ * tag -- uniquely identifies the object being locked
+ * grantMask -- bitmask for all lock types currently granted on this object.
+ * waitMask -- bitmask for all lock types currently awaited on this object.
+ * procLocks -- list of PROCLOCK objects for this lock.
+ * waitProcs -- queue of processes waiting for this lock.
+ * requested -- count of each lock type currently requested on the lock
+ *		(includes requests already granted!!).
+ * nRequested -- total requested locks of all types.
+ * granted -- count of each lock type currently granted on the lock.
+ * nGranted -- total granted locks of all types.
+ *
+ * Note: these counts count 1 for each backend.  Internally to a backend,
+ * there may be multiple grabs on a particular lock, but this is not reflected
+ * into shared memory.
+ */
+typedef struct LOCK
+{
+	/* hash key */
+	LOCKTAG		tag;			/* unique identifier of lockable object */
+
+	/* data */
+	LOCKMASK	grantMask;		/* bitmask for lock types already granted */
+	LOCKMASK	waitMask;		/* bitmask for lock types awaited */
+	SHM_QUEUE	procLocks;		/* list of PROCLOCK objects assoc. with lock */
+	PROC_QUEUE	waitProcs;		/* list of PGPROC objects waiting on lock */
+	int			requested[MAX_LOCKMODES];		/* counts of requested locks */
+	int			nRequested;		/* total of requested[] array */
+	int			granted[MAX_LOCKMODES]; /* counts of granted locks */
+	int			nGranted;		/* total of granted[] array */
+} LOCK;
+
+#define LOCK_LOCKMETHOD(lock) ((LOCKMETHODID) (lock).tag.locktag_lockmethodid)
+
+
+/*
+ * We may have several different backends holding or awaiting locks
+ * on the same lockable object.  We need to store some per-holder/waiter
+ * information for each such holder (or would-be holder).  This is kept in
+ * a PROCLOCK struct.
+ *
+ * PROCLOCKTAG is the key information needed to look up a PROCLOCK item in the
+ * proclock hashtable.  A PROCLOCKTAG value uniquely identifies the combination
+ * of a lockable object and a holder/waiter for that object.  (We can use
+ * pointers here because the PROCLOCKTAG need only be unique for the lifespan
+ * of the PROCLOCK, and it will never outlive the lock or the proc.)
+ *
+ * Internally to a backend, it is possible for the same lock to be held
+ * for different purposes: the backend tracks transaction locks separately
+ * from session locks.  However, this is not reflected in the shared-memory
+ * state: we only track which backend(s) hold the lock.  This is OK since a
+ * backend can never block itself.
+ *
+ * The holdMask field shows the already-granted locks represented by this
+ * proclock.  Note that there will be a proclock object, possibly with
+ * zero holdMask, for any lock that the process is currently waiting on.
+ * Otherwise, proclock objects whose holdMasks are zero are recycled
+ * as soon as convenient.
+ *
+ * releaseMask is workspace for LockReleaseAll(): it shows the locks due
+ * to be released during the current call.  This must only be examined or
+ * set by the backend owning the PROCLOCK.
+ *
+ * Each PROCLOCK object is linked into lists for both the associated LOCK
+ * object and the owning PGPROC object.  Note that the PROCLOCK is entered
+ * into these lists as soon as it is created, even if no lock has yet been
+ * granted.  A PGPROC that is waiting for a lock to be granted will also be
+ * linked into the lock's waitProcs queue.
+ */
+typedef struct PROCLOCKTAG
+{
+	/* NB: we assume this struct contains no padding! */
+	LOCK	   *myLock;			/* link to per-lockable-object information */
+	PGPROC	   *myProc;			/* link to PGPROC of owning backend */
+} PROCLOCKTAG;
+
+typedef struct PROCLOCK
+{
+	/* tag */
+	PROCLOCKTAG tag;			/* unique identifier of proclock object */
+
+	/* data */
+	LOCKMASK	holdMask;		/* bitmask for lock types currently held */
+	LOCKMASK	releaseMask;	/* bitmask for lock types to be released */
+	SHM_QUEUE	lockLink;		/* list link in LOCK's list of proclocks */
+	SHM_QUEUE	procLink;		/* list link in PGPROC's list of proclocks */
+} PROCLOCK;
+
+#define PROCLOCK_LOCKMETHOD(proclock) \
+	LOCK_LOCKMETHOD(*((proclock).tag.myLock))
+
+/*
+ * Each backend also maintains a local hash table with information about each
+ * lock it is currently interested in.  In particular the local table counts
+ * the number of times that lock has been acquired.  This allows multiple
+ * requests for the same lock to be executed without additional accesses to
+ * shared memory.  We also track the number of lock acquisitions per
+ * ResourceOwner, so that we can release just those locks belonging to a
+ * particular ResourceOwner.
+ *
+ * When holding a lock taken "normally", the lock and proclock fields always
+ * point to the associated objects in shared memory.  However, if we acquired
+ * the lock via the fast-path mechanism, the lock and proclock fields are set
+ * to NULL, since there probably aren't any such objects in shared memory.
+ * (If the lock later gets promoted to normal representation, we may eventually
+ * update our locallock's lock/proclock fields after finding the shared
+ * objects.)
+ *
+ * Caution: a locallock object can be left over from a failed lock acquisition
+ * attempt.  In this case its lock/proclock fields are untrustworthy, since
+ * the shared lock object is neither held nor awaited, and hence is available
+ * to be reclaimed.  If nLocks > 0 then these pointers must either be valid or
+ * NULL, but when nLocks == 0 they should be considered garbage.
+ */
+typedef struct LOCALLOCKTAG
+{
+	LOCKTAG		lock;			/* identifies the lockable object */
+	LOCKMODE	mode;			/* lock mode for this table entry */
+} LOCALLOCKTAG;
+
+typedef struct LOCALLOCKOWNER
+{
+	/*
+	 * Note: if owner is NULL then the lock is held on behalf of the session;
+	 * otherwise it is held on behalf of my current transaction.
+	 *
+	 * Must use a forward struct reference to avoid circularity.
+	 */
+	struct ResourceOwnerData *owner;
+	int64		nLocks;			/* # of times held by this owner */
+} LOCALLOCKOWNER;
+
+typedef struct LOCALLOCK
+{
+	/* tag */
+	LOCALLOCKTAG tag;			/* unique identifier of locallock entry */
+
+	/* data */
+	LOCK	   *lock;			/* associated LOCK object, if any */
+	PROCLOCK   *proclock;		/* associated PROCLOCK object, if any */
+	uint32		hashcode;		/* copy of LOCKTAG's hash value */
+	int64		nLocks;			/* total number of times lock is held */
+	int			numLockOwners;	/* # of relevant ResourceOwners */
+	int			maxLockOwners;	/* allocated size of array */
+	bool		holdsStrongLockCount;	/* bumped FastPathStrongRelationLocks */
+	LOCALLOCKOWNER *lockOwners; /* dynamically resizable array */
+} LOCALLOCK;
+
+#define LOCALLOCK_LOCKMETHOD(llock) ((llock).tag.lock.locktag_lockmethodid)
+
+
+/*
+ * These structures hold information passed from lmgr internals to the lock
+ * listing user-level functions (in lockfuncs.c).
+ */
+
+typedef struct LockInstanceData
+{
+	LOCKTAG		locktag;		/* locked object */
+	LOCKMASK	holdMask;		/* locks held by this PGPROC */
+	LOCKMODE	waitLockMode;	/* lock awaited by this PGPROC, if any */
+	BackendId	backend;		/* backend ID of this PGPROC */
+	LocalTransactionId lxid;	/* local transaction ID of this PGPROC */
+	int			pid;			/* pid of this PGPROC */
+	bool		fastpath;		/* taken via fastpath? */
+} LockInstanceData;
+
+typedef struct LockData
+{
+	int			nelements;		/* The length of the array */
+	LockInstanceData *locks;
+} LockData;
+
+
+/* Result codes for LockAcquire() */
+typedef enum
+{
+	LOCKACQUIRE_NOT_AVAIL,		/* lock not available, and dontWait=true */
+	LOCKACQUIRE_OK,				/* lock successfully acquired */
+	LOCKACQUIRE_ALREADY_HELD	/* incremented count for lock already held */
+} LockAcquireResult;
+
+/* Deadlock states identified by DeadLockCheck() */
+typedef enum
+{
+	DS_NOT_YET_CHECKED,			/* no deadlock check has run yet */
+	DS_NO_DEADLOCK,				/* no deadlock detected */
+	DS_SOFT_DEADLOCK,			/* deadlock avoided by queue rearrangement */
+	DS_HARD_DEADLOCK,			/* deadlock, no way out but ERROR */
+	DS_BLOCKED_BY_AUTOVACUUM	/* no deadlock; queue blocked by autovacuum
+								 * worker */
+} DeadLockState;
+
+
+/*
+ * The lockmgr's shared hash tables are partitioned to reduce contention.
+ * To determine which partition a given locktag belongs to, compute the tag's
+ * hash code with LockTagHashCode(), then apply one of these macros.
+ * NB: NUM_LOCK_PARTITIONS must be a power of 2!
+ */
+#define LockHashPartition(hashcode) \
+	((hashcode) % NUM_LOCK_PARTITIONS)
+#define LockHashPartitionLock(hashcode) \
+	(&MainLWLockArray[LOCK_MANAGER_LWLOCK_OFFSET + \
+		LockHashPartition(hashcode)].lock)
+#define LockHashPartitionLockByIndex(i) \
+	(&MainLWLockArray[LOCK_MANAGER_LWLOCK_OFFSET + (i)].lock)
+
+/*
+ * function prototypes
+ */
+extern void InitLocks(void);
+extern LockMethod GetLocksMethodTable(const LOCK *lock);
+extern uint32 LockTagHashCode(const LOCKTAG *locktag);
+extern bool DoLockModesConflict(LOCKMODE mode1, LOCKMODE mode2);
+extern LockAcquireResult LockAcquire(const LOCKTAG *locktag,
+			LOCKMODE lockmode,
+			bool sessionLock,
+			bool dontWait);
+extern LockAcquireResult LockAcquireExtended(const LOCKTAG *locktag,
+					LOCKMODE lockmode,
+					bool sessionLock,
+					bool dontWait,
+					bool report_memory_error);
+extern void AbortStrongLockAcquire(void);
+extern bool LockRelease(const LOCKTAG *locktag,
+			LOCKMODE lockmode, bool sessionLock);
+extern void LockReleaseAll(LOCKMETHODID lockmethodid, bool allLocks);
+extern void LockReleaseSession(LOCKMETHODID lockmethodid);
+extern void LockReleaseCurrentOwner(LOCALLOCK **locallocks, int nlocks);
+extern void LockReassignCurrentOwner(LOCALLOCK **locallocks, int nlocks);
+extern bool LockHasWaiters(const LOCKTAG *locktag,
+			   LOCKMODE lockmode, bool sessionLock);
+extern VirtualTransactionId *GetLockConflicts(const LOCKTAG *locktag,
+				 LOCKMODE lockmode);
+extern void AtPrepare_Locks(void);
+extern void PostPrepare_Locks(TransactionId xid);
+extern int LockCheckConflicts(LockMethod lockMethodTable,
+				   LOCKMODE lockmode,
+				   LOCK *lock, PROCLOCK *proclock);
+extern void GrantLock(LOCK *lock, PROCLOCK *proclock, LOCKMODE lockmode);
+extern void GrantAwaitedLock(void);
+extern void RemoveFromWaitQueue(PGPROC *proc, uint32 hashcode);
+extern Size LockShmemSize(void);
+extern LockData *GetLockStatusData(void);
+
+typedef struct xl_standby_lock
+{
+	TransactionId xid;			/* xid of holder of AccessExclusiveLock */
+	Oid			dbOid;
+	Oid			relOid;
+} xl_standby_lock;
+
+extern xl_standby_lock *GetRunningTransactionLocks(int *nlocks);
+extern const char *GetLockmodeName(LOCKMETHODID lockmethodid, LOCKMODE mode);
+
+extern void lock_twophase_recover(TransactionId xid, uint16 info,
+					  void *recdata, uint32 len);
+extern void lock_twophase_postcommit(TransactionId xid, uint16 info,
+						 void *recdata, uint32 len);
+extern void lock_twophase_postabort(TransactionId xid, uint16 info,
+						void *recdata, uint32 len);
+extern void lock_twophase_standby_recover(TransactionId xid, uint16 info,
+							  void *recdata, uint32 len);
+
+extern DeadLockState DeadLockCheck(PGPROC *proc);
+extern PGPROC *GetBlockingAutoVacuumPgproc(void);
+extern void DeadLockReport(void) pg_attribute_noreturn();
+extern void RememberSimpleDeadLock(PGPROC *proc1,
+					   LOCKMODE lockmode,
+					   LOCK *lock,
+					   PGPROC *proc2);
+extern void InitDeadLockChecking(void);
+
+#ifdef LOCK_DEBUG
+extern void DumpLocks(PGPROC *proc);
+extern void DumpAllLocks(void);
+#endif
+
+/* Lock a VXID (used to wait for a transaction to finish) */
+extern void VirtualXactLockTableInsert(VirtualTransactionId vxid);
+extern void VirtualXactLockTableCleanup(void);
+extern bool VirtualXactLock(VirtualTransactionId vxid, bool wait);
+
+#endif   /* LOCK_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/lwlock.h b/foreign/libpg_query/src/postgres/include/storage/lwlock.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/lwlock.h
@@ -0,0 +1,229 @@
+/*-------------------------------------------------------------------------
+ *
+ * lwlock.h
+ *	  Lightweight lock manager
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/lwlock.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef LWLOCK_H
+#define LWLOCK_H
+
+#include "lib/ilist.h"
+#include "storage/s_lock.h"
+#include "port/atomics.h"
+
+struct PGPROC;
+
+/*
+ * It's occasionally necessary to identify a particular LWLock "by name"; e.g.
+ * because we wish to report the lock to dtrace.  We could store a name or
+ * other identifying information in the lock itself, but since it's common
+ * to have many nearly-identical locks (e.g. one per buffer) this would end
+ * up wasting significant amounts of memory.  Instead, each lwlock stores a
+ * tranche ID which tells us which array it's part of.  Based on that, we can
+ * figure out where the lwlock lies within the array using the data structure
+ * shown below; the lock is then identified based on the tranche name and
+ * computed array index.  We need the array stride because the array might not
+ * be an array of lwlocks, but rather some larger data structure that includes
+ * one or more lwlocks per element.
+ */
+typedef struct LWLockTranche
+{
+	const char *name;
+	void	   *array_base;
+	Size		array_stride;
+} LWLockTranche;
+
+/*
+ * Code outside of lwlock.c should not manipulate the contents of this
+ * structure directly, but we have to declare it here to allow LWLocks to be
+ * incorporated into other data structures.
+ */
+typedef struct LWLock
+{
+	slock_t		mutex;			/* Protects LWLock and queue of PGPROCs */
+	uint16		tranche;		/* tranche ID */
+
+	pg_atomic_uint32 state;		/* state of exclusive/nonexclusive lockers */
+#ifdef LOCK_DEBUG
+	pg_atomic_uint32 nwaiters;	/* number of waiters */
+#endif
+	dlist_head	waiters;		/* list of waiting PGPROCs */
+#ifdef LOCK_DEBUG
+	struct PGPROC *owner;		/* last exclusive owner of the lock */
+#endif
+} LWLock;
+
+/*
+ * Prior to PostgreSQL 9.4, every lightweight lock in the system was stored
+ * in a single array.  For convenience and for compatibility with past
+ * releases, we still have a main array, but it's now also permissible to
+ * store LWLocks elsewhere in the main shared memory segment or in a dynamic
+ * shared memory segment.  In the main array, we force the array stride to
+ * be a power of 2, which saves a few cycles in indexing, but more importantly
+ * also ensures that individual LWLocks don't cross cache line boundaries.
+ * This reduces cache contention problems, especially on AMD Opterons.
+ * (Of course, we have to also ensure that the array start address is suitably
+ * aligned.)
+ *
+ * On a 32-bit platforms a LWLock will these days fit into 16 bytes, but since
+ * that didn't use to be the case and cramming more lwlocks into a cacheline
+ * might be detrimental performancewise we still use 32 byte alignment
+ * there. So, both on 32 and 64 bit platforms, it should fit into 32 bytes
+ * unless slock_t is really big.  We allow for that just in case.
+ */
+#define LWLOCK_PADDED_SIZE	(sizeof(LWLock) <= 32 ? 32 : 64)
+
+typedef union LWLockPadded
+{
+	LWLock		lock;
+	char		pad[LWLOCK_PADDED_SIZE];
+} LWLockPadded;
+extern PGDLLIMPORT LWLockPadded *MainLWLockArray;
+
+/*
+ * Some commonly-used locks have predefined positions within MainLWLockArray;
+ * defining macros here makes it much easier to keep track of these.  If you
+ * add a lock, add it to the end to avoid renumbering the existing locks;
+ * if you remove a lock, consider leaving a gap in the numbering sequence for
+ * the benefit of DTrace and other external debugging scripts.
+ */
+/* 0 is available; was formerly BufFreelistLock */
+#define ShmemIndexLock				(&MainLWLockArray[1].lock)
+#define OidGenLock					(&MainLWLockArray[2].lock)
+#define XidGenLock					(&MainLWLockArray[3].lock)
+#define ProcArrayLock				(&MainLWLockArray[4].lock)
+#define SInvalReadLock				(&MainLWLockArray[5].lock)
+#define SInvalWriteLock				(&MainLWLockArray[6].lock)
+#define WALBufMappingLock			(&MainLWLockArray[7].lock)
+#define WALWriteLock				(&MainLWLockArray[8].lock)
+#define ControlFileLock				(&MainLWLockArray[9].lock)
+#define CheckpointLock				(&MainLWLockArray[10].lock)
+#define CLogControlLock				(&MainLWLockArray[11].lock)
+#define SubtransControlLock			(&MainLWLockArray[12].lock)
+#define MultiXactGenLock			(&MainLWLockArray[13].lock)
+#define MultiXactOffsetControlLock	(&MainLWLockArray[14].lock)
+#define MultiXactMemberControlLock	(&MainLWLockArray[15].lock)
+#define RelCacheInitLock			(&MainLWLockArray[16].lock)
+#define CheckpointerCommLock		(&MainLWLockArray[17].lock)
+#define TwoPhaseStateLock			(&MainLWLockArray[18].lock)
+#define TablespaceCreateLock		(&MainLWLockArray[19].lock)
+#define BtreeVacuumLock				(&MainLWLockArray[20].lock)
+#define AddinShmemInitLock			(&MainLWLockArray[21].lock)
+#define AutovacuumLock				(&MainLWLockArray[22].lock)
+#define AutovacuumScheduleLock		(&MainLWLockArray[23].lock)
+#define SyncScanLock				(&MainLWLockArray[24].lock)
+#define RelationMappingLock			(&MainLWLockArray[25].lock)
+#define AsyncCtlLock				(&MainLWLockArray[26].lock)
+#define AsyncQueueLock				(&MainLWLockArray[27].lock)
+#define SerializableXactHashLock	(&MainLWLockArray[28].lock)
+#define SerializableFinishedListLock		(&MainLWLockArray[29].lock)
+#define SerializablePredicateLockListLock	(&MainLWLockArray[30].lock)
+#define OldSerXidLock				(&MainLWLockArray[31].lock)
+#define SyncRepLock					(&MainLWLockArray[32].lock)
+#define BackgroundWorkerLock		(&MainLWLockArray[33].lock)
+#define DynamicSharedMemoryControlLock		(&MainLWLockArray[34].lock)
+#define AutoFileLock				(&MainLWLockArray[35].lock)
+#define ReplicationSlotAllocationLock	(&MainLWLockArray[36].lock)
+#define ReplicationSlotControlLock		(&MainLWLockArray[37].lock)
+#define CommitTsControlLock			(&MainLWLockArray[38].lock)
+#define CommitTsLock				(&MainLWLockArray[39].lock)
+#define ReplicationOriginLock		(&MainLWLockArray[40].lock)
+#define MultiXactTruncationLock		(&MainLWLockArray[41].lock)
+#define NUM_INDIVIDUAL_LWLOCKS		42
+
+/*
+ * It's a bit odd to declare NUM_BUFFER_PARTITIONS and NUM_LOCK_PARTITIONS
+ * here, but we need them to figure out offsets within MainLWLockArray, and
+ * having this file include lock.h or bufmgr.h would be backwards.
+ */
+
+/* Number of partitions of the shared buffer mapping hashtable */
+#define NUM_BUFFER_PARTITIONS  128
+
+/* Number of partitions the shared lock tables are divided into */
+#define LOG2_NUM_LOCK_PARTITIONS  4
+#define NUM_LOCK_PARTITIONS  (1 << LOG2_NUM_LOCK_PARTITIONS)
+
+/* Number of partitions the shared predicate lock tables are divided into */
+#define LOG2_NUM_PREDICATELOCK_PARTITIONS  4
+#define NUM_PREDICATELOCK_PARTITIONS  (1 << LOG2_NUM_PREDICATELOCK_PARTITIONS)
+
+/* Offsets for various chunks of preallocated lwlocks. */
+#define BUFFER_MAPPING_LWLOCK_OFFSET	NUM_INDIVIDUAL_LWLOCKS
+#define LOCK_MANAGER_LWLOCK_OFFSET		\
+	(BUFFER_MAPPING_LWLOCK_OFFSET + NUM_BUFFER_PARTITIONS)
+#define PREDICATELOCK_MANAGER_LWLOCK_OFFSET \
+	(LOCK_MANAGER_LWLOCK_OFFSET + NUM_LOCK_PARTITIONS)
+#define NUM_FIXED_LWLOCKS \
+	(PREDICATELOCK_MANAGER_LWLOCK_OFFSET + NUM_PREDICATELOCK_PARTITIONS)
+
+typedef enum LWLockMode
+{
+	LW_EXCLUSIVE,
+	LW_SHARED,
+	LW_WAIT_UNTIL_FREE			/* A special mode used in PGPROC->lwlockMode,
+								 * when waiting for lock to become free. Not
+								 * to be used as LWLockAcquire argument */
+} LWLockMode;
+
+
+#ifdef LOCK_DEBUG
+extern bool Trace_lwlocks;
+#endif
+
+extern bool LWLockAcquire(LWLock *lock, LWLockMode mode);
+extern bool LWLockConditionalAcquire(LWLock *lock, LWLockMode mode);
+extern bool LWLockAcquireOrWait(LWLock *lock, LWLockMode mode);
+extern void LWLockRelease(LWLock *lock);
+extern void LWLockReleaseClearVar(LWLock *lock, uint64 *valptr, uint64 val);
+extern void LWLockReleaseAll(void);
+extern bool LWLockHeldByMe(LWLock *lock);
+
+extern bool LWLockWaitForVar(LWLock *lock, uint64 *valptr, uint64 oldval, uint64 *newval);
+extern void LWLockUpdateVar(LWLock *lock, uint64 *valptr, uint64 value);
+
+extern Size LWLockShmemSize(void);
+extern void CreateLWLocks(void);
+extern void InitLWLockAccess(void);
+
+/*
+ * The traditional method for obtaining an lwlock for use by an extension is
+ * to call RequestAddinLWLocks() during postmaster startup; this will reserve
+ * space for the indicated number of locks in MainLWLockArray.  Subsequently,
+ * a lock can be allocated using LWLockAssign.
+ */
+extern void RequestAddinLWLocks(int n);
+extern LWLock *LWLockAssign(void);
+
+/*
+ * There is another, more flexible method of obtaining lwlocks. First, call
+ * LWLockNewTrancheId just once to obtain a tranche ID; this allocates from
+ * a shared counter.  Next, each individual process using the tranche should
+ * call LWLockRegisterTranche() to associate that tranche ID with appropriate
+ * metadata.  Finally, LWLockInitialize should be called just once per lwlock,
+ * passing the tranche ID as an argument.
+ *
+ * It may seem strange that each process using the tranche must register it
+ * separately, but dynamic shared memory segments aren't guaranteed to be
+ * mapped at the same address in all coordinating backends, so storing the
+ * registration in the main shared memory segment wouldn't work for that case.
+ */
+extern int	LWLockNewTrancheId(void);
+extern void LWLockRegisterTranche(int tranche_id, LWLockTranche *tranche);
+extern void LWLockInitialize(LWLock *lock, int tranche_id);
+
+/*
+ * Prior to PostgreSQL 9.4, we used an enum type called LWLockId to refer
+ * to LWLocks.  New code should instead use LWLock *.  However, for the
+ * convenience of third-party code, we include the following typedef.
+ */
+typedef LWLock *LWLockId;
+
+#endif   /* LWLOCK_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/off.h b/foreign/libpg_query/src/postgres/include/storage/off.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/off.h
@@ -0,0 +1,58 @@
+/*-------------------------------------------------------------------------
+ *
+ * off.h
+ *	  POSTGRES disk "offset" definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/off.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef OFF_H
+#define OFF_H
+
+#include "storage/itemid.h"
+/*
+ * OffsetNumber:
+ *
+ * this is a 1-based index into the linp (ItemIdData) array in the
+ * header of each disk page.
+ */
+typedef uint16 OffsetNumber;
+
+#define InvalidOffsetNumber		((OffsetNumber) 0)
+#define FirstOffsetNumber		((OffsetNumber) 1)
+#define MaxOffsetNumber			((OffsetNumber) (BLCKSZ / sizeof(ItemIdData)))
+#define OffsetNumberMask		(0xffff)		/* valid uint16 bits */
+
+/* ----------------
+ *		support macros
+ * ----------------
+ */
+
+/*
+ * OffsetNumberIsValid
+ *		True iff the offset number is valid.
+ */
+#define OffsetNumberIsValid(offsetNumber) \
+	((bool) ((offsetNumber != InvalidOffsetNumber) && \
+			 (offsetNumber <= MaxOffsetNumber)))
+
+/*
+ * OffsetNumberNext
+ * OffsetNumberPrev
+ *		Increments/decrements the argument.  These macros look pointless
+ *		but they help us disambiguate the different manipulations on
+ *		OffsetNumbers (e.g., sometimes we subtract one from an
+ *		OffsetNumber to move back, and sometimes we do so to form a
+ *		real C array index).
+ */
+#define OffsetNumberNext(offsetNumber) \
+	((OffsetNumber) (1 + (offsetNumber)))
+#define OffsetNumberPrev(offsetNumber) \
+	((OffsetNumber) (-1 + (offsetNumber)))
+
+#endif   /* OFF_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/pg_sema.h b/foreign/libpg_query/src/postgres/include/storage/pg_sema.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/pg_sema.h
@@ -0,0 +1,83 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_sema.h
+ *	  Platform-independent API for semaphores.
+ *
+ * PostgreSQL requires counting semaphores (the kind that keep track of
+ * multiple unlock operations, and will allow an equal number of subsequent
+ * lock operations before blocking).  The underlying implementation is
+ * not the same on every platform.  This file defines the API that must
+ * be provided by each port.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/pg_sema.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_SEMA_H
+#define PG_SEMA_H
+
+/*
+ * PGSemaphoreData and pointer type PGSemaphore are the data structure
+ * representing an individual semaphore.  The contents of PGSemaphoreData
+ * vary across implementations and must never be touched by platform-
+ * independent code.  PGSemaphoreData structures are always allocated
+ * in shared memory (to support implementations where the data changes during
+ * lock/unlock).
+ *
+ * pg_config.h must define exactly one of the USE_xxx_SEMAPHORES symbols.
+ */
+
+#ifdef USE_NAMED_POSIX_SEMAPHORES
+
+#include <semaphore.h>
+
+typedef sem_t *PGSemaphoreData;
+#endif
+
+#ifdef USE_UNNAMED_POSIX_SEMAPHORES
+
+#include <semaphore.h>
+
+typedef sem_t PGSemaphoreData;
+#endif
+
+#ifdef USE_SYSV_SEMAPHORES
+
+typedef struct PGSemaphoreData
+{
+	int			semId;			/* semaphore set identifier */
+	int			semNum;			/* semaphore number within set */
+} PGSemaphoreData;
+#endif
+
+#ifdef USE_WIN32_SEMAPHORES
+
+typedef HANDLE PGSemaphoreData;
+#endif
+
+typedef PGSemaphoreData *PGSemaphore;
+
+
+/* Module initialization (called during postmaster start or shmem reinit) */
+extern void PGReserveSemaphores(int maxSemas, int port);
+
+/* Initialize a PGSemaphore structure to represent a sema with count 1 */
+extern void PGSemaphoreCreate(PGSemaphore sema);
+
+/* Reset a previously-initialized PGSemaphore to have count 0 */
+extern void PGSemaphoreReset(PGSemaphore sema);
+
+/* Lock a semaphore (decrement count), blocking if count would be < 0 */
+extern void PGSemaphoreLock(PGSemaphore sema);
+
+/* Unlock a semaphore (increment count) */
+extern void PGSemaphoreUnlock(PGSemaphore sema);
+
+/* Lock a semaphore only if able to do so without blocking */
+extern bool PGSemaphoreTryLock(PGSemaphore sema);
+
+#endif   /* PG_SEMA_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/pg_shmem.h b/foreign/libpg_query/src/postgres/include/storage/pg_shmem.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/pg_shmem.h
@@ -0,0 +1,72 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_shmem.h
+ *	  Platform-independent API for shared memory support.
+ *
+ * Every port is expected to support shared memory with approximately
+ * SysV-ish semantics; in particular, a memory block is not anonymous
+ * but has an ID, and we must be able to tell whether there are any
+ * remaining processes attached to a block of a specified ID.
+ *
+ * To simplify life for the SysV implementation, the ID is assumed to
+ * consist of two unsigned long values (these are key and ID in SysV
+ * terms).  Other platforms may ignore the second value if they need
+ * only one ID number.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/pg_shmem.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_SHMEM_H
+#define PG_SHMEM_H
+
+#include "storage/dsm_impl.h"
+
+typedef struct PGShmemHeader	/* standard header for all Postgres shmem */
+{
+	int32		magic;			/* magic # to identify Postgres segments */
+#define PGShmemMagic  679834894
+	pid_t		creatorPID;		/* PID of creating process */
+	Size		totalsize;		/* total size of segment */
+	Size		freeoffset;		/* offset to first free space */
+	dsm_handle	dsm_control;	/* ID of dynamic shared memory control seg */
+	void	   *index;			/* pointer to ShmemIndex table */
+#ifndef WIN32					/* Windows doesn't have useful inode#s */
+	dev_t		device;			/* device data directory is on */
+	ino_t		inode;			/* inode number of data directory */
+#endif
+} PGShmemHeader;
+
+/* GUC variable */
+extern int	huge_pages;
+
+/* Possible values for huge_pages */
+typedef enum
+{
+	HUGE_PAGES_OFF,
+	HUGE_PAGES_ON,
+	HUGE_PAGES_TRY
+}	HugePagesType;
+
+#ifndef WIN32
+extern unsigned long UsedShmemSegID;
+#else
+extern HANDLE UsedShmemSegID;
+#endif
+extern void *UsedShmemSegAddr;
+
+#ifdef EXEC_BACKEND
+extern void PGSharedMemoryReAttach(void);
+extern void PGSharedMemoryNoReAttach(void);
+#endif
+
+extern PGShmemHeader *PGSharedMemoryCreate(Size size, bool makePrivate,
+					 int port, PGShmemHeader **shim);
+extern bool PGSharedMemoryIsInUse(unsigned long id1, unsigned long id2);
+extern void PGSharedMemoryDetach(void);
+
+#endif   /* PG_SHMEM_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/pmsignal.h b/foreign/libpg_query/src/postgres/include/storage/pmsignal.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/pmsignal.h
@@ -0,0 +1,56 @@
+/*-------------------------------------------------------------------------
+ *
+ * pmsignal.h
+ *	  routines for signaling the postmaster from its child processes
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/pmsignal.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PMSIGNAL_H
+#define PMSIGNAL_H
+
+/*
+ * Reasons for signaling the postmaster.  We can cope with simultaneous
+ * signals for different reasons.  If the same reason is signaled multiple
+ * times in quick succession, however, the postmaster is likely to observe
+ * only one notification of it.  This is okay for the present uses.
+ */
+typedef enum
+{
+	PMSIGNAL_RECOVERY_STARTED,	/* recovery has started */
+	PMSIGNAL_BEGIN_HOT_STANDBY, /* begin Hot Standby */
+	PMSIGNAL_WAKEN_ARCHIVER,	/* send a NOTIFY signal to xlog archiver */
+	PMSIGNAL_ROTATE_LOGFILE,	/* send SIGUSR1 to syslogger to rotate logfile */
+	PMSIGNAL_START_AUTOVAC_LAUNCHER,	/* start an autovacuum launcher */
+	PMSIGNAL_START_AUTOVAC_WORKER,		/* start an autovacuum worker */
+	PMSIGNAL_BACKGROUND_WORKER_CHANGE,	/* background worker state change */
+	PMSIGNAL_START_WALRECEIVER, /* start a walreceiver */
+	PMSIGNAL_ADVANCE_STATE_MACHINE,		/* advance postmaster's state machine */
+
+	NUM_PMSIGNALS				/* Must be last value of enum! */
+} PMSignalReason;
+
+/* PMSignalData is an opaque struct, details known only within pmsignal.c */
+typedef struct PMSignalData PMSignalData;
+
+/*
+ * prototypes for functions in pmsignal.c
+ */
+extern Size PMSignalShmemSize(void);
+extern void PMSignalShmemInit(void);
+extern void SendPostmasterSignal(PMSignalReason reason);
+extern bool CheckPostmasterSignal(PMSignalReason reason);
+extern int	AssignPostmasterChildSlot(void);
+extern bool ReleasePostmasterChildSlot(int slot);
+extern bool IsPostmasterChildWalSender(int slot);
+extern void MarkPostmasterChildActive(void);
+extern void MarkPostmasterChildInactive(void);
+extern void MarkPostmasterChildWalSender(void);
+extern bool PostmasterIsAlive(void);
+
+#endif   /* PMSIGNAL_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/predicate.h b/foreign/libpg_query/src/postgres/include/storage/predicate.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/predicate.h
@@ -0,0 +1,73 @@
+/*-------------------------------------------------------------------------
+ *
+ * predicate.h
+ *	  POSTGRES public predicate locking definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/predicate.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PREDICATE_H
+#define PREDICATE_H
+
+#include "utils/relcache.h"
+#include "utils/snapshot.h"
+
+
+/*
+ * GUC variables
+ */
+extern int	max_predicate_locks_per_xact;
+
+
+/* Number of SLRU buffers to use for predicate locking */
+#define NUM_OLDSERXID_BUFFERS	16
+
+
+/*
+ * function prototypes
+ */
+
+/* housekeeping for shared memory predicate lock structures */
+extern void InitPredicateLocks(void);
+extern Size PredicateLockShmemSize(void);
+
+extern void CheckPointPredicate(void);
+
+/* predicate lock reporting */
+extern bool PageIsPredicateLocked(Relation relation, BlockNumber blkno);
+
+/* predicate lock maintenance */
+extern Snapshot GetSerializableTransactionSnapshot(Snapshot snapshot);
+extern void SetSerializableTransactionSnapshot(Snapshot snapshot,
+								   TransactionId sourcexid);
+extern void RegisterPredicateLockingXid(TransactionId xid);
+extern void PredicateLockRelation(Relation relation, Snapshot snapshot);
+extern void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot);
+extern void PredicateLockTuple(Relation relation, HeapTuple tuple, Snapshot snapshot);
+extern void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
+extern void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
+extern void TransferPredicateLocksToHeapRelation(Relation relation);
+extern void ReleasePredicateLocks(bool isCommit);
+
+/* conflict detection (may also trigger rollback) */
+extern void CheckForSerializableConflictOut(bool valid, Relation relation, HeapTuple tuple,
+								Buffer buffer, Snapshot snapshot);
+extern void CheckForSerializableConflictIn(Relation relation, HeapTuple tuple, Buffer buffer);
+extern void CheckTableForSerializableConflictIn(Relation relation);
+
+/* final rollback checking */
+extern void PreCommit_CheckForSerializationFailure(void);
+
+/* two-phase commit support */
+extern void AtPrepare_PredicateLocks(void);
+extern void PostPrepare_PredicateLocks(TransactionId xid);
+extern void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit);
+extern void predicatelock_twophase_recover(TransactionId xid, uint16 info,
+							   void *recdata, uint32 len);
+
+#endif   /* PREDICATE_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/proc.h b/foreign/libpg_query/src/postgres/include/storage/proc.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/proc.h
@@ -0,0 +1,261 @@
+/*-------------------------------------------------------------------------
+ *
+ * proc.h
+ *	  per-process shared memory data structures
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/proc.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef _PROC_H_
+#define _PROC_H_
+
+#include "access/xlogdefs.h"
+#include "lib/ilist.h"
+#include "storage/latch.h"
+#include "storage/lock.h"
+#include "storage/pg_sema.h"
+
+/*
+ * Each backend advertises up to PGPROC_MAX_CACHED_SUBXIDS TransactionIds
+ * for non-aborted subtransactions of its current top transaction.  These
+ * have to be treated as running XIDs by other backends.
+ *
+ * We also keep track of whether the cache overflowed (ie, the transaction has
+ * generated at least one subtransaction that didn't fit in the cache).
+ * If none of the caches have overflowed, we can assume that an XID that's not
+ * listed anywhere in the PGPROC array is not a running transaction.  Else we
+ * have to look at pg_subtrans.
+ */
+#define PGPROC_MAX_CACHED_SUBXIDS 64	/* XXX guessed-at value */
+
+struct XidCache
+{
+	TransactionId xids[PGPROC_MAX_CACHED_SUBXIDS];
+};
+
+/* Flags for PGXACT->vacuumFlags */
+#define		PROC_IS_AUTOVACUUM	0x01	/* is it an autovac worker? */
+#define		PROC_IN_VACUUM		0x02	/* currently running lazy vacuum */
+#define		PROC_IN_ANALYZE		0x04	/* currently running analyze */
+#define		PROC_VACUUM_FOR_WRAPAROUND	0x08	/* set by autovac only */
+#define		PROC_IN_LOGICAL_DECODING	0x10	/* currently doing logical
+												 * decoding outside xact */
+
+/* flags reset at EOXact */
+#define		PROC_VACUUM_STATE_MASK \
+	(PROC_IN_VACUUM | PROC_IN_ANALYZE | PROC_VACUUM_FOR_WRAPAROUND)
+
+/*
+ * We allow a small number of "weak" relation locks (AccesShareLock,
+ * RowShareLock, RowExclusiveLock) to be recorded in the PGPROC structure
+ * rather than the main lock table.  This eases contention on the lock
+ * manager LWLocks.  See storage/lmgr/README for additional details.
+ */
+#define		FP_LOCK_SLOTS_PER_BACKEND 16
+
+/*
+ * Each backend has a PGPROC struct in shared memory.  There is also a list of
+ * currently-unused PGPROC structs that will be reallocated to new backends.
+ *
+ * links: list link for any list the PGPROC is in.  When waiting for a lock,
+ * the PGPROC is linked into that lock's waitProcs queue.  A recycled PGPROC
+ * is linked into ProcGlobal's freeProcs list.
+ *
+ * Note: twophase.c also sets up a dummy PGPROC struct for each currently
+ * prepared transaction.  These PGPROCs appear in the ProcArray data structure
+ * so that the prepared transactions appear to be still running and are
+ * correctly shown as holding locks.  A prepared transaction PGPROC can be
+ * distinguished from a real one at need by the fact that it has pid == 0.
+ * The semaphore and lock-activity fields in a prepared-xact PGPROC are unused,
+ * but its myProcLocks[] lists are valid.
+ */
+struct PGPROC
+{
+	/* proc->links MUST BE FIRST IN STRUCT (see ProcSleep,ProcWakeup,etc) */
+	SHM_QUEUE	links;			/* list link if process is in a list */
+
+	PGSemaphoreData sem;		/* ONE semaphore to sleep on */
+	int			waitStatus;		/* STATUS_WAITING, STATUS_OK or STATUS_ERROR */
+
+	Latch		procLatch;		/* generic latch for process */
+
+	LocalTransactionId lxid;	/* local id of top-level transaction currently
+								 * being executed by this proc, if running;
+								 * else InvalidLocalTransactionId */
+	int			pid;			/* Backend's process ID; 0 if prepared xact */
+	int			pgprocno;
+
+	/* These fields are zero while a backend is still starting up: */
+	BackendId	backendId;		/* This backend's backend ID (if assigned) */
+	Oid			databaseId;		/* OID of database this backend is using */
+	Oid			roleId;			/* OID of role using this backend */
+
+	/*
+	 * While in hot standby mode, shows that a conflict signal has been sent
+	 * for the current transaction. Set/cleared while holding ProcArrayLock,
+	 * though not required. Accessed without lock, if needed.
+	 */
+	bool		recoveryConflictPending;
+
+	/* Info about LWLock the process is currently waiting for, if any. */
+	bool		lwWaiting;		/* true if waiting for an LW lock */
+	uint8		lwWaitMode;		/* lwlock mode being waited for */
+	dlist_node	lwWaitLink;		/* position in LW lock wait list */
+
+	/* Info about lock the process is currently waiting for, if any. */
+	/* waitLock and waitProcLock are NULL if not currently waiting. */
+	LOCK	   *waitLock;		/* Lock object we're sleeping on ... */
+	PROCLOCK   *waitProcLock;	/* Per-holder info for awaited lock */
+	LOCKMODE	waitLockMode;	/* type of lock we're waiting for */
+	LOCKMASK	heldLocks;		/* bitmask for lock types already held on this
+								 * lock object by this backend */
+
+	/*
+	 * Info to allow us to wait for synchronous replication, if needed.
+	 * waitLSN is InvalidXLogRecPtr if not waiting; set only by user backend.
+	 * syncRepState must not be touched except by owning process or WALSender.
+	 * syncRepLinks used only while holding SyncRepLock.
+	 */
+	XLogRecPtr	waitLSN;		/* waiting for this LSN or higher */
+	int			syncRepState;	/* wait state for sync rep */
+	SHM_QUEUE	syncRepLinks;	/* list link if process is in syncrep queue */
+
+	/*
+	 * All PROCLOCK objects for locks held or awaited by this backend are
+	 * linked into one of these lists, according to the partition number of
+	 * their lock.
+	 */
+	SHM_QUEUE	myProcLocks[NUM_LOCK_PARTITIONS];
+
+	struct XidCache subxids;	/* cache for subtransaction XIDs */
+
+	/* Per-backend LWLock.  Protects fields below. */
+	LWLock	   *backendLock;	/* protects the fields below */
+
+	/* Lock manager data, recording fast-path locks taken by this backend. */
+	uint64		fpLockBits;		/* lock modes held for each fast-path slot */
+	Oid			fpRelId[FP_LOCK_SLOTS_PER_BACKEND];		/* slots for rel oids */
+	bool		fpVXIDLock;		/* are we holding a fast-path VXID lock? */
+	LocalTransactionId fpLocalTransactionId;	/* lxid for fast-path VXID
+												 * lock */
+};
+
+/* NOTE: "typedef struct PGPROC PGPROC" appears in storage/lock.h. */
+
+
+extern PGDLLIMPORT PGPROC *MyProc;
+extern PGDLLIMPORT struct PGXACT *MyPgXact;
+
+/*
+ * Prior to PostgreSQL 9.2, the fields below were stored as part of the
+ * PGPROC.  However, benchmarking revealed that packing these particular
+ * members into a separate array as tightly as possible sped up GetSnapshotData
+ * considerably on systems with many CPU cores, by reducing the number of
+ * cache lines needing to be fetched.  Thus, think very carefully before adding
+ * anything else here.
+ */
+typedef struct PGXACT
+{
+	TransactionId xid;			/* id of top-level transaction currently being
+								 * executed by this proc, if running and XID
+								 * is assigned; else InvalidTransactionId */
+
+	TransactionId xmin;			/* minimal running XID as it was when we were
+								 * starting our xact, excluding LAZY VACUUM:
+								 * vacuum must not remove tuples deleted by
+								 * xid >= xmin ! */
+
+	uint8		vacuumFlags;	/* vacuum-related flags, see above */
+	bool		overflowed;
+	bool		delayChkpt;		/* true if this proc delays checkpoint start;
+								 * previously called InCommit */
+
+	uint8		nxids;
+} PGXACT;
+
+/*
+ * There is one ProcGlobal struct for the whole database cluster.
+ */
+typedef struct PROC_HDR
+{
+	/* Array of PGPROC structures (not including dummies for prepared txns) */
+	PGPROC	   *allProcs;
+	/* Array of PGXACT structures (not including dummies for prepared txns) */
+	PGXACT	   *allPgXact;
+	/* Length of allProcs array */
+	uint32		allProcCount;
+	/* Head of list of free PGPROC structures */
+	PGPROC	   *freeProcs;
+	/* Head of list of autovacuum's free PGPROC structures */
+	PGPROC	   *autovacFreeProcs;
+	/* Head of list of bgworker free PGPROC structures */
+	PGPROC	   *bgworkerFreeProcs;
+	/* WALWriter process's latch */
+	Latch	   *walwriterLatch;
+	/* Checkpointer process's latch */
+	Latch	   *checkpointerLatch;
+	/* Current shared estimate of appropriate spins_per_delay value */
+	int			spins_per_delay;
+	/* The proc of the Startup process, since not in ProcArray */
+	PGPROC	   *startupProc;
+	int			startupProcPid;
+	/* Buffer id of the buffer that Startup process waits for pin on, or -1 */
+	int			startupBufferPinWaitBufId;
+} PROC_HDR;
+
+extern PROC_HDR *ProcGlobal;
+
+extern PGPROC *PreparedXactProcs;
+
+/*
+ * We set aside some extra PGPROC structures for auxiliary processes,
+ * ie things that aren't full-fledged backends but need shmem access.
+ *
+ * Background writer, checkpointer and WAL writer run during normal operation.
+ * Startup process and WAL receiver also consume 2 slots, but WAL writer is
+ * launched only after startup has exited, so we only need 4 slots.
+ */
+#define NUM_AUXILIARY_PROCS		4
+
+
+/* configurable options */
+extern int	DeadlockTimeout;
+extern int	StatementTimeout;
+extern int	LockTimeout;
+extern bool log_lock_waits;
+
+
+/*
+ * Function Prototypes
+ */
+extern int	ProcGlobalSemas(void);
+extern Size ProcGlobalShmemSize(void);
+extern void InitProcGlobal(void);
+extern void InitProcess(void);
+extern void InitProcessPhase2(void);
+extern void InitAuxiliaryProcess(void);
+
+extern void PublishStartupProcessInformation(void);
+extern void SetStartupBufferPinWaitBufId(int bufid);
+extern int	GetStartupBufferPinWaitBufId(void);
+
+extern bool HaveNFreeProcs(int n);
+extern void ProcReleaseLocks(bool isCommit);
+
+extern void ProcQueueInit(PROC_QUEUE *queue);
+extern int	ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable);
+extern PGPROC *ProcWakeup(PGPROC *proc, int waitStatus);
+extern void ProcLockWakeup(LockMethod lockMethodTable, LOCK *lock);
+extern void CheckDeadLockAlert(void);
+extern bool IsWaitingForLock(void);
+extern void LockErrorCleanup(void);
+
+extern void ProcWaitForSignal(void);
+extern void ProcSendSignal(int pid);
+
+#endif   /* PROC_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/procsignal.h b/foreign/libpg_query/src/postgres/include/storage/procsignal.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/procsignal.h
@@ -0,0 +1,60 @@
+/*-------------------------------------------------------------------------
+ *
+ * procsignal.h
+ *	  Routines for interprocess signalling
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/procsignal.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PROCSIGNAL_H
+#define PROCSIGNAL_H
+
+#include "storage/backendid.h"
+
+
+/*
+ * Reasons for signalling a Postgres child process (a backend or an auxiliary
+ * process, like checkpointer).  We can cope with concurrent signals for different
+ * reasons.  However, if the same reason is signaled multiple times in quick
+ * succession, the process is likely to observe only one notification of it.
+ * This is okay for the present uses.
+ *
+ * Also, because of race conditions, it's important that all the signals be
+ * defined so that no harm is done if a process mistakenly receives one.
+ */
+typedef enum
+{
+	PROCSIG_CATCHUP_INTERRUPT,	/* sinval catchup interrupt */
+	PROCSIG_NOTIFY_INTERRUPT,	/* listen/notify interrupt */
+	PROCSIG_PARALLEL_MESSAGE,	/* message from cooperating parallel backend */
+
+	/* Recovery conflict reasons */
+	PROCSIG_RECOVERY_CONFLICT_DATABASE,
+	PROCSIG_RECOVERY_CONFLICT_TABLESPACE,
+	PROCSIG_RECOVERY_CONFLICT_LOCK,
+	PROCSIG_RECOVERY_CONFLICT_SNAPSHOT,
+	PROCSIG_RECOVERY_CONFLICT_BUFFERPIN,
+	PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK,
+
+	NUM_PROCSIGNALS				/* Must be last! */
+} ProcSignalReason;
+
+/*
+ * prototypes for functions in procsignal.c
+ */
+extern Size ProcSignalShmemSize(void);
+extern void ProcSignalShmemInit(void);
+
+extern void ProcSignalInit(int pss_idx);
+extern int SendProcSignal(pid_t pid, ProcSignalReason reason,
+			   BackendId backendId);
+
+extern void procsignal_sigusr1_handler(SIGNAL_ARGS);
+extern PGDLLIMPORT bool set_latch_on_sigusr1;
+
+#endif   /* PROCSIGNAL_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/relfilenode.h b/foreign/libpg_query/src/postgres/include/storage/relfilenode.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/relfilenode.h
@@ -0,0 +1,99 @@
+/*-------------------------------------------------------------------------
+ *
+ * relfilenode.h
+ *	  Physical access information for relations.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/relfilenode.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef RELFILENODE_H
+#define RELFILENODE_H
+
+#include "common/relpath.h"
+#include "storage/backendid.h"
+
+/*
+ * RelFileNode must provide all that we need to know to physically access
+ * a relation, with the exception of the backend ID, which can be provided
+ * separately. Note, however, that a "physical" relation is comprised of
+ * multiple files on the filesystem, as each fork is stored as a separate
+ * file, and each fork can be divided into multiple segments. See md.c.
+ *
+ * spcNode identifies the tablespace of the relation.  It corresponds to
+ * pg_tablespace.oid.
+ *
+ * dbNode identifies the database of the relation.  It is zero for
+ * "shared" relations (those common to all databases of a cluster).
+ * Nonzero dbNode values correspond to pg_database.oid.
+ *
+ * relNode identifies the specific relation.  relNode corresponds to
+ * pg_class.relfilenode (NOT pg_class.oid, because we need to be able
+ * to assign new physical files to relations in some situations).
+ * Notice that relNode is only unique within a database in a particular
+ * tablespace.
+ *
+ * Note: spcNode must be GLOBALTABLESPACE_OID if and only if dbNode is
+ * zero.  We support shared relations only in the "global" tablespace.
+ *
+ * Note: in pg_class we allow reltablespace == 0 to denote that the
+ * relation is stored in its database's "default" tablespace (as
+ * identified by pg_database.dattablespace).  However this shorthand
+ * is NOT allowed in RelFileNode structs --- the real tablespace ID
+ * must be supplied when setting spcNode.
+ *
+ * Note: in pg_class, relfilenode can be zero to denote that the relation
+ * is a "mapped" relation, whose current true filenode number is available
+ * from relmapper.c.  Again, this case is NOT allowed in RelFileNodes.
+ *
+ * Note: various places use RelFileNode in hashtable keys.  Therefore,
+ * there *must not* be any unused padding bytes in this struct.  That
+ * should be safe as long as all the fields are of type Oid.
+ */
+typedef struct RelFileNode
+{
+	Oid			spcNode;		/* tablespace */
+	Oid			dbNode;			/* database */
+	Oid			relNode;		/* relation */
+} RelFileNode;
+
+/*
+ * Augmenting a relfilenode with the backend ID provides all the information
+ * we need to locate the physical storage.  The backend ID is InvalidBackendId
+ * for regular relations (those accessible to more than one backend), or the
+ * owning backend's ID for backend-local relations.  Backend-local relations
+ * are always transient and removed in case of a database crash; they are
+ * never WAL-logged or fsync'd.
+ */
+typedef struct RelFileNodeBackend
+{
+	RelFileNode node;
+	BackendId	backend;
+} RelFileNodeBackend;
+
+#define RelFileNodeBackendIsTemp(rnode) \
+	((rnode).backend != InvalidBackendId)
+
+/*
+ * Note: RelFileNodeEquals and RelFileNodeBackendEquals compare relNode first
+ * since that is most likely to be different in two unequal RelFileNodes.  It
+ * is probably redundant to compare spcNode if the other fields are found equal,
+ * but do it anyway to be sure.  Likewise for checking the backend ID in
+ * RelFileNodeBackendEquals.
+ */
+#define RelFileNodeEquals(node1, node2) \
+	((node1).relNode == (node2).relNode && \
+	 (node1).dbNode == (node2).dbNode && \
+	 (node1).spcNode == (node2).spcNode)
+
+#define RelFileNodeBackendEquals(node1, node2) \
+	((node1).node.relNode == (node2).node.relNode && \
+	 (node1).node.dbNode == (node2).node.dbNode && \
+	 (node1).backend == (node2).backend && \
+	 (node1).node.spcNode == (node2).node.spcNode)
+
+#endif   /* RELFILENODE_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/s_lock.h b/foreign/libpg_query/src/postgres/include/storage/s_lock.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/s_lock.h
@@ -0,0 +1,985 @@
+/*-------------------------------------------------------------------------
+ *
+ * s_lock.h
+ *	   Hardware-dependent implementation of spinlocks.
+ *
+ *	NOTE: none of the macros in this file are intended to be called directly.
+ *	Call them through the hardware-independent macros in spin.h.
+ *
+ *	The following hardware-dependent macros must be provided for each
+ *	supported platform:
+ *
+ *	void S_INIT_LOCK(slock_t *lock)
+ *		Initialize a spinlock (to the unlocked state).
+ *
+ *	int S_LOCK(slock_t *lock)
+ *		Acquire a spinlock, waiting if necessary.
+ *		Time out and abort() if unable to acquire the lock in a
+ *		"reasonable" amount of time --- typically ~ 1 minute.
+ *		Should return number of "delays"; see s_lock.c
+ *
+ *	void S_UNLOCK(slock_t *lock)
+ *		Unlock a previously acquired lock.
+ *
+ *	bool S_LOCK_FREE(slock_t *lock)
+ *		Tests if the lock is free. Returns TRUE if free, FALSE if locked.
+ *		This does *not* change the state of the lock.
+ *
+ *	void SPIN_DELAY(void)
+ *		Delay operation to occur inside spinlock wait loop.
+ *
+ *	Note to implementors: there are default implementations for all these
+ *	macros at the bottom of the file.  Check if your platform can use
+ *	these or needs to override them.
+ *
+ *  Usually, S_LOCK() is implemented in terms of even lower-level macros
+ *	TAS() and TAS_SPIN():
+ *
+ *	int TAS(slock_t *lock)
+ *		Atomic test-and-set instruction.  Attempt to acquire the lock,
+ *		but do *not* wait.	Returns 0 if successful, nonzero if unable
+ *		to acquire the lock.
+ *
+ *	int TAS_SPIN(slock_t *lock)
+ *		Like TAS(), but this version is used when waiting for a lock
+ *		previously found to be contended.  By default, this is the
+ *		same as TAS(), but on some architectures it's better to poll a
+ *		contended lock using an unlocked instruction and retry the
+ *		atomic test-and-set only when it appears free.
+ *
+ *	TAS() and TAS_SPIN() are NOT part of the API, and should never be called
+ *	directly.
+ *
+ *	CAUTION: on some platforms TAS() and/or TAS_SPIN() may sometimes report
+ *	failure to acquire a lock even when the lock is not locked.  For example,
+ *	on Alpha TAS() will "fail" if interrupted.  Therefore a retry loop must
+ *	always be used, even if you are certain the lock is free.
+ *
+ *	It is the responsibility of these macros to make sure that the compiler
+ *	does not re-order accesses to shared memory to precede the actual lock
+ *	acquisition, or follow the lock release.  Prior to PostgreSQL 9.5, this
+ *	was the caller's responsibility, which meant that callers had to use
+ *	volatile-qualified pointers to refer to both the spinlock itself and the
+ *	shared data being accessed within the spinlocked critical section.  This
+ *	was notationally awkward, easy to forget (and thus error-prone), and
+ *	prevented some useful compiler optimizations.  For these reasons, we
+ *	now require that the macros themselves prevent compiler re-ordering,
+ *	so that the caller doesn't need to take special precautions.
+ *
+ *	On platforms with weak memory ordering, the TAS(), TAS_SPIN(), and
+ *	S_UNLOCK() macros must further include hardware-level memory fence
+ *	instructions to prevent similar re-ordering at the hardware level.
+ *	TAS() and TAS_SPIN() must guarantee that loads and stores issued after
+ *	the macro are not executed until the lock has been obtained.  Conversely,
+ *	S_UNLOCK() must guarantee that loads and stores issued before the macro
+ *	have been executed before the lock is released.
+ *
+ *	On most supported platforms, TAS() uses a tas() function written
+ *	in assembly language to execute a hardware atomic-test-and-set
+ *	instruction.  Equivalent OS-supplied mutex routines could be used too.
+ *
+ *	If no system-specific TAS() is available (ie, HAVE_SPINLOCKS is not
+ *	defined), then we fall back on an emulation that uses SysV semaphores
+ *	(see spin.c).  This emulation will be MUCH MUCH slower than a proper TAS()
+ *	implementation, because of the cost of a kernel call per lock or unlock.
+ *	An old report is that Postgres spends around 40% of its time in semop(2)
+ *	when using the SysV semaphore code.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *	  src/include/storage/s_lock.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef S_LOCK_H
+#define S_LOCK_H
+
+#ifdef HAVE_SPINLOCKS	/* skip spinlocks if requested */
+
+#if defined(__GNUC__) || defined(__INTEL_COMPILER)
+/*************************************************************************
+ * All the gcc inlines
+ * Gcc consistently defines the CPU as __cpu__.
+ * Other compilers use __cpu or __cpu__ so we test for both in those cases.
+ */
+
+/*----------
+ * Standard gcc asm format (assuming "volatile slock_t *lock"):
+
+	__asm__ __volatile__(
+		"	instruction	\n"
+		"	instruction	\n"
+		"	instruction	\n"
+:		"=r"(_res), "+m"(*lock)		// return register, in/out lock value
+:		"r"(lock)					// lock pointer, in input register
+:		"memory", "cc");			// show clobbered registers here
+
+ * The output-operands list (after first colon) should always include
+ * "+m"(*lock), whether or not the asm code actually refers to this
+ * operand directly.  This ensures that gcc believes the value in the
+ * lock variable is used and set by the asm code.  Also, the clobbers
+ * list (after third colon) should always include "memory"; this prevents
+ * gcc from thinking it can cache the values of shared-memory fields
+ * across the asm code.  Add "cc" if your asm code changes the condition
+ * code register, and also list any temp registers the code uses.
+ *----------
+ */
+
+
+#ifdef __i386__		/* 32-bit i386 */
+#define HAS_TEST_AND_SET
+
+typedef unsigned char slock_t;
+
+#define TAS(lock) tas(lock)
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+	register slock_t _res = 1;
+
+	/*
+	 * Use a non-locking test before asserting the bus lock.  Note that the
+	 * extra test appears to be a small loss on some x86 platforms and a small
+	 * win on others; it's by no means clear that we should keep it.
+	 *
+	 * When this was last tested, we didn't have separate TAS() and TAS_SPIN()
+	 * macros.  Nowadays it probably would be better to do a non-locking test
+	 * in TAS_SPIN() but not in TAS(), like on x86_64, but no-one's done the
+	 * testing to verify that.  Without some empirical evidence, better to
+	 * leave it alone.
+	 */
+	__asm__ __volatile__(
+		"	cmpb	$0,%1	\n"
+		"	jne		1f		\n"
+		"	lock			\n"
+		"	xchgb	%0,%1	\n"
+		"1: \n"
+:		"+q"(_res), "+m"(*lock)
+:		/* no inputs */
+:		"memory", "cc");
+	return (int) _res;
+}
+
+#define SPIN_DELAY() spin_delay()
+
+static __inline__ void
+spin_delay(void)
+{
+	/*
+	 * This sequence is equivalent to the PAUSE instruction ("rep" is
+	 * ignored by old IA32 processors if the following instruction is
+	 * not a string operation); the IA-32 Architecture Software
+	 * Developer's Manual, Vol. 3, Section 7.7.2 describes why using
+	 * PAUSE in the inner loop of a spin lock is necessary for good
+	 * performance:
+	 *
+	 *     The PAUSE instruction improves the performance of IA-32
+	 *     processors supporting Hyper-Threading Technology when
+	 *     executing spin-wait loops and other routines where one
+	 *     thread is accessing a shared lock or semaphore in a tight
+	 *     polling loop. When executing a spin-wait loop, the
+	 *     processor can suffer a severe performance penalty when
+	 *     exiting the loop because it detects a possible memory order
+	 *     violation and flushes the core processor's pipeline. The
+	 *     PAUSE instruction provides a hint to the processor that the
+	 *     code sequence is a spin-wait loop. The processor uses this
+	 *     hint to avoid the memory order violation and prevent the
+	 *     pipeline flush. In addition, the PAUSE instruction
+	 *     de-pipelines the spin-wait loop to prevent it from
+	 *     consuming execution resources excessively.
+	 */
+	__asm__ __volatile__(
+		" rep; nop			\n");
+}
+
+#endif	 /* __i386__ */
+
+
+#ifdef __x86_64__		/* AMD Opteron, Intel EM64T */
+#define HAS_TEST_AND_SET
+
+typedef unsigned char slock_t;
+
+#define TAS(lock) tas(lock)
+
+/*
+ * On Intel EM64T, it's a win to use a non-locking test before the xchg proper,
+ * but only when spinning.
+ *
+ * See also Implementing Scalable Atomic Locks for Multi-Core Intel(tm) EM64T
+ * and IA32, by Michael Chynoweth and Mary R. Lee. As of this writing, it is
+ * available at:
+ * http://software.intel.com/en-us/articles/implementing-scalable-atomic-locks-for-multi-core-intel-em64t-and-ia32-architectures
+ */
+#define TAS_SPIN(lock)    (*(lock) ? 1 : TAS(lock))
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+	register slock_t _res = 1;
+
+	__asm__ __volatile__(
+		"	lock			\n"
+		"	xchgb	%0,%1	\n"
+:		"+q"(_res), "+m"(*lock)
+:		/* no inputs */
+:		"memory", "cc");
+	return (int) _res;
+}
+
+#define SPIN_DELAY() spin_delay()
+
+static __inline__ void
+spin_delay(void)
+{
+	/*
+	 * Adding a PAUSE in the spin delay loop is demonstrably a no-op on
+	 * Opteron, but it may be of some use on EM64T, so we keep it.
+	 */
+	__asm__ __volatile__(
+		" rep; nop			\n");
+}
+
+#endif	 /* __x86_64__ */
+
+
+#if defined(__ia64__) || defined(__ia64)
+/*
+ * Intel Itanium, gcc or Intel's compiler.
+ *
+ * Itanium has weak memory ordering, but we rely on the compiler to enforce
+ * strict ordering of accesses to volatile data.  In particular, while the
+ * xchg instruction implicitly acts as a memory barrier with 'acquire'
+ * semantics, we do not have an explicit memory fence instruction in the
+ * S_UNLOCK macro.  We use a regular assignment to clear the spinlock, and
+ * trust that the compiler marks the generated store instruction with the
+ * ".rel" opcode.
+ *
+ * Testing shows that assumption to hold on gcc, although I could not find
+ * any explicit statement on that in the gcc manual.  In Intel's compiler,
+ * the -m[no-]serialize-volatile option controls that, and testing shows that
+ * it is enabled by default.
+ */
+#define HAS_TEST_AND_SET
+
+typedef unsigned int slock_t;
+
+#define TAS(lock) tas(lock)
+
+/* On IA64, it's a win to use a non-locking test before the xchg proper */
+#define TAS_SPIN(lock)	(*(lock) ? 1 : TAS(lock))
+
+#ifndef __INTEL_COMPILER
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+	long int	ret;
+
+	__asm__ __volatile__(
+		"	xchg4 	%0=%1,%2	\n"
+:		"=r"(ret), "+m"(*lock)
+:		"r"(1)
+:		"memory");
+	return (int) ret;
+}
+
+#else /* __INTEL_COMPILER */
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+	int		ret;
+
+	ret = _InterlockedExchange(lock,1);	/* this is a xchg asm macro */
+
+	return ret;
+}
+
+#endif /* __INTEL_COMPILER */
+#endif	 /* __ia64__ || __ia64 */
+
+/*
+ * On ARM and ARM64, we use __sync_lock_test_and_set(int *, int) if available.
+ *
+ * We use the int-width variant of the builtin because it works on more chips
+ * than other widths.
+ */
+#if defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(__aarch64)
+#ifdef HAVE_GCC__SYNC_INT32_TAS
+#define HAS_TEST_AND_SET
+
+#define TAS(lock) tas(lock)
+
+typedef int slock_t;
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+	return __sync_lock_test_and_set(lock, 1);
+}
+
+#define S_UNLOCK(lock) __sync_lock_release(lock)
+
+#endif	 /* HAVE_GCC__SYNC_INT32_TAS */
+#endif	 /* __arm__ || __arm || __aarch64__ || __aarch64 */
+
+
+/* S/390 and S/390x Linux (32- and 64-bit zSeries) */
+#if defined(__s390__) || defined(__s390x__)
+#define HAS_TEST_AND_SET
+
+typedef unsigned int slock_t;
+
+#define TAS(lock)	   tas(lock)
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+	int			_res = 0;
+
+	__asm__	__volatile__(
+		"	cs 	%0,%3,0(%2)		\n"
+:		"+d"(_res), "+m"(*lock)
+:		"a"(lock), "d"(1)
+:		"memory", "cc");
+	return _res;
+}
+
+#endif	 /* __s390__ || __s390x__ */
+
+
+#if defined(__sparc__)		/* Sparc */
+/*
+ * Solaris has always run sparc processors in TSO (total store) mode, but
+ * linux didn't use to and the *BSDs still don't. So, be careful about
+ * acquire/release semantics. The CPU will treat superfluous membars as
+ * NOPs, so it's just code space.
+ */
+#define HAS_TEST_AND_SET
+
+typedef unsigned char slock_t;
+
+#define TAS(lock) tas(lock)
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+	register slock_t _res;
+
+	/*
+	 *	See comment in /pg/backend/port/tas/solaris_sparc.s for why this
+	 *	uses "ldstub", and that file uses "cas".  gcc currently generates
+	 *	sparcv7-targeted binaries, so "cas" use isn't possible.
+	 */
+	__asm__ __volatile__(
+		"	ldstub	[%2], %0	\n"
+:		"=r"(_res), "+m"(*lock)
+:		"r"(lock)
+:		"memory");
+#if defined(__sparcv7) || defined(__sparc_v7__)
+	/*
+	 * No stbar or membar available, luckily no actually produced hardware
+	 * requires a barrier.
+	 */
+#elif defined(__sparcv8) || defined(__sparc_v8__)
+	/* stbar is available (and required for both PSO, RMO), membar isn't */
+	__asm__ __volatile__ ("stbar	 \n":::"memory");
+#else
+	/*
+	 * #LoadStore (RMO) | #LoadLoad (RMO) together are the appropriate acquire
+	 * barrier for sparcv8+ upwards.
+	 */
+	__asm__ __volatile__ ("membar #LoadStore | #LoadLoad \n":::"memory");
+#endif
+	return (int) _res;
+}
+
+#if defined(__sparcv7) || defined(__sparc_v7__)
+/*
+ * No stbar or membar available, luckily no actually produced hardware
+ * requires a barrier.  We fall through to the default gcc definition of
+ * S_UNLOCK in this case.
+ */
+#elif defined(__sparcv8) || defined(__sparc_v8__)
+/* stbar is available (and required for both PSO, RMO), membar isn't */
+#define S_UNLOCK(lock)	\
+do \
+{ \
+	__asm__ __volatile__ ("stbar	 \n":::"memory"); \
+	*((volatile slock_t *) (lock)) = 0; \
+} while (0)
+#else
+/*
+ * #LoadStore (RMO) | #StoreStore (RMO, PSO) together are the appropriate
+ * release barrier for sparcv8+ upwards.
+ */
+#define S_UNLOCK(lock)	\
+do \
+{ \
+	__asm__ __volatile__ ("membar #LoadStore | #StoreStore \n":::"memory"); \
+	*((volatile slock_t *) (lock)) = 0; \
+} while (0)
+#endif
+
+#endif	 /* __sparc__ */
+
+
+/* PowerPC */
+#if defined(__ppc__) || defined(__powerpc__) || defined(__ppc64__) || defined(__powerpc64__)
+#define HAS_TEST_AND_SET
+
+typedef unsigned int slock_t;
+
+#define TAS(lock) tas(lock)
+
+/* On PPC, it's a win to use a non-locking test before the lwarx */
+#define TAS_SPIN(lock)	(*(lock) ? 1 : TAS(lock))
+
+/*
+ * NOTE: per the Enhanced PowerPC Architecture manual, v1.0 dated 7-May-2002,
+ * an isync is a sufficient synchronization barrier after a lwarx/stwcx loop.
+ * On newer machines, we can use lwsync instead for better performance.
+ *
+ * Ordinarily, we'd code the branches here using GNU-style local symbols, that
+ * is "1f" referencing "1:" and so on.  But some people run gcc on AIX with
+ * IBM's assembler as backend, and IBM's assembler doesn't do local symbols.
+ * So hand-code the branch offsets; fortunately, all PPC instructions are
+ * exactly 4 bytes each, so it's not too hard to count.
+ */
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+	slock_t _t;
+	int _res;
+
+	__asm__ __volatile__(
+#ifdef USE_PPC_LWARX_MUTEX_HINT
+"	lwarx   %0,0,%3,1	\n"
+#else
+"	lwarx   %0,0,%3		\n"
+#endif
+"	cmpwi   %0,0		\n"
+"	bne     $+16		\n"		/* branch to li %1,1 */
+"	addi    %0,%0,1		\n"
+"	stwcx.  %0,0,%3		\n"
+"	beq     $+12		\n"		/* branch to lwsync/isync */
+"	li      %1,1		\n"
+"	b       $+12		\n"		/* branch to end of asm sequence */
+#ifdef USE_PPC_LWSYNC
+"	lwsync				\n"
+#else
+"	isync				\n"
+#endif
+"	li      %1,0		\n"
+
+:	"=&r"(_t), "=r"(_res), "+m"(*lock)
+:	"r"(lock)
+:	"memory", "cc");
+	return _res;
+}
+
+/*
+ * PowerPC S_UNLOCK is almost standard but requires a "sync" instruction.
+ * On newer machines, we can use lwsync instead for better performance.
+ */
+#ifdef USE_PPC_LWSYNC
+#define S_UNLOCK(lock)	\
+do \
+{ \
+	__asm__ __volatile__ ("	lwsync \n" ::: "memory"); \
+	*((volatile slock_t *) (lock)) = 0; \
+} while (0)
+#else
+#define S_UNLOCK(lock)	\
+do \
+{ \
+	__asm__ __volatile__ ("	sync \n" ::: "memory"); \
+	*((volatile slock_t *) (lock)) = 0; \
+} while (0)
+#endif /* USE_PPC_LWSYNC */
+
+#endif /* powerpc */
+
+
+/* Linux Motorola 68k */
+#if (defined(__mc68000__) || defined(__m68k__)) && defined(__linux__)
+#define HAS_TEST_AND_SET
+
+typedef unsigned char slock_t;
+
+#define TAS(lock) tas(lock)
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+	register int rv;
+
+	__asm__	__volatile__(
+		"	clrl	%0		\n"
+		"	tas		%1		\n"
+		"	sne		%0		\n"
+:		"=d"(rv), "+m"(*lock)
+:		/* no inputs */
+:		"memory", "cc");
+	return rv;
+}
+
+#endif	 /* (__mc68000__ || __m68k__) && __linux__ */
+
+
+/*
+ * VAXen -- even multiprocessor ones
+ * (thanks to Tom Ivar Helbekkmo)
+ */
+#if defined(__vax__)
+#define HAS_TEST_AND_SET
+
+typedef unsigned char slock_t;
+
+#define TAS(lock) tas(lock)
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+	register int	_res;
+
+	__asm__ __volatile__(
+		"	movl 	$1, %0			\n"
+		"	bbssi	$0, (%2), 1f	\n"
+		"	clrl	%0				\n"
+		"1: \n"
+:		"=&r"(_res), "+m"(*lock)
+:		"r"(lock)
+:		"memory");
+	return _res;
+}
+
+#endif	 /* __vax__ */
+
+
+#if defined(__mips__) && !defined(__sgi)	/* non-SGI MIPS */
+/* Note: on SGI we use the OS' mutex ABI, see below */
+/* Note: R10000 processors require a separate SYNC */
+#define HAS_TEST_AND_SET
+
+typedef unsigned int slock_t;
+
+#define TAS(lock) tas(lock)
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+	register volatile slock_t *_l = lock;
+	register int _res;
+	register int _tmp;
+
+	__asm__ __volatile__(
+		"       .set push           \n"
+		"       .set mips2          \n"
+		"       .set noreorder      \n"
+		"       .set nomacro        \n"
+		"       ll      %0, %2      \n"
+		"       or      %1, %0, 1   \n"
+		"       sc      %1, %2      \n"
+		"       xori    %1, 1       \n"
+		"       or      %0, %0, %1  \n"
+		"       sync                \n"
+		"       .set pop              "
+:		"=&r" (_res), "=&r" (_tmp), "+R" (*_l)
+:		/* no inputs */
+:		"memory");
+	return _res;
+}
+
+/* MIPS S_UNLOCK is almost standard but requires a "sync" instruction */
+#define S_UNLOCK(lock)	\
+do \
+{ \
+	__asm__ __volatile__( \
+		"       .set push           \n" \
+		"       .set mips2          \n" \
+		"       .set noreorder      \n" \
+		"       .set nomacro        \n" \
+		"       sync                \n" \
+		"       .set pop              " \
+:		/* no outputs */ \
+:		/* no inputs */	\
+:		"memory"); \
+	*((volatile slock_t *) (lock)) = 0; \
+} while (0)
+
+#endif /* __mips__ && !__sgi */
+
+
+#if defined(__m32r__) && defined(HAVE_SYS_TAS_H)	/* Renesas' M32R */
+#define HAS_TEST_AND_SET
+
+#include <sys/tas.h>
+
+typedef int slock_t;
+
+#define TAS(lock) tas(lock)
+
+#endif /* __m32r__ */
+
+
+#if defined(__sh__)				/* Renesas' SuperH */
+#define HAS_TEST_AND_SET
+
+typedef unsigned char slock_t;
+
+#define TAS(lock) tas(lock)
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+	register int _res;
+
+	/*
+	 * This asm is coded as if %0 could be any register, but actually SuperH
+	 * restricts the target of xor-immediate to be R0.  That's handled by
+	 * the "z" constraint on _res.
+	 */
+	__asm__ __volatile__(
+		"	tas.b @%2    \n"
+		"	movt  %0     \n"
+		"	xor   #1,%0  \n"
+:		"=z"(_res), "+m"(*lock)
+:		"r"(lock)
+:		"memory", "t");
+	return _res;
+}
+
+#endif	 /* __sh__ */
+
+
+/* These live in s_lock.c, but only for gcc */
+
+
+#if defined(__m68k__) && !defined(__linux__)	/* non-Linux Motorola 68k */
+#define HAS_TEST_AND_SET
+
+typedef unsigned char slock_t;
+#endif
+
+/*
+ * Note that this implementation is unsafe for any platform that can speculate
+ * a memory access (either load or store) after a following store.  That
+ * happens not to be possible x86 and most legacy architectures (some are
+ * single-processor!), but many modern systems have weaker memory ordering.
+ * Those that do must define their own version S_UNLOCK() rather than relying
+ * on this one.
+ */
+#if !defined(S_UNLOCK)
+#if defined(__INTEL_COMPILER)
+#define S_UNLOCK(lock)	\
+	do { __memory_barrier(); *(lock) = 0; } while (0)
+#else
+#define S_UNLOCK(lock)	\
+	do { __asm__ __volatile__("" : : : "memory");  *(lock) = 0; } while (0)
+#endif
+#endif
+
+#endif	/* defined(__GNUC__) || defined(__INTEL_COMPILER) */
+
+
+
+/*
+ * ---------------------------------------------------------------------
+ * Platforms that use non-gcc inline assembly:
+ * ---------------------------------------------------------------------
+ */
+
+#if !defined(HAS_TEST_AND_SET)	/* We didn't trigger above, let's try here */
+
+
+#if defined(USE_UNIVEL_CC)		/* Unixware compiler */
+#define HAS_TEST_AND_SET
+
+typedef unsigned char slock_t;
+
+#define TAS(lock)	tas(lock)
+
+asm int
+tas(volatile slock_t *s_lock)
+{
+/* UNIVEL wants %mem in column 1, so we don't pg_indent this file */
+%mem s_lock
+	pushl %ebx
+	movl s_lock, %ebx
+	movl $255, %eax
+	lock
+	xchgb %al, (%ebx)
+	popl %ebx
+}
+
+#endif	 /* defined(USE_UNIVEL_CC) */
+
+
+#if defined(__hppa) || defined(__hppa__)	/* HP PA-RISC, GCC and HP compilers */
+/*
+ * HP's PA-RISC
+ *
+ * See src/backend/port/hpux/tas.c.template for details about LDCWX.  Because
+ * LDCWX requires a 16-byte-aligned address, we declare slock_t as a 16-byte
+ * struct.  The active word in the struct is whichever has the aligned address;
+ * the other three words just sit at -1.
+ *
+ * When using gcc, we can inline the required assembly code.
+ */
+#define HAS_TEST_AND_SET
+
+typedef struct
+{
+	int			sema[4];
+} slock_t;
+
+#define TAS_ACTIVE_WORD(lock)	((volatile int *) (((uintptr_t) (lock) + 15) & ~15))
+
+#if defined(__GNUC__)
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+	volatile int *lockword = TAS_ACTIVE_WORD(lock);
+	register int lockval;
+
+	__asm__ __volatile__(
+		"	ldcwx	0(0,%2),%0	\n"
+:		"=r"(lockval), "+m"(*lockword)
+:		"r"(lockword)
+:		"memory");
+	return (lockval == 0);
+}
+
+/*
+ * The hppa implementation doesn't follow the rules of this files and provides
+ * a gcc specific implementation outside of the above defined(__GNUC__). It
+ * does so to avoid duplication between the HP compiler and gcc. So undefine
+ * the generic fallback S_UNLOCK from above.
+ */
+#ifdef S_UNLOCK
+#undef S_UNLOCK
+#endif
+#define S_UNLOCK(lock)	\
+	do { \
+		__asm__ __volatile__("" : : : "memory"); \
+		*TAS_ACTIVE_WORD(lock) = -1; \
+	} while (0)
+
+#endif /* __GNUC__ */
+
+#define S_INIT_LOCK(lock) \
+	do { \
+		volatile slock_t *lock_ = (lock); \
+		lock_->sema[0] = -1; \
+		lock_->sema[1] = -1; \
+		lock_->sema[2] = -1; \
+		lock_->sema[3] = -1; \
+	} while (0)
+
+#define S_LOCK_FREE(lock)	(*TAS_ACTIVE_WORD(lock) != 0)
+
+#endif	 /* __hppa || __hppa__ */
+
+
+#if defined(__hpux) && defined(__ia64) && !defined(__GNUC__)
+/*
+ * HP-UX on Itanium, non-gcc compiler
+ *
+ * We assume that the compiler enforces strict ordering of loads/stores on
+ * volatile data (see comments on the gcc-version earlier in this file).
+ * Note that this assumption does *not* hold if you use the
+ * +Ovolatile=__unordered option on the HP-UX compiler, so don't do that.
+ *
+ * See also Implementing Spinlocks on the Intel Itanium Architecture and
+ * PA-RISC, by Tor Ekqvist and David Graves, for more information.  As of
+ * this writing, version 1.0 of the manual is available at:
+ * http://h21007.www2.hp.com/portal/download/files/unprot/itanium/spinlocks.pdf
+ */
+#define HAS_TEST_AND_SET
+
+typedef unsigned int slock_t;
+
+#include <ia64/sys/inline.h>
+#define TAS(lock) _Asm_xchg(_SZ_W, lock, 1, _LDHINT_NONE)
+/* On IA64, it's a win to use a non-locking test before the xchg proper */
+#define TAS_SPIN(lock)	(*(lock) ? 1 : TAS(lock))
+#define S_UNLOCK(lock)	\
+	do { _Asm_mf(); (*(lock)) = 0; } while (0)
+
+#endif	/* HPUX on IA64, non gcc */
+
+#if defined(_AIX)	/* AIX */
+/*
+ * AIX (POWER)
+ */
+#define HAS_TEST_AND_SET
+
+#include <sys/atomic_op.h>
+
+typedef int slock_t;
+
+#define TAS(lock)			_check_lock((slock_t *) (lock), 0, 1)
+#define S_UNLOCK(lock)		_clear_lock((slock_t *) (lock), 0)
+#endif	 /* _AIX */
+
+
+/* These are in sunstudio_(sparc|x86).s */
+
+#if defined(__SUNPRO_C) && (defined(__i386) || defined(__x86_64__) || defined(__sparc__) || defined(__sparc))
+#define HAS_TEST_AND_SET
+
+#if defined(__i386) || defined(__x86_64__) || defined(__sparcv9) || defined(__sparcv8plus)
+typedef unsigned int slock_t;
+#else
+typedef unsigned char slock_t;
+#endif
+
+extern slock_t pg_atomic_cas(volatile slock_t *lock, slock_t with,
+									  slock_t cmp);
+
+#define TAS(a) (pg_atomic_cas((a), 1, 0) != 0)
+#endif
+
+
+#ifdef WIN32_ONLY_COMPILER
+typedef LONG slock_t;
+
+#define HAS_TEST_AND_SET
+#define TAS(lock) (InterlockedCompareExchange(lock, 1, 0))
+
+#define SPIN_DELAY() spin_delay()
+
+/* If using Visual C++ on Win64, inline assembly is unavailable.
+ * Use a _mm_pause instrinsic instead of rep nop.
+ */
+#if defined(_WIN64)
+static __forceinline void
+spin_delay(void)
+{
+	_mm_pause();
+}
+#else
+static __forceinline void
+spin_delay(void)
+{
+	/* See comment for gcc code. Same code, MASM syntax */
+	__asm rep nop;
+}
+#endif
+
+#include <intrin.h>
+#pragma intrinsic(_ReadWriteBarrier)
+
+#define S_UNLOCK(lock)	\
+	do { _ReadWriteBarrier(); (*(lock)) = 0; } while (0)
+
+#endif
+
+
+#endif	/* !defined(HAS_TEST_AND_SET) */
+
+
+/* Blow up if we didn't have any way to do spinlocks */
+#ifndef HAS_TEST_AND_SET
+#error PostgreSQL does not have native spinlock support on this platform.  To continue the compilation, rerun configure using --disable-spinlocks.  However, performance will be poor.  Please report this to pgsql-bugs@postgresql.org.
+#endif
+
+
+#else	/* !HAVE_SPINLOCKS */
+
+
+/*
+ * Fake spinlock implementation using semaphores --- slow and prone
+ * to fall foul of kernel limits on number of semaphores, so don't use this
+ * unless you must!  The subroutines appear in spin.c.
+ */
+typedef int slock_t;
+
+extern bool s_lock_free_sema(volatile slock_t *lock);
+extern void s_unlock_sema(volatile slock_t *lock);
+extern void s_init_lock_sema(volatile slock_t *lock, bool nested);
+extern int	tas_sema(volatile slock_t *lock);
+
+#define S_LOCK_FREE(lock)	s_lock_free_sema(lock)
+#define S_UNLOCK(lock)	 s_unlock_sema(lock)
+#define S_INIT_LOCK(lock)	s_init_lock_sema(lock, false)
+#define TAS(lock)	tas_sema(lock)
+
+
+#endif	/* HAVE_SPINLOCKS */
+
+
+/*
+ * Default Definitions - override these above as needed.
+ */
+
+#if !defined(S_LOCK)
+#define S_LOCK(lock) \
+	(TAS(lock) ? s_lock((lock), __FILE__, __LINE__) : 0)
+#endif	 /* S_LOCK */
+
+#if !defined(S_LOCK_FREE)
+#define S_LOCK_FREE(lock)	(*(lock) == 0)
+#endif	 /* S_LOCK_FREE */
+
+#if !defined(S_UNLOCK)
+/*
+ * Our default implementation of S_UNLOCK is essentially *(lock) = 0.  This
+ * is unsafe if the platform can speculate a memory access (either load or
+ * store) after a following store; platforms where this is possible must
+ * define their own S_UNLOCK.  But CPU reordering is not the only concern:
+ * if we simply defined S_UNLOCK() as an inline macro, the compiler might
+ * reorder instructions from inside the critical section to occur after the
+ * lock release.  Since the compiler probably can't know what the external
+ * function s_unlock is doing, putting the same logic there should be adequate.
+ * A sufficiently-smart globally optimizing compiler could break that
+ * assumption, though, and the cost of a function call for every spinlock
+ * release may hurt performance significantly, so we use this implementation
+ * only for platforms where we don't know of a suitable intrinsic.  For the
+ * most part, those are relatively obscure platform/compiler combinations to
+ * which the PostgreSQL project does not have access.
+ */
+#define USE_DEFAULT_S_UNLOCK
+extern void s_unlock(volatile slock_t *lock);
+#define S_UNLOCK(lock)		s_unlock(lock)
+#endif	 /* S_UNLOCK */
+
+#if !defined(S_INIT_LOCK)
+#define S_INIT_LOCK(lock)	S_UNLOCK(lock)
+#endif	 /* S_INIT_LOCK */
+
+#if !defined(SPIN_DELAY)
+#define SPIN_DELAY()	((void) 0)
+#endif	 /* SPIN_DELAY */
+
+#if !defined(TAS)
+extern int	tas(volatile slock_t *lock);		/* in port/.../tas.s, or
+												 * s_lock.c */
+
+#define TAS(lock)		tas(lock)
+#endif	 /* TAS */
+
+#if !defined(TAS_SPIN)
+#define TAS_SPIN(lock)	TAS(lock)
+#endif	 /* TAS_SPIN */
+
+extern slock_t dummy_spinlock;
+
+/*
+ * Platform-independent out-of-line support routines
+ */
+extern int s_lock(volatile slock_t *lock, const char *file, int line);
+
+/* Support for dynamic adjustment of spins_per_delay */
+#define DEFAULT_SPINS_PER_DELAY  100
+
+extern void set_spins_per_delay(int shared_spins_per_delay);
+extern int	update_spins_per_delay(int shared_spins_per_delay);
+
+#endif	 /* S_LOCK_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/shm_mq.h b/foreign/libpg_query/src/postgres/include/storage/shm_mq.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/shm_mq.h
@@ -0,0 +1,85 @@
+/*-------------------------------------------------------------------------
+ *
+ * shm_mq.h
+ *	  single-reader, single-writer shared memory message queue
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/shm_mq.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef SHM_MQ_H
+#define SHM_MQ_H
+
+#include "postmaster/bgworker.h"
+#include "storage/dsm.h"
+#include "storage/proc.h"
+
+/* The queue itself, in shared memory. */
+struct shm_mq;
+typedef struct shm_mq shm_mq;
+
+/* Backend-private state. */
+struct shm_mq_handle;
+typedef struct shm_mq_handle shm_mq_handle;
+
+/* Descriptors for a single write spanning multiple locations. */
+typedef struct
+{
+	const char *data;
+	Size		len;
+} shm_mq_iovec;
+
+/* Possible results of a send or receive operation. */
+typedef enum
+{
+	SHM_MQ_SUCCESS,				/* Sent or received a message. */
+	SHM_MQ_WOULD_BLOCK,			/* Not completed; retry later. */
+	SHM_MQ_DETACHED				/* Other process has detached queue. */
+} shm_mq_result;
+
+/*
+ * Primitives to create a queue and set the sender and receiver.
+ *
+ * Both the sender and the receiver must be set before any messages are read
+ * or written, but they need not be set by the same process.  Each must be
+ * set exactly once.
+ */
+extern shm_mq *shm_mq_create(void *address, Size size);
+extern void shm_mq_set_receiver(shm_mq *mq, PGPROC *);
+extern void shm_mq_set_sender(shm_mq *mq, PGPROC *);
+
+/* Accessor methods for sender and receiver. */
+extern PGPROC *shm_mq_get_receiver(shm_mq *);
+extern PGPROC *shm_mq_get_sender(shm_mq *);
+
+/* Set up backend-local queue state. */
+extern shm_mq_handle *shm_mq_attach(shm_mq *mq, dsm_segment *seg,
+			  BackgroundWorkerHandle *handle);
+
+/* Associate worker handle with shm_mq. */
+extern void shm_mq_set_handle(shm_mq_handle *, BackgroundWorkerHandle *);
+
+/* Break connection. */
+extern void shm_mq_detach(shm_mq *);
+
+/* Get the shm_mq from handle. */
+extern shm_mq *shm_mq_get_queue(shm_mq_handle *mqh);
+
+/* Send or receive messages. */
+extern shm_mq_result shm_mq_send(shm_mq_handle *mqh,
+			Size nbytes, const void *data, bool nowait);
+extern shm_mq_result shm_mq_sendv(shm_mq_handle *mqh,
+			 shm_mq_iovec *iov, int iovcnt, bool nowait);
+extern shm_mq_result shm_mq_receive(shm_mq_handle *mqh,
+			   Size *nbytesp, void **datap, bool nowait);
+
+/* Wait for our counterparty to attach to the queue. */
+extern shm_mq_result shm_mq_wait_for_attach(shm_mq_handle *mqh);
+
+/* Smallest possible queue. */
+extern PGDLLIMPORT const Size shm_mq_minimum_size;
+
+#endif   /* SHM_MQ_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/shm_toc.h b/foreign/libpg_query/src/postgres/include/storage/shm_toc.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/shm_toc.h
@@ -0,0 +1,57 @@
+/*-------------------------------------------------------------------------
+ *
+ * shm_toc.h
+ *	  shared memory segment table of contents
+ *
+ * This is intended to provide a simple way to divide a chunk of shared
+ * memory (probably dynamic shared memory allocated via dsm_create) into
+ * a number of regions and keep track of the addreses of those regions or
+ * key data structures within those regions.  This is not intended to
+ * scale to a large number of keys and will perform poorly if used that
+ * way; if you need a large number of pointers, store them within some
+ * other data structure within the segment and only put the pointer to
+ * the data structure itself in the table of contents.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/shm_toc.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef SHM_TOC_H
+#define SHM_TOC_H
+
+#include "storage/shmem.h"
+
+struct shm_toc;
+typedef struct shm_toc shm_toc;
+
+extern shm_toc *shm_toc_create(uint64 magic, void *address, Size nbytes);
+extern shm_toc *shm_toc_attach(uint64 magic, void *address);
+extern void *shm_toc_allocate(shm_toc *toc, Size nbytes);
+extern Size shm_toc_freespace(shm_toc *toc);
+extern void shm_toc_insert(shm_toc *toc, uint64 key, void *address);
+extern void *shm_toc_lookup(shm_toc *toc, uint64 key);
+
+/*
+ * Tools for estimating how large a chunk of shared memory will be needed
+ * to store a TOC and its dependent objects.
+ */
+typedef struct
+{
+	Size		space_for_chunks;
+	Size		number_of_keys;
+} shm_toc_estimator;
+
+#define shm_toc_initialize_estimator(e) \
+	((e)->space_for_chunks = 0, (e)->number_of_keys = 0)
+#define shm_toc_estimate_chunk(e, sz) \
+	((e)->space_for_chunks = add_size((e)->space_for_chunks, \
+		BUFFERALIGN((sz))))
+#define shm_toc_estimate_keys(e, cnt) \
+	((e)->number_of_keys = add_size((e)->number_of_keys, (cnt)))
+
+extern Size shm_toc_estimate(shm_toc_estimator *);
+
+#endif   /* SHM_TOC_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/shmem.h b/foreign/libpg_query/src/postgres/include/storage/shmem.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/shmem.h
@@ -0,0 +1,78 @@
+/*-------------------------------------------------------------------------
+ *
+ * shmem.h
+ *	  shared memory management structures
+ *
+ * Historical note:
+ * A long time ago, Postgres' shared memory region was allowed to be mapped
+ * at a different address in each process, and shared memory "pointers" were
+ * passed around as offsets relative to the start of the shared memory region.
+ * That is no longer the case: each process must map the shared memory region
+ * at the same address.  This means shared memory pointers can be passed
+ * around directly between different processes.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/shmem.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef SHMEM_H
+#define SHMEM_H
+
+#include "utils/hsearch.h"
+
+
+/* shmqueue.c */
+typedef struct SHM_QUEUE
+{
+	struct SHM_QUEUE *prev;
+	struct SHM_QUEUE *next;
+} SHM_QUEUE;
+
+/* shmem.c */
+extern void InitShmemAccess(void *seghdr);
+extern void InitShmemAllocation(void);
+extern void *ShmemAlloc(Size size);
+extern bool ShmemAddrIsValid(const void *addr);
+extern void InitShmemIndex(void);
+extern HTAB *ShmemInitHash(const char *name, long init_size, long max_size,
+			  HASHCTL *infoP, int hash_flags);
+extern void *ShmemInitStruct(const char *name, Size size, bool *foundPtr);
+extern Size add_size(Size s1, Size s2);
+extern Size mul_size(Size s1, Size s2);
+
+/* ipci.c */
+extern void RequestAddinShmemSpace(Size size);
+
+/* size constants for the shmem index table */
+ /* max size of data structure string name */
+#define SHMEM_INDEX_KEYSIZE		 (48)
+ /* estimated size of the shmem index table (not a hard limit) */
+#define SHMEM_INDEX_SIZE		 (64)
+
+/* this is a hash bucket in the shmem index table */
+typedef struct
+{
+	char		key[SHMEM_INDEX_KEYSIZE];		/* string name */
+	void	   *location;		/* location in shared mem */
+	Size		size;			/* # bytes allocated for the structure */
+} ShmemIndexEnt;
+
+/*
+ * prototypes for functions in shmqueue.c
+ */
+extern void SHMQueueInit(SHM_QUEUE *queue);
+extern void SHMQueueElemInit(SHM_QUEUE *queue);
+extern void SHMQueueDelete(SHM_QUEUE *queue);
+extern void SHMQueueInsertBefore(SHM_QUEUE *queue, SHM_QUEUE *elem);
+extern void SHMQueueInsertAfter(SHM_QUEUE *queue, SHM_QUEUE *elem);
+extern Pointer SHMQueueNext(const SHM_QUEUE *queue, const SHM_QUEUE *curElem,
+			 Size linkOffset);
+extern Pointer SHMQueuePrev(const SHM_QUEUE *queue, const SHM_QUEUE *curElem,
+			 Size linkOffset);
+extern bool SHMQueueEmpty(const SHM_QUEUE *queue);
+extern bool SHMQueueIsDetached(const SHM_QUEUE *queue);
+
+#endif   /* SHMEM_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/sinval.h b/foreign/libpg_query/src/postgres/include/storage/sinval.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/sinval.h
@@ -0,0 +1,153 @@
+/*-------------------------------------------------------------------------
+ *
+ * sinval.h
+ *	  POSTGRES shared cache invalidation communication definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/sinval.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef SINVAL_H
+#define SINVAL_H
+
+#include <signal.h>
+
+#include "storage/relfilenode.h"
+
+/*
+ * We support several types of shared-invalidation messages:
+ *	* invalidate a specific tuple in a specific catcache
+ *	* invalidate all catcache entries from a given system catalog
+ *	* invalidate a relcache entry for a specific logical relation
+ *	* invalidate an smgr cache entry for a specific physical relation
+ *	* invalidate the mapped-relation mapping for a given database
+ *	* invalidate any saved snapshot that might be used to scan a given relation
+ * More types could be added if needed.  The message type is identified by
+ * the first "int8" field of the message struct.  Zero or positive means a
+ * specific-catcache inval message (and also serves as the catcache ID field).
+ * Negative values identify the other message types, as per codes below.
+ *
+ * Catcache inval events are initially driven by detecting tuple inserts,
+ * updates and deletions in system catalogs (see CacheInvalidateHeapTuple).
+ * An update can generate two inval events, one for the old tuple and one for
+ * the new, but this is reduced to one event if the tuple's hash key doesn't
+ * change.  Note that the inval events themselves don't actually say whether
+ * the tuple is being inserted or deleted.  Also, since we transmit only a
+ * hash key, there is a small risk of unnecessary invalidations due to chance
+ * matches of hash keys.
+ *
+ * Note that some system catalogs have multiple caches on them (with different
+ * indexes).  On detecting a tuple invalidation in such a catalog, separate
+ * catcache inval messages must be generated for each of its caches, since
+ * the hash keys will generally be different.
+ *
+ * Catcache, relcache, and snapshot invalidations are transactional, and so
+ * are sent to other backends upon commit.  Internally to the generating
+ * backend, they are also processed at CommandCounterIncrement so that later
+ * commands in the same transaction see the new state.  The generating backend
+ * also has to process them at abort, to flush out any cache state it's loaded
+ * from no-longer-valid entries.
+ *
+ * smgr and relation mapping invalidations are non-transactional: they are
+ * sent immediately when the underlying file change is made.
+ */
+
+typedef struct
+{
+	int8		id;				/* cache ID --- must be first */
+	Oid			dbId;			/* database ID, or 0 if a shared relation */
+	uint32		hashValue;		/* hash value of key for this catcache */
+} SharedInvalCatcacheMsg;
+
+#define SHAREDINVALCATALOG_ID	(-1)
+
+typedef struct
+{
+	int8		id;				/* type field --- must be first */
+	Oid			dbId;			/* database ID, or 0 if a shared catalog */
+	Oid			catId;			/* ID of catalog whose contents are invalid */
+} SharedInvalCatalogMsg;
+
+#define SHAREDINVALRELCACHE_ID	(-2)
+
+typedef struct
+{
+	int8		id;				/* type field --- must be first */
+	Oid			dbId;			/* database ID, or 0 if a shared relation */
+	Oid			relId;			/* relation ID */
+} SharedInvalRelcacheMsg;
+
+#define SHAREDINVALSMGR_ID		(-3)
+
+typedef struct
+{
+	/* note: field layout chosen to pack into 16 bytes */
+	int8		id;				/* type field --- must be first */
+	int8		backend_hi;		/* high bits of backend ID, if temprel */
+	uint16		backend_lo;		/* low bits of backend ID, if temprel */
+	RelFileNode rnode;			/* spcNode, dbNode, relNode */
+} SharedInvalSmgrMsg;
+
+#define SHAREDINVALRELMAP_ID	(-4)
+
+typedef struct
+{
+	int8		id;				/* type field --- must be first */
+	Oid			dbId;			/* database ID, or 0 for shared catalogs */
+} SharedInvalRelmapMsg;
+
+#define SHAREDINVALSNAPSHOT_ID	(-5)
+
+typedef struct
+{
+	int8		id;				/* type field --- must be first */
+	Oid			dbId;			/* database ID, or 0 if a shared relation */
+	Oid			relId;			/* relation ID */
+} SharedInvalSnapshotMsg;
+
+typedef union
+{
+	int8		id;				/* type field --- must be first */
+	SharedInvalCatcacheMsg cc;
+	SharedInvalCatalogMsg cat;
+	SharedInvalRelcacheMsg rc;
+	SharedInvalSmgrMsg sm;
+	SharedInvalRelmapMsg rm;
+	SharedInvalSnapshotMsg sn;
+} SharedInvalidationMessage;
+
+
+/* Counter of messages processed; don't worry about overflow. */
+extern uint64 SharedInvalidMessageCounter;
+
+extern volatile sig_atomic_t catchupInterruptPending;
+
+extern void SendSharedInvalidMessages(const SharedInvalidationMessage *msgs,
+						  int n);
+extern void ReceiveSharedInvalidMessages(
+					  void (*invalFunction) (SharedInvalidationMessage *msg),
+							 void (*resetFunction) (void));
+
+/* signal handler for catchup events (PROCSIG_CATCHUP_INTERRUPT) */
+extern void HandleCatchupInterrupt(void);
+
+/*
+ * enable/disable processing of catchup events directly from signal handler.
+ * The enable routine first performs processing of any catchup events that
+ * have occurred since the last disable.
+ */
+extern void ProcessCatchupInterrupt(void);
+
+extern int xactGetCommittedInvalidationMessages(SharedInvalidationMessage **msgs,
+									 bool *RelcacheInitFileInval);
+extern void ProcessCommittedInvalidationMessages(SharedInvalidationMessage *msgs,
+									 int nmsgs, bool RelcacheInitFileInval,
+									 Oid dbid, Oid tsid);
+
+extern void LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg);
+
+#endif   /* SINVAL_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/spin.h b/foreign/libpg_query/src/postgres/include/storage/spin.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/spin.h
@@ -0,0 +1,77 @@
+/*-------------------------------------------------------------------------
+ *
+ * spin.h
+ *	   Hardware-independent implementation of spinlocks.
+ *
+ *
+ *	The hardware-independent interface to spinlocks is defined by the
+ *	typedef "slock_t" and these macros:
+ *
+ *	void SpinLockInit(volatile slock_t *lock)
+ *		Initialize a spinlock (to the unlocked state).
+ *
+ *	void SpinLockAcquire(volatile slock_t *lock)
+ *		Acquire a spinlock, waiting if necessary.
+ *		Time out and abort() if unable to acquire the lock in a
+ *		"reasonable" amount of time --- typically ~ 1 minute.
+ *
+ *	void SpinLockRelease(volatile slock_t *lock)
+ *		Unlock a previously acquired lock.
+ *
+ *	bool SpinLockFree(slock_t *lock)
+ *		Tests if the lock is free. Returns TRUE if free, FALSE if locked.
+ *		This does *not* change the state of the lock.
+ *
+ *	Callers must beware that the macro argument may be evaluated multiple
+ *	times!
+ *
+ *	Load and store operations in calling code are guaranteed not to be
+ *	reordered with respect to these operations, because they include a
+ *	compiler barrier.  (Before PostgreSQL 9.5, callers needed to use a
+ *	volatile qualifier to access data protected by spinlocks.)
+ *
+ *	Keep in mind the coding rule that spinlocks must not be held for more
+ *	than a few instructions.  In particular, we assume it is not possible
+ *	for a CHECK_FOR_INTERRUPTS() to occur while holding a spinlock, and so
+ *	it is not necessary to do HOLD/RESUME_INTERRUPTS() in these macros.
+ *
+ *	These macros are implemented in terms of hardware-dependent macros
+ *	supplied by s_lock.h.  There is not currently any extra functionality
+ *	added by this header, but there has been in the past and may someday
+ *	be again.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/spin.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef SPIN_H
+#define SPIN_H
+
+#include "storage/s_lock.h"
+#ifndef HAVE_SPINLOCKS
+#include "storage/pg_sema.h"
+#endif
+
+
+#define SpinLockInit(lock)	S_INIT_LOCK(lock)
+
+#define SpinLockAcquire(lock) S_LOCK(lock)
+
+#define SpinLockRelease(lock) S_UNLOCK(lock)
+
+#define SpinLockFree(lock)	S_LOCK_FREE(lock)
+
+
+extern int	SpinlockSemas(void);
+extern Size SpinlockSemaSize(void);
+
+#ifndef HAVE_SPINLOCKS
+extern void SpinlockSemaInit(PGSemaphore);
+extern PGSemaphore SpinlockSemaArray;
+#endif
+
+#endif   /* SPIN_H */
diff --git a/foreign/libpg_query/src/postgres/include/storage/standby.h b/foreign/libpg_query/src/postgres/include/storage/standby.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/storage/standby.h
@@ -0,0 +1,120 @@
+/*-------------------------------------------------------------------------
+ *
+ * standby.h
+ *	  Definitions for hot standby mode.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/storage/standby.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef STANDBY_H
+#define STANDBY_H
+
+#include "access/xlogreader.h"
+#include "lib/stringinfo.h"
+#include "storage/lock.h"
+#include "storage/procsignal.h"
+#include "storage/relfilenode.h"
+
+/* User-settable GUC parameters */
+extern int	vacuum_defer_cleanup_age;
+extern int	max_standby_archive_delay;
+extern int	max_standby_streaming_delay;
+
+extern void InitRecoveryTransactionEnvironment(void);
+extern void ShutdownRecoveryTransactionEnvironment(void);
+
+extern void ResolveRecoveryConflictWithSnapshot(TransactionId latestRemovedXid,
+									RelFileNode node);
+extern void ResolveRecoveryConflictWithTablespace(Oid tsid);
+extern void ResolveRecoveryConflictWithDatabase(Oid dbid);
+
+extern void ResolveRecoveryConflictWithBufferPin(void);
+extern void CheckRecoveryConflictDeadlock(void);
+extern void StandbyDeadLockHandler(void);
+extern void StandbyTimeoutHandler(void);
+
+/*
+ * Standby Rmgr (RM_STANDBY_ID)
+ *
+ * Standby recovery manager exists to perform actions that are required
+ * to make hot standby work. That includes logging AccessExclusiveLocks taken
+ * by transactions and running-xacts snapshots.
+ */
+extern void StandbyAcquireAccessExclusiveLock(TransactionId xid, Oid dbOid, Oid relOid);
+extern void StandbyReleaseLockTree(TransactionId xid,
+					   int nsubxids, TransactionId *subxids);
+extern void StandbyReleaseAllLocks(void);
+extern void StandbyReleaseOldLocks(int nxids, TransactionId *xids);
+
+/*
+ * XLOG message types
+ */
+#define XLOG_STANDBY_LOCK			0x00
+#define XLOG_RUNNING_XACTS			0x10
+
+typedef struct xl_standby_locks
+{
+	int			nlocks;			/* number of entries in locks array */
+	xl_standby_lock locks[FLEXIBLE_ARRAY_MEMBER];
+} xl_standby_locks;
+
+/*
+ * When we write running xact data to WAL, we use this structure.
+ */
+typedef struct xl_running_xacts
+{
+	int			xcnt;			/* # of xact ids in xids[] */
+	int			subxcnt;		/* # of subxact ids in xids[] */
+	bool		subxid_overflow;	/* snapshot overflowed, subxids missing */
+	TransactionId nextXid;		/* copy of ShmemVariableCache->nextXid */
+	TransactionId oldestRunningXid;		/* *not* oldestXmin */
+	TransactionId latestCompletedXid;	/* so we can set xmax */
+
+	TransactionId xids[FLEXIBLE_ARRAY_MEMBER];
+} xl_running_xacts;
+
+#define MinSizeOfXactRunningXacts offsetof(xl_running_xacts, xids)
+
+
+/* Recovery handlers for the Standby Rmgr (RM_STANDBY_ID) */
+extern void standby_redo(XLogReaderState *record);
+extern void standby_desc(StringInfo buf, XLogReaderState *record);
+extern const char *standby_identify(uint8 info);
+
+/*
+ * Declarations for GetRunningTransactionData(). Similar to Snapshots, but
+ * not quite. This has nothing at all to do with visibility on this server,
+ * so this is completely separate from snapmgr.c and snapmgr.h.
+ * This data is important for creating the initial snapshot state on a
+ * standby server. We need lots more information than a normal snapshot,
+ * hence we use a specific data structure for our needs. This data
+ * is written to WAL as a separate record immediately after each
+ * checkpoint. That means that wherever we start a standby from we will
+ * almost immediately see the data we need to begin executing queries.
+ */
+
+typedef struct RunningTransactionsData
+{
+	int			xcnt;			/* # of xact ids in xids[] */
+	int			subxcnt;		/* # of subxact ids in xids[] */
+	bool		subxid_overflow;	/* snapshot overflowed, subxids missing */
+	TransactionId nextXid;		/* copy of ShmemVariableCache->nextXid */
+	TransactionId oldestRunningXid;		/* *not* oldestXmin */
+	TransactionId latestCompletedXid;	/* so we can set xmax */
+
+	TransactionId *xids;		/* array of (sub)xids still running */
+} RunningTransactionsData;
+
+typedef RunningTransactionsData *RunningTransactions;
+
+extern void LogAccessExclusiveLock(Oid dbOid, Oid relOid);
+extern void LogAccessExclusiveLockPrepare(void);
+
+extern XLogRecPtr LogStandbySnapshot(void);
+
+#endif   /* STANDBY_H */
diff --git a/foreign/libpg_query/src/postgres/include/tcop/deparse_utility.h b/foreign/libpg_query/src/postgres/include/tcop/deparse_utility.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/tcop/deparse_utility.h
@@ -0,0 +1,105 @@
+/*-------------------------------------------------------------------------
+ *
+ * deparse_utility.h
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/tcop/deparse_utility.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef DEPARSE_UTILITY_H
+#define DEPARSE_UTILITY_H
+
+#include "access/attnum.h"
+#include "catalog/objectaddress.h"
+#include "nodes/nodes.h"
+#include "utils/aclchk_internal.h"
+
+
+/*
+ * Support for keeping track of collected commands.
+ */
+typedef enum CollectedCommandType
+{
+	SCT_Simple,
+	SCT_AlterTable,
+	SCT_Grant,
+	SCT_AlterOpFamily,
+	SCT_AlterDefaultPrivileges,
+	SCT_CreateOpClass,
+	SCT_AlterTSConfig
+} CollectedCommandType;
+
+/*
+ * For ALTER TABLE commands, we keep a list of the subcommands therein.
+ */
+typedef struct CollectedATSubcmd
+{
+	ObjectAddress address;		/* affected column, constraint, index, ... */
+	Node	   *parsetree;
+} CollectedATSubcmd;
+
+typedef struct CollectedCommand
+{
+	CollectedCommandType type;
+	bool		in_extension;
+	Node	   *parsetree;
+
+	union
+	{
+		/* most commands */
+		struct
+		{
+			ObjectAddress address;
+			ObjectAddress secondaryObject;
+		}			simple;
+
+		/* ALTER TABLE, and internal uses thereof */
+		struct
+		{
+			Oid			objectId;
+			Oid			classId;
+			List	   *subcmds;
+		}			alterTable;
+
+		/* GRANT / REVOKE */
+		struct
+		{
+			InternalGrant *istmt;
+		}			grant;
+
+		/* ALTER OPERATOR FAMILY */
+		struct
+		{
+			ObjectAddress address;
+			List	   *operators;
+			List	   *procedures;
+		}			opfam;
+
+		/* CREATE OPERATOR CLASS */
+		struct
+		{
+			ObjectAddress address;
+			List	   *operators;
+			List	   *procedures;
+		}			createopc;
+
+		/* ALTER TEXT SEARCH CONFIGURATION ADD/ALTER/DROP MAPPING */
+		struct
+		{
+			ObjectAddress address;
+			Oid		   *dictIds;
+			int			ndicts;
+		}			atscfg;
+
+		/* ALTER DEFAULT PRIVILEGES */
+		struct
+		{
+			GrantObjectType objtype;
+		}			defprivs;
+	}			d;
+} CollectedCommand;
+
+#endif   /* DEPARSE_UTILITY_H */
diff --git a/foreign/libpg_query/src/postgres/include/tcop/dest.h b/foreign/libpg_query/src/postgres/include/tcop/dest.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/tcop/dest.h
@@ -0,0 +1,141 @@
+/*-------------------------------------------------------------------------
+ *
+ * dest.h
+ *	  support for communication destinations
+ *
+ * Whenever the backend executes a query that returns tuples, the results
+ * have to go someplace.  For example:
+ *
+ *	  - stdout is the destination only when we are running a
+ *		standalone backend (no postmaster) and are returning results
+ *		back to an interactive user.
+ *
+ *	  - a remote process is the destination when we are
+ *		running a backend with a frontend and the frontend executes
+ *		PQexec() or PQfn().  In this case, the results are sent
+ *		to the frontend via the functions in backend/libpq.
+ *
+ *	  - DestNone is the destination when the system executes
+ *		a query internally.  The results are discarded.
+ *
+ * dest.c defines three functions that implement destination management:
+ *
+ * BeginCommand: initialize the destination at start of command.
+ * CreateDestReceiver: return a pointer to a struct of destination-specific
+ * receiver functions.
+ * EndCommand: clean up the destination at end of command.
+ *
+ * BeginCommand/EndCommand are executed once per received SQL query.
+ *
+ * CreateDestReceiver returns a receiver object appropriate to the specified
+ * destination.  The executor, as well as utility statements that can return
+ * tuples, are passed the resulting DestReceiver* pointer.  Each executor run
+ * or utility execution calls the receiver's rStartup method, then the
+ * receiveSlot method (zero or more times), then the rShutdown method.
+ * The same receiver object may be re-used multiple times; eventually it is
+ * destroyed by calling its rDestroy method.
+ *
+ * In some cases, receiver objects require additional parameters that must
+ * be passed to them after calling CreateDestReceiver.  Since the set of
+ * parameters varies for different receiver types, this is not handled by
+ * this module, but by direct calls from the calling code to receiver type
+ * specific functions.
+ *
+ * The DestReceiver object returned by CreateDestReceiver may be a statically
+ * allocated object (for destination types that require no local state),
+ * in which case rDestroy is a no-op.  Alternatively it can be a palloc'd
+ * object that has DestReceiver as its first field and contains additional
+ * fields (see printtup.c for an example).  These additional fields are then
+ * accessible to the DestReceiver functions by casting the DestReceiver*
+ * pointer passed to them.  The palloc'd object is pfree'd by the rDestroy
+ * method.  Note that the caller of CreateDestReceiver should take care to
+ * do so in a memory context that is long-lived enough for the receiver
+ * object not to disappear while still needed.
+ *
+ * Special provision: None_Receiver is a permanently available receiver
+ * object for the DestNone destination.  This avoids useless creation/destroy
+ * calls in portal and cursor manipulations.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/tcop/dest.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef DEST_H
+#define DEST_H
+
+#include "executor/tuptable.h"
+
+
+/* buffer size to use for command completion tags */
+#define COMPLETION_TAG_BUFSIZE	64
+
+
+/* ----------------
+ *		CommandDest is a simplistic means of identifying the desired
+ *		destination.  Someday this will probably need to be improved.
+ *
+ * Note: only the values DestNone, DestDebug, DestRemote are legal for the
+ * global variable whereToSendOutput.   The other values may be used
+ * as the destination for individual commands.
+ * ----------------
+ */
+typedef enum
+{
+	DestNone,					/* results are discarded */
+	DestDebug,					/* results go to debugging output */
+	DestRemote,					/* results sent to frontend process */
+	DestRemoteExecute,			/* sent to frontend, in Execute command */
+	DestSPI,					/* results sent to SPI manager */
+	DestTuplestore,				/* results sent to Tuplestore */
+	DestIntoRel,				/* results sent to relation (SELECT INTO) */
+	DestCopyOut,				/* results sent to COPY TO code */
+	DestSQLFunction,			/* results sent to SQL-language func mgr */
+	DestTransientRel			/* results sent to transient relation */
+} CommandDest;
+
+/* ----------------
+ *		DestReceiver is a base type for destination-specific local state.
+ *		In the simplest cases, there is no state info, just the function
+ *		pointers that the executor must call.
+ *
+ * Note: the receiveSlot routine must be passed a slot containing a TupleDesc
+ * identical to the one given to the rStartup routine.
+ * ----------------
+ */
+typedef struct _DestReceiver DestReceiver;
+
+struct _DestReceiver
+{
+	/* Called for each tuple to be output: */
+	void		(*receiveSlot) (TupleTableSlot *slot,
+											DestReceiver *self);
+	/* Per-executor-run initialization and shutdown: */
+	void		(*rStartup) (DestReceiver *self,
+										 int operation,
+										 TupleDesc typeinfo);
+	void		(*rShutdown) (DestReceiver *self);
+	/* Destroy the receiver object itself (if dynamically allocated) */
+	void		(*rDestroy) (DestReceiver *self);
+	/* CommandDest code for this receiver */
+	CommandDest mydest;
+	/* Private fields might appear beyond this point... */
+};
+
+extern DestReceiver *None_Receiver;		/* permanent receiver for DestNone */
+
+/* The primary destination management functions */
+
+extern void BeginCommand(const char *commandTag, CommandDest dest);
+extern DestReceiver *CreateDestReceiver(CommandDest dest);
+extern void EndCommand(const char *commandTag, CommandDest dest);
+
+/* Additional functions that go with destination management, more or less. */
+
+extern void NullCommand(CommandDest dest);
+extern void ReadyForQuery(CommandDest dest);
+
+#endif   /* DEST_H */
diff --git a/foreign/libpg_query/src/postgres/include/tcop/fastpath.h b/foreign/libpg_query/src/postgres/include/tcop/fastpath.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/tcop/fastpath.h
@@ -0,0 +1,21 @@
+/*-------------------------------------------------------------------------
+ *
+ * fastpath.h
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/tcop/fastpath.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef FASTPATH_H
+#define FASTPATH_H
+
+#include "lib/stringinfo.h"
+
+extern int	GetOldFunctionMessage(StringInfo buf);
+extern int	HandleFunctionRequest(StringInfo msgBuf);
+
+#endif   /* FASTPATH_H */
diff --git a/foreign/libpg_query/src/postgres/include/tcop/pquery.h b/foreign/libpg_query/src/postgres/include/tcop/pquery.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/tcop/pquery.h
@@ -0,0 +1,45 @@
+/*-------------------------------------------------------------------------
+ *
+ * pquery.h
+ *	  prototypes for pquery.c.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/tcop/pquery.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PQUERY_H
+#define PQUERY_H
+
+#include "nodes/parsenodes.h"
+#include "utils/portal.h"
+
+
+extern PGDLLIMPORT Portal ActivePortal;
+
+
+extern PortalStrategy ChoosePortalStrategy(List *stmts);
+
+extern List *FetchPortalTargetList(Portal portal);
+
+extern List *FetchStatementTargetList(Node *stmt);
+
+extern void PortalStart(Portal portal, ParamListInfo params,
+			int eflags, Snapshot snapshot);
+
+extern void PortalSetResultFormat(Portal portal, int nFormats,
+					  int16 *formats);
+
+extern bool PortalRun(Portal portal, long count, bool isTopLevel,
+		  DestReceiver *dest, DestReceiver *altdest,
+		  char *completionTag);
+
+extern long PortalRunFetch(Portal portal,
+			   FetchDirection fdirection,
+			   long count,
+			   DestReceiver *dest);
+
+#endif   /* PQUERY_H */
diff --git a/foreign/libpg_query/src/postgres/include/tcop/tcopprot.h b/foreign/libpg_query/src/postgres/include/tcop/tcopprot.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/tcop/tcopprot.h
@@ -0,0 +1,88 @@
+/*-------------------------------------------------------------------------
+ *
+ * tcopprot.h
+ *	  prototypes for postgres.c.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/tcop/tcopprot.h
+ *
+ * OLD COMMENTS
+ *	  This file was created so that other c files could get the two
+ *	  function prototypes without having to include tcop.h which single
+ *	  handedly includes the whole f*cking tree -- mer 5 Nov. 1991
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TCOPPROT_H
+#define TCOPPROT_H
+
+#include "nodes/params.h"
+#include "nodes/parsenodes.h"
+#include "nodes/plannodes.h"
+#include "storage/procsignal.h"
+#include "utils/guc.h"
+
+
+/* Required daylight between max_stack_depth and the kernel limit, in bytes */
+#define STACK_DEPTH_SLOP (512 * 1024L)
+
+extern __thread  CommandDest whereToSendOutput;
+extern PGDLLIMPORT __thread const char *debug_query_string;
+extern __thread  int max_stack_depth;
+extern int	PostAuthDelay;
+
+/* GUC-configurable parameters */
+
+typedef enum
+{
+	LOGSTMT_NONE,				/* log no statements */
+	LOGSTMT_DDL,				/* log data definition statements */
+	LOGSTMT_MOD,				/* log modification statements, plus DDL */
+	LOGSTMT_ALL					/* log all statements */
+} LogStmtLevel;
+
+extern int	log_statement;
+
+extern List *pg_parse_query(const char *query_string);
+extern List *pg_analyze_and_rewrite(Node *parsetree, const char *query_string,
+					   Oid *paramTypes, int numParams);
+extern List *pg_analyze_and_rewrite_params(Node *parsetree,
+							  const char *query_string,
+							  ParserSetupHook parserSetup,
+							  void *parserSetupArg);
+extern PlannedStmt *pg_plan_query(Query *querytree, int cursorOptions,
+			  ParamListInfo boundParams);
+extern List *pg_plan_queries(List *querytrees, int cursorOptions,
+				ParamListInfo boundParams);
+
+extern bool check_max_stack_depth(int *newval, void **extra, GucSource source);
+extern void assign_max_stack_depth(int newval, void *extra);
+
+extern void die(SIGNAL_ARGS);
+extern void quickdie(SIGNAL_ARGS) pg_attribute_noreturn();
+extern void StatementCancelHandler(SIGNAL_ARGS);
+extern void FloatExceptionHandler(SIGNAL_ARGS) pg_attribute_noreturn();
+extern void RecoveryConflictInterrupt(ProcSignalReason reason); /* called from SIGUSR1
+																 * handler */
+extern void ProcessClientReadInterrupt(bool blocked);
+extern void ProcessClientWriteInterrupt(bool blocked);
+
+extern void process_postgres_switches(int argc, char *argv[],
+						  GucContext ctx, const char **dbname);
+extern void PostgresMain(int argc, char *argv[],
+			 const char *dbname,
+			 const char *username) pg_attribute_noreturn();
+extern long get_stack_depth_rlimit(void);
+extern void ResetUsage(void);
+extern void ShowUsage(const char *title);
+extern int	check_log_duration(char *msec_str, bool was_logged);
+extern void set_debug_options(int debug_flag,
+				  GucContext context, GucSource source);
+extern bool set_plan_disabling_options(const char *arg,
+						   GucContext context, GucSource source);
+extern const char *get_stats_option_name(const char *arg);
+
+#endif   /* TCOPPROT_H */
diff --git a/foreign/libpg_query/src/postgres/include/tcop/utility.h b/foreign/libpg_query/src/postgres/include/tcop/utility.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/tcop/utility.h
@@ -0,0 +1,52 @@
+/*-------------------------------------------------------------------------
+ *
+ * utility.h
+ *	  prototypes for utility.c.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/tcop/utility.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef UTILITY_H
+#define UTILITY_H
+
+#include "tcop/tcopprot.h"
+
+typedef enum
+{
+	PROCESS_UTILITY_TOPLEVEL,	/* toplevel interactive command */
+	PROCESS_UTILITY_QUERY,		/* a complete query, but not toplevel */
+	PROCESS_UTILITY_SUBCOMMAND	/* a portion of a query */
+} ProcessUtilityContext;
+
+/* Hook for plugins to get control in ProcessUtility() */
+typedef void (*ProcessUtility_hook_type) (Node *parsetree,
+					  const char *queryString, ProcessUtilityContext context,
+													  ParamListInfo params,
+									DestReceiver *dest, char *completionTag);
+extern PGDLLIMPORT ProcessUtility_hook_type ProcessUtility_hook;
+
+extern void ProcessUtility(Node *parsetree, const char *queryString,
+			   ProcessUtilityContext context, ParamListInfo params,
+			   DestReceiver *dest, char *completionTag);
+extern void standard_ProcessUtility(Node *parsetree, const char *queryString,
+						ProcessUtilityContext context, ParamListInfo params,
+						DestReceiver *dest, char *completionTag);
+
+extern bool UtilityReturnsTuples(Node *parsetree);
+
+extern TupleDesc UtilityTupleDescriptor(Node *parsetree);
+
+extern Query *UtilityContainsQuery(Node *parsetree);
+
+extern const char *CreateCommandTag(Node *parsetree);
+
+extern LogStmtLevel GetCommandLogLevel(Node *parsetree);
+
+extern bool CommandIsReadOnly(Node *parsetree);
+
+#endif   /* UTILITY_H */
diff --git a/foreign/libpg_query/src/postgres/include/tsearch/ts_cache.h b/foreign/libpg_query/src/postgres/include/tsearch/ts_cache.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/tsearch/ts_cache.h
@@ -0,0 +1,98 @@
+/*-------------------------------------------------------------------------
+ *
+ * ts_cache.h
+ *	  Tsearch related object caches.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/tsearch/ts_cache.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TS_CACHE_H
+#define TS_CACHE_H
+
+#include "utils/guc.h"
+
+
+/*
+ * All TS*CacheEntry structs must share this common header
+ * (see InvalidateTSCacheCallBack)
+ */
+typedef struct TSAnyCacheEntry
+{
+	Oid			objId;
+	bool		isvalid;
+} TSAnyCacheEntry;
+
+
+typedef struct TSParserCacheEntry
+{
+	/* prsId is the hash lookup key and MUST BE FIRST */
+	Oid			prsId;			/* OID of the parser */
+	bool		isvalid;
+
+	Oid			startOid;
+	Oid			tokenOid;
+	Oid			endOid;
+	Oid			headlineOid;
+	Oid			lextypeOid;
+
+	/*
+	 * Pre-set-up fmgr call of most needed parser's methods
+	 */
+	FmgrInfo	prsstart;
+	FmgrInfo	prstoken;
+	FmgrInfo	prsend;
+	FmgrInfo	prsheadline;
+} TSParserCacheEntry;
+
+typedef struct TSDictionaryCacheEntry
+{
+	/* dictId is the hash lookup key and MUST BE FIRST */
+	Oid			dictId;
+	bool		isvalid;
+
+	/* most frequent fmgr call */
+	Oid			lexizeOid;
+	FmgrInfo	lexize;
+
+	MemoryContext dictCtx;		/* memory context to store private data */
+	void	   *dictData;
+} TSDictionaryCacheEntry;
+
+typedef struct
+{
+	int			len;
+	Oid		   *dictIds;
+} ListDictionary;
+
+typedef struct
+{
+	/* cfgId is the hash lookup key and MUST BE FIRST */
+	Oid			cfgId;
+	bool		isvalid;
+
+	Oid			prsId;
+
+	int			lenmap;
+	ListDictionary *map;
+} TSConfigCacheEntry;
+
+
+/*
+ * GUC variable for current configuration
+ */
+extern char *TSCurrentConfig;
+
+
+extern TSParserCacheEntry *lookup_ts_parser_cache(Oid prsId);
+extern TSDictionaryCacheEntry *lookup_ts_dictionary_cache(Oid dictId);
+extern TSConfigCacheEntry *lookup_ts_config_cache(Oid cfgId);
+
+extern Oid	getTSCurrentConfig(bool emitError);
+extern bool check_TSCurrentConfig(char **newval, void **extra, GucSource source);
+extern void assign_TSCurrentConfig(const char *newval, void *extra);
+
+#endif   /* TS_CACHE_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/acl.h b/foreign/libpg_query/src/postgres/include/utils/acl.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/acl.h
@@ -0,0 +1,336 @@
+/*-------------------------------------------------------------------------
+ *
+ * acl.h
+ *	  Definition of (and support for) access control list data structures.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/acl.h
+ *
+ * NOTES
+ *	  An ACL array is simply an array of AclItems, representing the union
+ *	  of the privileges represented by the individual items.  A zero-length
+ *	  array represents "no privileges".  There are no assumptions about the
+ *	  ordering of the items, but we do expect that there are no two entries
+ *	  in the array with the same grantor and grantee.
+ *
+ *	  For backward-compatibility purposes we have to allow null ACL entries
+ *	  in system catalogs.  A null ACL will be treated as meaning "default
+ *	  protection" (i.e., whatever acldefault() returns).
+ *-------------------------------------------------------------------------
+ */
+#ifndef ACL_H
+#define ACL_H
+
+#include "access/htup.h"
+#include "nodes/parsenodes.h"
+#include "utils/array.h"
+#include "utils/snapshot.h"
+
+
+/*
+ * typedef AclMode is declared in parsenodes.h, also the individual privilege
+ * bit meanings are defined there
+ */
+
+#define ACL_ID_PUBLIC	0		/* placeholder for id in a PUBLIC acl item */
+
+/*
+ * AclItem
+ *
+ * Note: must be same size on all platforms, because the size is hardcoded
+ * in the pg_type.h entry for aclitem.
+ */
+typedef struct AclItem
+{
+	Oid			ai_grantee;		/* ID that this item grants privs to */
+	Oid			ai_grantor;		/* grantor of privs */
+	AclMode		ai_privs;		/* privilege bits */
+} AclItem;
+
+/*
+ * The upper 16 bits of the ai_privs field of an AclItem are the grant option
+ * bits, and the lower 16 bits are the actual privileges.  We use "rights"
+ * to mean the combined grant option and privilege bits fields.
+ */
+#define ACLITEM_GET_PRIVS(item)    ((item).ai_privs & 0xFFFF)
+#define ACLITEM_GET_GOPTIONS(item) (((item).ai_privs >> 16) & 0xFFFF)
+#define ACLITEM_GET_RIGHTS(item)   ((item).ai_privs)
+
+#define ACL_GRANT_OPTION_FOR(privs) (((AclMode) (privs) & 0xFFFF) << 16)
+#define ACL_OPTION_TO_PRIVS(privs)	(((AclMode) (privs) >> 16) & 0xFFFF)
+
+#define ACLITEM_SET_PRIVS(item,privs) \
+  ((item).ai_privs = ((item).ai_privs & ~((AclMode) 0xFFFF)) | \
+					 ((AclMode) (privs) & 0xFFFF))
+#define ACLITEM_SET_GOPTIONS(item,goptions) \
+  ((item).ai_privs = ((item).ai_privs & ~(((AclMode) 0xFFFF) << 16)) | \
+					 (((AclMode) (goptions) & 0xFFFF) << 16))
+#define ACLITEM_SET_RIGHTS(item,rights) \
+  ((item).ai_privs = (AclMode) (rights))
+
+#define ACLITEM_SET_PRIVS_GOPTIONS(item,privs,goptions) \
+  ((item).ai_privs = ((AclMode) (privs) & 0xFFFF) | \
+					 (((AclMode) (goptions) & 0xFFFF) << 16))
+
+
+#define ACLITEM_ALL_PRIV_BITS		((AclMode) 0xFFFF)
+#define ACLITEM_ALL_GOPTION_BITS	((AclMode) 0xFFFF << 16)
+
+/*
+ * Definitions for convenient access to Acl (array of AclItem).
+ * These are standard PostgreSQL arrays, but are restricted to have one
+ * dimension and no nulls.  We also ignore the lower bound when reading,
+ * and set it to one when writing.
+ *
+ * CAUTION: as of PostgreSQL 7.1, these arrays are toastable (just like all
+ * other array types).  Therefore, be careful to detoast them with the
+ * macros provided, unless you know for certain that a particular array
+ * can't have been toasted.
+ */
+
+
+/*
+ * Acl			a one-dimensional array of AclItem
+ */
+typedef ArrayType Acl;
+
+#define ACL_NUM(ACL)			(ARR_DIMS(ACL)[0])
+#define ACL_DAT(ACL)			((AclItem *) ARR_DATA_PTR(ACL))
+#define ACL_N_SIZE(N)			(ARR_OVERHEAD_NONULLS(1) + ((N) * sizeof(AclItem)))
+#define ACL_SIZE(ACL)			ARR_SIZE(ACL)
+
+/*
+ * fmgr macros for these types
+ */
+#define DatumGetAclItemP(X)		   ((AclItem *) DatumGetPointer(X))
+#define PG_GETARG_ACLITEM_P(n)	   DatumGetAclItemP(PG_GETARG_DATUM(n))
+#define PG_RETURN_ACLITEM_P(x)	   PG_RETURN_POINTER(x)
+
+#define DatumGetAclP(X)			   ((Acl *) PG_DETOAST_DATUM(X))
+#define DatumGetAclPCopy(X)		   ((Acl *) PG_DETOAST_DATUM_COPY(X))
+#define PG_GETARG_ACL_P(n)		   DatumGetAclP(PG_GETARG_DATUM(n))
+#define PG_GETARG_ACL_P_COPY(n)    DatumGetAclPCopy(PG_GETARG_DATUM(n))
+#define PG_RETURN_ACL_P(x)		   PG_RETURN_POINTER(x)
+
+/*
+ * ACL modification opcodes for aclupdate
+ */
+#define ACL_MODECHG_ADD			1
+#define ACL_MODECHG_DEL			2
+#define ACL_MODECHG_EQL			3
+
+/*
+ * External representations of the privilege bits --- aclitemin/aclitemout
+ * represent each possible privilege bit with a distinct 1-character code
+ */
+#define ACL_INSERT_CHR			'a'		/* formerly known as "append" */
+#define ACL_SELECT_CHR			'r'		/* formerly known as "read" */
+#define ACL_UPDATE_CHR			'w'		/* formerly known as "write" */
+#define ACL_DELETE_CHR			'd'
+#define ACL_TRUNCATE_CHR		'D'		/* super-delete, as it were */
+#define ACL_REFERENCES_CHR		'x'
+#define ACL_TRIGGER_CHR			't'
+#define ACL_EXECUTE_CHR			'X'
+#define ACL_USAGE_CHR			'U'
+#define ACL_CREATE_CHR			'C'
+#define ACL_CREATE_TEMP_CHR		'T'
+#define ACL_CONNECT_CHR			'c'
+
+/* string holding all privilege code chars, in order by bitmask position */
+#define ACL_ALL_RIGHTS_STR	"arwdDxtXUCTc"
+
+/*
+ * Bitmasks defining "all rights" for each supported object type
+ */
+#define ACL_ALL_RIGHTS_COLUMN		(ACL_INSERT|ACL_SELECT|ACL_UPDATE|ACL_REFERENCES)
+#define ACL_ALL_RIGHTS_RELATION		(ACL_INSERT|ACL_SELECT|ACL_UPDATE|ACL_DELETE|ACL_TRUNCATE|ACL_REFERENCES|ACL_TRIGGER)
+#define ACL_ALL_RIGHTS_SEQUENCE		(ACL_USAGE|ACL_SELECT|ACL_UPDATE)
+#define ACL_ALL_RIGHTS_DATABASE		(ACL_CREATE|ACL_CREATE_TEMP|ACL_CONNECT)
+#define ACL_ALL_RIGHTS_FDW			(ACL_USAGE)
+#define ACL_ALL_RIGHTS_FOREIGN_SERVER (ACL_USAGE)
+#define ACL_ALL_RIGHTS_FUNCTION		(ACL_EXECUTE)
+#define ACL_ALL_RIGHTS_LANGUAGE		(ACL_USAGE)
+#define ACL_ALL_RIGHTS_LARGEOBJECT	(ACL_SELECT|ACL_UPDATE)
+#define ACL_ALL_RIGHTS_NAMESPACE	(ACL_USAGE|ACL_CREATE)
+#define ACL_ALL_RIGHTS_TABLESPACE	(ACL_CREATE)
+#define ACL_ALL_RIGHTS_TYPE			(ACL_USAGE)
+
+/* operation codes for pg_*_aclmask */
+typedef enum
+{
+	ACLMASK_ALL,				/* normal case: compute all bits */
+	ACLMASK_ANY					/* return when result is known nonzero */
+} AclMaskHow;
+
+/* result codes for pg_*_aclcheck */
+typedef enum
+{
+	ACLCHECK_OK = 0,
+	ACLCHECK_NO_PRIV,
+	ACLCHECK_NOT_OWNER
+} AclResult;
+
+/* this enum covers all object types that can have privilege errors */
+/* currently it's only used to tell aclcheck_error what to say */
+typedef enum AclObjectKind
+{
+	ACL_KIND_COLUMN,			/* pg_attribute */
+	ACL_KIND_CLASS,				/* pg_class */
+	ACL_KIND_SEQUENCE,			/* pg_sequence */
+	ACL_KIND_DATABASE,			/* pg_database */
+	ACL_KIND_PROC,				/* pg_proc */
+	ACL_KIND_OPER,				/* pg_operator */
+	ACL_KIND_TYPE,				/* pg_type */
+	ACL_KIND_LANGUAGE,			/* pg_language */
+	ACL_KIND_LARGEOBJECT,		/* pg_largeobject */
+	ACL_KIND_NAMESPACE,			/* pg_namespace */
+	ACL_KIND_OPCLASS,			/* pg_opclass */
+	ACL_KIND_OPFAMILY,			/* pg_opfamily */
+	ACL_KIND_COLLATION,			/* pg_collation */
+	ACL_KIND_CONVERSION,		/* pg_conversion */
+	ACL_KIND_TABLESPACE,		/* pg_tablespace */
+	ACL_KIND_TSDICTIONARY,		/* pg_ts_dict */
+	ACL_KIND_TSCONFIGURATION,	/* pg_ts_config */
+	ACL_KIND_FDW,				/* pg_foreign_data_wrapper */
+	ACL_KIND_FOREIGN_SERVER,	/* pg_foreign_server */
+	ACL_KIND_EVENT_TRIGGER,		/* pg_event_trigger */
+	ACL_KIND_EXTENSION,			/* pg_extension */
+	MAX_ACL_KIND				/* MUST BE LAST */
+} AclObjectKind;
+
+
+/*
+ * routines used internally
+ */
+extern Acl *acldefault(GrantObjectType objtype, Oid ownerId);
+extern Acl *get_user_default_acl(GrantObjectType objtype, Oid ownerId,
+					 Oid nsp_oid);
+
+extern Acl *aclupdate(const Acl *old_acl, const AclItem *mod_aip,
+		  int modechg, Oid ownerId, DropBehavior behavior);
+extern Acl *aclnewowner(const Acl *old_acl, Oid oldOwnerId, Oid newOwnerId);
+extern Acl *make_empty_acl(void);
+extern Acl *aclcopy(const Acl *orig_acl);
+extern Acl *aclconcat(const Acl *left_acl, const Acl *right_acl);
+extern Acl *aclmerge(const Acl *left_acl, const Acl *right_acl, Oid ownerId);
+extern void aclitemsort(Acl *acl);
+extern bool aclequal(const Acl *left_acl, const Acl *right_acl);
+
+extern AclMode aclmask(const Acl *acl, Oid roleid, Oid ownerId,
+		AclMode mask, AclMaskHow how);
+extern int	aclmembers(const Acl *acl, Oid **roleids);
+
+extern bool has_privs_of_role(Oid member, Oid role);
+extern bool is_member_of_role(Oid member, Oid role);
+extern bool is_member_of_role_nosuper(Oid member, Oid role);
+extern bool is_admin_of_role(Oid member, Oid role);
+extern void check_is_member_of_role(Oid member, Oid role);
+extern Oid	get_role_oid(const char *rolename, bool missing_ok);
+extern Oid	get_role_oid_or_public(const char *rolename);
+extern Oid	get_rolespec_oid(const Node *node, bool missing_ok);
+extern HeapTuple get_rolespec_tuple(const Node *node);
+extern char *get_rolespec_name(const Node *node);
+
+extern void select_best_grantor(Oid roleId, AclMode privileges,
+					const Acl *acl, Oid ownerId,
+					Oid *grantorId, AclMode *grantOptions);
+
+extern void initialize_acl(void);
+
+/*
+ * SQL functions (from acl.c)
+ */
+extern Datum aclitemin(PG_FUNCTION_ARGS);
+extern Datum aclitemout(PG_FUNCTION_ARGS);
+extern Datum aclinsert(PG_FUNCTION_ARGS);
+extern Datum aclremove(PG_FUNCTION_ARGS);
+extern Datum aclcontains(PG_FUNCTION_ARGS);
+extern Datum makeaclitem(PG_FUNCTION_ARGS);
+extern Datum aclitem_eq(PG_FUNCTION_ARGS);
+extern Datum hash_aclitem(PG_FUNCTION_ARGS);
+extern Datum acldefault_sql(PG_FUNCTION_ARGS);
+extern Datum aclexplode(PG_FUNCTION_ARGS);
+
+/*
+ * prototypes for functions in aclchk.c
+ */
+extern void ExecuteGrantStmt(GrantStmt *stmt);
+extern void ExecAlterDefaultPrivilegesStmt(AlterDefaultPrivilegesStmt *stmt);
+
+extern void RemoveRoleFromObjectACL(Oid roleid, Oid classid, Oid objid);
+extern void RemoveDefaultACLById(Oid defaclOid);
+
+extern AclMode pg_attribute_aclmask(Oid table_oid, AttrNumber attnum,
+					 Oid roleid, AclMode mask, AclMaskHow how);
+extern AclMode pg_class_aclmask(Oid table_oid, Oid roleid,
+				 AclMode mask, AclMaskHow how);
+extern AclMode pg_database_aclmask(Oid db_oid, Oid roleid,
+					AclMode mask, AclMaskHow how);
+extern AclMode pg_proc_aclmask(Oid proc_oid, Oid roleid,
+				AclMode mask, AclMaskHow how);
+extern AclMode pg_language_aclmask(Oid lang_oid, Oid roleid,
+					AclMode mask, AclMaskHow how);
+extern AclMode pg_largeobject_aclmask_snapshot(Oid lobj_oid, Oid roleid,
+							AclMode mask, AclMaskHow how, Snapshot snapshot);
+extern AclMode pg_namespace_aclmask(Oid nsp_oid, Oid roleid,
+					 AclMode mask, AclMaskHow how);
+extern AclMode pg_tablespace_aclmask(Oid spc_oid, Oid roleid,
+					  AclMode mask, AclMaskHow how);
+extern AclMode pg_foreign_data_wrapper_aclmask(Oid fdw_oid, Oid roleid,
+								AclMode mask, AclMaskHow how);
+extern AclMode pg_foreign_server_aclmask(Oid srv_oid, Oid roleid,
+						  AclMode mask, AclMaskHow how);
+extern AclMode pg_type_aclmask(Oid type_oid, Oid roleid,
+				AclMode mask, AclMaskHow how);
+
+extern AclResult pg_attribute_aclcheck(Oid table_oid, AttrNumber attnum,
+					  Oid roleid, AclMode mode);
+extern AclResult pg_attribute_aclcheck_all(Oid table_oid, Oid roleid,
+						  AclMode mode, AclMaskHow how);
+extern AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode);
+extern AclResult pg_database_aclcheck(Oid db_oid, Oid roleid, AclMode mode);
+extern AclResult pg_proc_aclcheck(Oid proc_oid, Oid roleid, AclMode mode);
+extern AclResult pg_language_aclcheck(Oid lang_oid, Oid roleid, AclMode mode);
+extern AclResult pg_largeobject_aclcheck_snapshot(Oid lang_oid, Oid roleid,
+								 AclMode mode, Snapshot snapshot);
+extern AclResult pg_namespace_aclcheck(Oid nsp_oid, Oid roleid, AclMode mode);
+extern AclResult pg_tablespace_aclcheck(Oid spc_oid, Oid roleid, AclMode mode);
+extern AclResult pg_foreign_data_wrapper_aclcheck(Oid fdw_oid, Oid roleid, AclMode mode);
+extern AclResult pg_foreign_server_aclcheck(Oid srv_oid, Oid roleid, AclMode mode);
+extern AclResult pg_type_aclcheck(Oid type_oid, Oid roleid, AclMode mode);
+
+extern void aclcheck_error(AclResult aclerr, AclObjectKind objectkind,
+			   const char *objectname);
+
+extern void aclcheck_error_col(AclResult aclerr, AclObjectKind objectkind,
+				   const char *objectname, const char *colname);
+
+extern void aclcheck_error_type(AclResult aclerr, Oid typeOid);
+
+/* ownercheck routines just return true (owner) or false (not) */
+extern bool pg_class_ownercheck(Oid class_oid, Oid roleid);
+extern bool pg_type_ownercheck(Oid type_oid, Oid roleid);
+extern bool pg_oper_ownercheck(Oid oper_oid, Oid roleid);
+extern bool pg_proc_ownercheck(Oid proc_oid, Oid roleid);
+extern bool pg_language_ownercheck(Oid lan_oid, Oid roleid);
+extern bool pg_largeobject_ownercheck(Oid lobj_oid, Oid roleid);
+extern bool pg_namespace_ownercheck(Oid nsp_oid, Oid roleid);
+extern bool pg_tablespace_ownercheck(Oid spc_oid, Oid roleid);
+extern bool pg_opclass_ownercheck(Oid opc_oid, Oid roleid);
+extern bool pg_opfamily_ownercheck(Oid opf_oid, Oid roleid);
+extern bool pg_database_ownercheck(Oid db_oid, Oid roleid);
+extern bool pg_collation_ownercheck(Oid coll_oid, Oid roleid);
+extern bool pg_conversion_ownercheck(Oid conv_oid, Oid roleid);
+extern bool pg_ts_dict_ownercheck(Oid dict_oid, Oid roleid);
+extern bool pg_ts_config_ownercheck(Oid cfg_oid, Oid roleid);
+extern bool pg_foreign_data_wrapper_ownercheck(Oid srv_oid, Oid roleid);
+extern bool pg_foreign_server_ownercheck(Oid srv_oid, Oid roleid);
+extern bool pg_event_trigger_ownercheck(Oid et_oid, Oid roleid);
+extern bool pg_extension_ownercheck(Oid ext_oid, Oid roleid);
+extern bool has_createrole_privilege(Oid roleid);
+extern bool has_bypassrls_privilege(Oid roleid);
+
+#endif   /* ACL_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/aclchk_internal.h b/foreign/libpg_query/src/postgres/include/utils/aclchk_internal.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/aclchk_internal.h
@@ -0,0 +1,45 @@
+/*-------------------------------------------------------------------------
+ *
+ * aclchk_internal.h
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/aclchk_internal.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef ACLCHK_INTERNAL_H
+#define ACLCHK_INTERNAL_H
+
+#include "nodes/parsenodes.h"
+#include "nodes/pg_list.h"
+
+/*
+ * The information about one Grant/Revoke statement, in internal format: object
+ * and grantees names have been turned into Oids, the privilege list is an
+ * AclMode bitmask.  If 'privileges' is ACL_NO_RIGHTS (the 0 value) and
+ * all_privs is true, 'privileges' will be internally set to the right kind of
+ * ACL_ALL_RIGHTS_*, depending on the object type (NB - this will modify the
+ * InternalGrant struct!)
+ *
+ * Note: 'all_privs' and 'privileges' represent object-level privileges only.
+ * There might also be column-level privilege specifications, which are
+ * represented in col_privs (this is a list of untransformed AccessPriv nodes).
+ * Column privileges are only valid for objtype ACL_OBJECT_RELATION.
+ */
+typedef struct
+{
+	bool		is_grant;
+	GrantObjectType objtype;
+	List	   *objects;
+	bool		all_privs;
+	AclMode		privileges;
+	List	   *col_privs;
+	List	   *grantees;
+	bool		grant_option;
+	DropBehavior behavior;
+} InternalGrant;
+
+
+#endif   /* ACLCHK_INTERNAL_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/array.h b/foreign/libpg_query/src/postgres/include/utils/array.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/array.h
@@ -0,0 +1,503 @@
+/*-------------------------------------------------------------------------
+ *
+ * array.h
+ *	  Declarations for Postgres arrays.
+ *
+ * A standard varlena array has the following internal structure:
+ *	  <vl_len_>		- standard varlena header word
+ *	  <ndim>		- number of dimensions of the array
+ *	  <dataoffset>	- offset to stored data, or 0 if no nulls bitmap
+ *	  <elemtype>	- element type OID
+ *	  <dimensions>	- length of each array axis (C array of int)
+ *	  <lower bnds>	- lower boundary of each dimension (C array of int)
+ *	  <null bitmap> - bitmap showing locations of nulls (OPTIONAL)
+ *	  <actual data> - whatever is the stored data
+ *
+ * The <dimensions> and <lower bnds> arrays each have ndim elements.
+ *
+ * The <null bitmap> may be omitted if the array contains no NULL elements.
+ * If it is absent, the <dataoffset> field is zero and the offset to the
+ * stored data must be computed on-the-fly.  If the bitmap is present,
+ * <dataoffset> is nonzero and is equal to the offset from the array start
+ * to the first data element (including any alignment padding).  The bitmap
+ * follows the same conventions as tuple null bitmaps, ie, a 1 indicates
+ * a non-null entry and the LSB of each bitmap byte is used first.
+ *
+ * The actual data starts on a MAXALIGN boundary.  Individual items in the
+ * array are aligned as specified by the array element type.  They are
+ * stored in row-major order (last subscript varies most rapidly).
+ *
+ * NOTE: it is important that array elements of toastable datatypes NOT be
+ * toasted, since the tupletoaster won't know they are there.  (We could
+ * support compressed toasted items; only out-of-line items are dangerous.
+ * However, it seems preferable to store such items uncompressed and allow
+ * the toaster to compress the whole array as one input.)
+ *
+ *
+ * The OIDVECTOR and INT2VECTOR datatypes are storage-compatible with
+ * generic arrays, but they support only one-dimensional arrays with no
+ * nulls (and no null bitmap).
+ *
+ * There are also some "fixed-length array" datatypes, such as NAME and
+ * POINT.  These are simply a sequence of a fixed number of items each
+ * of a fixed-length datatype, with no overhead; the item size must be
+ * a multiple of its alignment requirement, because we do no padding.
+ * We support subscripting on these types, but array_in() and array_out()
+ * only work with varlena arrays.
+ *
+ * In addition, arrays are a major user of the "expanded object" TOAST
+ * infrastructure.  This allows a varlena array to be converted to a
+ * separate representation that may include "deconstructed" Datum/isnull
+ * arrays holding the elements.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/array.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef ARRAY_H
+#define ARRAY_H
+
+#include "fmgr.h"
+#include "utils/expandeddatum.h"
+
+
+/*
+ * Arrays are varlena objects, so must meet the varlena convention that
+ * the first int32 of the object contains the total object size in bytes.
+ * Be sure to use VARSIZE() and SET_VARSIZE() to access it, though!
+ *
+ * CAUTION: if you change the header for ordinary arrays you will also
+ * need to change the headers for oidvector and int2vector!
+ */
+typedef struct
+{
+	int32		vl_len_;		/* varlena header (do not touch directly!) */
+	int			ndim;			/* # of dimensions */
+	int32		dataoffset;		/* offset to data, or 0 if no bitmap */
+	Oid			elemtype;		/* element type OID */
+} ArrayType;
+
+/*
+ * An expanded array is contained within a private memory context (as
+ * all expanded objects must be) and has a control structure as below.
+ *
+ * The expanded array might contain a regular "flat" array if that was the
+ * original input and we've not modified it significantly.  Otherwise, the
+ * contents are represented by Datum/isnull arrays plus dimensionality and
+ * type information.  We could also have both forms, if we've deconstructed
+ * the original array for access purposes but not yet changed it.  For pass-
+ * by-reference element types, the Datums would point into the flat array in
+ * this situation.  Once we start modifying array elements, new pass-by-ref
+ * elements are separately palloc'd within the memory context.
+ */
+#define EA_MAGIC 689375833		/* ID for debugging crosschecks */
+
+typedef struct ExpandedArrayHeader
+{
+	/* Standard header for expanded objects */
+	ExpandedObjectHeader hdr;
+
+	/* Magic value identifying an expanded array (for debugging only) */
+	int			ea_magic;
+
+	/* Dimensionality info (always valid) */
+	int			ndims;			/* # of dimensions */
+	int		   *dims;			/* array dimensions */
+	int		   *lbound;			/* index lower bounds for each dimension */
+
+	/* Element type info (always valid) */
+	Oid			element_type;	/* element type OID */
+	int16		typlen;			/* needed info about element datatype */
+	bool		typbyval;
+	char		typalign;
+
+	/*
+	 * If we have a Datum-array representation of the array, it's kept here;
+	 * else dvalues/dnulls are NULL.  The dvalues and dnulls arrays are always
+	 * palloc'd within the object private context, but may change size from
+	 * time to time.  For pass-by-ref element types, dvalues entries might
+	 * point either into the fstartptr..fendptr area, or to separately
+	 * palloc'd chunks.  Elements should always be fully detoasted, as they
+	 * are in the standard flat representation.
+	 *
+	 * Even when dvalues is valid, dnulls can be NULL if there are no null
+	 * elements.
+	 */
+	Datum	   *dvalues;		/* array of Datums */
+	bool	   *dnulls;			/* array of is-null flags for Datums */
+	int			dvalueslen;		/* allocated length of above arrays */
+	int			nelems;			/* number of valid entries in above arrays */
+
+	/*
+	 * flat_size is the current space requirement for the flat equivalent of
+	 * the expanded array, if known; otherwise it's 0.  We store this to make
+	 * consecutive calls of get_flat_size cheap.
+	 */
+	Size		flat_size;
+
+	/*
+	 * fvalue points to the flat representation if it is valid, else it is
+	 * NULL.  If we have or ever had a flat representation then
+	 * fstartptr/fendptr point to the start and end+1 of its data area; this
+	 * is so that we can tell which Datum pointers point into the flat
+	 * representation rather than being pointers to separately palloc'd data.
+	 */
+	ArrayType  *fvalue;			/* must be a fully detoasted array */
+	char	   *fstartptr;		/* start of its data area */
+	char	   *fendptr;		/* end+1 of its data area */
+} ExpandedArrayHeader;
+
+/*
+ * Functions that can handle either a "flat" varlena array or an expanded
+ * array use this union to work with their input.
+ */
+typedef union AnyArrayType
+{
+	ArrayType	flt;
+	ExpandedArrayHeader xpn;
+} AnyArrayType;
+
+/*
+ * working state for accumArrayResult() and friends
+ * note that the input must be scalars (legal array elements)
+ */
+typedef struct ArrayBuildState
+{
+	MemoryContext mcontext;		/* where all the temp stuff is kept */
+	Datum	   *dvalues;		/* array of accumulated Datums */
+	bool	   *dnulls;			/* array of is-null flags for Datums */
+	int			alen;			/* allocated length of above arrays */
+	int			nelems;			/* number of valid entries in above arrays */
+	Oid			element_type;	/* data type of the Datums */
+	int16		typlen;			/* needed info about datatype */
+	bool		typbyval;
+	char		typalign;
+	bool		private_cxt;	/* use private memory context */
+} ArrayBuildState;
+
+/*
+ * working state for accumArrayResultArr() and friends
+ * note that the input must be arrays, and the same array type is returned
+ */
+typedef struct ArrayBuildStateArr
+{
+	MemoryContext mcontext;		/* where all the temp stuff is kept */
+	char	   *data;			/* accumulated data */
+	bits8	   *nullbitmap;		/* bitmap of is-null flags, or NULL if none */
+	int			abytes;			/* allocated length of "data" */
+	int			nbytes;			/* number of bytes used so far */
+	int			aitems;			/* allocated length of bitmap (in elements) */
+	int			nitems;			/* total number of elements in result */
+	int			ndims;			/* current dimensions of result */
+	int			dims[MAXDIM];
+	int			lbs[MAXDIM];
+	Oid			array_type;		/* data type of the arrays */
+	Oid			element_type;	/* data type of the array elements */
+	bool		private_cxt;	/* use private memory context */
+} ArrayBuildStateArr;
+
+/*
+ * working state for accumArrayResultAny() and friends
+ * these functions handle both cases
+ */
+typedef struct ArrayBuildStateAny
+{
+	/* Exactly one of these is not NULL: */
+	ArrayBuildState *scalarstate;
+	ArrayBuildStateArr *arraystate;
+} ArrayBuildStateAny;
+
+/*
+ * structure to cache type metadata needed for array manipulation
+ */
+typedef struct ArrayMetaState
+{
+	Oid			element_type;
+	int16		typlen;
+	bool		typbyval;
+	char		typalign;
+	char		typdelim;
+	Oid			typioparam;
+	Oid			typiofunc;
+	FmgrInfo	proc;
+} ArrayMetaState;
+
+/*
+ * private state needed by array_map (here because caller must provide it)
+ */
+typedef struct ArrayMapState
+{
+	ArrayMetaState inp_extra;
+	ArrayMetaState ret_extra;
+} ArrayMapState;
+
+/* ArrayIteratorData is private in arrayfuncs.c */
+typedef struct ArrayIteratorData *ArrayIterator;
+
+/* fmgr macros for regular varlena array objects */
+#define DatumGetArrayTypeP(X)		  ((ArrayType *) PG_DETOAST_DATUM(X))
+#define DatumGetArrayTypePCopy(X)	  ((ArrayType *) PG_DETOAST_DATUM_COPY(X))
+#define PG_GETARG_ARRAYTYPE_P(n)	  DatumGetArrayTypeP(PG_GETARG_DATUM(n))
+#define PG_GETARG_ARRAYTYPE_P_COPY(n) DatumGetArrayTypePCopy(PG_GETARG_DATUM(n))
+#define PG_RETURN_ARRAYTYPE_P(x)	  PG_RETURN_POINTER(x)
+
+/* fmgr macros for expanded array objects */
+#define PG_GETARG_EXPANDED_ARRAY(n)  DatumGetExpandedArray(PG_GETARG_DATUM(n))
+#define PG_GETARG_EXPANDED_ARRAYX(n, metacache) \
+	DatumGetExpandedArrayX(PG_GETARG_DATUM(n), metacache)
+#define PG_RETURN_EXPANDED_ARRAY(x)  PG_RETURN_DATUM(EOHPGetRWDatum(&(x)->hdr))
+
+/* fmgr macros for AnyArrayType (ie, get either varlena or expanded form) */
+#define PG_GETARG_ANY_ARRAY(n)	DatumGetAnyArray(PG_GETARG_DATUM(n))
+
+/*
+ * Access macros for varlena array header fields.
+ *
+ * ARR_DIMS returns a pointer to an array of array dimensions (number of
+ * elements along the various array axes).
+ *
+ * ARR_LBOUND returns a pointer to an array of array lower bounds.
+ *
+ * That is: if the third axis of an array has elements 5 through 8, then
+ * ARR_DIMS(a)[2] == 4 and ARR_LBOUND(a)[2] == 5.
+ *
+ * Unlike C, the default lower bound is 1.
+ */
+#define ARR_SIZE(a)				VARSIZE(a)
+#define ARR_NDIM(a)				((a)->ndim)
+#define ARR_HASNULL(a)			((a)->dataoffset != 0)
+#define ARR_ELEMTYPE(a)			((a)->elemtype)
+
+#define ARR_DIMS(a) \
+		((int *) (((char *) (a)) + sizeof(ArrayType)))
+#define ARR_LBOUND(a) \
+		((int *) (((char *) (a)) + sizeof(ArrayType) + \
+				  sizeof(int) * ARR_NDIM(a)))
+
+#define ARR_NULLBITMAP(a) \
+		(ARR_HASNULL(a) ? \
+		 (bits8 *) (((char *) (a)) + sizeof(ArrayType) + \
+					2 * sizeof(int) * ARR_NDIM(a)) \
+		 : (bits8 *) NULL)
+
+/*
+ * The total array header size (in bytes) for an array with the specified
+ * number of dimensions and total number of items.
+ */
+#define ARR_OVERHEAD_NONULLS(ndims) \
+		MAXALIGN(sizeof(ArrayType) + 2 * sizeof(int) * (ndims))
+#define ARR_OVERHEAD_WITHNULLS(ndims, nitems) \
+		MAXALIGN(sizeof(ArrayType) + 2 * sizeof(int) * (ndims) + \
+				 ((nitems) + 7) / 8)
+
+#define ARR_DATA_OFFSET(a) \
+		(ARR_HASNULL(a) ? (a)->dataoffset : ARR_OVERHEAD_NONULLS(ARR_NDIM(a)))
+
+/*
+ * Returns a pointer to the actual array data.
+ */
+#define ARR_DATA_PTR(a) \
+		(((char *) (a)) + ARR_DATA_OFFSET(a))
+
+/*
+ * Macros for working with AnyArrayType inputs.  Beware multiple references!
+ */
+#define AARR_NDIM(a) \
+	(VARATT_IS_EXPANDED_HEADER(a) ? (a)->xpn.ndims : ARR_NDIM(&(a)->flt))
+#define AARR_HASNULL(a) \
+	(VARATT_IS_EXPANDED_HEADER(a) ? \
+	 ((a)->xpn.dvalues != NULL ? (a)->xpn.dnulls != NULL : ARR_HASNULL((a)->xpn.fvalue)) : \
+	 ARR_HASNULL(&(a)->flt))
+#define AARR_ELEMTYPE(a) \
+	(VARATT_IS_EXPANDED_HEADER(a) ? (a)->xpn.element_type : ARR_ELEMTYPE(&(a)->flt))
+#define AARR_DIMS(a) \
+	(VARATT_IS_EXPANDED_HEADER(a) ? (a)->xpn.dims : ARR_DIMS(&(a)->flt))
+#define AARR_LBOUND(a) \
+	(VARATT_IS_EXPANDED_HEADER(a) ? (a)->xpn.lbound : ARR_LBOUND(&(a)->flt))
+
+
+/*
+ * GUC parameter
+ */
+extern bool Array_nulls;
+
+/*
+ * prototypes for functions defined in arrayfuncs.c
+ */
+extern Datum array_in(PG_FUNCTION_ARGS);
+extern Datum array_out(PG_FUNCTION_ARGS);
+extern Datum array_recv(PG_FUNCTION_ARGS);
+extern Datum array_send(PG_FUNCTION_ARGS);
+extern Datum array_eq(PG_FUNCTION_ARGS);
+extern Datum array_ne(PG_FUNCTION_ARGS);
+extern Datum array_lt(PG_FUNCTION_ARGS);
+extern Datum array_gt(PG_FUNCTION_ARGS);
+extern Datum array_le(PG_FUNCTION_ARGS);
+extern Datum array_ge(PG_FUNCTION_ARGS);
+extern Datum btarraycmp(PG_FUNCTION_ARGS);
+extern Datum hash_array(PG_FUNCTION_ARGS);
+extern Datum arrayoverlap(PG_FUNCTION_ARGS);
+extern Datum arraycontains(PG_FUNCTION_ARGS);
+extern Datum arraycontained(PG_FUNCTION_ARGS);
+extern Datum array_ndims(PG_FUNCTION_ARGS);
+extern Datum array_dims(PG_FUNCTION_ARGS);
+extern Datum array_lower(PG_FUNCTION_ARGS);
+extern Datum array_upper(PG_FUNCTION_ARGS);
+extern Datum array_length(PG_FUNCTION_ARGS);
+extern Datum array_cardinality(PG_FUNCTION_ARGS);
+extern Datum array_larger(PG_FUNCTION_ARGS);
+extern Datum array_smaller(PG_FUNCTION_ARGS);
+extern Datum generate_subscripts(PG_FUNCTION_ARGS);
+extern Datum generate_subscripts_nodir(PG_FUNCTION_ARGS);
+extern Datum array_fill(PG_FUNCTION_ARGS);
+extern Datum array_fill_with_lower_bounds(PG_FUNCTION_ARGS);
+extern Datum array_unnest(PG_FUNCTION_ARGS);
+extern Datum array_remove(PG_FUNCTION_ARGS);
+extern Datum array_replace(PG_FUNCTION_ARGS);
+extern Datum width_bucket_array(PG_FUNCTION_ARGS);
+
+extern void CopyArrayEls(ArrayType *array,
+			 Datum *values,
+			 bool *nulls,
+			 int nitems,
+			 int typlen,
+			 bool typbyval,
+			 char typalign,
+			 bool freedata);
+
+extern Datum array_get_element(Datum arraydatum, int nSubscripts, int *indx,
+				  int arraytyplen, int elmlen, bool elmbyval, char elmalign,
+				  bool *isNull);
+extern Datum array_set_element(Datum arraydatum, int nSubscripts, int *indx,
+				  Datum dataValue, bool isNull,
+				  int arraytyplen, int elmlen, bool elmbyval, char elmalign);
+extern Datum array_get_slice(Datum arraydatum, int nSubscripts,
+				int *upperIndx, int *lowerIndx,
+				int arraytyplen, int elmlen, bool elmbyval, char elmalign);
+extern Datum array_set_slice(Datum arraydatum, int nSubscripts,
+				int *upperIndx, int *lowerIndx,
+				Datum srcArrayDatum, bool isNull,
+				int arraytyplen, int elmlen, bool elmbyval, char elmalign);
+
+extern Datum array_ref(ArrayType *array, int nSubscripts, int *indx,
+		  int arraytyplen, int elmlen, bool elmbyval, char elmalign,
+		  bool *isNull);
+extern ArrayType *array_set(ArrayType *array, int nSubscripts, int *indx,
+		  Datum dataValue, bool isNull,
+		  int arraytyplen, int elmlen, bool elmbyval, char elmalign);
+
+extern Datum array_map(FunctionCallInfo fcinfo, Oid retType,
+		  ArrayMapState *amstate);
+
+extern void array_bitmap_copy(bits8 *destbitmap, int destoffset,
+				  const bits8 *srcbitmap, int srcoffset,
+				  int nitems);
+
+extern ArrayType *construct_array(Datum *elems, int nelems,
+				Oid elmtype,
+				int elmlen, bool elmbyval, char elmalign);
+extern ArrayType *construct_md_array(Datum *elems,
+				   bool *nulls,
+				   int ndims,
+				   int *dims,
+				   int *lbs,
+				   Oid elmtype, int elmlen, bool elmbyval, char elmalign);
+extern ArrayType *construct_empty_array(Oid elmtype);
+extern ExpandedArrayHeader *construct_empty_expanded_array(Oid element_type,
+							   MemoryContext parentcontext,
+							   ArrayMetaState *metacache);
+extern void deconstruct_array(ArrayType *array,
+				  Oid elmtype,
+				  int elmlen, bool elmbyval, char elmalign,
+				  Datum **elemsp, bool **nullsp, int *nelemsp);
+extern bool array_contains_nulls(ArrayType *array);
+
+extern ArrayBuildState *initArrayResult(Oid element_type,
+				MemoryContext rcontext, bool subcontext);
+extern ArrayBuildState *accumArrayResult(ArrayBuildState *astate,
+				 Datum dvalue, bool disnull,
+				 Oid element_type,
+				 MemoryContext rcontext);
+extern Datum makeArrayResult(ArrayBuildState *astate,
+				MemoryContext rcontext);
+extern Datum makeMdArrayResult(ArrayBuildState *astate, int ndims,
+				  int *dims, int *lbs, MemoryContext rcontext, bool release);
+
+extern ArrayBuildStateArr *initArrayResultArr(Oid array_type, Oid element_type,
+				   MemoryContext rcontext, bool subcontext);
+extern ArrayBuildStateArr *accumArrayResultArr(ArrayBuildStateArr *astate,
+					Datum dvalue, bool disnull,
+					Oid array_type,
+					MemoryContext rcontext);
+extern Datum makeArrayResultArr(ArrayBuildStateArr *astate,
+				   MemoryContext rcontext, bool release);
+
+extern ArrayBuildStateAny *initArrayResultAny(Oid input_type,
+				   MemoryContext rcontext, bool subcontext);
+extern ArrayBuildStateAny *accumArrayResultAny(ArrayBuildStateAny *astate,
+					Datum dvalue, bool disnull,
+					Oid input_type,
+					MemoryContext rcontext);
+extern Datum makeArrayResultAny(ArrayBuildStateAny *astate,
+				   MemoryContext rcontext, bool release);
+
+extern ArrayIterator array_create_iterator(ArrayType *arr, int slice_ndim, ArrayMetaState *mstate);
+extern bool array_iterate(ArrayIterator iterator, Datum *value, bool *isnull);
+extern void array_free_iterator(ArrayIterator iterator);
+
+/*
+ * prototypes for functions defined in arrayutils.c
+ */
+
+extern int	ArrayGetOffset(int n, const int *dim, const int *lb, const int *indx);
+extern int	ArrayGetOffset0(int n, const int *tup, const int *scale);
+extern int	ArrayGetNItems(int ndim, const int *dims);
+extern void mda_get_range(int n, int *span, const int *st, const int *endp);
+extern void mda_get_prod(int n, const int *range, int *prod);
+extern void mda_get_offset_values(int n, int *dist, const int *prod, const int *span);
+extern int	mda_next_tuple(int n, int *curr, const int *span);
+extern int32 *ArrayGetIntegerTypmods(ArrayType *arr, int *n);
+
+/*
+ * prototypes for functions defined in array_expanded.c
+ */
+extern Datum expand_array(Datum arraydatum, MemoryContext parentcontext,
+			 ArrayMetaState *metacache);
+extern ExpandedArrayHeader *DatumGetExpandedArray(Datum d);
+extern ExpandedArrayHeader *DatumGetExpandedArrayX(Datum d,
+					   ArrayMetaState *metacache);
+extern AnyArrayType *DatumGetAnyArray(Datum d);
+extern void deconstruct_expanded_array(ExpandedArrayHeader *eah);
+
+/*
+ * prototypes for functions defined in array_userfuncs.c
+ */
+extern Datum array_append(PG_FUNCTION_ARGS);
+extern Datum array_prepend(PG_FUNCTION_ARGS);
+extern Datum array_cat(PG_FUNCTION_ARGS);
+
+extern ArrayType *create_singleton_array(FunctionCallInfo fcinfo,
+					   Oid element_type,
+					   Datum element,
+					   bool isNull,
+					   int ndims);
+
+extern Datum array_agg_transfn(PG_FUNCTION_ARGS);
+extern Datum array_agg_finalfn(PG_FUNCTION_ARGS);
+extern Datum array_agg_array_transfn(PG_FUNCTION_ARGS);
+extern Datum array_agg_array_finalfn(PG_FUNCTION_ARGS);
+
+extern Datum array_position(PG_FUNCTION_ARGS);
+extern Datum array_position_start(PG_FUNCTION_ARGS);
+extern Datum array_positions(PG_FUNCTION_ARGS);
+
+/*
+ * prototypes for functions defined in array_typanalyze.c
+ */
+extern Datum array_typanalyze(PG_FUNCTION_ARGS);
+
+#endif   /* ARRAY_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/builtins.h b/foreign/libpg_query/src/postgres/include/utils/builtins.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/builtins.h
@@ -0,0 +1,1269 @@
+/*-------------------------------------------------------------------------
+ *
+ * builtins.h
+ *	  Declarations for operations on built-in types.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/builtins.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef BUILTINS_H
+#define BUILTINS_H
+
+#include "fmgr.h"
+#include "nodes/parsenodes.h"
+
+/*
+ *		Defined in adt/
+ */
+
+/* acl.c */
+extern Datum has_any_column_privilege_name_name(PG_FUNCTION_ARGS);
+extern Datum has_any_column_privilege_name_id(PG_FUNCTION_ARGS);
+extern Datum has_any_column_privilege_id_name(PG_FUNCTION_ARGS);
+extern Datum has_any_column_privilege_id_id(PG_FUNCTION_ARGS);
+extern Datum has_any_column_privilege_name(PG_FUNCTION_ARGS);
+extern Datum has_any_column_privilege_id(PG_FUNCTION_ARGS);
+extern Datum has_column_privilege_name_name_name(PG_FUNCTION_ARGS);
+extern Datum has_column_privilege_name_name_attnum(PG_FUNCTION_ARGS);
+extern Datum has_column_privilege_name_id_name(PG_FUNCTION_ARGS);
+extern Datum has_column_privilege_name_id_attnum(PG_FUNCTION_ARGS);
+extern Datum has_column_privilege_id_name_name(PG_FUNCTION_ARGS);
+extern Datum has_column_privilege_id_name_attnum(PG_FUNCTION_ARGS);
+extern Datum has_column_privilege_id_id_name(PG_FUNCTION_ARGS);
+extern Datum has_column_privilege_id_id_attnum(PG_FUNCTION_ARGS);
+extern Datum has_column_privilege_name_name(PG_FUNCTION_ARGS);
+extern Datum has_column_privilege_name_attnum(PG_FUNCTION_ARGS);
+extern Datum has_column_privilege_id_name(PG_FUNCTION_ARGS);
+extern Datum has_column_privilege_id_attnum(PG_FUNCTION_ARGS);
+extern Datum has_table_privilege_name_name(PG_FUNCTION_ARGS);
+extern Datum has_table_privilege_name_id(PG_FUNCTION_ARGS);
+extern Datum has_table_privilege_id_name(PG_FUNCTION_ARGS);
+extern Datum has_table_privilege_id_id(PG_FUNCTION_ARGS);
+extern Datum has_table_privilege_name(PG_FUNCTION_ARGS);
+extern Datum has_table_privilege_id(PG_FUNCTION_ARGS);
+extern Datum has_sequence_privilege_name_name(PG_FUNCTION_ARGS);
+extern Datum has_sequence_privilege_name_id(PG_FUNCTION_ARGS);
+extern Datum has_sequence_privilege_id_name(PG_FUNCTION_ARGS);
+extern Datum has_sequence_privilege_id_id(PG_FUNCTION_ARGS);
+extern Datum has_sequence_privilege_name(PG_FUNCTION_ARGS);
+extern Datum has_sequence_privilege_id(PG_FUNCTION_ARGS);
+extern Datum has_database_privilege_name_name(PG_FUNCTION_ARGS);
+extern Datum has_database_privilege_name_id(PG_FUNCTION_ARGS);
+extern Datum has_database_privilege_id_name(PG_FUNCTION_ARGS);
+extern Datum has_database_privilege_id_id(PG_FUNCTION_ARGS);
+extern Datum has_database_privilege_name(PG_FUNCTION_ARGS);
+extern Datum has_database_privilege_id(PG_FUNCTION_ARGS);
+extern Datum has_foreign_data_wrapper_privilege_name_name(PG_FUNCTION_ARGS);
+extern Datum has_foreign_data_wrapper_privilege_name_id(PG_FUNCTION_ARGS);
+extern Datum has_foreign_data_wrapper_privilege_id_name(PG_FUNCTION_ARGS);
+extern Datum has_foreign_data_wrapper_privilege_id_id(PG_FUNCTION_ARGS);
+extern Datum has_foreign_data_wrapper_privilege_name(PG_FUNCTION_ARGS);
+extern Datum has_foreign_data_wrapper_privilege_id(PG_FUNCTION_ARGS);
+extern Datum has_function_privilege_name_name(PG_FUNCTION_ARGS);
+extern Datum has_function_privilege_name_id(PG_FUNCTION_ARGS);
+extern Datum has_function_privilege_id_name(PG_FUNCTION_ARGS);
+extern Datum has_function_privilege_id_id(PG_FUNCTION_ARGS);
+extern Datum has_function_privilege_name(PG_FUNCTION_ARGS);
+extern Datum has_function_privilege_id(PG_FUNCTION_ARGS);
+extern Datum has_language_privilege_name_name(PG_FUNCTION_ARGS);
+extern Datum has_language_privilege_name_id(PG_FUNCTION_ARGS);
+extern Datum has_language_privilege_id_name(PG_FUNCTION_ARGS);
+extern Datum has_language_privilege_id_id(PG_FUNCTION_ARGS);
+extern Datum has_language_privilege_name(PG_FUNCTION_ARGS);
+extern Datum has_language_privilege_id(PG_FUNCTION_ARGS);
+extern Datum has_schema_privilege_name_name(PG_FUNCTION_ARGS);
+extern Datum has_schema_privilege_name_id(PG_FUNCTION_ARGS);
+extern Datum has_schema_privilege_id_name(PG_FUNCTION_ARGS);
+extern Datum has_schema_privilege_id_id(PG_FUNCTION_ARGS);
+extern Datum has_schema_privilege_name(PG_FUNCTION_ARGS);
+extern Datum has_schema_privilege_id(PG_FUNCTION_ARGS);
+extern Datum has_server_privilege_name_name(PG_FUNCTION_ARGS);
+extern Datum has_server_privilege_name_id(PG_FUNCTION_ARGS);
+extern Datum has_server_privilege_id_name(PG_FUNCTION_ARGS);
+extern Datum has_server_privilege_id_id(PG_FUNCTION_ARGS);
+extern Datum has_server_privilege_name(PG_FUNCTION_ARGS);
+extern Datum has_server_privilege_id(PG_FUNCTION_ARGS);
+extern Datum has_tablespace_privilege_name_name(PG_FUNCTION_ARGS);
+extern Datum has_tablespace_privilege_name_id(PG_FUNCTION_ARGS);
+extern Datum has_tablespace_privilege_id_name(PG_FUNCTION_ARGS);
+extern Datum has_tablespace_privilege_id_id(PG_FUNCTION_ARGS);
+extern Datum has_tablespace_privilege_name(PG_FUNCTION_ARGS);
+extern Datum has_tablespace_privilege_id(PG_FUNCTION_ARGS);
+extern Datum has_type_privilege_name_name(PG_FUNCTION_ARGS);
+extern Datum has_type_privilege_name_id(PG_FUNCTION_ARGS);
+extern Datum has_type_privilege_id_name(PG_FUNCTION_ARGS);
+extern Datum has_type_privilege_id_id(PG_FUNCTION_ARGS);
+extern Datum has_type_privilege_name(PG_FUNCTION_ARGS);
+extern Datum has_type_privilege_id(PG_FUNCTION_ARGS);
+extern Datum pg_has_role_name_name(PG_FUNCTION_ARGS);
+extern Datum pg_has_role_name_id(PG_FUNCTION_ARGS);
+extern Datum pg_has_role_id_name(PG_FUNCTION_ARGS);
+extern Datum pg_has_role_id_id(PG_FUNCTION_ARGS);
+extern Datum pg_has_role_name(PG_FUNCTION_ARGS);
+extern Datum pg_has_role_id(PG_FUNCTION_ARGS);
+
+/* bool.c */
+extern Datum boolin(PG_FUNCTION_ARGS);
+extern Datum boolout(PG_FUNCTION_ARGS);
+extern Datum boolrecv(PG_FUNCTION_ARGS);
+extern Datum boolsend(PG_FUNCTION_ARGS);
+extern Datum booltext(PG_FUNCTION_ARGS);
+extern Datum booleq(PG_FUNCTION_ARGS);
+extern Datum boolne(PG_FUNCTION_ARGS);
+extern Datum boollt(PG_FUNCTION_ARGS);
+extern Datum boolgt(PG_FUNCTION_ARGS);
+extern Datum boolle(PG_FUNCTION_ARGS);
+extern Datum boolge(PG_FUNCTION_ARGS);
+extern Datum booland_statefunc(PG_FUNCTION_ARGS);
+extern Datum boolor_statefunc(PG_FUNCTION_ARGS);
+extern Datum bool_accum(PG_FUNCTION_ARGS);
+extern Datum bool_accum_inv(PG_FUNCTION_ARGS);
+extern Datum bool_alltrue(PG_FUNCTION_ARGS);
+extern Datum bool_anytrue(PG_FUNCTION_ARGS);
+extern bool parse_bool(const char *value, bool *result);
+extern bool parse_bool_with_len(const char *value, size_t len, bool *result);
+
+/* char.c */
+extern Datum charin(PG_FUNCTION_ARGS);
+extern Datum charout(PG_FUNCTION_ARGS);
+extern Datum charrecv(PG_FUNCTION_ARGS);
+extern Datum charsend(PG_FUNCTION_ARGS);
+extern Datum chareq(PG_FUNCTION_ARGS);
+extern Datum charne(PG_FUNCTION_ARGS);
+extern Datum charlt(PG_FUNCTION_ARGS);
+extern Datum charle(PG_FUNCTION_ARGS);
+extern Datum chargt(PG_FUNCTION_ARGS);
+extern Datum charge(PG_FUNCTION_ARGS);
+extern Datum chartoi4(PG_FUNCTION_ARGS);
+extern Datum i4tochar(PG_FUNCTION_ARGS);
+extern Datum text_char(PG_FUNCTION_ARGS);
+extern Datum char_text(PG_FUNCTION_ARGS);
+
+/* domains.c */
+extern Datum domain_in(PG_FUNCTION_ARGS);
+extern Datum domain_recv(PG_FUNCTION_ARGS);
+extern void domain_check(Datum value, bool isnull, Oid domainType,
+			 void **extra, MemoryContext mcxt);
+extern int	errdatatype(Oid datatypeOid);
+extern int	errdomainconstraint(Oid datatypeOid, const char *conname);
+
+/* encode.c */
+extern Datum binary_encode(PG_FUNCTION_ARGS);
+extern Datum binary_decode(PG_FUNCTION_ARGS);
+extern unsigned hex_encode(const char *src, unsigned len, char *dst);
+extern unsigned hex_decode(const char *src, unsigned len, char *dst);
+
+/* enum.c */
+extern Datum enum_in(PG_FUNCTION_ARGS);
+extern Datum enum_out(PG_FUNCTION_ARGS);
+extern Datum enum_recv(PG_FUNCTION_ARGS);
+extern Datum enum_send(PG_FUNCTION_ARGS);
+extern Datum enum_lt(PG_FUNCTION_ARGS);
+extern Datum enum_le(PG_FUNCTION_ARGS);
+extern Datum enum_eq(PG_FUNCTION_ARGS);
+extern Datum enum_ne(PG_FUNCTION_ARGS);
+extern Datum enum_ge(PG_FUNCTION_ARGS);
+extern Datum enum_gt(PG_FUNCTION_ARGS);
+extern Datum enum_cmp(PG_FUNCTION_ARGS);
+extern Datum enum_smaller(PG_FUNCTION_ARGS);
+extern Datum enum_larger(PG_FUNCTION_ARGS);
+extern Datum enum_first(PG_FUNCTION_ARGS);
+extern Datum enum_last(PG_FUNCTION_ARGS);
+extern Datum enum_range_bounds(PG_FUNCTION_ARGS);
+extern Datum enum_range_all(PG_FUNCTION_ARGS);
+
+/* int.c */
+extern Datum int2in(PG_FUNCTION_ARGS);
+extern Datum int2out(PG_FUNCTION_ARGS);
+extern Datum int2recv(PG_FUNCTION_ARGS);
+extern Datum int2send(PG_FUNCTION_ARGS);
+extern Datum int2vectorin(PG_FUNCTION_ARGS);
+extern Datum int2vectorout(PG_FUNCTION_ARGS);
+extern Datum int2vectorrecv(PG_FUNCTION_ARGS);
+extern Datum int2vectorsend(PG_FUNCTION_ARGS);
+extern Datum int2vectoreq(PG_FUNCTION_ARGS);
+extern Datum int4in(PG_FUNCTION_ARGS);
+extern Datum int4out(PG_FUNCTION_ARGS);
+extern Datum int4recv(PG_FUNCTION_ARGS);
+extern Datum int4send(PG_FUNCTION_ARGS);
+extern Datum i2toi4(PG_FUNCTION_ARGS);
+extern Datum i4toi2(PG_FUNCTION_ARGS);
+extern Datum int4_bool(PG_FUNCTION_ARGS);
+extern Datum bool_int4(PG_FUNCTION_ARGS);
+extern Datum int4eq(PG_FUNCTION_ARGS);
+extern Datum int4ne(PG_FUNCTION_ARGS);
+extern Datum int4lt(PG_FUNCTION_ARGS);
+extern Datum int4le(PG_FUNCTION_ARGS);
+extern Datum int4gt(PG_FUNCTION_ARGS);
+extern Datum int4ge(PG_FUNCTION_ARGS);
+extern Datum int2eq(PG_FUNCTION_ARGS);
+extern Datum int2ne(PG_FUNCTION_ARGS);
+extern Datum int2lt(PG_FUNCTION_ARGS);
+extern Datum int2le(PG_FUNCTION_ARGS);
+extern Datum int2gt(PG_FUNCTION_ARGS);
+extern Datum int2ge(PG_FUNCTION_ARGS);
+extern Datum int24eq(PG_FUNCTION_ARGS);
+extern Datum int24ne(PG_FUNCTION_ARGS);
+extern Datum int24lt(PG_FUNCTION_ARGS);
+extern Datum int24le(PG_FUNCTION_ARGS);
+extern Datum int24gt(PG_FUNCTION_ARGS);
+extern Datum int24ge(PG_FUNCTION_ARGS);
+extern Datum int42eq(PG_FUNCTION_ARGS);
+extern Datum int42ne(PG_FUNCTION_ARGS);
+extern Datum int42lt(PG_FUNCTION_ARGS);
+extern Datum int42le(PG_FUNCTION_ARGS);
+extern Datum int42gt(PG_FUNCTION_ARGS);
+extern Datum int42ge(PG_FUNCTION_ARGS);
+extern Datum int4um(PG_FUNCTION_ARGS);
+extern Datum int4up(PG_FUNCTION_ARGS);
+extern Datum int4pl(PG_FUNCTION_ARGS);
+extern Datum int4mi(PG_FUNCTION_ARGS);
+extern Datum int4mul(PG_FUNCTION_ARGS);
+extern Datum int4div(PG_FUNCTION_ARGS);
+extern Datum int4abs(PG_FUNCTION_ARGS);
+extern Datum int4inc(PG_FUNCTION_ARGS);
+extern Datum int2um(PG_FUNCTION_ARGS);
+extern Datum int2up(PG_FUNCTION_ARGS);
+extern Datum int2pl(PG_FUNCTION_ARGS);
+extern Datum int2mi(PG_FUNCTION_ARGS);
+extern Datum int2mul(PG_FUNCTION_ARGS);
+extern Datum int2div(PG_FUNCTION_ARGS);
+extern Datum int2abs(PG_FUNCTION_ARGS);
+extern Datum int24pl(PG_FUNCTION_ARGS);
+extern Datum int24mi(PG_FUNCTION_ARGS);
+extern Datum int24mul(PG_FUNCTION_ARGS);
+extern Datum int24div(PG_FUNCTION_ARGS);
+extern Datum int42pl(PG_FUNCTION_ARGS);
+extern Datum int42mi(PG_FUNCTION_ARGS);
+extern Datum int42mul(PG_FUNCTION_ARGS);
+extern Datum int42div(PG_FUNCTION_ARGS);
+extern Datum int4mod(PG_FUNCTION_ARGS);
+extern Datum int2mod(PG_FUNCTION_ARGS);
+extern Datum int2larger(PG_FUNCTION_ARGS);
+extern Datum int2smaller(PG_FUNCTION_ARGS);
+extern Datum int4larger(PG_FUNCTION_ARGS);
+extern Datum int4smaller(PG_FUNCTION_ARGS);
+
+extern Datum int4and(PG_FUNCTION_ARGS);
+extern Datum int4or(PG_FUNCTION_ARGS);
+extern Datum int4xor(PG_FUNCTION_ARGS);
+extern Datum int4not(PG_FUNCTION_ARGS);
+extern Datum int4shl(PG_FUNCTION_ARGS);
+extern Datum int4shr(PG_FUNCTION_ARGS);
+extern Datum int2and(PG_FUNCTION_ARGS);
+extern Datum int2or(PG_FUNCTION_ARGS);
+extern Datum int2xor(PG_FUNCTION_ARGS);
+extern Datum int2not(PG_FUNCTION_ARGS);
+extern Datum int2shl(PG_FUNCTION_ARGS);
+extern Datum int2shr(PG_FUNCTION_ARGS);
+extern Datum generate_series_int4(PG_FUNCTION_ARGS);
+extern Datum generate_series_step_int4(PG_FUNCTION_ARGS);
+extern int2vector *buildint2vector(const int16 *int2s, int n);
+
+/* name.c */
+extern Datum namein(PG_FUNCTION_ARGS);
+extern Datum nameout(PG_FUNCTION_ARGS);
+extern Datum namerecv(PG_FUNCTION_ARGS);
+extern Datum namesend(PG_FUNCTION_ARGS);
+extern Datum nameeq(PG_FUNCTION_ARGS);
+extern Datum namene(PG_FUNCTION_ARGS);
+extern Datum namelt(PG_FUNCTION_ARGS);
+extern Datum namele(PG_FUNCTION_ARGS);
+extern Datum namegt(PG_FUNCTION_ARGS);
+extern Datum namege(PG_FUNCTION_ARGS);
+extern int	namecpy(Name n1, Name n2);
+extern int	namestrcpy(Name name, const char *str);
+extern int	namestrcmp(Name name, const char *str);
+extern Datum current_user(PG_FUNCTION_ARGS);
+extern Datum session_user(PG_FUNCTION_ARGS);
+extern Datum current_schema(PG_FUNCTION_ARGS);
+extern Datum current_schemas(PG_FUNCTION_ARGS);
+
+/* numutils.c */
+extern int32 pg_atoi(const char *s, int size, int c);
+extern void pg_itoa(int16 i, char *a);
+extern void pg_ltoa(int32 l, char *a);
+extern void pg_lltoa(int64 ll, char *a);
+
+/*
+ *		Per-opclass comparison functions for new btrees.  These are
+ *		stored in pg_amproc; most are defined in access/nbtree/nbtcompare.c
+ */
+extern Datum btboolcmp(PG_FUNCTION_ARGS);
+extern Datum btint2cmp(PG_FUNCTION_ARGS);
+extern Datum btint4cmp(PG_FUNCTION_ARGS);
+extern Datum btint8cmp(PG_FUNCTION_ARGS);
+extern Datum btfloat4cmp(PG_FUNCTION_ARGS);
+extern Datum btfloat8cmp(PG_FUNCTION_ARGS);
+extern Datum btint48cmp(PG_FUNCTION_ARGS);
+extern Datum btint84cmp(PG_FUNCTION_ARGS);
+extern Datum btint24cmp(PG_FUNCTION_ARGS);
+extern Datum btint42cmp(PG_FUNCTION_ARGS);
+extern Datum btint28cmp(PG_FUNCTION_ARGS);
+extern Datum btint82cmp(PG_FUNCTION_ARGS);
+extern Datum btfloat48cmp(PG_FUNCTION_ARGS);
+extern Datum btfloat84cmp(PG_FUNCTION_ARGS);
+extern Datum btoidcmp(PG_FUNCTION_ARGS);
+extern Datum btoidvectorcmp(PG_FUNCTION_ARGS);
+extern Datum btabstimecmp(PG_FUNCTION_ARGS);
+extern Datum btreltimecmp(PG_FUNCTION_ARGS);
+extern Datum bttintervalcmp(PG_FUNCTION_ARGS);
+extern Datum btcharcmp(PG_FUNCTION_ARGS);
+extern Datum btnamecmp(PG_FUNCTION_ARGS);
+extern Datum bttextcmp(PG_FUNCTION_ARGS);
+extern Datum bttextsortsupport(PG_FUNCTION_ARGS);
+
+/*
+ *		Per-opclass sort support functions for new btrees.  Like the
+ *		functions above, these are stored in pg_amproc; most are defined in
+ *		access/nbtree/nbtcompare.c
+ */
+extern Datum btint2sortsupport(PG_FUNCTION_ARGS);
+extern Datum btint4sortsupport(PG_FUNCTION_ARGS);
+extern Datum btint8sortsupport(PG_FUNCTION_ARGS);
+extern Datum btfloat4sortsupport(PG_FUNCTION_ARGS);
+extern Datum btfloat8sortsupport(PG_FUNCTION_ARGS);
+extern Datum btoidsortsupport(PG_FUNCTION_ARGS);
+extern Datum btnamesortsupport(PG_FUNCTION_ARGS);
+
+/* float.c */
+extern PGDLLIMPORT int extra_float_digits;
+
+extern double get_float8_infinity(void);
+extern float get_float4_infinity(void);
+extern double get_float8_nan(void);
+extern float get_float4_nan(void);
+extern int	is_infinite(double val);
+
+extern Datum float4in(PG_FUNCTION_ARGS);
+extern Datum float4out(PG_FUNCTION_ARGS);
+extern Datum float4recv(PG_FUNCTION_ARGS);
+extern Datum float4send(PG_FUNCTION_ARGS);
+extern Datum float8in(PG_FUNCTION_ARGS);
+extern Datum float8out(PG_FUNCTION_ARGS);
+extern Datum float8recv(PG_FUNCTION_ARGS);
+extern Datum float8send(PG_FUNCTION_ARGS);
+extern Datum float4abs(PG_FUNCTION_ARGS);
+extern Datum float4um(PG_FUNCTION_ARGS);
+extern Datum float4up(PG_FUNCTION_ARGS);
+extern Datum float4larger(PG_FUNCTION_ARGS);
+extern Datum float4smaller(PG_FUNCTION_ARGS);
+extern Datum float8abs(PG_FUNCTION_ARGS);
+extern Datum float8um(PG_FUNCTION_ARGS);
+extern Datum float8up(PG_FUNCTION_ARGS);
+extern Datum float8larger(PG_FUNCTION_ARGS);
+extern Datum float8smaller(PG_FUNCTION_ARGS);
+extern Datum float4pl(PG_FUNCTION_ARGS);
+extern Datum float4mi(PG_FUNCTION_ARGS);
+extern Datum float4mul(PG_FUNCTION_ARGS);
+extern Datum float4div(PG_FUNCTION_ARGS);
+extern Datum float8pl(PG_FUNCTION_ARGS);
+extern Datum float8mi(PG_FUNCTION_ARGS);
+extern Datum float8mul(PG_FUNCTION_ARGS);
+extern Datum float8div(PG_FUNCTION_ARGS);
+extern Datum float4eq(PG_FUNCTION_ARGS);
+extern Datum float4ne(PG_FUNCTION_ARGS);
+extern Datum float4lt(PG_FUNCTION_ARGS);
+extern Datum float4le(PG_FUNCTION_ARGS);
+extern Datum float4gt(PG_FUNCTION_ARGS);
+extern Datum float4ge(PG_FUNCTION_ARGS);
+extern Datum float8eq(PG_FUNCTION_ARGS);
+extern Datum float8ne(PG_FUNCTION_ARGS);
+extern Datum float8lt(PG_FUNCTION_ARGS);
+extern Datum float8le(PG_FUNCTION_ARGS);
+extern Datum float8gt(PG_FUNCTION_ARGS);
+extern Datum float8ge(PG_FUNCTION_ARGS);
+extern Datum ftod(PG_FUNCTION_ARGS);
+extern Datum i4tod(PG_FUNCTION_ARGS);
+extern Datum i2tod(PG_FUNCTION_ARGS);
+extern Datum dtof(PG_FUNCTION_ARGS);
+extern Datum dtoi4(PG_FUNCTION_ARGS);
+extern Datum dtoi2(PG_FUNCTION_ARGS);
+extern Datum i4tof(PG_FUNCTION_ARGS);
+extern Datum i2tof(PG_FUNCTION_ARGS);
+extern Datum ftoi4(PG_FUNCTION_ARGS);
+extern Datum ftoi2(PG_FUNCTION_ARGS);
+extern Datum dround(PG_FUNCTION_ARGS);
+extern Datum dceil(PG_FUNCTION_ARGS);
+extern Datum dfloor(PG_FUNCTION_ARGS);
+extern Datum dsign(PG_FUNCTION_ARGS);
+extern Datum dtrunc(PG_FUNCTION_ARGS);
+extern Datum dsqrt(PG_FUNCTION_ARGS);
+extern Datum dcbrt(PG_FUNCTION_ARGS);
+extern Datum dpow(PG_FUNCTION_ARGS);
+extern Datum dexp(PG_FUNCTION_ARGS);
+extern Datum dlog1(PG_FUNCTION_ARGS);
+extern Datum dlog10(PG_FUNCTION_ARGS);
+extern Datum dacos(PG_FUNCTION_ARGS);
+extern Datum dasin(PG_FUNCTION_ARGS);
+extern Datum datan(PG_FUNCTION_ARGS);
+extern Datum datan2(PG_FUNCTION_ARGS);
+extern Datum dcos(PG_FUNCTION_ARGS);
+extern Datum dcot(PG_FUNCTION_ARGS);
+extern Datum dsin(PG_FUNCTION_ARGS);
+extern Datum dtan(PG_FUNCTION_ARGS);
+extern Datum degrees(PG_FUNCTION_ARGS);
+extern Datum dpi(PG_FUNCTION_ARGS);
+extern Datum radians(PG_FUNCTION_ARGS);
+extern Datum drandom(PG_FUNCTION_ARGS);
+extern Datum setseed(PG_FUNCTION_ARGS);
+extern Datum float8_accum(PG_FUNCTION_ARGS);
+extern Datum float4_accum(PG_FUNCTION_ARGS);
+extern Datum float8_avg(PG_FUNCTION_ARGS);
+extern Datum float8_var_pop(PG_FUNCTION_ARGS);
+extern Datum float8_var_samp(PG_FUNCTION_ARGS);
+extern Datum float8_stddev_pop(PG_FUNCTION_ARGS);
+extern Datum float8_stddev_samp(PG_FUNCTION_ARGS);
+extern Datum float8_regr_accum(PG_FUNCTION_ARGS);
+extern Datum float8_regr_sxx(PG_FUNCTION_ARGS);
+extern Datum float8_regr_syy(PG_FUNCTION_ARGS);
+extern Datum float8_regr_sxy(PG_FUNCTION_ARGS);
+extern Datum float8_regr_avgx(PG_FUNCTION_ARGS);
+extern Datum float8_regr_avgy(PG_FUNCTION_ARGS);
+extern Datum float8_covar_pop(PG_FUNCTION_ARGS);
+extern Datum float8_covar_samp(PG_FUNCTION_ARGS);
+extern Datum float8_corr(PG_FUNCTION_ARGS);
+extern Datum float8_regr_r2(PG_FUNCTION_ARGS);
+extern Datum float8_regr_slope(PG_FUNCTION_ARGS);
+extern Datum float8_regr_intercept(PG_FUNCTION_ARGS);
+extern Datum float48pl(PG_FUNCTION_ARGS);
+extern Datum float48mi(PG_FUNCTION_ARGS);
+extern Datum float48mul(PG_FUNCTION_ARGS);
+extern Datum float48div(PG_FUNCTION_ARGS);
+extern Datum float84pl(PG_FUNCTION_ARGS);
+extern Datum float84mi(PG_FUNCTION_ARGS);
+extern Datum float84mul(PG_FUNCTION_ARGS);
+extern Datum float84div(PG_FUNCTION_ARGS);
+extern Datum float48eq(PG_FUNCTION_ARGS);
+extern Datum float48ne(PG_FUNCTION_ARGS);
+extern Datum float48lt(PG_FUNCTION_ARGS);
+extern Datum float48le(PG_FUNCTION_ARGS);
+extern Datum float48gt(PG_FUNCTION_ARGS);
+extern Datum float48ge(PG_FUNCTION_ARGS);
+extern Datum float84eq(PG_FUNCTION_ARGS);
+extern Datum float84ne(PG_FUNCTION_ARGS);
+extern Datum float84lt(PG_FUNCTION_ARGS);
+extern Datum float84le(PG_FUNCTION_ARGS);
+extern Datum float84gt(PG_FUNCTION_ARGS);
+extern Datum float84ge(PG_FUNCTION_ARGS);
+extern Datum width_bucket_float8(PG_FUNCTION_ARGS);
+
+/* dbsize.c */
+extern Datum pg_tablespace_size_oid(PG_FUNCTION_ARGS);
+extern Datum pg_tablespace_size_name(PG_FUNCTION_ARGS);
+extern Datum pg_database_size_oid(PG_FUNCTION_ARGS);
+extern Datum pg_database_size_name(PG_FUNCTION_ARGS);
+extern Datum pg_relation_size(PG_FUNCTION_ARGS);
+extern Datum pg_total_relation_size(PG_FUNCTION_ARGS);
+extern Datum pg_size_pretty(PG_FUNCTION_ARGS);
+extern Datum pg_size_pretty_numeric(PG_FUNCTION_ARGS);
+extern Datum pg_table_size(PG_FUNCTION_ARGS);
+extern Datum pg_indexes_size(PG_FUNCTION_ARGS);
+extern Datum pg_relation_filenode(PG_FUNCTION_ARGS);
+extern Datum pg_filenode_relation(PG_FUNCTION_ARGS);
+extern Datum pg_relation_filepath(PG_FUNCTION_ARGS);
+
+/* genfile.c */
+extern Datum pg_stat_file(PG_FUNCTION_ARGS);
+extern Datum pg_stat_file_1arg(PG_FUNCTION_ARGS);
+extern Datum pg_read_file(PG_FUNCTION_ARGS);
+extern Datum pg_read_file_off_len(PG_FUNCTION_ARGS);
+extern Datum pg_read_file_all(PG_FUNCTION_ARGS);
+extern Datum pg_read_binary_file(PG_FUNCTION_ARGS);
+extern Datum pg_read_binary_file_off_len(PG_FUNCTION_ARGS);
+extern Datum pg_read_binary_file_all(PG_FUNCTION_ARGS);
+extern Datum pg_ls_dir(PG_FUNCTION_ARGS);
+extern Datum pg_ls_dir_1arg(PG_FUNCTION_ARGS);
+
+/* misc.c */
+extern Datum current_database(PG_FUNCTION_ARGS);
+extern Datum current_query(PG_FUNCTION_ARGS);
+extern Datum pg_cancel_backend(PG_FUNCTION_ARGS);
+extern Datum pg_terminate_backend(PG_FUNCTION_ARGS);
+extern Datum pg_reload_conf(PG_FUNCTION_ARGS);
+extern Datum pg_tablespace_databases(PG_FUNCTION_ARGS);
+extern Datum pg_tablespace_location(PG_FUNCTION_ARGS);
+extern Datum pg_rotate_logfile(PG_FUNCTION_ARGS);
+extern Datum pg_sleep(PG_FUNCTION_ARGS);
+extern Datum pg_get_keywords(PG_FUNCTION_ARGS);
+extern Datum pg_typeof(PG_FUNCTION_ARGS);
+extern Datum pg_collation_for(PG_FUNCTION_ARGS);
+extern Datum pg_relation_is_updatable(PG_FUNCTION_ARGS);
+extern Datum pg_column_is_updatable(PG_FUNCTION_ARGS);
+
+/* oid.c */
+extern Datum oidin(PG_FUNCTION_ARGS);
+extern Datum oidout(PG_FUNCTION_ARGS);
+extern Datum oidrecv(PG_FUNCTION_ARGS);
+extern Datum oidsend(PG_FUNCTION_ARGS);
+extern Datum oideq(PG_FUNCTION_ARGS);
+extern Datum oidne(PG_FUNCTION_ARGS);
+extern Datum oidlt(PG_FUNCTION_ARGS);
+extern Datum oidle(PG_FUNCTION_ARGS);
+extern Datum oidge(PG_FUNCTION_ARGS);
+extern Datum oidgt(PG_FUNCTION_ARGS);
+extern Datum oidlarger(PG_FUNCTION_ARGS);
+extern Datum oidsmaller(PG_FUNCTION_ARGS);
+extern Datum oidvectorin(PG_FUNCTION_ARGS);
+extern Datum oidvectorout(PG_FUNCTION_ARGS);
+extern Datum oidvectorrecv(PG_FUNCTION_ARGS);
+extern Datum oidvectorsend(PG_FUNCTION_ARGS);
+extern Datum oidvectoreq(PG_FUNCTION_ARGS);
+extern Datum oidvectorne(PG_FUNCTION_ARGS);
+extern Datum oidvectorlt(PG_FUNCTION_ARGS);
+extern Datum oidvectorle(PG_FUNCTION_ARGS);
+extern Datum oidvectorge(PG_FUNCTION_ARGS);
+extern Datum oidvectorgt(PG_FUNCTION_ARGS);
+extern oidvector *buildoidvector(const Oid *oids, int n);
+extern Oid	oidparse(Node *node);
+
+/* orderedsetaggs.c */
+extern Datum ordered_set_transition(PG_FUNCTION_ARGS);
+extern Datum ordered_set_transition_multi(PG_FUNCTION_ARGS);
+extern Datum percentile_disc_final(PG_FUNCTION_ARGS);
+extern Datum percentile_cont_float8_final(PG_FUNCTION_ARGS);
+extern Datum percentile_cont_interval_final(PG_FUNCTION_ARGS);
+extern Datum percentile_disc_multi_final(PG_FUNCTION_ARGS);
+extern Datum percentile_cont_float8_multi_final(PG_FUNCTION_ARGS);
+extern Datum percentile_cont_interval_multi_final(PG_FUNCTION_ARGS);
+extern Datum mode_final(PG_FUNCTION_ARGS);
+extern Datum hypothetical_rank_final(PG_FUNCTION_ARGS);
+extern Datum hypothetical_percent_rank_final(PG_FUNCTION_ARGS);
+extern Datum hypothetical_cume_dist_final(PG_FUNCTION_ARGS);
+extern Datum hypothetical_dense_rank_final(PG_FUNCTION_ARGS);
+
+/* pseudotypes.c */
+extern Datum cstring_in(PG_FUNCTION_ARGS);
+extern Datum cstring_out(PG_FUNCTION_ARGS);
+extern Datum cstring_recv(PG_FUNCTION_ARGS);
+extern Datum cstring_send(PG_FUNCTION_ARGS);
+extern Datum any_in(PG_FUNCTION_ARGS);
+extern Datum any_out(PG_FUNCTION_ARGS);
+extern Datum anyarray_in(PG_FUNCTION_ARGS);
+extern Datum anyarray_out(PG_FUNCTION_ARGS);
+extern Datum anyarray_recv(PG_FUNCTION_ARGS);
+extern Datum anyarray_send(PG_FUNCTION_ARGS);
+extern Datum anynonarray_in(PG_FUNCTION_ARGS);
+extern Datum anynonarray_out(PG_FUNCTION_ARGS);
+extern Datum anyenum_in(PG_FUNCTION_ARGS);
+extern Datum anyenum_out(PG_FUNCTION_ARGS);
+extern Datum anyrange_in(PG_FUNCTION_ARGS);
+extern Datum anyrange_out(PG_FUNCTION_ARGS);
+extern Datum void_in(PG_FUNCTION_ARGS);
+extern Datum void_out(PG_FUNCTION_ARGS);
+extern Datum void_recv(PG_FUNCTION_ARGS);
+extern Datum void_send(PG_FUNCTION_ARGS);
+extern Datum trigger_in(PG_FUNCTION_ARGS);
+extern Datum trigger_out(PG_FUNCTION_ARGS);
+extern Datum event_trigger_in(PG_FUNCTION_ARGS);
+extern Datum event_trigger_out(PG_FUNCTION_ARGS);
+extern Datum language_handler_in(PG_FUNCTION_ARGS);
+extern Datum language_handler_out(PG_FUNCTION_ARGS);
+extern Datum fdw_handler_in(PG_FUNCTION_ARGS);
+extern Datum fdw_handler_out(PG_FUNCTION_ARGS);
+extern Datum tsm_handler_in(PG_FUNCTION_ARGS);
+extern Datum tsm_handler_out(PG_FUNCTION_ARGS);
+extern Datum internal_in(PG_FUNCTION_ARGS);
+extern Datum internal_out(PG_FUNCTION_ARGS);
+extern Datum opaque_in(PG_FUNCTION_ARGS);
+extern Datum opaque_out(PG_FUNCTION_ARGS);
+extern Datum anyelement_in(PG_FUNCTION_ARGS);
+extern Datum anyelement_out(PG_FUNCTION_ARGS);
+extern Datum shell_in(PG_FUNCTION_ARGS);
+extern Datum shell_out(PG_FUNCTION_ARGS);
+extern Datum pg_node_tree_in(PG_FUNCTION_ARGS);
+extern Datum pg_node_tree_out(PG_FUNCTION_ARGS);
+extern Datum pg_node_tree_recv(PG_FUNCTION_ARGS);
+extern Datum pg_node_tree_send(PG_FUNCTION_ARGS);
+extern Datum pg_ddl_command_in(PG_FUNCTION_ARGS);
+extern Datum pg_ddl_command_out(PG_FUNCTION_ARGS);
+extern Datum pg_ddl_command_recv(PG_FUNCTION_ARGS);
+extern Datum pg_ddl_command_send(PG_FUNCTION_ARGS);
+
+/* regexp.c */
+extern Datum nameregexeq(PG_FUNCTION_ARGS);
+extern Datum nameregexne(PG_FUNCTION_ARGS);
+extern Datum textregexeq(PG_FUNCTION_ARGS);
+extern Datum textregexne(PG_FUNCTION_ARGS);
+extern Datum nameicregexeq(PG_FUNCTION_ARGS);
+extern Datum nameicregexne(PG_FUNCTION_ARGS);
+extern Datum texticregexeq(PG_FUNCTION_ARGS);
+extern Datum texticregexne(PG_FUNCTION_ARGS);
+extern Datum textregexsubstr(PG_FUNCTION_ARGS);
+extern Datum textregexreplace_noopt(PG_FUNCTION_ARGS);
+extern Datum textregexreplace(PG_FUNCTION_ARGS);
+extern Datum similar_escape(PG_FUNCTION_ARGS);
+extern Datum regexp_matches(PG_FUNCTION_ARGS);
+extern Datum regexp_matches_no_flags(PG_FUNCTION_ARGS);
+extern Datum regexp_split_to_table(PG_FUNCTION_ARGS);
+extern Datum regexp_split_to_table_no_flags(PG_FUNCTION_ARGS);
+extern Datum regexp_split_to_array(PG_FUNCTION_ARGS);
+extern Datum regexp_split_to_array_no_flags(PG_FUNCTION_ARGS);
+extern char *regexp_fixed_prefix(text *text_re, bool case_insensitive,
+					Oid collation, bool *exact);
+
+/* regproc.c */
+extern Datum regprocin(PG_FUNCTION_ARGS);
+extern Datum regprocout(PG_FUNCTION_ARGS);
+extern Datum to_regproc(PG_FUNCTION_ARGS);
+extern Datum to_regprocedure(PG_FUNCTION_ARGS);
+extern Datum regprocrecv(PG_FUNCTION_ARGS);
+extern Datum regprocsend(PG_FUNCTION_ARGS);
+extern Datum regprocedurein(PG_FUNCTION_ARGS);
+extern Datum regprocedureout(PG_FUNCTION_ARGS);
+extern Datum regprocedurerecv(PG_FUNCTION_ARGS);
+extern Datum regproceduresend(PG_FUNCTION_ARGS);
+extern Datum regoperin(PG_FUNCTION_ARGS);
+extern Datum regoperout(PG_FUNCTION_ARGS);
+extern Datum regoperrecv(PG_FUNCTION_ARGS);
+extern Datum regopersend(PG_FUNCTION_ARGS);
+extern Datum to_regoper(PG_FUNCTION_ARGS);
+extern Datum to_regoperator(PG_FUNCTION_ARGS);
+extern Datum regoperatorin(PG_FUNCTION_ARGS);
+extern Datum regoperatorout(PG_FUNCTION_ARGS);
+extern Datum regoperatorrecv(PG_FUNCTION_ARGS);
+extern Datum regoperatorsend(PG_FUNCTION_ARGS);
+extern Datum regclassin(PG_FUNCTION_ARGS);
+extern Datum regclassout(PG_FUNCTION_ARGS);
+extern Datum regclassrecv(PG_FUNCTION_ARGS);
+extern Datum regclasssend(PG_FUNCTION_ARGS);
+extern Datum to_regclass(PG_FUNCTION_ARGS);
+extern Datum regtypein(PG_FUNCTION_ARGS);
+extern Datum regtypeout(PG_FUNCTION_ARGS);
+extern Datum regtyperecv(PG_FUNCTION_ARGS);
+extern Datum regtypesend(PG_FUNCTION_ARGS);
+extern Datum to_regtype(PG_FUNCTION_ARGS);
+extern Datum regrolein(PG_FUNCTION_ARGS);
+extern Datum regroleout(PG_FUNCTION_ARGS);
+extern Datum regrolerecv(PG_FUNCTION_ARGS);
+extern Datum regrolesend(PG_FUNCTION_ARGS);
+extern Datum to_regrole(PG_FUNCTION_ARGS);
+extern Datum regnamespacein(PG_FUNCTION_ARGS);
+extern Datum regnamespaceout(PG_FUNCTION_ARGS);
+extern Datum regnamespacerecv(PG_FUNCTION_ARGS);
+extern Datum regnamespacesend(PG_FUNCTION_ARGS);
+extern Datum to_regnamespace(PG_FUNCTION_ARGS);
+extern Datum regconfigin(PG_FUNCTION_ARGS);
+extern Datum regconfigout(PG_FUNCTION_ARGS);
+extern Datum regconfigrecv(PG_FUNCTION_ARGS);
+extern Datum regconfigsend(PG_FUNCTION_ARGS);
+extern Datum regdictionaryin(PG_FUNCTION_ARGS);
+extern Datum regdictionaryout(PG_FUNCTION_ARGS);
+extern Datum regdictionaryrecv(PG_FUNCTION_ARGS);
+extern Datum regdictionarysend(PG_FUNCTION_ARGS);
+extern Datum text_regclass(PG_FUNCTION_ARGS);
+extern List *stringToQualifiedNameList(const char *string);
+extern char *format_procedure(Oid procedure_oid);
+extern char *format_procedure_qualified(Oid procedure_oid);
+extern void format_procedure_parts(Oid operator_oid, List **objnames,
+					   List **objargs);
+extern char *format_operator(Oid operator_oid);
+extern char *format_operator_qualified(Oid operator_oid);
+extern void format_operator_parts(Oid operator_oid, List **objnames,
+					  List **objargs);
+
+/* rowtypes.c */
+extern Datum record_in(PG_FUNCTION_ARGS);
+extern Datum record_out(PG_FUNCTION_ARGS);
+extern Datum record_recv(PG_FUNCTION_ARGS);
+extern Datum record_send(PG_FUNCTION_ARGS);
+extern Datum record_eq(PG_FUNCTION_ARGS);
+extern Datum record_ne(PG_FUNCTION_ARGS);
+extern Datum record_lt(PG_FUNCTION_ARGS);
+extern Datum record_gt(PG_FUNCTION_ARGS);
+extern Datum record_le(PG_FUNCTION_ARGS);
+extern Datum record_ge(PG_FUNCTION_ARGS);
+extern Datum btrecordcmp(PG_FUNCTION_ARGS);
+extern Datum record_image_eq(PG_FUNCTION_ARGS);
+extern Datum record_image_ne(PG_FUNCTION_ARGS);
+extern Datum record_image_lt(PG_FUNCTION_ARGS);
+extern Datum record_image_gt(PG_FUNCTION_ARGS);
+extern Datum record_image_le(PG_FUNCTION_ARGS);
+extern Datum record_image_ge(PG_FUNCTION_ARGS);
+extern Datum btrecordimagecmp(PG_FUNCTION_ARGS);
+
+/* ruleutils.c */
+extern __thread  bool quote_all_identifiers;
+extern Datum pg_get_ruledef(PG_FUNCTION_ARGS);
+extern Datum pg_get_ruledef_ext(PG_FUNCTION_ARGS);
+extern Datum pg_get_viewdef(PG_FUNCTION_ARGS);
+extern Datum pg_get_viewdef_ext(PG_FUNCTION_ARGS);
+extern Datum pg_get_viewdef_wrap(PG_FUNCTION_ARGS);
+extern Datum pg_get_viewdef_name(PG_FUNCTION_ARGS);
+extern Datum pg_get_viewdef_name_ext(PG_FUNCTION_ARGS);
+extern Datum pg_get_indexdef(PG_FUNCTION_ARGS);
+extern Datum pg_get_indexdef_ext(PG_FUNCTION_ARGS);
+extern Datum pg_get_triggerdef(PG_FUNCTION_ARGS);
+extern Datum pg_get_triggerdef_ext(PG_FUNCTION_ARGS);
+extern Datum pg_get_constraintdef(PG_FUNCTION_ARGS);
+extern Datum pg_get_constraintdef_ext(PG_FUNCTION_ARGS);
+extern Datum pg_get_expr(PG_FUNCTION_ARGS);
+extern Datum pg_get_expr_ext(PG_FUNCTION_ARGS);
+extern Datum pg_get_userbyid(PG_FUNCTION_ARGS);
+extern Datum pg_get_serial_sequence(PG_FUNCTION_ARGS);
+extern Datum pg_get_functiondef(PG_FUNCTION_ARGS);
+extern Datum pg_get_function_arguments(PG_FUNCTION_ARGS);
+extern Datum pg_get_function_identity_arguments(PG_FUNCTION_ARGS);
+extern Datum pg_get_function_result(PG_FUNCTION_ARGS);
+extern Datum pg_get_function_arg_default(PG_FUNCTION_ARGS);
+extern const char *quote_identifier(const char *ident);
+extern char *quote_qualified_identifier(const char *qualifier,
+						   const char *ident);
+
+
+/* tid.c */
+extern Datum tidin(PG_FUNCTION_ARGS);
+extern Datum tidout(PG_FUNCTION_ARGS);
+extern Datum tidrecv(PG_FUNCTION_ARGS);
+extern Datum tidsend(PG_FUNCTION_ARGS);
+extern Datum tideq(PG_FUNCTION_ARGS);
+extern Datum tidne(PG_FUNCTION_ARGS);
+extern Datum tidlt(PG_FUNCTION_ARGS);
+extern Datum tidle(PG_FUNCTION_ARGS);
+extern Datum tidgt(PG_FUNCTION_ARGS);
+extern Datum tidge(PG_FUNCTION_ARGS);
+extern Datum bttidcmp(PG_FUNCTION_ARGS);
+extern Datum tidlarger(PG_FUNCTION_ARGS);
+extern Datum tidsmaller(PG_FUNCTION_ARGS);
+extern Datum currtid_byreloid(PG_FUNCTION_ARGS);
+extern Datum currtid_byrelname(PG_FUNCTION_ARGS);
+
+/* varchar.c */
+extern Datum bpcharin(PG_FUNCTION_ARGS);
+extern Datum bpcharout(PG_FUNCTION_ARGS);
+extern Datum bpcharrecv(PG_FUNCTION_ARGS);
+extern Datum bpcharsend(PG_FUNCTION_ARGS);
+extern Datum bpchartypmodin(PG_FUNCTION_ARGS);
+extern Datum bpchartypmodout(PG_FUNCTION_ARGS);
+extern Datum bpchar(PG_FUNCTION_ARGS);
+extern Datum char_bpchar(PG_FUNCTION_ARGS);
+extern Datum name_bpchar(PG_FUNCTION_ARGS);
+extern Datum bpchar_name(PG_FUNCTION_ARGS);
+extern Datum bpchareq(PG_FUNCTION_ARGS);
+extern Datum bpcharne(PG_FUNCTION_ARGS);
+extern Datum bpcharlt(PG_FUNCTION_ARGS);
+extern Datum bpcharle(PG_FUNCTION_ARGS);
+extern Datum bpchargt(PG_FUNCTION_ARGS);
+extern Datum bpcharge(PG_FUNCTION_ARGS);
+extern Datum bpcharcmp(PG_FUNCTION_ARGS);
+extern Datum bpchar_larger(PG_FUNCTION_ARGS);
+extern Datum bpchar_smaller(PG_FUNCTION_ARGS);
+extern Datum bpcharlen(PG_FUNCTION_ARGS);
+extern Datum bpcharoctetlen(PG_FUNCTION_ARGS);
+extern Datum hashbpchar(PG_FUNCTION_ARGS);
+extern Datum bpchar_pattern_lt(PG_FUNCTION_ARGS);
+extern Datum bpchar_pattern_le(PG_FUNCTION_ARGS);
+extern Datum bpchar_pattern_gt(PG_FUNCTION_ARGS);
+extern Datum bpchar_pattern_ge(PG_FUNCTION_ARGS);
+extern Datum btbpchar_pattern_cmp(PG_FUNCTION_ARGS);
+
+extern Datum varcharin(PG_FUNCTION_ARGS);
+extern Datum varcharout(PG_FUNCTION_ARGS);
+extern Datum varcharrecv(PG_FUNCTION_ARGS);
+extern Datum varcharsend(PG_FUNCTION_ARGS);
+extern Datum varchartypmodin(PG_FUNCTION_ARGS);
+extern Datum varchartypmodout(PG_FUNCTION_ARGS);
+extern Datum varchar_transform(PG_FUNCTION_ARGS);
+extern Datum varchar(PG_FUNCTION_ARGS);
+
+/* varlena.c */
+extern text *cstring_to_text(const char *s);
+extern text *cstring_to_text_with_len(const char *s, int len);
+extern char *text_to_cstring(const text *t);
+extern void text_to_cstring_buffer(const text *src, char *dst, size_t dst_len);
+
+#define CStringGetTextDatum(s) PointerGetDatum(cstring_to_text(s))
+#define TextDatumGetCString(d) text_to_cstring((text *) DatumGetPointer(d))
+
+extern Datum textin(PG_FUNCTION_ARGS);
+extern Datum textout(PG_FUNCTION_ARGS);
+extern Datum textrecv(PG_FUNCTION_ARGS);
+extern Datum textsend(PG_FUNCTION_ARGS);
+extern Datum textcat(PG_FUNCTION_ARGS);
+extern Datum texteq(PG_FUNCTION_ARGS);
+extern Datum textne(PG_FUNCTION_ARGS);
+extern Datum text_lt(PG_FUNCTION_ARGS);
+extern Datum text_le(PG_FUNCTION_ARGS);
+extern Datum text_gt(PG_FUNCTION_ARGS);
+extern Datum text_ge(PG_FUNCTION_ARGS);
+extern Datum text_larger(PG_FUNCTION_ARGS);
+extern Datum text_smaller(PG_FUNCTION_ARGS);
+extern Datum text_pattern_lt(PG_FUNCTION_ARGS);
+extern Datum text_pattern_le(PG_FUNCTION_ARGS);
+extern Datum text_pattern_gt(PG_FUNCTION_ARGS);
+extern Datum text_pattern_ge(PG_FUNCTION_ARGS);
+extern Datum bttext_pattern_cmp(PG_FUNCTION_ARGS);
+extern Datum textlen(PG_FUNCTION_ARGS);
+extern Datum textoctetlen(PG_FUNCTION_ARGS);
+extern Datum textpos(PG_FUNCTION_ARGS);
+extern Datum text_substr(PG_FUNCTION_ARGS);
+extern Datum text_substr_no_len(PG_FUNCTION_ARGS);
+extern Datum textoverlay(PG_FUNCTION_ARGS);
+extern Datum textoverlay_no_len(PG_FUNCTION_ARGS);
+extern Datum name_text(PG_FUNCTION_ARGS);
+extern Datum text_name(PG_FUNCTION_ARGS);
+extern int	varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid);
+extern int varstr_levenshtein(const char *source, int slen,
+				   const char *target, int tlen,
+				   int ins_c, int del_c, int sub_c,
+				   bool trusted);
+extern int varstr_levenshtein_less_equal(const char *source, int slen,
+							  const char *target, int tlen,
+							  int ins_c, int del_c, int sub_c,
+							  int max_d, bool trusted);
+extern List *textToQualifiedNameList(text *textval);
+extern bool SplitIdentifierString(char *rawstring, char separator,
+					  List **namelist);
+extern bool SplitDirectoriesString(char *rawstring, char separator,
+					   List **namelist);
+extern Datum replace_text(PG_FUNCTION_ARGS);
+extern text *replace_text_regexp(text *src_text, void *regexp,
+					text *replace_text, bool glob);
+extern Datum split_text(PG_FUNCTION_ARGS);
+extern Datum text_to_array(PG_FUNCTION_ARGS);
+extern Datum array_to_text(PG_FUNCTION_ARGS);
+extern Datum text_to_array_null(PG_FUNCTION_ARGS);
+extern Datum array_to_text_null(PG_FUNCTION_ARGS);
+extern Datum to_hex32(PG_FUNCTION_ARGS);
+extern Datum to_hex64(PG_FUNCTION_ARGS);
+extern Datum md5_text(PG_FUNCTION_ARGS);
+extern Datum md5_bytea(PG_FUNCTION_ARGS);
+
+extern Datum unknownin(PG_FUNCTION_ARGS);
+extern Datum unknownout(PG_FUNCTION_ARGS);
+extern Datum unknownrecv(PG_FUNCTION_ARGS);
+extern Datum unknownsend(PG_FUNCTION_ARGS);
+
+extern Datum pg_column_size(PG_FUNCTION_ARGS);
+
+extern Datum bytea_string_agg_transfn(PG_FUNCTION_ARGS);
+extern Datum bytea_string_agg_finalfn(PG_FUNCTION_ARGS);
+extern Datum string_agg_transfn(PG_FUNCTION_ARGS);
+extern Datum string_agg_finalfn(PG_FUNCTION_ARGS);
+
+extern Datum text_concat(PG_FUNCTION_ARGS);
+extern Datum text_concat_ws(PG_FUNCTION_ARGS);
+extern Datum text_left(PG_FUNCTION_ARGS);
+extern Datum text_right(PG_FUNCTION_ARGS);
+extern Datum text_reverse(PG_FUNCTION_ARGS);
+extern Datum text_format(PG_FUNCTION_ARGS);
+extern Datum text_format_nv(PG_FUNCTION_ARGS);
+
+/* version.c */
+extern Datum pgsql_version(PG_FUNCTION_ARGS);
+
+/* xid.c */
+extern Datum xidin(PG_FUNCTION_ARGS);
+extern Datum xidout(PG_FUNCTION_ARGS);
+extern Datum xidrecv(PG_FUNCTION_ARGS);
+extern Datum xidsend(PG_FUNCTION_ARGS);
+extern Datum xideq(PG_FUNCTION_ARGS);
+extern Datum xid_age(PG_FUNCTION_ARGS);
+extern Datum mxid_age(PG_FUNCTION_ARGS);
+extern int	xidComparator(const void *arg1, const void *arg2);
+extern Datum cidin(PG_FUNCTION_ARGS);
+extern Datum cidout(PG_FUNCTION_ARGS);
+extern Datum cidrecv(PG_FUNCTION_ARGS);
+extern Datum cidsend(PG_FUNCTION_ARGS);
+extern Datum cideq(PG_FUNCTION_ARGS);
+
+/* like.c */
+extern Datum namelike(PG_FUNCTION_ARGS);
+extern Datum namenlike(PG_FUNCTION_ARGS);
+extern Datum nameiclike(PG_FUNCTION_ARGS);
+extern Datum nameicnlike(PG_FUNCTION_ARGS);
+extern Datum textlike(PG_FUNCTION_ARGS);
+extern Datum textnlike(PG_FUNCTION_ARGS);
+extern Datum texticlike(PG_FUNCTION_ARGS);
+extern Datum texticnlike(PG_FUNCTION_ARGS);
+extern Datum bytealike(PG_FUNCTION_ARGS);
+extern Datum byteanlike(PG_FUNCTION_ARGS);
+extern Datum like_escape(PG_FUNCTION_ARGS);
+extern Datum like_escape_bytea(PG_FUNCTION_ARGS);
+
+/* oracle_compat.c */
+extern Datum lower(PG_FUNCTION_ARGS);
+extern Datum upper(PG_FUNCTION_ARGS);
+extern Datum initcap(PG_FUNCTION_ARGS);
+extern Datum lpad(PG_FUNCTION_ARGS);
+extern Datum rpad(PG_FUNCTION_ARGS);
+extern Datum btrim(PG_FUNCTION_ARGS);
+extern Datum btrim1(PG_FUNCTION_ARGS);
+extern Datum byteatrim(PG_FUNCTION_ARGS);
+extern Datum ltrim(PG_FUNCTION_ARGS);
+extern Datum ltrim1(PG_FUNCTION_ARGS);
+extern Datum rtrim(PG_FUNCTION_ARGS);
+extern Datum rtrim1(PG_FUNCTION_ARGS);
+extern Datum translate(PG_FUNCTION_ARGS);
+extern Datum chr (PG_FUNCTION_ARGS);
+extern Datum repeat(PG_FUNCTION_ARGS);
+extern Datum ascii(PG_FUNCTION_ARGS);
+
+/* inet_cidr_ntop.c */
+extern char *inet_cidr_ntop(int af, const void *src, int bits,
+			   char *dst, size_t size);
+
+/* inet_net_pton.c */
+extern int inet_net_pton(int af, const char *src,
+			  void *dst, size_t size);
+
+/* network.c */
+extern Datum inet_in(PG_FUNCTION_ARGS);
+extern Datum inet_out(PG_FUNCTION_ARGS);
+extern Datum inet_recv(PG_FUNCTION_ARGS);
+extern Datum inet_send(PG_FUNCTION_ARGS);
+extern Datum cidr_in(PG_FUNCTION_ARGS);
+extern Datum cidr_out(PG_FUNCTION_ARGS);
+extern Datum cidr_recv(PG_FUNCTION_ARGS);
+extern Datum cidr_send(PG_FUNCTION_ARGS);
+extern Datum network_cmp(PG_FUNCTION_ARGS);
+extern Datum network_lt(PG_FUNCTION_ARGS);
+extern Datum network_le(PG_FUNCTION_ARGS);
+extern Datum network_eq(PG_FUNCTION_ARGS);
+extern Datum network_ge(PG_FUNCTION_ARGS);
+extern Datum network_gt(PG_FUNCTION_ARGS);
+extern Datum network_ne(PG_FUNCTION_ARGS);
+extern Datum network_smaller(PG_FUNCTION_ARGS);
+extern Datum network_larger(PG_FUNCTION_ARGS);
+extern Datum hashinet(PG_FUNCTION_ARGS);
+extern Datum network_sub(PG_FUNCTION_ARGS);
+extern Datum network_subeq(PG_FUNCTION_ARGS);
+extern Datum network_sup(PG_FUNCTION_ARGS);
+extern Datum network_supeq(PG_FUNCTION_ARGS);
+extern Datum network_overlap(PG_FUNCTION_ARGS);
+extern Datum network_network(PG_FUNCTION_ARGS);
+extern Datum network_netmask(PG_FUNCTION_ARGS);
+extern Datum network_hostmask(PG_FUNCTION_ARGS);
+extern Datum network_masklen(PG_FUNCTION_ARGS);
+extern Datum network_family(PG_FUNCTION_ARGS);
+extern Datum network_broadcast(PG_FUNCTION_ARGS);
+extern Datum network_host(PG_FUNCTION_ARGS);
+extern Datum network_show(PG_FUNCTION_ARGS);
+extern Datum inet_abbrev(PG_FUNCTION_ARGS);
+extern Datum cidr_abbrev(PG_FUNCTION_ARGS);
+extern double convert_network_to_scalar(Datum value, Oid typid);
+extern Datum inet_to_cidr(PG_FUNCTION_ARGS);
+extern Datum inet_set_masklen(PG_FUNCTION_ARGS);
+extern Datum cidr_set_masklen(PG_FUNCTION_ARGS);
+extern Datum network_scan_first(Datum in);
+extern Datum network_scan_last(Datum in);
+extern Datum inet_client_addr(PG_FUNCTION_ARGS);
+extern Datum inet_client_port(PG_FUNCTION_ARGS);
+extern Datum inet_server_addr(PG_FUNCTION_ARGS);
+extern Datum inet_server_port(PG_FUNCTION_ARGS);
+extern Datum inetnot(PG_FUNCTION_ARGS);
+extern Datum inetand(PG_FUNCTION_ARGS);
+extern Datum inetor(PG_FUNCTION_ARGS);
+extern Datum inetpl(PG_FUNCTION_ARGS);
+extern Datum inetmi_int8(PG_FUNCTION_ARGS);
+extern Datum inetmi(PG_FUNCTION_ARGS);
+extern void clean_ipv6_addr(int addr_family, char *addr);
+extern Datum inet_same_family(PG_FUNCTION_ARGS);
+extern Datum inet_merge(PG_FUNCTION_ARGS);
+
+/* mac.c */
+extern Datum macaddr_in(PG_FUNCTION_ARGS);
+extern Datum macaddr_out(PG_FUNCTION_ARGS);
+extern Datum macaddr_recv(PG_FUNCTION_ARGS);
+extern Datum macaddr_send(PG_FUNCTION_ARGS);
+extern Datum macaddr_cmp(PG_FUNCTION_ARGS);
+extern Datum macaddr_lt(PG_FUNCTION_ARGS);
+extern Datum macaddr_le(PG_FUNCTION_ARGS);
+extern Datum macaddr_eq(PG_FUNCTION_ARGS);
+extern Datum macaddr_ge(PG_FUNCTION_ARGS);
+extern Datum macaddr_gt(PG_FUNCTION_ARGS);
+extern Datum macaddr_ne(PG_FUNCTION_ARGS);
+extern Datum macaddr_not(PG_FUNCTION_ARGS);
+extern Datum macaddr_and(PG_FUNCTION_ARGS);
+extern Datum macaddr_or(PG_FUNCTION_ARGS);
+extern Datum macaddr_trunc(PG_FUNCTION_ARGS);
+extern Datum hashmacaddr(PG_FUNCTION_ARGS);
+
+/* numeric.c */
+extern Datum numeric_in(PG_FUNCTION_ARGS);
+extern Datum numeric_out(PG_FUNCTION_ARGS);
+extern Datum numeric_recv(PG_FUNCTION_ARGS);
+extern Datum numeric_send(PG_FUNCTION_ARGS);
+extern Datum numerictypmodin(PG_FUNCTION_ARGS);
+extern Datum numerictypmodout(PG_FUNCTION_ARGS);
+extern Datum numeric_transform(PG_FUNCTION_ARGS);
+extern Datum numeric (PG_FUNCTION_ARGS);
+extern Datum numeric_abs(PG_FUNCTION_ARGS);
+extern Datum numeric_uminus(PG_FUNCTION_ARGS);
+extern Datum numeric_uplus(PG_FUNCTION_ARGS);
+extern Datum numeric_sign(PG_FUNCTION_ARGS);
+extern Datum numeric_round(PG_FUNCTION_ARGS);
+extern Datum numeric_trunc(PG_FUNCTION_ARGS);
+extern Datum numeric_ceil(PG_FUNCTION_ARGS);
+extern Datum numeric_floor(PG_FUNCTION_ARGS);
+extern Datum numeric_sortsupport(PG_FUNCTION_ARGS);
+extern Datum numeric_cmp(PG_FUNCTION_ARGS);
+extern Datum numeric_eq(PG_FUNCTION_ARGS);
+extern Datum numeric_ne(PG_FUNCTION_ARGS);
+extern Datum numeric_gt(PG_FUNCTION_ARGS);
+extern Datum numeric_ge(PG_FUNCTION_ARGS);
+extern Datum numeric_lt(PG_FUNCTION_ARGS);
+extern Datum numeric_le(PG_FUNCTION_ARGS);
+extern Datum numeric_add(PG_FUNCTION_ARGS);
+extern Datum numeric_sub(PG_FUNCTION_ARGS);
+extern Datum numeric_mul(PG_FUNCTION_ARGS);
+extern Datum numeric_div(PG_FUNCTION_ARGS);
+extern Datum numeric_div_trunc(PG_FUNCTION_ARGS);
+extern Datum numeric_mod(PG_FUNCTION_ARGS);
+extern Datum numeric_inc(PG_FUNCTION_ARGS);
+extern Datum numeric_smaller(PG_FUNCTION_ARGS);
+extern Datum numeric_larger(PG_FUNCTION_ARGS);
+extern Datum numeric_fac(PG_FUNCTION_ARGS);
+extern Datum numeric_sqrt(PG_FUNCTION_ARGS);
+extern Datum numeric_exp(PG_FUNCTION_ARGS);
+extern Datum numeric_ln(PG_FUNCTION_ARGS);
+extern Datum numeric_log(PG_FUNCTION_ARGS);
+extern Datum numeric_power(PG_FUNCTION_ARGS);
+extern Datum int4_numeric(PG_FUNCTION_ARGS);
+extern Datum numeric_int4(PG_FUNCTION_ARGS);
+extern Datum int8_numeric(PG_FUNCTION_ARGS);
+extern Datum numeric_int8(PG_FUNCTION_ARGS);
+extern Datum int2_numeric(PG_FUNCTION_ARGS);
+extern Datum numeric_int2(PG_FUNCTION_ARGS);
+extern Datum float8_numeric(PG_FUNCTION_ARGS);
+extern Datum numeric_float8(PG_FUNCTION_ARGS);
+extern Datum numeric_float8_no_overflow(PG_FUNCTION_ARGS);
+extern Datum float4_numeric(PG_FUNCTION_ARGS);
+extern Datum numeric_float4(PG_FUNCTION_ARGS);
+extern Datum numeric_accum(PG_FUNCTION_ARGS);
+extern Datum numeric_avg_accum(PG_FUNCTION_ARGS);
+extern Datum numeric_accum_inv(PG_FUNCTION_ARGS);
+extern Datum int2_accum(PG_FUNCTION_ARGS);
+extern Datum int4_accum(PG_FUNCTION_ARGS);
+extern Datum int8_accum(PG_FUNCTION_ARGS);
+extern Datum int2_accum_inv(PG_FUNCTION_ARGS);
+extern Datum int4_accum_inv(PG_FUNCTION_ARGS);
+extern Datum int8_accum_inv(PG_FUNCTION_ARGS);
+extern Datum int8_avg_accum(PG_FUNCTION_ARGS);
+extern Datum numeric_avg(PG_FUNCTION_ARGS);
+extern Datum numeric_sum(PG_FUNCTION_ARGS);
+extern Datum numeric_var_pop(PG_FUNCTION_ARGS);
+extern Datum numeric_var_samp(PG_FUNCTION_ARGS);
+extern Datum numeric_stddev_pop(PG_FUNCTION_ARGS);
+extern Datum numeric_stddev_samp(PG_FUNCTION_ARGS);
+extern Datum numeric_poly_sum(PG_FUNCTION_ARGS);
+extern Datum numeric_poly_avg(PG_FUNCTION_ARGS);
+extern Datum numeric_poly_var_pop(PG_FUNCTION_ARGS);
+extern Datum numeric_poly_var_samp(PG_FUNCTION_ARGS);
+extern Datum numeric_poly_stddev_pop(PG_FUNCTION_ARGS);
+extern Datum numeric_poly_stddev_samp(PG_FUNCTION_ARGS);
+extern Datum int2_sum(PG_FUNCTION_ARGS);
+extern Datum int4_sum(PG_FUNCTION_ARGS);
+extern Datum int8_sum(PG_FUNCTION_ARGS);
+extern Datum int2_avg_accum(PG_FUNCTION_ARGS);
+extern Datum int4_avg_accum(PG_FUNCTION_ARGS);
+extern Datum int2_avg_accum_inv(PG_FUNCTION_ARGS);
+extern Datum int4_avg_accum_inv(PG_FUNCTION_ARGS);
+extern Datum int8_avg_accum_inv(PG_FUNCTION_ARGS);
+extern Datum int8_avg(PG_FUNCTION_ARGS);
+extern Datum int2int4_sum(PG_FUNCTION_ARGS);
+extern Datum width_bucket_numeric(PG_FUNCTION_ARGS);
+extern Datum hash_numeric(PG_FUNCTION_ARGS);
+extern Datum generate_series_numeric(PG_FUNCTION_ARGS);
+extern Datum generate_series_step_numeric(PG_FUNCTION_ARGS);
+
+/* ri_triggers.c */
+extern Datum RI_FKey_check_ins(PG_FUNCTION_ARGS);
+extern Datum RI_FKey_check_upd(PG_FUNCTION_ARGS);
+extern Datum RI_FKey_noaction_del(PG_FUNCTION_ARGS);
+extern Datum RI_FKey_noaction_upd(PG_FUNCTION_ARGS);
+extern Datum RI_FKey_cascade_del(PG_FUNCTION_ARGS);
+extern Datum RI_FKey_cascade_upd(PG_FUNCTION_ARGS);
+extern Datum RI_FKey_restrict_del(PG_FUNCTION_ARGS);
+extern Datum RI_FKey_restrict_upd(PG_FUNCTION_ARGS);
+extern Datum RI_FKey_setnull_del(PG_FUNCTION_ARGS);
+extern Datum RI_FKey_setnull_upd(PG_FUNCTION_ARGS);
+extern Datum RI_FKey_setdefault_del(PG_FUNCTION_ARGS);
+extern Datum RI_FKey_setdefault_upd(PG_FUNCTION_ARGS);
+
+/* trigfuncs.c */
+extern Datum suppress_redundant_updates_trigger(PG_FUNCTION_ARGS);
+
+/* encoding support functions */
+extern Datum getdatabaseencoding(PG_FUNCTION_ARGS);
+extern Datum database_character_set(PG_FUNCTION_ARGS);
+extern Datum pg_client_encoding(PG_FUNCTION_ARGS);
+extern Datum PG_encoding_to_char(PG_FUNCTION_ARGS);
+extern Datum PG_char_to_encoding(PG_FUNCTION_ARGS);
+extern Datum PG_character_set_name(PG_FUNCTION_ARGS);
+extern Datum PG_character_set_id(PG_FUNCTION_ARGS);
+extern Datum pg_convert(PG_FUNCTION_ARGS);
+extern Datum pg_convert_to(PG_FUNCTION_ARGS);
+extern Datum pg_convert_from(PG_FUNCTION_ARGS);
+extern Datum length_in_encoding(PG_FUNCTION_ARGS);
+extern Datum pg_encoding_max_length_sql(PG_FUNCTION_ARGS);
+
+/* format_type.c */
+extern Datum format_type(PG_FUNCTION_ARGS);
+extern char *format_type_be(Oid type_oid);
+extern char *format_type_be_qualified(Oid type_oid);
+extern char *format_type_with_typemod(Oid type_oid, int32 typemod);
+extern Datum oidvectortypes(PG_FUNCTION_ARGS);
+extern int32 type_maximum_size(Oid type_oid, int32 typemod);
+
+/* quote.c */
+extern Datum quote_ident(PG_FUNCTION_ARGS);
+extern Datum quote_literal(PG_FUNCTION_ARGS);
+extern char *quote_literal_cstr(const char *rawstr);
+extern Datum quote_nullable(PG_FUNCTION_ARGS);
+
+/* guc.c */
+extern Datum show_config_by_name(PG_FUNCTION_ARGS);
+extern Datum set_config_by_name(PG_FUNCTION_ARGS);
+extern Datum show_all_settings(PG_FUNCTION_ARGS);
+extern Datum show_all_file_settings(PG_FUNCTION_ARGS);
+
+/* rls.c */
+extern Datum row_security_active(PG_FUNCTION_ARGS);
+extern Datum row_security_active_name(PG_FUNCTION_ARGS);
+
+/* lockfuncs.c */
+extern Datum pg_lock_status(PG_FUNCTION_ARGS);
+extern Datum pg_advisory_lock_int8(PG_FUNCTION_ARGS);
+extern Datum pg_advisory_xact_lock_int8(PG_FUNCTION_ARGS);
+extern Datum pg_advisory_lock_shared_int8(PG_FUNCTION_ARGS);
+extern Datum pg_advisory_xact_lock_shared_int8(PG_FUNCTION_ARGS);
+extern Datum pg_try_advisory_lock_int8(PG_FUNCTION_ARGS);
+extern Datum pg_try_advisory_xact_lock_int8(PG_FUNCTION_ARGS);
+extern Datum pg_try_advisory_lock_shared_int8(PG_FUNCTION_ARGS);
+extern Datum pg_try_advisory_xact_lock_shared_int8(PG_FUNCTION_ARGS);
+extern Datum pg_advisory_unlock_int8(PG_FUNCTION_ARGS);
+extern Datum pg_advisory_unlock_shared_int8(PG_FUNCTION_ARGS);
+extern Datum pg_advisory_lock_int4(PG_FUNCTION_ARGS);
+extern Datum pg_advisory_xact_lock_int4(PG_FUNCTION_ARGS);
+extern Datum pg_advisory_lock_shared_int4(PG_FUNCTION_ARGS);
+extern Datum pg_advisory_xact_lock_shared_int4(PG_FUNCTION_ARGS);
+extern Datum pg_try_advisory_lock_int4(PG_FUNCTION_ARGS);
+extern Datum pg_try_advisory_xact_lock_int4(PG_FUNCTION_ARGS);
+extern Datum pg_try_advisory_lock_shared_int4(PG_FUNCTION_ARGS);
+extern Datum pg_try_advisory_xact_lock_shared_int4(PG_FUNCTION_ARGS);
+extern Datum pg_advisory_unlock_int4(PG_FUNCTION_ARGS);
+extern Datum pg_advisory_unlock_shared_int4(PG_FUNCTION_ARGS);
+extern Datum pg_advisory_unlock_all(PG_FUNCTION_ARGS);
+
+/* txid.c */
+extern Datum txid_snapshot_in(PG_FUNCTION_ARGS);
+extern Datum txid_snapshot_out(PG_FUNCTION_ARGS);
+extern Datum txid_snapshot_recv(PG_FUNCTION_ARGS);
+extern Datum txid_snapshot_send(PG_FUNCTION_ARGS);
+extern Datum txid_current(PG_FUNCTION_ARGS);
+extern Datum txid_current_snapshot(PG_FUNCTION_ARGS);
+extern Datum txid_snapshot_xmin(PG_FUNCTION_ARGS);
+extern Datum txid_snapshot_xmax(PG_FUNCTION_ARGS);
+extern Datum txid_snapshot_xip(PG_FUNCTION_ARGS);
+extern Datum txid_visible_in_snapshot(PG_FUNCTION_ARGS);
+
+/* uuid.c */
+extern Datum uuid_in(PG_FUNCTION_ARGS);
+extern Datum uuid_out(PG_FUNCTION_ARGS);
+extern Datum uuid_send(PG_FUNCTION_ARGS);
+extern Datum uuid_recv(PG_FUNCTION_ARGS);
+extern Datum uuid_lt(PG_FUNCTION_ARGS);
+extern Datum uuid_le(PG_FUNCTION_ARGS);
+extern Datum uuid_eq(PG_FUNCTION_ARGS);
+extern Datum uuid_ge(PG_FUNCTION_ARGS);
+extern Datum uuid_gt(PG_FUNCTION_ARGS);
+extern Datum uuid_ne(PG_FUNCTION_ARGS);
+extern Datum uuid_cmp(PG_FUNCTION_ARGS);
+extern Datum uuid_hash(PG_FUNCTION_ARGS);
+
+/* windowfuncs.c */
+extern Datum window_row_number(PG_FUNCTION_ARGS);
+extern Datum window_rank(PG_FUNCTION_ARGS);
+extern Datum window_dense_rank(PG_FUNCTION_ARGS);
+extern Datum window_percent_rank(PG_FUNCTION_ARGS);
+extern Datum window_cume_dist(PG_FUNCTION_ARGS);
+extern Datum window_ntile(PG_FUNCTION_ARGS);
+extern Datum window_lag(PG_FUNCTION_ARGS);
+extern Datum window_lag_with_offset(PG_FUNCTION_ARGS);
+extern Datum window_lag_with_offset_and_default(PG_FUNCTION_ARGS);
+extern Datum window_lead(PG_FUNCTION_ARGS);
+extern Datum window_lead_with_offset(PG_FUNCTION_ARGS);
+extern Datum window_lead_with_offset_and_default(PG_FUNCTION_ARGS);
+extern Datum window_first_value(PG_FUNCTION_ARGS);
+extern Datum window_last_value(PG_FUNCTION_ARGS);
+extern Datum window_nth_value(PG_FUNCTION_ARGS);
+
+/* access/spgist/spgquadtreeproc.c */
+extern Datum spg_quad_config(PG_FUNCTION_ARGS);
+extern Datum spg_quad_choose(PG_FUNCTION_ARGS);
+extern Datum spg_quad_picksplit(PG_FUNCTION_ARGS);
+extern Datum spg_quad_inner_consistent(PG_FUNCTION_ARGS);
+extern Datum spg_quad_leaf_consistent(PG_FUNCTION_ARGS);
+
+/* access/spgist/spgkdtreeproc.c */
+extern Datum spg_kd_config(PG_FUNCTION_ARGS);
+extern Datum spg_kd_choose(PG_FUNCTION_ARGS);
+extern Datum spg_kd_picksplit(PG_FUNCTION_ARGS);
+extern Datum spg_kd_inner_consistent(PG_FUNCTION_ARGS);
+
+/* access/spgist/spgtextproc.c */
+extern Datum spg_text_config(PG_FUNCTION_ARGS);
+extern Datum spg_text_choose(PG_FUNCTION_ARGS);
+extern Datum spg_text_picksplit(PG_FUNCTION_ARGS);
+extern Datum spg_text_inner_consistent(PG_FUNCTION_ARGS);
+extern Datum spg_text_leaf_consistent(PG_FUNCTION_ARGS);
+
+/* access/gin/ginarrayproc.c */
+extern Datum ginarrayextract(PG_FUNCTION_ARGS);
+extern Datum ginarrayextract_2args(PG_FUNCTION_ARGS);
+extern Datum ginqueryarrayextract(PG_FUNCTION_ARGS);
+extern Datum ginarrayconsistent(PG_FUNCTION_ARGS);
+extern Datum ginarraytriconsistent(PG_FUNCTION_ARGS);
+
+/* access/tablesample/bernoulli.c */
+extern Datum tsm_bernoulli_handler(PG_FUNCTION_ARGS);
+
+/* access/tablesample/system.c */
+extern Datum tsm_system_handler(PG_FUNCTION_ARGS);
+
+/* access/transam/twophase.c */
+extern Datum pg_prepared_xact(PG_FUNCTION_ARGS);
+
+/* access/transam/multixact.c */
+extern Datum pg_get_multixact_members(PG_FUNCTION_ARGS);
+
+/* access/transam/committs.c */
+extern Datum pg_xact_commit_timestamp(PG_FUNCTION_ARGS);
+extern Datum pg_last_committed_xact(PG_FUNCTION_ARGS);
+
+/* catalogs/dependency.c */
+extern Datum pg_describe_object(PG_FUNCTION_ARGS);
+extern Datum pg_identify_object(PG_FUNCTION_ARGS);
+extern Datum pg_identify_object_as_address(PG_FUNCTION_ARGS);
+
+/* catalog/objectaddress.c */
+extern Datum pg_get_object_address(PG_FUNCTION_ARGS);
+
+/* commands/constraint.c */
+extern Datum unique_key_recheck(PG_FUNCTION_ARGS);
+
+/* commands/event_trigger.c */
+extern Datum pg_event_trigger_dropped_objects(PG_FUNCTION_ARGS);
+extern Datum pg_event_trigger_table_rewrite_oid(PG_FUNCTION_ARGS);
+extern Datum pg_event_trigger_table_rewrite_reason(PG_FUNCTION_ARGS);
+extern Datum pg_event_trigger_ddl_commands(PG_FUNCTION_ARGS);
+
+/* commands/extension.c */
+extern Datum pg_available_extensions(PG_FUNCTION_ARGS);
+extern Datum pg_available_extension_versions(PG_FUNCTION_ARGS);
+extern Datum pg_extension_update_paths(PG_FUNCTION_ARGS);
+extern Datum pg_extension_config_dump(PG_FUNCTION_ARGS);
+
+/* commands/prepare.c */
+extern Datum pg_prepared_statement(PG_FUNCTION_ARGS);
+
+/* utils/mmgr/portalmem.c */
+extern Datum pg_cursor(PG_FUNCTION_ARGS);
+
+#endif   /* BUILTINS_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/bytea.h b/foreign/libpg_query/src/postgres/include/utils/bytea.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/bytea.h
@@ -0,0 +1,52 @@
+/*-------------------------------------------------------------------------
+ *
+ * bytea.h
+ *	  Declarations for BYTEA data type support.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/bytea.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef BYTEA_H
+#define BYTEA_H
+
+#include "fmgr.h"
+
+
+typedef enum
+{
+	BYTEA_OUTPUT_ESCAPE,
+	BYTEA_OUTPUT_HEX
+}	ByteaOutputType;
+
+extern int	bytea_output;		/* ByteaOutputType, but int for GUC enum */
+
+/* functions are in utils/adt/varlena.c */
+extern Datum byteain(PG_FUNCTION_ARGS);
+extern Datum byteaout(PG_FUNCTION_ARGS);
+extern Datum bytearecv(PG_FUNCTION_ARGS);
+extern Datum byteasend(PG_FUNCTION_ARGS);
+extern Datum byteaoctetlen(PG_FUNCTION_ARGS);
+extern Datum byteaGetByte(PG_FUNCTION_ARGS);
+extern Datum byteaGetBit(PG_FUNCTION_ARGS);
+extern Datum byteaSetByte(PG_FUNCTION_ARGS);
+extern Datum byteaSetBit(PG_FUNCTION_ARGS);
+extern Datum byteaeq(PG_FUNCTION_ARGS);
+extern Datum byteane(PG_FUNCTION_ARGS);
+extern Datum bytealt(PG_FUNCTION_ARGS);
+extern Datum byteale(PG_FUNCTION_ARGS);
+extern Datum byteagt(PG_FUNCTION_ARGS);
+extern Datum byteage(PG_FUNCTION_ARGS);
+extern Datum byteacmp(PG_FUNCTION_ARGS);
+extern Datum byteacat(PG_FUNCTION_ARGS);
+extern Datum byteapos(PG_FUNCTION_ARGS);
+extern Datum bytea_substr(PG_FUNCTION_ARGS);
+extern Datum bytea_substr_no_len(PG_FUNCTION_ARGS);
+extern Datum byteaoverlay(PG_FUNCTION_ARGS);
+extern Datum byteaoverlay_no_len(PG_FUNCTION_ARGS);
+
+#endif   /* BYTEA_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/catcache.h b/foreign/libpg_query/src/postgres/include/utils/catcache.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/catcache.h
@@ -0,0 +1,197 @@
+/*-------------------------------------------------------------------------
+ *
+ * catcache.h
+ *	  Low-level catalog cache definitions.
+ *
+ * NOTE: every catalog cache must have a corresponding unique index on
+ * the system table that it caches --- ie, the index must match the keys
+ * used to do lookups in this cache.  All cache fetches are done with
+ * indexscans (under normal conditions).  The index should be unique to
+ * guarantee that there can only be one matching row for a key combination.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/catcache.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef CATCACHE_H
+#define CATCACHE_H
+
+#include "access/htup.h"
+#include "access/skey.h"
+#include "lib/ilist.h"
+#include "utils/relcache.h"
+
+/*
+ *		struct catctup:			individual tuple in the cache.
+ *		struct catclist:		list of tuples matching a partial key.
+ *		struct catcache:		information for managing a cache.
+ *		struct catcacheheader:	information for managing all the caches.
+ */
+
+#define CATCACHE_MAXKEYS		4
+
+typedef struct catcache
+{
+	int			id;				/* cache identifier --- see syscache.h */
+	slist_node	cc_next;		/* list link */
+	const char *cc_relname;		/* name of relation the tuples come from */
+	Oid			cc_reloid;		/* OID of relation the tuples come from */
+	Oid			cc_indexoid;	/* OID of index matching cache keys */
+	bool		cc_relisshared; /* is relation shared across databases? */
+	TupleDesc	cc_tupdesc;		/* tuple descriptor (copied from reldesc) */
+	int			cc_ntup;		/* # of tuples currently in this cache */
+	int			cc_nbuckets;	/* # of hash buckets in this cache */
+	int			cc_nkeys;		/* # of keys (1..CATCACHE_MAXKEYS) */
+	int			cc_key[CATCACHE_MAXKEYS];		/* AttrNumber of each key */
+	PGFunction	cc_hashfunc[CATCACHE_MAXKEYS];	/* hash function for each key */
+	ScanKeyData cc_skey[CATCACHE_MAXKEYS];		/* precomputed key info for
+												 * heap scans */
+	bool		cc_isname[CATCACHE_MAXKEYS];	/* flag "name" key columns */
+	dlist_head	cc_lists;		/* list of CatCList structs */
+#ifdef CATCACHE_STATS
+	long		cc_searches;	/* total # searches against this cache */
+	long		cc_hits;		/* # of matches against existing entry */
+	long		cc_neg_hits;	/* # of matches against negative entry */
+	long		cc_newloads;	/* # of successful loads of new entry */
+
+	/*
+	 * cc_searches - (cc_hits + cc_neg_hits + cc_newloads) is number of failed
+	 * searches, each of which will result in loading a negative entry
+	 */
+	long		cc_invals;		/* # of entries invalidated from cache */
+	long		cc_lsearches;	/* total # list-searches */
+	long		cc_lhits;		/* # of matches against existing lists */
+#endif
+	dlist_head *cc_bucket;		/* hash buckets */
+} CatCache;
+
+
+typedef struct catctup
+{
+	int			ct_magic;		/* for identifying CatCTup entries */
+#define CT_MAGIC   0x57261502
+	CatCache   *my_cache;		/* link to owning catcache */
+
+	/*
+	 * Each tuple in a cache is a member of a dlist that stores the elements
+	 * of its hash bucket.  We keep each dlist in LRU order to speed repeated
+	 * lookups.
+	 */
+	dlist_node	cache_elem;		/* list member of per-bucket list */
+
+	/*
+	 * The tuple may also be a member of at most one CatCList.  (If a single
+	 * catcache is list-searched with varying numbers of keys, we may have to
+	 * make multiple entries for the same tuple because of this restriction.
+	 * Currently, that's not expected to be common, so we accept the potential
+	 * inefficiency.)
+	 */
+	struct catclist *c_list;	/* containing CatCList, or NULL if none */
+
+	/*
+	 * A tuple marked "dead" must not be returned by subsequent searches.
+	 * However, it won't be physically deleted from the cache until its
+	 * refcount goes to zero.  (If it's a member of a CatCList, the list's
+	 * refcount must go to zero, too; also, remember to mark the list dead at
+	 * the same time the tuple is marked.)
+	 *
+	 * A negative cache entry is an assertion that there is no tuple matching
+	 * a particular key.  This is just as useful as a normal entry so far as
+	 * avoiding catalog searches is concerned.  Management of positive and
+	 * negative entries is identical.
+	 */
+	int			refcount;		/* number of active references */
+	bool		dead;			/* dead but not yet removed? */
+	bool		negative;		/* negative cache entry? */
+	uint32		hash_value;		/* hash value for this tuple's keys */
+	HeapTupleData tuple;		/* tuple management header */
+} CatCTup;
+
+
+typedef struct catclist
+{
+	int			cl_magic;		/* for identifying CatCList entries */
+#define CL_MAGIC   0x52765103
+	CatCache   *my_cache;		/* link to owning catcache */
+
+	/*
+	 * A CatCList describes the result of a partial search, ie, a search using
+	 * only the first K key columns of an N-key cache.  We form the keys used
+	 * into a tuple (with other attributes NULL) to represent the stored key
+	 * set.  The CatCList object contains links to cache entries for all the
+	 * table rows satisfying the partial key.  (Note: none of these will be
+	 * negative cache entries.)
+	 *
+	 * A CatCList is only a member of a per-cache list; we do not currently
+	 * divide them into hash buckets.
+	 *
+	 * A list marked "dead" must not be returned by subsequent searches.
+	 * However, it won't be physically deleted from the cache until its
+	 * refcount goes to zero.  (A list should be marked dead if any of its
+	 * member entries are dead.)
+	 *
+	 * If "ordered" is true then the member tuples appear in the order of the
+	 * cache's underlying index.  This will be true in normal operation, but
+	 * might not be true during bootstrap or recovery operations. (namespace.c
+	 * is able to save some cycles when it is true.)
+	 */
+	dlist_node	cache_elem;		/* list member of per-catcache list */
+	int			refcount;		/* number of active references */
+	bool		dead;			/* dead but not yet removed? */
+	bool		ordered;		/* members listed in index order? */
+	short		nkeys;			/* number of lookup keys specified */
+	uint32		hash_value;		/* hash value for lookup keys */
+	HeapTupleData tuple;		/* header for tuple holding keys */
+	int			n_members;		/* number of member tuples */
+	CatCTup    *members[FLEXIBLE_ARRAY_MEMBER]; /* members */
+} CatCList;
+
+
+typedef struct catcacheheader
+{
+	slist_head	ch_caches;		/* head of list of CatCache structs */
+	int			ch_ntup;		/* # of tuples in all caches */
+} CatCacheHeader;
+
+
+/* this extern duplicates utils/memutils.h... */
+extern PGDLLIMPORT MemoryContext CacheMemoryContext;
+
+extern void CreateCacheMemoryContext(void);
+extern void AtEOXact_CatCache(bool isCommit);
+
+extern CatCache *InitCatCache(int id, Oid reloid, Oid indexoid,
+			 int nkeys, const int *key,
+			 int nbuckets);
+extern void InitCatCachePhase2(CatCache *cache, bool touch_index);
+
+extern HeapTuple SearchCatCache(CatCache *cache,
+			   Datum v1, Datum v2,
+			   Datum v3, Datum v4);
+extern void ReleaseCatCache(HeapTuple tuple);
+
+extern uint32 GetCatCacheHashValue(CatCache *cache,
+					 Datum v1, Datum v2,
+					 Datum v3, Datum v4);
+
+extern CatCList *SearchCatCacheList(CatCache *cache, int nkeys,
+				   Datum v1, Datum v2,
+				   Datum v3, Datum v4);
+extern void ReleaseCatCacheList(CatCList *list);
+
+extern void ResetCatalogCaches(void);
+extern void CatalogCacheFlushCatalog(Oid catId);
+extern void CatalogCacheIdInvalidate(int cacheId, uint32 hashValue);
+extern void PrepareToInvalidateCacheTuple(Relation relation,
+							  HeapTuple tuple,
+							  HeapTuple newtuple,
+							  void (*function) (int, uint32, Oid));
+
+extern void PrintCatCacheLeakWarning(HeapTuple tuple);
+extern void PrintCatCacheListLeakWarning(CatCList *list);
+
+#endif   /* CATCACHE_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/date.h b/foreign/libpg_query/src/postgres/include/utils/date.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/date.h
@@ -0,0 +1,208 @@
+/*-------------------------------------------------------------------------
+ *
+ * date.h
+ *	  Definitions for the SQL "date" and "time" types.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/date.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef DATE_H
+#define DATE_H
+
+#include <math.h>
+
+#include "fmgr.h"
+
+
+typedef int32 DateADT;
+
+#ifdef HAVE_INT64_TIMESTAMP
+typedef int64 TimeADT;
+#else
+typedef float8 TimeADT;
+#endif
+
+typedef struct
+{
+	TimeADT		time;			/* all time units other than months and years */
+	int32		zone;			/* numeric time zone, in seconds */
+} TimeTzADT;
+
+/*
+ * Infinity and minus infinity must be the max and min values of DateADT.
+ */
+#define DATEVAL_NOBEGIN		((DateADT) PG_INT32_MIN)
+#define DATEVAL_NOEND		((DateADT) PG_INT32_MAX)
+
+#define DATE_NOBEGIN(j)		((j) = DATEVAL_NOBEGIN)
+#define DATE_IS_NOBEGIN(j)	((j) == DATEVAL_NOBEGIN)
+#define DATE_NOEND(j)		((j) = DATEVAL_NOEND)
+#define DATE_IS_NOEND(j)	((j) == DATEVAL_NOEND)
+#define DATE_NOT_FINITE(j)	(DATE_IS_NOBEGIN(j) || DATE_IS_NOEND(j))
+
+/*
+ * Macros for fmgr-callable functions.
+ *
+ * For TimeADT, we make use of the same support routines as for float8 or int64.
+ * Therefore TimeADT is pass-by-reference if and only if float8 or int64 is!
+ */
+#ifdef HAVE_INT64_TIMESTAMP
+
+#define MAX_TIME_PRECISION 6
+
+#define DatumGetDateADT(X)	  ((DateADT) DatumGetInt32(X))
+#define DatumGetTimeADT(X)	  ((TimeADT) DatumGetInt64(X))
+#define DatumGetTimeTzADTP(X) ((TimeTzADT *) DatumGetPointer(X))
+
+#define DateADTGetDatum(X)	  Int32GetDatum(X)
+#define TimeADTGetDatum(X)	  Int64GetDatum(X)
+#define TimeTzADTPGetDatum(X) PointerGetDatum(X)
+#else							/* !HAVE_INT64_TIMESTAMP */
+
+#define MAX_TIME_PRECISION 10
+
+/* round off to MAX_TIME_PRECISION decimal places */
+#define TIME_PREC_INV 10000000000.0
+#define TIMEROUND(j) (rint(((double) (j)) * TIME_PREC_INV) / TIME_PREC_INV)
+
+#define DatumGetDateADT(X)	  ((DateADT) DatumGetInt32(X))
+#define DatumGetTimeADT(X)	  ((TimeADT) DatumGetFloat8(X))
+#define DatumGetTimeTzADTP(X) ((TimeTzADT *) DatumGetPointer(X))
+
+#define DateADTGetDatum(X)	  Int32GetDatum(X)
+#define TimeADTGetDatum(X)	  Float8GetDatum(X)
+#define TimeTzADTPGetDatum(X) PointerGetDatum(X)
+#endif   /* HAVE_INT64_TIMESTAMP */
+
+#define PG_GETARG_DATEADT(n)	 DatumGetDateADT(PG_GETARG_DATUM(n))
+#define PG_GETARG_TIMEADT(n)	 DatumGetTimeADT(PG_GETARG_DATUM(n))
+#define PG_GETARG_TIMETZADT_P(n) DatumGetTimeTzADTP(PG_GETARG_DATUM(n))
+
+#define PG_RETURN_DATEADT(x)	 return DateADTGetDatum(x)
+#define PG_RETURN_TIMEADT(x)	 return TimeADTGetDatum(x)
+#define PG_RETURN_TIMETZADT_P(x) return TimeTzADTPGetDatum(x)
+
+
+/* date.c */
+extern double date2timestamp_no_overflow(DateADT dateVal);
+extern void EncodeSpecialDate(DateADT dt, char *str);
+
+extern Datum date_in(PG_FUNCTION_ARGS);
+extern Datum date_out(PG_FUNCTION_ARGS);
+extern Datum date_recv(PG_FUNCTION_ARGS);
+extern Datum date_send(PG_FUNCTION_ARGS);
+extern Datum make_date(PG_FUNCTION_ARGS);
+extern Datum date_eq(PG_FUNCTION_ARGS);
+extern Datum date_ne(PG_FUNCTION_ARGS);
+extern Datum date_lt(PG_FUNCTION_ARGS);
+extern Datum date_le(PG_FUNCTION_ARGS);
+extern Datum date_gt(PG_FUNCTION_ARGS);
+extern Datum date_ge(PG_FUNCTION_ARGS);
+extern Datum date_cmp(PG_FUNCTION_ARGS);
+extern Datum date_sortsupport(PG_FUNCTION_ARGS);
+extern Datum date_finite(PG_FUNCTION_ARGS);
+extern Datum date_larger(PG_FUNCTION_ARGS);
+extern Datum date_smaller(PG_FUNCTION_ARGS);
+extern Datum date_mi(PG_FUNCTION_ARGS);
+extern Datum date_pli(PG_FUNCTION_ARGS);
+extern Datum date_mii(PG_FUNCTION_ARGS);
+extern Datum date_eq_timestamp(PG_FUNCTION_ARGS);
+extern Datum date_ne_timestamp(PG_FUNCTION_ARGS);
+extern Datum date_lt_timestamp(PG_FUNCTION_ARGS);
+extern Datum date_le_timestamp(PG_FUNCTION_ARGS);
+extern Datum date_gt_timestamp(PG_FUNCTION_ARGS);
+extern Datum date_ge_timestamp(PG_FUNCTION_ARGS);
+extern Datum date_cmp_timestamp(PG_FUNCTION_ARGS);
+extern Datum date_eq_timestamptz(PG_FUNCTION_ARGS);
+extern Datum date_ne_timestamptz(PG_FUNCTION_ARGS);
+extern Datum date_lt_timestamptz(PG_FUNCTION_ARGS);
+extern Datum date_le_timestamptz(PG_FUNCTION_ARGS);
+extern Datum date_gt_timestamptz(PG_FUNCTION_ARGS);
+extern Datum date_ge_timestamptz(PG_FUNCTION_ARGS);
+extern Datum date_cmp_timestamptz(PG_FUNCTION_ARGS);
+extern Datum timestamp_eq_date(PG_FUNCTION_ARGS);
+extern Datum timestamp_ne_date(PG_FUNCTION_ARGS);
+extern Datum timestamp_lt_date(PG_FUNCTION_ARGS);
+extern Datum timestamp_le_date(PG_FUNCTION_ARGS);
+extern Datum timestamp_gt_date(PG_FUNCTION_ARGS);
+extern Datum timestamp_ge_date(PG_FUNCTION_ARGS);
+extern Datum timestamp_cmp_date(PG_FUNCTION_ARGS);
+extern Datum timestamptz_eq_date(PG_FUNCTION_ARGS);
+extern Datum timestamptz_ne_date(PG_FUNCTION_ARGS);
+extern Datum timestamptz_lt_date(PG_FUNCTION_ARGS);
+extern Datum timestamptz_le_date(PG_FUNCTION_ARGS);
+extern Datum timestamptz_gt_date(PG_FUNCTION_ARGS);
+extern Datum timestamptz_ge_date(PG_FUNCTION_ARGS);
+extern Datum timestamptz_cmp_date(PG_FUNCTION_ARGS);
+extern Datum date_pl_interval(PG_FUNCTION_ARGS);
+extern Datum date_mi_interval(PG_FUNCTION_ARGS);
+extern Datum date_timestamp(PG_FUNCTION_ARGS);
+extern Datum timestamp_date(PG_FUNCTION_ARGS);
+extern Datum date_timestamptz(PG_FUNCTION_ARGS);
+extern Datum timestamptz_date(PG_FUNCTION_ARGS);
+extern Datum datetime_timestamp(PG_FUNCTION_ARGS);
+extern Datum abstime_date(PG_FUNCTION_ARGS);
+
+extern Datum time_in(PG_FUNCTION_ARGS);
+extern Datum time_out(PG_FUNCTION_ARGS);
+extern Datum time_recv(PG_FUNCTION_ARGS);
+extern Datum time_send(PG_FUNCTION_ARGS);
+extern Datum timetypmodin(PG_FUNCTION_ARGS);
+extern Datum timetypmodout(PG_FUNCTION_ARGS);
+extern Datum make_time(PG_FUNCTION_ARGS);
+extern Datum time_transform(PG_FUNCTION_ARGS);
+extern Datum time_scale(PG_FUNCTION_ARGS);
+extern Datum time_eq(PG_FUNCTION_ARGS);
+extern Datum time_ne(PG_FUNCTION_ARGS);
+extern Datum time_lt(PG_FUNCTION_ARGS);
+extern Datum time_le(PG_FUNCTION_ARGS);
+extern Datum time_gt(PG_FUNCTION_ARGS);
+extern Datum time_ge(PG_FUNCTION_ARGS);
+extern Datum time_cmp(PG_FUNCTION_ARGS);
+extern Datum time_hash(PG_FUNCTION_ARGS);
+extern Datum overlaps_time(PG_FUNCTION_ARGS);
+extern Datum time_larger(PG_FUNCTION_ARGS);
+extern Datum time_smaller(PG_FUNCTION_ARGS);
+extern Datum time_mi_time(PG_FUNCTION_ARGS);
+extern Datum timestamp_time(PG_FUNCTION_ARGS);
+extern Datum timestamptz_time(PG_FUNCTION_ARGS);
+extern Datum time_interval(PG_FUNCTION_ARGS);
+extern Datum interval_time(PG_FUNCTION_ARGS);
+extern Datum time_pl_interval(PG_FUNCTION_ARGS);
+extern Datum time_mi_interval(PG_FUNCTION_ARGS);
+extern Datum time_part(PG_FUNCTION_ARGS);
+
+extern Datum timetz_in(PG_FUNCTION_ARGS);
+extern Datum timetz_out(PG_FUNCTION_ARGS);
+extern Datum timetz_recv(PG_FUNCTION_ARGS);
+extern Datum timetz_send(PG_FUNCTION_ARGS);
+extern Datum timetztypmodin(PG_FUNCTION_ARGS);
+extern Datum timetztypmodout(PG_FUNCTION_ARGS);
+extern Datum timetz_scale(PG_FUNCTION_ARGS);
+extern Datum timetz_eq(PG_FUNCTION_ARGS);
+extern Datum timetz_ne(PG_FUNCTION_ARGS);
+extern Datum timetz_lt(PG_FUNCTION_ARGS);
+extern Datum timetz_le(PG_FUNCTION_ARGS);
+extern Datum timetz_gt(PG_FUNCTION_ARGS);
+extern Datum timetz_ge(PG_FUNCTION_ARGS);
+extern Datum timetz_cmp(PG_FUNCTION_ARGS);
+extern Datum timetz_hash(PG_FUNCTION_ARGS);
+extern Datum overlaps_timetz(PG_FUNCTION_ARGS);
+extern Datum timetz_larger(PG_FUNCTION_ARGS);
+extern Datum timetz_smaller(PG_FUNCTION_ARGS);
+extern Datum timetz_time(PG_FUNCTION_ARGS);
+extern Datum time_timetz(PG_FUNCTION_ARGS);
+extern Datum timestamptz_timetz(PG_FUNCTION_ARGS);
+extern Datum datetimetz_timestamptz(PG_FUNCTION_ARGS);
+extern Datum timetz_part(PG_FUNCTION_ARGS);
+extern Datum timetz_zone(PG_FUNCTION_ARGS);
+extern Datum timetz_izone(PG_FUNCTION_ARGS);
+extern Datum timetz_pl_interval(PG_FUNCTION_ARGS);
+extern Datum timetz_mi_interval(PG_FUNCTION_ARGS);
+
+#endif   /* DATE_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/datetime.h b/foreign/libpg_query/src/postgres/include/utils/datetime.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/datetime.h
@@ -0,0 +1,352 @@
+/*-------------------------------------------------------------------------
+ *
+ * datetime.h
+ *	  Definitions for date/time support code.
+ *	  The support code is shared with other date data types,
+ *	   including abstime, reltime, date, and time.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/datetime.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef DATETIME_H
+#define DATETIME_H
+
+#include "nodes/nodes.h"
+#include "utils/timestamp.h"
+
+/* this struct is declared in utils/tzparser.h: */
+struct tzEntry;
+
+
+/* ----------------------------------------------------------------
+ *				time types + support macros
+ *
+ * String definitions for standard time quantities.
+ *
+ * These strings are the defaults used to form output time strings.
+ * Other alternative forms are hardcoded into token tables in datetime.c.
+ * ----------------------------------------------------------------
+ */
+
+#define DAGO			"ago"
+#define DCURRENT		"current"
+#define EPOCH			"epoch"
+#define INVALID			"invalid"
+#define EARLY			"-infinity"
+#define LATE			"infinity"
+#define NOW				"now"
+#define TODAY			"today"
+#define TOMORROW		"tomorrow"
+#define YESTERDAY		"yesterday"
+#define ZULU			"zulu"
+
+#define DMICROSEC		"usecond"
+#define DMILLISEC		"msecond"
+#define DSECOND			"second"
+#define DMINUTE			"minute"
+#define DHOUR			"hour"
+#define DDAY			"day"
+#define DWEEK			"week"
+#define DMONTH			"month"
+#define DQUARTER		"quarter"
+#define DYEAR			"year"
+#define DDECADE			"decade"
+#define DCENTURY		"century"
+#define DMILLENNIUM		"millennium"
+#define DA_D			"ad"
+#define DB_C			"bc"
+#define DTIMEZONE		"timezone"
+
+/*
+ * Fundamental time field definitions for parsing.
+ *
+ *	Meridian:  am, pm, or 24-hour style.
+ *	Millennium: ad, bc
+ */
+
+#define AM		0
+#define PM		1
+#define HR24	2
+
+#define AD		0
+#define BC		1
+
+/*
+ * Field types for time decoding.
+ *
+ * Can't have more of these than there are bits in an unsigned int
+ * since these are turned into bit masks during parsing and decoding.
+ *
+ * Furthermore, the values for YEAR, MONTH, DAY, HOUR, MINUTE, SECOND
+ * must be in the range 0..14 so that the associated bitmasks can fit
+ * into the left half of an INTERVAL's typmod value.  Since those bits
+ * are stored in typmods, you can't change them without initdb!
+ */
+
+#define RESERV	0
+#define MONTH	1
+#define YEAR	2
+#define DAY		3
+#define JULIAN	4
+#define TZ		5				/* fixed-offset timezone abbreviation */
+#define DTZ		6				/* fixed-offset timezone abbrev, DST */
+#define DYNTZ	7				/* dynamic timezone abbreviation */
+#define IGNORE_DTF	8
+#define AMPM	9
+#define HOUR	10
+#define MINUTE	11
+#define SECOND	12
+#define MILLISECOND 13
+#define MICROSECOND 14
+#define DOY		15
+#define DOW		16
+#define UNITS	17
+#define ADBC	18
+/* these are only for relative dates */
+#define AGO		19
+#define ABS_BEFORE		20
+#define ABS_AFTER		21
+/* generic fields to help with parsing */
+#define ISODATE 22
+#define ISOTIME 23
+/* these are only for parsing intervals */
+#define WEEK		24
+#define DECADE		25
+#define CENTURY		26
+#define MILLENNIUM	27
+/* hack for parsing two-word timezone specs "MET DST" etc */
+#define DTZMOD	28				/* "DST" as a separate word */
+/* reserved for unrecognized string values */
+#define UNKNOWN_FIELD	31
+
+/*
+ * Token field definitions for time parsing and decoding.
+ *
+ * Some field type codes (see above) use these as the "value" in datetktbl[].
+ * These are also used for bit masks in DecodeDateTime and friends
+ *	so actually restrict them to within [0,31] for now.
+ * - thomas 97/06/19
+ * Not all of these fields are used for masks in DecodeDateTime
+ *	so allow some larger than 31. - thomas 1997-11-17
+ *
+ * Caution: there are undocumented assumptions in the code that most of these
+ * values are not equal to IGNORE_DTF nor RESERV.  Be very careful when
+ * renumbering values in either of these apparently-independent lists :-(
+ */
+
+#define DTK_NUMBER		0
+#define DTK_STRING		1
+
+#define DTK_DATE		2
+#define DTK_TIME		3
+#define DTK_TZ			4
+#define DTK_AGO			5
+
+#define DTK_SPECIAL		6
+#define DTK_INVALID		7
+#define DTK_CURRENT		8
+#define DTK_EARLY		9
+#define DTK_LATE		10
+#define DTK_EPOCH		11
+#define DTK_NOW			12
+#define DTK_YESTERDAY	13
+#define DTK_TODAY		14
+#define DTK_TOMORROW	15
+#define DTK_ZULU		16
+
+#define DTK_DELTA		17
+#define DTK_SECOND		18
+#define DTK_MINUTE		19
+#define DTK_HOUR		20
+#define DTK_DAY			21
+#define DTK_WEEK		22
+#define DTK_MONTH		23
+#define DTK_QUARTER		24
+#define DTK_YEAR		25
+#define DTK_DECADE		26
+#define DTK_CENTURY		27
+#define DTK_MILLENNIUM	28
+#define DTK_MILLISEC	29
+#define DTK_MICROSEC	30
+#define DTK_JULIAN		31
+
+#define DTK_DOW			32
+#define DTK_DOY			33
+#define DTK_TZ_HOUR		34
+#define DTK_TZ_MINUTE	35
+#define DTK_ISOYEAR		36
+#define DTK_ISODOW		37
+
+
+/*
+ * Bit mask definitions for time parsing.
+ */
+
+#define DTK_M(t)		(0x01 << (t))
+
+/* Convenience: a second, plus any fractional component */
+#define DTK_ALL_SECS_M	(DTK_M(SECOND) | DTK_M(MILLISECOND) | DTK_M(MICROSECOND))
+#define DTK_DATE_M		(DTK_M(YEAR) | DTK_M(MONTH) | DTK_M(DAY))
+#define DTK_TIME_M		(DTK_M(HOUR) | DTK_M(MINUTE) | DTK_ALL_SECS_M)
+
+/*
+ * Working buffer size for input and output of interval, timestamp, etc.
+ * Inputs that need more working space will be rejected early.  Longer outputs
+ * will overrun buffers, so this must suffice for all possible output.  As of
+ * this writing, interval_out() needs the most space at ~90 bytes.
+ */
+#define MAXDATELEN		128
+/* maximum possible number of fields in a date string */
+#define MAXDATEFIELDS	25
+/* only this many chars are stored in datetktbl */
+#define TOKMAXLEN		10
+
+/* keep this struct small; it gets used a lot */
+typedef struct
+{
+	char		token[TOKMAXLEN + 1];	/* always NUL-terminated */
+	char		type;			/* see field type codes above */
+	int32		value;			/* meaning depends on type */
+} datetkn;
+
+/* one of its uses is in tables of time zone abbreviations */
+typedef struct TimeZoneAbbrevTable
+{
+	Size		tblsize;		/* size in bytes of TimeZoneAbbrevTable */
+	int			numabbrevs;		/* number of entries in abbrevs[] array */
+	datetkn		abbrevs[FLEXIBLE_ARRAY_MEMBER];
+	/* DynamicZoneAbbrev(s) may follow the abbrevs[] array */
+} TimeZoneAbbrevTable;
+
+/* auxiliary data for a dynamic time zone abbreviation (non-fixed-offset) */
+typedef struct DynamicZoneAbbrev
+{
+	pg_tz	   *tz;				/* NULL if not yet looked up */
+	char		zone[FLEXIBLE_ARRAY_MEMBER];	/* NUL-terminated zone name */
+} DynamicZoneAbbrev;
+
+
+/* FMODULO()
+ * Macro to replace modf(), which is broken on some platforms.
+ * t = input and remainder
+ * q = integer part
+ * u = divisor
+ */
+#define FMODULO(t,q,u) \
+do { \
+	(q) = (((t) < 0) ? ceil((t) / (u)) : floor((t) / (u))); \
+	if ((q) != 0) (t) -= rint((q) * (u)); \
+} while(0)
+
+/* TMODULO()
+ * Like FMODULO(), but work on the timestamp datatype (either int64 or float8).
+ * We assume that int64 follows the C99 semantics for division (negative
+ * quotients truncate towards zero).
+ */
+#ifdef HAVE_INT64_TIMESTAMP
+#define TMODULO(t,q,u) \
+do { \
+	(q) = ((t) / (u)); \
+	if ((q) != 0) (t) -= ((q) * (u)); \
+} while(0)
+#else
+#define TMODULO(t,q,u) \
+do { \
+	(q) = (((t) < 0) ? ceil((t) / (u)) : floor((t) / (u))); \
+	if ((q) != 0) (t) -= rint((q) * (u)); \
+} while(0)
+#endif
+
+/*
+ * Date/time validation
+ * Include check for leap year.
+ */
+
+extern const char *const months[];		/* months (3-char abbreviations) */
+extern const char *const days[];	/* days (full names) */
+extern const int day_tab[2][13];
+
+/*
+ * These are the rules for the Gregorian calendar, which was adopted in 1582.
+ * However, we use this calculation for all prior years as well because the
+ * SQL standard specifies use of the Gregorian calendar.  This prevents the
+ * date 1500-02-29 from being stored, even though it is valid in the Julian
+ * calendar.
+ */
+#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
+
+
+/*
+ * Datetime input parsing routines (ParseDateTime, DecodeDateTime, etc)
+ * return zero or a positive value on success.  On failure, they return
+ * one of these negative code values.  DateTimeParseError may be used to
+ * produce a correct ereport.
+ */
+#define DTERR_BAD_FORMAT		(-1)
+#define DTERR_FIELD_OVERFLOW	(-2)
+#define DTERR_MD_FIELD_OVERFLOW (-3)	/* triggers hint about DateStyle */
+#define DTERR_INTERVAL_OVERFLOW (-4)
+#define DTERR_TZDISP_OVERFLOW	(-5)
+
+
+extern void GetCurrentDateTime(struct pg_tm * tm);
+extern void GetCurrentTimeUsec(struct pg_tm * tm, fsec_t *fsec, int *tzp);
+extern void j2date(int jd, int *year, int *month, int *day);
+extern int	date2j(int year, int month, int day);
+
+extern int ParseDateTime(const char *timestr, char *workbuf, size_t buflen,
+			  char **field, int *ftype,
+			  int maxfields, int *numfields);
+extern int DecodeDateTime(char **field, int *ftype,
+			   int nf, int *dtype,
+			   struct pg_tm * tm, fsec_t *fsec, int *tzp);
+extern int	DecodeTimezone(char *str, int *tzp);
+extern int DecodeTimeOnly(char **field, int *ftype,
+			   int nf, int *dtype,
+			   struct pg_tm * tm, fsec_t *fsec, int *tzp);
+extern int DecodeInterval(char **field, int *ftype, int nf, int range,
+			   int *dtype, struct pg_tm * tm, fsec_t *fsec);
+extern int DecodeISO8601Interval(char *str,
+					  int *dtype, struct pg_tm * tm, fsec_t *fsec);
+
+extern void DateTimeParseError(int dterr, const char *str,
+				   const char *datatype) pg_attribute_noreturn();
+
+extern int	DetermineTimeZoneOffset(struct pg_tm * tm, pg_tz *tzp);
+extern int	DetermineTimeZoneAbbrevOffset(struct pg_tm * tm, const char *abbr, pg_tz *tzp);
+extern int DetermineTimeZoneAbbrevOffsetTS(TimestampTz ts, const char *abbr,
+								pg_tz *tzp, int *isdst);
+
+extern void EncodeDateOnly(struct pg_tm * tm, int style, char *str);
+extern void EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, int style, char *str);
+extern void EncodeDateTime(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str);
+extern void EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str);
+extern void EncodeSpecialTimestamp(Timestamp dt, char *str);
+
+extern int ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc,
+			 struct pg_tm * tm);
+
+extern int DecodeTimezoneAbbrev(int field, char *lowtoken,
+					 int *offset, pg_tz **tz);
+extern int	DecodeSpecial(int field, char *lowtoken, int *val);
+extern int	DecodeUnits(int field, char *lowtoken, int *val);
+
+extern int	j2day(int jd);
+
+extern Node *TemporalTransform(int32 max_precis, Node *node);
+
+extern bool CheckDateTokenTables(void);
+
+extern TimeZoneAbbrevTable *ConvertTimeZoneAbbrevs(struct tzEntry *abbrevs,
+					   int n);
+extern void InstallTimeZoneAbbrevs(TimeZoneAbbrevTable *tbl);
+
+extern Datum pg_timezone_abbrevs(PG_FUNCTION_ARGS);
+extern Datum pg_timezone_names(PG_FUNCTION_ARGS);
+
+#endif   /* DATETIME_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/datum.h b/foreign/libpg_query/src/postgres/include/utils/datum.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/datum.h
@@ -0,0 +1,49 @@
+/*-------------------------------------------------------------------------
+ *
+ * datum.h
+ *	  POSTGRES Datum (abstract data type) manipulation routines.
+ *
+ * These routines are driven by the 'typbyval' and 'typlen' information,
+ * which must previously have been obtained by the caller for the datatype
+ * of the Datum.  (We do it this way because in most situations the caller
+ * can look up the info just once and use it for many per-datum operations.)
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/datum.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef DATUM_H
+#define DATUM_H
+
+/*
+ * datumGetSize - find the "real" length of a datum
+ */
+extern Size datumGetSize(Datum value, bool typByVal, int typLen);
+
+/*
+ * datumCopy - make a copy of a non-NULL datum.
+ *
+ * If the datatype is pass-by-reference, memory is obtained with palloc().
+ */
+extern Datum datumCopy(Datum value, bool typByVal, int typLen);
+
+/*
+ * datumTransfer - transfer a non-NULL datum into the current memory context.
+ *
+ * Differs from datumCopy() in its handling of read-write expanded objects.
+ */
+extern Datum datumTransfer(Datum value, bool typByVal, int typLen);
+
+/*
+ * datumIsEqual
+ * return true if two datums of the same type are equal, false otherwise.
+ *
+ * XXX : See comments in the code for restrictions!
+ */
+extern bool datumIsEqual(Datum value1, Datum value2,
+			 bool typByVal, int typLen);
+
+#endif   /* DATUM_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/dynamic_loader.h b/foreign/libpg_query/src/postgres/include/utils/dynamic_loader.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/dynamic_loader.h
@@ -0,0 +1,25 @@
+/*-------------------------------------------------------------------------
+ *
+ * dynamic_loader.h
+ *
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/dynamic_loader.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef DYNAMIC_LOADER_H
+#define DYNAMIC_LOADER_H
+
+#include "fmgr.h"
+
+
+extern void *pg_dlopen(char *filename);
+extern PGFunction pg_dlsym(void *handle, char *funcname);
+extern void pg_dlclose(void *handle);
+extern char *pg_dlerror(void);
+
+#endif   /* DYNAMIC_LOADER_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/elog.h b/foreign/libpg_query/src/postgres/include/utils/elog.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/elog.h
@@ -0,0 +1,422 @@
+/*-------------------------------------------------------------------------
+ *
+ * elog.h
+ *	  POSTGRES error reporting/logging definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/elog.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef ELOG_H
+#define ELOG_H
+
+#include <setjmp.h>
+
+/* Error level codes */
+#define DEBUG5		10			/* Debugging messages, in categories of
+								 * decreasing detail. */
+#define DEBUG4		11
+#define DEBUG3		12
+#define DEBUG2		13
+#define DEBUG1		14			/* used by GUC debug_* variables */
+#define LOG			15			/* Server operational messages; sent only to
+								 * server log by default. */
+#define COMMERROR	16			/* Client communication problems; same as LOG
+								 * for server reporting, but never sent to
+								 * client. */
+#define INFO		17			/* Messages specifically requested by user (eg
+								 * VACUUM VERBOSE output); always sent to
+								 * client regardless of client_min_messages,
+								 * but by default not sent to server log. */
+#define NOTICE		18			/* Helpful messages to users about query
+								 * operation; sent to client and server log by
+								 * default. */
+#define WARNING		19			/* Warnings.  NOTICE is for expected messages
+								 * like implicit sequence creation by SERIAL.
+								 * WARNING is for unexpected messages. */
+#define ERROR		20			/* user error - abort transaction; return to
+								 * known state */
+/* Save ERROR value in PGERROR so it can be restored when Win32 includes
+ * modify it.  We have to use a constant rather than ERROR because macros
+ * are expanded only when referenced outside macros.
+ */
+#ifdef WIN32
+#define PGERROR		20
+#endif
+#define FATAL		21			/* fatal error - abort process */
+#define PANIC		22			/* take down the other backends with me */
+
+ /* #define DEBUG DEBUG1 */	/* Backward compatibility with pre-7.3 */
+
+
+/* macros for representing SQLSTATE strings compactly */
+#define PGSIXBIT(ch)	(((ch) - '0') & 0x3F)
+#define PGUNSIXBIT(val) (((val) & 0x3F) + '0')
+
+#define MAKE_SQLSTATE(ch1,ch2,ch3,ch4,ch5)	\
+	(PGSIXBIT(ch1) + (PGSIXBIT(ch2) << 6) + (PGSIXBIT(ch3) << 12) + \
+	 (PGSIXBIT(ch4) << 18) + (PGSIXBIT(ch5) << 24))
+
+/* These macros depend on the fact that '0' becomes a zero in SIXBIT */
+#define ERRCODE_TO_CATEGORY(ec)  ((ec) & ((1 << 12) - 1))
+#define ERRCODE_IS_CATEGORY(ec)  (((ec) & ~((1 << 12) - 1)) == 0)
+
+/* SQLSTATE codes for errors are defined in a separate file */
+#include "utils/errcodes.h"
+
+
+/* Which __func__ symbol do we have, if any? */
+#ifdef HAVE_FUNCNAME__FUNC
+#define PG_FUNCNAME_MACRO	__func__
+#else
+#ifdef HAVE_FUNCNAME__FUNCTION
+#define PG_FUNCNAME_MACRO	__FUNCTION__
+#else
+#define PG_FUNCNAME_MACRO	NULL
+#endif
+#endif
+
+
+/*----------
+ * New-style error reporting API: to be used in this way:
+ *		ereport(ERROR,
+ *				(errcode(ERRCODE_UNDEFINED_CURSOR),
+ *				 errmsg("portal \"%s\" not found", stmt->portalname),
+ *				 ... other errxxx() fields as needed ...));
+ *
+ * The error level is required, and so is a primary error message (errmsg
+ * or errmsg_internal).  All else is optional.  errcode() defaults to
+ * ERRCODE_INTERNAL_ERROR if elevel is ERROR or more, ERRCODE_WARNING
+ * if elevel is WARNING, or ERRCODE_SUCCESSFUL_COMPLETION if elevel is
+ * NOTICE or below.
+ *
+ * ereport_domain() allows a message domain to be specified, for modules that
+ * wish to use a different message catalog from the backend's.  To avoid having
+ * one copy of the default text domain per .o file, we define it as NULL here
+ * and have errstart insert the default text domain.  Modules can either use
+ * ereport_domain() directly, or preferably they can override the TEXTDOMAIN
+ * macro.
+ *
+ * If elevel >= ERROR, the call will not return; we try to inform the compiler
+ * of that via pg_unreachable().  However, no useful optimization effect is
+ * obtained unless the compiler sees elevel as a compile-time constant, else
+ * we're just adding code bloat.  So, if __builtin_constant_p is available,
+ * use that to cause the second if() to vanish completely for non-constant
+ * cases.  We avoid using a local variable because it's not necessary and
+ * prevents gcc from making the unreachability deduction at optlevel -O0.
+ *----------
+ */
+#ifdef HAVE__BUILTIN_CONSTANT_P
+#define ereport_domain(elevel, domain, rest)	\
+	do { \
+		if (errstart(elevel, __FILE__, __LINE__, PG_FUNCNAME_MACRO, domain)) \
+			errfinish rest; \
+		if (__builtin_constant_p(elevel) && (elevel) >= ERROR) \
+			pg_unreachable(); \
+	} while(0)
+#else							/* !HAVE__BUILTIN_CONSTANT_P */
+#define ereport_domain(elevel, domain, rest)	\
+	do { \
+		const int elevel_ = (elevel); \
+		if (errstart(elevel_, __FILE__, __LINE__, PG_FUNCNAME_MACRO, domain)) \
+			errfinish rest; \
+		if (elevel_ >= ERROR) \
+			pg_unreachable(); \
+	} while(0)
+#endif   /* HAVE__BUILTIN_CONSTANT_P */
+
+#define ereport(elevel, rest)	\
+	ereport_domain(elevel, TEXTDOMAIN, rest)
+
+#define TEXTDOMAIN NULL
+
+extern bool errstart(int elevel, const char *filename, int lineno,
+		 const char *funcname, const char *domain);
+extern void errfinish(int dummy,...);
+
+extern int	errcode(int sqlerrcode);
+
+extern int	errcode_for_file_access(void);
+extern int	errcode_for_socket_access(void);
+
+extern int	errmsg(const char *fmt,...) pg_attribute_printf(1, 2);
+extern int	errmsg_internal(const char *fmt,...) pg_attribute_printf(1, 2);
+
+extern int errmsg_plural(const char *fmt_singular, const char *fmt_plural,
+	unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4);
+
+extern int	errdetail(const char *fmt,...) pg_attribute_printf(1, 2);
+extern int	errdetail_internal(const char *fmt,...) pg_attribute_printf(1, 2);
+
+extern int	errdetail_log(const char *fmt,...) pg_attribute_printf(1, 2);
+
+extern int errdetail_log_plural(const char *fmt_singular,
+					 const char *fmt_plural,
+	unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4);
+
+extern int errdetail_plural(const char *fmt_singular, const char *fmt_plural,
+	unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4);
+
+extern int	errhint(const char *fmt,...) pg_attribute_printf(1, 2);
+
+/*
+ * errcontext() is typically called in error context callback functions, not
+ * within an ereport() invocation. The callback function can be in a different
+ * module than the ereport() call, so the message domain passed in errstart()
+ * is not usually the correct domain for translating the context message.
+ * set_errcontext_domain() first sets the domain to be used, and
+ * errcontext_msg() passes the actual message.
+ */
+#define errcontext	set_errcontext_domain(TEXTDOMAIN),	errcontext_msg
+
+extern int	set_errcontext_domain(const char *domain);
+
+extern int	errcontext_msg(const char *fmt,...) pg_attribute_printf(1, 2);
+
+extern int	errhidestmt(bool hide_stmt);
+extern int	errhidecontext(bool hide_ctx);
+
+extern int	errfunction(const char *funcname);
+extern int	errposition(int cursorpos);
+
+extern int	internalerrposition(int cursorpos);
+extern int	internalerrquery(const char *query);
+
+extern int	err_generic_string(int field, const char *str);
+
+extern int	geterrcode(void);
+extern int	geterrposition(void);
+extern int	getinternalerrposition(void);
+
+
+/*----------
+ * Old-style error reporting API: to be used in this way:
+ *		elog(ERROR, "portal \"%s\" not found", stmt->portalname);
+ *----------
+ */
+#ifdef HAVE__VA_ARGS
+/*
+ * If we have variadic macros, we can give the compiler a hint about the
+ * call not returning when elevel >= ERROR.  See comments for ereport().
+ * Note that historically elog() has called elog_start (which saves errno)
+ * before evaluating "elevel", so we preserve that behavior here.
+ */
+#ifdef HAVE__BUILTIN_CONSTANT_P
+#define elog(elevel, ...)  \
+	do { \
+		elog_start(__FILE__, __LINE__, PG_FUNCNAME_MACRO); \
+		elog_finish(elevel, __VA_ARGS__); \
+		if (__builtin_constant_p(elevel) && (elevel) >= ERROR) \
+			pg_unreachable(); \
+	} while(0)
+#else							/* !HAVE__BUILTIN_CONSTANT_P */
+#define elog(elevel, ...)  \
+	do { \
+		int		elevel_; \
+		elog_start(__FILE__, __LINE__, PG_FUNCNAME_MACRO); \
+		elevel_ = (elevel); \
+		elog_finish(elevel_, __VA_ARGS__); \
+		if (elevel_ >= ERROR) \
+			pg_unreachable(); \
+	} while(0)
+#endif   /* HAVE__BUILTIN_CONSTANT_P */
+#else							/* !HAVE__VA_ARGS */
+#define elog  \
+	elog_start(__FILE__, __LINE__, PG_FUNCNAME_MACRO), \
+	elog_finish
+#endif   /* HAVE__VA_ARGS */
+
+extern void elog_start(const char *filename, int lineno, const char *funcname);
+extern void elog_finish(int elevel, const char *fmt,...) pg_attribute_printf(2, 3);
+
+
+/* Support for constructing error strings separately from ereport() calls */
+
+extern void pre_format_elog_string(int errnumber, const char *domain);
+extern char *format_elog_string(const char *fmt,...) pg_attribute_printf(1, 2);
+
+
+/* Support for attaching context information to error reports */
+
+typedef struct ErrorContextCallback
+{
+	struct ErrorContextCallback *previous;
+	void		(*callback) (void *arg);
+	void	   *arg;
+} ErrorContextCallback;
+
+extern PGDLLIMPORT __thread  ErrorContextCallback *error_context_stack;
+
+
+/*----------
+ * API for catching ereport(ERROR) exits.  Use these macros like so:
+ *
+ *		PG_TRY();
+ *		{
+ *			... code that might throw ereport(ERROR) ...
+ *		}
+ *		PG_CATCH();
+ *		{
+ *			... error recovery code ...
+ *		}
+ *		PG_END_TRY();
+ *
+ * (The braces are not actually necessary, but are recommended so that
+ * pg_indent will indent the construct nicely.)  The error recovery code
+ * can optionally do PG_RE_THROW() to propagate the same error outwards.
+ *
+ * Note: while the system will correctly propagate any new ereport(ERROR)
+ * occurring in the recovery section, there is a small limit on the number
+ * of levels this will work for.  It's best to keep the error recovery
+ * section simple enough that it can't generate any new errors, at least
+ * not before popping the error stack.
+ *
+ * Note: an ereport(FATAL) will not be caught by this construct; control will
+ * exit straight through proc_exit().  Therefore, do NOT put any cleanup
+ * of non-process-local resources into the error recovery section, at least
+ * not without taking thought for what will happen during ereport(FATAL).
+ * The PG_ENSURE_ERROR_CLEANUP macros provided by storage/ipc.h may be
+ * helpful in such cases.
+ *
+ * Note: if a local variable of the function containing PG_TRY is modified
+ * in the PG_TRY section and used in the PG_CATCH section, that variable
+ * must be declared "volatile" for POSIX compliance.  This is not mere
+ * pedantry; we have seen bugs from compilers improperly optimizing code
+ * away when such a variable was not marked.  Beware that gcc's -Wclobbered
+ * warnings are just about entirely useless for catching such oversights.
+ *----------
+ */
+#define PG_TRY()  \
+	do { \
+		sigjmp_buf *save_exception_stack = PG_exception_stack; \
+		ErrorContextCallback *save_context_stack = error_context_stack; \
+		sigjmp_buf local_sigjmp_buf; \
+		if (sigsetjmp(local_sigjmp_buf, 0) == 0) \
+		{ \
+			PG_exception_stack = &local_sigjmp_buf
+
+#define PG_CATCH()	\
+		} \
+		else \
+		{ \
+			PG_exception_stack = save_exception_stack; \
+			error_context_stack = save_context_stack
+
+#define PG_END_TRY()  \
+		} \
+		PG_exception_stack = save_exception_stack; \
+		error_context_stack = save_context_stack; \
+	} while (0)
+
+/*
+ * Some compilers understand pg_attribute_noreturn(); for other compilers,
+ * insert pg_unreachable() so that the compiler gets the point.
+ */
+#ifdef HAVE_PG_ATTRIBUTE_NORETURN
+#define PG_RE_THROW()  \
+	pg_re_throw()
+#else
+#define PG_RE_THROW()  \
+	(pg_re_throw(), pg_unreachable())
+#endif
+
+extern PGDLLIMPORT __thread  sigjmp_buf *PG_exception_stack;
+
+
+/* Stuff that error handlers might want to use */
+
+/*
+ * ErrorData holds the data accumulated during any one ereport() cycle.
+ * Any non-NULL pointers must point to palloc'd data.
+ * (The const pointers are an exception; we assume they point at non-freeable
+ * constant strings.)
+ */
+typedef struct ErrorData
+{
+	int			elevel;			/* error level */
+	bool		output_to_server;		/* will report to server log? */
+	bool		output_to_client;		/* will report to client? */
+	bool		show_funcname;	/* true to force funcname inclusion */
+	bool		hide_stmt;		/* true to prevent STATEMENT: inclusion */
+	bool		hide_ctx;		/* true to prevent CONTEXT: inclusion */
+	const char *filename;		/* __FILE__ of ereport() call */
+	int			lineno;			/* __LINE__ of ereport() call */
+	const char *funcname;		/* __func__ of ereport() call */
+	const char *domain;			/* message domain */
+	const char *context_domain; /* message domain for context message */
+	int			sqlerrcode;		/* encoded ERRSTATE */
+	char	   *message;		/* primary error message */
+	char	   *detail;			/* detail error message */
+	char	   *detail_log;		/* detail error message for server log only */
+	char	   *hint;			/* hint message */
+	char	   *context;		/* context message */
+	char	   *schema_name;	/* name of schema */
+	char	   *table_name;		/* name of table */
+	char	   *column_name;	/* name of column */
+	char	   *datatype_name;	/* name of datatype */
+	char	   *constraint_name;	/* name of constraint */
+	int			cursorpos;		/* cursor index into query string */
+	int			internalpos;	/* cursor index into internalquery */
+	char	   *internalquery;	/* text of internally-generated query */
+	int			saved_errno;	/* errno at entry */
+
+	/* context containing associated non-constant strings */
+	struct MemoryContextData *assoc_context;
+} ErrorData;
+
+extern void EmitErrorReport(void);
+extern ErrorData *CopyErrorData(void);
+extern void FreeErrorData(ErrorData *edata);
+extern void FlushErrorState(void);
+extern void ReThrowError(ErrorData *edata) pg_attribute_noreturn();
+extern void ThrowErrorData(ErrorData *edata);
+extern void pg_re_throw(void) pg_attribute_noreturn();
+
+extern char *GetErrorContextStack(void);
+
+/* Hook for intercepting messages before they are sent to the server log */
+typedef void (*emit_log_hook_type) (ErrorData *edata);
+extern PGDLLIMPORT __thread  emit_log_hook_type emit_log_hook;
+
+
+/* GUC-configurable parameters */
+
+typedef enum
+{
+	PGERROR_TERSE,				/* single-line error messages */
+	PGERROR_DEFAULT,			/* recommended style */
+	PGERROR_VERBOSE				/* all the facts, ma'am */
+}	PGErrorVerbosity;
+
+extern int	Log_error_verbosity;
+extern char *Log_line_prefix;
+extern int	Log_destination;
+extern char *Log_destination_string;
+
+/* Log destination bitmap */
+#define LOG_DESTINATION_STDERR	 1
+#define LOG_DESTINATION_SYSLOG	 2
+#define LOG_DESTINATION_EVENTLOG 4
+#define LOG_DESTINATION_CSVLOG	 8
+
+/* Other exported functions */
+extern void DebugFileOpen(void);
+extern char *unpack_sql_state(int sql_state);
+extern bool in_error_recursion_trouble(void);
+
+#ifdef HAVE_SYSLOG
+extern void set_syslog_parameters(const char *ident, int facility);
+#endif
+
+/*
+ * Write errors to stderr (or by equal means when stderr is
+ * not available). Used before ereport/elog can be used
+ * safely (memory context, GUC load etc)
+ */
+extern void write_stderr(const char *fmt,...) pg_attribute_printf(1, 2);
+
+#endif   /* ELOG_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/errcodes.h b/foreign/libpg_query/src/postgres/include/utils/errcodes.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/errcodes.h
@@ -0,0 +1,328 @@
+/* autogenerated from src/backend/utils/errcodes.txt, do not edit */
+/* there is deliberately not an #ifndef ERRCODES_H here */
+
+/* Class 00 - Successful Completion */
+#define ERRCODE_SUCCESSFUL_COMPLETION MAKE_SQLSTATE('0','0','0','0','0')
+
+/* Class 01 - Warning */
+#define ERRCODE_WARNING MAKE_SQLSTATE('0','1','0','0','0')
+#define ERRCODE_WARNING_DYNAMIC_RESULT_SETS_RETURNED MAKE_SQLSTATE('0','1','0','0','C')
+#define ERRCODE_WARNING_IMPLICIT_ZERO_BIT_PADDING MAKE_SQLSTATE('0','1','0','0','8')
+#define ERRCODE_WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION MAKE_SQLSTATE('0','1','0','0','3')
+#define ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED MAKE_SQLSTATE('0','1','0','0','7')
+#define ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED MAKE_SQLSTATE('0','1','0','0','6')
+#define ERRCODE_WARNING_STRING_DATA_RIGHT_TRUNCATION MAKE_SQLSTATE('0','1','0','0','4')
+#define ERRCODE_WARNING_DEPRECATED_FEATURE MAKE_SQLSTATE('0','1','P','0','1')
+
+/* Class 02 - No Data (this is also a warning class per the SQL standard) */
+#define ERRCODE_NO_DATA MAKE_SQLSTATE('0','2','0','0','0')
+#define ERRCODE_NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED MAKE_SQLSTATE('0','2','0','0','1')
+
+/* Class 03 - SQL Statement Not Yet Complete */
+#define ERRCODE_SQL_STATEMENT_NOT_YET_COMPLETE MAKE_SQLSTATE('0','3','0','0','0')
+
+/* Class 08 - Connection Exception */
+#define ERRCODE_CONNECTION_EXCEPTION MAKE_SQLSTATE('0','8','0','0','0')
+#define ERRCODE_CONNECTION_DOES_NOT_EXIST MAKE_SQLSTATE('0','8','0','0','3')
+#define ERRCODE_CONNECTION_FAILURE MAKE_SQLSTATE('0','8','0','0','6')
+#define ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION MAKE_SQLSTATE('0','8','0','0','1')
+#define ERRCODE_SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION MAKE_SQLSTATE('0','8','0','0','4')
+#define ERRCODE_TRANSACTION_RESOLUTION_UNKNOWN MAKE_SQLSTATE('0','8','0','0','7')
+#define ERRCODE_PROTOCOL_VIOLATION MAKE_SQLSTATE('0','8','P','0','1')
+
+/* Class 09 - Triggered Action Exception */
+#define ERRCODE_TRIGGERED_ACTION_EXCEPTION MAKE_SQLSTATE('0','9','0','0','0')
+
+/* Class 0A - Feature Not Supported */
+#define ERRCODE_FEATURE_NOT_SUPPORTED MAKE_SQLSTATE('0','A','0','0','0')
+
+/* Class 0B - Invalid Transaction Initiation */
+#define ERRCODE_INVALID_TRANSACTION_INITIATION MAKE_SQLSTATE('0','B','0','0','0')
+
+/* Class 0F - Locator Exception */
+#define ERRCODE_LOCATOR_EXCEPTION MAKE_SQLSTATE('0','F','0','0','0')
+#define ERRCODE_L_E_INVALID_SPECIFICATION MAKE_SQLSTATE('0','F','0','0','1')
+
+/* Class 0L - Invalid Grantor */
+#define ERRCODE_INVALID_GRANTOR MAKE_SQLSTATE('0','L','0','0','0')
+#define ERRCODE_INVALID_GRANT_OPERATION MAKE_SQLSTATE('0','L','P','0','1')
+
+/* Class 0P - Invalid Role Specification */
+#define ERRCODE_INVALID_ROLE_SPECIFICATION MAKE_SQLSTATE('0','P','0','0','0')
+
+/* Class 0Z - Diagnostics Exception */
+#define ERRCODE_DIAGNOSTICS_EXCEPTION MAKE_SQLSTATE('0','Z','0','0','0')
+#define ERRCODE_STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER MAKE_SQLSTATE('0','Z','0','0','2')
+
+/* Class 20 - Case Not Found */
+#define ERRCODE_CASE_NOT_FOUND MAKE_SQLSTATE('2','0','0','0','0')
+
+/* Class 21 - Cardinality Violation */
+#define ERRCODE_CARDINALITY_VIOLATION MAKE_SQLSTATE('2','1','0','0','0')
+
+/* Class 22 - Data Exception */
+#define ERRCODE_DATA_EXCEPTION MAKE_SQLSTATE('2','2','0','0','0')
+#define ERRCODE_ARRAY_ELEMENT_ERROR MAKE_SQLSTATE('2','2','0','2','E')
+#define ERRCODE_ARRAY_SUBSCRIPT_ERROR MAKE_SQLSTATE('2','2','0','2','E')
+#define ERRCODE_CHARACTER_NOT_IN_REPERTOIRE MAKE_SQLSTATE('2','2','0','2','1')
+#define ERRCODE_DATETIME_FIELD_OVERFLOW MAKE_SQLSTATE('2','2','0','0','8')
+#define ERRCODE_DATETIME_VALUE_OUT_OF_RANGE MAKE_SQLSTATE('2','2','0','0','8')
+#define ERRCODE_DIVISION_BY_ZERO MAKE_SQLSTATE('2','2','0','1','2')
+#define ERRCODE_ERROR_IN_ASSIGNMENT MAKE_SQLSTATE('2','2','0','0','5')
+#define ERRCODE_ESCAPE_CHARACTER_CONFLICT MAKE_SQLSTATE('2','2','0','0','B')
+#define ERRCODE_INDICATOR_OVERFLOW MAKE_SQLSTATE('2','2','0','2','2')
+#define ERRCODE_INTERVAL_FIELD_OVERFLOW MAKE_SQLSTATE('2','2','0','1','5')
+#define ERRCODE_INVALID_ARGUMENT_FOR_LOG MAKE_SQLSTATE('2','2','0','1','E')
+#define ERRCODE_INVALID_ARGUMENT_FOR_NTILE MAKE_SQLSTATE('2','2','0','1','4')
+#define ERRCODE_INVALID_ARGUMENT_FOR_NTH_VALUE MAKE_SQLSTATE('2','2','0','1','6')
+#define ERRCODE_INVALID_ARGUMENT_FOR_POWER_FUNCTION MAKE_SQLSTATE('2','2','0','1','F')
+#define ERRCODE_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION MAKE_SQLSTATE('2','2','0','1','G')
+#define ERRCODE_INVALID_CHARACTER_VALUE_FOR_CAST MAKE_SQLSTATE('2','2','0','1','8')
+#define ERRCODE_INVALID_DATETIME_FORMAT MAKE_SQLSTATE('2','2','0','0','7')
+#define ERRCODE_INVALID_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2','0','1','9')
+#define ERRCODE_INVALID_ESCAPE_OCTET MAKE_SQLSTATE('2','2','0','0','D')
+#define ERRCODE_INVALID_ESCAPE_SEQUENCE MAKE_SQLSTATE('2','2','0','2','5')
+#define ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2','P','0','6')
+#define ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE MAKE_SQLSTATE('2','2','0','1','0')
+#define ERRCODE_INVALID_PARAMETER_VALUE MAKE_SQLSTATE('2','2','0','2','3')
+#define ERRCODE_INVALID_REGULAR_EXPRESSION MAKE_SQLSTATE('2','2','0','1','B')
+#define ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE MAKE_SQLSTATE('2','2','0','1','W')
+#define ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE MAKE_SQLSTATE('2','2','0','1','X')
+#define ERRCODE_INVALID_TABLESAMPLE_ARGUMENT MAKE_SQLSTATE('2','2','0','2','H')
+#define ERRCODE_INVALID_TABLESAMPLE_REPEAT MAKE_SQLSTATE('2','2','0','2','G')
+#define ERRCODE_INVALID_TIME_ZONE_DISPLACEMENT_VALUE MAKE_SQLSTATE('2','2','0','0','9')
+#define ERRCODE_INVALID_USE_OF_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2','0','0','C')
+#define ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH MAKE_SQLSTATE('2','2','0','0','G')
+#define ERRCODE_NULL_VALUE_NOT_ALLOWED MAKE_SQLSTATE('2','2','0','0','4')
+#define ERRCODE_NULL_VALUE_NO_INDICATOR_PARAMETER MAKE_SQLSTATE('2','2','0','0','2')
+#define ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE MAKE_SQLSTATE('2','2','0','0','3')
+#define ERRCODE_STRING_DATA_LENGTH_MISMATCH MAKE_SQLSTATE('2','2','0','2','6')
+#define ERRCODE_STRING_DATA_RIGHT_TRUNCATION MAKE_SQLSTATE('2','2','0','0','1')
+#define ERRCODE_SUBSTRING_ERROR MAKE_SQLSTATE('2','2','0','1','1')
+#define ERRCODE_TRIM_ERROR MAKE_SQLSTATE('2','2','0','2','7')
+#define ERRCODE_UNTERMINATED_C_STRING MAKE_SQLSTATE('2','2','0','2','4')
+#define ERRCODE_ZERO_LENGTH_CHARACTER_STRING MAKE_SQLSTATE('2','2','0','0','F')
+#define ERRCODE_FLOATING_POINT_EXCEPTION MAKE_SQLSTATE('2','2','P','0','1')
+#define ERRCODE_INVALID_TEXT_REPRESENTATION MAKE_SQLSTATE('2','2','P','0','2')
+#define ERRCODE_INVALID_BINARY_REPRESENTATION MAKE_SQLSTATE('2','2','P','0','3')
+#define ERRCODE_BAD_COPY_FILE_FORMAT MAKE_SQLSTATE('2','2','P','0','4')
+#define ERRCODE_UNTRANSLATABLE_CHARACTER MAKE_SQLSTATE('2','2','P','0','5')
+#define ERRCODE_NOT_AN_XML_DOCUMENT MAKE_SQLSTATE('2','2','0','0','L')
+#define ERRCODE_INVALID_XML_DOCUMENT MAKE_SQLSTATE('2','2','0','0','M')
+#define ERRCODE_INVALID_XML_CONTENT MAKE_SQLSTATE('2','2','0','0','N')
+#define ERRCODE_INVALID_XML_COMMENT MAKE_SQLSTATE('2','2','0','0','S')
+#define ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION MAKE_SQLSTATE('2','2','0','0','T')
+
+/* Class 23 - Integrity Constraint Violation */
+#define ERRCODE_INTEGRITY_CONSTRAINT_VIOLATION MAKE_SQLSTATE('2','3','0','0','0')
+#define ERRCODE_RESTRICT_VIOLATION MAKE_SQLSTATE('2','3','0','0','1')
+#define ERRCODE_NOT_NULL_VIOLATION MAKE_SQLSTATE('2','3','5','0','2')
+#define ERRCODE_FOREIGN_KEY_VIOLATION MAKE_SQLSTATE('2','3','5','0','3')
+#define ERRCODE_UNIQUE_VIOLATION MAKE_SQLSTATE('2','3','5','0','5')
+#define ERRCODE_CHECK_VIOLATION MAKE_SQLSTATE('2','3','5','1','4')
+#define ERRCODE_EXCLUSION_VIOLATION MAKE_SQLSTATE('2','3','P','0','1')
+
+/* Class 24 - Invalid Cursor State */
+#define ERRCODE_INVALID_CURSOR_STATE MAKE_SQLSTATE('2','4','0','0','0')
+
+/* Class 25 - Invalid Transaction State */
+#define ERRCODE_INVALID_TRANSACTION_STATE MAKE_SQLSTATE('2','5','0','0','0')
+#define ERRCODE_ACTIVE_SQL_TRANSACTION MAKE_SQLSTATE('2','5','0','0','1')
+#define ERRCODE_BRANCH_TRANSACTION_ALREADY_ACTIVE MAKE_SQLSTATE('2','5','0','0','2')
+#define ERRCODE_HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL MAKE_SQLSTATE('2','5','0','0','8')
+#define ERRCODE_INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION MAKE_SQLSTATE('2','5','0','0','3')
+#define ERRCODE_INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION MAKE_SQLSTATE('2','5','0','0','4')
+#define ERRCODE_NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION MAKE_SQLSTATE('2','5','0','0','5')
+#define ERRCODE_READ_ONLY_SQL_TRANSACTION MAKE_SQLSTATE('2','5','0','0','6')
+#define ERRCODE_SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED MAKE_SQLSTATE('2','5','0','0','7')
+#define ERRCODE_NO_ACTIVE_SQL_TRANSACTION MAKE_SQLSTATE('2','5','P','0','1')
+#define ERRCODE_IN_FAILED_SQL_TRANSACTION MAKE_SQLSTATE('2','5','P','0','2')
+
+/* Class 26 - Invalid SQL Statement Name */
+#define ERRCODE_INVALID_SQL_STATEMENT_NAME MAKE_SQLSTATE('2','6','0','0','0')
+
+/* Class 27 - Triggered Data Change Violation */
+#define ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION MAKE_SQLSTATE('2','7','0','0','0')
+
+/* Class 28 - Invalid Authorization Specification */
+#define ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION MAKE_SQLSTATE('2','8','0','0','0')
+#define ERRCODE_INVALID_PASSWORD MAKE_SQLSTATE('2','8','P','0','1')
+
+/* Class 2B - Dependent Privilege Descriptors Still Exist */
+#define ERRCODE_DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST MAKE_SQLSTATE('2','B','0','0','0')
+#define ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST MAKE_SQLSTATE('2','B','P','0','1')
+
+/* Class 2D - Invalid Transaction Termination */
+#define ERRCODE_INVALID_TRANSACTION_TERMINATION MAKE_SQLSTATE('2','D','0','0','0')
+
+/* Class 2F - SQL Routine Exception */
+#define ERRCODE_SQL_ROUTINE_EXCEPTION MAKE_SQLSTATE('2','F','0','0','0')
+#define ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT MAKE_SQLSTATE('2','F','0','0','5')
+#define ERRCODE_S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('2','F','0','0','2')
+#define ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED MAKE_SQLSTATE('2','F','0','0','3')
+#define ERRCODE_S_R_E_READING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('2','F','0','0','4')
+
+/* Class 34 - Invalid Cursor Name */
+#define ERRCODE_INVALID_CURSOR_NAME MAKE_SQLSTATE('3','4','0','0','0')
+
+/* Class 38 - External Routine Exception */
+#define ERRCODE_EXTERNAL_ROUTINE_EXCEPTION MAKE_SQLSTATE('3','8','0','0','0')
+#define ERRCODE_E_R_E_CONTAINING_SQL_NOT_PERMITTED MAKE_SQLSTATE('3','8','0','0','1')
+#define ERRCODE_E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('3','8','0','0','2')
+#define ERRCODE_E_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED MAKE_SQLSTATE('3','8','0','0','3')
+#define ERRCODE_E_R_E_READING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('3','8','0','0','4')
+
+/* Class 39 - External Routine Invocation Exception */
+#define ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION MAKE_SQLSTATE('3','9','0','0','0')
+#define ERRCODE_E_R_I_E_INVALID_SQLSTATE_RETURNED MAKE_SQLSTATE('3','9','0','0','1')
+#define ERRCODE_E_R_I_E_NULL_VALUE_NOT_ALLOWED MAKE_SQLSTATE('3','9','0','0','4')
+#define ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED MAKE_SQLSTATE('3','9','P','0','1')
+#define ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED MAKE_SQLSTATE('3','9','P','0','2')
+#define ERRCODE_E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED MAKE_SQLSTATE('3','9','P','0','3')
+
+/* Class 3B - Savepoint Exception */
+#define ERRCODE_SAVEPOINT_EXCEPTION MAKE_SQLSTATE('3','B','0','0','0')
+#define ERRCODE_S_E_INVALID_SPECIFICATION MAKE_SQLSTATE('3','B','0','0','1')
+
+/* Class 3D - Invalid Catalog Name */
+#define ERRCODE_INVALID_CATALOG_NAME MAKE_SQLSTATE('3','D','0','0','0')
+
+/* Class 3F - Invalid Schema Name */
+#define ERRCODE_INVALID_SCHEMA_NAME MAKE_SQLSTATE('3','F','0','0','0')
+
+/* Class 40 - Transaction Rollback */
+#define ERRCODE_TRANSACTION_ROLLBACK MAKE_SQLSTATE('4','0','0','0','0')
+#define ERRCODE_T_R_INTEGRITY_CONSTRAINT_VIOLATION MAKE_SQLSTATE('4','0','0','0','2')
+#define ERRCODE_T_R_SERIALIZATION_FAILURE MAKE_SQLSTATE('4','0','0','0','1')
+#define ERRCODE_T_R_STATEMENT_COMPLETION_UNKNOWN MAKE_SQLSTATE('4','0','0','0','3')
+#define ERRCODE_T_R_DEADLOCK_DETECTED MAKE_SQLSTATE('4','0','P','0','1')
+
+/* Class 42 - Syntax Error or Access Rule Violation */
+#define ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION MAKE_SQLSTATE('4','2','0','0','0')
+#define ERRCODE_SYNTAX_ERROR MAKE_SQLSTATE('4','2','6','0','1')
+#define ERRCODE_INSUFFICIENT_PRIVILEGE MAKE_SQLSTATE('4','2','5','0','1')
+#define ERRCODE_CANNOT_COERCE MAKE_SQLSTATE('4','2','8','4','6')
+#define ERRCODE_GROUPING_ERROR MAKE_SQLSTATE('4','2','8','0','3')
+#define ERRCODE_WINDOWING_ERROR MAKE_SQLSTATE('4','2','P','2','0')
+#define ERRCODE_INVALID_RECURSION MAKE_SQLSTATE('4','2','P','1','9')
+#define ERRCODE_INVALID_FOREIGN_KEY MAKE_SQLSTATE('4','2','8','3','0')
+#define ERRCODE_INVALID_NAME MAKE_SQLSTATE('4','2','6','0','2')
+#define ERRCODE_NAME_TOO_LONG MAKE_SQLSTATE('4','2','6','2','2')
+#define ERRCODE_RESERVED_NAME MAKE_SQLSTATE('4','2','9','3','9')
+#define ERRCODE_DATATYPE_MISMATCH MAKE_SQLSTATE('4','2','8','0','4')
+#define ERRCODE_INDETERMINATE_DATATYPE MAKE_SQLSTATE('4','2','P','1','8')
+#define ERRCODE_COLLATION_MISMATCH MAKE_SQLSTATE('4','2','P','2','1')
+#define ERRCODE_INDETERMINATE_COLLATION MAKE_SQLSTATE('4','2','P','2','2')
+#define ERRCODE_WRONG_OBJECT_TYPE MAKE_SQLSTATE('4','2','8','0','9')
+#define ERRCODE_UNDEFINED_COLUMN MAKE_SQLSTATE('4','2','7','0','3')
+#define ERRCODE_UNDEFINED_CURSOR MAKE_SQLSTATE('3','4','0','0','0')
+#define ERRCODE_UNDEFINED_DATABASE MAKE_SQLSTATE('3','D','0','0','0')
+#define ERRCODE_UNDEFINED_FUNCTION MAKE_SQLSTATE('4','2','8','8','3')
+#define ERRCODE_UNDEFINED_PSTATEMENT MAKE_SQLSTATE('2','6','0','0','0')
+#define ERRCODE_UNDEFINED_SCHEMA MAKE_SQLSTATE('3','F','0','0','0')
+#define ERRCODE_UNDEFINED_TABLE MAKE_SQLSTATE('4','2','P','0','1')
+#define ERRCODE_UNDEFINED_PARAMETER MAKE_SQLSTATE('4','2','P','0','2')
+#define ERRCODE_UNDEFINED_OBJECT MAKE_SQLSTATE('4','2','7','0','4')
+#define ERRCODE_DUPLICATE_COLUMN MAKE_SQLSTATE('4','2','7','0','1')
+#define ERRCODE_DUPLICATE_CURSOR MAKE_SQLSTATE('4','2','P','0','3')
+#define ERRCODE_DUPLICATE_DATABASE MAKE_SQLSTATE('4','2','P','0','4')
+#define ERRCODE_DUPLICATE_FUNCTION MAKE_SQLSTATE('4','2','7','2','3')
+#define ERRCODE_DUPLICATE_PSTATEMENT MAKE_SQLSTATE('4','2','P','0','5')
+#define ERRCODE_DUPLICATE_SCHEMA MAKE_SQLSTATE('4','2','P','0','6')
+#define ERRCODE_DUPLICATE_TABLE MAKE_SQLSTATE('4','2','P','0','7')
+#define ERRCODE_DUPLICATE_ALIAS MAKE_SQLSTATE('4','2','7','1','2')
+#define ERRCODE_DUPLICATE_OBJECT MAKE_SQLSTATE('4','2','7','1','0')
+#define ERRCODE_AMBIGUOUS_COLUMN MAKE_SQLSTATE('4','2','7','0','2')
+#define ERRCODE_AMBIGUOUS_FUNCTION MAKE_SQLSTATE('4','2','7','2','5')
+#define ERRCODE_AMBIGUOUS_PARAMETER MAKE_SQLSTATE('4','2','P','0','8')
+#define ERRCODE_AMBIGUOUS_ALIAS MAKE_SQLSTATE('4','2','P','0','9')
+#define ERRCODE_INVALID_COLUMN_REFERENCE MAKE_SQLSTATE('4','2','P','1','0')
+#define ERRCODE_INVALID_COLUMN_DEFINITION MAKE_SQLSTATE('4','2','6','1','1')
+#define ERRCODE_INVALID_CURSOR_DEFINITION MAKE_SQLSTATE('4','2','P','1','1')
+#define ERRCODE_INVALID_DATABASE_DEFINITION MAKE_SQLSTATE('4','2','P','1','2')
+#define ERRCODE_INVALID_FUNCTION_DEFINITION MAKE_SQLSTATE('4','2','P','1','3')
+#define ERRCODE_INVALID_PSTATEMENT_DEFINITION MAKE_SQLSTATE('4','2','P','1','4')
+#define ERRCODE_INVALID_SCHEMA_DEFINITION MAKE_SQLSTATE('4','2','P','1','5')
+#define ERRCODE_INVALID_TABLE_DEFINITION MAKE_SQLSTATE('4','2','P','1','6')
+#define ERRCODE_INVALID_OBJECT_DEFINITION MAKE_SQLSTATE('4','2','P','1','7')
+
+/* Class 44 - WITH CHECK OPTION Violation */
+#define ERRCODE_WITH_CHECK_OPTION_VIOLATION MAKE_SQLSTATE('4','4','0','0','0')
+
+/* Class 53 - Insufficient Resources */
+#define ERRCODE_INSUFFICIENT_RESOURCES MAKE_SQLSTATE('5','3','0','0','0')
+#define ERRCODE_DISK_FULL MAKE_SQLSTATE('5','3','1','0','0')
+#define ERRCODE_OUT_OF_MEMORY MAKE_SQLSTATE('5','3','2','0','0')
+#define ERRCODE_TOO_MANY_CONNECTIONS MAKE_SQLSTATE('5','3','3','0','0')
+#define ERRCODE_CONFIGURATION_LIMIT_EXCEEDED MAKE_SQLSTATE('5','3','4','0','0')
+
+/* Class 54 - Program Limit Exceeded */
+#define ERRCODE_PROGRAM_LIMIT_EXCEEDED MAKE_SQLSTATE('5','4','0','0','0')
+#define ERRCODE_STATEMENT_TOO_COMPLEX MAKE_SQLSTATE('5','4','0','0','1')
+#define ERRCODE_TOO_MANY_COLUMNS MAKE_SQLSTATE('5','4','0','1','1')
+#define ERRCODE_TOO_MANY_ARGUMENTS MAKE_SQLSTATE('5','4','0','2','3')
+
+/* Class 55 - Object Not In Prerequisite State */
+#define ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE MAKE_SQLSTATE('5','5','0','0','0')
+#define ERRCODE_OBJECT_IN_USE MAKE_SQLSTATE('5','5','0','0','6')
+#define ERRCODE_CANT_CHANGE_RUNTIME_PARAM MAKE_SQLSTATE('5','5','P','0','2')
+#define ERRCODE_LOCK_NOT_AVAILABLE MAKE_SQLSTATE('5','5','P','0','3')
+
+/* Class 57 - Operator Intervention */
+#define ERRCODE_OPERATOR_INTERVENTION MAKE_SQLSTATE('5','7','0','0','0')
+#define ERRCODE_QUERY_CANCELED MAKE_SQLSTATE('5','7','0','1','4')
+#define ERRCODE_ADMIN_SHUTDOWN MAKE_SQLSTATE('5','7','P','0','1')
+#define ERRCODE_CRASH_SHUTDOWN MAKE_SQLSTATE('5','7','P','0','2')
+#define ERRCODE_CANNOT_CONNECT_NOW MAKE_SQLSTATE('5','7','P','0','3')
+#define ERRCODE_DATABASE_DROPPED MAKE_SQLSTATE('5','7','P','0','4')
+
+/* Class 58 - System Error (errors external to PostgreSQL itself) */
+#define ERRCODE_SYSTEM_ERROR MAKE_SQLSTATE('5','8','0','0','0')
+#define ERRCODE_IO_ERROR MAKE_SQLSTATE('5','8','0','3','0')
+#define ERRCODE_UNDEFINED_FILE MAKE_SQLSTATE('5','8','P','0','1')
+#define ERRCODE_DUPLICATE_FILE MAKE_SQLSTATE('5','8','P','0','2')
+
+/* Class F0 - Configuration File Error */
+#define ERRCODE_CONFIG_FILE_ERROR MAKE_SQLSTATE('F','0','0','0','0')
+#define ERRCODE_LOCK_FILE_EXISTS MAKE_SQLSTATE('F','0','0','0','1')
+
+/* Class HV - Foreign Data Wrapper Error (SQL/MED) */
+#define ERRCODE_FDW_ERROR MAKE_SQLSTATE('H','V','0','0','0')
+#define ERRCODE_FDW_COLUMN_NAME_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','5')
+#define ERRCODE_FDW_DYNAMIC_PARAMETER_VALUE_NEEDED MAKE_SQLSTATE('H','V','0','0','2')
+#define ERRCODE_FDW_FUNCTION_SEQUENCE_ERROR MAKE_SQLSTATE('H','V','0','1','0')
+#define ERRCODE_FDW_INCONSISTENT_DESCRIPTOR_INFORMATION MAKE_SQLSTATE('H','V','0','2','1')
+#define ERRCODE_FDW_INVALID_ATTRIBUTE_VALUE MAKE_SQLSTATE('H','V','0','2','4')
+#define ERRCODE_FDW_INVALID_COLUMN_NAME MAKE_SQLSTATE('H','V','0','0','7')
+#define ERRCODE_FDW_INVALID_COLUMN_NUMBER MAKE_SQLSTATE('H','V','0','0','8')
+#define ERRCODE_FDW_INVALID_DATA_TYPE MAKE_SQLSTATE('H','V','0','0','4')
+#define ERRCODE_FDW_INVALID_DATA_TYPE_DESCRIPTORS MAKE_SQLSTATE('H','V','0','0','6')
+#define ERRCODE_FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER MAKE_SQLSTATE('H','V','0','9','1')
+#define ERRCODE_FDW_INVALID_HANDLE MAKE_SQLSTATE('H','V','0','0','B')
+#define ERRCODE_FDW_INVALID_OPTION_INDEX MAKE_SQLSTATE('H','V','0','0','C')
+#define ERRCODE_FDW_INVALID_OPTION_NAME MAKE_SQLSTATE('H','V','0','0','D')
+#define ERRCODE_FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH MAKE_SQLSTATE('H','V','0','9','0')
+#define ERRCODE_FDW_INVALID_STRING_FORMAT MAKE_SQLSTATE('H','V','0','0','A')
+#define ERRCODE_FDW_INVALID_USE_OF_NULL_POINTER MAKE_SQLSTATE('H','V','0','0','9')
+#define ERRCODE_FDW_TOO_MANY_HANDLES MAKE_SQLSTATE('H','V','0','1','4')
+#define ERRCODE_FDW_OUT_OF_MEMORY MAKE_SQLSTATE('H','V','0','0','1')
+#define ERRCODE_FDW_NO_SCHEMAS MAKE_SQLSTATE('H','V','0','0','P')
+#define ERRCODE_FDW_OPTION_NAME_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','J')
+#define ERRCODE_FDW_REPLY_HANDLE MAKE_SQLSTATE('H','V','0','0','K')
+#define ERRCODE_FDW_SCHEMA_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','Q')
+#define ERRCODE_FDW_TABLE_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','R')
+#define ERRCODE_FDW_UNABLE_TO_CREATE_EXECUTION MAKE_SQLSTATE('H','V','0','0','L')
+#define ERRCODE_FDW_UNABLE_TO_CREATE_REPLY MAKE_SQLSTATE('H','V','0','0','M')
+#define ERRCODE_FDW_UNABLE_TO_ESTABLISH_CONNECTION MAKE_SQLSTATE('H','V','0','0','N')
+
+/* Class P0 - PL/pgSQL Error */
+#define ERRCODE_PLPGSQL_ERROR MAKE_SQLSTATE('P','0','0','0','0')
+#define ERRCODE_RAISE_EXCEPTION MAKE_SQLSTATE('P','0','0','0','1')
+#define ERRCODE_NO_DATA_FOUND MAKE_SQLSTATE('P','0','0','0','2')
+#define ERRCODE_TOO_MANY_ROWS MAKE_SQLSTATE('P','0','0','0','3')
+#define ERRCODE_ASSERT_FAILURE MAKE_SQLSTATE('P','0','0','0','4')
+
+/* Class XX - Internal Error */
+#define ERRCODE_INTERNAL_ERROR MAKE_SQLSTATE('X','X','0','0','0')
+#define ERRCODE_DATA_CORRUPTED MAKE_SQLSTATE('X','X','0','0','1')
+#define ERRCODE_INDEX_CORRUPTED MAKE_SQLSTATE('X','X','0','0','2')
diff --git a/foreign/libpg_query/src/postgres/include/utils/expandeddatum.h b/foreign/libpg_query/src/postgres/include/utils/expandeddatum.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/expandeddatum.h
@@ -0,0 +1,151 @@
+/*-------------------------------------------------------------------------
+ *
+ * expandeddatum.h
+ *	  Declarations for access to "expanded" value representations.
+ *
+ * Complex data types, particularly container types such as arrays and
+ * records, usually have on-disk representations that are compact but not
+ * especially convenient to modify.  What's more, when we do modify them,
+ * having to recopy all the rest of the value can be extremely inefficient.
+ * Therefore, we provide a notion of an "expanded" representation that is used
+ * only in memory and is optimized more for computation than storage.
+ * The format appearing on disk is called the data type's "flattened"
+ * representation, since it is required to be a contiguous blob of bytes --
+ * but the type can have an expanded representation that is not.  Data types
+ * must provide means to translate an expanded representation back to
+ * flattened form.
+ *
+ * An expanded object is meant to survive across multiple operations, but
+ * not to be enormously long-lived; for example it might be a local variable
+ * in a PL/pgSQL procedure.  So its extra bulk compared to the on-disk format
+ * is a worthwhile trade-off.
+ *
+ * References to expanded objects are a type of TOAST pointer.
+ * Because of longstanding conventions in Postgres, this means that the
+ * flattened form of such an object must always be a varlena object.
+ * Fortunately that's no restriction in practice.
+ *
+ * There are actually two kinds of TOAST pointers for expanded objects:
+ * read-only and read-write pointers.  Possession of one of the latter
+ * authorizes a function to modify the value in-place rather than copying it
+ * as would normally be required.  Functions should always return a read-write
+ * pointer to any new expanded object they create.  Functions that modify an
+ * argument value in-place must take care that they do not corrupt the old
+ * value if they fail partway through.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/expandeddatum.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef EXPANDEDDATUM_H
+#define EXPANDEDDATUM_H
+
+/* Size of an EXTERNAL datum that contains a pointer to an expanded object */
+#define EXPANDED_POINTER_SIZE (VARHDRSZ_EXTERNAL + sizeof(varatt_expanded))
+
+/*
+ * "Methods" that must be provided for any expanded object.
+ *
+ * get_flat_size: compute space needed for flattened representation (total,
+ * including header).
+ *
+ * flatten_into: construct flattened representation in the caller-allocated
+ * space at *result, of size allocated_size (which will always be the result
+ * of a preceding get_flat_size call; it's passed for cross-checking).
+ *
+ * The flattened representation must be a valid in-line, non-compressed,
+ * 4-byte-header varlena object.
+ *
+ * Note: construction of a heap tuple from an expanded datum calls
+ * get_flat_size twice, so it's worthwhile to make sure that that doesn't
+ * incur too much overhead.
+ */
+typedef Size (*EOM_get_flat_size_method) (ExpandedObjectHeader *eohptr);
+typedef void (*EOM_flatten_into_method) (ExpandedObjectHeader *eohptr,
+										  void *result, Size allocated_size);
+
+/* Struct of function pointers for an expanded object's methods */
+typedef struct ExpandedObjectMethods
+{
+	EOM_get_flat_size_method get_flat_size;
+	EOM_flatten_into_method flatten_into;
+} ExpandedObjectMethods;
+
+/*
+ * Every expanded object must contain this header; typically the header
+ * is embedded in some larger struct that adds type-specific fields.
+ *
+ * It is presumed that the header object and all subsidiary data are stored
+ * in eoh_context, so that the object can be freed by deleting that context,
+ * or its storage lifespan can be altered by reparenting the context.
+ * (In principle the object could own additional resources, such as malloc'd
+ * storage, and use a memory context reset callback to free them upon reset or
+ * deletion of eoh_context.)
+ *
+ * We set up two TOAST pointers within the standard header, one read-write
+ * and one read-only.  This allows functions to return either kind of pointer
+ * without making an additional allocation, and in particular without worrying
+ * whether a separately palloc'd object would have sufficient lifespan.
+ * But note that these pointers are just a convenience; a pointer object
+ * appearing somewhere else would still be legal.
+ *
+ * The typedef declaration for this appears in postgres.h.
+ */
+struct ExpandedObjectHeader
+{
+	/* Phony varlena header */
+	int32		vl_len_;		/* always EOH_HEADER_MAGIC, see below */
+
+	/* Pointer to methods required for object type */
+	const ExpandedObjectMethods *eoh_methods;
+
+	/* Memory context containing this header and subsidiary data */
+	MemoryContext eoh_context;
+
+	/* Standard R/W TOAST pointer for this object is kept here */
+	char		eoh_rw_ptr[EXPANDED_POINTER_SIZE];
+
+	/* Standard R/O TOAST pointer for this object is kept here */
+	char		eoh_ro_ptr[EXPANDED_POINTER_SIZE];
+};
+
+/*
+ * Particularly for read-only functions, it is handy to be able to work with
+ * either regular "flat" varlena inputs or expanded inputs of the same data
+ * type.  To allow determining which case an argument-fetching function has
+ * returned, the first int32 of an ExpandedObjectHeader always contains -1
+ * (EOH_HEADER_MAGIC to the code).  This works since no 4-byte-header varlena
+ * could have that as its first 4 bytes.  Caution: we could not reliably tell
+ * the difference between an ExpandedObjectHeader and a short-header object
+ * with this trick.  However, it works fine if the argument fetching code
+ * always returns either a 4-byte-header flat object or an expanded object.
+ */
+#define EOH_HEADER_MAGIC (-1)
+#define VARATT_IS_EXPANDED_HEADER(PTR) \
+	(((ExpandedObjectHeader *) (PTR))->vl_len_ == EOH_HEADER_MAGIC)
+
+/*
+ * Generic support functions for expanded objects.
+ * (More of these might be worth inlining later.)
+ */
+
+#define EOHPGetRWDatum(eohptr)	PointerGetDatum((eohptr)->eoh_rw_ptr)
+#define EOHPGetRODatum(eohptr)	PointerGetDatum((eohptr)->eoh_ro_ptr)
+
+extern ExpandedObjectHeader *DatumGetEOHP(Datum d);
+extern void EOH_init_header(ExpandedObjectHeader *eohptr,
+				const ExpandedObjectMethods *methods,
+				MemoryContext obj_context);
+extern Size EOH_get_flat_size(ExpandedObjectHeader *eohptr);
+extern void EOH_flatten_into(ExpandedObjectHeader *eohptr,
+				 void *result, Size allocated_size);
+extern bool DatumIsReadWriteExpandedObject(Datum d, bool isnull, int16 typlen);
+extern Datum MakeExpandedObjectReadOnly(Datum d, bool isnull, int16 typlen);
+extern Datum TransferExpandedObject(Datum d, MemoryContext new_parent);
+extern void DeleteExpandedObject(Datum d);
+
+#endif   /* EXPANDEDDATUM_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/fmgroids.h b/foreign/libpg_query/src/postgres/include/utils/fmgroids.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/fmgroids.h
@@ -0,0 +1,2450 @@
+/*-------------------------------------------------------------------------
+ *
+ * fmgroids.h
+ *    Macros that define the OIDs of built-in functions.
+ *
+ * These macros can be used to avoid a catalog lookup when a specific
+ * fmgr-callable function needs to be referenced.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * NOTES
+ *	******************************
+ *	*** DO NOT EDIT THIS FILE! ***
+ *	******************************
+ *
+ *	It has been GENERATED by Gen_fmgrtab.pl
+ *	from ../../../src/include/catalog/pg_proc.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef FMGROIDS_H
+#define FMGROIDS_H
+
+/*
+ *	Constant macros for the OIDs of entries in pg_proc.
+ *
+ *	NOTE: macros are named after the prosrc value, ie the actual C name
+ *	of the implementing function, not the proname which may be overloaded.
+ *	For example, we want to be able to assign different macro names to both
+ *	char_text() and name_text() even though these both appear with proname
+ *	'text'.  If the same C function appears in more than one pg_proc entry,
+ *	its equivalent macro will be defined with the lowest OID among those
+ *	entries.
+ */
+#define F_BYTEAOUT 31
+#define F_CHAROUT 33
+#define F_NAMEIN 34
+#define F_NAMEOUT 35
+#define F_INT2IN 38
+#define F_INT2OUT 39
+#define F_INT2VECTORIN 40
+#define F_INT2VECTOROUT 41
+#define F_INT4IN 42
+#define F_INT4OUT 43
+#define F_REGPROCIN 44
+#define F_REGPROCOUT 45
+#define F_TEXTIN 46
+#define F_TEXTOUT 47
+#define F_TIDIN 48
+#define F_TIDOUT 49
+#define F_XIDIN 50
+#define F_XIDOUT 51
+#define F_CIDIN 52
+#define F_CIDOUT 53
+#define F_OIDVECTORIN 54
+#define F_OIDVECTOROUT 55
+#define F_BOOLLT 56
+#define F_BOOLGT 57
+#define F_BOOLEQ 60
+#define F_CHAREQ 61
+#define F_NAMEEQ 62
+#define F_INT2EQ 63
+#define F_INT2LT 64
+#define F_INT4EQ 65
+#define F_INT4LT 66
+#define F_TEXTEQ 67
+#define F_XIDEQ 68
+#define F_CIDEQ 69
+#define F_CHARNE 70
+#define F_CHARLE 72
+#define F_CHARGT 73
+#define F_CHARGE 74
+#define F_CHARTOI4 77
+#define F_I4TOCHAR 78
+#define F_NAMEREGEXEQ 79
+#define F_BOOLNE 84
+#define F_PG_DDL_COMMAND_IN 86
+#define F_PG_DDL_COMMAND_OUT 87
+#define F_PG_DDL_COMMAND_RECV 88
+#define F_PGSQL_VERSION 89
+#define F_PG_DDL_COMMAND_SEND 90
+#define F_EQSEL 101
+#define F_NEQSEL 102
+#define F_SCALARLTSEL 103
+#define F_SCALARGTSEL 104
+#define F_EQJOINSEL 105
+#define F_NEQJOINSEL 106
+#define F_SCALARLTJOINSEL 107
+#define F_SCALARGTJOINSEL 108
+#define F_UNKNOWNIN 109
+#define F_UNKNOWNOUT 110
+#define F_NUMERIC_FAC 111
+#define F_BOX_ABOVE_EQ 115
+#define F_BOX_BELOW_EQ 116
+#define F_POINT_IN 117
+#define F_POINT_OUT 118
+#define F_LSEG_IN 119
+#define F_LSEG_OUT 120
+#define F_PATH_IN 121
+#define F_PATH_OUT 122
+#define F_BOX_IN 123
+#define F_BOX_OUT 124
+#define F_BOX_OVERLAP 125
+#define F_BOX_GE 126
+#define F_BOX_GT 127
+#define F_BOX_EQ 128
+#define F_BOX_LT 129
+#define F_BOX_LE 130
+#define F_POINT_ABOVE 131
+#define F_POINT_LEFT 132
+#define F_POINT_RIGHT 133
+#define F_POINT_BELOW 134
+#define F_POINT_EQ 135
+#define F_ON_PB 136
+#define F_ON_PPATH 137
+#define F_BOX_CENTER 138
+#define F_AREASEL 139
+#define F_AREAJOINSEL 140
+#define F_INT4MUL 141
+#define F_INT4NE 144
+#define F_INT2NE 145
+#define F_INT2GT 146
+#define F_INT4GT 147
+#define F_INT2LE 148
+#define F_INT4LE 149
+#define F_INT4GE 150
+#define F_INT2GE 151
+#define F_INT2MUL 152
+#define F_INT2DIV 153
+#define F_INT4DIV 154
+#define F_INT2MOD 155
+#define F_INT4MOD 156
+#define F_TEXTNE 157
+#define F_INT24EQ 158
+#define F_INT42EQ 159
+#define F_INT24LT 160
+#define F_INT42LT 161
+#define F_INT24GT 162
+#define F_INT42GT 163
+#define F_INT24NE 164
+#define F_INT42NE 165
+#define F_INT24LE 166
+#define F_INT42LE 167
+#define F_INT24GE 168
+#define F_INT42GE 169
+#define F_INT24MUL 170
+#define F_INT42MUL 171
+#define F_INT24DIV 172
+#define F_INT42DIV 173
+#define F_INT2PL 176
+#define F_INT4PL 177
+#define F_INT24PL 178
+#define F_INT42PL 179
+#define F_INT2MI 180
+#define F_INT4MI 181
+#define F_INT24MI 182
+#define F_INT42MI 183
+#define F_OIDEQ 184
+#define F_OIDNE 185
+#define F_BOX_SAME 186
+#define F_BOX_CONTAIN 187
+#define F_BOX_LEFT 188
+#define F_BOX_OVERLEFT 189
+#define F_BOX_OVERRIGHT 190
+#define F_BOX_RIGHT 191
+#define F_BOX_CONTAINED 192
+#define F_BOX_CONTAIN_PT 193
+#define F_PG_NODE_TREE_IN 195
+#define F_PG_NODE_TREE_OUT 196
+#define F_PG_NODE_TREE_RECV 197
+#define F_PG_NODE_TREE_SEND 198
+#define F_FLOAT4IN 200
+#define F_FLOAT4OUT 201
+#define F_FLOAT4MUL 202
+#define F_FLOAT4DIV 203
+#define F_FLOAT4PL 204
+#define F_FLOAT4MI 205
+#define F_FLOAT4UM 206
+#define F_FLOAT4ABS 207
+#define F_FLOAT4_ACCUM 208
+#define F_FLOAT4LARGER 209
+#define F_FLOAT4SMALLER 211
+#define F_INT4UM 212
+#define F_INT2UM 213
+#define F_FLOAT8IN 214
+#define F_FLOAT8OUT 215
+#define F_FLOAT8MUL 216
+#define F_FLOAT8DIV 217
+#define F_FLOAT8PL 218
+#define F_FLOAT8MI 219
+#define F_FLOAT8UM 220
+#define F_FLOAT8ABS 221
+#define F_FLOAT8_ACCUM 222
+#define F_FLOAT8LARGER 223
+#define F_FLOAT8SMALLER 224
+#define F_LSEG_CENTER 225
+#define F_PATH_CENTER 226
+#define F_POLY_CENTER 227
+#define F_DROUND 228
+#define F_DTRUNC 229
+#define F_DSQRT 230
+#define F_DCBRT 231
+#define F_DPOW 232
+#define F_DEXP 233
+#define F_DLOG1 234
+#define F_I2TOD 235
+#define F_I2TOF 236
+#define F_DTOI2 237
+#define F_FTOI2 238
+#define F_LINE_DISTANCE 239
+#define F_ABSTIMEIN 240
+#define F_ABSTIMEOUT 241
+#define F_RELTIMEIN 242
+#define F_RELTIMEOUT 243
+#define F_TIMEPL 244
+#define F_TIMEMI 245
+#define F_TINTERVALIN 246
+#define F_TINTERVALOUT 247
+#define F_INTINTERVAL 248
+#define F_TINTERVALREL 249
+#define F_TIMENOW 250
+#define F_ABSTIMEEQ 251
+#define F_ABSTIMENE 252
+#define F_ABSTIMELT 253
+#define F_ABSTIMEGT 254
+#define F_ABSTIMELE 255
+#define F_ABSTIMEGE 256
+#define F_RELTIMEEQ 257
+#define F_RELTIMENE 258
+#define F_RELTIMELT 259
+#define F_RELTIMEGT 260
+#define F_RELTIMELE 261
+#define F_RELTIMEGE 262
+#define F_TINTERVALSAME 263
+#define F_TINTERVALCT 264
+#define F_TINTERVALOV 265
+#define F_TINTERVALLENEQ 266
+#define F_TINTERVALLENNE 267
+#define F_TINTERVALLENLT 268
+#define F_TINTERVALLENGT 269
+#define F_TINTERVALLENLE 270
+#define F_TINTERVALLENGE 271
+#define F_TINTERVALSTART 272
+#define F_TINTERVALEND 273
+#define F_TIMEOFDAY 274
+#define F_ABSTIME_FINITE 275
+#define F_BTCANRETURN 276
+#define F_INTER_SL 277
+#define F_INTER_LB 278
+#define F_FLOAT48MUL 279
+#define F_FLOAT48DIV 280
+#define F_FLOAT48PL 281
+#define F_FLOAT48MI 282
+#define F_FLOAT84MUL 283
+#define F_FLOAT84DIV 284
+#define F_FLOAT84PL 285
+#define F_FLOAT84MI 286
+#define F_FLOAT4EQ 287
+#define F_FLOAT4NE 288
+#define F_FLOAT4LT 289
+#define F_FLOAT4LE 290
+#define F_FLOAT4GT 291
+#define F_FLOAT4GE 292
+#define F_FLOAT8EQ 293
+#define F_FLOAT8NE 294
+#define F_FLOAT8LT 295
+#define F_FLOAT8LE 296
+#define F_FLOAT8GT 297
+#define F_FLOAT8GE 298
+#define F_FLOAT48EQ 299
+#define F_FLOAT48NE 300
+#define F_FLOAT48LT 301
+#define F_FLOAT48LE 302
+#define F_FLOAT48GT 303
+#define F_FLOAT48GE 304
+#define F_FLOAT84EQ 305
+#define F_FLOAT84NE 306
+#define F_FLOAT84LT 307
+#define F_FLOAT84LE 308
+#define F_FLOAT84GT 309
+#define F_FLOAT84GE 310
+#define F_FTOD 311
+#define F_DTOF 312
+#define F_I2TOI4 313
+#define F_I4TOI2 314
+#define F_INT2VECTOREQ 315
+#define F_I4TOD 316
+#define F_DTOI4 317
+#define F_I4TOF 318
+#define F_FTOI4 319
+#define F_WIDTH_BUCKET_FLOAT8 320
+#define F_JSON_IN 321
+#define F_JSON_OUT 322
+#define F_JSON_RECV 323
+#define F_JSON_SEND 324
+#define F_GINBUILDEMPTY 325
+#define F_GISTBUILDEMPTY 326
+#define F_HASHBUILDEMPTY 327
+#define F_BTBUILDEMPTY 328
+#define F_HASH_ACLITEM 329
+#define F_BTGETTUPLE 330
+#define F_BTINSERT 331
+#define F_BTBULKDELETE 332
+#define F_BTBEGINSCAN 333
+#define F_BTRESCAN 334
+#define F_BTENDSCAN 335
+#define F_BTMARKPOS 336
+#define F_BTRESTRPOS 337
+#define F_BTBUILD 338
+#define F_POLY_SAME 339
+#define F_POLY_CONTAIN 340
+#define F_POLY_LEFT 341
+#define F_POLY_OVERLEFT 342
+#define F_POLY_OVERRIGHT 343
+#define F_POLY_RIGHT 344
+#define F_POLY_CONTAINED 345
+#define F_POLY_OVERLAP 346
+#define F_POLY_IN 347
+#define F_POLY_OUT 348
+#define F_BTINT2CMP 350
+#define F_BTINT4CMP 351
+#define F_BTFLOAT4CMP 354
+#define F_BTFLOAT8CMP 355
+#define F_BTOIDCMP 356
+#define F_BTABSTIMECMP 357
+#define F_BTCHARCMP 358
+#define F_BTNAMECMP 359
+#define F_BTTEXTCMP 360
+#define F_LSEG_DISTANCE 361
+#define F_LSEG_INTERPT 362
+#define F_DIST_PS 363
+#define F_DIST_PB 364
+#define F_DIST_SB 365
+#define F_CLOSE_PS 366
+#define F_CLOSE_PB 367
+#define F_CLOSE_SB 368
+#define F_ON_PS 369
+#define F_PATH_DISTANCE 370
+#define F_DIST_PPATH 371
+#define F_ON_SB 372
+#define F_INTER_SB 373
+#define F_TEXT_TO_ARRAY_NULL 376
+#define F_CASH_CMP 377
+#define F_ARRAY_APPEND 378
+#define F_ARRAY_PREPEND 379
+#define F_BTRELTIMECMP 380
+#define F_BTTINTERVALCMP 381
+#define F_BTARRAYCMP 382
+#define F_ARRAY_CAT 383
+#define F_ARRAY_TO_TEXT_NULL 384
+#define F_ARRAY_NE 390
+#define F_ARRAY_LT 391
+#define F_ARRAY_GT 392
+#define F_ARRAY_LE 393
+#define F_TEXT_TO_ARRAY 394
+#define F_ARRAY_TO_TEXT 395
+#define F_ARRAY_GE 396
+#define F_HASHINT2VECTOR 398
+#define F_HASHMACADDR 399
+#define F_HASHTEXT 400
+#define F_RTRIM1 401
+#define F_BTOIDVECTORCMP 404
+#define F_NAME_TEXT 406
+#define F_TEXT_NAME 407
+#define F_NAME_BPCHAR 408
+#define F_BPCHAR_NAME 409
+#define F_HASHINET 422
+#define F_HASHVACUUMCLEANUP 425
+#define F_HASH_NUMERIC 432
+#define F_MACADDR_IN 436
+#define F_MACADDR_OUT 437
+#define F_HASHCOSTESTIMATE 438
+#define F_HASHGETTUPLE 440
+#define F_HASHINSERT 441
+#define F_HASHBULKDELETE 442
+#define F_HASHBEGINSCAN 443
+#define F_HASHRESCAN 444
+#define F_HASHENDSCAN 445
+#define F_HASHMARKPOS 446
+#define F_HASHRESTRPOS 447
+#define F_HASHBUILD 448
+#define F_HASHINT2 449
+#define F_HASHINT4 450
+#define F_HASHFLOAT4 451
+#define F_HASHFLOAT8 452
+#define F_HASHOID 453
+#define F_HASHCHAR 454
+#define F_HASHNAME 455
+#define F_HASHVARLENA 456
+#define F_HASHOIDVECTOR 457
+#define F_TEXT_LARGER 458
+#define F_TEXT_SMALLER 459
+#define F_INT8IN 460
+#define F_INT8OUT 461
+#define F_INT8UM 462
+#define F_INT8PL 463
+#define F_INT8MI 464
+#define F_INT8MUL 465
+#define F_INT8DIV 466
+#define F_INT8EQ 467
+#define F_INT8NE 468
+#define F_INT8LT 469
+#define F_INT8GT 470
+#define F_INT8LE 471
+#define F_INT8GE 472
+#define F_INT84EQ 474
+#define F_INT84NE 475
+#define F_INT84LT 476
+#define F_INT84GT 477
+#define F_INT84LE 478
+#define F_INT84GE 479
+#define F_INT84 480
+#define F_INT48 481
+#define F_I8TOD 482
+#define F_DTOI8 483
+#define F_ARRAY_LARGER 515
+#define F_ARRAY_SMALLER 516
+#define F_INET_ABBREV 598
+#define F_CIDR_ABBREV 599
+#define F_INET_SET_MASKLEN 605
+#define F_OIDVECTORNE 619
+#define F_HASH_ARRAY 626
+#define F_CIDR_SET_MASKLEN 635
+#define F_BTGETBITMAP 636
+#define F_HASHGETBITMAP 637
+#define F_GISTGETBITMAP 638
+#define F_I8TOF 652
+#define F_FTOI8 653
+#define F_NAMELT 655
+#define F_NAMELE 656
+#define F_NAMEGT 657
+#define F_NAMEGE 658
+#define F_NAMENE 659
+#define F_BPCHAR 668
+#define F_VARCHAR 669
+#define F_MKTINTERVAL 676
+#define F_OIDVECTORLT 677
+#define F_OIDVECTORLE 678
+#define F_OIDVECTOREQ 679
+#define F_OIDVECTORGE 680
+#define F_OIDVECTORGT 681
+#define F_NETWORK_NETWORK 683
+#define F_NETWORK_NETMASK 696
+#define F_NETWORK_MASKLEN 697
+#define F_NETWORK_BROADCAST 698
+#define F_NETWORK_HOST 699
+#define F_CURRENT_USER 710
+#define F_NETWORK_FAMILY 711
+#define F_INT82 714
+#define F_LO_CREATE 715
+#define F_OIDLT 716
+#define F_OIDLE 717
+#define F_BYTEAOCTETLEN 720
+#define F_BYTEAGETBYTE 721
+#define F_BYTEASETBYTE 722
+#define F_BYTEAGETBIT 723
+#define F_BYTEASETBIT 724
+#define F_DIST_PL 725
+#define F_DIST_LB 726
+#define F_DIST_SL 727
+#define F_DIST_CPOLY 728
+#define F_POLY_DISTANCE 729
+#define F_NETWORK_SHOW 730
+#define F_TEXT_LT 740
+#define F_TEXT_LE 741
+#define F_TEXT_GT 742
+#define F_TEXT_GE 743
+#define F_ARRAY_EQ 744
+#define F_SESSION_USER 746
+#define F_ARRAY_DIMS 747
+#define F_ARRAY_NDIMS 748
+#define F_BYTEAOVERLAY 749
+#define F_ARRAY_IN 750
+#define F_ARRAY_OUT 751
+#define F_BYTEAOVERLAY_NO_LEN 752
+#define F_MACADDR_TRUNC 753
+#define F_INT28 754
+#define F_SMGRIN 760
+#define F_SMGROUT 761
+#define F_SMGREQ 762
+#define F_SMGRNE 763
+#define F_LO_IMPORT 764
+#define F_LO_EXPORT 765
+#define F_INT4INC 766
+#define F_LO_IMPORT_WITH_OID 767
+#define F_INT4LARGER 768
+#define F_INT4SMALLER 769
+#define F_INT2LARGER 770
+#define F_INT2SMALLER 771
+#define F_GISTCOSTESTIMATE 772
+#define F_GISTGETTUPLE 774
+#define F_GISTINSERT 775
+#define F_GISTBULKDELETE 776
+#define F_GISTBEGINSCAN 777
+#define F_GISTRESCAN 778
+#define F_GISTENDSCAN 779
+#define F_GISTMARKPOS 780
+#define F_GISTRESTRPOS 781
+#define F_GISTBUILD 782
+#define F_TINTERVALEQ 784
+#define F_TINTERVALNE 785
+#define F_TINTERVALLT 786
+#define F_TINTERVALGT 787
+#define F_TINTERVALLE 788
+#define F_TINTERVALGE 789
+#define F_PG_CLIENT_ENCODING 810
+#define F_CURRENT_QUERY 817
+#define F_MACADDR_EQ 830
+#define F_MACADDR_LT 831
+#define F_MACADDR_LE 832
+#define F_MACADDR_GT 833
+#define F_MACADDR_GE 834
+#define F_MACADDR_NE 835
+#define F_MACADDR_CMP 836
+#define F_INT82PL 837
+#define F_INT82MI 838
+#define F_INT82MUL 839
+#define F_INT82DIV 840
+#define F_INT28PL 841
+#define F_BTINT8CMP 842
+#define F_CASH_MUL_FLT4 846
+#define F_CASH_DIV_FLT4 847
+#define F_FLT4_MUL_CASH 848
+#define F_TEXTPOS 849
+#define F_TEXTLIKE 850
+#define F_TEXTNLIKE 851
+#define F_INT48EQ 852
+#define F_INT48NE 853
+#define F_INT48LT 854
+#define F_INT48GT 855
+#define F_INT48LE 856
+#define F_INT48GE 857
+#define F_NAMELIKE 858
+#define F_NAMENLIKE 859
+#define F_CHAR_BPCHAR 860
+#define F_CURRENT_DATABASE 861
+#define F_INT4_MUL_CASH 862
+#define F_INT2_MUL_CASH 863
+#define F_CASH_MUL_INT4 864
+#define F_CASH_DIV_INT4 865
+#define F_CASH_MUL_INT2 866
+#define F_CASH_DIV_INT2 867
+#define F_LOWER 870
+#define F_UPPER 871
+#define F_INITCAP 872
+#define F_LPAD 873
+#define F_RPAD 874
+#define F_LTRIM 875
+#define F_RTRIM 876
+#define F_TEXT_SUBSTR 877
+#define F_TRANSLATE 878
+#define F_LTRIM1 881
+#define F_TEXT_SUBSTR_NO_LEN 883
+#define F_BTRIM 884
+#define F_BTRIM1 885
+#define F_CASH_IN 886
+#define F_CASH_OUT 887
+#define F_CASH_EQ 888
+#define F_CASH_NE 889
+#define F_CASH_LT 890
+#define F_CASH_LE 891
+#define F_CASH_GT 892
+#define F_CASH_GE 893
+#define F_CASH_PL 894
+#define F_CASH_MI 895
+#define F_CASH_MUL_FLT8 896
+#define F_CASH_DIV_FLT8 897
+#define F_CASHLARGER 898
+#define F_CASHSMALLER 899
+#define F_INET_IN 910
+#define F_INET_OUT 911
+#define F_FLT8_MUL_CASH 919
+#define F_NETWORK_EQ 920
+#define F_NETWORK_LT 921
+#define F_NETWORK_LE 922
+#define F_NETWORK_GT 923
+#define F_NETWORK_GE 924
+#define F_NETWORK_NE 925
+#define F_NETWORK_CMP 926
+#define F_NETWORK_SUB 927
+#define F_NETWORK_SUBEQ 928
+#define F_NETWORK_SUP 929
+#define F_NETWORK_SUPEQ 930
+#define F_CASH_WORDS 935
+#define F_GENERATE_SERIES_TIMESTAMP 938
+#define F_GENERATE_SERIES_TIMESTAMPTZ 939
+#define F_INT28MI 942
+#define F_INT28MUL 943
+#define F_TEXT_CHAR 944
+#define F_INT8MOD 945
+#define F_CHAR_TEXT 946
+#define F_INT28DIV 948
+#define F_HASHINT8 949
+#define F_LO_OPEN 952
+#define F_LO_CLOSE 953
+#define F_LOREAD 954
+#define F_LOWRITE 955
+#define F_LO_LSEEK 956
+#define F_LO_CREAT 957
+#define F_LO_TELL 958
+#define F_ON_PL 959
+#define F_ON_SL 960
+#define F_CLOSE_PL 961
+#define F_CLOSE_SL 962
+#define F_CLOSE_LB 963
+#define F_LO_UNLINK 964
+#define F_BTVACUUMCLEANUP 972
+#define F_PATH_INTER 973
+#define F_BOX_AREA 975
+#define F_BOX_WIDTH 976
+#define F_BOX_HEIGHT 977
+#define F_BOX_DISTANCE 978
+#define F_PATH_AREA 979
+#define F_BOX_INTERSECT 980
+#define F_BOX_DIAGONAL 981
+#define F_PATH_N_LT 982
+#define F_PATH_N_GT 983
+#define F_PATH_N_EQ 984
+#define F_PATH_N_LE 985
+#define F_PATH_N_GE 986
+#define F_PATH_LENGTH 987
+#define F_POINT_NE 988
+#define F_POINT_VERT 989
+#define F_POINT_HORIZ 990
+#define F_POINT_DISTANCE 991
+#define F_POINT_SLOPE 992
+#define F_LSEG_CONSTRUCT 993
+#define F_LSEG_INTERSECT 994
+#define F_LSEG_PARALLEL 995
+#define F_LSEG_PERP 996
+#define F_LSEG_VERTICAL 997
+#define F_LSEG_HORIZONTAL 998
+#define F_LSEG_EQ 999
+#define F_LO_TRUNCATE 1004
+#define F_TIMESTAMPTZ_IZONE 1026
+#define F_GIST_POINT_COMPRESS 1030
+#define F_ACLITEMIN 1031
+#define F_ACLITEMOUT 1032
+#define F_ACLINSERT 1035
+#define F_ACLREMOVE 1036
+#define F_ACLCONTAINS 1037
+#define F_GETDATABASEENCODING 1039
+#define F_BPCHARIN 1044
+#define F_BPCHAROUT 1045
+#define F_VARCHARIN 1046
+#define F_VARCHAROUT 1047
+#define F_BPCHAREQ 1048
+#define F_BPCHARLT 1049
+#define F_BPCHARLE 1050
+#define F_BPCHARGT 1051
+#define F_BPCHARGE 1052
+#define F_BPCHARNE 1053
+#define F_ACLITEM_EQ 1062
+#define F_BPCHAR_LARGER 1063
+#define F_BPCHAR_SMALLER 1064
+#define F_PG_PREPARED_XACT 1065
+#define F_GENERATE_SERIES_STEP_INT4 1066
+#define F_GENERATE_SERIES_INT4 1067
+#define F_GENERATE_SERIES_STEP_INT8 1068
+#define F_GENERATE_SERIES_INT8 1069
+#define F_BPCHARCMP 1078
+#define F_TEXT_REGCLASS 1079
+#define F_HASHBPCHAR 1080
+#define F_FORMAT_TYPE 1081
+#define F_DATE_IN 1084
+#define F_DATE_OUT 1085
+#define F_DATE_EQ 1086
+#define F_DATE_LT 1087
+#define F_DATE_LE 1088
+#define F_DATE_GT 1089
+#define F_DATE_GE 1090
+#define F_DATE_NE 1091
+#define F_DATE_CMP 1092
+#define F_TIME_LT 1102
+#define F_TIME_LE 1103
+#define F_TIME_GT 1104
+#define F_TIME_GE 1105
+#define F_TIME_NE 1106
+#define F_TIME_CMP 1107
+#define F_DATE_LARGER 1138
+#define F_DATE_SMALLER 1139
+#define F_DATE_MI 1140
+#define F_DATE_PLI 1141
+#define F_DATE_MII 1142
+#define F_TIME_IN 1143
+#define F_TIME_OUT 1144
+#define F_TIME_EQ 1145
+#define F_CIRCLE_ADD_PT 1146
+#define F_CIRCLE_SUB_PT 1147
+#define F_CIRCLE_MUL_PT 1148
+#define F_CIRCLE_DIV_PT 1149
+#define F_TIMESTAMPTZ_IN 1150
+#define F_TIMESTAMPTZ_OUT 1151
+#define F_TIMESTAMP_EQ 1152
+#define F_TIMESTAMP_NE 1153
+#define F_TIMESTAMP_LT 1154
+#define F_TIMESTAMP_LE 1155
+#define F_TIMESTAMP_GE 1156
+#define F_TIMESTAMP_GT 1157
+#define F_TIMESTAMPTZ_ZONE 1159
+#define F_INTERVAL_IN 1160
+#define F_INTERVAL_OUT 1161
+#define F_INTERVAL_EQ 1162
+#define F_INTERVAL_NE 1163
+#define F_INTERVAL_LT 1164
+#define F_INTERVAL_LE 1165
+#define F_INTERVAL_GE 1166
+#define F_INTERVAL_GT 1167
+#define F_INTERVAL_UM 1168
+#define F_INTERVAL_PL 1169
+#define F_INTERVAL_MI 1170
+#define F_TIMESTAMPTZ_PART 1171
+#define F_INTERVAL_PART 1172
+#define F_ABSTIME_TIMESTAMPTZ 1173
+#define F_DATE_TIMESTAMPTZ 1174
+#define F_INTERVAL_JUSTIFY_HOURS 1175
+#define F_RELTIME_INTERVAL 1177
+#define F_TIMESTAMPTZ_DATE 1178
+#define F_ABSTIME_DATE 1179
+#define F_TIMESTAMPTZ_ABSTIME 1180
+#define F_XID_AGE 1181
+#define F_TIMESTAMP_MI 1188
+#define F_TIMESTAMPTZ_PL_INTERVAL 1189
+#define F_TIMESTAMPTZ_MI_INTERVAL 1190
+#define F_GENERATE_SUBSCRIPTS 1191
+#define F_GENERATE_SUBSCRIPTS_NODIR 1192
+#define F_ARRAY_FILL 1193
+#define F_INTERVAL_RELTIME 1194
+#define F_TIMESTAMP_SMALLER 1195
+#define F_TIMESTAMP_LARGER 1196
+#define F_INTERVAL_SMALLER 1197
+#define F_INTERVAL_LARGER 1198
+#define F_TIMESTAMPTZ_AGE 1199
+#define F_INTERVAL_SCALE 1200
+#define F_TIMESTAMPTZ_TRUNC 1217
+#define F_INTERVAL_TRUNC 1218
+#define F_INT8INC 1219
+#define F_INT8ABS 1230
+#define F_INT8LARGER 1236
+#define F_INT8SMALLER 1237
+#define F_TEXTICREGEXEQ 1238
+#define F_TEXTICREGEXNE 1239
+#define F_NAMEICREGEXEQ 1240
+#define F_NAMEICREGEXNE 1241
+#define F_BOOLIN 1242
+#define F_BOOLOUT 1243
+#define F_BYTEAIN 1244
+#define F_CHARIN 1245
+#define F_CHARLT 1246
+#define F_UNIQUE_KEY_RECHECK 1250
+#define F_INT4ABS 1251
+#define F_NAMEREGEXNE 1252
+#define F_INT2ABS 1253
+#define F_TEXTREGEXEQ 1254
+#define F_TEXTREGEXNE 1256
+#define F_TEXTLEN 1257
+#define F_TEXTCAT 1258
+#define F_PG_CHAR_TO_ENCODING 1264
+#define F_TIDNE 1265
+#define F_CIDR_IN 1267
+#define F_BTCOSTESTIMATE 1268
+#define F_PG_COLUMN_SIZE 1269
+#define F_OVERLAPS_TIMETZ 1271
+#define F_DATETIME_TIMESTAMP 1272
+#define F_TIMETZ_PART 1273
+#define F_INT84PL 1274
+#define F_INT84MI 1275
+#define F_INT84MUL 1276
+#define F_INT84DIV 1277
+#define F_INT48PL 1278
+#define F_INT48MI 1279
+#define F_INT48MUL 1280
+#define F_INT48DIV 1281
+#define F_QUOTE_IDENT 1282
+#define F_QUOTE_LITERAL 1283
+#define F_ARRAY_FILL_WITH_LOWER_BOUNDS 1286
+#define F_I8TOOID 1287
+#define F_OIDTOI8 1288
+#define F_QUOTE_NULLABLE 1289
+#define F_SUPPRESS_REDUNDANT_UPDATES_TRIGGER 1291
+#define F_TIDEQ 1292
+#define F_CURRTID_BYRELOID 1293
+#define F_CURRTID_BYRELNAME 1294
+#define F_INTERVAL_JUSTIFY_DAYS 1295
+#define F_DATETIMETZ_TIMESTAMPTZ 1297
+#define F_NOW 1299
+#define F_POSITIONSEL 1300
+#define F_POSITIONJOINSEL 1301
+#define F_CONTSEL 1302
+#define F_CONTJOINSEL 1303
+#define F_OVERLAPS_TIMESTAMP 1304
+#define F_OVERLAPS_TIME 1308
+#define F_TIMESTAMP_IN 1312
+#define F_TIMESTAMP_OUT 1313
+#define F_TIMESTAMP_CMP 1314
+#define F_INTERVAL_CMP 1315
+#define F_TIMESTAMP_TIME 1316
+#define F_BPCHARLEN 1318
+#define F_INTERVAL_DIV 1326
+#define F_DLOG10 1339
+#define F_OIDVECTORTYPES 1349
+#define F_TIMETZ_IN 1350
+#define F_TIMETZ_OUT 1351
+#define F_TIMETZ_EQ 1352
+#define F_TIMETZ_NE 1353
+#define F_TIMETZ_LT 1354
+#define F_TIMETZ_LE 1355
+#define F_TIMETZ_GE 1356
+#define F_TIMETZ_GT 1357
+#define F_TIMETZ_CMP 1358
+#define F_NETWORK_HOSTMASK 1362
+#define F_MAKEACLITEM 1365
+#define F_TIME_INTERVAL 1370
+#define F_PG_LOCK_STATUS 1371
+#define F_DATE_FINITE 1373
+#define F_TEXTOCTETLEN 1374
+#define F_BPCHAROCTETLEN 1375
+#define F_TIME_LARGER 1377
+#define F_TIME_SMALLER 1378
+#define F_TIMETZ_LARGER 1379
+#define F_TIMETZ_SMALLER 1380
+#define F_TIME_PART 1385
+#define F_PG_GET_CONSTRAINTDEF 1387
+#define F_TIMESTAMPTZ_TIMETZ 1388
+#define F_TIMESTAMP_FINITE 1389
+#define F_INTERVAL_FINITE 1390
+#define F_PG_STAT_GET_BACKEND_START 1391
+#define F_PG_STAT_GET_BACKEND_CLIENT_ADDR 1392
+#define F_PG_STAT_GET_BACKEND_CLIENT_PORT 1393
+#define F_CURRENT_SCHEMA 1402
+#define F_CURRENT_SCHEMAS 1403
+#define F_TEXTOVERLAY 1404
+#define F_TEXTOVERLAY_NO_LEN 1405
+#define F_LINE_PARALLEL 1412
+#define F_LINE_PERP 1413
+#define F_LINE_VERTICAL 1414
+#define F_LINE_HORIZONTAL 1415
+#define F_CIRCLE_CENTER 1416
+#define F_INTERVAL_TIME 1419
+#define F_POINTS_BOX 1421
+#define F_BOX_ADD 1422
+#define F_BOX_SUB 1423
+#define F_BOX_MUL 1424
+#define F_BOX_DIV 1425
+#define F_CIDR_OUT 1427
+#define F_POLY_CONTAIN_PT 1428
+#define F_PT_CONTAINED_POLY 1429
+#define F_PATH_ISCLOSED 1430
+#define F_PATH_ISOPEN 1431
+#define F_PATH_NPOINTS 1432
+#define F_PATH_CLOSE 1433
+#define F_PATH_OPEN 1434
+#define F_PATH_ADD 1435
+#define F_PATH_ADD_PT 1436
+#define F_PATH_SUB_PT 1437
+#define F_PATH_MUL_PT 1438
+#define F_PATH_DIV_PT 1439
+#define F_CONSTRUCT_POINT 1440
+#define F_POINT_ADD 1441
+#define F_POINT_SUB 1442
+#define F_POINT_MUL 1443
+#define F_POINT_DIV 1444
+#define F_POLY_NPOINTS 1445
+#define F_POLY_BOX 1446
+#define F_POLY_PATH 1447
+#define F_BOX_POLY 1448
+#define F_PATH_POLY 1449
+#define F_CIRCLE_IN 1450
+#define F_CIRCLE_OUT 1451
+#define F_CIRCLE_SAME 1452
+#define F_CIRCLE_CONTAIN 1453
+#define F_CIRCLE_LEFT 1454
+#define F_CIRCLE_OVERLEFT 1455
+#define F_CIRCLE_OVERRIGHT 1456
+#define F_CIRCLE_RIGHT 1457
+#define F_CIRCLE_CONTAINED 1458
+#define F_CIRCLE_OVERLAP 1459
+#define F_CIRCLE_BELOW 1460
+#define F_CIRCLE_ABOVE 1461
+#define F_CIRCLE_EQ 1462
+#define F_CIRCLE_NE 1463
+#define F_CIRCLE_LT 1464
+#define F_CIRCLE_GT 1465
+#define F_CIRCLE_LE 1466
+#define F_CIRCLE_GE 1467
+#define F_CIRCLE_AREA 1468
+#define F_CIRCLE_DIAMETER 1469
+#define F_CIRCLE_RADIUS 1470
+#define F_CIRCLE_DISTANCE 1471
+#define F_CR_CIRCLE 1473
+#define F_POLY_CIRCLE 1474
+#define F_CIRCLE_POLY 1475
+#define F_DIST_PC 1476
+#define F_CIRCLE_CONTAIN_PT 1477
+#define F_PT_CONTAINED_CIRCLE 1478
+#define F_BOX_CIRCLE 1479
+#define F_CIRCLE_BOX 1480
+#define F_LSEG_NE 1482
+#define F_LSEG_LT 1483
+#define F_LSEG_LE 1484
+#define F_LSEG_GT 1485
+#define F_LSEG_GE 1486
+#define F_LSEG_LENGTH 1487
+#define F_CLOSE_LS 1488
+#define F_CLOSE_LSEG 1489
+#define F_LINE_IN 1490
+#define F_LINE_OUT 1491
+#define F_LINE_EQ 1492
+#define F_LINE_CONSTRUCT_PP 1493
+#define F_LINE_INTERPT 1494
+#define F_LINE_INTERSECT 1495
+#define F_BIT_IN 1564
+#define F_BIT_OUT 1565
+#define F_PG_GET_RULEDEF 1573
+#define F_NEXTVAL_OID 1574
+#define F_CURRVAL_OID 1575
+#define F_SETVAL_OID 1576
+#define F_VARBIT_IN 1579
+#define F_VARBIT_OUT 1580
+#define F_BITEQ 1581
+#define F_BITNE 1582
+#define F_BITGE 1592
+#define F_BITGT 1593
+#define F_BITLE 1594
+#define F_BITLT 1595
+#define F_BITCMP 1596
+#define F_PG_ENCODING_TO_CHAR 1597
+#define F_DRANDOM 1598
+#define F_SETSEED 1599
+#define F_DASIN 1600
+#define F_DACOS 1601
+#define F_DATAN 1602
+#define F_DATAN2 1603
+#define F_DSIN 1604
+#define F_DCOS 1605
+#define F_DTAN 1606
+#define F_DCOT 1607
+#define F_DEGREES 1608
+#define F_RADIANS 1609
+#define F_DPI 1610
+#define F_INTERVAL_MUL 1618
+#define F_PG_TYPEOF 1619
+#define F_ASCII 1620
+#define F_CHR 1621
+#define F_REPEAT 1622
+#define F_SIMILAR_ESCAPE 1623
+#define F_MUL_D_INTERVAL 1624
+#define F_TEXTICLIKE 1633
+#define F_TEXTICNLIKE 1634
+#define F_NAMEICLIKE 1635
+#define F_NAMEICNLIKE 1636
+#define F_LIKE_ESCAPE 1637
+#define F_OIDGT 1638
+#define F_OIDGE 1639
+#define F_PG_GET_VIEWDEF_NAME 1640
+#define F_PG_GET_VIEWDEF 1641
+#define F_PG_GET_USERBYID 1642
+#define F_PG_GET_INDEXDEF 1643
+#define F_RI_FKEY_CHECK_INS 1644
+#define F_RI_FKEY_CHECK_UPD 1645
+#define F_RI_FKEY_CASCADE_DEL 1646
+#define F_RI_FKEY_CASCADE_UPD 1647
+#define F_RI_FKEY_RESTRICT_DEL 1648
+#define F_RI_FKEY_RESTRICT_UPD 1649
+#define F_RI_FKEY_SETNULL_DEL 1650
+#define F_RI_FKEY_SETNULL_UPD 1651
+#define F_RI_FKEY_SETDEFAULT_DEL 1652
+#define F_RI_FKEY_SETDEFAULT_UPD 1653
+#define F_RI_FKEY_NOACTION_DEL 1654
+#define F_RI_FKEY_NOACTION_UPD 1655
+#define F_PG_GET_TRIGGERDEF 1662
+#define F_PG_GET_SERIAL_SEQUENCE 1665
+#define F_BIT_AND 1673
+#define F_BIT_OR 1674
+#define F_BITXOR 1675
+#define F_BITNOT 1676
+#define F_BITSHIFTLEFT 1677
+#define F_BITSHIFTRIGHT 1678
+#define F_BITCAT 1679
+#define F_BITSUBSTR 1680
+#define F_BITLENGTH 1681
+#define F_BITOCTETLENGTH 1682
+#define F_BITFROMINT4 1683
+#define F_BITTOINT4 1684
+#define F_BIT 1685
+#define F_PG_GET_KEYWORDS 1686
+#define F_VARBIT 1687
+#define F_TIME_HASH 1688
+#define F_ACLEXPLODE 1689
+#define F_TIME_MI_TIME 1690
+#define F_BOOLLE 1691
+#define F_BOOLGE 1692
+#define F_BTBOOLCMP 1693
+#define F_TIMETZ_HASH 1696
+#define F_INTERVAL_HASH 1697
+#define F_BITPOSITION 1698
+#define F_BITSUBSTR_NO_LEN 1699
+#define F_NUMERIC_IN 1701
+#define F_NUMERIC_OUT 1702
+#define F_NUMERIC 1703
+#define F_NUMERIC_ABS 1704
+#define F_NUMERIC_SIGN 1706
+#define F_NUMERIC_ROUND 1707
+#define F_NUMERIC_TRUNC 1709
+#define F_NUMERIC_CEIL 1711
+#define F_NUMERIC_FLOOR 1712
+#define F_LENGTH_IN_ENCODING 1713
+#define F_PG_CONVERT_FROM 1714
+#define F_INET_TO_CIDR 1715
+#define F_PG_GET_EXPR 1716
+#define F_PG_CONVERT_TO 1717
+#define F_NUMERIC_EQ 1718
+#define F_NUMERIC_NE 1719
+#define F_NUMERIC_GT 1720
+#define F_NUMERIC_GE 1721
+#define F_NUMERIC_LT 1722
+#define F_NUMERIC_LE 1723
+#define F_NUMERIC_ADD 1724
+#define F_NUMERIC_SUB 1725
+#define F_NUMERIC_MUL 1726
+#define F_NUMERIC_DIV 1727
+#define F_NUMERIC_MOD 1728
+#define F_NUMERIC_SQRT 1730
+#define F_NUMERIC_EXP 1732
+#define F_NUMERIC_LN 1734
+#define F_NUMERIC_LOG 1736
+#define F_NUMERIC_POWER 1738
+#define F_INT4_NUMERIC 1740
+#define F_FLOAT4_NUMERIC 1742
+#define F_FLOAT8_NUMERIC 1743
+#define F_NUMERIC_INT4 1744
+#define F_NUMERIC_FLOAT4 1745
+#define F_NUMERIC_FLOAT8 1746
+#define F_TIME_PL_INTERVAL 1747
+#define F_TIME_MI_INTERVAL 1748
+#define F_TIMETZ_PL_INTERVAL 1749
+#define F_TIMETZ_MI_INTERVAL 1750
+#define F_NUMERIC_INC 1764
+#define F_SETVAL3_OID 1765
+#define F_NUMERIC_SMALLER 1766
+#define F_NUMERIC_LARGER 1767
+#define F_INTERVAL_TO_CHAR 1768
+#define F_NUMERIC_CMP 1769
+#define F_TIMESTAMPTZ_TO_CHAR 1770
+#define F_NUMERIC_UMINUS 1771
+#define F_NUMERIC_TO_CHAR 1772
+#define F_INT4_TO_CHAR 1773
+#define F_INT8_TO_CHAR 1774
+#define F_FLOAT4_TO_CHAR 1775
+#define F_FLOAT8_TO_CHAR 1776
+#define F_NUMERIC_TO_NUMBER 1777
+#define F_TO_TIMESTAMP 1778
+#define F_NUMERIC_INT8 1779
+#define F_TO_DATE 1780
+#define F_INT8_NUMERIC 1781
+#define F_INT2_NUMERIC 1782
+#define F_NUMERIC_INT2 1783
+#define F_OIDIN 1798
+#define F_OIDOUT 1799
+#define F_PG_CONVERT 1813
+#define F_ICLIKESEL 1814
+#define F_ICNLIKESEL 1815
+#define F_ICLIKEJOINSEL 1816
+#define F_ICNLIKEJOINSEL 1817
+#define F_REGEXEQSEL 1818
+#define F_LIKESEL 1819
+#define F_ICREGEXEQSEL 1820
+#define F_REGEXNESEL 1821
+#define F_NLIKESEL 1822
+#define F_ICREGEXNESEL 1823
+#define F_REGEXEQJOINSEL 1824
+#define F_LIKEJOINSEL 1825
+#define F_ICREGEXEQJOINSEL 1826
+#define F_REGEXNEJOINSEL 1827
+#define F_NLIKEJOINSEL 1828
+#define F_ICREGEXNEJOINSEL 1829
+#define F_FLOAT8_AVG 1830
+#define F_FLOAT8_VAR_SAMP 1831
+#define F_FLOAT8_STDDEV_SAMP 1832
+#define F_NUMERIC_ACCUM 1833
+#define F_INT2_ACCUM 1834
+#define F_INT4_ACCUM 1835
+#define F_INT8_ACCUM 1836
+#define F_NUMERIC_AVG 1837
+#define F_NUMERIC_VAR_SAMP 1838
+#define F_NUMERIC_STDDEV_SAMP 1839
+#define F_INT2_SUM 1840
+#define F_INT4_SUM 1841
+#define F_INT8_SUM 1842
+#define F_INTERVAL_ACCUM 1843
+#define F_INTERVAL_AVG 1844
+#define F_TO_ASCII_DEFAULT 1845
+#define F_TO_ASCII_ENC 1846
+#define F_TO_ASCII_ENCNAME 1847
+#define F_INT28EQ 1850
+#define F_INT28NE 1851
+#define F_INT28LT 1852
+#define F_INT28GT 1853
+#define F_INT28LE 1854
+#define F_INT28GE 1855
+#define F_INT82EQ 1856
+#define F_INT82NE 1857
+#define F_INT82LT 1858
+#define F_INT82GT 1859
+#define F_INT82LE 1860
+#define F_INT82GE 1861
+#define F_INT2AND 1892
+#define F_INT2OR 1893
+#define F_INT2XOR 1894
+#define F_INT2NOT 1895
+#define F_INT2SHL 1896
+#define F_INT2SHR 1897
+#define F_INT4AND 1898
+#define F_INT4OR 1899
+#define F_INT4XOR 1900
+#define F_INT4NOT 1901
+#define F_INT4SHL 1902
+#define F_INT4SHR 1903
+#define F_INT8AND 1904
+#define F_INT8OR 1905
+#define F_INT8XOR 1906
+#define F_INT8NOT 1907
+#define F_INT8SHL 1908
+#define F_INT8SHR 1909
+#define F_INT8UP 1910
+#define F_INT2UP 1911
+#define F_INT4UP 1912
+#define F_FLOAT4UP 1913
+#define F_FLOAT8UP 1914
+#define F_NUMERIC_UPLUS 1915
+#define F_HAS_TABLE_PRIVILEGE_NAME_NAME 1922
+#define F_HAS_TABLE_PRIVILEGE_NAME_ID 1923
+#define F_HAS_TABLE_PRIVILEGE_ID_NAME 1924
+#define F_HAS_TABLE_PRIVILEGE_ID_ID 1925
+#define F_HAS_TABLE_PRIVILEGE_NAME 1926
+#define F_HAS_TABLE_PRIVILEGE_ID 1927
+#define F_PG_STAT_GET_NUMSCANS 1928
+#define F_PG_STAT_GET_TUPLES_RETURNED 1929
+#define F_PG_STAT_GET_TUPLES_FETCHED 1930
+#define F_PG_STAT_GET_TUPLES_INSERTED 1931
+#define F_PG_STAT_GET_TUPLES_UPDATED 1932
+#define F_PG_STAT_GET_TUPLES_DELETED 1933
+#define F_PG_STAT_GET_BLOCKS_FETCHED 1934
+#define F_PG_STAT_GET_BLOCKS_HIT 1935
+#define F_PG_STAT_GET_BACKEND_IDSET 1936
+#define F_PG_STAT_GET_BACKEND_PID 1937
+#define F_PG_STAT_GET_BACKEND_DBID 1938
+#define F_PG_STAT_GET_BACKEND_USERID 1939
+#define F_PG_STAT_GET_BACKEND_ACTIVITY 1940
+#define F_PG_STAT_GET_DB_NUMBACKENDS 1941
+#define F_PG_STAT_GET_DB_XACT_COMMIT 1942
+#define F_PG_STAT_GET_DB_XACT_ROLLBACK 1943
+#define F_PG_STAT_GET_DB_BLOCKS_FETCHED 1944
+#define F_PG_STAT_GET_DB_BLOCKS_HIT 1945
+#define F_BINARY_ENCODE 1946
+#define F_BINARY_DECODE 1947
+#define F_BYTEAEQ 1948
+#define F_BYTEALT 1949
+#define F_BYTEALE 1950
+#define F_BYTEAGT 1951
+#define F_BYTEAGE 1952
+#define F_BYTEANE 1953
+#define F_BYTEACMP 1954
+#define F_TIMESTAMP_SCALE 1961
+#define F_INT2_AVG_ACCUM 1962
+#define F_INT4_AVG_ACCUM 1963
+#define F_INT8_AVG 1964
+#define F_OIDLARGER 1965
+#define F_OIDSMALLER 1966
+#define F_TIMESTAMPTZ_SCALE 1967
+#define F_TIME_SCALE 1968
+#define F_TIMETZ_SCALE 1969
+#define F_PG_STAT_GET_TUPLES_HOT_UPDATED 1972
+#define F_NUMERIC_DIV_TRUNC 1973
+#define F_BYTEALIKE 2005
+#define F_BYTEANLIKE 2006
+#define F_LIKE_ESCAPE_BYTEA 2009
+#define F_BYTEACAT 2011
+#define F_BYTEA_SUBSTR 2012
+#define F_BYTEA_SUBSTR_NO_LEN 2013
+#define F_BYTEAPOS 2014
+#define F_BYTEATRIM 2015
+#define F_TIMESTAMPTZ_TIME 2019
+#define F_TIMESTAMP_TRUNC 2020
+#define F_TIMESTAMP_PART 2021
+#define F_PG_STAT_GET_ACTIVITY 2022
+#define F_ABSTIME_TIMESTAMP 2023
+#define F_DATE_TIMESTAMP 2024
+#define F_PG_BACKEND_PID 2026
+#define F_TIMESTAMPTZ_TIMESTAMP 2027
+#define F_TIMESTAMP_TIMESTAMPTZ 2028
+#define F_TIMESTAMP_DATE 2029
+#define F_TIMESTAMP_ABSTIME 2030
+#define F_TIMESTAMP_PL_INTERVAL 2032
+#define F_TIMESTAMP_MI_INTERVAL 2033
+#define F_PG_CONF_LOAD_TIME 2034
+#define F_TIMETZ_ZONE 2037
+#define F_TIMETZ_IZONE 2038
+#define F_TIMESTAMP_HASH 2039
+#define F_TIMETZ_TIME 2046
+#define F_TIME_TIMETZ 2047
+#define F_TIMESTAMP_TO_CHAR 2049
+#define F_AGGREGATE_DUMMY 2050
+#define F_TIMESTAMP_AGE 2058
+#define F_TIMESTAMP_ZONE 2069
+#define F_TIMESTAMP_IZONE 2070
+#define F_DATE_PL_INTERVAL 2071
+#define F_DATE_MI_INTERVAL 2072
+#define F_TEXTREGEXSUBSTR 2073
+#define F_BITFROMINT8 2075
+#define F_BITTOINT8 2076
+#define F_SHOW_CONFIG_BY_NAME 2077
+#define F_SET_CONFIG_BY_NAME 2078
+#define F_PG_TABLE_IS_VISIBLE 2079
+#define F_PG_TYPE_IS_VISIBLE 2080
+#define F_PG_FUNCTION_IS_VISIBLE 2081
+#define F_PG_OPERATOR_IS_VISIBLE 2082
+#define F_PG_OPCLASS_IS_VISIBLE 2083
+#define F_SHOW_ALL_SETTINGS 2084
+#define F_REPLACE_TEXT 2087
+#define F_SPLIT_TEXT 2088
+#define F_TO_HEX32 2089
+#define F_TO_HEX64 2090
+#define F_ARRAY_LOWER 2091
+#define F_ARRAY_UPPER 2092
+#define F_PG_CONVERSION_IS_VISIBLE 2093
+#define F_PG_STAT_GET_BACKEND_ACTIVITY_START 2094
+#define F_PG_TERMINATE_BACKEND 2096
+#define F_PG_GET_FUNCTIONDEF 2098
+#define F_TEXT_PATTERN_LT 2160
+#define F_TEXT_PATTERN_LE 2161
+#define F_PG_GET_FUNCTION_ARGUMENTS 2162
+#define F_TEXT_PATTERN_GE 2163
+#define F_TEXT_PATTERN_GT 2164
+#define F_PG_GET_FUNCTION_RESULT 2165
+#define F_BTTEXT_PATTERN_CMP 2166
+#define F_PG_DATABASE_SIZE_NAME 2168
+#define F_WIDTH_BUCKET_NUMERIC 2170
+#define F_PG_CANCEL_BACKEND 2171
+#define F_PG_START_BACKUP 2172
+#define F_PG_STOP_BACKUP 2173
+#define F_BPCHAR_PATTERN_LT 2174
+#define F_BPCHAR_PATTERN_LE 2175
+#define F_ARRAY_LENGTH 2176
+#define F_BPCHAR_PATTERN_GE 2177
+#define F_BPCHAR_PATTERN_GT 2178
+#define F_GIST_POINT_CONSISTENT 2179
+#define F_BTBPCHAR_PATTERN_CMP 2180
+#define F_HAS_SEQUENCE_PRIVILEGE_NAME_NAME 2181
+#define F_HAS_SEQUENCE_PRIVILEGE_NAME_ID 2182
+#define F_HAS_SEQUENCE_PRIVILEGE_ID_NAME 2183
+#define F_HAS_SEQUENCE_PRIVILEGE_ID_ID 2184
+#define F_HAS_SEQUENCE_PRIVILEGE_NAME 2185
+#define F_HAS_SEQUENCE_PRIVILEGE_ID 2186
+#define F_BTINT48CMP 2188
+#define F_BTINT84CMP 2189
+#define F_BTINT24CMP 2190
+#define F_BTINT42CMP 2191
+#define F_BTINT28CMP 2192
+#define F_BTINT82CMP 2193
+#define F_BTFLOAT48CMP 2194
+#define F_BTFLOAT84CMP 2195
+#define F_INET_CLIENT_ADDR 2196
+#define F_INET_CLIENT_PORT 2197
+#define F_INET_SERVER_ADDR 2198
+#define F_INET_SERVER_PORT 2199
+#define F_REGPROCEDUREIN 2212
+#define F_REGPROCEDUREOUT 2213
+#define F_REGOPERIN 2214
+#define F_REGOPEROUT 2215
+#define F_REGOPERATORIN 2216
+#define F_REGOPERATOROUT 2217
+#define F_REGCLASSIN 2218
+#define F_REGCLASSOUT 2219
+#define F_REGTYPEIN 2220
+#define F_REGTYPEOUT 2221
+#define F_PG_STAT_CLEAR_SNAPSHOT 2230
+#define F_PG_GET_FUNCTION_IDENTITY_ARGUMENTS 2232
+#define F_FMGR_INTERNAL_VALIDATOR 2246
+#define F_FMGR_C_VALIDATOR 2247
+#define F_FMGR_SQL_VALIDATOR 2248
+#define F_HAS_DATABASE_PRIVILEGE_NAME_NAME 2250
+#define F_HAS_DATABASE_PRIVILEGE_NAME_ID 2251
+#define F_HAS_DATABASE_PRIVILEGE_ID_NAME 2252
+#define F_HAS_DATABASE_PRIVILEGE_ID_ID 2253
+#define F_HAS_DATABASE_PRIVILEGE_NAME 2254
+#define F_HAS_DATABASE_PRIVILEGE_ID 2255
+#define F_HAS_FUNCTION_PRIVILEGE_NAME_NAME 2256
+#define F_HAS_FUNCTION_PRIVILEGE_NAME_ID 2257
+#define F_HAS_FUNCTION_PRIVILEGE_ID_NAME 2258
+#define F_HAS_FUNCTION_PRIVILEGE_ID_ID 2259
+#define F_HAS_FUNCTION_PRIVILEGE_NAME 2260
+#define F_HAS_FUNCTION_PRIVILEGE_ID 2261
+#define F_HAS_LANGUAGE_PRIVILEGE_NAME_NAME 2262
+#define F_HAS_LANGUAGE_PRIVILEGE_NAME_ID 2263
+#define F_HAS_LANGUAGE_PRIVILEGE_ID_NAME 2264
+#define F_HAS_LANGUAGE_PRIVILEGE_ID_ID 2265
+#define F_HAS_LANGUAGE_PRIVILEGE_NAME 2266
+#define F_HAS_LANGUAGE_PRIVILEGE_ID 2267
+#define F_HAS_SCHEMA_PRIVILEGE_NAME_NAME 2268
+#define F_HAS_SCHEMA_PRIVILEGE_NAME_ID 2269
+#define F_HAS_SCHEMA_PRIVILEGE_ID_NAME 2270
+#define F_HAS_SCHEMA_PRIVILEGE_ID_ID 2271
+#define F_HAS_SCHEMA_PRIVILEGE_NAME 2272
+#define F_HAS_SCHEMA_PRIVILEGE_ID 2273
+#define F_PG_STAT_RESET 2274
+#define F_TEXTREGEXREPLACE_NOOPT 2284
+#define F_TEXTREGEXREPLACE 2285
+#define F_PG_TOTAL_RELATION_SIZE 2286
+#define F_PG_SIZE_PRETTY 2288
+#define F_PG_OPTIONS_TO_TABLE 2289
+#define F_RECORD_IN 2290
+#define F_RECORD_OUT 2291
+#define F_CSTRING_IN 2292
+#define F_CSTRING_OUT 2293
+#define F_ANY_IN 2294
+#define F_ANY_OUT 2295
+#define F_ANYARRAY_IN 2296
+#define F_ANYARRAY_OUT 2297
+#define F_VOID_IN 2298
+#define F_VOID_OUT 2299
+#define F_TRIGGER_IN 2300
+#define F_TRIGGER_OUT 2301
+#define F_LANGUAGE_HANDLER_IN 2302
+#define F_LANGUAGE_HANDLER_OUT 2303
+#define F_INTERNAL_IN 2304
+#define F_INTERNAL_OUT 2305
+#define F_OPAQUE_IN 2306
+#define F_OPAQUE_OUT 2307
+#define F_DCEIL 2308
+#define F_DFLOOR 2309
+#define F_DSIGN 2310
+#define F_MD5_TEXT 2311
+#define F_ANYELEMENT_IN 2312
+#define F_ANYELEMENT_OUT 2313
+#define F_POSTGRESQL_FDW_VALIDATOR 2316
+#define F_PG_ENCODING_MAX_LENGTH_SQL 2319
+#define F_MD5_BYTEA 2321
+#define F_PG_TABLESPACE_SIZE_OID 2322
+#define F_PG_TABLESPACE_SIZE_NAME 2323
+#define F_PG_DATABASE_SIZE_OID 2324
+#define F_ARRAY_UNNEST 2331
+#define F_PG_RELATION_SIZE 2332
+#define F_ARRAY_AGG_TRANSFN 2333
+#define F_ARRAY_AGG_FINALFN 2334
+#define F_DATE_LT_TIMESTAMP 2338
+#define F_DATE_LE_TIMESTAMP 2339
+#define F_DATE_EQ_TIMESTAMP 2340
+#define F_DATE_GT_TIMESTAMP 2341
+#define F_DATE_GE_TIMESTAMP 2342
+#define F_DATE_NE_TIMESTAMP 2343
+#define F_DATE_CMP_TIMESTAMP 2344
+#define F_DATE_LT_TIMESTAMPTZ 2351
+#define F_DATE_LE_TIMESTAMPTZ 2352
+#define F_DATE_EQ_TIMESTAMPTZ 2353
+#define F_DATE_GT_TIMESTAMPTZ 2354
+#define F_DATE_GE_TIMESTAMPTZ 2355
+#define F_DATE_NE_TIMESTAMPTZ 2356
+#define F_DATE_CMP_TIMESTAMPTZ 2357
+#define F_TIMESTAMP_LT_DATE 2364
+#define F_TIMESTAMP_LE_DATE 2365
+#define F_TIMESTAMP_EQ_DATE 2366
+#define F_TIMESTAMP_GT_DATE 2367
+#define F_TIMESTAMP_GE_DATE 2368
+#define F_TIMESTAMP_NE_DATE 2369
+#define F_TIMESTAMP_CMP_DATE 2370
+#define F_TIMESTAMPTZ_LT_DATE 2377
+#define F_TIMESTAMPTZ_LE_DATE 2378
+#define F_TIMESTAMPTZ_EQ_DATE 2379
+#define F_TIMESTAMPTZ_GT_DATE 2380
+#define F_TIMESTAMPTZ_GE_DATE 2381
+#define F_TIMESTAMPTZ_NE_DATE 2382
+#define F_TIMESTAMPTZ_CMP_DATE 2383
+#define F_HAS_TABLESPACE_PRIVILEGE_NAME_NAME 2390
+#define F_HAS_TABLESPACE_PRIVILEGE_NAME_ID 2391
+#define F_HAS_TABLESPACE_PRIVILEGE_ID_NAME 2392
+#define F_HAS_TABLESPACE_PRIVILEGE_ID_ID 2393
+#define F_HAS_TABLESPACE_PRIVILEGE_NAME 2394
+#define F_HAS_TABLESPACE_PRIVILEGE_ID 2395
+#define F_SHELL_IN 2398
+#define F_SHELL_OUT 2399
+#define F_ARRAY_RECV 2400
+#define F_ARRAY_SEND 2401
+#define F_RECORD_RECV 2402
+#define F_RECORD_SEND 2403
+#define F_INT2RECV 2404
+#define F_INT2SEND 2405
+#define F_INT4RECV 2406
+#define F_INT4SEND 2407
+#define F_INT8RECV 2408
+#define F_INT8SEND 2409
+#define F_INT2VECTORRECV 2410
+#define F_INT2VECTORSEND 2411
+#define F_BYTEARECV 2412
+#define F_BYTEASEND 2413
+#define F_TEXTRECV 2414
+#define F_TEXTSEND 2415
+#define F_UNKNOWNRECV 2416
+#define F_UNKNOWNSEND 2417
+#define F_OIDRECV 2418
+#define F_OIDSEND 2419
+#define F_OIDVECTORRECV 2420
+#define F_OIDVECTORSEND 2421
+#define F_NAMERECV 2422
+#define F_NAMESEND 2423
+#define F_FLOAT4RECV 2424
+#define F_FLOAT4SEND 2425
+#define F_FLOAT8RECV 2426
+#define F_FLOAT8SEND 2427
+#define F_POINT_RECV 2428
+#define F_POINT_SEND 2429
+#define F_BPCHARRECV 2430
+#define F_BPCHARSEND 2431
+#define F_VARCHARRECV 2432
+#define F_VARCHARSEND 2433
+#define F_CHARRECV 2434
+#define F_CHARSEND 2435
+#define F_BOOLRECV 2436
+#define F_BOOLSEND 2437
+#define F_TIDRECV 2438
+#define F_TIDSEND 2439
+#define F_XIDRECV 2440
+#define F_XIDSEND 2441
+#define F_CIDRECV 2442
+#define F_CIDSEND 2443
+#define F_REGPROCRECV 2444
+#define F_REGPROCSEND 2445
+#define F_REGPROCEDURERECV 2446
+#define F_REGPROCEDURESEND 2447
+#define F_REGOPERRECV 2448
+#define F_REGOPERSEND 2449
+#define F_REGOPERATORRECV 2450
+#define F_REGOPERATORSEND 2451
+#define F_REGCLASSRECV 2452
+#define F_REGCLASSSEND 2453
+#define F_REGTYPERECV 2454
+#define F_REGTYPESEND 2455
+#define F_BIT_RECV 2456
+#define F_BIT_SEND 2457
+#define F_VARBIT_RECV 2458
+#define F_VARBIT_SEND 2459
+#define F_NUMERIC_RECV 2460
+#define F_NUMERIC_SEND 2461
+#define F_ABSTIMERECV 2462
+#define F_ABSTIMESEND 2463
+#define F_RELTIMERECV 2464
+#define F_RELTIMESEND 2465
+#define F_TINTERVALRECV 2466
+#define F_TINTERVALSEND 2467
+#define F_DATE_RECV 2468
+#define F_DATE_SEND 2469
+#define F_TIME_RECV 2470
+#define F_TIME_SEND 2471
+#define F_TIMETZ_RECV 2472
+#define F_TIMETZ_SEND 2473
+#define F_TIMESTAMP_RECV 2474
+#define F_TIMESTAMP_SEND 2475
+#define F_TIMESTAMPTZ_RECV 2476
+#define F_TIMESTAMPTZ_SEND 2477
+#define F_INTERVAL_RECV 2478
+#define F_INTERVAL_SEND 2479
+#define F_LSEG_RECV 2480
+#define F_LSEG_SEND 2481
+#define F_PATH_RECV 2482
+#define F_PATH_SEND 2483
+#define F_BOX_RECV 2484
+#define F_BOX_SEND 2485
+#define F_POLY_RECV 2486
+#define F_POLY_SEND 2487
+#define F_LINE_RECV 2488
+#define F_LINE_SEND 2489
+#define F_CIRCLE_RECV 2490
+#define F_CIRCLE_SEND 2491
+#define F_CASH_RECV 2492
+#define F_CASH_SEND 2493
+#define F_MACADDR_RECV 2494
+#define F_MACADDR_SEND 2495
+#define F_INET_RECV 2496
+#define F_INET_SEND 2497
+#define F_CIDR_RECV 2498
+#define F_CIDR_SEND 2499
+#define F_CSTRING_RECV 2500
+#define F_CSTRING_SEND 2501
+#define F_ANYARRAY_RECV 2502
+#define F_ANYARRAY_SEND 2503
+#define F_PG_GET_RULEDEF_EXT 2504
+#define F_PG_GET_VIEWDEF_NAME_EXT 2505
+#define F_PG_GET_VIEWDEF_EXT 2506
+#define F_PG_GET_INDEXDEF_EXT 2507
+#define F_PG_GET_CONSTRAINTDEF_EXT 2508
+#define F_PG_GET_EXPR_EXT 2509
+#define F_PG_PREPARED_STATEMENT 2510
+#define F_PG_CURSOR 2511
+#define F_FLOAT8_VAR_POP 2512
+#define F_FLOAT8_STDDEV_POP 2513
+#define F_NUMERIC_VAR_POP 2514
+#define F_BOOLAND_STATEFUNC 2515
+#define F_BOOLOR_STATEFUNC 2516
+#define F_TIMESTAMP_LT_TIMESTAMPTZ 2520
+#define F_TIMESTAMP_LE_TIMESTAMPTZ 2521
+#define F_TIMESTAMP_EQ_TIMESTAMPTZ 2522
+#define F_TIMESTAMP_GT_TIMESTAMPTZ 2523
+#define F_TIMESTAMP_GE_TIMESTAMPTZ 2524
+#define F_TIMESTAMP_NE_TIMESTAMPTZ 2525
+#define F_TIMESTAMP_CMP_TIMESTAMPTZ 2526
+#define F_TIMESTAMPTZ_LT_TIMESTAMP 2527
+#define F_TIMESTAMPTZ_LE_TIMESTAMP 2528
+#define F_TIMESTAMPTZ_EQ_TIMESTAMP 2529
+#define F_TIMESTAMPTZ_GT_TIMESTAMP 2530
+#define F_TIMESTAMPTZ_GE_TIMESTAMP 2531
+#define F_TIMESTAMPTZ_NE_TIMESTAMP 2532
+#define F_TIMESTAMPTZ_CMP_TIMESTAMP 2533
+#define F_PG_TABLESPACE_DATABASES 2556
+#define F_INT4_BOOL 2557
+#define F_BOOL_INT4 2558
+#define F_LASTVAL 2559
+#define F_PG_POSTMASTER_START_TIME 2560
+#define F_GISTVACUUMCLEANUP 2561
+#define F_BOX_BELOW 2562
+#define F_BOX_OVERBELOW 2563
+#define F_BOX_OVERABOVE 2564
+#define F_BOX_ABOVE 2565
+#define F_POLY_BELOW 2566
+#define F_POLY_OVERBELOW 2567
+#define F_POLY_OVERABOVE 2568
+#define F_POLY_ABOVE 2569
+#define F_GIST_BOX_CONSISTENT 2578
+#define F_GIST_BOX_COMPRESS 2579
+#define F_GIST_BOX_DECOMPRESS 2580
+#define F_GIST_BOX_PENALTY 2581
+#define F_GIST_BOX_PICKSPLIT 2582
+#define F_GIST_BOX_UNION 2583
+#define F_GIST_BOX_SAME 2584
+#define F_GIST_POLY_CONSISTENT 2585
+#define F_GIST_POLY_COMPRESS 2586
+#define F_CIRCLE_OVERBELOW 2587
+#define F_CIRCLE_OVERABOVE 2588
+#define F_GIST_CIRCLE_CONSISTENT 2591
+#define F_GIST_CIRCLE_COMPRESS 2592
+#define F_NUMERIC_STDDEV_POP 2596
+#define F_DOMAIN_IN 2597
+#define F_DOMAIN_RECV 2598
+#define F_PG_TIMEZONE_ABBREVS 2599
+#define F_XMLEXISTS 2614
+#define F_PG_RELOAD_CONF 2621
+#define F_PG_ROTATE_LOGFILE 2622
+#define F_PG_STAT_FILE_1ARG 2623
+#define F_PG_READ_FILE_OFF_LEN 2624
+#define F_PG_LS_DIR_1ARG 2625
+#define F_PG_SLEEP 2626
+#define F_INETNOT 2627
+#define F_INETAND 2628
+#define F_INETOR 2629
+#define F_INETPL 2630
+#define F_INETMI_INT8 2632
+#define F_INETMI 2633
+#define F_STATEMENT_TIMESTAMP 2648
+#define F_CLOCK_TIMESTAMP 2649
+#define F_GIN_CMP_PREFIX 2700
+#define F_PG_HAS_ROLE_NAME_NAME 2705
+#define F_PG_HAS_ROLE_NAME_ID 2706
+#define F_PG_HAS_ROLE_ID_NAME 2707
+#define F_PG_HAS_ROLE_ID_ID 2708
+#define F_PG_HAS_ROLE_NAME 2709
+#define F_PG_HAS_ROLE_ID 2710
+#define F_INTERVAL_JUSTIFY_INTERVAL 2711
+#define F_PG_GET_TRIGGERDEF_EXT 2730
+#define F_GINGETBITMAP 2731
+#define F_GININSERT 2732
+#define F_GINBEGINSCAN 2733
+#define F_GINRESCAN 2734
+#define F_GINENDSCAN 2735
+#define F_GINMARKPOS 2736
+#define F_GINRESTRPOS 2737
+#define F_GINBUILD 2738
+#define F_GINBULKDELETE 2739
+#define F_GINVACUUMCLEANUP 2740
+#define F_GINCOSTESTIMATE 2741
+#define F_GINARRAYEXTRACT 2743
+#define F_GINARRAYCONSISTENT 2744
+#define F_INT8_AVG_ACCUM 2746
+#define F_ARRAYOVERLAP 2747
+#define F_ARRAYCONTAINS 2748
+#define F_ARRAYCONTAINED 2749
+#define F_PG_STAT_GET_DB_TUPLES_RETURNED 2758
+#define F_PG_STAT_GET_DB_TUPLES_FETCHED 2759
+#define F_PG_STAT_GET_DB_TUPLES_INSERTED 2760
+#define F_PG_STAT_GET_DB_TUPLES_UPDATED 2761
+#define F_PG_STAT_GET_DB_TUPLES_DELETED 2762
+#define F_REGEXP_MATCHES_NO_FLAGS 2763
+#define F_REGEXP_MATCHES 2764
+#define F_REGEXP_SPLIT_TO_TABLE_NO_FLAGS 2765
+#define F_REGEXP_SPLIT_TO_TABLE 2766
+#define F_REGEXP_SPLIT_TO_ARRAY_NO_FLAGS 2767
+#define F_REGEXP_SPLIT_TO_ARRAY 2768
+#define F_PG_STAT_GET_BGWRITER_TIMED_CHECKPOINTS 2769
+#define F_PG_STAT_GET_BGWRITER_REQUESTED_CHECKPOINTS 2770
+#define F_PG_STAT_GET_BGWRITER_BUF_WRITTEN_CHECKPOINTS 2771
+#define F_PG_STAT_GET_BGWRITER_BUF_WRITTEN_CLEAN 2772
+#define F_PG_STAT_GET_BGWRITER_MAXWRITTEN_CLEAN 2773
+#define F_GINQUERYARRAYEXTRACT 2774
+#define F_PG_STAT_GET_BUF_WRITTEN_BACKEND 2775
+#define F_ANYNONARRAY_IN 2777
+#define F_ANYNONARRAY_OUT 2778
+#define F_PG_STAT_GET_LAST_VACUUM_TIME 2781
+#define F_PG_STAT_GET_LAST_AUTOVACUUM_TIME 2782
+#define F_PG_STAT_GET_LAST_ANALYZE_TIME 2783
+#define F_PG_STAT_GET_LAST_AUTOANALYZE_TIME 2784
+#define F_BTOPTIONS 2785
+#define F_HASHOPTIONS 2786
+#define F_GISTOPTIONS 2787
+#define F_GINOPTIONS 2788
+#define F_TIDGT 2790
+#define F_TIDLT 2791
+#define F_TIDGE 2792
+#define F_TIDLE 2793
+#define F_BTTIDCMP 2794
+#define F_TIDLARGER 2795
+#define F_TIDSMALLER 2796
+#define F_INT8INC_ANY 2804
+#define F_INT8INC_FLOAT8_FLOAT8 2805
+#define F_FLOAT8_REGR_ACCUM 2806
+#define F_FLOAT8_REGR_SXX 2807
+#define F_FLOAT8_REGR_SYY 2808
+#define F_FLOAT8_REGR_SXY 2809
+#define F_FLOAT8_REGR_AVGX 2810
+#define F_FLOAT8_REGR_AVGY 2811
+#define F_FLOAT8_REGR_R2 2812
+#define F_FLOAT8_REGR_SLOPE 2813
+#define F_FLOAT8_REGR_INTERCEPT 2814
+#define F_FLOAT8_COVAR_POP 2815
+#define F_FLOAT8_COVAR_SAMP 2816
+#define F_FLOAT8_CORR 2817
+#define F_PG_STAT_GET_DB_BLK_READ_TIME 2844
+#define F_PG_STAT_GET_DB_BLK_WRITE_TIME 2845
+#define F_PG_SWITCH_XLOG 2848
+#define F_PG_CURRENT_XLOG_LOCATION 2849
+#define F_PG_XLOGFILE_NAME_OFFSET 2850
+#define F_PG_XLOGFILE_NAME 2851
+#define F_PG_CURRENT_XLOG_INSERT_LOCATION 2852
+#define F_PG_STAT_GET_BACKEND_WAITING 2853
+#define F_PG_MY_TEMP_SCHEMA 2854
+#define F_PG_IS_OTHER_TEMP_SCHEMA 2855
+#define F_PG_TIMEZONE_NAMES 2856
+#define F_PG_STAT_GET_BACKEND_XACT_START 2857
+#define F_NUMERIC_AVG_ACCUM 2858
+#define F_PG_STAT_GET_BUF_ALLOC 2859
+#define F_PG_STAT_GET_LIVE_TUPLES 2878
+#define F_PG_STAT_GET_DEAD_TUPLES 2879
+#define F_PG_ADVISORY_LOCK_INT8 2880
+#define F_PG_ADVISORY_LOCK_SHARED_INT8 2881
+#define F_PG_TRY_ADVISORY_LOCK_INT8 2882
+#define F_PG_TRY_ADVISORY_LOCK_SHARED_INT8 2883
+#define F_PG_ADVISORY_UNLOCK_INT8 2884
+#define F_PG_ADVISORY_UNLOCK_SHARED_INT8 2885
+#define F_PG_ADVISORY_LOCK_INT4 2886
+#define F_PG_ADVISORY_LOCK_SHARED_INT4 2887
+#define F_PG_TRY_ADVISORY_LOCK_INT4 2888
+#define F_PG_TRY_ADVISORY_LOCK_SHARED_INT4 2889
+#define F_PG_ADVISORY_UNLOCK_INT4 2890
+#define F_PG_ADVISORY_UNLOCK_SHARED_INT4 2891
+#define F_PG_ADVISORY_UNLOCK_ALL 2892
+#define F_XML_IN 2893
+#define F_XML_OUT 2894
+#define F_XMLCOMMENT 2895
+#define F_TEXTTOXML 2896
+#define F_XMLVALIDATE 2897
+#define F_XML_RECV 2898
+#define F_XML_SEND 2899
+#define F_XMLCONCAT2 2900
+#define F_VARBITTYPMODIN 2902
+#define F_INTERVALTYPMODIN 2903
+#define F_INTERVALTYPMODOUT 2904
+#define F_TIMESTAMPTYPMODIN 2905
+#define F_TIMESTAMPTYPMODOUT 2906
+#define F_TIMESTAMPTZTYPMODIN 2907
+#define F_TIMESTAMPTZTYPMODOUT 2908
+#define F_TIMETYPMODIN 2909
+#define F_TIMETYPMODOUT 2910
+#define F_TIMETZTYPMODIN 2911
+#define F_TIMETZTYPMODOUT 2912
+#define F_BPCHARTYPMODIN 2913
+#define F_BPCHARTYPMODOUT 2914
+#define F_VARCHARTYPMODIN 2915
+#define F_VARCHARTYPMODOUT 2916
+#define F_NUMERICTYPMODIN 2917
+#define F_NUMERICTYPMODOUT 2918
+#define F_BITTYPMODIN 2919
+#define F_BITTYPMODOUT 2920
+#define F_VARBITTYPMODOUT 2921
+#define F_XMLTOTEXT 2922
+#define F_TABLE_TO_XML 2923
+#define F_QUERY_TO_XML 2924
+#define F_CURSOR_TO_XML 2925
+#define F_TABLE_TO_XMLSCHEMA 2926
+#define F_QUERY_TO_XMLSCHEMA 2927
+#define F_CURSOR_TO_XMLSCHEMA 2928
+#define F_TABLE_TO_XML_AND_XMLSCHEMA 2929
+#define F_QUERY_TO_XML_AND_XMLSCHEMA 2930
+#define F_XPATH 2931
+#define F_SCHEMA_TO_XML 2933
+#define F_SCHEMA_TO_XMLSCHEMA 2934
+#define F_SCHEMA_TO_XML_AND_XMLSCHEMA 2935
+#define F_DATABASE_TO_XML 2936
+#define F_DATABASE_TO_XMLSCHEMA 2937
+#define F_DATABASE_TO_XML_AND_XMLSCHEMA 2938
+#define F_TXID_SNAPSHOT_IN 2939
+#define F_TXID_SNAPSHOT_OUT 2940
+#define F_TXID_SNAPSHOT_RECV 2941
+#define F_TXID_SNAPSHOT_SEND 2942
+#define F_TXID_CURRENT 2943
+#define F_TXID_CURRENT_SNAPSHOT 2944
+#define F_TXID_SNAPSHOT_XMIN 2945
+#define F_TXID_SNAPSHOT_XMAX 2946
+#define F_TXID_SNAPSHOT_XIP 2947
+#define F_TXID_VISIBLE_IN_SNAPSHOT 2948
+#define F_UUID_IN 2952
+#define F_UUID_OUT 2953
+#define F_UUID_LT 2954
+#define F_UUID_LE 2955
+#define F_UUID_EQ 2956
+#define F_UUID_GE 2957
+#define F_UUID_GT 2958
+#define F_UUID_NE 2959
+#define F_UUID_CMP 2960
+#define F_UUID_RECV 2961
+#define F_UUID_SEND 2962
+#define F_UUID_HASH 2963
+#define F_BOOLTEXT 2971
+#define F_PG_STAT_GET_FUNCTION_CALLS 2978
+#define F_PG_STAT_GET_FUNCTION_TOTAL_TIME 2979
+#define F_PG_STAT_GET_FUNCTION_SELF_TIME 2980
+#define F_RECORD_EQ 2981
+#define F_RECORD_NE 2982
+#define F_RECORD_LT 2983
+#define F_RECORD_GT 2984
+#define F_RECORD_LE 2985
+#define F_RECORD_GE 2986
+#define F_BTRECORDCMP 2987
+#define F_PG_TABLE_SIZE 2997
+#define F_PG_INDEXES_SIZE 2998
+#define F_PG_RELATION_FILENODE 2999
+#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_NAME_NAME 3000
+#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_NAME_ID 3001
+#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_ID_NAME 3002
+#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_ID_ID 3003
+#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_NAME 3004
+#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_ID 3005
+#define F_HAS_SERVER_PRIVILEGE_NAME_NAME 3006
+#define F_HAS_SERVER_PRIVILEGE_NAME_ID 3007
+#define F_HAS_SERVER_PRIVILEGE_ID_NAME 3008
+#define F_HAS_SERVER_PRIVILEGE_ID_ID 3009
+#define F_HAS_SERVER_PRIVILEGE_NAME 3010
+#define F_HAS_SERVER_PRIVILEGE_ID 3011
+#define F_HAS_COLUMN_PRIVILEGE_NAME_NAME_NAME 3012
+#define F_HAS_COLUMN_PRIVILEGE_NAME_NAME_ATTNUM 3013
+#define F_HAS_COLUMN_PRIVILEGE_NAME_ID_NAME 3014
+#define F_HAS_COLUMN_PRIVILEGE_NAME_ID_ATTNUM 3015
+#define F_HAS_COLUMN_PRIVILEGE_ID_NAME_NAME 3016
+#define F_HAS_COLUMN_PRIVILEGE_ID_NAME_ATTNUM 3017
+#define F_HAS_COLUMN_PRIVILEGE_ID_ID_NAME 3018
+#define F_HAS_COLUMN_PRIVILEGE_ID_ID_ATTNUM 3019
+#define F_HAS_COLUMN_PRIVILEGE_NAME_NAME 3020
+#define F_HAS_COLUMN_PRIVILEGE_NAME_ATTNUM 3021
+#define F_HAS_COLUMN_PRIVILEGE_ID_NAME 3022
+#define F_HAS_COLUMN_PRIVILEGE_ID_ATTNUM 3023
+#define F_HAS_ANY_COLUMN_PRIVILEGE_NAME_NAME 3024
+#define F_HAS_ANY_COLUMN_PRIVILEGE_NAME_ID 3025
+#define F_HAS_ANY_COLUMN_PRIVILEGE_ID_NAME 3026
+#define F_HAS_ANY_COLUMN_PRIVILEGE_ID_ID 3027
+#define F_HAS_ANY_COLUMN_PRIVILEGE_NAME 3028
+#define F_HAS_ANY_COLUMN_PRIVILEGE_ID 3029
+#define F_BITOVERLAY 3030
+#define F_BITOVERLAY_NO_LEN 3031
+#define F_BITGETBIT 3032
+#define F_BITSETBIT 3033
+#define F_PG_RELATION_FILEPATH 3034
+#define F_PG_LISTENING_CHANNELS 3035
+#define F_PG_NOTIFY 3036
+#define F_PG_STAT_GET_XACT_NUMSCANS 3037
+#define F_PG_STAT_GET_XACT_TUPLES_RETURNED 3038
+#define F_PG_STAT_GET_XACT_TUPLES_FETCHED 3039
+#define F_PG_STAT_GET_XACT_TUPLES_INSERTED 3040
+#define F_PG_STAT_GET_XACT_TUPLES_UPDATED 3041
+#define F_PG_STAT_GET_XACT_TUPLES_DELETED 3042
+#define F_PG_STAT_GET_XACT_TUPLES_HOT_UPDATED 3043
+#define F_PG_STAT_GET_XACT_BLOCKS_FETCHED 3044
+#define F_PG_STAT_GET_XACT_BLOCKS_HIT 3045
+#define F_PG_STAT_GET_XACT_FUNCTION_CALLS 3046
+#define F_PG_STAT_GET_XACT_FUNCTION_TOTAL_TIME 3047
+#define F_PG_STAT_GET_XACT_FUNCTION_SELF_TIME 3048
+#define F_XPATH_EXISTS 3049
+#define F_XML_IS_WELL_FORMED 3051
+#define F_XML_IS_WELL_FORMED_DOCUMENT 3052
+#define F_XML_IS_WELL_FORMED_CONTENT 3053
+#define F_PG_STAT_GET_VACUUM_COUNT 3054
+#define F_PG_STAT_GET_AUTOVACUUM_COUNT 3055
+#define F_PG_STAT_GET_ANALYZE_COUNT 3056
+#define F_PG_STAT_GET_AUTOANALYZE_COUNT 3057
+#define F_TEXT_CONCAT 3058
+#define F_TEXT_CONCAT_WS 3059
+#define F_TEXT_LEFT 3060
+#define F_TEXT_RIGHT 3061
+#define F_TEXT_REVERSE 3062
+#define F_PG_STAT_GET_BUF_FSYNC_BACKEND 3063
+#define F_GIST_POINT_DISTANCE 3064
+#define F_PG_STAT_GET_DB_CONFLICT_TABLESPACE 3065
+#define F_PG_STAT_GET_DB_CONFLICT_LOCK 3066
+#define F_PG_STAT_GET_DB_CONFLICT_SNAPSHOT 3067
+#define F_PG_STAT_GET_DB_CONFLICT_BUFFERPIN 3068
+#define F_PG_STAT_GET_DB_CONFLICT_STARTUP_DEADLOCK 3069
+#define F_PG_STAT_GET_DB_CONFLICT_ALL 3070
+#define F_PG_XLOG_REPLAY_PAUSE 3071
+#define F_PG_XLOG_REPLAY_RESUME 3072
+#define F_PG_IS_XLOG_REPLAY_PAUSED 3073
+#define F_PG_STAT_GET_DB_STAT_RESET_TIME 3074
+#define F_PG_STAT_GET_BGWRITER_STAT_RESET_TIME 3075
+#define F_GINARRAYEXTRACT_2ARGS 3076
+#define F_GIN_EXTRACT_TSVECTOR_2ARGS 3077
+#define F_PG_SEQUENCE_PARAMETERS 3078
+#define F_PG_AVAILABLE_EXTENSIONS 3082
+#define F_PG_AVAILABLE_EXTENSION_VERSIONS 3083
+#define F_PG_EXTENSION_UPDATE_PATHS 3084
+#define F_PG_EXTENSION_CONFIG_DUMP 3086
+#define F_GIN_EXTRACT_TSQUERY_5ARGS 3087
+#define F_GIN_TSQUERY_CONSISTENT_6ARGS 3088
+#define F_PG_ADVISORY_XACT_LOCK_INT8 3089
+#define F_PG_ADVISORY_XACT_LOCK_SHARED_INT8 3090
+#define F_PG_TRY_ADVISORY_XACT_LOCK_INT8 3091
+#define F_PG_TRY_ADVISORY_XACT_LOCK_SHARED_INT8 3092
+#define F_PG_ADVISORY_XACT_LOCK_INT4 3093
+#define F_PG_ADVISORY_XACT_LOCK_SHARED_INT4 3094
+#define F_PG_TRY_ADVISORY_XACT_LOCK_INT4 3095
+#define F_PG_TRY_ADVISORY_XACT_LOCK_SHARED_INT4 3096
+#define F_VARCHAR_TRANSFORM 3097
+#define F_PG_CREATE_RESTORE_POINT 3098
+#define F_PG_STAT_GET_WAL_SENDERS 3099
+#define F_WINDOW_ROW_NUMBER 3100
+#define F_WINDOW_RANK 3101
+#define F_WINDOW_DENSE_RANK 3102
+#define F_WINDOW_PERCENT_RANK 3103
+#define F_WINDOW_CUME_DIST 3104
+#define F_WINDOW_NTILE 3105
+#define F_WINDOW_LAG 3106
+#define F_WINDOW_LAG_WITH_OFFSET 3107
+#define F_WINDOW_LAG_WITH_OFFSET_AND_DEFAULT 3108
+#define F_WINDOW_LEAD 3109
+#define F_WINDOW_LEAD_WITH_OFFSET 3110
+#define F_WINDOW_LEAD_WITH_OFFSET_AND_DEFAULT 3111
+#define F_WINDOW_FIRST_VALUE 3112
+#define F_WINDOW_LAST_VALUE 3113
+#define F_WINDOW_NTH_VALUE 3114
+#define F_FDW_HANDLER_IN 3116
+#define F_FDW_HANDLER_OUT 3117
+#define F_VOID_RECV 3120
+#define F_VOID_SEND 3121
+#define F_BTINT2SORTSUPPORT 3129
+#define F_BTINT4SORTSUPPORT 3130
+#define F_BTINT8SORTSUPPORT 3131
+#define F_BTFLOAT4SORTSUPPORT 3132
+#define F_BTFLOAT8SORTSUPPORT 3133
+#define F_BTOIDSORTSUPPORT 3134
+#define F_BTNAMESORTSUPPORT 3135
+#define F_DATE_SORTSUPPORT 3136
+#define F_TIMESTAMP_SORTSUPPORT 3137
+#define F_HAS_TYPE_PRIVILEGE_NAME_NAME 3138
+#define F_HAS_TYPE_PRIVILEGE_NAME_ID 3139
+#define F_HAS_TYPE_PRIVILEGE_ID_NAME 3140
+#define F_HAS_TYPE_PRIVILEGE_ID_ID 3141
+#define F_HAS_TYPE_PRIVILEGE_NAME 3142
+#define F_HAS_TYPE_PRIVILEGE_ID 3143
+#define F_MACADDR_NOT 3144
+#define F_MACADDR_AND 3145
+#define F_MACADDR_OR 3146
+#define F_PG_STAT_GET_DB_TEMP_FILES 3150
+#define F_PG_STAT_GET_DB_TEMP_BYTES 3151
+#define F_PG_STAT_GET_DB_DEADLOCKS 3152
+#define F_ARRAY_TO_JSON 3153
+#define F_ARRAY_TO_JSON_PRETTY 3154
+#define F_ROW_TO_JSON 3155
+#define F_ROW_TO_JSON_PRETTY 3156
+#define F_NUMERIC_TRANSFORM 3157
+#define F_VARBIT_TRANSFORM 3158
+#define F_PG_GET_VIEWDEF_WRAP 3159
+#define F_PG_STAT_GET_CHECKPOINT_WRITE_TIME 3160
+#define F_PG_STAT_GET_CHECKPOINT_SYNC_TIME 3161
+#define F_PG_COLLATION_FOR 3162
+#define F_PG_TRIGGER_DEPTH 3163
+#define F_PG_XLOG_LOCATION_DIFF 3165
+#define F_PG_SIZE_PRETTY_NUMERIC 3166
+#define F_ARRAY_REMOVE 3167
+#define F_ARRAY_REPLACE 3168
+#define F_RANGESEL 3169
+#define F_LO_LSEEK64 3170
+#define F_LO_TELL64 3171
+#define F_LO_TRUNCATE64 3172
+#define F_JSON_AGG_TRANSFN 3173
+#define F_JSON_AGG_FINALFN 3174
+#define F_TO_JSON 3176
+#define F_PG_STAT_GET_MOD_SINCE_ANALYZE 3177
+#define F_NUMERIC_SUM 3178
+#define F_ARRAY_CARDINALITY 3179
+#define F_JSON_OBJECT_AGG_TRANSFN 3180
+#define F_RECORD_IMAGE_EQ 3181
+#define F_RECORD_IMAGE_NE 3182
+#define F_RECORD_IMAGE_LT 3183
+#define F_RECORD_IMAGE_GT 3184
+#define F_RECORD_IMAGE_LE 3185
+#define F_RECORD_IMAGE_GE 3186
+#define F_BTRECORDIMAGECMP 3187
+#define F_PG_STAT_GET_ARCHIVER 3195
+#define F_JSON_OBJECT_AGG_FINALFN 3196
+#define F_JSON_BUILD_ARRAY 3198
+#define F_JSON_BUILD_ARRAY_NOARGS 3199
+#define F_JSON_BUILD_OBJECT 3200
+#define F_JSON_BUILD_OBJECT_NOARGS 3201
+#define F_JSON_OBJECT 3202
+#define F_JSON_OBJECT_TWO_ARG 3203
+#define F_JSON_TO_RECORD 3204
+#define F_JSON_TO_RECORDSET 3205
+#define F_JSONB_ARRAY_LENGTH 3207
+#define F_JSONB_EACH 3208
+#define F_JSONB_POPULATE_RECORD 3209
+#define F_JSONB_TYPEOF 3210
+#define F_JSONB_OBJECT_FIELD_TEXT 3214
+#define F_JSONB_ARRAY_ELEMENT 3215
+#define F_JSONB_ARRAY_ELEMENT_TEXT 3216
+#define F_JSONB_EXTRACT_PATH 3217
+#define F_WIDTH_BUCKET_ARRAY 3218
+#define F_JSONB_ARRAY_ELEMENTS 3219
+#define F_PG_LSN_IN 3229
+#define F_PG_LSN_OUT 3230
+#define F_PG_LSN_LT 3231
+#define F_PG_LSN_LE 3232
+#define F_PG_LSN_EQ 3233
+#define F_PG_LSN_GE 3234
+#define F_PG_LSN_GT 3235
+#define F_PG_LSN_NE 3236
+#define F_PG_LSN_MI 3237
+#define F_PG_LSN_RECV 3238
+#define F_PG_LSN_SEND 3239
+#define F_PG_LSN_CMP 3251
+#define F_PG_LSN_HASH 3252
+#define F_BTTEXTSORTSUPPORT 3255
+#define F_GENERATE_SERIES_STEP_NUMERIC 3259
+#define F_GENERATE_SERIES_NUMERIC 3260
+#define F_JSON_STRIP_NULLS 3261
+#define F_JSONB_STRIP_NULLS 3262
+#define F_JSONB_OBJECT 3263
+#define F_JSONB_OBJECT_TWO_ARG 3264
+#define F_JSONB_AGG_TRANSFN 3265
+#define F_JSONB_AGG_FINALFN 3266
+#define F_JSONB_OBJECT_AGG_TRANSFN 3268
+#define F_JSONB_OBJECT_AGG_FINALFN 3269
+#define F_JSONB_BUILD_ARRAY 3271
+#define F_JSONB_BUILD_ARRAY_NOARGS 3272
+#define F_JSONB_BUILD_OBJECT 3273
+#define F_JSONB_BUILD_OBJECT_NOARGS 3274
+#define F_DIST_PPOLY 3275
+#define F_ARRAY_POSITION 3277
+#define F_ARRAY_POSITION_START 3278
+#define F_ARRAY_POSITIONS 3279
+#define F_GISTCANRETURN 3280
+#define F_GIST_BOX_FETCH 3281
+#define F_GIST_POINT_FETCH 3282
+#define F_NUMERIC_SORTSUPPORT 3283
+#define F_GIST_BBOX_DISTANCE 3288
+#define F_DIST_CPOINT 3290
+#define F_DIST_POLYP 3292
+#define F_PG_READ_FILE 3293
+#define F_PG_READ_BINARY_FILE 3295
+#define F_PG_LS_DIR 3297
+#define F_ROW_SECURITY_ACTIVE 3298
+#define F_ROW_SECURITY_ACTIVE_NAME 3299
+#define F_JSONB_CONCAT 3301
+#define F_JSONB_DELETE 3302
+#define F_JSONB_DELETE_IDX 3303
+#define F_JSONB_DELETE_PATH 3304
+#define F_JSONB_SET 3305
+#define F_JSONB_PRETTY 3306
+#define F_PG_STAT_FILE 3307
+#define F_TSM_HANDLER_IN 3311
+#define F_TSM_HANDLER_OUT 3312
+#define F_TSM_BERNOULLI_HANDLER 3313
+#define F_TSM_SYSTEM_HANDLER 3314
+#define F_SHOW_ALL_FILE_SETTINGS 3329
+#define F_PG_IDENTIFY_OBJECT_AS_ADDRESS 3382
+#define F_BRIN_MINMAX_OPCINFO 3383
+#define F_BRIN_MINMAX_ADD_VALUE 3384
+#define F_BRIN_MINMAX_CONSISTENT 3385
+#define F_BRIN_MINMAX_UNION 3386
+#define F_INT8_AVG_ACCUM_INV 3387
+#define F_NUMERIC_POLY_SUM 3388
+#define F_NUMERIC_POLY_AVG 3389
+#define F_NUMERIC_POLY_VAR_POP 3390
+#define F_NUMERIC_POLY_VAR_SAMP 3391
+#define F_NUMERIC_POLY_STDDEV_POP 3392
+#define F_NUMERIC_POLY_STDDEV_SAMP 3393
+#define F_PG_FILENODE_RELATION 3454
+#define F_LO_FROM_BYTEA 3457
+#define F_LO_GET 3458
+#define F_LO_GET_FRAGMENT 3459
+#define F_LO_PUT 3460
+#define F_MAKE_TIMESTAMP 3461
+#define F_MAKE_TIMESTAMPTZ 3462
+#define F_MAKE_TIMESTAMPTZ_AT_TIMEZONE 3463
+#define F_MAKE_INTERVAL 3464
+#define F_JSONB_ARRAY_ELEMENTS_TEXT 3465
+#define F_SPG_RANGE_QUAD_CONFIG 3469
+#define F_SPG_RANGE_QUAD_CHOOSE 3470
+#define F_SPG_RANGE_QUAD_PICKSPLIT 3471
+#define F_SPG_RANGE_QUAD_INNER_CONSISTENT 3472
+#define F_SPG_RANGE_QUAD_LEAF_CONSISTENT 3473
+#define F_JSONB_POPULATE_RECORDSET 3475
+#define F_TO_REGOPERATOR 3476
+#define F_JSONB_OBJECT_FIELD 3478
+#define F_TO_REGPROCEDURE 3479
+#define F_GIN_COMPARE_JSONB 3480
+#define F_GIN_EXTRACT_JSONB 3482
+#define F_GIN_EXTRACT_JSONB_QUERY 3483
+#define F_GIN_CONSISTENT_JSONB 3484
+#define F_GIN_EXTRACT_JSONB_PATH 3485
+#define F_GIN_EXTRACT_JSONB_QUERY_PATH 3486
+#define F_GIN_CONSISTENT_JSONB_PATH 3487
+#define F_GIN_TRICONSISTENT_JSONB 3488
+#define F_GIN_TRICONSISTENT_JSONB_PATH 3489
+#define F_JSONB_TO_RECORD 3490
+#define F_JSONB_TO_RECORDSET 3491
+#define F_TO_REGOPER 3492
+#define F_TO_REGTYPE 3493
+#define F_TO_REGPROC 3494
+#define F_TO_REGCLASS 3495
+#define F_BOOL_ACCUM 3496
+#define F_BOOL_ACCUM_INV 3497
+#define F_BOOL_ALLTRUE 3498
+#define F_BOOL_ANYTRUE 3499
+#define F_ANYENUM_IN 3504
+#define F_ANYENUM_OUT 3505
+#define F_ENUM_IN 3506
+#define F_ENUM_OUT 3507
+#define F_ENUM_EQ 3508
+#define F_ENUM_NE 3509
+#define F_ENUM_LT 3510
+#define F_ENUM_GT 3511
+#define F_ENUM_LE 3512
+#define F_ENUM_GE 3513
+#define F_ENUM_CMP 3514
+#define F_HASHENUM 3515
+#define F_ENUM_SMALLER 3524
+#define F_ENUM_LARGER 3525
+#define F_ENUM_FIRST 3528
+#define F_ENUM_LAST 3529
+#define F_ENUM_RANGE_BOUNDS 3530
+#define F_ENUM_RANGE_ALL 3531
+#define F_ENUM_RECV 3532
+#define F_ENUM_SEND 3533
+#define F_STRING_AGG_TRANSFN 3535
+#define F_STRING_AGG_FINALFN 3536
+#define F_PG_DESCRIBE_OBJECT 3537
+#define F_TEXT_FORMAT 3539
+#define F_TEXT_FORMAT_NV 3540
+#define F_BYTEA_STRING_AGG_TRANSFN 3543
+#define F_BYTEA_STRING_AGG_FINALFN 3544
+#define F_INT8DEC 3546
+#define F_INT8DEC_ANY 3547
+#define F_NUMERIC_ACCUM_INV 3548
+#define F_INTERVAL_ACCUM_INV 3549
+#define F_NETWORK_OVERLAP 3551
+#define F_INET_GIST_CONSISTENT 3553
+#define F_INET_GIST_UNION 3554
+#define F_INET_GIST_COMPRESS 3555
+#define F_INET_GIST_DECOMPRESS 3556
+#define F_INET_GIST_PENALTY 3557
+#define F_INET_GIST_PICKSPLIT 3558
+#define F_INET_GIST_SAME 3559
+#define F_NETWORKSEL 3560
+#define F_NETWORKJOINSEL 3561
+#define F_NETWORK_LARGER 3562
+#define F_NETWORK_SMALLER 3563
+#define F_PG_EVENT_TRIGGER_DROPPED_OBJECTS 3566
+#define F_INT2_ACCUM_INV 3567
+#define F_INT4_ACCUM_INV 3568
+#define F_INT8_ACCUM_INV 3569
+#define F_INT2_AVG_ACCUM_INV 3570
+#define F_INT4_AVG_ACCUM_INV 3571
+#define F_INT2INT4_SUM 3572
+#define F_INET_GIST_FETCH 3573
+#define F_PG_XACT_COMMIT_TIMESTAMP 3581
+#define F_BINARY_UPGRADE_SET_NEXT_PG_TYPE_OID 3582
+#define F_PG_LAST_COMMITTED_XACT 3583
+#define F_BINARY_UPGRADE_SET_NEXT_ARRAY_PG_TYPE_OID 3584
+#define F_BINARY_UPGRADE_SET_NEXT_TOAST_PG_TYPE_OID 3585
+#define F_BINARY_UPGRADE_SET_NEXT_HEAP_PG_CLASS_OID 3586
+#define F_BINARY_UPGRADE_SET_NEXT_INDEX_PG_CLASS_OID 3587
+#define F_BINARY_UPGRADE_SET_NEXT_TOAST_PG_CLASS_OID 3588
+#define F_BINARY_UPGRADE_SET_NEXT_PG_ENUM_OID 3589
+#define F_BINARY_UPGRADE_SET_NEXT_PG_AUTHID_OID 3590
+#define F_BINARY_UPGRADE_CREATE_EMPTY_EXTENSION 3591
+#define F_EVENT_TRIGGER_IN 3594
+#define F_EVENT_TRIGGER_OUT 3595
+#define F_TSVECTORIN 3610
+#define F_TSVECTOROUT 3611
+#define F_TSQUERYIN 3612
+#define F_TSQUERYOUT 3613
+#define F_TSVECTOR_LT 3616
+#define F_TSVECTOR_LE 3617
+#define F_TSVECTOR_EQ 3618
+#define F_TSVECTOR_NE 3619
+#define F_TSVECTOR_GE 3620
+#define F_TSVECTOR_GT 3621
+#define F_TSVECTOR_CMP 3622
+#define F_TSVECTOR_STRIP 3623
+#define F_TSVECTOR_SETWEIGHT 3624
+#define F_TSVECTOR_CONCAT 3625
+#define F_TS_MATCH_VQ 3634
+#define F_TS_MATCH_QV 3635
+#define F_TSVECTORSEND 3638
+#define F_TSVECTORRECV 3639
+#define F_TSQUERYSEND 3640
+#define F_TSQUERYRECV 3641
+#define F_GTSVECTORIN 3646
+#define F_GTSVECTOROUT 3647
+#define F_GTSVECTOR_COMPRESS 3648
+#define F_GTSVECTOR_DECOMPRESS 3649
+#define F_GTSVECTOR_PICKSPLIT 3650
+#define F_GTSVECTOR_UNION 3651
+#define F_GTSVECTOR_SAME 3652
+#define F_GTSVECTOR_PENALTY 3653
+#define F_GTSVECTOR_CONSISTENT 3654
+#define F_GIN_EXTRACT_TSVECTOR 3656
+#define F_GIN_EXTRACT_TSQUERY 3657
+#define F_GIN_TSQUERY_CONSISTENT 3658
+#define F_TSQUERY_LT 3662
+#define F_TSQUERY_LE 3663
+#define F_TSQUERY_EQ 3664
+#define F_TSQUERY_NE 3665
+#define F_TSQUERY_GE 3666
+#define F_TSQUERY_GT 3667
+#define F_TSQUERY_CMP 3668
+#define F_TSQUERY_AND 3669
+#define F_TSQUERY_OR 3670
+#define F_TSQUERY_NOT 3671
+#define F_TSQUERY_NUMNODE 3672
+#define F_TSQUERYTREE 3673
+#define F_TSQUERY_REWRITE 3684
+#define F_TSQUERY_REWRITE_QUERY 3685
+#define F_TSMATCHSEL 3686
+#define F_TSMATCHJOINSEL 3687
+#define F_TS_TYPANALYZE 3688
+#define F_TS_STAT1 3689
+#define F_TS_STAT2 3690
+#define F_TSQ_MCONTAINS 3691
+#define F_TSQ_MCONTAINED 3692
+#define F_GTSQUERY_COMPRESS 3695
+#define F_GTSQUERY_DECOMPRESS 3696
+#define F_GTSQUERY_PICKSPLIT 3697
+#define F_GTSQUERY_UNION 3698
+#define F_GTSQUERY_SAME 3699
+#define F_GTSQUERY_PENALTY 3700
+#define F_GTSQUERY_CONSISTENT 3701
+#define F_TS_RANK_WTTF 3703
+#define F_TS_RANK_WTT 3704
+#define F_TS_RANK_TTF 3705
+#define F_TS_RANK_TT 3706
+#define F_TS_RANKCD_WTTF 3707
+#define F_TS_RANKCD_WTT 3708
+#define F_TS_RANKCD_TTF 3709
+#define F_TS_RANKCD_TT 3710
+#define F_TSVECTOR_LENGTH 3711
+#define F_TS_TOKEN_TYPE_BYID 3713
+#define F_TS_TOKEN_TYPE_BYNAME 3714
+#define F_TS_PARSE_BYID 3715
+#define F_TS_PARSE_BYNAME 3716
+#define F_PRSD_START 3717
+#define F_PRSD_NEXTTOKEN 3718
+#define F_PRSD_END 3719
+#define F_PRSD_HEADLINE 3720
+#define F_PRSD_LEXTYPE 3721
+#define F_TS_LEXIZE 3723
+#define F_GIN_CMP_TSLEXEME 3724
+#define F_DSIMPLE_INIT 3725
+#define F_DSIMPLE_LEXIZE 3726
+#define F_DSYNONYM_INIT 3728
+#define F_DSYNONYM_LEXIZE 3729
+#define F_DISPELL_INIT 3731
+#define F_DISPELL_LEXIZE 3732
+#define F_REGCONFIGIN 3736
+#define F_REGCONFIGOUT 3737
+#define F_REGCONFIGRECV 3738
+#define F_REGCONFIGSEND 3739
+#define F_THESAURUS_INIT 3740
+#define F_THESAURUS_LEXIZE 3741
+#define F_TS_HEADLINE_BYID_OPT 3743
+#define F_TS_HEADLINE_BYID 3744
+#define F_TO_TSVECTOR_BYID 3745
+#define F_TO_TSQUERY_BYID 3746
+#define F_PLAINTO_TSQUERY_BYID 3747
+#define F_TO_TSVECTOR 3749
+#define F_TO_TSQUERY 3750
+#define F_PLAINTO_TSQUERY 3751
+#define F_TSVECTOR_UPDATE_TRIGGER_BYID 3752
+#define F_TSVECTOR_UPDATE_TRIGGER_BYCOLUMN 3753
+#define F_TS_HEADLINE_OPT 3754
+#define F_TS_HEADLINE 3755
+#define F_PG_TS_PARSER_IS_VISIBLE 3756
+#define F_PG_TS_DICT_IS_VISIBLE 3757
+#define F_PG_TS_CONFIG_IS_VISIBLE 3758
+#define F_GET_CURRENT_TS_CONFIG 3759
+#define F_TS_MATCH_TT 3760
+#define F_TS_MATCH_TQ 3761
+#define F_PG_TS_TEMPLATE_IS_VISIBLE 3768
+#define F_REGDICTIONARYIN 3771
+#define F_REGDICTIONARYOUT 3772
+#define F_REGDICTIONARYRECV 3773
+#define F_REGDICTIONARYSEND 3774
+#define F_PG_STAT_RESET_SHARED 3775
+#define F_PG_STAT_RESET_SINGLE_TABLE_COUNTERS 3776
+#define F_PG_STAT_RESET_SINGLE_FUNCTION_COUNTERS 3777
+#define F_PG_TABLESPACE_LOCATION 3778
+#define F_PG_CREATE_PHYSICAL_REPLICATION_SLOT 3779
+#define F_PG_DROP_REPLICATION_SLOT 3780
+#define F_PG_GET_REPLICATION_SLOTS 3781
+#define F_PG_LOGICAL_SLOT_GET_CHANGES 3782
+#define F_PG_LOGICAL_SLOT_GET_BINARY_CHANGES 3783
+#define F_PG_LOGICAL_SLOT_PEEK_CHANGES 3784
+#define F_PG_LOGICAL_SLOT_PEEK_BINARY_CHANGES 3785
+#define F_PG_CREATE_LOGICAL_REPLICATION_SLOT 3786
+#define F_TO_JSONB 3787
+#define F_PG_STAT_GET_SNAPSHOT_TIMESTAMP 3788
+#define F_BRINGETBITMAP 3789
+#define F_BRININSERT 3790
+#define F_BRINBEGINSCAN 3791
+#define F_BRINRESCAN 3792
+#define F_BRINENDSCAN 3793
+#define F_BRINMARKPOS 3794
+#define F_BRINRESTRPOS 3795
+#define F_BRINBUILD 3796
+#define F_BRINBUILDEMPTY 3797
+#define F_BRINBULKDELETE 3798
+#define F_BRINVACUUMCLEANUP 3799
+#define F_BRINCOSTESTIMATE 3800
+#define F_BRINOPTIONS 3801
+#define F_JSONB_SEND 3803
+#define F_JSONB_OUT 3804
+#define F_JSONB_RECV 3805
+#define F_JSONB_IN 3806
+#define F_PG_GET_FUNCTION_ARG_DEFAULT 3808
+#define F_PG_EXPORT_SNAPSHOT 3809
+#define F_PG_IS_IN_RECOVERY 3810
+#define F_INT4_CASH 3811
+#define F_INT8_CASH 3812
+#define F_PG_IS_IN_BACKUP 3813
+#define F_PG_BACKUP_START_TIME 3814
+#define F_PG_COLLATION_IS_VISIBLE 3815
+#define F_ARRAY_TYPANALYZE 3816
+#define F_ARRAYCONTSEL 3817
+#define F_ARRAYCONTJOINSEL 3818
+#define F_PG_GET_MULTIXACT_MEMBERS 3819
+#define F_PG_LAST_XLOG_RECEIVE_LOCATION 3820
+#define F_PG_LAST_XLOG_REPLAY_LOCATION 3821
+#define F_CASH_DIV_CASH 3822
+#define F_CASH_NUMERIC 3823
+#define F_NUMERIC_CASH 3824
+#define F_PG_READ_FILE_ALL 3826
+#define F_PG_READ_BINARY_FILE_OFF_LEN 3827
+#define F_PG_READ_BINARY_FILE_ALL 3828
+#define F_PG_OPFAMILY_IS_VISIBLE 3829
+#define F_PG_LAST_XACT_REPLAY_TIMESTAMP 3830
+#define F_ANYRANGE_IN 3832
+#define F_ANYRANGE_OUT 3833
+#define F_RANGE_IN 3834
+#define F_RANGE_OUT 3835
+#define F_RANGE_RECV 3836
+#define F_RANGE_SEND 3837
+#define F_PG_IDENTIFY_OBJECT 3839
+#define F_RANGE_CONSTRUCTOR2 3840
+#define F_RANGE_CONSTRUCTOR3 3841
+#define F_PG_RELATION_IS_UPDATABLE 3842
+#define F_PG_COLUMN_IS_UPDATABLE 3843
+#define F_MAKE_DATE 3846
+#define F_MAKE_TIME 3847
+#define F_RANGE_LOWER 3848
+#define F_RANGE_UPPER 3849
+#define F_RANGE_EMPTY 3850
+#define F_RANGE_LOWER_INC 3851
+#define F_RANGE_UPPER_INC 3852
+#define F_RANGE_LOWER_INF 3853
+#define F_RANGE_UPPER_INF 3854
+#define F_RANGE_EQ 3855
+#define F_RANGE_NE 3856
+#define F_RANGE_OVERLAPS 3857
+#define F_RANGE_CONTAINS_ELEM 3858
+#define F_RANGE_CONTAINS 3859
+#define F_ELEM_CONTAINED_BY_RANGE 3860
+#define F_RANGE_CONTAINED_BY 3861
+#define F_RANGE_ADJACENT 3862
+#define F_RANGE_BEFORE 3863
+#define F_RANGE_AFTER 3864
+#define F_RANGE_OVERLEFT 3865
+#define F_RANGE_OVERRIGHT 3866
+#define F_RANGE_UNION 3867
+#define F_RANGE_INTERSECT 3868
+#define F_RANGE_MINUS 3869
+#define F_RANGE_CMP 3870
+#define F_RANGE_LT 3871
+#define F_RANGE_LE 3872
+#define F_RANGE_GE 3873
+#define F_RANGE_GT 3874
+#define F_RANGE_GIST_CONSISTENT 3875
+#define F_RANGE_GIST_UNION 3876
+#define F_RANGE_GIST_COMPRESS 3877
+#define F_RANGE_GIST_DECOMPRESS 3878
+#define F_RANGE_GIST_PENALTY 3879
+#define F_RANGE_GIST_PICKSPLIT 3880
+#define F_RANGE_GIST_SAME 3881
+#define F_HASH_RANGE 3902
+#define F_INT4RANGE_CANONICAL 3914
+#define F_DATERANGE_CANONICAL 3915
+#define F_RANGE_TYPANALYZE 3916
+#define F_TIMESTAMP_TRANSFORM 3917
+#define F_INTERVAL_TRANSFORM 3918
+#define F_GINARRAYTRICONSISTENT 3920
+#define F_GIN_TSQUERY_TRICONSISTENT 3921
+#define F_INT4RANGE_SUBDIFF 3922
+#define F_INT8RANGE_SUBDIFF 3923
+#define F_NUMRANGE_SUBDIFF 3924
+#define F_DATERANGE_SUBDIFF 3925
+#define F_INT8RANGE_CANONICAL 3928
+#define F_TSRANGE_SUBDIFF 3929
+#define F_TSTZRANGE_SUBDIFF 3930
+#define F_JSONB_OBJECT_KEYS 3931
+#define F_JSONB_EACH_TEXT 3932
+#define F_MXID_AGE 3939
+#define F_JSONB_EXTRACT_PATH_TEXT 3940
+#define F_ACLDEFAULT_SQL 3943
+#define F_TIME_TRANSFORM 3944
+#define F_JSON_OBJECT_FIELD 3947
+#define F_JSON_OBJECT_FIELD_TEXT 3948
+#define F_JSON_ARRAY_ELEMENT 3949
+#define F_JSON_ARRAY_ELEMENT_TEXT 3950
+#define F_JSON_EXTRACT_PATH 3951
+#define F_BRIN_SUMMARIZE_NEW_VALUES 3952
+#define F_JSON_EXTRACT_PATH_TEXT 3953
+#define F_PG_GET_OBJECT_ADDRESS 3954
+#define F_JSON_ARRAY_ELEMENTS 3955
+#define F_JSON_ARRAY_LENGTH 3956
+#define F_JSON_OBJECT_KEYS 3957
+#define F_JSON_EACH 3958
+#define F_JSON_EACH_TEXT 3959
+#define F_JSON_POPULATE_RECORD 3960
+#define F_JSON_POPULATE_RECORDSET 3961
+#define F_JSON_TYPEOF 3968
+#define F_JSON_ARRAY_ELEMENTS_TEXT 3969
+#define F_ORDERED_SET_TRANSITION 3970
+#define F_ORDERED_SET_TRANSITION_MULTI 3971
+#define F_PERCENTILE_DISC_FINAL 3973
+#define F_PERCENTILE_CONT_FLOAT8_FINAL 3975
+#define F_PERCENTILE_CONT_INTERVAL_FINAL 3977
+#define F_PERCENTILE_DISC_MULTI_FINAL 3979
+#define F_PERCENTILE_CONT_FLOAT8_MULTI_FINAL 3981
+#define F_PERCENTILE_CONT_INTERVAL_MULTI_FINAL 3983
+#define F_MODE_FINAL 3985
+#define F_HYPOTHETICAL_RANK_FINAL 3987
+#define F_HYPOTHETICAL_PERCENT_RANK_FINAL 3989
+#define F_HYPOTHETICAL_CUME_DIST_FINAL 3991
+#define F_HYPOTHETICAL_DENSE_RANK_FINAL 3993
+#define F_TIMESTAMP_IZONE_TRANSFORM 3994
+#define F_TIMESTAMP_ZONE_TRANSFORM 3995
+#define F_RANGE_GIST_FETCH 3996
+#define F_SPGGETTUPLE 4001
+#define F_SPGGETBITMAP 4002
+#define F_SPGINSERT 4003
+#define F_SPGBEGINSCAN 4004
+#define F_SPGRESCAN 4005
+#define F_SPGENDSCAN 4006
+#define F_SPGMARKPOS 4007
+#define F_SPGRESTRPOS 4008
+#define F_SPGBUILD 4009
+#define F_SPGBUILDEMPTY 4010
+#define F_SPGBULKDELETE 4011
+#define F_SPGVACUUMCLEANUP 4012
+#define F_SPGCOSTESTIMATE 4013
+#define F_SPGOPTIONS 4014
+#define F_SPG_QUAD_CONFIG 4018
+#define F_SPG_QUAD_CHOOSE 4019
+#define F_SPG_QUAD_PICKSPLIT 4020
+#define F_SPG_QUAD_INNER_CONSISTENT 4021
+#define F_SPG_QUAD_LEAF_CONSISTENT 4022
+#define F_SPG_KD_CONFIG 4023
+#define F_SPG_KD_CHOOSE 4024
+#define F_SPG_KD_PICKSPLIT 4025
+#define F_SPG_KD_INNER_CONSISTENT 4026
+#define F_SPG_TEXT_CONFIG 4027
+#define F_SPG_TEXT_CHOOSE 4028
+#define F_SPG_TEXT_PICKSPLIT 4029
+#define F_SPG_TEXT_INNER_CONSISTENT 4030
+#define F_SPG_TEXT_LEAF_CONSISTENT 4031
+#define F_SPGCANRETURN 4032
+#define F_JSONB_NE 4038
+#define F_JSONB_LT 4039
+#define F_JSONB_GT 4040
+#define F_JSONB_LE 4041
+#define F_JSONB_GE 4042
+#define F_JSONB_EQ 4043
+#define F_JSONB_CMP 4044
+#define F_JSONB_HASH 4045
+#define F_JSONB_CONTAINS 4046
+#define F_JSONB_EXISTS 4047
+#define F_JSONB_EXISTS_ANY 4048
+#define F_JSONB_EXISTS_ALL 4049
+#define F_JSONB_CONTAINED 4050
+#define F_ARRAY_AGG_ARRAY_TRANSFN 4051
+#define F_ARRAY_AGG_ARRAY_FINALFN 4052
+#define F_RANGE_MERGE 4057
+#define F_INET_MERGE 4063
+#define F_BOXES_BOUND_BOX 4067
+#define F_INET_SAME_FAMILY 4071
+#define F_REGNAMESPACEIN 4084
+#define F_REGNAMESPACEOUT 4085
+#define F_TO_REGNAMESPACE 4086
+#define F_REGNAMESPACERECV 4087
+#define F_REGNAMESPACESEND 4088
+#define F_POINT_BOX 4091
+#define F_REGROLEOUT 4092
+#define F_TO_REGROLE 4093
+#define F_REGROLERECV 4094
+#define F_REGROLESEND 4095
+#define F_REGROLEIN 4098
+#define F_BRIN_INCLUSION_OPCINFO 4105
+#define F_BRIN_INCLUSION_ADD_VALUE 4106
+#define F_BRIN_INCLUSION_CONSISTENT 4107
+#define F_BRIN_INCLUSION_UNION 4108
+#define F_PG_EVENT_TRIGGER_TABLE_REWRITE_OID 4566
+#define F_PG_EVENT_TRIGGER_TABLE_REWRITE_REASON 4567
+#define F_PG_EVENT_TRIGGER_DDL_COMMANDS 4568
+#define F_PG_REPLICATION_ORIGIN_CREATE 6003
+#define F_PG_REPLICATION_ORIGIN_DROP 6004
+#define F_PG_REPLICATION_ORIGIN_OID 6005
+#define F_PG_REPLICATION_ORIGIN_SESSION_SETUP 6006
+#define F_PG_REPLICATION_ORIGIN_SESSION_RESET 6007
+#define F_PG_REPLICATION_ORIGIN_SESSION_IS_SETUP 6008
+#define F_PG_REPLICATION_ORIGIN_SESSION_PROGRESS 6009
+#define F_PG_REPLICATION_ORIGIN_XACT_SETUP 6010
+#define F_PG_REPLICATION_ORIGIN_XACT_RESET 6011
+#define F_PG_REPLICATION_ORIGIN_ADVANCE 6012
+#define F_PG_REPLICATION_ORIGIN_PROGRESS 6013
+#define F_PG_SHOW_REPLICATION_ORIGIN_STATUS 6014
+
+#endif /* FMGROIDS_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/guc.h b/foreign/libpg_query/src/postgres/include/utils/guc.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/guc.h
@@ -0,0 +1,435 @@
+/*--------------------------------------------------------------------
+ * guc.h
+ *
+ * External declarations pertaining to backend/utils/misc/guc.c and
+ * backend/utils/misc/guc-file.l
+ *
+ * Copyright (c) 2000-2015, PostgreSQL Global Development Group
+ * Written by Peter Eisentraut <peter_e@gmx.net>.
+ *
+ * src/include/utils/guc.h
+ *--------------------------------------------------------------------
+ */
+#ifndef GUC_H
+#define GUC_H
+
+#include "nodes/parsenodes.h"
+#include "tcop/dest.h"
+#include "utils/array.h"
+
+
+/* upper limit for GUC variables measured in kilobytes of memory */
+/* note that various places assume the byte size fits in a "long" variable */
+#if SIZEOF_SIZE_T > 4 && SIZEOF_LONG > 4
+#define MAX_KILOBYTES	INT_MAX
+#else
+#define MAX_KILOBYTES	(INT_MAX / 1024)
+#endif
+
+/*
+ * Automatic configuration file name for ALTER SYSTEM.
+ * This file will be used to store values of configuration parameters
+ * set by ALTER SYSTEM command.
+ */
+#define PG_AUTOCONF_FILENAME		"postgresql.auto.conf"
+
+/*
+ * Certain options can only be set at certain times. The rules are
+ * like this:
+ *
+ * INTERNAL options cannot be set by the user at all, but only through
+ * internal processes ("server_version" is an example).  These are GUC
+ * variables only so they can be shown by SHOW, etc.
+ *
+ * POSTMASTER options can only be set when the postmaster starts,
+ * either from the configuration file or the command line.
+ *
+ * SIGHUP options can only be set at postmaster startup or by changing
+ * the configuration file and sending the HUP signal to the postmaster
+ * or a backend process. (Notice that the signal receipt will not be
+ * evaluated immediately. The postmaster and the backend check it at a
+ * certain point in their main loop. It's safer to wait than to read a
+ * file asynchronously.)
+ *
+ * BACKEND and SU_BACKEND options can only be set at postmaster startup,
+ * from the configuration file, or by client request in the connection
+ * startup packet (e.g., from libpq's PGOPTIONS variable).  SU_BACKEND
+ * options can be set from the startup packet only when the user is a
+ * superuser.  Furthermore, an already-started backend will ignore changes
+ * to such an option in the configuration file.  The idea is that these
+ * options are fixed for a given backend once it's started, but they can
+ * vary across backends.
+ *
+ * SUSET options can be set at postmaster startup, with the SIGHUP
+ * mechanism, or from the startup packet or SQL if you're a superuser.
+ *
+ * USERSET options can be set by anyone any time.
+ */
+typedef enum
+{
+	PGC_INTERNAL,
+	PGC_POSTMASTER,
+	PGC_SIGHUP,
+	PGC_SU_BACKEND,
+	PGC_BACKEND,
+	PGC_SUSET,
+	PGC_USERSET
+} GucContext;
+
+/*
+ * The following type records the source of the current setting.  A
+ * new setting can only take effect if the previous setting had the
+ * same or lower level.  (E.g, changing the config file doesn't
+ * override the postmaster command line.)  Tracking the source allows us
+ * to process sources in any convenient order without affecting results.
+ * Sources <= PGC_S_OVERRIDE will set the default used by RESET, as well
+ * as the current value.  Note that source == PGC_S_OVERRIDE should be
+ * used when setting a PGC_INTERNAL option.
+ *
+ * PGC_S_INTERACTIVE isn't actually a source value, but is the
+ * dividing line between "interactive" and "non-interactive" sources for
+ * error reporting purposes.
+ *
+ * PGC_S_TEST is used when testing values to be used later ("doit" will always
+ * be false, so this never gets stored as the actual source of any value).
+ * For example, ALTER DATABASE/ROLE tests proposed per-database or per-user
+ * defaults this way, and CREATE FUNCTION tests proposed function SET clauses
+ * this way.  This is an interactive case, but it needs its own source value
+ * because some assign hooks need to make different validity checks in this
+ * case.  In particular, references to nonexistent database objects generally
+ * shouldn't throw hard errors in this case, at most NOTICEs, since the
+ * objects might exist by the time the setting is used for real.
+ *
+ * NB: see GucSource_Names in guc.c if you change this.
+ */
+typedef enum
+{
+	PGC_S_DEFAULT,				/* hard-wired default ("boot_val") */
+	PGC_S_DYNAMIC_DEFAULT,		/* default computed during initialization */
+	PGC_S_ENV_VAR,				/* postmaster environment variable */
+	PGC_S_FILE,					/* postgresql.conf */
+	PGC_S_ARGV,					/* postmaster command line */
+	PGC_S_GLOBAL,				/* global in-database setting */
+	PGC_S_DATABASE,				/* per-database setting */
+	PGC_S_USER,					/* per-user setting */
+	PGC_S_DATABASE_USER,		/* per-user-and-database setting */
+	PGC_S_CLIENT,				/* from client connection request */
+	PGC_S_OVERRIDE,				/* special case to forcibly set default */
+	PGC_S_INTERACTIVE,			/* dividing line for error reporting */
+	PGC_S_TEST,					/* test per-database or per-user setting */
+	PGC_S_SESSION				/* SET command */
+} GucSource;
+
+/*
+ * Parsing the configuration file(s) will return a list of name-value pairs
+ * with source location info.  We also abuse this data structure to carry
+ * error reports about the config files.  An entry reporting an error will
+ * have errmsg != NULL, and might have NULLs for name, value, and/or filename.
+ *
+ * If "ignore" is true, don't attempt to apply the item (it might be an error
+ * report, or an item we determined to be duplicate).  "applied" is set true
+ * if we successfully applied, or could have applied, the setting.
+ */
+typedef struct ConfigVariable
+{
+	char	   *name;
+	char	   *value;
+	char	   *errmsg;
+	char	   *filename;
+	int			sourceline;
+	bool		ignore;
+	bool		applied;
+	struct ConfigVariable *next;
+} ConfigVariable;
+
+extern bool ParseConfigFile(const char *config_file, bool strict,
+				const char *calling_file, int calling_lineno,
+				int depth, int elevel,
+				ConfigVariable **head_p, ConfigVariable **tail_p);
+extern bool ParseConfigFp(FILE *fp, const char *config_file,
+			  int depth, int elevel,
+			  ConfigVariable **head_p, ConfigVariable **tail_p);
+extern bool ParseConfigDirectory(const char *includedir,
+					 const char *calling_file, int calling_lineno,
+					 int depth, int elevel,
+					 ConfigVariable **head_p,
+					 ConfigVariable **tail_p);
+extern void FreeConfigVariables(ConfigVariable *list);
+
+/*
+ * The possible values of an enum variable are specified by an array of
+ * name-value pairs.  The "hidden" flag means the value is accepted but
+ * won't be displayed when guc.c is asked for a list of acceptable values.
+ */
+struct config_enum_entry
+{
+	const char *name;
+	int			val;
+	bool		hidden;
+};
+
+/*
+ * Signatures for per-variable check/assign/show hook functions
+ */
+typedef bool (*GucBoolCheckHook) (bool *newval, void **extra, GucSource source);
+typedef bool (*GucIntCheckHook) (int *newval, void **extra, GucSource source);
+typedef bool (*GucRealCheckHook) (double *newval, void **extra, GucSource source);
+typedef bool (*GucStringCheckHook) (char **newval, void **extra, GucSource source);
+typedef bool (*GucEnumCheckHook) (int *newval, void **extra, GucSource source);
+
+typedef void (*GucBoolAssignHook) (bool newval, void *extra);
+typedef void (*GucIntAssignHook) (int newval, void *extra);
+typedef void (*GucRealAssignHook) (double newval, void *extra);
+typedef void (*GucStringAssignHook) (const char *newval, void *extra);
+typedef void (*GucEnumAssignHook) (int newval, void *extra);
+
+typedef const char *(*GucShowHook) (void);
+
+/*
+ * Miscellaneous
+ */
+typedef enum
+{
+	/* Types of set_config_option actions */
+	GUC_ACTION_SET,				/* regular SET command */
+	GUC_ACTION_LOCAL,			/* SET LOCAL command */
+	GUC_ACTION_SAVE				/* function SET option, or temp assignment */
+} GucAction;
+
+#define GUC_QUALIFIER_SEPARATOR '.'
+
+/*
+ * bit values in "flags" of a GUC variable
+ */
+#define GUC_LIST_INPUT			0x0001	/* input can be list format */
+#define GUC_LIST_QUOTE			0x0002	/* double-quote list elements */
+#define GUC_NO_SHOW_ALL			0x0004	/* exclude from SHOW ALL */
+#define GUC_NO_RESET_ALL		0x0008	/* exclude from RESET ALL */
+#define GUC_REPORT				0x0010	/* auto-report changes to client */
+#define GUC_NOT_IN_SAMPLE		0x0020	/* not in postgresql.conf.sample */
+#define GUC_DISALLOW_IN_FILE	0x0040	/* can't set in postgresql.conf */
+#define GUC_CUSTOM_PLACEHOLDER	0x0080	/* placeholder for custom variable */
+#define GUC_SUPERUSER_ONLY		0x0100	/* show only to superusers */
+#define GUC_IS_NAME				0x0200	/* limit string to NAMEDATALEN-1 */
+#define GUC_NOT_WHILE_SEC_REST	0x0400	/* can't set if security restricted */
+#define GUC_DISALLOW_IN_AUTO_FILE 0x0800		/* can't set in
+												 * PG_AUTOCONF_FILENAME */
+
+#define GUC_UNIT_KB				0x1000	/* value is in kilobytes */
+#define GUC_UNIT_BLOCKS			0x2000	/* value is in blocks */
+#define GUC_UNIT_XBLOCKS		0x3000	/* value is in xlog blocks */
+#define GUC_UNIT_XSEGS			0x4000	/* value is in xlog segments */
+#define GUC_UNIT_MEMORY			0xF000	/* mask for KB, BLOCKS, XBLOCKS */
+
+#define GUC_UNIT_MS			   0x10000	/* value is in milliseconds */
+#define GUC_UNIT_S			   0x20000	/* value is in seconds */
+#define GUC_UNIT_MIN		   0x30000	/* value is in minutes */
+#define GUC_UNIT_TIME		   0xF0000	/* mask for MS, S, MIN */
+
+#define GUC_UNIT				(GUC_UNIT_MEMORY | GUC_UNIT_TIME)
+
+
+/* GUC vars that are actually declared in guc.c, rather than elsewhere */
+extern bool log_duration;
+extern bool Debug_print_plan;
+extern bool Debug_print_parse;
+extern bool Debug_print_rewritten;
+extern bool Debug_pretty_print;
+
+extern bool log_parser_stats;
+extern bool log_planner_stats;
+extern bool log_executor_stats;
+extern bool log_statement_stats;
+extern bool log_btree_build_stats;
+
+extern PGDLLIMPORT __thread  bool check_function_bodies;
+extern bool default_with_oids;
+extern bool SQL_inheritance;
+
+extern int	log_min_error_statement;
+extern __thread  int log_min_messages;
+extern __thread  int client_min_messages;
+extern int	log_min_duration_statement;
+extern int	log_temp_files;
+
+extern int	temp_file_limit;
+
+extern int	num_temp_buffers;
+
+extern char *cluster_name;
+extern char *ConfigFileName;
+extern char *HbaFileName;
+extern char *IdentFileName;
+extern char *external_pid_file;
+
+extern char *application_name;
+
+extern int	tcp_keepalives_idle;
+extern int	tcp_keepalives_interval;
+extern int	tcp_keepalives_count;
+
+#ifdef TRACE_SORT
+extern bool trace_sort;
+#endif
+
+/*
+ * Functions exported by guc.c
+ */
+extern void SetConfigOption(const char *name, const char *value,
+				GucContext context, GucSource source);
+
+extern void DefineCustomBoolVariable(
+						 const char *name,
+						 const char *short_desc,
+						 const char *long_desc,
+						 bool *valueAddr,
+						 bool bootValue,
+						 GucContext context,
+						 int flags,
+						 GucBoolCheckHook check_hook,
+						 GucBoolAssignHook assign_hook,
+						 GucShowHook show_hook);
+
+extern void DefineCustomIntVariable(
+						const char *name,
+						const char *short_desc,
+						const char *long_desc,
+						int *valueAddr,
+						int bootValue,
+						int minValue,
+						int maxValue,
+						GucContext context,
+						int flags,
+						GucIntCheckHook check_hook,
+						GucIntAssignHook assign_hook,
+						GucShowHook show_hook);
+
+extern void DefineCustomRealVariable(
+						 const char *name,
+						 const char *short_desc,
+						 const char *long_desc,
+						 double *valueAddr,
+						 double bootValue,
+						 double minValue,
+						 double maxValue,
+						 GucContext context,
+						 int flags,
+						 GucRealCheckHook check_hook,
+						 GucRealAssignHook assign_hook,
+						 GucShowHook show_hook);
+
+extern void DefineCustomStringVariable(
+						   const char *name,
+						   const char *short_desc,
+						   const char *long_desc,
+						   char **valueAddr,
+						   const char *bootValue,
+						   GucContext context,
+						   int flags,
+						   GucStringCheckHook check_hook,
+						   GucStringAssignHook assign_hook,
+						   GucShowHook show_hook);
+
+extern void DefineCustomEnumVariable(
+						 const char *name,
+						 const char *short_desc,
+						 const char *long_desc,
+						 int *valueAddr,
+						 int bootValue,
+						 const struct config_enum_entry * options,
+						 GucContext context,
+						 int flags,
+						 GucEnumCheckHook check_hook,
+						 GucEnumAssignHook assign_hook,
+						 GucShowHook show_hook);
+
+extern void EmitWarningsOnPlaceholders(const char *className);
+
+extern const char *GetConfigOption(const char *name, bool missing_ok,
+				bool restrict_superuser);
+extern const char *GetConfigOptionResetString(const char *name);
+extern void ProcessConfigFile(GucContext context);
+extern void InitializeGUCOptions(void);
+extern bool SelectConfigFiles(const char *userDoption, const char *progname);
+extern void ResetAllOptions(void);
+extern void AtStart_GUC(void);
+extern int	NewGUCNestLevel(void);
+extern void AtEOXact_GUC(bool isCommit, int nestLevel);
+extern void BeginReportingGUCOptions(void);
+extern void ParseLongOption(const char *string, char **name, char **value);
+extern bool parse_int(const char *value, int *result, int flags,
+		  const char **hintmsg);
+extern bool parse_real(const char *value, double *result);
+extern int set_config_option(const char *name, const char *value,
+				  GucContext context, GucSource source,
+				  GucAction action, bool changeVal, int elevel,
+				  bool is_reload);
+extern void AlterSystemSetConfigFile(AlterSystemStmt *setstmt);
+extern char *GetConfigOptionByName(const char *name, const char **varname);
+extern void GetConfigOptionByNum(int varnum, const char **values, bool *noshow);
+extern int	GetNumConfigOptions(void);
+
+extern void SetPGVariable(const char *name, List *args, bool is_local);
+extern void GetPGVariable(const char *name, DestReceiver *dest);
+extern TupleDesc GetPGVariableResultDesc(const char *name);
+
+extern void ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel);
+extern char *ExtractSetVariableArgs(VariableSetStmt *stmt);
+
+extern void ProcessGUCArray(ArrayType *array,
+				GucContext context, GucSource source, GucAction action);
+extern ArrayType *GUCArrayAdd(ArrayType *array, const char *name, const char *value);
+extern ArrayType *GUCArrayDelete(ArrayType *array, const char *name);
+extern ArrayType *GUCArrayReset(ArrayType *array);
+
+#ifdef EXEC_BACKEND
+extern void write_nondefault_variables(GucContext context);
+extern void read_nondefault_variables(void);
+#endif
+
+/* GUC serialization */
+extern Size EstimateGUCStateSpace(void);
+extern void SerializeGUCState(Size maxsize, char *start_address);
+extern void RestoreGUCState(void *gucstate);
+
+/* Support for messages reported from GUC check hooks */
+
+extern PGDLLIMPORT char *GUC_check_errmsg_string;
+extern PGDLLIMPORT char *GUC_check_errdetail_string;
+extern PGDLLIMPORT char *GUC_check_errhint_string;
+
+extern void GUC_check_errcode(int sqlerrcode);
+
+#define GUC_check_errmsg \
+	pre_format_elog_string(errno, TEXTDOMAIN), \
+	GUC_check_errmsg_string = format_elog_string
+
+#define GUC_check_errdetail \
+	pre_format_elog_string(errno, TEXTDOMAIN), \
+	GUC_check_errdetail_string = format_elog_string
+
+#define GUC_check_errhint \
+	pre_format_elog_string(errno, TEXTDOMAIN), \
+	GUC_check_errhint_string = format_elog_string
+
+
+/*
+ * The following functions are not in guc.c, but are declared here to avoid
+ * having to include guc.h in some widely used headers that it really doesn't
+ * belong in.
+ */
+
+/* in commands/tablespace.c */
+extern bool check_default_tablespace(char **newval, void **extra, GucSource source);
+extern bool check_temp_tablespaces(char **newval, void **extra, GucSource source);
+extern void assign_temp_tablespaces(const char *newval, void *extra);
+
+/* in catalog/namespace.c */
+extern bool check_search_path(char **newval, void **extra, GucSource source);
+extern void assign_search_path(const char *newval, void *extra);
+
+/* in access/transam/xlog.c */
+extern bool check_wal_buffers(int *newval, void **extra, GucSource source);
+extern void assign_xlog_sync_method(int new_sync_method, void *extra);
+
+#endif   /* GUC_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/guc_tables.h b/foreign/libpg_query/src/postgres/include/utils/guc_tables.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/guc_tables.h
@@ -0,0 +1,267 @@
+/*-------------------------------------------------------------------------
+ *
+ * guc_tables.h
+ *		Declarations of tables used by GUC.
+ *
+ * See src/backend/utils/misc/README for design notes.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ *
+ *	  src/include/utils/guc_tables.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef GUC_TABLES_H
+#define GUC_TABLES_H 1
+
+#include "utils/guc.h"
+
+/*
+ * GUC supports these types of variables:
+ */
+enum config_type
+{
+	PGC_BOOL,
+	PGC_INT,
+	PGC_REAL,
+	PGC_STRING,
+	PGC_ENUM
+};
+
+union config_var_val
+{
+	bool		boolval;
+	int			intval;
+	double		realval;
+	char	   *stringval;
+	int			enumval;
+};
+
+/*
+ * The actual value of a GUC variable can include a malloc'd opaque struct
+ * "extra", which is created by its check_hook and used by its assign_hook.
+ */
+typedef struct config_var_value
+{
+	union config_var_val val;
+	void	   *extra;
+} config_var_value;
+
+/*
+ * Groupings to help organize all the run-time options for display
+ */
+enum config_group
+{
+	UNGROUPED,
+	FILE_LOCATIONS,
+	CONN_AUTH,
+	CONN_AUTH_SETTINGS,
+	CONN_AUTH_SECURITY,
+	RESOURCES,
+	RESOURCES_MEM,
+	RESOURCES_DISK,
+	RESOURCES_KERNEL,
+	RESOURCES_VACUUM_DELAY,
+	RESOURCES_BGWRITER,
+	RESOURCES_ASYNCHRONOUS,
+	WAL,
+	WAL_SETTINGS,
+	WAL_CHECKPOINTS,
+	WAL_ARCHIVING,
+	REPLICATION,
+	REPLICATION_SENDING,
+	REPLICATION_MASTER,
+	REPLICATION_STANDBY,
+	QUERY_TUNING,
+	QUERY_TUNING_METHOD,
+	QUERY_TUNING_COST,
+	QUERY_TUNING_GEQO,
+	QUERY_TUNING_OTHER,
+	LOGGING,
+	LOGGING_WHERE,
+	LOGGING_WHEN,
+	LOGGING_WHAT,
+	PROCESS_TITLE,
+	STATS,
+	STATS_MONITORING,
+	STATS_COLLECTOR,
+	AUTOVACUUM,
+	CLIENT_CONN,
+	CLIENT_CONN_STATEMENT,
+	CLIENT_CONN_LOCALE,
+	CLIENT_CONN_PRELOAD,
+	CLIENT_CONN_OTHER,
+	LOCK_MANAGEMENT,
+	COMPAT_OPTIONS,
+	COMPAT_OPTIONS_PREVIOUS,
+	COMPAT_OPTIONS_CLIENT,
+	ERROR_HANDLING_OPTIONS,
+	PRESET_OPTIONS,
+	CUSTOM_OPTIONS,
+	DEVELOPER_OPTIONS
+};
+
+/*
+ * Stack entry for saving the state a variable had prior to an uncommitted
+ * transactional change
+ */
+typedef enum
+{
+	/* This is almost GucAction, but we need a fourth state for SET+LOCAL */
+	GUC_SAVE,					/* entry caused by function SET option */
+	GUC_SET,					/* entry caused by plain SET command */
+	GUC_LOCAL,					/* entry caused by SET LOCAL command */
+	GUC_SET_LOCAL				/* entry caused by SET then SET LOCAL */
+} GucStackState;
+
+typedef struct guc_stack
+{
+	struct guc_stack *prev;		/* previous stack item, if any */
+	int			nest_level;		/* nesting depth at which we made entry */
+	GucStackState state;		/* see enum above */
+	GucSource	source;			/* source of the prior value */
+	/* masked value's source must be PGC_S_SESSION, so no need to store it */
+	GucContext	scontext;		/* context that set the prior value */
+	GucContext	masked_scontext;	/* context that set the masked value */
+	config_var_value prior;		/* previous value of variable */
+	config_var_value masked;	/* SET value in a GUC_SET_LOCAL entry */
+} GucStack;
+
+/*
+ * Generic fields applicable to all types of variables
+ *
+ * The short description should be less than 80 chars in length. Some
+ * applications may use the long description as well, and will append
+ * it to the short description. (separated by a newline or '. ')
+ *
+ * Note that sourcefile/sourceline are kept here, and not pushed into stacked
+ * values, although in principle they belong with some stacked value if the
+ * active value is session- or transaction-local.  This is to avoid bloating
+ * stack entries.  We know they are only relevant when source == PGC_S_FILE.
+ */
+struct config_generic
+{
+	/* constant fields, must be set correctly in initial value: */
+	const char *name;			/* name of variable - MUST BE FIRST */
+	GucContext	context;		/* context required to set the variable */
+	enum config_group group;	/* to help organize variables by function */
+	const char *short_desc;		/* short desc. of this variable's purpose */
+	const char *long_desc;		/* long desc. of this variable's purpose */
+	int			flags;			/* flag bits, see guc.h */
+	/* variable fields, initialized at runtime: */
+	enum config_type vartype;	/* type of variable (set only at startup) */
+	int			status;			/* status bits, see below */
+	GucSource	source;			/* source of the current actual value */
+	GucSource	reset_source;	/* source of the reset_value */
+	GucContext	scontext;		/* context that set the current value */
+	GucContext	reset_scontext; /* context that set the reset value */
+	GucStack   *stack;			/* stacked prior values */
+	void	   *extra;			/* "extra" pointer for current actual value */
+	char	   *sourcefile;		/* file current setting is from (NULL if not
+								 * set in config file) */
+	int			sourceline;		/* line in source file */
+};
+
+/* bit values in status field */
+#define GUC_IS_IN_FILE		0x0001		/* found it in config file */
+/*
+ * Caution: the GUC_IS_IN_FILE bit is transient state for ProcessConfigFile.
+ * Do not assume that its value represents useful information elsewhere.
+ */
+#define GUC_PENDING_RESTART 0x0002
+
+
+/* GUC records for specific variable types */
+
+struct config_bool
+{
+	struct config_generic gen;
+	/* constant fields, must be set correctly in initial value: */
+	bool	   *variable;
+	bool		boot_val;
+	GucBoolCheckHook check_hook;
+	GucBoolAssignHook assign_hook;
+	GucShowHook show_hook;
+	/* variable fields, initialized at runtime: */
+	bool		reset_val;
+	void	   *reset_extra;
+};
+
+struct config_int
+{
+	struct config_generic gen;
+	/* constant fields, must be set correctly in initial value: */
+	int		   *variable;
+	int			boot_val;
+	int			min;
+	int			max;
+	GucIntCheckHook check_hook;
+	GucIntAssignHook assign_hook;
+	GucShowHook show_hook;
+	/* variable fields, initialized at runtime: */
+	int			reset_val;
+	void	   *reset_extra;
+};
+
+struct config_real
+{
+	struct config_generic gen;
+	/* constant fields, must be set correctly in initial value: */
+	double	   *variable;
+	double		boot_val;
+	double		min;
+	double		max;
+	GucRealCheckHook check_hook;
+	GucRealAssignHook assign_hook;
+	GucShowHook show_hook;
+	/* variable fields, initialized at runtime: */
+	double		reset_val;
+	void	   *reset_extra;
+};
+
+struct config_string
+{
+	struct config_generic gen;
+	/* constant fields, must be set correctly in initial value: */
+	char	  **variable;
+	const char *boot_val;
+	GucStringCheckHook check_hook;
+	GucStringAssignHook assign_hook;
+	GucShowHook show_hook;
+	/* variable fields, initialized at runtime: */
+	char	   *reset_val;
+	void	   *reset_extra;
+};
+
+struct config_enum
+{
+	struct config_generic gen;
+	/* constant fields, must be set correctly in initial value: */
+	int		   *variable;
+	int			boot_val;
+	const struct config_enum_entry *options;
+	GucEnumCheckHook check_hook;
+	GucEnumAssignHook assign_hook;
+	GucShowHook show_hook;
+	/* variable fields, initialized at runtime: */
+	int			reset_val;
+	void	   *reset_extra;
+};
+
+/* constant tables corresponding to enums above and in guc.h */
+extern const char *const config_group_names[];
+extern const char *const config_type_names[];
+extern const char *const GucContext_Names[];
+extern const char *const GucSource_Names[];
+
+/* get the current set of variables */
+extern struct config_generic **get_guc_variables(void);
+
+extern void build_guc_variables(void);
+
+/* search in enum options */
+extern const char *config_enum_lookup_by_value(struct config_enum * record, int val);
+extern bool config_enum_lookup_by_name(struct config_enum * record,
+						   const char *value, int *retval);
+
+#endif   /* GUC_TABLES_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/hsearch.h b/foreign/libpg_query/src/postgres/include/utils/hsearch.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/hsearch.h
@@ -0,0 +1,160 @@
+/*-------------------------------------------------------------------------
+ *
+ * hsearch.h
+ *	  exported definitions for utils/hash/dynahash.c; see notes therein
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/hsearch.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef HSEARCH_H
+#define HSEARCH_H
+
+
+/*
+ * Hash functions must have this signature.
+ */
+typedef uint32 (*HashValueFunc) (const void *key, Size keysize);
+
+/*
+ * Key comparison functions must have this signature.  Comparison functions
+ * return zero for match, nonzero for no match.  (The comparison function
+ * definition is designed to allow memcmp() and strncmp() to be used directly
+ * as key comparison functions.)
+ */
+typedef int (*HashCompareFunc) (const void *key1, const void *key2,
+											Size keysize);
+
+/*
+ * Key copying functions must have this signature.  The return value is not
+ * used.  (The definition is set up to allow memcpy() and strlcpy() to be
+ * used directly.)
+ */
+typedef void *(*HashCopyFunc) (void *dest, const void *src, Size keysize);
+
+/*
+ * Space allocation function for a hashtable --- designed to match malloc().
+ * Note: there is no free function API; can't destroy a hashtable unless you
+ * use the default allocator.
+ */
+typedef void *(*HashAllocFunc) (Size request);
+
+/*
+ * HASHELEMENT is the private part of a hashtable entry.  The caller's data
+ * follows the HASHELEMENT structure (on a MAXALIGN'd boundary).  The hash key
+ * is expected to be at the start of the caller's hash entry data structure.
+ */
+typedef struct HASHELEMENT
+{
+	struct HASHELEMENT *link;	/* link to next entry in same bucket */
+	uint32		hashvalue;		/* hash function result for this entry */
+} HASHELEMENT;
+
+/* Hash table header struct is an opaque type known only within dynahash.c */
+typedef struct HASHHDR HASHHDR;
+
+/* Hash table control struct is an opaque type known only within dynahash.c */
+typedef struct HTAB HTAB;
+
+/* Parameter data structure for hash_create */
+/* Only those fields indicated by hash_flags need be set */
+typedef struct HASHCTL
+{
+	long		num_partitions; /* # partitions (must be power of 2) */
+	long		ssize;			/* segment size */
+	long		dsize;			/* (initial) directory size */
+	long		max_dsize;		/* limit to dsize if dir size is limited */
+	long		ffactor;		/* fill factor */
+	Size		keysize;		/* hash key length in bytes */
+	Size		entrysize;		/* total user element size in bytes */
+	HashValueFunc hash;			/* hash function */
+	HashCompareFunc match;		/* key comparison function */
+	HashCopyFunc keycopy;		/* key copying function */
+	HashAllocFunc alloc;		/* memory allocator */
+	MemoryContext hcxt;			/* memory context to use for allocations */
+	HASHHDR    *hctl;			/* location of header in shared mem */
+} HASHCTL;
+
+/* Flags to indicate which parameters are supplied */
+#define HASH_PARTITION	0x0001	/* Hashtable is used w/partitioned locking */
+#define HASH_SEGMENT	0x0002	/* Set segment size */
+#define HASH_DIRSIZE	0x0004	/* Set directory size (initial and max) */
+#define HASH_FFACTOR	0x0008	/* Set fill factor */
+#define HASH_ELEM		0x0010	/* Set keysize and entrysize */
+#define HASH_BLOBS		0x0020	/* Select support functions for binary keys */
+#define HASH_FUNCTION	0x0040	/* Set user defined hash function */
+#define HASH_COMPARE	0x0080	/* Set user defined comparison function */
+#define HASH_KEYCOPY	0x0100	/* Set user defined key-copying function */
+#define HASH_ALLOC		0x0200	/* Set memory allocator */
+#define HASH_CONTEXT	0x0400	/* Set memory allocation context */
+#define HASH_SHARED_MEM 0x0800	/* Hashtable is in shared memory */
+#define HASH_ATTACH		0x1000	/* Do not initialize hctl */
+#define HASH_FIXED_SIZE 0x2000	/* Initial size is a hard limit */
+
+
+/* max_dsize value to indicate expansible directory */
+#define NO_MAX_DSIZE			(-1)
+
+/* hash_search operations */
+typedef enum
+{
+	HASH_FIND,
+	HASH_ENTER,
+	HASH_REMOVE,
+	HASH_ENTER_NULL
+} HASHACTION;
+
+/* hash_seq status (should be considered an opaque type by callers) */
+typedef struct
+{
+	HTAB	   *hashp;
+	uint32		curBucket;		/* index of current bucket */
+	HASHELEMENT *curEntry;		/* current entry in bucket */
+} HASH_SEQ_STATUS;
+
+/*
+ * prototypes for functions in dynahash.c
+ */
+extern HTAB *hash_create(const char *tabname, long nelem,
+			HASHCTL *info, int flags);
+extern void hash_destroy(HTAB *hashp);
+extern void hash_stats(const char *where, HTAB *hashp);
+extern void *hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action,
+			bool *foundPtr);
+extern uint32 get_hash_value(HTAB *hashp, const void *keyPtr);
+extern void *hash_search_with_hash_value(HTAB *hashp, const void *keyPtr,
+							uint32 hashvalue, HASHACTION action,
+							bool *foundPtr);
+extern bool hash_update_hash_key(HTAB *hashp, void *existingEntry,
+					 const void *newKeyPtr);
+extern long hash_get_num_entries(HTAB *hashp);
+extern void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp);
+extern void *hash_seq_search(HASH_SEQ_STATUS *status);
+extern void hash_seq_term(HASH_SEQ_STATUS *status);
+extern void hash_freeze(HTAB *hashp);
+extern Size hash_estimate_size(long num_entries, Size entrysize);
+extern long hash_select_dirsize(long num_entries);
+extern Size hash_get_shared_size(HASHCTL *info, int flags);
+extern void AtEOXact_HashTables(bool isCommit);
+extern void AtEOSubXact_HashTables(bool isCommit, int nestDepth);
+
+/*
+ * prototypes for functions in hashfn.c
+ *
+ * Note: It is deprecated for callers of hash_create to explicitly specify
+ * string_hash, tag_hash, uint32_hash, or oid_hash.  Just set HASH_BLOBS or
+ * not.  Use HASH_FUNCTION only when you want something other than those.
+ */
+extern uint32 string_hash(const void *key, Size keysize);
+extern uint32 tag_hash(const void *key, Size keysize);
+extern uint32 uint32_hash(const void *key, Size keysize);
+extern uint32 bitmap_hash(const void *key, Size keysize);
+extern int	bitmap_match(const void *key1, const void *key2, Size keysize);
+
+#define oid_hash uint32_hash	/* Remove me eventually */
+
+#endif   /* HSEARCH_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/int8.h b/foreign/libpg_query/src/postgres/include/utils/int8.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/int8.h
@@ -0,0 +1,129 @@
+/*-------------------------------------------------------------------------
+ *
+ * int8.h
+ *	  Declarations for operations on 64-bit integers.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/int8.h
+ *
+ * NOTES
+ * These data types are supported on all 64-bit architectures, and may
+ *	be supported through libraries on some 32-bit machines. If your machine
+ *	is not currently supported, then please try to make it so, then post
+ *	patches to the postgresql.org hackers mailing list.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef INT8_H
+#define INT8_H
+
+#include "fmgr.h"
+
+
+extern bool scanint8(const char *str, bool errorOK, int64 *result);
+
+extern Datum int8in(PG_FUNCTION_ARGS);
+extern Datum int8out(PG_FUNCTION_ARGS);
+extern Datum int8recv(PG_FUNCTION_ARGS);
+extern Datum int8send(PG_FUNCTION_ARGS);
+
+extern Datum int8eq(PG_FUNCTION_ARGS);
+extern Datum int8ne(PG_FUNCTION_ARGS);
+extern Datum int8lt(PG_FUNCTION_ARGS);
+extern Datum int8gt(PG_FUNCTION_ARGS);
+extern Datum int8le(PG_FUNCTION_ARGS);
+extern Datum int8ge(PG_FUNCTION_ARGS);
+
+extern Datum int84eq(PG_FUNCTION_ARGS);
+extern Datum int84ne(PG_FUNCTION_ARGS);
+extern Datum int84lt(PG_FUNCTION_ARGS);
+extern Datum int84gt(PG_FUNCTION_ARGS);
+extern Datum int84le(PG_FUNCTION_ARGS);
+extern Datum int84ge(PG_FUNCTION_ARGS);
+
+extern Datum int48eq(PG_FUNCTION_ARGS);
+extern Datum int48ne(PG_FUNCTION_ARGS);
+extern Datum int48lt(PG_FUNCTION_ARGS);
+extern Datum int48gt(PG_FUNCTION_ARGS);
+extern Datum int48le(PG_FUNCTION_ARGS);
+extern Datum int48ge(PG_FUNCTION_ARGS);
+
+extern Datum int82eq(PG_FUNCTION_ARGS);
+extern Datum int82ne(PG_FUNCTION_ARGS);
+extern Datum int82lt(PG_FUNCTION_ARGS);
+extern Datum int82gt(PG_FUNCTION_ARGS);
+extern Datum int82le(PG_FUNCTION_ARGS);
+extern Datum int82ge(PG_FUNCTION_ARGS);
+
+extern Datum int28eq(PG_FUNCTION_ARGS);
+extern Datum int28ne(PG_FUNCTION_ARGS);
+extern Datum int28lt(PG_FUNCTION_ARGS);
+extern Datum int28gt(PG_FUNCTION_ARGS);
+extern Datum int28le(PG_FUNCTION_ARGS);
+extern Datum int28ge(PG_FUNCTION_ARGS);
+
+extern Datum int8um(PG_FUNCTION_ARGS);
+extern Datum int8up(PG_FUNCTION_ARGS);
+extern Datum int8pl(PG_FUNCTION_ARGS);
+extern Datum int8mi(PG_FUNCTION_ARGS);
+extern Datum int8mul(PG_FUNCTION_ARGS);
+extern Datum int8div(PG_FUNCTION_ARGS);
+extern Datum int8abs(PG_FUNCTION_ARGS);
+extern Datum int8mod(PG_FUNCTION_ARGS);
+extern Datum int8inc(PG_FUNCTION_ARGS);
+extern Datum int8dec(PG_FUNCTION_ARGS);
+extern Datum int8inc_any(PG_FUNCTION_ARGS);
+extern Datum int8inc_float8_float8(PG_FUNCTION_ARGS);
+extern Datum int8dec_any(PG_FUNCTION_ARGS);
+extern Datum int8larger(PG_FUNCTION_ARGS);
+extern Datum int8smaller(PG_FUNCTION_ARGS);
+
+extern Datum int8and(PG_FUNCTION_ARGS);
+extern Datum int8or(PG_FUNCTION_ARGS);
+extern Datum int8xor(PG_FUNCTION_ARGS);
+extern Datum int8not(PG_FUNCTION_ARGS);
+extern Datum int8shl(PG_FUNCTION_ARGS);
+extern Datum int8shr(PG_FUNCTION_ARGS);
+
+extern Datum int84pl(PG_FUNCTION_ARGS);
+extern Datum int84mi(PG_FUNCTION_ARGS);
+extern Datum int84mul(PG_FUNCTION_ARGS);
+extern Datum int84div(PG_FUNCTION_ARGS);
+
+extern Datum int48pl(PG_FUNCTION_ARGS);
+extern Datum int48mi(PG_FUNCTION_ARGS);
+extern Datum int48mul(PG_FUNCTION_ARGS);
+extern Datum int48div(PG_FUNCTION_ARGS);
+
+extern Datum int82pl(PG_FUNCTION_ARGS);
+extern Datum int82mi(PG_FUNCTION_ARGS);
+extern Datum int82mul(PG_FUNCTION_ARGS);
+extern Datum int82div(PG_FUNCTION_ARGS);
+
+extern Datum int28pl(PG_FUNCTION_ARGS);
+extern Datum int28mi(PG_FUNCTION_ARGS);
+extern Datum int28mul(PG_FUNCTION_ARGS);
+extern Datum int28div(PG_FUNCTION_ARGS);
+
+extern Datum int48(PG_FUNCTION_ARGS);
+extern Datum int84(PG_FUNCTION_ARGS);
+
+extern Datum int28(PG_FUNCTION_ARGS);
+extern Datum int82(PG_FUNCTION_ARGS);
+
+extern Datum i8tod(PG_FUNCTION_ARGS);
+extern Datum dtoi8(PG_FUNCTION_ARGS);
+
+extern Datum i8tof(PG_FUNCTION_ARGS);
+extern Datum ftoi8(PG_FUNCTION_ARGS);
+
+extern Datum i8tooid(PG_FUNCTION_ARGS);
+extern Datum oidtoi8(PG_FUNCTION_ARGS);
+
+extern Datum generate_series_int8(PG_FUNCTION_ARGS);
+extern Datum generate_series_step_int8(PG_FUNCTION_ARGS);
+
+#endif   /* INT8_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/inval.h b/foreign/libpg_query/src/postgres/include/utils/inval.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/inval.h
@@ -0,0 +1,64 @@
+/*-------------------------------------------------------------------------
+ *
+ * inval.h
+ *	  POSTGRES cache invalidation dispatcher definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/inval.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef INVAL_H
+#define INVAL_H
+
+#include "access/htup.h"
+#include "storage/relfilenode.h"
+#include "utils/relcache.h"
+
+
+typedef void (*SyscacheCallbackFunction) (Datum arg, int cacheid, uint32 hashvalue);
+typedef void (*RelcacheCallbackFunction) (Datum arg, Oid relid);
+
+
+extern void AcceptInvalidationMessages(void);
+
+extern void AtEOXact_Inval(bool isCommit);
+
+extern void AtEOSubXact_Inval(bool isCommit);
+
+extern void AtPrepare_Inval(void);
+
+extern void PostPrepare_Inval(void);
+
+extern void CommandEndInvalidationMessages(void);
+
+extern void CacheInvalidateHeapTuple(Relation relation,
+						 HeapTuple tuple,
+						 HeapTuple newtuple);
+
+extern void CacheInvalidateCatalog(Oid catalogId);
+
+extern void CacheInvalidateRelcache(Relation relation);
+
+extern void CacheInvalidateRelcacheByTuple(HeapTuple classTuple);
+
+extern void CacheInvalidateRelcacheByRelid(Oid relid);
+
+extern void CacheInvalidateSmgr(RelFileNodeBackend rnode);
+
+extern void CacheInvalidateRelmap(Oid databaseId);
+
+extern void CacheRegisterSyscacheCallback(int cacheid,
+							  SyscacheCallbackFunction func,
+							  Datum arg);
+
+extern void CacheRegisterRelcacheCallback(RelcacheCallbackFunction func,
+							  Datum arg);
+
+extern void CallSyscacheCallbacks(int cacheid, uint32 hashvalue);
+
+extern void InvalidateSystemCaches(void);
+#endif   /* INVAL_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/lsyscache.h b/foreign/libpg_query/src/postgres/include/utils/lsyscache.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/lsyscache.h
@@ -0,0 +1,166 @@
+/*-------------------------------------------------------------------------
+ *
+ * lsyscache.h
+ *	  Convenience routines for common queries in the system catalog cache.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/lsyscache.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef LSYSCACHE_H
+#define LSYSCACHE_H
+
+#include "access/attnum.h"
+#include "access/htup.h"
+#include "nodes/pg_list.h"
+
+/* Result list element for get_op_btree_interpretation */
+typedef struct OpBtreeInterpretation
+{
+	Oid			opfamily_id;	/* btree opfamily containing operator */
+	int			strategy;		/* its strategy number */
+	Oid			oplefttype;		/* declared left input datatype */
+	Oid			oprighttype;	/* declared right input datatype */
+} OpBtreeInterpretation;
+
+/* I/O function selector for get_type_io_data */
+typedef enum IOFuncSelector
+{
+	IOFunc_input,
+	IOFunc_output,
+	IOFunc_receive,
+	IOFunc_send
+} IOFuncSelector;
+
+/* Hook for plugins to get control in get_attavgwidth() */
+typedef int32 (*get_attavgwidth_hook_type) (Oid relid, AttrNumber attnum);
+extern PGDLLIMPORT get_attavgwidth_hook_type get_attavgwidth_hook;
+
+extern bool op_in_opfamily(Oid opno, Oid opfamily);
+extern int	get_op_opfamily_strategy(Oid opno, Oid opfamily);
+extern Oid	get_op_opfamily_sortfamily(Oid opno, Oid opfamily);
+extern void get_op_opfamily_properties(Oid opno, Oid opfamily, bool ordering_op,
+						   int *strategy,
+						   Oid *lefttype,
+						   Oid *righttype);
+extern Oid get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype,
+					int16 strategy);
+extern bool get_ordering_op_properties(Oid opno,
+						   Oid *opfamily, Oid *opcintype, int16 *strategy);
+extern Oid	get_equality_op_for_ordering_op(Oid opno, bool *reverse);
+extern Oid	get_ordering_op_for_equality_op(Oid opno, bool use_lhs_type);
+extern List *get_mergejoin_opfamilies(Oid opno);
+extern bool get_compatible_hash_operators(Oid opno,
+							  Oid *lhs_opno, Oid *rhs_opno);
+extern bool get_op_hash_functions(Oid opno,
+					  RegProcedure *lhs_procno, RegProcedure *rhs_procno);
+extern List *get_op_btree_interpretation(Oid opno);
+extern bool equality_ops_are_compatible(Oid opno1, Oid opno2);
+extern Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype,
+				  int16 procnum);
+extern char *get_attname(Oid relid, AttrNumber attnum);
+extern char *get_relid_attribute_name(Oid relid, AttrNumber attnum);
+extern AttrNumber get_attnum(Oid relid, const char *attname);
+extern Oid	get_atttype(Oid relid, AttrNumber attnum);
+extern int32 get_atttypmod(Oid relid, AttrNumber attnum);
+extern void get_atttypetypmodcoll(Oid relid, AttrNumber attnum,
+					  Oid *typid, int32 *typmod, Oid *collid);
+extern char *get_collation_name(Oid colloid);
+extern char *get_constraint_name(Oid conoid);
+extern char *get_language_name(Oid langoid, bool missing_ok);
+extern Oid	get_opclass_family(Oid opclass);
+extern Oid	get_opclass_input_type(Oid opclass);
+extern RegProcedure get_opcode(Oid opno);
+extern char *get_opname(Oid opno);
+extern void op_input_types(Oid opno, Oid *lefttype, Oid *righttype);
+extern bool op_mergejoinable(Oid opno, Oid inputtype);
+extern bool op_hashjoinable(Oid opno, Oid inputtype);
+extern bool op_strict(Oid opno);
+extern char op_volatile(Oid opno);
+extern Oid	get_commutator(Oid opno);
+extern Oid	get_negator(Oid opno);
+extern RegProcedure get_oprrest(Oid opno);
+extern RegProcedure get_oprjoin(Oid opno);
+extern char *get_func_name(Oid funcid);
+extern Oid	get_func_namespace(Oid funcid);
+extern Oid	get_func_rettype(Oid funcid);
+extern int	get_func_nargs(Oid funcid);
+extern Oid	get_func_signature(Oid funcid, Oid **argtypes, int *nargs);
+extern Oid	get_func_variadictype(Oid funcid);
+extern bool get_func_retset(Oid funcid);
+extern bool func_strict(Oid funcid);
+extern char func_volatile(Oid funcid);
+extern bool get_func_leakproof(Oid funcid);
+extern float4 get_func_cost(Oid funcid);
+extern float4 get_func_rows(Oid funcid);
+extern Oid	get_relname_relid(const char *relname, Oid relnamespace);
+extern char *get_rel_name(Oid relid);
+extern Oid	get_rel_namespace(Oid relid);
+extern Oid	get_rel_type_id(Oid relid);
+extern char get_rel_relkind(Oid relid);
+extern Oid	get_rel_tablespace(Oid relid);
+extern Oid	get_transform_fromsql(Oid typid, Oid langid, List *trftypes);
+extern Oid	get_transform_tosql(Oid typid, Oid langid, List *trftypes);
+extern bool get_typisdefined(Oid typid);
+extern int16 get_typlen(Oid typid);
+extern bool get_typbyval(Oid typid);
+extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval);
+extern void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval,
+					 char *typalign);
+extern Oid	getTypeIOParam(HeapTuple typeTuple);
+extern void get_type_io_data(Oid typid,
+				 IOFuncSelector which_func,
+				 int16 *typlen,
+				 bool *typbyval,
+				 char *typalign,
+				 char *typdelim,
+				 Oid *typioparam,
+				 Oid *func);
+extern char get_typstorage(Oid typid);
+extern Node *get_typdefault(Oid typid);
+extern char get_typtype(Oid typid);
+extern bool type_is_rowtype(Oid typid);
+extern bool type_is_enum(Oid typid);
+extern bool type_is_range(Oid typid);
+extern void get_type_category_preferred(Oid typid,
+							char *typcategory,
+							bool *typispreferred);
+extern Oid	get_typ_typrelid(Oid typid);
+extern Oid	get_element_type(Oid typid);
+extern Oid	get_array_type(Oid typid);
+extern Oid	get_promoted_array_type(Oid typid);
+extern Oid	get_base_element_type(Oid typid);
+extern void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam);
+extern void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena);
+extern void getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typIOParam);
+extern void getTypeBinaryOutputInfo(Oid type, Oid *typSend, bool *typIsVarlena);
+extern Oid	get_typmodin(Oid typid);
+extern Oid	get_typcollation(Oid typid);
+extern bool type_is_collatable(Oid typid);
+extern Oid	getBaseType(Oid typid);
+extern Oid	getBaseTypeAndTypmod(Oid typid, int32 *typmod);
+extern int32 get_typavgwidth(Oid typid, int32 typmod);
+extern int32 get_attavgwidth(Oid relid, AttrNumber attnum);
+extern bool get_attstatsslot(HeapTuple statstuple,
+				 Oid atttype, int32 atttypmod,
+				 int reqkind, Oid reqop,
+				 Oid *actualop,
+				 Datum **values, int *nvalues,
+				 float4 **numbers, int *nnumbers);
+extern void free_attstatsslot(Oid atttype,
+				  Datum *values, int nvalues,
+				  float4 *numbers, int nnumbers);
+extern char *get_namespace_name(Oid nspid);
+extern char *get_namespace_name_or_temp(Oid nspid);
+extern Oid	get_range_subtype(Oid rangeOid);
+
+#define type_is_array(typid)  (get_element_type(typid) != InvalidOid)
+/* type_is_array_domain accepts both plain arrays and domains over arrays */
+#define type_is_array_domain(typid)  (get_base_element_type(typid) != InvalidOid)
+
+#define TypeIsToastable(typid)	(get_typstorage(typid) != 'p')
+
+#endif   /* LSYSCACHE_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/memdebug.h b/foreign/libpg_query/src/postgres/include/utils/memdebug.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/memdebug.h
@@ -0,0 +1,34 @@
+/*-------------------------------------------------------------------------
+ *
+ * memdebug.h
+ *	  Memory debugging support.
+ *
+ * Currently, this file either wraps <valgrind/memcheck.h> or substitutes
+ * empty definitions for Valgrind client request macros we use.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/memdebug.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef MEMDEBUG_H
+#define MEMDEBUG_H
+
+#ifdef USE_VALGRIND
+#include <valgrind/memcheck.h>
+#else
+#define VALGRIND_CHECK_MEM_IS_DEFINED(addr, size)			do {} while (0)
+#define VALGRIND_CREATE_MEMPOOL(context, redzones, zeroed)	do {} while (0)
+#define VALGRIND_DESTROY_MEMPOOL(context)					do {} while (0)
+#define VALGRIND_MAKE_MEM_DEFINED(addr, size)				do {} while (0)
+#define VALGRIND_MAKE_MEM_NOACCESS(addr, size)				do {} while (0)
+#define VALGRIND_MAKE_MEM_UNDEFINED(addr, size)				do {} while (0)
+#define VALGRIND_MEMPOOL_ALLOC(context, addr, size)			do {} while (0)
+#define VALGRIND_MEMPOOL_FREE(context, addr)				do {} while (0)
+#define VALGRIND_MEMPOOL_CHANGE(context, optr, nptr, size)	do {} while (0)
+#endif
+
+#endif   /* MEMDEBUG_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/memutils.h b/foreign/libpg_query/src/postgres/include/utils/memutils.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/memutils.h
@@ -0,0 +1,161 @@
+/*-------------------------------------------------------------------------
+ *
+ * memutils.h
+ *	  This file contains declarations for memory allocation utility
+ *	  functions.  These are functions that are not quite widely used
+ *	  enough to justify going in utils/palloc.h, but are still part
+ *	  of the API of the memory management subsystem.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/memutils.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef MEMUTILS_H
+#define MEMUTILS_H
+
+#include "nodes/memnodes.h"
+
+
+/*
+ * MaxAllocSize, MaxAllocHugeSize
+ *		Quasi-arbitrary limits on size of allocations.
+ *
+ * Note:
+ *		There is no guarantee that smaller allocations will succeed, but
+ *		larger requests will be summarily denied.
+ *
+ * palloc() enforces MaxAllocSize, chosen to correspond to the limiting size
+ * of varlena objects under TOAST.  See VARSIZE_4B() and related macros in
+ * postgres.h.  Many datatypes assume that any allocatable size can be
+ * represented in a varlena header.  This limit also permits a caller to use
+ * an "int" variable for an index into or length of an allocation.  Callers
+ * careful to avoid these hazards can access the higher limit with
+ * MemoryContextAllocHuge().  Both limits permit code to assume that it may
+ * compute twice an allocation's size without overflow.
+ */
+#define MaxAllocSize	((Size) 0x3fffffff)		/* 1 gigabyte - 1 */
+
+#define AllocSizeIsValid(size)	((Size) (size) <= MaxAllocSize)
+
+#define MaxAllocHugeSize	((Size) -1 >> 1)	/* SIZE_MAX / 2 */
+
+#define AllocHugeSizeIsValid(size)	((Size) (size) <= MaxAllocHugeSize)
+
+/*
+ * All chunks allocated by any memory context manager are required to be
+ * preceded by a StandardChunkHeader at a spacing of STANDARDCHUNKHEADERSIZE.
+ * A currently-allocated chunk must contain a backpointer to its owning
+ * context as well as the allocated size of the chunk.  The backpointer is
+ * used by pfree() and repalloc() to find the context to call.  The allocated
+ * size is not absolutely essential, but it's expected to be needed by any
+ * reasonable implementation.
+ */
+typedef struct StandardChunkHeader
+{
+	MemoryContext context;		/* owning context */
+	Size		size;			/* size of data space allocated in chunk */
+#ifdef MEMORY_CONTEXT_CHECKING
+	/* when debugging memory usage, also store actual requested size */
+	Size		requested_size;
+#endif
+} StandardChunkHeader;
+
+#define STANDARDCHUNKHEADERSIZE  MAXALIGN(sizeof(StandardChunkHeader))
+
+
+/*
+ * Standard top-level memory contexts.
+ *
+ * Only TopMemoryContext and ErrorContext are initialized by
+ * MemoryContextInit() itself.
+ */
+extern PGDLLIMPORT __thread  MemoryContext TopMemoryContext;
+extern PGDLLIMPORT __thread  MemoryContext ErrorContext;
+extern PGDLLIMPORT MemoryContext PostmasterContext;
+extern PGDLLIMPORT MemoryContext CacheMemoryContext;
+extern PGDLLIMPORT MemoryContext MessageContext;
+extern PGDLLIMPORT MemoryContext TopTransactionContext;
+extern PGDLLIMPORT MemoryContext CurTransactionContext;
+
+/* This is a transient link to the active portal's memory context: */
+extern PGDLLIMPORT MemoryContext PortalContext;
+
+/* Backwards compatibility macro */
+#define MemoryContextResetAndDeleteChildren(ctx) MemoryContextReset(ctx)
+
+
+/*
+ * Memory-context-type-independent functions in mcxt.c
+ */
+extern void MemoryContextInit(void);
+extern void MemoryContextReset(MemoryContext context);
+extern void MemoryContextDelete(MemoryContext context);
+extern void MemoryContextResetOnly(MemoryContext context);
+extern void MemoryContextResetChildren(MemoryContext context);
+extern void MemoryContextDeleteChildren(MemoryContext context);
+extern void MemoryContextSetParent(MemoryContext context,
+					   MemoryContext new_parent);
+extern Size GetMemoryChunkSpace(void *pointer);
+extern MemoryContext GetMemoryChunkContext(void *pointer);
+extern MemoryContext MemoryContextGetParent(MemoryContext context);
+extern bool MemoryContextIsEmpty(MemoryContext context);
+extern void MemoryContextStats(MemoryContext context);
+extern void MemoryContextAllowInCriticalSection(MemoryContext context,
+									bool allow);
+
+#ifdef MEMORY_CONTEXT_CHECKING
+extern void MemoryContextCheck(MemoryContext context);
+#endif
+extern bool MemoryContextContains(MemoryContext context, void *pointer);
+
+/*
+ * This routine handles the context-type-independent part of memory
+ * context creation.  It's intended to be called from context-type-
+ * specific creation routines, and noplace else.
+ */
+extern MemoryContext MemoryContextCreate(NodeTag tag, Size size,
+					MemoryContextMethods *methods,
+					MemoryContext parent,
+					const char *name);
+
+
+/*
+ * Memory-context-type-specific functions
+ */
+
+/* aset.c */
+extern MemoryContext AllocSetContextCreate(MemoryContext parent,
+					  const char *name,
+					  Size minContextSize,
+					  Size initBlockSize,
+					  Size maxBlockSize);
+
+/*
+ * Recommended default alloc parameters, suitable for "ordinary" contexts
+ * that might hold quite a lot of data.
+ */
+#define ALLOCSET_DEFAULT_MINSIZE   0
+#define ALLOCSET_DEFAULT_INITSIZE  (8 * 1024)
+#define ALLOCSET_DEFAULT_MAXSIZE   (8 * 1024 * 1024)
+
+/*
+ * Recommended alloc parameters for "small" contexts that are not expected
+ * to contain much data (for example, a context to contain a query plan).
+ */
+#define ALLOCSET_SMALL_MINSIZE	 0
+#define ALLOCSET_SMALL_INITSIZE  (1 * 1024)
+#define ALLOCSET_SMALL_MAXSIZE	 (8 * 1024)
+
+/*
+ * Threshold above which a request in an AllocSet context is certain to be
+ * allocated separately (and thereby have constant allocation overhead).
+ * Few callers should be interested in this, but tuplesort/tuplestore need
+ * to know it.
+ */
+#define ALLOCSET_SEPARATE_THRESHOLD  8192
+
+#endif   /* MEMUTILS_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/numeric.h b/foreign/libpg_query/src/postgres/include/utils/numeric.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/numeric.h
@@ -0,0 +1,63 @@
+/*-------------------------------------------------------------------------
+ *
+ * numeric.h
+ *	  Definitions for the exact numeric data type of Postgres
+ *
+ * Original coding 1998, Jan Wieck.  Heavily revised 2003, Tom Lane.
+ *
+ * Copyright (c) 1998-2015, PostgreSQL Global Development Group
+ *
+ * src/include/utils/numeric.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef _PG_NUMERIC_H_
+#define _PG_NUMERIC_H_
+
+#include "fmgr.h"
+
+/*
+ * Hardcoded precision limit - arbitrary, but must be small enough that
+ * dscale values will fit in 14 bits.
+ */
+#define NUMERIC_MAX_PRECISION		1000
+
+/*
+ * Internal limits on the scales chosen for calculation results
+ */
+#define NUMERIC_MAX_DISPLAY_SCALE	NUMERIC_MAX_PRECISION
+#define NUMERIC_MIN_DISPLAY_SCALE	0
+
+#define NUMERIC_MAX_RESULT_SCALE	(NUMERIC_MAX_PRECISION * 2)
+
+/*
+ * For inherently inexact calculations such as division and square root,
+ * we try to get at least this many significant digits; the idea is to
+ * deliver a result no worse than float8 would.
+ */
+#define NUMERIC_MIN_SIG_DIGITS		16
+
+/* The actual contents of Numeric are private to numeric.c */
+struct NumericData;
+typedef struct NumericData *Numeric;
+
+/*
+ * fmgr interface macros
+ */
+
+#define DatumGetNumeric(X)		  ((Numeric) PG_DETOAST_DATUM(X))
+#define DatumGetNumericCopy(X)	  ((Numeric) PG_DETOAST_DATUM_COPY(X))
+#define NumericGetDatum(X)		  PointerGetDatum(X)
+#define PG_GETARG_NUMERIC(n)	  DatumGetNumeric(PG_GETARG_DATUM(n))
+#define PG_GETARG_NUMERIC_COPY(n) DatumGetNumericCopy(PG_GETARG_DATUM(n))
+#define PG_RETURN_NUMERIC(x)	  return NumericGetDatum(x)
+
+/*
+ * Utility functions in numeric.c
+ */
+extern bool numeric_is_nan(Numeric num);
+int32		numeric_maximum_size(int32 typmod);
+extern char *numeric_out_sci(Numeric num, int scale);
+extern char *numeric_normalize(Numeric num);
+
+#endif   /* _PG_NUMERIC_H_ */
diff --git a/foreign/libpg_query/src/postgres/include/utils/palloc.h b/foreign/libpg_query/src/postgres/include/utils/palloc.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/palloc.h
@@ -0,0 +1,143 @@
+/*-------------------------------------------------------------------------
+ *
+ * palloc.h
+ *	  POSTGRES memory allocator definitions.
+ *
+ * This file contains the basic memory allocation interface that is
+ * needed by almost every backend module.  It is included directly by
+ * postgres.h, so the definitions here are automatically available
+ * everywhere.  Keep it lean!
+ *
+ * Memory allocation occurs within "contexts".  Every chunk obtained from
+ * palloc()/MemoryContextAlloc() is allocated within a specific context.
+ * The entire contents of a context can be freed easily and quickly by
+ * resetting or deleting the context --- this is both faster and less
+ * prone to memory-leakage bugs than releasing chunks individually.
+ * We organize contexts into context trees to allow fine-grain control
+ * over chunk lifetime while preserving the certainty that we will free
+ * everything that should be freed.  See utils/mmgr/README for more info.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/palloc.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PALLOC_H
+#define PALLOC_H
+
+/*
+ * Type MemoryContextData is declared in nodes/memnodes.h.  Most users
+ * of memory allocation should just treat it as an abstract type, so we
+ * do not provide the struct contents here.
+ */
+typedef struct MemoryContextData *MemoryContext;
+
+/*
+ * A memory context can have callback functions registered on it.  Any such
+ * function will be called once just before the context is next reset or
+ * deleted.  The MemoryContextCallback struct describing such a callback
+ * typically would be allocated within the context itself, thereby avoiding
+ * any need to manage it explicitly (the reset/delete action will free it).
+ */
+typedef void (*MemoryContextCallbackFunction) (void *arg);
+
+typedef struct MemoryContextCallback
+{
+	MemoryContextCallbackFunction func; /* function to call */
+	void	   *arg;			/* argument to pass it */
+	struct MemoryContextCallback *next; /* next in list of callbacks */
+} MemoryContextCallback;
+
+/*
+ * CurrentMemoryContext is the default allocation context for palloc().
+ * Avoid accessing it directly!  Instead, use MemoryContextSwitchTo()
+ * to change the setting.
+ */
+extern PGDLLIMPORT __thread  MemoryContext CurrentMemoryContext;
+
+/*
+ * Flags for MemoryContextAllocExtended.
+ */
+#define MCXT_ALLOC_HUGE			0x01	/* allow huge allocation (> 1 GB) */
+#define MCXT_ALLOC_NO_OOM		0x02	/* no failure if out-of-memory */
+#define MCXT_ALLOC_ZERO			0x04	/* zero allocated memory */
+
+/*
+ * Fundamental memory-allocation operations (more are in utils/memutils.h)
+ */
+extern void *MemoryContextAlloc(MemoryContext context, Size size);
+extern void *MemoryContextAllocZero(MemoryContext context, Size size);
+extern void *MemoryContextAllocZeroAligned(MemoryContext context, Size size);
+extern void *MemoryContextAllocExtended(MemoryContext context,
+						   Size size, int flags);
+
+extern void *palloc(Size size);
+extern void *palloc0(Size size);
+extern void *palloc_extended(Size size, int flags);
+extern void *repalloc(void *pointer, Size size);
+extern void pfree(void *pointer);
+
+/*
+ * The result of palloc() is always word-aligned, so we can skip testing
+ * alignment of the pointer when deciding which MemSet variant to use.
+ * Note that this variant does not offer any advantage, and should not be
+ * used, unless its "sz" argument is a compile-time constant; therefore, the
+ * issue that it evaluates the argument multiple times isn't a problem in
+ * practice.
+ */
+#define palloc0fast(sz) \
+	( MemSetTest(0, sz) ? \
+		MemoryContextAllocZeroAligned(CurrentMemoryContext, sz) : \
+		MemoryContextAllocZero(CurrentMemoryContext, sz) )
+
+/* Higher-limit allocators. */
+extern void *MemoryContextAllocHuge(MemoryContext context, Size size);
+extern void *repalloc_huge(void *pointer, Size size);
+
+/*
+ * MemoryContextSwitchTo can't be a macro in standard C compilers.
+ * But we can make it an inline function if the compiler supports it.
+ * See STATIC_IF_INLINE in c.h.
+ *
+ * Although this header file is nominally backend-only, certain frontend
+ * programs like pg_controldata include it via postgres.h.  For some compilers
+ * it's necessary to hide the inline definition of MemoryContextSwitchTo in
+ * this scenario; hence the #ifndef FRONTEND.
+ */
+
+#ifndef FRONTEND
+#ifndef PG_USE_INLINE
+extern MemoryContext MemoryContextSwitchTo(MemoryContext context);
+#endif   /* !PG_USE_INLINE */
+#if defined(PG_USE_INLINE) || defined(MCXT_INCLUDE_DEFINITIONS)
+STATIC_IF_INLINE MemoryContext
+MemoryContextSwitchTo(MemoryContext context)
+{
+	MemoryContext old = CurrentMemoryContext;
+
+	CurrentMemoryContext = context;
+	return old;
+}
+#endif   /* PG_USE_INLINE || MCXT_INCLUDE_DEFINITIONS */
+#endif   /* FRONTEND */
+
+/* Registration of memory context reset/delete callbacks */
+extern void MemoryContextRegisterResetCallback(MemoryContext context,
+								   MemoryContextCallback *cb);
+
+/*
+ * These are like standard strdup() except the copied string is
+ * allocated in a context, not with malloc().
+ */
+extern char *MemoryContextStrdup(MemoryContext context, const char *string);
+extern char *pstrdup(const char *in);
+extern char *pnstrdup(const char *in, Size len);
+
+/* sprintf into a palloc'd buffer --- these are in psprintf.c */
+extern char *psprintf(const char *fmt,...) pg_attribute_printf(1, 2);
+extern size_t pvsnprintf(char *buf, size_t len, const char *fmt, va_list args) pg_attribute_printf(3, 0);
+
+#endif   /* PALLOC_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/pg_locale.h b/foreign/libpg_query/src/postgres/include/utils/pg_locale.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/pg_locale.h
@@ -0,0 +1,84 @@
+/*-----------------------------------------------------------------------
+ *
+ * PostgreSQL locale utilities
+ *
+ * src/include/utils/pg_locale.h
+ *
+ * Copyright (c) 2002-2015, PostgreSQL Global Development Group
+ *
+ *-----------------------------------------------------------------------
+ */
+
+#ifndef _PG_LOCALE_
+#define _PG_LOCALE_
+
+#include <locale.h>
+#if defined(LOCALE_T_IN_XLOCALE) || defined(WCSTOMBS_L_IN_XLOCALE)
+#include <xlocale.h>
+#endif
+
+#include "utils/guc.h"
+
+
+/* GUC settings */
+extern char *locale_messages;
+extern char *locale_monetary;
+extern char *locale_numeric;
+extern char *locale_time;
+
+/* lc_time localization cache */
+extern char *localized_abbrev_days[];
+extern char *localized_full_days[];
+extern char *localized_abbrev_months[];
+extern char *localized_full_months[];
+
+
+extern bool check_locale_messages(char **newval, void **extra, GucSource source);
+extern void assign_locale_messages(const char *newval, void *extra);
+extern bool check_locale_monetary(char **newval, void **extra, GucSource source);
+extern void assign_locale_monetary(const char *newval, void *extra);
+extern bool check_locale_numeric(char **newval, void **extra, GucSource source);
+extern void assign_locale_numeric(const char *newval, void *extra);
+extern bool check_locale_time(char **newval, void **extra, GucSource source);
+extern void assign_locale_time(const char *newval, void *extra);
+
+extern bool check_locale(int category, const char *locale, char **canonname);
+extern char *pg_perm_setlocale(int category, const char *locale);
+extern void check_strxfrm_bug(void);
+
+extern bool lc_collate_is_c(Oid collation);
+extern bool lc_ctype_is_c(Oid collation);
+
+/*
+ * Return the POSIX lconv struct (contains number/money formatting
+ * information) with locale information for all categories.
+ */
+extern struct lconv *PGLC_localeconv(void);
+
+extern void cache_locale_time(void);
+
+
+/*
+ * We define our own wrapper around locale_t so we can keep the same
+ * function signatures for all builds, while not having to create a
+ * fake version of the standard type locale_t in the global namespace.
+ * The fake version of pg_locale_t can be checked for truth; that's
+ * about all it will be needed for.
+ */
+#ifdef HAVE_LOCALE_T
+typedef locale_t pg_locale_t;
+#else
+typedef int pg_locale_t;
+#endif
+
+extern pg_locale_t pg_newlocale_from_collation(Oid collid);
+
+/* These functions convert from/to libc's wchar_t, *not* pg_wchar_t */
+#ifdef USE_WIDE_UPPER_LOWER
+extern size_t wchar2char(char *to, const wchar_t *from, size_t tolen,
+		   pg_locale_t locale);
+extern size_t char2wchar(wchar_t *to, size_t tolen,
+		   const char *from, size_t fromlen, pg_locale_t locale);
+#endif
+
+#endif   /* _PG_LOCALE_ */
diff --git a/foreign/libpg_query/src/postgres/include/utils/plancache.h b/foreign/libpg_query/src/postgres/include/utils/plancache.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/plancache.h
@@ -0,0 +1,178 @@
+/*-------------------------------------------------------------------------
+ *
+ * plancache.h
+ *	  Plan cache definitions.
+ *
+ * See plancache.c for comments.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/plancache.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PLANCACHE_H
+#define PLANCACHE_H
+
+#include "access/tupdesc.h"
+#include "nodes/params.h"
+
+#define CACHEDPLANSOURCE_MAGIC		195726186
+#define CACHEDPLAN_MAGIC			953717834
+
+/*
+ * CachedPlanSource (which might better have been called CachedQuery)
+ * represents a SQL query that we expect to use multiple times.  It stores
+ * the query source text, the raw parse tree, and the analyzed-and-rewritten
+ * query tree, as well as adjunct data.  Cache invalidation can happen as a
+ * result of DDL affecting objects used by the query.  In that case we discard
+ * the analyzed-and-rewritten query tree, and rebuild it when next needed.
+ *
+ * An actual execution plan, represented by CachedPlan, is derived from the
+ * CachedPlanSource when we need to execute the query.  The plan could be
+ * either generic (usable with any set of plan parameters) or custom (for a
+ * specific set of parameters).  plancache.c contains the logic that decides
+ * which way to do it for any particular execution.  If we are using a generic
+ * cached plan then it is meant to be re-used across multiple executions, so
+ * callers must always treat CachedPlans as read-only.
+ *
+ * Once successfully built and "saved", CachedPlanSources typically live
+ * for the life of the backend, although they can be dropped explicitly.
+ * CachedPlans are reference-counted and go away automatically when the last
+ * reference is dropped.  A CachedPlan can outlive the CachedPlanSource it
+ * was created from.
+ *
+ * An "unsaved" CachedPlanSource can be used for generating plans, but it
+ * lives in transient storage and will not be updated in response to sinval
+ * events.
+ *
+ * CachedPlans made from saved CachedPlanSources are likewise in permanent
+ * storage, so to avoid memory leaks, the reference-counted references to them
+ * must be held in permanent data structures or ResourceOwners.  CachedPlans
+ * made from unsaved CachedPlanSources are in children of the caller's
+ * memory context, so references to them should not be longer-lived than
+ * that context.  (Reference counting is somewhat pro forma in that case,
+ * though it may be useful if the CachedPlan can be discarded early.)
+ *
+ * A CachedPlanSource has two associated memory contexts: one that holds the
+ * struct itself, the query source text and the raw parse tree, and another
+ * context that holds the rewritten query tree and associated data.  This
+ * allows the query tree to be discarded easily when it is invalidated.
+ *
+ * Some callers wish to use the CachedPlan API even with one-shot queries
+ * that have no reason to be saved at all.  We therefore support a "oneshot"
+ * variant that does no data copying or invalidation checking.  In this case
+ * there are no separate memory contexts: the CachedPlanSource struct and
+ * all subsidiary data live in the caller's CurrentMemoryContext, and there
+ * is no way to free memory short of clearing that entire context.  A oneshot
+ * plan is always treated as unsaved.
+ *
+ * Note: the string referenced by commandTag is not subsidiary storage;
+ * it is assumed to be a compile-time-constant string.  As with portals,
+ * commandTag shall be NULL if and only if the original query string (before
+ * rewriting) was an empty string.
+ */
+typedef struct CachedPlanSource
+{
+	int			magic;			/* should equal CACHEDPLANSOURCE_MAGIC */
+	Node	   *raw_parse_tree; /* output of raw_parser(), or NULL */
+	const char *query_string;	/* source text of query */
+	const char *commandTag;		/* command tag (a constant!), or NULL */
+	Oid		   *param_types;	/* array of parameter type OIDs, or NULL */
+	int			num_params;		/* length of param_types array */
+	ParserSetupHook parserSetup;	/* alternative parameter spec method */
+	void	   *parserSetupArg;
+	int			cursor_options; /* cursor options used for planning */
+	bool		fixed_result;	/* disallow change in result tupdesc? */
+	TupleDesc	resultDesc;		/* result type; NULL = doesn't return tuples */
+	MemoryContext context;		/* memory context holding all above */
+	/* These fields describe the current analyzed-and-rewritten query tree: */
+	List	   *query_list;		/* list of Query nodes, or NIL if not valid */
+	List	   *relationOids;	/* OIDs of relations the queries depend on */
+	List	   *invalItems;		/* other dependencies, as PlanInvalItems */
+	struct OverrideSearchPath *search_path;		/* search_path used for
+												 * parsing and planning */
+	Oid			planUserId;		/* User-id that the plan depends on */
+	MemoryContext query_context;	/* context holding the above, or NULL */
+	/* If we have a generic plan, this is a reference-counted link to it: */
+	struct CachedPlan *gplan;	/* generic plan, or NULL if not valid */
+	/* Some state flags: */
+	bool		is_oneshot;		/* is it a "oneshot" plan? */
+	bool		is_complete;	/* has CompleteCachedPlan been done? */
+	bool		is_saved;		/* has CachedPlanSource been "saved"? */
+	bool		is_valid;		/* is the query_list currently valid? */
+	int			generation;		/* increments each time we create a plan */
+	/* If CachedPlanSource has been saved, it is a member of a global list */
+	struct CachedPlanSource *next_saved;		/* list link, if so */
+	/* State kept to help decide whether to use custom or generic plans: */
+	double		generic_cost;	/* cost of generic plan, or -1 if not known */
+	double		total_custom_cost;		/* total cost of custom plans so far */
+	int			num_custom_plans;		/* number of plans included in total */
+	bool		hasRowSecurity; /* planned with row security? */
+	bool		row_security_env;		/* row security setting when planned */
+} CachedPlanSource;
+
+/*
+ * CachedPlan represents an execution plan derived from a CachedPlanSource.
+ * The reference count includes both the link from the parent CachedPlanSource
+ * (if any), and any active plan executions, so the plan can be discarded
+ * exactly when refcount goes to zero.  Both the struct itself and the
+ * subsidiary data live in the context denoted by the context field.
+ * This makes it easy to free a no-longer-needed cached plan.  (However,
+ * if is_oneshot is true, the context does not belong solely to the CachedPlan
+ * so no freeing is possible.)
+ */
+typedef struct CachedPlan
+{
+	int			magic;			/* should equal CACHEDPLAN_MAGIC */
+	List	   *stmt_list;		/* list of statement nodes (PlannedStmts and
+								 * bare utility statements) */
+	bool		is_oneshot;		/* is it a "oneshot" plan? */
+	bool		is_saved;		/* is CachedPlan in a long-lived context? */
+	bool		is_valid;		/* is the stmt_list currently valid? */
+	TransactionId saved_xmin;	/* if valid, replan when TransactionXmin
+								 * changes from this value */
+	int			generation;		/* parent's generation number for this plan */
+	int			refcount;		/* count of live references to this struct */
+	MemoryContext context;		/* context containing this CachedPlan */
+} CachedPlan;
+
+
+extern void InitPlanCache(void);
+extern void ResetPlanCache(void);
+
+extern CachedPlanSource *CreateCachedPlan(Node *raw_parse_tree,
+				 const char *query_string,
+				 const char *commandTag);
+extern CachedPlanSource *CreateOneShotCachedPlan(Node *raw_parse_tree,
+						const char *query_string,
+						const char *commandTag);
+extern void CompleteCachedPlan(CachedPlanSource *plansource,
+				   List *querytree_list,
+				   MemoryContext querytree_context,
+				   Oid *param_types,
+				   int num_params,
+				   ParserSetupHook parserSetup,
+				   void *parserSetupArg,
+				   int cursor_options,
+				   bool fixed_result);
+
+extern void SaveCachedPlan(CachedPlanSource *plansource);
+extern void DropCachedPlan(CachedPlanSource *plansource);
+
+extern void CachedPlanSetParentContext(CachedPlanSource *plansource,
+						   MemoryContext newcontext);
+
+extern CachedPlanSource *CopyCachedPlan(CachedPlanSource *plansource);
+
+extern bool CachedPlanIsValid(CachedPlanSource *plansource);
+
+extern List *CachedPlanGetTargetList(CachedPlanSource *plansource);
+
+extern CachedPlan *GetCachedPlan(CachedPlanSource *plansource,
+			  ParamListInfo boundParams,
+			  bool useResOwner);
+extern void ReleaseCachedPlan(CachedPlan *plan, bool useResOwner);
+
+#endif   /* PLANCACHE_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/portal.h b/foreign/libpg_query/src/postgres/include/utils/portal.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/portal.h
@@ -0,0 +1,231 @@
+/*-------------------------------------------------------------------------
+ *
+ * portal.h
+ *	  POSTGRES portal definitions.
+ *
+ * A portal is an abstraction which represents the execution state of
+ * a running or runnable query.  Portals support both SQL-level CURSORs
+ * and protocol-level portals.
+ *
+ * Scrolling (nonsequential access) and suspension of execution are allowed
+ * only for portals that contain a single SELECT-type query.  We do not want
+ * to let the client suspend an update-type query partway through!	Because
+ * the query rewriter does not allow arbitrary ON SELECT rewrite rules,
+ * only queries that were originally update-type could produce multiple
+ * plan trees; so the restriction to a single query is not a problem
+ * in practice.
+ *
+ * For SQL cursors, we support three kinds of scroll behavior:
+ *
+ * (1) Neither NO SCROLL nor SCROLL was specified: to remain backward
+ *	   compatible, we allow backward fetches here, unless it would
+ *	   impose additional runtime overhead to do so.
+ *
+ * (2) NO SCROLL was specified: don't allow any backward fetches.
+ *
+ * (3) SCROLL was specified: allow all kinds of backward fetches, even
+ *	   if we need to take a performance hit to do so.  (The planner sticks
+ *	   a Materialize node atop the query plan if needed.)
+ *
+ * Case #1 is converted to #2 or #3 by looking at the query itself and
+ * determining if scrollability can be supported without additional
+ * overhead.
+ *
+ * Protocol-level portals have no nonsequential-fetch API and so the
+ * distinction doesn't matter for them.  They are always initialized
+ * to look like NO SCROLL cursors.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/portal.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PORTAL_H
+#define PORTAL_H
+
+#include "datatype/timestamp.h"
+#include "executor/execdesc.h"
+#include "utils/plancache.h"
+#include "utils/resowner.h"
+
+/*
+ * We have several execution strategies for Portals, depending on what
+ * query or queries are to be executed.  (Note: in all cases, a Portal
+ * executes just a single source-SQL query, and thus produces just a
+ * single result from the user's viewpoint.  However, the rule rewriter
+ * may expand the single source query to zero or many actual queries.)
+ *
+ * PORTAL_ONE_SELECT: the portal contains one single SELECT query.  We run
+ * the Executor incrementally as results are demanded.  This strategy also
+ * supports holdable cursors (the Executor results can be dumped into a
+ * tuplestore for access after transaction completion).
+ *
+ * PORTAL_ONE_RETURNING: the portal contains a single INSERT/UPDATE/DELETE
+ * query with a RETURNING clause (plus possibly auxiliary queries added by
+ * rule rewriting).  On first execution, we run the portal to completion
+ * and dump the primary query's results into the portal tuplestore; the
+ * results are then returned to the client as demanded.  (We can't support
+ * suspension of the query partway through, because the AFTER TRIGGER code
+ * can't cope, and also because we don't want to risk failing to execute
+ * all the auxiliary queries.)
+ *
+ * PORTAL_ONE_MOD_WITH: the portal contains one single SELECT query, but
+ * it has data-modifying CTEs.  This is currently treated the same as the
+ * PORTAL_ONE_RETURNING case because of the possibility of needing to fire
+ * triggers.  It may act more like PORTAL_ONE_SELECT in future.
+ *
+ * PORTAL_UTIL_SELECT: the portal contains a utility statement that returns
+ * a SELECT-like result (for example, EXPLAIN or SHOW).  On first execution,
+ * we run the statement and dump its results into the portal tuplestore;
+ * the results are then returned to the client as demanded.
+ *
+ * PORTAL_MULTI_QUERY: all other cases.  Here, we do not support partial
+ * execution: the portal's queries will be run to completion on first call.
+ */
+typedef enum PortalStrategy
+{
+	PORTAL_ONE_SELECT,
+	PORTAL_ONE_RETURNING,
+	PORTAL_ONE_MOD_WITH,
+	PORTAL_UTIL_SELECT,
+	PORTAL_MULTI_QUERY
+} PortalStrategy;
+
+/*
+ * A portal is always in one of these states.  It is possible to transit
+ * from ACTIVE back to READY if the query is not run to completion;
+ * otherwise we never back up in status.
+ */
+typedef enum PortalStatus
+{
+	PORTAL_NEW,					/* freshly created */
+	PORTAL_DEFINED,				/* PortalDefineQuery done */
+	PORTAL_READY,				/* PortalStart complete, can run it */
+	PORTAL_ACTIVE,				/* portal is running (can't delete it) */
+	PORTAL_DONE,				/* portal is finished (don't re-run it) */
+	PORTAL_FAILED				/* portal got error (can't re-run it) */
+} PortalStatus;
+
+typedef struct PortalData *Portal;
+
+typedef struct PortalData
+{
+	/* Bookkeeping data */
+	const char *name;			/* portal's name */
+	const char *prepStmtName;	/* source prepared statement (NULL if none) */
+	MemoryContext heap;			/* subsidiary memory for portal */
+	ResourceOwner resowner;		/* resources owned by portal */
+	void		(*cleanup) (Portal portal);		/* cleanup hook */
+
+	/*
+	 * State data for remembering which subtransaction(s) the portal was
+	 * created or used in.  If the portal is held over from a previous
+	 * transaction, both subxids are InvalidSubTransactionId.  Otherwise,
+	 * createSubid is the creating subxact and activeSubid is the last subxact
+	 * in which we ran the portal.
+	 */
+	SubTransactionId createSubid;		/* the creating subxact */
+	SubTransactionId activeSubid;		/* the last subxact with activity */
+
+	/* The query or queries the portal will execute */
+	const char *sourceText;		/* text of query (as of 8.4, never NULL) */
+	const char *commandTag;		/* command tag for original query */
+	List	   *stmts;			/* PlannedStmts and/or utility statements */
+	CachedPlan *cplan;			/* CachedPlan, if stmts are from one */
+
+	ParamListInfo portalParams; /* params to pass to query */
+
+	/* Features/options */
+	PortalStrategy strategy;	/* see above */
+	int			cursorOptions;	/* DECLARE CURSOR option bits */
+
+	/* Status data */
+	PortalStatus status;		/* see above */
+	bool		portalPinned;	/* a pinned portal can't be dropped */
+
+	/* If not NULL, Executor is active; call ExecutorEnd eventually: */
+	QueryDesc  *queryDesc;		/* info needed for executor invocation */
+
+	/* If portal returns tuples, this is their tupdesc: */
+	TupleDesc	tupDesc;		/* descriptor for result tuples */
+	/* and these are the format codes to use for the columns: */
+	int16	   *formats;		/* a format code for each column */
+
+	/*
+	 * Where we store tuples for a held cursor or a PORTAL_ONE_RETURNING or
+	 * PORTAL_UTIL_SELECT query.  (A cursor held past the end of its
+	 * transaction no longer has any active executor state.)
+	 */
+	Tuplestorestate *holdStore; /* store for holdable cursors */
+	MemoryContext holdContext;	/* memory containing holdStore */
+
+	/*
+	 * atStart, atEnd and portalPos indicate the current cursor position.
+	 * portalPos is zero before the first row, N after fetching N'th row of
+	 * query.  After we run off the end, portalPos = # of rows in query, and
+	 * atEnd is true.  If portalPos overflows, set posOverflow (this causes us
+	 * to stop relying on its value for navigation).  Note that atStart
+	 * implies portalPos == 0, but not the reverse (portalPos could have
+	 * overflowed).
+	 */
+	bool		atStart;
+	bool		atEnd;
+	bool		posOverflow;
+	long		portalPos;
+
+	/* Presentation data, primarily used by the pg_cursors system view */
+	TimestampTz creation_time;	/* time at which this portal was defined */
+	bool		visible;		/* include this portal in pg_cursors? */
+}	PortalData;
+
+/*
+ * PortalIsValid
+ *		True iff portal is valid.
+ */
+#define PortalIsValid(p) PointerIsValid(p)
+
+/*
+ * Access macros for Portal ... use these in preference to field access.
+ */
+#define PortalGetQueryDesc(portal)	((portal)->queryDesc)
+#define PortalGetHeapMemory(portal) ((portal)->heap)
+#define PortalGetPrimaryStmt(portal) PortalListGetPrimaryStmt((portal)->stmts)
+
+
+/* Prototypes for functions in utils/mmgr/portalmem.c */
+extern void EnablePortalManager(void);
+extern bool PreCommit_Portals(bool isPrepare);
+extern void AtAbort_Portals(void);
+extern void AtCleanup_Portals(void);
+extern void AtSubCommit_Portals(SubTransactionId mySubid,
+					SubTransactionId parentSubid,
+					ResourceOwner parentXactOwner);
+extern void AtSubAbort_Portals(SubTransactionId mySubid,
+				   SubTransactionId parentSubid,
+				   ResourceOwner myXactOwner,
+				   ResourceOwner parentXactOwner);
+extern void AtSubCleanup_Portals(SubTransactionId mySubid);
+extern Portal CreatePortal(const char *name, bool allowDup, bool dupSilent);
+extern Portal CreateNewPortal(void);
+extern void PinPortal(Portal portal);
+extern void UnpinPortal(Portal portal);
+extern void MarkPortalActive(Portal portal);
+extern void MarkPortalDone(Portal portal);
+extern void MarkPortalFailed(Portal portal);
+extern void PortalDrop(Portal portal, bool isTopCommit);
+extern Portal GetPortalByName(const char *name);
+extern void PortalDefineQuery(Portal portal,
+				  const char *prepStmtName,
+				  const char *sourceText,
+				  const char *commandTag,
+				  List *stmts,
+				  CachedPlan *cplan);
+extern Node *PortalListGetPrimaryStmt(List *stmts);
+extern void PortalCreateHoldStore(Portal portal);
+extern void PortalHashTableDeleteAll(void);
+extern bool ThereAreNoReadyPortals(void);
+
+#endif   /* PORTAL_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/probes.h b/foreign/libpg_query/src/postgres/include/utils/probes.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/probes.h
@@ -0,0 +1,114 @@
+#define TRACE_POSTGRESQL_TRANSACTION_START(INT1)
+#define TRACE_POSTGRESQL_TRANSACTION_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_TRANSACTION_COMMIT(INT1)
+#define TRACE_POSTGRESQL_TRANSACTION_COMMIT_ENABLED() (0)
+#define TRACE_POSTGRESQL_TRANSACTION_ABORT(INT1)
+#define TRACE_POSTGRESQL_TRANSACTION_ABORT_ENABLED() (0)
+#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE(INT1, INT2, INT3)
+#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_ENABLED() (0)
+#define TRACE_POSTGRESQL_LWLOCK_RELEASE(INT1, INT2)
+#define TRACE_POSTGRESQL_LWLOCK_RELEASE_ENABLED() (0)
+#define TRACE_POSTGRESQL_LWLOCK_WAIT_START(INT1, INT2, INT3)
+#define TRACE_POSTGRESQL_LWLOCK_WAIT_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_LWLOCK_WAIT_DONE(INT1, INT2, INT3)
+#define TRACE_POSTGRESQL_LWLOCK_WAIT_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE(INT1, INT2, INT3)
+#define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_ENABLED() (0)
+#define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL(INT1, INT2, INT3)
+#define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL_ENABLED() (0)
+#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_OR_WAIT(INT1, INT2, INT3)
+#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_OR_WAIT_ENABLED() (0)
+#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_OR_WAIT_FAIL(INT1, INT2, INT3)
+#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_OR_WAIT_FAIL_ENABLED() (0)
+#define TRACE_POSTGRESQL_LOCK_WAIT_START(INT1, INT2, INT3, INT4, INT5, INT6)
+#define TRACE_POSTGRESQL_LOCK_WAIT_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_LOCK_WAIT_DONE(INT1, INT2, INT3, INT4, INT5, INT6)
+#define TRACE_POSTGRESQL_LOCK_WAIT_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_QUERY_PARSE_START(INT1)
+#define TRACE_POSTGRESQL_QUERY_PARSE_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_QUERY_PARSE_DONE(INT1)
+#define TRACE_POSTGRESQL_QUERY_PARSE_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_QUERY_REWRITE_START(INT1)
+#define TRACE_POSTGRESQL_QUERY_REWRITE_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_QUERY_REWRITE_DONE(INT1)
+#define TRACE_POSTGRESQL_QUERY_REWRITE_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_QUERY_PLAN_START()
+#define TRACE_POSTGRESQL_QUERY_PLAN_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_QUERY_PLAN_DONE()
+#define TRACE_POSTGRESQL_QUERY_PLAN_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_QUERY_EXECUTE_START()
+#define TRACE_POSTGRESQL_QUERY_EXECUTE_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_QUERY_EXECUTE_DONE()
+#define TRACE_POSTGRESQL_QUERY_EXECUTE_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_QUERY_START(INT1)
+#define TRACE_POSTGRESQL_QUERY_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_QUERY_DONE(INT1)
+#define TRACE_POSTGRESQL_QUERY_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_STATEMENT_STATUS(INT1)
+#define TRACE_POSTGRESQL_STATEMENT_STATUS_ENABLED() (0)
+#define TRACE_POSTGRESQL_SORT_START(INT1, INT2, INT3, INT4, INT5)
+#define TRACE_POSTGRESQL_SORT_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_SORT_DONE(INT1, INT2)
+#define TRACE_POSTGRESQL_SORT_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_BUFFER_READ_START(INT1, INT2, INT3, INT4, INT5, INT6, INT7)
+#define TRACE_POSTGRESQL_BUFFER_READ_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_BUFFER_READ_DONE(INT1, INT2, INT3, INT4, INT5, INT6, INT7, INT8)
+#define TRACE_POSTGRESQL_BUFFER_READ_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_BUFFER_FLUSH_START(INT1, INT2, INT3, INT4, INT5)
+#define TRACE_POSTGRESQL_BUFFER_FLUSH_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_BUFFER_FLUSH_DONE(INT1, INT2, INT3, INT4, INT5)
+#define TRACE_POSTGRESQL_BUFFER_FLUSH_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_START(INT1)
+#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_SYNC_START()
+#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_SYNC_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_DONE()
+#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_BUFFER_SYNC_START(INT1, INT2)
+#define TRACE_POSTGRESQL_BUFFER_SYNC_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN(INT1)
+#define TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN_ENABLED() (0)
+#define TRACE_POSTGRESQL_BUFFER_SYNC_DONE(INT1, INT2, INT3)
+#define TRACE_POSTGRESQL_BUFFER_SYNC_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_START(INT1, INT2, INT3, INT4, INT5)
+#define TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_DONE(INT1, INT2, INT3, INT4, INT5)
+#define TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_DEADLOCK_FOUND()
+#define TRACE_POSTGRESQL_DEADLOCK_FOUND_ENABLED() (0)
+#define TRACE_POSTGRESQL_CHECKPOINT_START(INT1)
+#define TRACE_POSTGRESQL_CHECKPOINT_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_CHECKPOINT_DONE(INT1, INT2, INT3, INT4, INT5)
+#define TRACE_POSTGRESQL_CHECKPOINT_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_CLOG_CHECKPOINT_START(INT1)
+#define TRACE_POSTGRESQL_CLOG_CHECKPOINT_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_CLOG_CHECKPOINT_DONE(INT1)
+#define TRACE_POSTGRESQL_CLOG_CHECKPOINT_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_START(INT1)
+#define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_DONE(INT1)
+#define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_START(INT1)
+#define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_DONE(INT1)
+#define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_START()
+#define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_DONE()
+#define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_SMGR_MD_READ_START(INT1, INT2, INT3, INT4, INT5, INT6)
+#define TRACE_POSTGRESQL_SMGR_MD_READ_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_SMGR_MD_READ_DONE(INT1, INT2, INT3, INT4, INT5, INT6, INT7, INT8)
+#define TRACE_POSTGRESQL_SMGR_MD_READ_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_SMGR_MD_WRITE_START(INT1, INT2, INT3, INT4, INT5, INT6)
+#define TRACE_POSTGRESQL_SMGR_MD_WRITE_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_SMGR_MD_WRITE_DONE(INT1, INT2, INT3, INT4, INT5, INT6, INT7, INT8)
+#define TRACE_POSTGRESQL_SMGR_MD_WRITE_DONE_ENABLED() (0)
+#define TRACE_POSTGRESQL_XLOG_INSERT(INT1, INT2)
+#define TRACE_POSTGRESQL_XLOG_INSERT_ENABLED() (0)
+#define TRACE_POSTGRESQL_XLOG_SWITCH()
+#define TRACE_POSTGRESQL_XLOG_SWITCH_ENABLED() (0)
+#define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_START()
+#define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_START_ENABLED() (0)
+#define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_DONE()
+#define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_DONE_ENABLED() (0)
diff --git a/foreign/libpg_query/src/postgres/include/utils/ps_status.h b/foreign/libpg_query/src/postgres/include/utils/ps_status.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/ps_status.h
@@ -0,0 +1,26 @@
+/*-------------------------------------------------------------------------
+ *
+ * ps_status.h
+ *
+ * Declarations for backend/utils/misc/ps_status.c
+ *
+ * src/include/utils/ps_status.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef PS_STATUS_H
+#define PS_STATUS_H
+
+extern bool update_process_title;
+
+extern char **save_ps_display_args(int argc, char **argv);
+
+extern void init_ps_display(const char *username, const char *dbname,
+				const char *host_info, const char *initial_str);
+
+extern void set_ps_display(const char *activity, bool force);
+
+extern const char *get_ps_display(int *displen);
+
+#endif   /* PS_STATUS_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/rel.h b/foreign/libpg_query/src/postgres/include/utils/rel.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/rel.h
@@ -0,0 +1,513 @@
+/*-------------------------------------------------------------------------
+ *
+ * rel.h
+ *	  POSTGRES relation descriptor (a/k/a relcache entry) definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/rel.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef REL_H
+#define REL_H
+
+#include "access/tupdesc.h"
+#include "catalog/pg_am.h"
+#include "catalog/pg_class.h"
+#include "catalog/pg_index.h"
+#include "fmgr.h"
+#include "nodes/bitmapset.h"
+#include "rewrite/prs2lock.h"
+#include "storage/block.h"
+#include "storage/relfilenode.h"
+#include "utils/relcache.h"
+#include "utils/reltrigger.h"
+
+
+/*
+ * LockRelId and LockInfo really belong to lmgr.h, but it's more convenient
+ * to declare them here so we can have a LockInfoData field in a Relation.
+ */
+
+typedef struct LockRelId
+{
+	Oid			relId;			/* a relation identifier */
+	Oid			dbId;			/* a database identifier */
+} LockRelId;
+
+typedef struct LockInfoData
+{
+	LockRelId	lockRelId;
+} LockInfoData;
+
+typedef LockInfoData *LockInfo;
+
+
+/*
+ * Cached lookup information for the frequently used index access method
+ * functions, defined by the pg_am row associated with an index relation.
+ */
+typedef struct RelationAmInfo
+{
+	FmgrInfo	aminsert;
+	FmgrInfo	ambeginscan;
+	FmgrInfo	amgettuple;
+	FmgrInfo	amgetbitmap;
+	FmgrInfo	amrescan;
+	FmgrInfo	amendscan;
+	FmgrInfo	ammarkpos;
+	FmgrInfo	amrestrpos;
+	FmgrInfo	amcanreturn;
+} RelationAmInfo;
+
+/*
+ * Here are the contents of a relation cache entry.
+ */
+
+typedef struct RelationData
+{
+	RelFileNode rd_node;		/* relation physical identifier */
+	/* use "struct" here to avoid needing to include smgr.h: */
+	struct SMgrRelationData *rd_smgr;	/* cached file handle, or NULL */
+	int			rd_refcnt;		/* reference count */
+	BackendId	rd_backend;		/* owning backend id, if temporary relation */
+	bool		rd_islocaltemp; /* rel is a temp rel of this session */
+	bool		rd_isnailed;	/* rel is nailed in cache */
+	bool		rd_isvalid;		/* relcache entry is valid */
+	char		rd_indexvalid;	/* state of rd_indexlist: 0 = not valid, 1 =
+								 * valid, 2 = temporarily forced */
+
+	/*
+	 * rd_createSubid is the ID of the highest subtransaction the rel has
+	 * survived into; or zero if the rel was not created in the current top
+	 * transaction.  This can be now be relied on, whereas previously it could
+	 * be "forgotten" in earlier releases. Likewise, rd_newRelfilenodeSubid is
+	 * the ID of the highest subtransaction the relfilenode change has
+	 * survived into, or zero if not changed in the current transaction (or we
+	 * have forgotten changing it). rd_newRelfilenodeSubid can be forgotten
+	 * when a relation has multiple new relfilenodes within a single
+	 * transaction, with one of them occurring in a subsequently aborted
+	 * subtransaction, e.g. BEGIN; TRUNCATE t; SAVEPOINT save; TRUNCATE t;
+	 * ROLLBACK TO save; -- rd_newRelfilenode is now forgotten
+	 */
+	SubTransactionId rd_createSubid;	/* rel was created in current xact */
+	SubTransactionId rd_newRelfilenodeSubid;	/* new relfilenode assigned in
+												 * current xact */
+
+	Form_pg_class rd_rel;		/* RELATION tuple */
+	TupleDesc	rd_att;			/* tuple descriptor */
+	Oid			rd_id;			/* relation's object id */
+	LockInfoData rd_lockInfo;	/* lock mgr's info for locking relation */
+	RuleLock   *rd_rules;		/* rewrite rules */
+	MemoryContext rd_rulescxt;	/* private memory cxt for rd_rules, if any */
+	TriggerDesc *trigdesc;		/* Trigger info, or NULL if rel has none */
+	/* use "struct" here to avoid needing to include rowsecurity.h: */
+	struct RowSecurityDesc *rd_rsdesc;	/* row security policies, or NULL */
+
+	/* data managed by RelationGetIndexList: */
+	List	   *rd_indexlist;	/* list of OIDs of indexes on relation */
+	Oid			rd_oidindex;	/* OID of unique index on OID, if any */
+	Oid			rd_replidindex; /* OID of replica identity index, if any */
+
+	/* data managed by RelationGetIndexAttrBitmap: */
+	Bitmapset  *rd_indexattr;	/* identifies columns used in indexes */
+	Bitmapset  *rd_keyattr;		/* cols that can be ref'd by foreign keys */
+	Bitmapset  *rd_idattr;		/* included in replica identity index */
+
+	/*
+	 * rd_options is set whenever rd_rel is loaded into the relcache entry.
+	 * Note that you can NOT look into rd_rel for this data.  NULL means "use
+	 * defaults".
+	 */
+	bytea	   *rd_options;		/* parsed pg_class.reloptions */
+
+	/* These are non-NULL only for an index relation: */
+	Form_pg_index rd_index;		/* pg_index tuple describing this index */
+	/* use "struct" here to avoid needing to include htup.h: */
+	struct HeapTupleData *rd_indextuple;		/* all of pg_index tuple */
+	Form_pg_am	rd_am;			/* pg_am tuple for index's AM */
+
+	/*
+	 * index access support info (used only for an index relation)
+	 *
+	 * Note: only default support procs for each opclass are cached, namely
+	 * those with lefttype and righttype equal to the opclass's opcintype. The
+	 * arrays are indexed by support function number, which is a sufficient
+	 * identifier given that restriction.
+	 *
+	 * Note: rd_amcache is available for index AMs to cache private data about
+	 * an index.  This must be just a cache since it may get reset at any time
+	 * (in particular, it will get reset by a relcache inval message for the
+	 * index).  If used, it must point to a single memory chunk palloc'd in
+	 * rd_indexcxt.  A relcache reset will include freeing that chunk and
+	 * setting rd_amcache = NULL.
+	 */
+	MemoryContext rd_indexcxt;	/* private memory cxt for this stuff */
+	RelationAmInfo *rd_aminfo;	/* lookup info for funcs found in pg_am */
+	Oid		   *rd_opfamily;	/* OIDs of op families for each index col */
+	Oid		   *rd_opcintype;	/* OIDs of opclass declared input data types */
+	RegProcedure *rd_support;	/* OIDs of support procedures */
+	FmgrInfo   *rd_supportinfo; /* lookup info for support procedures */
+	int16	   *rd_indoption;	/* per-column AM-specific flags */
+	List	   *rd_indexprs;	/* index expression trees, if any */
+	List	   *rd_indpred;		/* index predicate tree, if any */
+	Oid		   *rd_exclops;		/* OIDs of exclusion operators, if any */
+	Oid		   *rd_exclprocs;	/* OIDs of exclusion ops' procs, if any */
+	uint16	   *rd_exclstrats;	/* exclusion ops' strategy numbers, if any */
+	void	   *rd_amcache;		/* available for use by index AM */
+	Oid		   *rd_indcollation;	/* OIDs of index collations */
+
+	/*
+	 * foreign-table support
+	 *
+	 * rd_fdwroutine must point to a single memory chunk palloc'd in
+	 * CacheMemoryContext.  It will be freed and reset to NULL on a relcache
+	 * reset.
+	 */
+
+	/* use "struct" here to avoid needing to include fdwapi.h: */
+	struct FdwRoutine *rd_fdwroutine;	/* cached function pointers, or NULL */
+
+	/*
+	 * Hack for CLUSTER, rewriting ALTER TABLE, etc: when writing a new
+	 * version of a table, we need to make any toast pointers inserted into it
+	 * have the existing toast table's OID, not the OID of the transient toast
+	 * table.  If rd_toastoid isn't InvalidOid, it is the OID to place in
+	 * toast pointers inserted into this rel.  (Note it's set on the new
+	 * version of the main heap, not the toast table itself.)  This also
+	 * causes toast_save_datum() to try to preserve toast value OIDs.
+	 */
+	Oid			rd_toastoid;	/* Real TOAST table's OID, or InvalidOid */
+
+	/* use "struct" here to avoid needing to include pgstat.h: */
+	struct PgStat_TableStatus *pgstat_info;		/* statistics collection area */
+} RelationData;
+
+/*
+ * StdRdOptions
+ *		Standard contents of rd_options for heaps and generic indexes.
+ *
+ * RelationGetFillFactor() and RelationGetTargetPageFreeSpace() can only
+ * be applied to relations that use this format or a superset for
+ * private options data.
+ */
+ /* autovacuum-related reloptions. */
+typedef struct AutoVacOpts
+{
+	bool		enabled;
+	int			vacuum_threshold;
+	int			analyze_threshold;
+	int			vacuum_cost_delay;
+	int			vacuum_cost_limit;
+	int			freeze_min_age;
+	int			freeze_max_age;
+	int			freeze_table_age;
+	int			multixact_freeze_min_age;
+	int			multixact_freeze_max_age;
+	int			multixact_freeze_table_age;
+	int			log_min_duration;
+	float8		vacuum_scale_factor;
+	float8		analyze_scale_factor;
+} AutoVacOpts;
+
+typedef struct StdRdOptions
+{
+	int32		vl_len_;		/* varlena header (do not touch directly!) */
+	int			fillfactor;		/* page fill factor in percent (0..100) */
+	AutoVacOpts autovacuum;		/* autovacuum-related options */
+	bool		user_catalog_table;		/* use as an additional catalog
+										 * relation */
+} StdRdOptions;
+
+#define HEAP_MIN_FILLFACTOR			10
+#define HEAP_DEFAULT_FILLFACTOR		100
+
+/*
+ * RelationGetFillFactor
+ *		Returns the relation's fillfactor.  Note multiple eval of argument!
+ */
+#define RelationGetFillFactor(relation, defaultff) \
+	((relation)->rd_options ? \
+	 ((StdRdOptions *) (relation)->rd_options)->fillfactor : (defaultff))
+
+/*
+ * RelationGetTargetPageUsage
+ *		Returns the relation's desired space usage per page in bytes.
+ */
+#define RelationGetTargetPageUsage(relation, defaultff) \
+	(BLCKSZ * RelationGetFillFactor(relation, defaultff) / 100)
+
+/*
+ * RelationGetTargetPageFreeSpace
+ *		Returns the relation's desired freespace per page in bytes.
+ */
+#define RelationGetTargetPageFreeSpace(relation, defaultff) \
+	(BLCKSZ * (100 - RelationGetFillFactor(relation, defaultff)) / 100)
+
+/*
+ * RelationIsUsedAsCatalogTable
+ *		Returns whether the relation should be treated as a catalog table
+ *		from the pov of logical decoding.  Note multiple eval or argument!
+ */
+#define RelationIsUsedAsCatalogTable(relation)	\
+	((relation)->rd_options ?				\
+	 ((StdRdOptions *) (relation)->rd_options)->user_catalog_table : false)
+
+
+/*
+ * ViewOptions
+ *		Contents of rd_options for views
+ */
+typedef struct ViewOptions
+{
+	int32		vl_len_;		/* varlena header (do not touch directly!) */
+	bool		security_barrier;
+	int			check_option_offset;
+} ViewOptions;
+
+/*
+ * RelationIsSecurityView
+ *		Returns whether the relation is security view, or not.  Note multiple
+ *		eval of argument!
+ */
+#define RelationIsSecurityView(relation)	\
+	((relation)->rd_options ?				\
+	 ((ViewOptions *) (relation)->rd_options)->security_barrier : false)
+
+/*
+ * RelationHasCheckOption
+ *		Returns true if the relation is a view defined with either the local
+ *		or the cascaded check option.  Note multiple eval of argument!
+ */
+#define RelationHasCheckOption(relation)									\
+	((relation)->rd_options &&												\
+	 ((ViewOptions *) (relation)->rd_options)->check_option_offset != 0)
+
+/*
+ * RelationHasLocalCheckOption
+ *		Returns true if the relation is a view defined with the local check
+ *		option.  Note multiple eval of argument!
+ */
+#define RelationHasLocalCheckOption(relation)								\
+	((relation)->rd_options &&												\
+	 ((ViewOptions *) (relation)->rd_options)->check_option_offset != 0 ?	\
+	 strcmp((char *) (relation)->rd_options +								\
+			((ViewOptions *) (relation)->rd_options)->check_option_offset,	\
+			"local") == 0 : false)
+
+/*
+ * RelationHasCascadedCheckOption
+ *		Returns true if the relation is a view defined with the cascaded check
+ *		option.  Note multiple eval of argument!
+ */
+#define RelationHasCascadedCheckOption(relation)							\
+	((relation)->rd_options &&												\
+	 ((ViewOptions *) (relation)->rd_options)->check_option_offset != 0 ?	\
+	 strcmp((char *) (relation)->rd_options +								\
+			((ViewOptions *) (relation)->rd_options)->check_option_offset,	\
+			"cascaded") == 0 : false)
+
+
+/*
+ * RelationIsValid
+ *		True iff relation descriptor is valid.
+ */
+#define RelationIsValid(relation) PointerIsValid(relation)
+
+#define InvalidRelation ((Relation) NULL)
+
+/*
+ * RelationHasReferenceCountZero
+ *		True iff relation reference count is zero.
+ *
+ * Note:
+ *		Assumes relation descriptor is valid.
+ */
+#define RelationHasReferenceCountZero(relation) \
+		((bool)((relation)->rd_refcnt == 0))
+
+/*
+ * RelationGetForm
+ *		Returns pg_class tuple for a relation.
+ *
+ * Note:
+ *		Assumes relation descriptor is valid.
+ */
+#define RelationGetForm(relation) ((relation)->rd_rel)
+
+/*
+ * RelationGetRelid
+ *		Returns the OID of the relation
+ */
+#define RelationGetRelid(relation) ((relation)->rd_id)
+
+/*
+ * RelationGetNumberOfAttributes
+ *		Returns the number of attributes in a relation.
+ */
+#define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts)
+
+/*
+ * RelationGetDescr
+ *		Returns tuple descriptor for a relation.
+ */
+#define RelationGetDescr(relation) ((relation)->rd_att)
+
+/*
+ * RelationGetRelationName
+ *		Returns the rel's name.
+ *
+ * Note that the name is only unique within the containing namespace.
+ */
+#define RelationGetRelationName(relation) \
+	(NameStr((relation)->rd_rel->relname))
+
+/*
+ * RelationGetNamespace
+ *		Returns the rel's namespace OID.
+ */
+#define RelationGetNamespace(relation) \
+	((relation)->rd_rel->relnamespace)
+
+/*
+ * RelationIsMapped
+ *		True if the relation uses the relfilenode map.
+ *
+ * NB: this is only meaningful for relkinds that have storage, else it
+ * will misleadingly say "true".
+ */
+#define RelationIsMapped(relation) \
+	((relation)->rd_rel->relfilenode == InvalidOid)
+
+/*
+ * RelationOpenSmgr
+ *		Open the relation at the smgr level, if not already done.
+ */
+#define RelationOpenSmgr(relation) \
+	do { \
+		if ((relation)->rd_smgr == NULL) \
+			smgrsetowner(&((relation)->rd_smgr), smgropen((relation)->rd_node, (relation)->rd_backend)); \
+	} while (0)
+
+/*
+ * RelationCloseSmgr
+ *		Close the relation at the smgr level, if not already done.
+ *
+ * Note: smgrclose should unhook from owner pointer, hence the Assert.
+ */
+#define RelationCloseSmgr(relation) \
+	do { \
+		if ((relation)->rd_smgr != NULL) \
+		{ \
+			smgrclose((relation)->rd_smgr); \
+			Assert((relation)->rd_smgr == NULL); \
+		} \
+	} while (0)
+
+/*
+ * RelationGetTargetBlock
+ *		Fetch relation's current insertion target block.
+ *
+ * Returns InvalidBlockNumber if there is no current target block.  Note
+ * that the target block status is discarded on any smgr-level invalidation.
+ */
+#define RelationGetTargetBlock(relation) \
+	( (relation)->rd_smgr != NULL ? (relation)->rd_smgr->smgr_targblock : InvalidBlockNumber )
+
+/*
+ * RelationSetTargetBlock
+ *		Set relation's current insertion target block.
+ */
+#define RelationSetTargetBlock(relation, targblock) \
+	do { \
+		RelationOpenSmgr(relation); \
+		(relation)->rd_smgr->smgr_targblock = (targblock); \
+	} while (0)
+
+/*
+ * RelationNeedsWAL
+ *		True if relation needs WAL.
+ */
+#define RelationNeedsWAL(relation) \
+	((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
+
+/*
+ * RelationUsesLocalBuffers
+ *		True if relation's pages are stored in local buffers.
+ */
+#define RelationUsesLocalBuffers(relation) \
+	((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP)
+
+/*
+ * RELATION_IS_LOCAL
+ *		If a rel is either temp or newly created in the current transaction,
+ *		it can be assumed to be accessible only to the current backend.
+ *		This is typically used to decide that we can skip acquiring locks.
+ *
+ * Beware of multiple eval of argument
+ */
+#define RELATION_IS_LOCAL(relation) \
+	((relation)->rd_islocaltemp || \
+	 (relation)->rd_createSubid != InvalidSubTransactionId)
+
+/*
+ * RELATION_IS_OTHER_TEMP
+ *		Test for a temporary relation that belongs to some other session.
+ *
+ * Beware of multiple eval of argument
+ */
+#define RELATION_IS_OTHER_TEMP(relation) \
+	((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP && \
+	 !(relation)->rd_islocaltemp)
+
+
+/*
+ * RelationIsScannable
+ *		Currently can only be false for a materialized view which has not been
+ *		populated by its query.  This is likely to get more complicated later,
+ *		so use a macro which looks like a function.
+ */
+#define RelationIsScannable(relation) ((relation)->rd_rel->relispopulated)
+
+/*
+ * RelationIsPopulated
+ *		Currently, we don't physically distinguish the "populated" and
+ *		"scannable" properties of matviews, but that may change later.
+ *		Hence, use the appropriate one of these macros in code tests.
+ */
+#define RelationIsPopulated(relation) ((relation)->rd_rel->relispopulated)
+
+/*
+ * RelationIsAccessibleInLogicalDecoding
+ *		True if we need to log enough information to have access via
+ *		decoding snapshot.
+ */
+#define RelationIsAccessibleInLogicalDecoding(relation) \
+	(XLogLogicalInfoActive() && \
+	 RelationNeedsWAL(relation) && \
+	 (IsCatalogRelation(relation) || RelationIsUsedAsCatalogTable(relation)))
+
+/*
+ * RelationIsLogicallyLogged
+ *		True if we need to log enough information to extract the data from the
+ *		WAL stream.
+ *
+ * We don't log information for unlogged tables (since they don't WAL log
+ * anyway) and for system tables (their content is hard to make sense of, and
+ * it would complicate decoding slightly for little gain). Note that we *do*
+ * log information for user defined catalog tables since they presumably are
+ * interesting to the user...
+ */
+#define RelationIsLogicallyLogged(relation) \
+	(XLogLogicalInfoActive() && \
+	 RelationNeedsWAL(relation) && \
+	 !IsCatalogRelation(relation))
+
+/* routines in utils/cache/relcache.c */
+extern void RelationIncrementReferenceCount(Relation rel);
+extern void RelationDecrementReferenceCount(Relation rel);
+
+#endif   /* REL_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/relcache.h b/foreign/libpg_query/src/postgres/include/utils/relcache.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/relcache.h
@@ -0,0 +1,130 @@
+/*-------------------------------------------------------------------------
+ *
+ * relcache.h
+ *	  Relation descriptor cache definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/relcache.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef RELCACHE_H
+#define RELCACHE_H
+
+#include "access/tupdesc.h"
+#include "nodes/bitmapset.h"
+
+
+typedef struct RelationData *Relation;
+
+/* ----------------
+ *		RelationPtr is used in the executor to support index scans
+ *		where we have to keep track of several index relations in an
+ *		array.  -cim 9/10/89
+ * ----------------
+ */
+typedef Relation *RelationPtr;
+
+/*
+ * Routines to open (lookup) and close a relcache entry
+ */
+extern Relation RelationIdGetRelation(Oid relationId);
+extern void RelationClose(Relation relation);
+
+/*
+ * Routines to compute/retrieve additional cached information
+ */
+extern List *RelationGetIndexList(Relation relation);
+extern Oid	RelationGetOidIndex(Relation relation);
+extern Oid	RelationGetReplicaIndex(Relation relation);
+extern List *RelationGetIndexExpressions(Relation relation);
+extern List *RelationGetIndexPredicate(Relation relation);
+
+typedef enum IndexAttrBitmapKind
+{
+	INDEX_ATTR_BITMAP_ALL,
+	INDEX_ATTR_BITMAP_KEY,
+	INDEX_ATTR_BITMAP_IDENTITY_KEY
+} IndexAttrBitmapKind;
+
+extern Bitmapset *RelationGetIndexAttrBitmap(Relation relation,
+						   IndexAttrBitmapKind keyAttrs);
+
+extern void RelationGetExclusionInfo(Relation indexRelation,
+						 Oid **operators,
+						 Oid **procs,
+						 uint16 **strategies);
+
+extern void RelationSetIndexList(Relation relation,
+					 List *indexIds, Oid oidIndex);
+
+extern void RelationInitIndexAccessInfo(Relation relation);
+
+/*
+ * Routines to support ereport() reports of relation-related errors
+ */
+extern int	errtable(Relation rel);
+extern int	errtablecol(Relation rel, int attnum);
+extern int	errtablecolname(Relation rel, const char *colname);
+extern int	errtableconstraint(Relation rel, const char *conname);
+
+/*
+ * Routines for backend startup
+ */
+extern void RelationCacheInitialize(void);
+extern void RelationCacheInitializePhase2(void);
+extern void RelationCacheInitializePhase3(void);
+
+/*
+ * Routine to create a relcache entry for an about-to-be-created relation
+ */
+extern Relation RelationBuildLocalRelation(const char *relname,
+						   Oid relnamespace,
+						   TupleDesc tupDesc,
+						   Oid relid,
+						   Oid relfilenode,
+						   Oid reltablespace,
+						   bool shared_relation,
+						   bool mapped_relation,
+						   char relpersistence,
+						   char relkind);
+
+/*
+ * Routine to manage assignment of new relfilenode to a relation
+ */
+extern void RelationSetNewRelfilenode(Relation relation, char persistence,
+						  TransactionId freezeXid, MultiXactId minmulti);
+
+/*
+ * Routines for flushing/rebuilding relcache entries in various scenarios
+ */
+extern void RelationForgetRelation(Oid rid);
+
+extern void RelationCacheInvalidateEntry(Oid relationId);
+
+extern void RelationCacheInvalidate(void);
+
+extern void RelationCloseSmgrByOid(Oid relationId);
+
+extern void AtEOXact_RelationCache(bool isCommit);
+extern void AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid,
+						  SubTransactionId parentSubid);
+
+/*
+ * Routines to help manage rebuilding of relcache init files
+ */
+extern bool RelationIdIsInInitFile(Oid relationId);
+extern void RelationCacheInitFilePreInvalidate(void);
+extern void RelationCacheInitFilePostInvalidate(void);
+extern void RelationCacheInitFileRemove(void);
+
+/* should be used only by relcache.c and catcache.c */
+extern bool criticalRelcachesBuilt;
+
+/* should be used only by relcache.c and postinit.c */
+extern bool criticalSharedRelcachesBuilt;
+
+#endif   /* RELCACHE_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/reltrigger.h b/foreign/libpg_query/src/postgres/include/utils/reltrigger.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/reltrigger.h
@@ -0,0 +1,73 @@
+/*-------------------------------------------------------------------------
+ *
+ * reltrigger.h
+ *	  POSTGRES relation trigger definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/reltrigger.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef RELTRIGGER_H
+#define RELTRIGGER_H
+
+
+/*
+ * These struct really belongs to trigger.h, but we put it separately so that
+ * it can be cleanly included in rel.h and other places.
+ */
+
+typedef struct Trigger
+{
+	Oid			tgoid;			/* OID of trigger (pg_trigger row) */
+	/* Remaining fields are copied from pg_trigger, see pg_trigger.h */
+	char	   *tgname;
+	Oid			tgfoid;
+	int16		tgtype;
+	char		tgenabled;
+	bool		tgisinternal;
+	Oid			tgconstrrelid;
+	Oid			tgconstrindid;
+	Oid			tgconstraint;
+	bool		tgdeferrable;
+	bool		tginitdeferred;
+	int16		tgnargs;
+	int16		tgnattr;
+	int16	   *tgattr;
+	char	  **tgargs;
+	char	   *tgqual;
+} Trigger;
+
+typedef struct TriggerDesc
+{
+	Trigger    *triggers;		/* array of Trigger structs */
+	int			numtriggers;	/* number of array entries */
+
+	/*
+	 * These flags indicate whether the array contains at least one of each
+	 * type of trigger.  We use these to skip searching the array if not.
+	 */
+	bool		trig_insert_before_row;
+	bool		trig_insert_after_row;
+	bool		trig_insert_instead_row;
+	bool		trig_insert_before_statement;
+	bool		trig_insert_after_statement;
+	bool		trig_update_before_row;
+	bool		trig_update_after_row;
+	bool		trig_update_instead_row;
+	bool		trig_update_before_statement;
+	bool		trig_update_after_statement;
+	bool		trig_delete_before_row;
+	bool		trig_delete_after_row;
+	bool		trig_delete_instead_row;
+	bool		trig_delete_before_statement;
+	bool		trig_delete_after_statement;
+	/* there are no row-level truncate triggers */
+	bool		trig_truncate_before_statement;
+	bool		trig_truncate_after_statement;
+} TriggerDesc;
+
+#endif   /* RELTRIGGER_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/resowner.h b/foreign/libpg_query/src/postgres/include/utils/resowner.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/resowner.h
@@ -0,0 +1,82 @@
+/*-------------------------------------------------------------------------
+ *
+ * resowner.h
+ *	  POSTGRES resource owner definitions.
+ *
+ * Query-lifespan resources are tracked by associating them with
+ * ResourceOwner objects.  This provides a simple mechanism for ensuring
+ * that such resources are freed at the right time.
+ * See utils/resowner/README for more info.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/resowner.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef RESOWNER_H
+#define RESOWNER_H
+
+
+/*
+ * ResourceOwner objects are an opaque data structure known only within
+ * resowner.c.
+ */
+typedef struct ResourceOwnerData *ResourceOwner;
+
+
+/*
+ * Globally known ResourceOwners
+ */
+extern PGDLLIMPORT ResourceOwner CurrentResourceOwner;
+extern PGDLLIMPORT ResourceOwner CurTransactionResourceOwner;
+extern PGDLLIMPORT ResourceOwner TopTransactionResourceOwner;
+
+/*
+ * Resource releasing is done in three phases: pre-locks, locks, and
+ * post-locks.  The pre-lock phase must release any resources that are
+ * visible to other backends (such as pinned buffers); this ensures that
+ * when we release a lock that another backend may be waiting on, it will
+ * see us as being fully out of our transaction.  The post-lock phase
+ * should be used for backend-internal cleanup.
+ */
+typedef enum
+{
+	RESOURCE_RELEASE_BEFORE_LOCKS,
+	RESOURCE_RELEASE_LOCKS,
+	RESOURCE_RELEASE_AFTER_LOCKS
+} ResourceReleasePhase;
+
+/*
+ *	Dynamically loaded modules can get control during ResourceOwnerRelease
+ *	by providing a callback of this form.
+ */
+typedef void (*ResourceReleaseCallback) (ResourceReleasePhase phase,
+													 bool isCommit,
+													 bool isTopLevel,
+													 void *arg);
+
+
+/*
+ * Functions in resowner.c
+ */
+
+/* generic routines */
+extern ResourceOwner ResourceOwnerCreate(ResourceOwner parent,
+					const char *name);
+extern void ResourceOwnerRelease(ResourceOwner owner,
+					 ResourceReleasePhase phase,
+					 bool isCommit,
+					 bool isTopLevel);
+extern void ResourceOwnerDelete(ResourceOwner owner);
+extern ResourceOwner ResourceOwnerGetParent(ResourceOwner owner);
+extern void ResourceOwnerNewParent(ResourceOwner owner,
+					   ResourceOwner newparent);
+extern void RegisterResourceReleaseCallback(ResourceReleaseCallback callback,
+								void *arg);
+extern void UnregisterResourceReleaseCallback(ResourceReleaseCallback callback,
+								  void *arg);
+
+#endif   /* RESOWNER_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/rls.h b/foreign/libpg_query/src/postgres/include/utils/rls.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/rls.h
@@ -0,0 +1,50 @@
+/*-------------------------------------------------------------------------
+ *
+ * rls.h
+ *	  Header file for Row Level Security (RLS) utility commands to be used
+ *	  with the rowsecurity feature.
+ *
+ * Copyright (c) 2007-2015, PostgreSQL Global Development Group
+ *
+ * src/include/utils/rls.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef RLS_H
+#define RLS_H
+
+/* GUC variable */
+extern bool row_security;
+
+/*
+ * Used by callers of check_enable_rls.
+ *
+ * RLS could be completely disabled on the tables involved in the query,
+ * which is the simple case, or it may depend on the current environment
+ * (the role which is running the query or the value of the row_security
+ * GUC), or it might be simply enabled as usual.
+ *
+ * If RLS isn't on the table involved then RLS_NONE is returned to indicate
+ * that we don't need to worry about invalidating the query plan for RLS
+ * reasons.  If RLS is on the table, but we are bypassing it for now, then
+ * we return RLS_NONE_ENV to indicate that, if the environment changes,
+ * we need to invalidate and replan.  Finally, if RLS should be turned on
+ * for the query, then we return RLS_ENABLED, which means we also need to
+ * invalidate if the environment changes.
+ *
+ * Note that RLS_ENABLED will also be returned if noError is true
+ * (indicating that the caller simply want to know if RLS should be applied
+ * for this user but doesn't want an error thrown if it is; this is used
+ * by other error cases where we're just trying to decide if data from the
+ * table should be passed back to the user or not).
+ */
+enum CheckEnableRlsResult
+{
+	RLS_NONE,
+	RLS_NONE_ENV,
+	RLS_ENABLED
+};
+
+extern int	check_enable_rls(Oid relid, Oid checkAsUser, bool noError);
+
+#endif   /* RLS_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/ruleutils.h b/foreign/libpg_query/src/postgres/include/utils/ruleutils.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/ruleutils.h
@@ -0,0 +1,35 @@
+/*-------------------------------------------------------------------------
+ *
+ * ruleutils.h
+ *		Declarations for ruleutils.c
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/ruleutils.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef RULEUTILS_H
+#define RULEUTILS_H
+
+#include "nodes/nodes.h"
+#include "nodes/parsenodes.h"
+#include "nodes/pg_list.h"
+
+
+extern char *pg_get_indexdef_string(Oid indexrelid);
+extern char *pg_get_indexdef_columns(Oid indexrelid, bool pretty);
+
+extern char *pg_get_constraintdef_command(Oid constraintId);
+extern char *deparse_expression(Node *expr, List *dpcontext,
+				   bool forceprefix, bool showimplicit);
+extern List *deparse_context_for(const char *aliasname, Oid relid);
+extern List *deparse_context_for_plan_rtable(List *rtable, List *rtable_names);
+extern List *set_deparse_context_planstate(List *dpcontext,
+							  Node *planstate, List *ancestors);
+extern List *select_rtable_names_for_explain(List *rtable,
+								Bitmapset *rels_used);
+extern char *generate_collation_name(Oid collid);
+
+#endif   /* RULEUTILS_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/snapmgr.h b/foreign/libpg_query/src/postgres/include/utils/snapmgr.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/snapmgr.h
@@ -0,0 +1,72 @@
+/*-------------------------------------------------------------------------
+ *
+ * snapmgr.h
+ *	  POSTGRES snapshot manager
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/snapmgr.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef SNAPMGR_H
+#define SNAPMGR_H
+
+#include "fmgr.h"
+#include "utils/resowner.h"
+#include "utils/snapshot.h"
+
+
+extern bool FirstSnapshotSet;
+
+extern TransactionId TransactionXmin;
+extern TransactionId RecentXmin;
+extern TransactionId RecentGlobalXmin;
+extern TransactionId RecentGlobalDataXmin;
+
+extern Snapshot GetTransactionSnapshot(void);
+extern Snapshot GetLatestSnapshot(void);
+extern void SnapshotSetCommandId(CommandId curcid);
+
+extern Snapshot GetCatalogSnapshot(Oid relid);
+extern Snapshot GetNonHistoricCatalogSnapshot(Oid relid);
+extern void InvalidateCatalogSnapshot(void);
+
+extern void PushActiveSnapshot(Snapshot snapshot);
+extern void PushCopiedSnapshot(Snapshot snapshot);
+extern void UpdateActiveSnapshotCommandId(void);
+extern void PopActiveSnapshot(void);
+extern Snapshot GetActiveSnapshot(void);
+extern bool ActiveSnapshotSet(void);
+
+extern Snapshot RegisterSnapshot(Snapshot snapshot);
+extern void UnregisterSnapshot(Snapshot snapshot);
+extern Snapshot RegisterSnapshotOnOwner(Snapshot snapshot, ResourceOwner owner);
+extern void UnregisterSnapshotFromOwner(Snapshot snapshot, ResourceOwner owner);
+
+extern void AtSubCommit_Snapshot(int level);
+extern void AtSubAbort_Snapshot(int level);
+extern void AtEOXact_Snapshot(bool isCommit);
+
+extern Datum pg_export_snapshot(PG_FUNCTION_ARGS);
+extern void ImportSnapshot(const char *idstr);
+extern bool XactHasExportedSnapshots(void);
+extern void DeleteAllExportedSnapshotFiles(void);
+extern bool ThereAreNoPriorRegisteredSnapshots(void);
+
+extern char *ExportSnapshot(Snapshot snapshot);
+
+/* Support for catalog timetravel for logical decoding */
+struct HTAB;
+extern struct HTAB *HistoricSnapshotGetTupleCids(void);
+extern void SetupHistoricSnapshot(Snapshot snapshot_now, struct HTAB *tuplecids);
+extern void TeardownHistoricSnapshot(bool is_error);
+extern bool HistoricSnapshotActive(void);
+
+extern Size EstimateSnapshotSpace(Snapshot snapshot);
+extern void SerializeSnapshot(Snapshot snapshot, char *start_address);
+extern Snapshot RestoreSnapshot(char *start_address);
+extern void RestoreTransactionSnapshot(Snapshot snapshot, void *master_pgproc);
+
+#endif   /* SNAPMGR_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/snapshot.h b/foreign/libpg_query/src/postgres/include/utils/snapshot.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/snapshot.h
@@ -0,0 +1,124 @@
+/*-------------------------------------------------------------------------
+ *
+ * snapshot.h
+ *	  POSTGRES snapshot definition
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/snapshot.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef SNAPSHOT_H
+#define SNAPSHOT_H
+
+#include "access/htup.h"
+#include "lib/pairingheap.h"
+#include "storage/buf.h"
+
+
+typedef struct SnapshotData *Snapshot;
+
+#define InvalidSnapshot		((Snapshot) NULL)
+
+/*
+ * We use SnapshotData structures to represent both "regular" (MVCC)
+ * snapshots and "special" snapshots that have non-MVCC semantics.
+ * The specific semantics of a snapshot are encoded by the "satisfies"
+ * function.
+ */
+typedef bool (*SnapshotSatisfiesFunc) (HeapTuple htup,
+										   Snapshot snapshot, Buffer buffer);
+
+/*
+ * Struct representing all kind of possible snapshots.
+ *
+ * There are several different kinds of snapshots:
+ * * Normal MVCC snapshots
+ * * MVCC snapshots taken during recovery (in Hot-Standby mode)
+ * * Historic MVCC snapshots used during logical decoding
+ * * snapshots passed to HeapTupleSatisfiesDirty()
+ * * snapshots used for SatisfiesAny, Toast, Self where no members are
+ *	 accessed.
+ *
+ * TODO: It's probably a good idea to split this struct using a NodeTag
+ * similar to how parser and executor nodes are handled, with one type for
+ * each different kind of snapshot to avoid overloading the meaning of
+ * individual fields.
+ */
+typedef struct SnapshotData
+{
+	SnapshotSatisfiesFunc satisfies;	/* tuple test function */
+
+	/*
+	 * The remaining fields are used only for MVCC snapshots, and are normally
+	 * just zeroes in special snapshots.  (But xmin and xmax are used
+	 * specially by HeapTupleSatisfiesDirty.)
+	 *
+	 * An MVCC snapshot can never see the effects of XIDs >= xmax. It can see
+	 * the effects of all older XIDs except those listed in the snapshot. xmin
+	 * is stored as an optimization to avoid needing to search the XID arrays
+	 * for most tuples.
+	 */
+	TransactionId xmin;			/* all XID < xmin are visible to me */
+	TransactionId xmax;			/* all XID >= xmax are invisible to me */
+
+	/*
+	 * For normal MVCC snapshot this contains the all xact IDs that are in
+	 * progress, unless the snapshot was taken during recovery in which case
+	 * it's empty. For historic MVCC snapshots, the meaning is inverted, i.e.
+	 * it contains *committed* transactions between xmin and xmax.
+	 *
+	 * note: all ids in xip[] satisfy xmin <= xip[i] < xmax
+	 */
+	TransactionId *xip;
+	uint32		xcnt;			/* # of xact ids in xip[] */
+
+	/*
+	 * For non-historic MVCC snapshots, this contains subxact IDs that are in
+	 * progress (and other transactions that are in progress if taken during
+	 * recovery). For historic snapshot it contains *all* xids assigned to the
+	 * replayed transaction, including the toplevel xid.
+	 *
+	 * note: all ids in subxip[] are >= xmin, but we don't bother filtering
+	 * out any that are >= xmax
+	 */
+	TransactionId *subxip;
+	int32		subxcnt;		/* # of xact ids in subxip[] */
+	bool		suboverflowed;	/* has the subxip array overflowed? */
+
+	bool		takenDuringRecovery;	/* recovery-shaped snapshot? */
+	bool		copied;			/* false if it's a static snapshot */
+
+	CommandId	curcid;			/* in my xact, CID < curcid are visible */
+
+	/*
+	 * An extra return value for HeapTupleSatisfiesDirty, not used in MVCC
+	 * snapshots.
+	 */
+	uint32		speculativeToken;
+
+	/*
+	 * Book-keeping information, used by the snapshot manager
+	 */
+	uint32		active_count;	/* refcount on ActiveSnapshot stack */
+	uint32		regd_count;		/* refcount on RegisteredSnapshots */
+	pairingheap_node ph_node;	/* link in the RegisteredSnapshots heap */
+} SnapshotData;
+
+/*
+ * Result codes for HeapTupleSatisfiesUpdate.  This should really be in
+ * tqual.h, but we want to avoid including that file elsewhere.
+ */
+typedef enum
+{
+	HeapTupleMayBeUpdated,
+	HeapTupleInvisible,
+	HeapTupleSelfUpdated,
+	HeapTupleUpdated,
+	HeapTupleBeingUpdated,
+	HeapTupleWouldBlock			/* can be returned by heap_tuple_lock */
+} HTSU_Result;
+
+#endif   /* SNAPSHOT_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/sortsupport.h b/foreign/libpg_query/src/postgres/include/utils/sortsupport.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/sortsupport.h
@@ -0,0 +1,291 @@
+/*-------------------------------------------------------------------------
+ *
+ * sortsupport.h
+ *	  Framework for accelerated sorting.
+ *
+ * Traditionally, PostgreSQL has implemented sorting by repeatedly invoking
+ * an SQL-callable comparison function "cmp(x, y) returns int" on pairs of
+ * values to be compared, where the comparison function is the BTORDER_PROC
+ * pg_amproc support function of the appropriate btree index opclass.
+ *
+ * This file defines alternative APIs that allow sorting to be performed with
+ * reduced overhead.  To support lower-overhead sorting, a btree opclass may
+ * provide a BTSORTSUPPORT_PROC pg_amproc entry, which must take a single
+ * argument of type internal and return void.  The argument is actually a
+ * pointer to a SortSupportData struct, which is defined below.
+ *
+ * If provided, the BTSORTSUPPORT function will be called during sort setup,
+ * and it must initialize the provided struct with pointers to function(s)
+ * that can be called to perform sorting.  This API is defined to allow
+ * multiple acceleration mechanisms to be supported, but no opclass is
+ * required to provide all of them.  The BTSORTSUPPORT function should
+ * simply not set any function pointers for mechanisms it doesn't support.
+ * Opclasses that provide BTSORTSUPPORT and don't provide a comparator
+ * function will have a shim set up by sort support automatically.  However,
+ * opclasses that support the optional additional abbreviated key capability
+ * must always provide an authoritative comparator used to tie-break
+ * inconclusive abbreviated comparisons and also used  when aborting
+ * abbreviation.  Furthermore, a converter and abort/costing function must be
+ * provided.
+ *
+ * All sort support functions will be passed the address of the
+ * SortSupportData struct when called, so they can use it to store
+ * additional private data as needed.  In particular, for collation-aware
+ * datatypes, the ssup_collation field is set before calling BTSORTSUPPORT
+ * and is available to all support functions.  Additional opclass-dependent
+ * data can be stored using the ssup_extra field.  Any such data
+ * should be allocated in the ssup_cxt memory context.
+ *
+ * Note: since pg_amproc functions are indexed by (lefttype, righttype)
+ * it is possible to associate a BTSORTSUPPORT function with a cross-type
+ * comparison.  This could sensibly be used to provide a fast comparator
+ * function for such cases, but probably not any other acceleration method.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/sortsupport.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef SORTSUPPORT_H
+#define SORTSUPPORT_H
+
+#include "access/attnum.h"
+#include "utils/relcache.h"
+
+typedef struct SortSupportData *SortSupport;
+
+typedef struct SortSupportData
+{
+	/*
+	 * These fields are initialized before calling the BTSORTSUPPORT function
+	 * and should not be changed later.
+	 */
+	MemoryContext ssup_cxt;		/* Context containing sort info */
+	Oid			ssup_collation; /* Collation to use, or InvalidOid */
+
+	/*
+	 * Additional sorting parameters; but unlike ssup_collation, these can be
+	 * changed after BTSORTSUPPORT is called, so don't use them in selecting
+	 * sort support functions.
+	 */
+	bool		ssup_reverse;	/* descending-order sort? */
+	bool		ssup_nulls_first;		/* sort nulls first? */
+
+	/*
+	 * These fields are workspace for callers, and should not be touched by
+	 * opclass-specific functions.
+	 */
+	AttrNumber	ssup_attno;		/* column number to sort */
+
+	/*
+	 * ssup_extra is zeroed before calling the BTSORTSUPPORT function, and is
+	 * not touched subsequently by callers.
+	 */
+	void	   *ssup_extra;		/* Workspace for opclass functions */
+
+	/*
+	 * Function pointers are zeroed before calling the BTSORTSUPPORT function,
+	 * and must be set by it for any acceleration methods it wants to supply.
+	 * The comparator pointer must be set, others are optional.
+	 */
+
+	/*
+	 * Comparator function has the same API as the traditional btree
+	 * comparison function, ie, return <0, 0, or >0 according as x is less
+	 * than, equal to, or greater than y.  Note that x and y are guaranteed
+	 * not null, and there is no way to return null either.  Do not return
+	 * INT_MIN, as callers are allowed to negate the result before using it.
+	 *
+	 * This may be either the authoritative comparator, or the abbreviated
+	 * comparator.  Core code may switch this over the initial preference of
+	 * an opclass support function despite originally indicating abbreviation
+	 * was applicable, by assigning the authoritative comparator back.
+	 */
+	int			(*comparator) (Datum x, Datum y, SortSupport ssup);
+
+	/*
+	 * "Abbreviated key" infrastructure follows.
+	 *
+	 * All callbacks must be set by sortsupport opclasses that make use of
+	 * this optional additional infrastructure (unless for whatever reasons
+	 * the opclass doesn't proceed with abbreviation, in which case
+	 * abbrev_converter must not be set).
+	 *
+	 * This allows opclass authors to supply a conversion routine, used to
+	 * create an alternative representation of the underlying type (an
+	 * "abbreviated key").  This representation must be pass-by-value and
+	 * typically will use some ad-hoc format that only the opclass has
+	 * knowledge of.  An alternative comparator, used only with this
+	 * alternative representation must also be provided (which is assigned to
+	 * "comparator").  This representation is a simple approximation of the
+	 * original Datum.  It must be possible to compare datums of this
+	 * representation with each other using the supplied alternative
+	 * comparator, and have any non-zero return value be a reliable proxy for
+	 * what a proper comparison would indicate. Returning zero from the
+	 * alternative comparator does not indicate equality, as with a
+	 * conventional support routine 1, though -- it indicates that it wasn't
+	 * possible to determine how the two abbreviated values compared.  A
+	 * proper comparison, using "abbrev_full_comparator"/
+	 * ApplySortAbbrevFullComparator() is therefore required.  In many cases
+	 * this results in most or all comparisons only using the cheap
+	 * alternative comparison func, which is typically implemented as code
+	 * that compiles to just a few CPU instructions.  CPU cache miss penalties
+	 * are expensive; to get good overall performance, sort infrastructure
+	 * must heavily weigh cache performance.
+	 *
+	 * Opclass authors must consider the final cardinality of abbreviated keys
+	 * when devising an encoding scheme.  It's possible for a strategy to work
+	 * better than an alternative strategy with one usage pattern, while the
+	 * reverse might be true for another usage pattern.  All of these factors
+	 * must be considered.
+	 */
+
+	/*
+	 * "abbreviate" concerns whether or not the abbreviated key optimization
+	 * is applicable in principle (that is, the sortsupport routine needs to
+	 * know if its dealing with a key where an abbreviated representation can
+	 * usefully be packed together.  Conventionally, this is the leading
+	 * attribute key).  Note, however, that in order to determine that
+	 * abbreviation is not in play, the core code always checks whether or not
+	 * the opclass has set abbrev_converter.  This is a one way, one time
+	 * message to the opclass.
+	 */
+	bool		abbreviate;
+
+	/*
+	 * Converter to abbreviated format, from original representation.  Core
+	 * code uses this callback to convert from a pass-by-reference "original"
+	 * Datum to a pass-by-value abbreviated key Datum.  Note that original is
+	 * guaranteed NOT NULL, because it doesn't make sense to factor NULLness
+	 * into ad-hoc cost model.
+	 *
+	 * abbrev_converter is tested to see if abbreviation is in play.  Core
+	 * code may set it to NULL to indicate abbreviation should not be used
+	 * (which is something sortsupport routines need not concern themselves
+	 * with). However, sortsupport routines must not set it when it is
+	 * immediately established that abbreviation should not proceed (e.g., for
+	 * !abbreviate calls, or due to platform-specific impediments to using
+	 * abbreviation).
+	 */
+	Datum		(*abbrev_converter) (Datum original, SortSupport ssup);
+
+	/*
+	 * abbrev_abort callback allows clients to verify that the current
+	 * strategy is working out, using a sortsupport routine defined ad-hoc
+	 * cost model. If there is a lot of duplicate abbreviated keys in
+	 * practice, it's useful to be able to abandon the strategy before paying
+	 * too high a cost in conversion (perhaps certain opclass-specific
+	 * adaptations are useful too).
+	 */
+	bool		(*abbrev_abort) (int memtupcount, SortSupport ssup);
+
+	/*
+	 * Full, authoritative comparator for key that an abbreviated
+	 * representation was generated for, used when an abbreviated comparison
+	 * was inconclusive (by calling ApplySortComparatorFull()), or used to
+	 * replace "comparator" when core system ultimately decides against
+	 * abbreviation.
+	 */
+	int			(*abbrev_full_comparator) (Datum x, Datum y, SortSupport ssup);
+} SortSupportData;
+
+
+/*
+ * ApplySortComparator should be inlined if possible.  See STATIC_IF_INLINE
+ * in c.h.
+ */
+#ifndef PG_USE_INLINE
+extern int ApplySortComparator(Datum datum1, bool isNull1,
+					Datum datum2, bool isNull2,
+					SortSupport ssup);
+extern int ApplySortAbbrevFullComparator(Datum datum1, bool isNull1,
+							  Datum datum2, bool isNull2,
+							  SortSupport ssup);
+#endif   /* !PG_USE_INLINE */
+#if defined(PG_USE_INLINE) || defined(SORTSUPPORT_INCLUDE_DEFINITIONS)
+/*
+ * Apply a sort comparator function and return a 3-way comparison result.
+ * This takes care of handling reverse-sort and NULLs-ordering properly.
+ */
+STATIC_IF_INLINE int
+ApplySortComparator(Datum datum1, bool isNull1,
+					Datum datum2, bool isNull2,
+					SortSupport ssup)
+{
+	int			compare;
+
+	if (isNull1)
+	{
+		if (isNull2)
+			compare = 0;		/* NULL "=" NULL */
+		else if (ssup->ssup_nulls_first)
+			compare = -1;		/* NULL "<" NOT_NULL */
+		else
+			compare = 1;		/* NULL ">" NOT_NULL */
+	}
+	else if (isNull2)
+	{
+		if (ssup->ssup_nulls_first)
+			compare = 1;		/* NOT_NULL ">" NULL */
+		else
+			compare = -1;		/* NOT_NULL "<" NULL */
+	}
+	else
+	{
+		compare = (*ssup->comparator) (datum1, datum2, ssup);
+		if (ssup->ssup_reverse)
+			compare = -compare;
+	}
+
+	return compare;
+}
+
+/*
+ * Apply a sort comparator function and return a 3-way comparison using full,
+ * authoritative comparator.  This takes care of handling reverse-sort and
+ * NULLs-ordering properly.
+ */
+STATIC_IF_INLINE int
+ApplySortAbbrevFullComparator(Datum datum1, bool isNull1,
+							  Datum datum2, bool isNull2,
+							  SortSupport ssup)
+{
+	int			compare;
+
+	if (isNull1)
+	{
+		if (isNull2)
+			compare = 0;		/* NULL "=" NULL */
+		else if (ssup->ssup_nulls_first)
+			compare = -1;		/* NULL "<" NOT_NULL */
+		else
+			compare = 1;		/* NULL ">" NOT_NULL */
+	}
+	else if (isNull2)
+	{
+		if (ssup->ssup_nulls_first)
+			compare = 1;		/* NOT_NULL ">" NULL */
+		else
+			compare = -1;		/* NOT_NULL "<" NULL */
+	}
+	else
+	{
+		compare = (*ssup->abbrev_full_comparator) (datum1, datum2, ssup);
+		if (ssup->ssup_reverse)
+			compare = -compare;
+	}
+
+	return compare;
+}
+#endif   /*-- PG_USE_INLINE || SORTSUPPORT_INCLUDE_DEFINITIONS */
+
+/* Other functions in utils/sort/sortsupport.c */
+extern void PrepareSortSupportComparisonShim(Oid cmpFunc, SortSupport ssup);
+extern void PrepareSortSupportFromOrderingOp(Oid orderingOp, SortSupport ssup);
+extern void PrepareSortSupportFromIndexRel(Relation indexRel, int16 strategy,
+							   SortSupport ssup);
+
+#endif   /* SORTSUPPORT_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/syscache.h b/foreign/libpg_query/src/postgres/include/utils/syscache.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/syscache.h
@@ -0,0 +1,197 @@
+/*-------------------------------------------------------------------------
+ *
+ * syscache.h
+ *	  System catalog cache definitions.
+ *
+ * See also lsyscache.h, which provides convenience routines for
+ * common cache-lookup operations.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/syscache.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef SYSCACHE_H
+#define SYSCACHE_H
+
+#include "access/attnum.h"
+#include "access/htup.h"
+/* we intentionally do not include utils/catcache.h here */
+
+/*
+ *		SysCache identifiers.
+ *
+ *		The order of these identifiers must match the order
+ *		of the entries in the array cacheinfo[] in syscache.c.
+ *		Keep them in alphabetical order (renumbering only costs a
+ *		backend rebuild).
+ */
+
+enum SysCacheIdentifier
+{
+	AGGFNOID = 0,
+	AMNAME,
+	AMOID,
+	AMOPOPID,
+	AMOPSTRATEGY,
+	AMPROCNUM,
+	ATTNAME,
+	ATTNUM,
+	AUTHMEMMEMROLE,
+	AUTHMEMROLEMEM,
+	AUTHNAME,
+	AUTHOID,
+	CASTSOURCETARGET,
+	CLAAMNAMENSP,
+	CLAOID,
+	COLLNAMEENCNSP,
+	COLLOID,
+	CONDEFAULT,
+	CONNAMENSP,
+	CONSTROID,
+	CONVOID,
+	DATABASEOID,
+	DEFACLROLENSPOBJ,
+	ENUMOID,
+	ENUMTYPOIDNAME,
+	EVENTTRIGGERNAME,
+	EVENTTRIGGEROID,
+	FOREIGNDATAWRAPPERNAME,
+	FOREIGNDATAWRAPPEROID,
+	FOREIGNSERVERNAME,
+	FOREIGNSERVEROID,
+	FOREIGNTABLEREL,
+	INDEXRELID,
+	LANGNAME,
+	LANGOID,
+	NAMESPACENAME,
+	NAMESPACEOID,
+	OPERNAMENSP,
+	OPEROID,
+	OPFAMILYAMNAMENSP,
+	OPFAMILYOID,
+	PROCNAMEARGSNSP,
+	PROCOID,
+	RANGETYPE,
+	RELNAMENSP,
+	RELOID,
+	REPLORIGIDENT,
+	REPLORIGNAME,
+	RULERELNAME,
+	STATRELATTINH,
+	TABLESPACEOID,
+	TRFOID,
+	TRFTYPELANG,
+	TSCONFIGMAP,
+	TSCONFIGNAMENSP,
+	TSCONFIGOID,
+	TSDICTNAMENSP,
+	TSDICTOID,
+	TSPARSERNAMENSP,
+	TSPARSEROID,
+	TSTEMPLATENAMENSP,
+	TSTEMPLATEOID,
+	TYPENAMENSP,
+	TYPEOID,
+	USERMAPPINGOID,
+	USERMAPPINGUSERSERVER
+};
+
+extern void InitCatalogCache(void);
+extern void InitCatalogCachePhase2(void);
+
+extern HeapTuple SearchSysCache(int cacheId,
+			   Datum key1, Datum key2, Datum key3, Datum key4);
+extern void ReleaseSysCache(HeapTuple tuple);
+
+/* convenience routines */
+extern HeapTuple SearchSysCacheCopy(int cacheId,
+				   Datum key1, Datum key2, Datum key3, Datum key4);
+extern bool SearchSysCacheExists(int cacheId,
+					 Datum key1, Datum key2, Datum key3, Datum key4);
+extern Oid GetSysCacheOid(int cacheId,
+			   Datum key1, Datum key2, Datum key3, Datum key4);
+
+extern HeapTuple SearchSysCacheAttName(Oid relid, const char *attname);
+extern HeapTuple SearchSysCacheCopyAttName(Oid relid, const char *attname);
+extern bool SearchSysCacheExistsAttName(Oid relid, const char *attname);
+
+extern Datum SysCacheGetAttr(int cacheId, HeapTuple tup,
+				AttrNumber attributeNumber, bool *isNull);
+
+extern uint32 GetSysCacheHashValue(int cacheId,
+					 Datum key1, Datum key2, Datum key3, Datum key4);
+
+/* list-search interface.  Users of this must import catcache.h too */
+struct catclist;
+extern struct catclist *SearchSysCacheList(int cacheId, int nkeys,
+				   Datum key1, Datum key2, Datum key3, Datum key4);
+
+extern bool RelationInvalidatesSnapshotsOnly(Oid relid);
+extern bool RelationHasSysCache(Oid relid);
+extern bool RelationSupportsSysCache(Oid relid);
+
+/*
+ * The use of the macros below rather than direct calls to the corresponding
+ * functions is encouraged, as it insulates the caller from changes in the
+ * maximum number of keys.
+ */
+#define SearchSysCache1(cacheId, key1) \
+	SearchSysCache(cacheId, key1, 0, 0, 0)
+#define SearchSysCache2(cacheId, key1, key2) \
+	SearchSysCache(cacheId, key1, key2, 0, 0)
+#define SearchSysCache3(cacheId, key1, key2, key3) \
+	SearchSysCache(cacheId, key1, key2, key3, 0)
+#define SearchSysCache4(cacheId, key1, key2, key3, key4) \
+	SearchSysCache(cacheId, key1, key2, key3, key4)
+
+#define SearchSysCacheCopy1(cacheId, key1) \
+	SearchSysCacheCopy(cacheId, key1, 0, 0, 0)
+#define SearchSysCacheCopy2(cacheId, key1, key2) \
+	SearchSysCacheCopy(cacheId, key1, key2, 0, 0)
+#define SearchSysCacheCopy3(cacheId, key1, key2, key3) \
+	SearchSysCacheCopy(cacheId, key1, key2, key3, 0)
+#define SearchSysCacheCopy4(cacheId, key1, key2, key3, key4) \
+	SearchSysCacheCopy(cacheId, key1, key2, key3, key4)
+
+#define SearchSysCacheExists1(cacheId, key1) \
+	SearchSysCacheExists(cacheId, key1, 0, 0, 0)
+#define SearchSysCacheExists2(cacheId, key1, key2) \
+	SearchSysCacheExists(cacheId, key1, key2, 0, 0)
+#define SearchSysCacheExists3(cacheId, key1, key2, key3) \
+	SearchSysCacheExists(cacheId, key1, key2, key3, 0)
+#define SearchSysCacheExists4(cacheId, key1, key2, key3, key4) \
+	SearchSysCacheExists(cacheId, key1, key2, key3, key4)
+
+#define GetSysCacheOid1(cacheId, key1) \
+	GetSysCacheOid(cacheId, key1, 0, 0, 0)
+#define GetSysCacheOid2(cacheId, key1, key2) \
+	GetSysCacheOid(cacheId, key1, key2, 0, 0)
+#define GetSysCacheOid3(cacheId, key1, key2, key3) \
+	GetSysCacheOid(cacheId, key1, key2, key3, 0)
+#define GetSysCacheOid4(cacheId, key1, key2, key3, key4) \
+	GetSysCacheOid(cacheId, key1, key2, key3, key4)
+
+#define GetSysCacheHashValue1(cacheId, key1) \
+	GetSysCacheHashValue(cacheId, key1, 0, 0, 0)
+#define GetSysCacheHashValue2(cacheId, key1, key2) \
+	GetSysCacheHashValue(cacheId, key1, key2, 0, 0)
+#define GetSysCacheHashValue3(cacheId, key1, key2, key3) \
+	GetSysCacheHashValue(cacheId, key1, key2, key3, 0)
+#define GetSysCacheHashValue4(cacheId, key1, key2, key3, key4) \
+	GetSysCacheHashValue(cacheId, key1, key2, key3, key4)
+
+#define SearchSysCacheList1(cacheId, key1) \
+	SearchSysCacheList(cacheId, 1, key1, 0, 0, 0)
+#define SearchSysCacheList2(cacheId, key1, key2) \
+	SearchSysCacheList(cacheId, 2, key1, key2, 0, 0)
+#define SearchSysCacheList3(cacheId, key1, key2, key3) \
+	SearchSysCacheList(cacheId, 3, key1, key2, key3, 0)
+#define SearchSysCacheList4(cacheId, key1, key2, key3, key4) \
+	SearchSysCacheList(cacheId, 4, key1, key2, key3, key4)
+
+#define ReleaseSysCacheList(x)	ReleaseCatCacheList(x)
+
+#endif   /* SYSCACHE_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/timeout.h b/foreign/libpg_query/src/postgres/include/utils/timeout.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/timeout.h
@@ -0,0 +1,84 @@
+/*-------------------------------------------------------------------------
+ *
+ * timeout.h
+ *	  Routines to multiplex SIGALRM interrupts for multiple timeout reasons.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/timeout.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TIMEOUT_H
+#define TIMEOUT_H
+
+#include "datatype/timestamp.h"
+
+/*
+ * Identifiers for timeout reasons.  Note that in case multiple timeouts
+ * trigger at the same time, they are serviced in the order of this enum.
+ */
+typedef enum TimeoutId
+{
+	/* Predefined timeout reasons */
+	STARTUP_PACKET_TIMEOUT,
+	DEADLOCK_TIMEOUT,
+	LOCK_TIMEOUT,
+	STATEMENT_TIMEOUT,
+	STANDBY_DEADLOCK_TIMEOUT,
+	STANDBY_TIMEOUT,
+	/* First user-definable timeout reason */
+	USER_TIMEOUT,
+	/* Maximum number of timeout reasons */
+	MAX_TIMEOUTS = 16
+} TimeoutId;
+
+/* callback function signature */
+typedef void (*timeout_handler_proc) (void);
+
+/*
+ * Parameter structure for setting multiple timeouts at once
+ */
+typedef enum TimeoutType
+{
+	TMPARAM_AFTER,
+	TMPARAM_AT
+} TimeoutType;
+
+typedef struct
+{
+	TimeoutId	id;				/* timeout to set */
+	TimeoutType type;			/* TMPARAM_AFTER or TMPARAM_AT */
+	int			delay_ms;		/* only used for TMPARAM_AFTER */
+	TimestampTz fin_time;		/* only used for TMPARAM_AT */
+} EnableTimeoutParams;
+
+/*
+ * Parameter structure for clearing multiple timeouts at once
+ */
+typedef struct
+{
+	TimeoutId	id;				/* timeout to clear */
+	bool		keep_indicator; /* keep the indicator flag? */
+} DisableTimeoutParams;
+
+/* timeout setup */
+extern void InitializeTimeouts(void);
+extern TimeoutId RegisterTimeout(TimeoutId id, timeout_handler_proc handler);
+extern void reschedule_timeouts(void);
+
+/* timeout operation */
+extern void enable_timeout_after(TimeoutId id, int delay_ms);
+extern void enable_timeout_at(TimeoutId id, TimestampTz fin_time);
+extern void enable_timeouts(const EnableTimeoutParams *timeouts, int count);
+extern void disable_timeout(TimeoutId id, bool keep_indicator);
+extern void disable_timeouts(const DisableTimeoutParams *timeouts, int count);
+extern void disable_all_timeouts(bool keep_indicators);
+
+/* accessors */
+extern bool get_timeout_indicator(TimeoutId id, bool reset_indicator);
+extern TimestampTz get_timeout_start_time(TimeoutId id);
+
+#endif   /* TIMEOUT_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/timestamp.h b/foreign/libpg_query/src/postgres/include/utils/timestamp.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/timestamp.h
@@ -0,0 +1,263 @@
+/*-------------------------------------------------------------------------
+ *
+ * timestamp.h
+ *	  Definitions for the SQL "timestamp" and "interval" types.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/timestamp.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TIMESTAMP_H
+#define TIMESTAMP_H
+
+#include "datatype/timestamp.h"
+#include "fmgr.h"
+#include "pgtime.h"
+
+
+/*
+ * Macros for fmgr-callable functions.
+ *
+ * For Timestamp, we make use of the same support routines as for int64
+ * or float8.  Therefore Timestamp is pass-by-reference if and only if
+ * int64 or float8 is!
+ */
+#ifdef HAVE_INT64_TIMESTAMP
+
+#define DatumGetTimestamp(X)  ((Timestamp) DatumGetInt64(X))
+#define DatumGetTimestampTz(X)	((TimestampTz) DatumGetInt64(X))
+#define DatumGetIntervalP(X)  ((Interval *) DatumGetPointer(X))
+
+#define TimestampGetDatum(X) Int64GetDatum(X)
+#define TimestampTzGetDatum(X) Int64GetDatum(X)
+#define IntervalPGetDatum(X) PointerGetDatum(X)
+
+#define PG_GETARG_TIMESTAMP(n) DatumGetTimestamp(PG_GETARG_DATUM(n))
+#define PG_GETARG_TIMESTAMPTZ(n) DatumGetTimestampTz(PG_GETARG_DATUM(n))
+#define PG_GETARG_INTERVAL_P(n) DatumGetIntervalP(PG_GETARG_DATUM(n))
+
+#define PG_RETURN_TIMESTAMP(x) return TimestampGetDatum(x)
+#define PG_RETURN_TIMESTAMPTZ(x) return TimestampTzGetDatum(x)
+#define PG_RETURN_INTERVAL_P(x) return IntervalPGetDatum(x)
+#else							/* !HAVE_INT64_TIMESTAMP */
+
+#define DatumGetTimestamp(X)  ((Timestamp) DatumGetFloat8(X))
+#define DatumGetTimestampTz(X)	((TimestampTz) DatumGetFloat8(X))
+#define DatumGetIntervalP(X)  ((Interval *) DatumGetPointer(X))
+
+#define TimestampGetDatum(X) Float8GetDatum(X)
+#define TimestampTzGetDatum(X) Float8GetDatum(X)
+#define IntervalPGetDatum(X) PointerGetDatum(X)
+
+#define PG_GETARG_TIMESTAMP(n) DatumGetTimestamp(PG_GETARG_DATUM(n))
+#define PG_GETARG_TIMESTAMPTZ(n) DatumGetTimestampTz(PG_GETARG_DATUM(n))
+#define PG_GETARG_INTERVAL_P(n) DatumGetIntervalP(PG_GETARG_DATUM(n))
+
+#define PG_RETURN_TIMESTAMP(x) return TimestampGetDatum(x)
+#define PG_RETURN_TIMESTAMPTZ(x) return TimestampTzGetDatum(x)
+#define PG_RETURN_INTERVAL_P(x) return IntervalPGetDatum(x)
+#endif   /* HAVE_INT64_TIMESTAMP */
+
+
+#define TIMESTAMP_MASK(b) (1 << (b))
+#define INTERVAL_MASK(b) (1 << (b))
+
+/* Macros to handle packing and unpacking the typmod field for intervals */
+#define INTERVAL_FULL_RANGE (0x7FFF)
+#define INTERVAL_RANGE_MASK (0x7FFF)
+#define INTERVAL_FULL_PRECISION (0xFFFF)
+#define INTERVAL_PRECISION_MASK (0xFFFF)
+#define INTERVAL_TYPMOD(p,r) ((((r) & INTERVAL_RANGE_MASK) << 16) | ((p) & INTERVAL_PRECISION_MASK))
+#define INTERVAL_PRECISION(t) ((t) & INTERVAL_PRECISION_MASK)
+#define INTERVAL_RANGE(t) (((t) >> 16) & INTERVAL_RANGE_MASK)
+
+#ifdef HAVE_INT64_TIMESTAMP
+#define TimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) * (int64) 1000))
+#else
+#define TimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) / 1000.0))
+#endif
+
+
+/* Set at postmaster start */
+extern TimestampTz PgStartTime;
+
+/* Set at configuration reload */
+extern TimestampTz PgReloadTime;
+
+
+/*
+ * timestamp.c prototypes
+ */
+
+extern Datum timestamp_in(PG_FUNCTION_ARGS);
+extern Datum timestamp_out(PG_FUNCTION_ARGS);
+extern Datum timestamp_recv(PG_FUNCTION_ARGS);
+extern Datum timestamp_send(PG_FUNCTION_ARGS);
+extern Datum timestamptypmodin(PG_FUNCTION_ARGS);
+extern Datum timestamptypmodout(PG_FUNCTION_ARGS);
+extern Datum timestamp_transform(PG_FUNCTION_ARGS);
+extern Datum timestamp_scale(PG_FUNCTION_ARGS);
+extern Datum timestamp_eq(PG_FUNCTION_ARGS);
+extern Datum timestamp_ne(PG_FUNCTION_ARGS);
+extern Datum timestamp_lt(PG_FUNCTION_ARGS);
+extern Datum timestamp_le(PG_FUNCTION_ARGS);
+extern Datum timestamp_ge(PG_FUNCTION_ARGS);
+extern Datum timestamp_gt(PG_FUNCTION_ARGS);
+extern Datum timestamp_finite(PG_FUNCTION_ARGS);
+extern Datum timestamp_cmp(PG_FUNCTION_ARGS);
+extern Datum timestamp_sortsupport(PG_FUNCTION_ARGS);
+extern Datum timestamp_hash(PG_FUNCTION_ARGS);
+extern Datum timestamp_smaller(PG_FUNCTION_ARGS);
+extern Datum timestamp_larger(PG_FUNCTION_ARGS);
+
+extern Datum timestamp_eq_timestamptz(PG_FUNCTION_ARGS);
+extern Datum timestamp_ne_timestamptz(PG_FUNCTION_ARGS);
+extern Datum timestamp_lt_timestamptz(PG_FUNCTION_ARGS);
+extern Datum timestamp_le_timestamptz(PG_FUNCTION_ARGS);
+extern Datum timestamp_gt_timestamptz(PG_FUNCTION_ARGS);
+extern Datum timestamp_ge_timestamptz(PG_FUNCTION_ARGS);
+extern Datum timestamp_cmp_timestamptz(PG_FUNCTION_ARGS);
+
+extern Datum make_timestamp(PG_FUNCTION_ARGS);
+extern Datum make_timestamptz(PG_FUNCTION_ARGS);
+extern Datum make_timestamptz_at_timezone(PG_FUNCTION_ARGS);
+
+extern Datum timestamptz_eq_timestamp(PG_FUNCTION_ARGS);
+extern Datum timestamptz_ne_timestamp(PG_FUNCTION_ARGS);
+extern Datum timestamptz_lt_timestamp(PG_FUNCTION_ARGS);
+extern Datum timestamptz_le_timestamp(PG_FUNCTION_ARGS);
+extern Datum timestamptz_gt_timestamp(PG_FUNCTION_ARGS);
+extern Datum timestamptz_ge_timestamp(PG_FUNCTION_ARGS);
+extern Datum timestamptz_cmp_timestamp(PG_FUNCTION_ARGS);
+
+extern Datum interval_in(PG_FUNCTION_ARGS);
+extern Datum interval_out(PG_FUNCTION_ARGS);
+extern Datum interval_recv(PG_FUNCTION_ARGS);
+extern Datum interval_send(PG_FUNCTION_ARGS);
+extern Datum intervaltypmodin(PG_FUNCTION_ARGS);
+extern Datum intervaltypmodout(PG_FUNCTION_ARGS);
+extern Datum interval_transform(PG_FUNCTION_ARGS);
+extern Datum interval_scale(PG_FUNCTION_ARGS);
+extern Datum interval_eq(PG_FUNCTION_ARGS);
+extern Datum interval_ne(PG_FUNCTION_ARGS);
+extern Datum interval_lt(PG_FUNCTION_ARGS);
+extern Datum interval_le(PG_FUNCTION_ARGS);
+extern Datum interval_ge(PG_FUNCTION_ARGS);
+extern Datum interval_gt(PG_FUNCTION_ARGS);
+extern Datum interval_finite(PG_FUNCTION_ARGS);
+extern Datum interval_cmp(PG_FUNCTION_ARGS);
+extern Datum interval_hash(PG_FUNCTION_ARGS);
+extern Datum interval_smaller(PG_FUNCTION_ARGS);
+extern Datum interval_larger(PG_FUNCTION_ARGS);
+extern Datum interval_justify_interval(PG_FUNCTION_ARGS);
+extern Datum interval_justify_hours(PG_FUNCTION_ARGS);
+extern Datum interval_justify_days(PG_FUNCTION_ARGS);
+extern Datum make_interval(PG_FUNCTION_ARGS);
+
+extern Datum timestamp_trunc(PG_FUNCTION_ARGS);
+extern Datum interval_trunc(PG_FUNCTION_ARGS);
+extern Datum timestamp_part(PG_FUNCTION_ARGS);
+extern Datum interval_part(PG_FUNCTION_ARGS);
+extern Datum timestamp_zone_transform(PG_FUNCTION_ARGS);
+extern Datum timestamp_zone(PG_FUNCTION_ARGS);
+extern Datum timestamp_izone_transform(PG_FUNCTION_ARGS);
+extern Datum timestamp_izone(PG_FUNCTION_ARGS);
+extern Datum timestamp_timestamptz(PG_FUNCTION_ARGS);
+
+extern Datum timestamptz_in(PG_FUNCTION_ARGS);
+extern Datum timestamptz_out(PG_FUNCTION_ARGS);
+extern Datum timestamptz_recv(PG_FUNCTION_ARGS);
+extern Datum timestamptz_send(PG_FUNCTION_ARGS);
+extern Datum timestamptztypmodin(PG_FUNCTION_ARGS);
+extern Datum timestamptztypmodout(PG_FUNCTION_ARGS);
+extern Datum timestamptz_scale(PG_FUNCTION_ARGS);
+extern Datum timestamptz_timestamp(PG_FUNCTION_ARGS);
+extern Datum timestamptz_zone(PG_FUNCTION_ARGS);
+extern Datum timestamptz_izone(PG_FUNCTION_ARGS);
+extern Datum timestamptz_timestamptz(PG_FUNCTION_ARGS);
+
+extern Datum interval_um(PG_FUNCTION_ARGS);
+extern Datum interval_pl(PG_FUNCTION_ARGS);
+extern Datum interval_mi(PG_FUNCTION_ARGS);
+extern Datum interval_mul(PG_FUNCTION_ARGS);
+extern Datum mul_d_interval(PG_FUNCTION_ARGS);
+extern Datum interval_div(PG_FUNCTION_ARGS);
+extern Datum interval_accum(PG_FUNCTION_ARGS);
+extern Datum interval_accum_inv(PG_FUNCTION_ARGS);
+extern Datum interval_avg(PG_FUNCTION_ARGS);
+
+extern Datum timestamp_mi(PG_FUNCTION_ARGS);
+extern Datum timestamp_pl_interval(PG_FUNCTION_ARGS);
+extern Datum timestamp_mi_interval(PG_FUNCTION_ARGS);
+extern Datum timestamp_age(PG_FUNCTION_ARGS);
+extern Datum overlaps_timestamp(PG_FUNCTION_ARGS);
+
+extern Datum timestamptz_pl_interval(PG_FUNCTION_ARGS);
+extern Datum timestamptz_mi_interval(PG_FUNCTION_ARGS);
+extern Datum timestamptz_age(PG_FUNCTION_ARGS);
+extern Datum timestamptz_trunc(PG_FUNCTION_ARGS);
+extern Datum timestamptz_part(PG_FUNCTION_ARGS);
+
+extern Datum now(PG_FUNCTION_ARGS);
+extern Datum statement_timestamp(PG_FUNCTION_ARGS);
+extern Datum clock_timestamp(PG_FUNCTION_ARGS);
+
+extern Datum pg_postmaster_start_time(PG_FUNCTION_ARGS);
+extern Datum pg_conf_load_time(PG_FUNCTION_ARGS);
+
+extern Datum generate_series_timestamp(PG_FUNCTION_ARGS);
+extern Datum generate_series_timestamptz(PG_FUNCTION_ARGS);
+
+/* Internal routines (not fmgr-callable) */
+
+extern TimestampTz GetCurrentTimestamp(void);
+extern void TimestampDifference(TimestampTz start_time, TimestampTz stop_time,
+					long *secs, int *microsecs);
+extern bool TimestampDifferenceExceeds(TimestampTz start_time,
+						   TimestampTz stop_time,
+						   int msec);
+
+/*
+ * Prototypes for functions to deal with integer timestamps, when the native
+ * format is float timestamps.
+ */
+#ifndef HAVE_INT64_TIMESTAMP
+extern int64 GetCurrentIntegerTimestamp(void);
+extern TimestampTz IntegerTimestampToTimestampTz(int64 timestamp);
+#else
+#define GetCurrentIntegerTimestamp()	GetCurrentTimestamp()
+#define IntegerTimestampToTimestampTz(timestamp) (timestamp)
+#endif
+
+extern TimestampTz time_t_to_timestamptz(pg_time_t tm);
+extern pg_time_t timestamptz_to_time_t(TimestampTz t);
+
+extern const char *timestamptz_to_str(TimestampTz t);
+
+extern int	tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *dt);
+extern int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm,
+			 fsec_t *fsec, const char **tzn, pg_tz *attimezone);
+extern void dt2time(Timestamp dt, int *hour, int *min, int *sec, fsec_t *fsec);
+
+extern int	interval2tm(Interval span, struct pg_tm * tm, fsec_t *fsec);
+extern int	tm2interval(struct pg_tm * tm, fsec_t fsec, Interval *span);
+
+extern Timestamp SetEpochTimestamp(void);
+extern void GetEpochTime(struct pg_tm * tm);
+
+extern int	timestamp_cmp_internal(Timestamp dt1, Timestamp dt2);
+
+/* timestamp comparison works for timestamptz also */
+#define timestamptz_cmp_internal(dt1,dt2)	timestamp_cmp_internal(dt1, dt2)
+
+extern int	isoweek2j(int year, int week);
+extern void isoweek2date(int woy, int *year, int *mon, int *mday);
+extern void isoweekdate2date(int isoweek, int wday, int *year, int *mon, int *mday);
+extern int	date2isoweek(int year, int mon, int mday);
+extern int	date2isoyear(int year, int mon, int mday);
+extern int	date2isoyearday(int year, int mon, int mday);
+
+#endif   /* TIMESTAMP_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/tqual.h b/foreign/libpg_query/src/postgres/include/utils/tqual.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/tqual.h
@@ -0,0 +1,103 @@
+/*-------------------------------------------------------------------------
+ *
+ * tqual.h
+ *	  POSTGRES "time qualification" definitions, ie, tuple visibility rules.
+ *
+ *	  Should be moved/renamed...    - vadim 07/28/98
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/tqual.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TQUAL_H
+#define TQUAL_H
+
+#include "utils/snapshot.h"
+
+
+/* Static variables representing various special snapshot semantics */
+extern PGDLLIMPORT SnapshotData SnapshotSelfData;
+extern PGDLLIMPORT SnapshotData SnapshotAnyData;
+extern PGDLLIMPORT SnapshotData SnapshotToastData;
+extern PGDLLIMPORT SnapshotData CatalogSnapshotData;
+
+#define SnapshotSelf		(&SnapshotSelfData)
+#define SnapshotAny			(&SnapshotAnyData)
+#define SnapshotToast		(&SnapshotToastData)
+
+/*
+ * We don't provide a static SnapshotDirty variable because it would be
+ * non-reentrant.  Instead, users of that snapshot type should declare a
+ * local variable of type SnapshotData, and initialize it with this macro.
+ */
+#define InitDirtySnapshot(snapshotdata)  \
+	((snapshotdata).satisfies = HeapTupleSatisfiesDirty)
+
+/* This macro encodes the knowledge of which snapshots are MVCC-safe */
+#define IsMVCCSnapshot(snapshot)  \
+	((snapshot)->satisfies == HeapTupleSatisfiesMVCC || \
+	 (snapshot)->satisfies == HeapTupleSatisfiesHistoricMVCC)
+
+/*
+ * HeapTupleSatisfiesVisibility
+ *		True iff heap tuple satisfies a time qual.
+ *
+ * Notes:
+ *	Assumes heap tuple is valid.
+ *	Beware of multiple evaluations of snapshot argument.
+ *	Hint bits in the HeapTuple's t_infomask may be updated as a side effect;
+ *	if so, the indicated buffer is marked dirty.
+ */
+#define HeapTupleSatisfiesVisibility(tuple, snapshot, buffer) \
+	((*(snapshot)->satisfies) (tuple, snapshot, buffer))
+
+/* Result codes for HeapTupleSatisfiesVacuum */
+typedef enum
+{
+	HEAPTUPLE_DEAD,				/* tuple is dead and deletable */
+	HEAPTUPLE_LIVE,				/* tuple is live (committed, no deleter) */
+	HEAPTUPLE_RECENTLY_DEAD,	/* tuple is dead, but not deletable yet */
+	HEAPTUPLE_INSERT_IN_PROGRESS,		/* inserting xact is still in progress */
+	HEAPTUPLE_DELETE_IN_PROGRESS	/* deleting xact is still in progress */
+} HTSV_Result;
+
+/* These are the "satisfies" test routines for the various snapshot types */
+extern bool HeapTupleSatisfiesMVCC(HeapTuple htup,
+					   Snapshot snapshot, Buffer buffer);
+extern bool HeapTupleSatisfiesSelf(HeapTuple htup,
+					   Snapshot snapshot, Buffer buffer);
+extern bool HeapTupleSatisfiesAny(HeapTuple htup,
+					  Snapshot snapshot, Buffer buffer);
+extern bool HeapTupleSatisfiesToast(HeapTuple htup,
+						Snapshot snapshot, Buffer buffer);
+extern bool HeapTupleSatisfiesDirty(HeapTuple htup,
+						Snapshot snapshot, Buffer buffer);
+extern bool HeapTupleSatisfiesHistoricMVCC(HeapTuple htup,
+							   Snapshot snapshot, Buffer buffer);
+
+/* Special "satisfies" routines with different APIs */
+extern HTSU_Result HeapTupleSatisfiesUpdate(HeapTuple htup,
+						 CommandId curcid, Buffer buffer);
+extern HTSV_Result HeapTupleSatisfiesVacuum(HeapTuple htup,
+						 TransactionId OldestXmin, Buffer buffer);
+extern bool HeapTupleIsSurelyDead(HeapTuple htup,
+					  TransactionId OldestXmin);
+
+extern void HeapTupleSetHintBits(HeapTupleHeader tuple, Buffer buffer,
+					 uint16 infomask, TransactionId xid);
+extern bool HeapTupleHeaderIsOnlyLocked(HeapTupleHeader tuple);
+
+/*
+ * To avoid leaking too much knowledge about reorderbuffer implementation
+ * details this is implemented in reorderbuffer.c not tqual.c.
+ */
+struct HTAB;
+extern bool ResolveCminCmaxDuringDecoding(struct HTAB *tuplecid_data,
+							  Snapshot snapshot,
+							  HeapTuple htup,
+							  Buffer buffer,
+							  CommandId *cmin, CommandId *cmax);
+#endif   /* TQUAL_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/tuplesort.h b/foreign/libpg_query/src/postgres/include/utils/tuplesort.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/tuplesort.h
@@ -0,0 +1,126 @@
+/*-------------------------------------------------------------------------
+ *
+ * tuplesort.h
+ *	  Generalized tuple sorting routines.
+ *
+ * This module handles sorting of heap tuples, index tuples, or single
+ * Datums (and could easily support other kinds of sortable objects,
+ * if necessary).  It works efficiently for both small and large amounts
+ * of data.  Small amounts are sorted in-memory using qsort().  Large
+ * amounts are sorted using temporary files and a standard external sort
+ * algorithm.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/tuplesort.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TUPLESORT_H
+#define TUPLESORT_H
+
+#include "access/itup.h"
+#include "executor/tuptable.h"
+#include "fmgr.h"
+#include "utils/relcache.h"
+
+
+/* Tuplesortstate is an opaque type whose details are not known outside
+ * tuplesort.c.
+ */
+typedef struct Tuplesortstate Tuplesortstate;
+
+/*
+ * We provide multiple interfaces to what is essentially the same code,
+ * since different callers have different data to be sorted and want to
+ * specify the sort key information differently.  There are two APIs for
+ * sorting HeapTuples and two more for sorting IndexTuples.  Yet another
+ * API supports sorting bare Datums.
+ *
+ * The "heap" API actually stores/sorts MinimalTuples, which means it doesn't
+ * preserve the system columns (tuple identity and transaction visibility
+ * info).  The sort keys are specified by column numbers within the tuples
+ * and sort operator OIDs.  We save some cycles by passing and returning the
+ * tuples in TupleTableSlots, rather than forming actual HeapTuples (which'd
+ * have to be converted to MinimalTuples).  This API works well for sorts
+ * executed as parts of plan trees.
+ *
+ * The "cluster" API stores/sorts full HeapTuples including all visibility
+ * info. The sort keys are specified by reference to a btree index that is
+ * defined on the relation to be sorted.  Note that putheaptuple/getheaptuple
+ * go with this API, not the "begin_heap" one!
+ *
+ * The "index_btree" API stores/sorts IndexTuples (preserving all their
+ * header fields).  The sort keys are specified by a btree index definition.
+ *
+ * The "index_hash" API is similar to index_btree, but the tuples are
+ * actually sorted by their hash codes not the raw data.
+ */
+
+extern Tuplesortstate *tuplesort_begin_heap(TupleDesc tupDesc,
+					 int nkeys, AttrNumber *attNums,
+					 Oid *sortOperators, Oid *sortCollations,
+					 bool *nullsFirstFlags,
+					 int workMem, bool randomAccess);
+extern Tuplesortstate *tuplesort_begin_cluster(TupleDesc tupDesc,
+						Relation indexRel,
+						int workMem, bool randomAccess);
+extern Tuplesortstate *tuplesort_begin_index_btree(Relation heapRel,
+							Relation indexRel,
+							bool enforceUnique,
+							int workMem, bool randomAccess);
+extern Tuplesortstate *tuplesort_begin_index_hash(Relation heapRel,
+						   Relation indexRel,
+						   uint32 hash_mask,
+						   int workMem, bool randomAccess);
+extern Tuplesortstate *tuplesort_begin_datum(Oid datumType,
+					  Oid sortOperator, Oid sortCollation,
+					  bool nullsFirstFlag,
+					  int workMem, bool randomAccess);
+
+extern void tuplesort_set_bound(Tuplesortstate *state, int64 bound);
+
+extern void tuplesort_puttupleslot(Tuplesortstate *state,
+					   TupleTableSlot *slot);
+extern void tuplesort_putheaptuple(Tuplesortstate *state, HeapTuple tup);
+extern void tuplesort_putindextuplevalues(Tuplesortstate *state,
+							  Relation rel, ItemPointer self,
+							  Datum *values, bool *isnull);
+extern void tuplesort_putdatum(Tuplesortstate *state, Datum val,
+				   bool isNull);
+
+extern void tuplesort_performsort(Tuplesortstate *state);
+
+extern bool tuplesort_gettupleslot(Tuplesortstate *state, bool forward,
+					   TupleTableSlot *slot);
+extern HeapTuple tuplesort_getheaptuple(Tuplesortstate *state, bool forward,
+					   bool *should_free);
+extern IndexTuple tuplesort_getindextuple(Tuplesortstate *state, bool forward,
+						bool *should_free);
+extern bool tuplesort_getdatum(Tuplesortstate *state, bool forward,
+				   Datum *val, bool *isNull);
+
+extern bool tuplesort_skiptuples(Tuplesortstate *state, int64 ntuples,
+					 bool forward);
+
+extern void tuplesort_end(Tuplesortstate *state);
+
+extern void tuplesort_get_stats(Tuplesortstate *state,
+					const char **sortMethod,
+					const char **spaceType,
+					long *spaceUsed);
+
+extern int	tuplesort_merge_order(int64 allowedMem);
+
+/*
+ * These routines may only be called if randomAccess was specified 'true'.
+ * Likewise, backwards scan in gettuple/getdatum is only allowed if
+ * randomAccess was specified.
+ */
+
+extern void tuplesort_rescan(Tuplesortstate *state);
+extern void tuplesort_markpos(Tuplesortstate *state);
+extern void tuplesort_restorepos(Tuplesortstate *state);
+
+#endif   /* TUPLESORT_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/tuplestore.h b/foreign/libpg_query/src/postgres/include/utils/tuplestore.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/tuplestore.h
@@ -0,0 +1,89 @@
+/*-------------------------------------------------------------------------
+ *
+ * tuplestore.h
+ *	  Generalized routines for temporary tuple storage.
+ *
+ * This module handles temporary storage of tuples for purposes such
+ * as Materialize nodes, hashjoin batch files, etc.  It is essentially
+ * a dumbed-down version of tuplesort.c; it does no sorting of tuples
+ * but can only store and regurgitate a sequence of tuples.  However,
+ * because no sort is required, it is allowed to start reading the sequence
+ * before it has all been written.  This is particularly useful for cursors,
+ * because it allows random access within the already-scanned portion of
+ * a query without having to process the underlying scan to completion.
+ * Also, it is possible to support multiple independent read pointers.
+ *
+ * A temporary file is used to handle the data if it exceeds the
+ * space limit specified by the caller.
+ *
+ * Beginning in Postgres 8.2, what is stored is just MinimalTuples;
+ * callers cannot expect valid system columns in regurgitated tuples.
+ * Also, we have changed the API to return tuples in TupleTableSlots,
+ * so that there is a check to prevent attempted access to system columns.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/tuplestore.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TUPLESTORE_H
+#define TUPLESTORE_H
+
+#include "executor/tuptable.h"
+
+
+/* Tuplestorestate is an opaque type whose details are not known outside
+ * tuplestore.c.
+ */
+typedef struct Tuplestorestate Tuplestorestate;
+
+/*
+ * Currently we only need to store MinimalTuples, but it would be easy
+ * to support the same behavior for IndexTuples and/or bare Datums.
+ */
+
+extern Tuplestorestate *tuplestore_begin_heap(bool randomAccess,
+					  bool interXact,
+					  int maxKBytes);
+
+extern void tuplestore_set_eflags(Tuplestorestate *state, int eflags);
+
+extern void tuplestore_puttupleslot(Tuplestorestate *state,
+						TupleTableSlot *slot);
+extern void tuplestore_puttuple(Tuplestorestate *state, HeapTuple tuple);
+extern void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc,
+					 Datum *values, bool *isnull);
+
+/* tuplestore_donestoring() used to be required, but is no longer used */
+#define tuplestore_donestoring(state)	((void) 0)
+
+extern int	tuplestore_alloc_read_pointer(Tuplestorestate *state, int eflags);
+
+extern void tuplestore_select_read_pointer(Tuplestorestate *state, int ptr);
+
+extern void tuplestore_copy_read_pointer(Tuplestorestate *state,
+							 int srcptr, int destptr);
+
+extern void tuplestore_trim(Tuplestorestate *state);
+
+extern bool tuplestore_in_memory(Tuplestorestate *state);
+
+extern bool tuplestore_gettupleslot(Tuplestorestate *state, bool forward,
+						bool copy, TupleTableSlot *slot);
+
+extern bool tuplestore_advance(Tuplestorestate *state, bool forward);
+
+extern bool tuplestore_skiptuples(Tuplestorestate *state,
+					  int64 ntuples, bool forward);
+
+extern bool tuplestore_ateof(Tuplestorestate *state);
+
+extern void tuplestore_rescan(Tuplestorestate *state);
+
+extern void tuplestore_clear(Tuplestorestate *state);
+
+extern void tuplestore_end(Tuplestorestate *state);
+
+#endif   /* TUPLESTORE_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/typcache.h b/foreign/libpg_query/src/postgres/include/utils/typcache.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/typcache.h
@@ -0,0 +1,162 @@
+/*-------------------------------------------------------------------------
+ *
+ * typcache.h
+ *	  Type cache definitions.
+ *
+ * The type cache exists to speed lookup of certain information about data
+ * types that is not directly available from a type's pg_type row.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/typcache.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TYPCACHE_H
+#define TYPCACHE_H
+
+#include "access/tupdesc.h"
+#include "fmgr.h"
+
+
+/* DomainConstraintCache is an opaque struct known only within typcache.c */
+typedef struct DomainConstraintCache DomainConstraintCache;
+
+/* TypeCacheEnumData is an opaque struct known only within typcache.c */
+struct TypeCacheEnumData;
+
+typedef struct TypeCacheEntry
+{
+	/* typeId is the hash lookup key and MUST BE FIRST */
+	Oid			type_id;		/* OID of the data type */
+
+	/* some subsidiary information copied from the pg_type row */
+	int16		typlen;
+	bool		typbyval;
+	char		typalign;
+	char		typstorage;
+	char		typtype;
+	Oid			typrelid;
+
+	/*
+	 * Information obtained from opfamily entries
+	 *
+	 * These will be InvalidOid if no match could be found, or if the
+	 * information hasn't yet been requested.  Also note that for array and
+	 * composite types, typcache.c checks that the contained types are
+	 * comparable or hashable before allowing eq_opr etc to become set.
+	 */
+	Oid			btree_opf;		/* the default btree opclass' family */
+	Oid			btree_opintype; /* the default btree opclass' opcintype */
+	Oid			hash_opf;		/* the default hash opclass' family */
+	Oid			hash_opintype;	/* the default hash opclass' opcintype */
+	Oid			eq_opr;			/* the equality operator */
+	Oid			lt_opr;			/* the less-than operator */
+	Oid			gt_opr;			/* the greater-than operator */
+	Oid			cmp_proc;		/* the btree comparison function */
+	Oid			hash_proc;		/* the hash calculation function */
+
+	/*
+	 * Pre-set-up fmgr call info for the equality operator, the btree
+	 * comparison function, and the hash calculation function.  These are kept
+	 * in the type cache to avoid problems with memory leaks in repeated calls
+	 * to functions such as array_eq, array_cmp, hash_array.  There is not
+	 * currently a need to maintain call info for the lt_opr or gt_opr.
+	 */
+	FmgrInfo	eq_opr_finfo;
+	FmgrInfo	cmp_proc_finfo;
+	FmgrInfo	hash_proc_finfo;
+
+	/*
+	 * Tuple descriptor if it's a composite type (row type).  NULL if not
+	 * composite or information hasn't yet been requested.  (NOTE: this is a
+	 * reference-counted tupledesc.)
+	 */
+	TupleDesc	tupDesc;
+
+	/*
+	 * Fields computed when TYPECACHE_RANGE_INFO is requested.  Zeroes if not
+	 * a range type or information hasn't yet been requested.  Note that
+	 * rng_cmp_proc_finfo could be different from the element type's default
+	 * btree comparison function.
+	 */
+	struct TypeCacheEntry *rngelemtype; /* range's element type */
+	Oid			rng_collation;	/* collation for comparisons, if any */
+	FmgrInfo	rng_cmp_proc_finfo;		/* comparison function */
+	FmgrInfo	rng_canonical_finfo;	/* canonicalization function, if any */
+	FmgrInfo	rng_subdiff_finfo;		/* difference function, if any */
+
+	/*
+	 * Domain constraint data if it's a domain type.  NULL if not domain, or
+	 * if domain has no constraints, or if information hasn't been requested.
+	 */
+	DomainConstraintCache *domainData;
+
+	/* Private data, for internal use of typcache.c only */
+	int			flags;			/* flags about what we've computed */
+
+	/*
+	 * Private information about an enum type.  NULL if not enum or
+	 * information hasn't been requested.
+	 */
+	struct TypeCacheEnumData *enumData;
+
+	/* We also maintain a list of all known domain-type cache entries */
+	struct TypeCacheEntry *nextDomain;
+} TypeCacheEntry;
+
+/* Bit flags to indicate which fields a given caller needs to have set */
+#define TYPECACHE_EQ_OPR			0x0001
+#define TYPECACHE_LT_OPR			0x0002
+#define TYPECACHE_GT_OPR			0x0004
+#define TYPECACHE_CMP_PROC			0x0008
+#define TYPECACHE_HASH_PROC			0x0010
+#define TYPECACHE_EQ_OPR_FINFO		0x0020
+#define TYPECACHE_CMP_PROC_FINFO	0x0040
+#define TYPECACHE_HASH_PROC_FINFO	0x0080
+#define TYPECACHE_TUPDESC			0x0100
+#define TYPECACHE_BTREE_OPFAMILY	0x0200
+#define TYPECACHE_HASH_OPFAMILY		0x0400
+#define TYPECACHE_RANGE_INFO		0x0800
+#define TYPECACHE_DOMAIN_INFO		0x1000
+
+/*
+ * Callers wishing to maintain a long-lived reference to a domain's constraint
+ * set must store it in one of these.  Use InitDomainConstraintRef() and
+ * UpdateDomainConstraintRef() to manage it.  Note: DomainConstraintState is
+ * considered an executable expression type, so it's defined in execnodes.h.
+ */
+typedef struct DomainConstraintRef
+{
+	List	   *constraints;	/* list of DomainConstraintState nodes */
+	MemoryContext refctx;		/* context holding DomainConstraintRef */
+
+	/* Management data --- treat these fields as private to typcache.c */
+	TypeCacheEntry *tcache;		/* owning typcache entry */
+	DomainConstraintCache *dcc; /* current constraints, or NULL if none */
+	MemoryContextCallback callback;		/* used to release refcount when done */
+} DomainConstraintRef;
+
+
+extern TypeCacheEntry *lookup_type_cache(Oid type_id, int flags);
+
+extern void InitDomainConstraintRef(Oid type_id, DomainConstraintRef *ref,
+						MemoryContext refctx);
+
+extern void UpdateDomainConstraintRef(DomainConstraintRef *ref);
+
+extern bool DomainHasConstraints(Oid type_id);
+
+extern TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod);
+
+extern TupleDesc lookup_rowtype_tupdesc_noerror(Oid type_id, int32 typmod,
+							   bool noError);
+
+extern TupleDesc lookup_rowtype_tupdesc_copy(Oid type_id, int32 typmod);
+
+extern void assign_record_type_typmod(TupleDesc tupDesc);
+
+extern int	compare_values_of_enum(TypeCacheEntry *tcache, Oid arg1, Oid arg2);
+
+#endif   /* TYPCACHE_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/tzparser.h b/foreign/libpg_query/src/postgres/include/utils/tzparser.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/tzparser.h
@@ -0,0 +1,39 @@
+/*-------------------------------------------------------------------------
+ *
+ * tzparser.h
+ *	  Timezone offset file parsing definitions.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/tzparser.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TZPARSER_H
+#define TZPARSER_H
+
+#include "utils/datetime.h"
+
+/*
+ * The result of parsing a timezone configuration file is an array of
+ * these structs, in order by abbrev.  We export this because datetime.c
+ * needs it.
+ */
+typedef struct tzEntry
+{
+	/* the actual data */
+	char	   *abbrev;			/* TZ abbreviation (downcased) */
+	char	   *zone;			/* zone name if dynamic abbrev, else NULL */
+	/* for a dynamic abbreviation, offset/is_dst are not used */
+	int			offset;			/* offset in seconds from UTC */
+	bool		is_dst;			/* true if a DST abbreviation */
+	/* source information (for error messages) */
+	int			lineno;
+	const char *filename;
+} tzEntry;
+
+
+extern TimeZoneAbbrevTable *load_tzoffsets(const char *filename);
+
+#endif   /* TZPARSER_H */
diff --git a/foreign/libpg_query/src/postgres/include/utils/xml.h b/foreign/libpg_query/src/postgres/include/utils/xml.h
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/include/utils/xml.h
@@ -0,0 +1,112 @@
+/*-------------------------------------------------------------------------
+ *
+ * xml.h
+ *	  Declarations for XML data type support.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/utils/xml.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef XML_H
+#define XML_H
+
+#include "fmgr.h"
+#include "nodes/execnodes.h"
+#include "nodes/primnodes.h"
+
+typedef struct varlena xmltype;
+
+typedef enum
+{
+	XML_STANDALONE_YES,
+	XML_STANDALONE_NO,
+	XML_STANDALONE_NO_VALUE,
+	XML_STANDALONE_OMITTED
+}	XmlStandaloneType;
+
+typedef enum
+{
+	XMLBINARY_BASE64,
+	XMLBINARY_HEX
+}	XmlBinaryType;
+
+typedef enum
+{
+	PG_XML_STRICTNESS_LEGACY,	/* ignore errors unless function result
+								 * indicates error condition */
+	PG_XML_STRICTNESS_WELLFORMED,		/* ignore non-parser messages */
+	PG_XML_STRICTNESS_ALL		/* report all notices/warnings/errors */
+} PgXmlStrictness;
+
+/* struct PgXmlErrorContext is private to xml.c */
+typedef struct PgXmlErrorContext PgXmlErrorContext;
+
+#define DatumGetXmlP(X)		((xmltype *) PG_DETOAST_DATUM(X))
+#define XmlPGetDatum(X)		PointerGetDatum(X)
+
+#define PG_GETARG_XML_P(n)	DatumGetXmlP(PG_GETARG_DATUM(n))
+#define PG_RETURN_XML_P(x)	PG_RETURN_POINTER(x)
+
+extern Datum xml_in(PG_FUNCTION_ARGS);
+extern Datum xml_out(PG_FUNCTION_ARGS);
+extern Datum xml_recv(PG_FUNCTION_ARGS);
+extern Datum xml_send(PG_FUNCTION_ARGS);
+extern Datum xmlcomment(PG_FUNCTION_ARGS);
+extern Datum xmlconcat2(PG_FUNCTION_ARGS);
+extern Datum texttoxml(PG_FUNCTION_ARGS);
+extern Datum xmltotext(PG_FUNCTION_ARGS);
+extern Datum xmlvalidate(PG_FUNCTION_ARGS);
+extern Datum xpath(PG_FUNCTION_ARGS);
+extern Datum xpath_exists(PG_FUNCTION_ARGS);
+extern Datum xmlexists(PG_FUNCTION_ARGS);
+extern Datum xml_is_well_formed(PG_FUNCTION_ARGS);
+extern Datum xml_is_well_formed_document(PG_FUNCTION_ARGS);
+extern Datum xml_is_well_formed_content(PG_FUNCTION_ARGS);
+
+extern Datum table_to_xml(PG_FUNCTION_ARGS);
+extern Datum query_to_xml(PG_FUNCTION_ARGS);
+extern Datum cursor_to_xml(PG_FUNCTION_ARGS);
+extern Datum table_to_xmlschema(PG_FUNCTION_ARGS);
+extern Datum query_to_xmlschema(PG_FUNCTION_ARGS);
+extern Datum cursor_to_xmlschema(PG_FUNCTION_ARGS);
+extern Datum table_to_xml_and_xmlschema(PG_FUNCTION_ARGS);
+extern Datum query_to_xml_and_xmlschema(PG_FUNCTION_ARGS);
+
+extern Datum schema_to_xml(PG_FUNCTION_ARGS);
+extern Datum schema_to_xmlschema(PG_FUNCTION_ARGS);
+extern Datum schema_to_xml_and_xmlschema(PG_FUNCTION_ARGS);
+
+extern Datum database_to_xml(PG_FUNCTION_ARGS);
+extern Datum database_to_xmlschema(PG_FUNCTION_ARGS);
+extern Datum database_to_xml_and_xmlschema(PG_FUNCTION_ARGS);
+
+extern void pg_xml_init_library(void);
+extern PgXmlErrorContext *pg_xml_init(PgXmlStrictness strictness);
+extern void pg_xml_done(PgXmlErrorContext *errcxt, bool isError);
+extern bool pg_xml_error_occurred(PgXmlErrorContext *errcxt);
+extern void xml_ereport(PgXmlErrorContext *errcxt, int level, int sqlcode,
+			const char *msg);
+
+extern xmltype *xmlconcat(List *args);
+extern xmltype *xmlelement(XmlExprState *xmlExpr, ExprContext *econtext);
+extern xmltype *xmlparse(text *data, XmlOptionType xmloption, bool preserve_whitespace);
+extern xmltype *xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is_null);
+extern xmltype *xmlroot(xmltype *data, text *version, int standalone);
+extern bool xml_is_document(xmltype *arg);
+extern text *xmltotext_with_xmloption(xmltype *data, XmlOptionType xmloption_arg);
+extern char *escape_xml(const char *str);
+
+extern char *map_sql_identifier_to_xml_name(char *ident, bool fully_escaped, bool escape_period);
+extern char *map_xml_name_to_sql_identifier(char *name);
+extern char *map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings);
+
+extern int	xmlbinary;			/* XmlBinaryType, but int for guc enum */
+
+extern int	xmloption;			/* XmlOptionType, but int for guc enum */
+
+#endif   /* XML_H */
diff --git a/foreign/libpg_query/src/postgres/scan.c b/foreign/libpg_query/src/postgres/scan.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/scan.c
@@ -0,0 +1,11483 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - scanner_init
+ * - core_yylex_init
+ * - core_yyalloc
+ * - yy_init_globals
+ * - core_yyset_extra
+ * - backslash_quote
+ * - escape_string_warning
+ * - standard_conforming_strings
+ * - core_yy_scan_buffer
+ * - core_yy_switch_to_buffer
+ * - core_yyensure_buffer_stack
+ * - core_yyrealloc
+ * - core_yy_load_buffer_state
+ * - yy_fatal_error
+ * - fprintf_to_ereport
+ * - core_yylex
+ * - core_yy_create_buffer
+ * - core_yy_init_buffer
+ * - core_yy_flush_buffer
+ * - core_yyrestart
+ * - yy_start_state_list
+ * - yy_transition
+ * - addlitchar
+ * - litbufdup
+ * - addlit
+ * - litbuf_udeescape
+ * - hexval
+ * - check_unicode_value
+ * - check_uescapechar
+ * - check_escape_warning
+ * - is_utf16_surrogate_first
+ * - is_utf16_surrogate_second
+ * - addunicode
+ * - surrogate_pair_to_codepoint
+ * - check_string_escape_warning
+ * - unescape_single_char
+ * - process_integer_literal
+ * - yy_get_previous_state
+ * - yy_try_NUL_trans
+ * - yy_get_next_buffer
+ * - scanner_errposition
+ * - scanner_yyerror
+ * - scanner_finish
+ *--------------------------------------------------------------------
+ */
+
+#line 2 "scan.c"
+
+#line 4 "scan.c"
+
+#define  YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 35
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* First, we deal with  platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types. 
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+typedef uint64_t flex_uint64_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t; 
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN               (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN              (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN              (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX               (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX              (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX              (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX              (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX             (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX             (4294967295U)
+#endif
+
+#endif /* ! FLEXINT_H */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else	/* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif	/* defined (__STDC__) */
+#endif	/* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index.  If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* An opaque pointer. */
+#ifndef YY_TYPEDEF_YY_SCANNER_T
+#define YY_TYPEDEF_YY_SCANNER_T
+typedef void* yyscan_t;
+#endif
+
+/* For convenience, these vars (plus the bison vars far below)
+   are macros in the reentrant scanner. */
+#define yyin yyg->yyin_r
+#define yyout yyg->yyout_r
+#define yyextra yyg->yyextra_r
+#define yyleng yyg->yyleng_r
+#define yytext yyg->yytext_r
+#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
+#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
+#define yy_flex_debug yyg->yy_flex_debug_r
+
+/* Enter a start condition.  This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yyg->yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state.  The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yyg->yy_start - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE core_yyrestart(yyin ,yyscanner )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE 16384
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+    #define YY_LESS_LINENO(n)
+    
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+		*yy_cp = yyg->yy_hold_char; \
+		YY_RESTORE_YY_MORE_OFFSET \
+		yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+		} \
+	while ( 0 )
+
+#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+	{
+	FILE *yy_input_file;
+
+	char *yy_ch_buf;		/* input buffer */
+	char *yy_buf_pos;		/* current position in input buffer */
+
+	/* Size of input buffer in bytes, not including room for EOB
+	 * characters.
+	 */
+	yy_size_t yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	yy_size_t yy_n_chars;
+
+	/* Whether we "own" the buffer - i.e., we know we created it,
+	 * and can realloc() it to grow it, and should free() it to
+	 * delete it.
+	 */
+	int yy_is_our_buffer;
+
+	/* Whether this is an "interactive" input source; if so, and
+	 * if we're using stdio for input, then we want to use getc()
+	 * instead of fread(), to make sure we stop fetching input after
+	 * each newline.
+	 */
+	int yy_is_interactive;
+
+	/* Whether we're considered to be at the beginning of a line.
+	 * If so, '^' rules will be active on the next match, otherwise
+	 * not.
+	 */
+	int yy_at_bol;
+
+    int yy_bs_lineno; /**< The line count. */
+    int yy_bs_column; /**< The column count. */
+    
+	/* Whether to try to fill the input buffer when we reach the
+	 * end of it.
+	 */
+	int yy_fill_buffer;
+
+	int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+	/* When an EOF's been seen but there's still some text to process
+	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+	 * shouldn't try reading from the input source any more.  We might
+	 * still have a bunch of tokens to match, though, because of
+	 * possible backing-up.
+	 *
+	 * When we actually see the EOF, we change the status to "new"
+	 * (via core_yyrestart()), so that the user can continue scanning by
+	 * just pointing yyin at a new input file.
+	 */
+#define YY_BUFFER_EOF_PENDING 2
+
+	};
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
+                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
+                          : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
+
+void core_yyrestart (FILE *input_file ,yyscan_t yyscanner );
+void core_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
+YY_BUFFER_STATE core_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
+void core_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+void core_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+void core_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
+void core_yypop_buffer_state (yyscan_t yyscanner );
+
+static void core_yyensure_buffer_stack (yyscan_t yyscanner );
+static void core_yy_load_buffer_state (yyscan_t yyscanner );
+static void core_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
+
+#define YY_FLUSH_BUFFER core_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
+
+YY_BUFFER_STATE core_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
+YY_BUFFER_STATE core_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
+YY_BUFFER_STATE core_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
+
+void *core_yyalloc (yy_size_t ,yyscan_t yyscanner );
+void *core_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
+void core_yyfree (void * ,yyscan_t yyscanner );
+
+#define yy_new_buffer core_yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+	{ \
+	if ( ! YY_CURRENT_BUFFER ){ \
+        core_yyensure_buffer_stack (yyscanner); \
+		YY_CURRENT_BUFFER_LVALUE =    \
+            core_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+	} \
+	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+	}
+
+#define yy_set_bol(at_bol) \
+	{ \
+	if ( ! YY_CURRENT_BUFFER ){\
+        core_yyensure_buffer_stack (yyscanner); \
+		YY_CURRENT_BUFFER_LVALUE =    \
+            core_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+	} \
+	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+	}
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* Begin user sect3 */
+
+#define core_yywrap(n) 1
+#define YY_SKIP_YYWRAP
+
+typedef unsigned char YY_CHAR;
+
+typedef yyconst struct yy_trans_info *yy_state_type;
+
+#define yytext_ptr yytext_r
+
+static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
+static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
+static int yy_get_next_buffer (yyscan_t yyscanner );
+static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+	yyg->yytext_ptr = yy_bp; \
+	yyleng = (yy_size_t) (yy_cp - yy_bp); \
+	yyg->yy_hold_char = *yy_cp; \
+	*yy_cp = '\0'; \
+	yyg->yy_c_buf_p = yy_cp;
+
+#define YY_NUM_RULES 80
+#define YY_END_OF_BUFFER 81
+struct yy_trans_info
+	{
+	flex_int32_t yy_verify;
+	flex_int32_t yy_nxt;
+	};
+static yyconst struct yy_trans_info yy_transition[37005] =
+    {
+ {   0,   0 }, {   0,36749 }, {   0,   0 }, {   0,36747 }, {   1,6708 },
+ {   2,6708 }, {   3,6708 }, {   4,6708 }, {   5,6708 }, {   6,6708 },
+ {   7,6708 }, {   8,6708 }, {   9,6710 }, {  10,6715 }, {  11,6708 },
+ {  12,6710 }, {  13,6710 }, {  14,6708 }, {  15,6708 }, {  16,6708 },
+ {  17,6708 }, {  18,6708 }, {  19,6708 }, {  20,6708 }, {  21,6708 },
+ {  22,6708 }, {  23,6708 }, {  24,6708 }, {  25,6708 }, {  26,6708 },
+ {  27,6708 }, {  28,6708 }, {  29,6708 }, {  30,6708 }, {  31,6708 },
+ {  32,6710 }, {  33,6717 }, {  34,6712 }, {  35,6757 }, {  36,6823 },
+ {  37,7080 }, {  38,6757 }, {  39,6730 }, {  40,6732 }, {  41,6732 },
+ {  42,7080 }, {  43,7080 }, {  44,6732 }, {  45,7091 }, {  46,7110 },
+
+ {  47,7181 }, {  48,7183 }, {  49,7183 }, {  50,7183 }, {  51,7183 },
+ {  52,7183 }, {  53,7183 }, {  54,7183 }, {  55,7183 }, {  56,7183 },
+ {  57,7183 }, {  58,6735 }, {  59,6732 }, {  60,7248 }, {  61,7259 },
+ {  62,7326 }, {  63,7080 }, {  64,6757 }, {  65,7358 }, {  66,7615 },
+ {  67,7358 }, {  68,7358 }, {  69,7872 }, {  70,7358 }, {  71,7358 },
+ {  72,7358 }, {  73,7358 }, {  74,7358 }, {  75,7358 }, {  76,7358 },
+ {  77,7358 }, {  78,8129 }, {  79,7358 }, {  80,7358 }, {  81,7358 },
+ {  82,7358 }, {  83,7358 }, {  84,7358 }, {  85,8386 }, {  86,7358 },
+ {  87,7358 }, {  88,8643 }, {  89,7358 }, {  90,7358 }, {  91,6732 },
+ {  92,6708 }, {  93,6732 }, {  94,7080 }, {  95,7358 }, {  96,6757 },
+
+ {  97,7358 }, {  98,7615 }, {  99,7358 }, { 100,7358 }, { 101,7872 },
+ { 102,7358 }, { 103,7358 }, { 104,7358 }, { 105,7358 }, { 106,7358 },
+ { 107,7358 }, { 108,7358 }, { 109,7358 }, { 110,8129 }, { 111,7358 },
+ { 112,7358 }, { 113,7358 }, { 114,7358 }, { 115,7358 }, { 116,7358 },
+ { 117,8386 }, { 118,7358 }, { 119,7358 }, { 120,8643 }, { 121,7358 },
+ { 122,7358 }, { 123,6708 }, { 124,6757 }, { 125,6708 }, { 126,6757 },
+ { 127,6708 }, { 128,7358 }, { 129,7358 }, { 130,7358 }, { 131,7358 },
+ { 132,7358 }, { 133,7358 }, { 134,7358 }, { 135,7358 }, { 136,7358 },
+ { 137,7358 }, { 138,7358 }, { 139,7358 }, { 140,7358 }, { 141,7358 },
+ { 142,7358 }, { 143,7358 }, { 144,7358 }, { 145,7358 }, { 146,7358 },
+
+ { 147,7358 }, { 148,7358 }, { 149,7358 }, { 150,7358 }, { 151,7358 },
+ { 152,7358 }, { 153,7358 }, { 154,7358 }, { 155,7358 }, { 156,7358 },
+ { 157,7358 }, { 158,7358 }, { 159,7358 }, { 160,7358 }, { 161,7358 },
+ { 162,7358 }, { 163,7358 }, { 164,7358 }, { 165,7358 }, { 166,7358 },
+ { 167,7358 }, { 168,7358 }, { 169,7358 }, { 170,7358 }, { 171,7358 },
+ { 172,7358 }, { 173,7358 }, { 174,7358 }, { 175,7358 }, { 176,7358 },
+ { 177,7358 }, { 178,7358 }, { 179,7358 }, { 180,7358 }, { 181,7358 },
+ { 182,7358 }, { 183,7358 }, { 184,7358 }, { 185,7358 }, { 186,7358 },
+ { 187,7358 }, { 188,7358 }, { 189,7358 }, { 190,7358 }, { 191,7358 },
+ { 192,7358 }, { 193,7358 }, { 194,7358 }, { 195,7358 }, { 196,7358 },
+
+ { 197,7358 }, { 198,7358 }, { 199,7358 }, { 200,7358 }, { 201,7358 },
+ { 202,7358 }, { 203,7358 }, { 204,7358 }, { 205,7358 }, { 206,7358 },
+ { 207,7358 }, { 208,7358 }, { 209,7358 }, { 210,7358 }, { 211,7358 },
+ { 212,7358 }, { 213,7358 }, { 214,7358 }, { 215,7358 }, { 216,7358 },
+ { 217,7358 }, { 218,7358 }, { 219,7358 }, { 220,7358 }, { 221,7358 },
+ { 222,7358 }, { 223,7358 }, { 224,7358 }, { 225,7358 }, { 226,7358 },
+ { 227,7358 }, { 228,7358 }, { 229,7358 }, { 230,7358 }, { 231,7358 },
+ { 232,7358 }, { 233,7358 }, { 234,7358 }, { 235,7358 }, { 236,7358 },
+ { 237,7358 }, { 238,7358 }, { 239,7358 }, { 240,7358 }, { 241,7358 },
+ { 242,7358 }, { 243,7358 }, { 244,7358 }, { 245,7358 }, { 246,7358 },
+
+ { 247,7358 }, { 248,7358 }, { 249,7358 }, { 250,7358 }, { 251,7358 },
+ { 252,7358 }, { 253,7358 }, { 254,7358 }, { 255,7358 }, { 256,6708 },
+ {   0,   0 }, {   0,36489 }, {   1,6450 }, {   2,6450 }, {   3,6450 },
+ {   4,6450 }, {   5,6450 }, {   6,6450 }, {   7,6450 }, {   8,6450 },
+ {   9,6452 }, {  10,6457 }, {  11,6450 }, {  12,6452 }, {  13,6452 },
+ {  14,6450 }, {  15,6450 }, {  16,6450 }, {  17,6450 }, {  18,6450 },
+ {  19,6450 }, {  20,6450 }, {  21,6450 }, {  22,6450 }, {  23,6450 },
+ {  24,6450 }, {  25,6450 }, {  26,6450 }, {  27,6450 }, {  28,6450 },
+ {  29,6450 }, {  30,6450 }, {  31,6450 }, {  32,6452 }, {  33,6459 },
+ {  34,6454 }, {  35,6499 }, {  36,6565 }, {  37,6822 }, {  38,6499 },
+
+ {  39,6472 }, {  40,6474 }, {  41,6474 }, {  42,6822 }, {  43,6822 },
+ {  44,6474 }, {  45,6833 }, {  46,6852 }, {  47,6923 }, {  48,6925 },
+ {  49,6925 }, {  50,6925 }, {  51,6925 }, {  52,6925 }, {  53,6925 },
+ {  54,6925 }, {  55,6925 }, {  56,6925 }, {  57,6925 }, {  58,6477 },
+ {  59,6474 }, {  60,6990 }, {  61,7001 }, {  62,7068 }, {  63,6822 },
+ {  64,6499 }, {  65,7100 }, {  66,7357 }, {  67,7100 }, {  68,7100 },
+ {  69,7614 }, {  70,7100 }, {  71,7100 }, {  72,7100 }, {  73,7100 },
+ {  74,7100 }, {  75,7100 }, {  76,7100 }, {  77,7100 }, {  78,7871 },
+ {  79,7100 }, {  80,7100 }, {  81,7100 }, {  82,7100 }, {  83,7100 },
+ {  84,7100 }, {  85,8128 }, {  86,7100 }, {  87,7100 }, {  88,8385 },
+
+ {  89,7100 }, {  90,7100 }, {  91,6474 }, {  92,6450 }, {  93,6474 },
+ {  94,6822 }, {  95,7100 }, {  96,6499 }, {  97,7100 }, {  98,7357 },
+ {  99,7100 }, { 100,7100 }, { 101,7614 }, { 102,7100 }, { 103,7100 },
+ { 104,7100 }, { 105,7100 }, { 106,7100 }, { 107,7100 }, { 108,7100 },
+ { 109,7100 }, { 110,7871 }, { 111,7100 }, { 112,7100 }, { 113,7100 },
+ { 114,7100 }, { 115,7100 }, { 116,7100 }, { 117,8128 }, { 118,7100 },
+ { 119,7100 }, { 120,8385 }, { 121,7100 }, { 122,7100 }, { 123,6450 },
+ { 124,6499 }, { 125,6450 }, { 126,6499 }, { 127,6450 }, { 128,7100 },
+ { 129,7100 }, { 130,7100 }, { 131,7100 }, { 132,7100 }, { 133,7100 },
+ { 134,7100 }, { 135,7100 }, { 136,7100 }, { 137,7100 }, { 138,7100 },
+
+ { 139,7100 }, { 140,7100 }, { 141,7100 }, { 142,7100 }, { 143,7100 },
+ { 144,7100 }, { 145,7100 }, { 146,7100 }, { 147,7100 }, { 148,7100 },
+ { 149,7100 }, { 150,7100 }, { 151,7100 }, { 152,7100 }, { 153,7100 },
+ { 154,7100 }, { 155,7100 }, { 156,7100 }, { 157,7100 }, { 158,7100 },
+ { 159,7100 }, { 160,7100 }, { 161,7100 }, { 162,7100 }, { 163,7100 },
+ { 164,7100 }, { 165,7100 }, { 166,7100 }, { 167,7100 }, { 168,7100 },
+ { 169,7100 }, { 170,7100 }, { 171,7100 }, { 172,7100 }, { 173,7100 },
+ { 174,7100 }, { 175,7100 }, { 176,7100 }, { 177,7100 }, { 178,7100 },
+ { 179,7100 }, { 180,7100 }, { 181,7100 }, { 182,7100 }, { 183,7100 },
+ { 184,7100 }, { 185,7100 }, { 186,7100 }, { 187,7100 }, { 188,7100 },
+
+ { 189,7100 }, { 190,7100 }, { 191,7100 }, { 192,7100 }, { 193,7100 },
+ { 194,7100 }, { 195,7100 }, { 196,7100 }, { 197,7100 }, { 198,7100 },
+ { 199,7100 }, { 200,7100 }, { 201,7100 }, { 202,7100 }, { 203,7100 },
+ { 204,7100 }, { 205,7100 }, { 206,7100 }, { 207,7100 }, { 208,7100 },
+ { 209,7100 }, { 210,7100 }, { 211,7100 }, { 212,7100 }, { 213,7100 },
+ { 214,7100 }, { 215,7100 }, { 216,7100 }, { 217,7100 }, { 218,7100 },
+ { 219,7100 }, { 220,7100 }, { 221,7100 }, { 222,7100 }, { 223,7100 },
+ { 224,7100 }, { 225,7100 }, { 226,7100 }, { 227,7100 }, { 228,7100 },
+ { 229,7100 }, { 230,7100 }, { 231,7100 }, { 232,7100 }, { 233,7100 },
+ { 234,7100 }, { 235,7100 }, { 236,7100 }, { 237,7100 }, { 238,7100 },
+
+ { 239,7100 }, { 240,7100 }, { 241,7100 }, { 242,7100 }, { 243,7100 },
+ { 244,7100 }, { 245,7100 }, { 246,7100 }, { 247,7100 }, { 248,7100 },
+ { 249,7100 }, { 250,7100 }, { 251,7100 }, { 252,7100 }, { 253,7100 },
+ { 254,7100 }, { 255,7100 }, { 256,6450 }, {   0,  12 }, {   0,36231 },
+ {   1,8384 }, {   2,8384 }, {   3,8384 }, {   4,8384 }, {   5,8384 },
+ {   6,8384 }, {   7,8384 }, {   8,8384 }, {   9,8384 }, {  10,8384 },
+ {  11,8384 }, {  12,8384 }, {  13,8384 }, {  14,8384 }, {  15,8384 },
+ {  16,8384 }, {  17,8384 }, {  18,8384 }, {  19,8384 }, {  20,8384 },
+ {  21,8384 }, {  22,8384 }, {  23,8384 }, {  24,8384 }, {  25,8384 },
+ {  26,8384 }, {  27,8384 }, {  28,8384 }, {  29,8384 }, {  30,8384 },
+
+ {  31,8384 }, {  32,8384 }, {  33,8384 }, {  34,8384 }, {  35,8384 },
+ {  36,8384 }, {  37,8384 }, {  38,8384 }, {  39,8642 }, {  40,8384 },
+ {  41,8384 }, {  42,8384 }, {  43,8384 }, {  44,8384 }, {  45,8384 },
+ {  46,8384 }, {  47,8384 }, {  48,8384 }, {  49,8384 }, {  50,8384 },
+ {  51,8384 }, {  52,8384 }, {  53,8384 }, {  54,8384 }, {  55,8384 },
+ {  56,8384 }, {  57,8384 }, {  58,8384 }, {  59,8384 }, {  60,8384 },
+ {  61,8384 }, {  62,8384 }, {  63,8384 }, {  64,8384 }, {  65,8384 },
+ {  66,8384 }, {  67,8384 }, {  68,8384 }, {  69,8384 }, {  70,8384 },
+ {  71,8384 }, {  72,8384 }, {  73,8384 }, {  74,8384 }, {  75,8384 },
+ {  76,8384 }, {  77,8384 }, {  78,8384 }, {  79,8384 }, {  80,8384 },
+
+ {  81,8384 }, {  82,8384 }, {  83,8384 }, {  84,8384 }, {  85,8384 },
+ {  86,8384 }, {  87,8384 }, {  88,8384 }, {  89,8384 }, {  90,8384 },
+ {  91,8384 }, {  92,8384 }, {  93,8384 }, {  94,8384 }, {  95,8384 },
+ {  96,8384 }, {  97,8384 }, {  98,8384 }, {  99,8384 }, { 100,8384 },
+ { 101,8384 }, { 102,8384 }, { 103,8384 }, { 104,8384 }, { 105,8384 },
+ { 106,8384 }, { 107,8384 }, { 108,8384 }, { 109,8384 }, { 110,8384 },
+ { 111,8384 }, { 112,8384 }, { 113,8384 }, { 114,8384 }, { 115,8384 },
+ { 116,8384 }, { 117,8384 }, { 118,8384 }, { 119,8384 }, { 120,8384 },
+ { 121,8384 }, { 122,8384 }, { 123,8384 }, { 124,8384 }, { 125,8384 },
+ { 126,8384 }, { 127,8384 }, { 128,8384 }, { 129,8384 }, { 130,8384 },
+
+ { 131,8384 }, { 132,8384 }, { 133,8384 }, { 134,8384 }, { 135,8384 },
+ { 136,8384 }, { 137,8384 }, { 138,8384 }, { 139,8384 }, { 140,8384 },
+ { 141,8384 }, { 142,8384 }, { 143,8384 }, { 144,8384 }, { 145,8384 },
+ { 146,8384 }, { 147,8384 }, { 148,8384 }, { 149,8384 }, { 150,8384 },
+ { 151,8384 }, { 152,8384 }, { 153,8384 }, { 154,8384 }, { 155,8384 },
+ { 156,8384 }, { 157,8384 }, { 158,8384 }, { 159,8384 }, { 160,8384 },
+ { 161,8384 }, { 162,8384 }, { 163,8384 }, { 164,8384 }, { 165,8384 },
+ { 166,8384 }, { 167,8384 }, { 168,8384 }, { 169,8384 }, { 170,8384 },
+ { 171,8384 }, { 172,8384 }, { 173,8384 }, { 174,8384 }, { 175,8384 },
+ { 176,8384 }, { 177,8384 }, { 178,8384 }, { 179,8384 }, { 180,8384 },
+
+ { 181,8384 }, { 182,8384 }, { 183,8384 }, { 184,8384 }, { 185,8384 },
+ { 186,8384 }, { 187,8384 }, { 188,8384 }, { 189,8384 }, { 190,8384 },
+ { 191,8384 }, { 192,8384 }, { 193,8384 }, { 194,8384 }, { 195,8384 },
+ { 196,8384 }, { 197,8384 }, { 198,8384 }, { 199,8384 }, { 200,8384 },
+ { 201,8384 }, { 202,8384 }, { 203,8384 }, { 204,8384 }, { 205,8384 },
+ { 206,8384 }, { 207,8384 }, { 208,8384 }, { 209,8384 }, { 210,8384 },
+ { 211,8384 }, { 212,8384 }, { 213,8384 }, { 214,8384 }, { 215,8384 },
+ { 216,8384 }, { 217,8384 }, { 218,8384 }, { 219,8384 }, { 220,8384 },
+ { 221,8384 }, { 222,8384 }, { 223,8384 }, { 224,8384 }, { 225,8384 },
+ { 226,8384 }, { 227,8384 }, { 228,8384 }, { 229,8384 }, { 230,8384 },
+
+ { 231,8384 }, { 232,8384 }, { 233,8384 }, { 234,8384 }, { 235,8384 },
+ { 236,8384 }, { 237,8384 }, { 238,8384 }, { 239,8384 }, { 240,8384 },
+ { 241,8384 }, { 242,8384 }, { 243,8384 }, { 244,8384 }, { 245,8384 },
+ { 246,8384 }, { 247,8384 }, { 248,8384 }, { 249,8384 }, { 250,8384 },
+ { 251,8384 }, { 252,8384 }, { 253,8384 }, { 254,8384 }, { 255,8384 },
+ { 256,8384 }, {   0,  12 }, {   0,35973 }, {   1,8126 }, {   2,8126 },
+ {   3,8126 }, {   4,8126 }, {   5,8126 }, {   6,8126 }, {   7,8126 },
+ {   8,8126 }, {   9,8126 }, {  10,8126 }, {  11,8126 }, {  12,8126 },
+ {  13,8126 }, {  14,8126 }, {  15,8126 }, {  16,8126 }, {  17,8126 },
+ {  18,8126 }, {  19,8126 }, {  20,8126 }, {  21,8126 }, {  22,8126 },
+
+ {  23,8126 }, {  24,8126 }, {  25,8126 }, {  26,8126 }, {  27,8126 },
+ {  28,8126 }, {  29,8126 }, {  30,8126 }, {  31,8126 }, {  32,8126 },
+ {  33,8126 }, {  34,8126 }, {  35,8126 }, {  36,8126 }, {  37,8126 },
+ {  38,8126 }, {  39,8384 }, {  40,8126 }, {  41,8126 }, {  42,8126 },
+ {  43,8126 }, {  44,8126 }, {  45,8126 }, {  46,8126 }, {  47,8126 },
+ {  48,8126 }, {  49,8126 }, {  50,8126 }, {  51,8126 }, {  52,8126 },
+ {  53,8126 }, {  54,8126 }, {  55,8126 }, {  56,8126 }, {  57,8126 },
+ {  58,8126 }, {  59,8126 }, {  60,8126 }, {  61,8126 }, {  62,8126 },
+ {  63,8126 }, {  64,8126 }, {  65,8126 }, {  66,8126 }, {  67,8126 },
+ {  68,8126 }, {  69,8126 }, {  70,8126 }, {  71,8126 }, {  72,8126 },
+
+ {  73,8126 }, {  74,8126 }, {  75,8126 }, {  76,8126 }, {  77,8126 },
+ {  78,8126 }, {  79,8126 }, {  80,8126 }, {  81,8126 }, {  82,8126 },
+ {  83,8126 }, {  84,8126 }, {  85,8126 }, {  86,8126 }, {  87,8126 },
+ {  88,8126 }, {  89,8126 }, {  90,8126 }, {  91,8126 }, {  92,8126 },
+ {  93,8126 }, {  94,8126 }, {  95,8126 }, {  96,8126 }, {  97,8126 },
+ {  98,8126 }, {  99,8126 }, { 100,8126 }, { 101,8126 }, { 102,8126 },
+ { 103,8126 }, { 104,8126 }, { 105,8126 }, { 106,8126 }, { 107,8126 },
+ { 108,8126 }, { 109,8126 }, { 110,8126 }, { 111,8126 }, { 112,8126 },
+ { 113,8126 }, { 114,8126 }, { 115,8126 }, { 116,8126 }, { 117,8126 },
+ { 118,8126 }, { 119,8126 }, { 120,8126 }, { 121,8126 }, { 122,8126 },
+
+ { 123,8126 }, { 124,8126 }, { 125,8126 }, { 126,8126 }, { 127,8126 },
+ { 128,8126 }, { 129,8126 }, { 130,8126 }, { 131,8126 }, { 132,8126 },
+ { 133,8126 }, { 134,8126 }, { 135,8126 }, { 136,8126 }, { 137,8126 },
+ { 138,8126 }, { 139,8126 }, { 140,8126 }, { 141,8126 }, { 142,8126 },
+ { 143,8126 }, { 144,8126 }, { 145,8126 }, { 146,8126 }, { 147,8126 },
+ { 148,8126 }, { 149,8126 }, { 150,8126 }, { 151,8126 }, { 152,8126 },
+ { 153,8126 }, { 154,8126 }, { 155,8126 }, { 156,8126 }, { 157,8126 },
+ { 158,8126 }, { 159,8126 }, { 160,8126 }, { 161,8126 }, { 162,8126 },
+ { 163,8126 }, { 164,8126 }, { 165,8126 }, { 166,8126 }, { 167,8126 },
+ { 168,8126 }, { 169,8126 }, { 170,8126 }, { 171,8126 }, { 172,8126 },
+
+ { 173,8126 }, { 174,8126 }, { 175,8126 }, { 176,8126 }, { 177,8126 },
+ { 178,8126 }, { 179,8126 }, { 180,8126 }, { 181,8126 }, { 182,8126 },
+ { 183,8126 }, { 184,8126 }, { 185,8126 }, { 186,8126 }, { 187,8126 },
+ { 188,8126 }, { 189,8126 }, { 190,8126 }, { 191,8126 }, { 192,8126 },
+ { 193,8126 }, { 194,8126 }, { 195,8126 }, { 196,8126 }, { 197,8126 },
+ { 198,8126 }, { 199,8126 }, { 200,8126 }, { 201,8126 }, { 202,8126 },
+ { 203,8126 }, { 204,8126 }, { 205,8126 }, { 206,8126 }, { 207,8126 },
+ { 208,8126 }, { 209,8126 }, { 210,8126 }, { 211,8126 }, { 212,8126 },
+ { 213,8126 }, { 214,8126 }, { 215,8126 }, { 216,8126 }, { 217,8126 },
+ { 218,8126 }, { 219,8126 }, { 220,8126 }, { 221,8126 }, { 222,8126 },
+
+ { 223,8126 }, { 224,8126 }, { 225,8126 }, { 226,8126 }, { 227,8126 },
+ { 228,8126 }, { 229,8126 }, { 230,8126 }, { 231,8126 }, { 232,8126 },
+ { 233,8126 }, { 234,8126 }, { 235,8126 }, { 236,8126 }, { 237,8126 },
+ { 238,8126 }, { 239,8126 }, { 240,8126 }, { 241,8126 }, { 242,8126 },
+ { 243,8126 }, { 244,8126 }, { 245,8126 }, { 246,8126 }, { 247,8126 },
+ { 248,8126 }, { 249,8126 }, { 250,8126 }, { 251,8126 }, { 252,8126 },
+ { 253,8126 }, { 254,8126 }, { 255,8126 }, { 256,8126 }, {   0,   0 },
+ {   0,35715 }, {   1,8173 }, {   2,8173 }, {   3,8173 }, {   4,8173 },
+ {   5,8173 }, {   6,8173 }, {   7,8173 }, {   8,8173 }, {   9,8173 },
+ {  10,8173 }, {  11,8173 }, {  12,8173 }, {  13,8173 }, {  14,8173 },
+
+ {  15,8173 }, {  16,8173 }, {  17,8173 }, {  18,8173 }, {  19,8173 },
+ {  20,8173 }, {  21,8173 }, {  22,8173 }, {  23,8173 }, {  24,8173 },
+ {  25,8173 }, {  26,8173 }, {  27,8173 }, {  28,8173 }, {  29,8173 },
+ {  30,8173 }, {  31,8173 }, {  32,8173 }, {  33,8431 }, {  34,8173 },
+ {  35,8431 }, {  36,8173 }, {  37,8431 }, {  38,8431 }, {  39,8173 },
+ {  40,8173 }, {  41,8173 }, {  42,5708 }, {  43,8431 }, {  44,8173 },
+ {  45,8431 }, {  46,8173 }, {  47,5712 }, {  48,8173 }, {  49,8173 },
+ {  50,8173 }, {  51,8173 }, {  52,8173 }, {  53,8173 }, {  54,8173 },
+ {  55,8173 }, {  56,8173 }, {  57,8173 }, {  58,8173 }, {  59,8173 },
+ {  60,8431 }, {  61,8431 }, {  62,8431 }, {  63,8431 }, {  64,8431 },
+
+ {  65,8173 }, {  66,8173 }, {  67,8173 }, {  68,8173 }, {  69,8173 },
+ {  70,8173 }, {  71,8173 }, {  72,8173 }, {  73,8173 }, {  74,8173 },
+ {  75,8173 }, {  76,8173 }, {  77,8173 }, {  78,8173 }, {  79,8173 },
+ {  80,8173 }, {  81,8173 }, {  82,8173 }, {  83,8173 }, {  84,8173 },
+ {  85,8173 }, {  86,8173 }, {  87,8173 }, {  88,8173 }, {  89,8173 },
+ {  90,8173 }, {  91,8173 }, {  92,8173 }, {  93,8173 }, {  94,8431 },
+ {  95,8173 }, {  96,8431 }, {  97,8173 }, {  98,8173 }, {  99,8173 },
+ { 100,8173 }, { 101,8173 }, { 102,8173 }, { 103,8173 }, { 104,8173 },
+ { 105,8173 }, { 106,8173 }, { 107,8173 }, { 108,8173 }, { 109,8173 },
+ { 110,8173 }, { 111,8173 }, { 112,8173 }, { 113,8173 }, { 114,8173 },
+
+ { 115,8173 }, { 116,8173 }, { 117,8173 }, { 118,8173 }, { 119,8173 },
+ { 120,8173 }, { 121,8173 }, { 122,8173 }, { 123,8173 }, { 124,8431 },
+ { 125,8173 }, { 126,8431 }, { 127,8173 }, { 128,8173 }, { 129,8173 },
+ { 130,8173 }, { 131,8173 }, { 132,8173 }, { 133,8173 }, { 134,8173 },
+ { 135,8173 }, { 136,8173 }, { 137,8173 }, { 138,8173 }, { 139,8173 },
+ { 140,8173 }, { 141,8173 }, { 142,8173 }, { 143,8173 }, { 144,8173 },
+ { 145,8173 }, { 146,8173 }, { 147,8173 }, { 148,8173 }, { 149,8173 },
+ { 150,8173 }, { 151,8173 }, { 152,8173 }, { 153,8173 }, { 154,8173 },
+ { 155,8173 }, { 156,8173 }, { 157,8173 }, { 158,8173 }, { 159,8173 },
+ { 160,8173 }, { 161,8173 }, { 162,8173 }, { 163,8173 }, { 164,8173 },
+
+ { 165,8173 }, { 166,8173 }, { 167,8173 }, { 168,8173 }, { 169,8173 },
+ { 170,8173 }, { 171,8173 }, { 172,8173 }, { 173,8173 }, { 174,8173 },
+ { 175,8173 }, { 176,8173 }, { 177,8173 }, { 178,8173 }, { 179,8173 },
+ { 180,8173 }, { 181,8173 }, { 182,8173 }, { 183,8173 }, { 184,8173 },
+ { 185,8173 }, { 186,8173 }, { 187,8173 }, { 188,8173 }, { 189,8173 },
+ { 190,8173 }, { 191,8173 }, { 192,8173 }, { 193,8173 }, { 194,8173 },
+ { 195,8173 }, { 196,8173 }, { 197,8173 }, { 198,8173 }, { 199,8173 },
+ { 200,8173 }, { 201,8173 }, { 202,8173 }, { 203,8173 }, { 204,8173 },
+ { 205,8173 }, { 206,8173 }, { 207,8173 }, { 208,8173 }, { 209,8173 },
+ { 210,8173 }, { 211,8173 }, { 212,8173 }, { 213,8173 }, { 214,8173 },
+
+ { 215,8173 }, { 216,8173 }, { 217,8173 }, { 218,8173 }, { 219,8173 },
+ { 220,8173 }, { 221,8173 }, { 222,8173 }, { 223,8173 }, { 224,8173 },
+ { 225,8173 }, { 226,8173 }, { 227,8173 }, { 228,8173 }, { 229,8173 },
+ { 230,8173 }, { 231,8173 }, { 232,8173 }, { 233,8173 }, { 234,8173 },
+ { 235,8173 }, { 236,8173 }, { 237,8173 }, { 238,8173 }, { 239,8173 },
+ { 240,8173 }, { 241,8173 }, { 242,8173 }, { 243,8173 }, { 244,8173 },
+ { 245,8173 }, { 246,8173 }, { 247,8173 }, { 248,8173 }, { 249,8173 },
+ { 250,8173 }, { 251,8173 }, { 252,8173 }, { 253,8173 }, { 254,8173 },
+ { 255,8173 }, { 256,8173 }, {   0,   0 }, {   0,35457 }, {   1,7915 },
+ {   2,7915 }, {   3,7915 }, {   4,7915 }, {   5,7915 }, {   6,7915 },
+
+ {   7,7915 }, {   8,7915 }, {   9,7915 }, {  10,7915 }, {  11,7915 },
+ {  12,7915 }, {  13,7915 }, {  14,7915 }, {  15,7915 }, {  16,7915 },
+ {  17,7915 }, {  18,7915 }, {  19,7915 }, {  20,7915 }, {  21,7915 },
+ {  22,7915 }, {  23,7915 }, {  24,7915 }, {  25,7915 }, {  26,7915 },
+ {  27,7915 }, {  28,7915 }, {  29,7915 }, {  30,7915 }, {  31,7915 },
+ {  32,7915 }, {  33,8173 }, {  34,7915 }, {  35,8173 }, {  36,7915 },
+ {  37,8173 }, {  38,8173 }, {  39,7915 }, {  40,7915 }, {  41,7915 },
+ {  42,5450 }, {  43,8173 }, {  44,7915 }, {  45,8173 }, {  46,7915 },
+ {  47,5454 }, {  48,7915 }, {  49,7915 }, {  50,7915 }, {  51,7915 },
+ {  52,7915 }, {  53,7915 }, {  54,7915 }, {  55,7915 }, {  56,7915 },
+
+ {  57,7915 }, {  58,7915 }, {  59,7915 }, {  60,8173 }, {  61,8173 },
+ {  62,8173 }, {  63,8173 }, {  64,8173 }, {  65,7915 }, {  66,7915 },
+ {  67,7915 }, {  68,7915 }, {  69,7915 }, {  70,7915 }, {  71,7915 },
+ {  72,7915 }, {  73,7915 }, {  74,7915 }, {  75,7915 }, {  76,7915 },
+ {  77,7915 }, {  78,7915 }, {  79,7915 }, {  80,7915 }, {  81,7915 },
+ {  82,7915 }, {  83,7915 }, {  84,7915 }, {  85,7915 }, {  86,7915 },
+ {  87,7915 }, {  88,7915 }, {  89,7915 }, {  90,7915 }, {  91,7915 },
+ {  92,7915 }, {  93,7915 }, {  94,8173 }, {  95,7915 }, {  96,8173 },
+ {  97,7915 }, {  98,7915 }, {  99,7915 }, { 100,7915 }, { 101,7915 },
+ { 102,7915 }, { 103,7915 }, { 104,7915 }, { 105,7915 }, { 106,7915 },
+
+ { 107,7915 }, { 108,7915 }, { 109,7915 }, { 110,7915 }, { 111,7915 },
+ { 112,7915 }, { 113,7915 }, { 114,7915 }, { 115,7915 }, { 116,7915 },
+ { 117,7915 }, { 118,7915 }, { 119,7915 }, { 120,7915 }, { 121,7915 },
+ { 122,7915 }, { 123,7915 }, { 124,8173 }, { 125,7915 }, { 126,8173 },
+ { 127,7915 }, { 128,7915 }, { 129,7915 }, { 130,7915 }, { 131,7915 },
+ { 132,7915 }, { 133,7915 }, { 134,7915 }, { 135,7915 }, { 136,7915 },
+ { 137,7915 }, { 138,7915 }, { 139,7915 }, { 140,7915 }, { 141,7915 },
+ { 142,7915 }, { 143,7915 }, { 144,7915 }, { 145,7915 }, { 146,7915 },
+ { 147,7915 }, { 148,7915 }, { 149,7915 }, { 150,7915 }, { 151,7915 },
+ { 152,7915 }, { 153,7915 }, { 154,7915 }, { 155,7915 }, { 156,7915 },
+
+ { 157,7915 }, { 158,7915 }, { 159,7915 }, { 160,7915 }, { 161,7915 },
+ { 162,7915 }, { 163,7915 }, { 164,7915 }, { 165,7915 }, { 166,7915 },
+ { 167,7915 }, { 168,7915 }, { 169,7915 }, { 170,7915 }, { 171,7915 },
+ { 172,7915 }, { 173,7915 }, { 174,7915 }, { 175,7915 }, { 176,7915 },
+ { 177,7915 }, { 178,7915 }, { 179,7915 }, { 180,7915 }, { 181,7915 },
+ { 182,7915 }, { 183,7915 }, { 184,7915 }, { 185,7915 }, { 186,7915 },
+ { 187,7915 }, { 188,7915 }, { 189,7915 }, { 190,7915 }, { 191,7915 },
+ { 192,7915 }, { 193,7915 }, { 194,7915 }, { 195,7915 }, { 196,7915 },
+ { 197,7915 }, { 198,7915 }, { 199,7915 }, { 200,7915 }, { 201,7915 },
+ { 202,7915 }, { 203,7915 }, { 204,7915 }, { 205,7915 }, { 206,7915 },
+
+ { 207,7915 }, { 208,7915 }, { 209,7915 }, { 210,7915 }, { 211,7915 },
+ { 212,7915 }, { 213,7915 }, { 214,7915 }, { 215,7915 }, { 216,7915 },
+ { 217,7915 }, { 218,7915 }, { 219,7915 }, { 220,7915 }, { 221,7915 },
+ { 222,7915 }, { 223,7915 }, { 224,7915 }, { 225,7915 }, { 226,7915 },
+ { 227,7915 }, { 228,7915 }, { 229,7915 }, { 230,7915 }, { 231,7915 },
+ { 232,7915 }, { 233,7915 }, { 234,7915 }, { 235,7915 }, { 236,7915 },
+ { 237,7915 }, { 238,7915 }, { 239,7915 }, { 240,7915 }, { 241,7915 },
+ { 242,7915 }, { 243,7915 }, { 244,7915 }, { 245,7915 }, { 246,7915 },
+ { 247,7915 }, { 248,7915 }, { 249,7915 }, { 250,7915 }, { 251,7915 },
+ { 252,7915 }, { 253,7915 }, { 254,7915 }, { 255,7915 }, { 256,7915 },
+
+ {   0,   0 }, {   0,35199 }, {   1,8173 }, {   2,8173 }, {   3,8173 },
+ {   4,8173 }, {   5,8173 }, {   6,8173 }, {   7,8173 }, {   8,8173 },
+ {   9,8173 }, {  10,8173 }, {  11,8173 }, {  12,8173 }, {  13,8173 },
+ {  14,8173 }, {  15,8173 }, {  16,8173 }, {  17,8173 }, {  18,8173 },
+ {  19,8173 }, {  20,8173 }, {  21,8173 }, {  22,8173 }, {  23,8173 },
+ {  24,8173 }, {  25,8173 }, {  26,8173 }, {  27,8173 }, {  28,8173 },
+ {  29,8173 }, {  30,8173 }, {  31,8173 }, {  32,8173 }, {  33,8173 },
+ {  34,5201 }, {  35,8173 }, {  36,8173 }, {  37,8173 }, {  38,8173 },
+ {  39,8173 }, {  40,8173 }, {  41,8173 }, {  42,8173 }, {  43,8173 },
+ {  44,8173 }, {  45,8173 }, {  46,8173 }, {  47,8173 }, {  48,8173 },
+
+ {  49,8173 }, {  50,8173 }, {  51,8173 }, {  52,8173 }, {  53,8173 },
+ {  54,8173 }, {  55,8173 }, {  56,8173 }, {  57,8173 }, {  58,8173 },
+ {  59,8173 }, {  60,8173 }, {  61,8173 }, {  62,8173 }, {  63,8173 },
+ {  64,8173 }, {  65,8173 }, {  66,8173 }, {  67,8173 }, {  68,8173 },
+ {  69,8173 }, {  70,8173 }, {  71,8173 }, {  72,8173 }, {  73,8173 },
+ {  74,8173 }, {  75,8173 }, {  76,8173 }, {  77,8173 }, {  78,8173 },
+ {  79,8173 }, {  80,8173 }, {  81,8173 }, {  82,8173 }, {  83,8173 },
+ {  84,8173 }, {  85,8173 }, {  86,8173 }, {  87,8173 }, {  88,8173 },
+ {  89,8173 }, {  90,8173 }, {  91,8173 }, {  92,8173 }, {  93,8173 },
+ {  94,8173 }, {  95,8173 }, {  96,8173 }, {  97,8173 }, {  98,8173 },
+
+ {  99,8173 }, { 100,8173 }, { 101,8173 }, { 102,8173 }, { 103,8173 },
+ { 104,8173 }, { 105,8173 }, { 106,8173 }, { 107,8173 }, { 108,8173 },
+ { 109,8173 }, { 110,8173 }, { 111,8173 }, { 112,8173 }, { 113,8173 },
+ { 114,8173 }, { 115,8173 }, { 116,8173 }, { 117,8173 }, { 118,8173 },
+ { 119,8173 }, { 120,8173 }, { 121,8173 }, { 122,8173 }, { 123,8173 },
+ { 124,8173 }, { 125,8173 }, { 126,8173 }, { 127,8173 }, { 128,8173 },
+ { 129,8173 }, { 130,8173 }, { 131,8173 }, { 132,8173 }, { 133,8173 },
+ { 134,8173 }, { 135,8173 }, { 136,8173 }, { 137,8173 }, { 138,8173 },
+ { 139,8173 }, { 140,8173 }, { 141,8173 }, { 142,8173 }, { 143,8173 },
+ { 144,8173 }, { 145,8173 }, { 146,8173 }, { 147,8173 }, { 148,8173 },
+
+ { 149,8173 }, { 150,8173 }, { 151,8173 }, { 152,8173 }, { 153,8173 },
+ { 154,8173 }, { 155,8173 }, { 156,8173 }, { 157,8173 }, { 158,8173 },
+ { 159,8173 }, { 160,8173 }, { 161,8173 }, { 162,8173 }, { 163,8173 },
+ { 164,8173 }, { 165,8173 }, { 166,8173 }, { 167,8173 }, { 168,8173 },
+ { 169,8173 }, { 170,8173 }, { 171,8173 }, { 172,8173 }, { 173,8173 },
+ { 174,8173 }, { 175,8173 }, { 176,8173 }, { 177,8173 }, { 178,8173 },
+ { 179,8173 }, { 180,8173 }, { 181,8173 }, { 182,8173 }, { 183,8173 },
+ { 184,8173 }, { 185,8173 }, { 186,8173 }, { 187,8173 }, { 188,8173 },
+ { 189,8173 }, { 190,8173 }, { 191,8173 }, { 192,8173 }, { 193,8173 },
+ { 194,8173 }, { 195,8173 }, { 196,8173 }, { 197,8173 }, { 198,8173 },
+
+ { 199,8173 }, { 200,8173 }, { 201,8173 }, { 202,8173 }, { 203,8173 },
+ { 204,8173 }, { 205,8173 }, { 206,8173 }, { 207,8173 }, { 208,8173 },
+ { 209,8173 }, { 210,8173 }, { 211,8173 }, { 212,8173 }, { 213,8173 },
+ { 214,8173 }, { 215,8173 }, { 216,8173 }, { 217,8173 }, { 218,8173 },
+ { 219,8173 }, { 220,8173 }, { 221,8173 }, { 222,8173 }, { 223,8173 },
+ { 224,8173 }, { 225,8173 }, { 226,8173 }, { 227,8173 }, { 228,8173 },
+ { 229,8173 }, { 230,8173 }, { 231,8173 }, { 232,8173 }, { 233,8173 },
+ { 234,8173 }, { 235,8173 }, { 236,8173 }, { 237,8173 }, { 238,8173 },
+ { 239,8173 }, { 240,8173 }, { 241,8173 }, { 242,8173 }, { 243,8173 },
+ { 244,8173 }, { 245,8173 }, { 246,8173 }, { 247,8173 }, { 248,8173 },
+
+ { 249,8173 }, { 250,8173 }, { 251,8173 }, { 252,8173 }, { 253,8173 },
+ { 254,8173 }, { 255,8173 }, { 256,8173 }, {   0,   0 }, {   0,34941 },
+ {   1,7915 }, {   2,7915 }, {   3,7915 }, {   4,7915 }, {   5,7915 },
+ {   6,7915 }, {   7,7915 }, {   8,7915 }, {   9,7915 }, {  10,7915 },
+ {  11,7915 }, {  12,7915 }, {  13,7915 }, {  14,7915 }, {  15,7915 },
+ {  16,7915 }, {  17,7915 }, {  18,7915 }, {  19,7915 }, {  20,7915 },
+ {  21,7915 }, {  22,7915 }, {  23,7915 }, {  24,7915 }, {  25,7915 },
+ {  26,7915 }, {  27,7915 }, {  28,7915 }, {  29,7915 }, {  30,7915 },
+ {  31,7915 }, {  32,7915 }, {  33,7915 }, {  34,4943 }, {  35,7915 },
+ {  36,7915 }, {  37,7915 }, {  38,7915 }, {  39,7915 }, {  40,7915 },
+
+ {  41,7915 }, {  42,7915 }, {  43,7915 }, {  44,7915 }, {  45,7915 },
+ {  46,7915 }, {  47,7915 }, {  48,7915 }, {  49,7915 }, {  50,7915 },
+ {  51,7915 }, {  52,7915 }, {  53,7915 }, {  54,7915 }, {  55,7915 },
+ {  56,7915 }, {  57,7915 }, {  58,7915 }, {  59,7915 }, {  60,7915 },
+ {  61,7915 }, {  62,7915 }, {  63,7915 }, {  64,7915 }, {  65,7915 },
+ {  66,7915 }, {  67,7915 }, {  68,7915 }, {  69,7915 }, {  70,7915 },
+ {  71,7915 }, {  72,7915 }, {  73,7915 }, {  74,7915 }, {  75,7915 },
+ {  76,7915 }, {  77,7915 }, {  78,7915 }, {  79,7915 }, {  80,7915 },
+ {  81,7915 }, {  82,7915 }, {  83,7915 }, {  84,7915 }, {  85,7915 },
+ {  86,7915 }, {  87,7915 }, {  88,7915 }, {  89,7915 }, {  90,7915 },
+
+ {  91,7915 }, {  92,7915 }, {  93,7915 }, {  94,7915 }, {  95,7915 },
+ {  96,7915 }, {  97,7915 }, {  98,7915 }, {  99,7915 }, { 100,7915 },
+ { 101,7915 }, { 102,7915 }, { 103,7915 }, { 104,7915 }, { 105,7915 },
+ { 106,7915 }, { 107,7915 }, { 108,7915 }, { 109,7915 }, { 110,7915 },
+ { 111,7915 }, { 112,7915 }, { 113,7915 }, { 114,7915 }, { 115,7915 },
+ { 116,7915 }, { 117,7915 }, { 118,7915 }, { 119,7915 }, { 120,7915 },
+ { 121,7915 }, { 122,7915 }, { 123,7915 }, { 124,7915 }, { 125,7915 },
+ { 126,7915 }, { 127,7915 }, { 128,7915 }, { 129,7915 }, { 130,7915 },
+ { 131,7915 }, { 132,7915 }, { 133,7915 }, { 134,7915 }, { 135,7915 },
+ { 136,7915 }, { 137,7915 }, { 138,7915 }, { 139,7915 }, { 140,7915 },
+
+ { 141,7915 }, { 142,7915 }, { 143,7915 }, { 144,7915 }, { 145,7915 },
+ { 146,7915 }, { 147,7915 }, { 148,7915 }, { 149,7915 }, { 150,7915 },
+ { 151,7915 }, { 152,7915 }, { 153,7915 }, { 154,7915 }, { 155,7915 },
+ { 156,7915 }, { 157,7915 }, { 158,7915 }, { 159,7915 }, { 160,7915 },
+ { 161,7915 }, { 162,7915 }, { 163,7915 }, { 164,7915 }, { 165,7915 },
+ { 166,7915 }, { 167,7915 }, { 168,7915 }, { 169,7915 }, { 170,7915 },
+ { 171,7915 }, { 172,7915 }, { 173,7915 }, { 174,7915 }, { 175,7915 },
+ { 176,7915 }, { 177,7915 }, { 178,7915 }, { 179,7915 }, { 180,7915 },
+ { 181,7915 }, { 182,7915 }, { 183,7915 }, { 184,7915 }, { 185,7915 },
+ { 186,7915 }, { 187,7915 }, { 188,7915 }, { 189,7915 }, { 190,7915 },
+
+ { 191,7915 }, { 192,7915 }, { 193,7915 }, { 194,7915 }, { 195,7915 },
+ { 196,7915 }, { 197,7915 }, { 198,7915 }, { 199,7915 }, { 200,7915 },
+ { 201,7915 }, { 202,7915 }, { 203,7915 }, { 204,7915 }, { 205,7915 },
+ { 206,7915 }, { 207,7915 }, { 208,7915 }, { 209,7915 }, { 210,7915 },
+ { 211,7915 }, { 212,7915 }, { 213,7915 }, { 214,7915 }, { 215,7915 },
+ { 216,7915 }, { 217,7915 }, { 218,7915 }, { 219,7915 }, { 220,7915 },
+ { 221,7915 }, { 222,7915 }, { 223,7915 }, { 224,7915 }, { 225,7915 },
+ { 226,7915 }, { 227,7915 }, { 228,7915 }, { 229,7915 }, { 230,7915 },
+ { 231,7915 }, { 232,7915 }, { 233,7915 }, { 234,7915 }, { 235,7915 },
+ { 236,7915 }, { 237,7915 }, { 238,7915 }, { 239,7915 }, { 240,7915 },
+
+ { 241,7915 }, { 242,7915 }, { 243,7915 }, { 244,7915 }, { 245,7915 },
+ { 246,7915 }, { 247,7915 }, { 248,7915 }, { 249,7915 }, { 250,7915 },
+ { 251,7915 }, { 252,7915 }, { 253,7915 }, { 254,7915 }, { 255,7915 },
+ { 256,7915 }, {   0,  11 }, {   0,34683 }, {   1,7915 }, {   2,7915 },
+ {   3,7915 }, {   4,7915 }, {   5,7915 }, {   6,7915 }, {   7,7915 },
+ {   8,7915 }, {   9,7915 }, {  10,7915 }, {  11,7915 }, {  12,7915 },
+ {  13,7915 }, {  14,7915 }, {  15,7915 }, {  16,7915 }, {  17,7915 },
+ {  18,7915 }, {  19,7915 }, {  20,7915 }, {  21,7915 }, {  22,7915 },
+ {  23,7915 }, {  24,7915 }, {  25,7915 }, {  26,7915 }, {  27,7915 },
+ {  28,7915 }, {  29,7915 }, {  30,7915 }, {  31,7915 }, {  32,7915 },
+
+ {  33,7915 }, {  34,7915 }, {  35,7915 }, {  36,7915 }, {  37,7915 },
+ {  38,7915 }, {  39,8173 }, {  40,7915 }, {  41,7915 }, {  42,7915 },
+ {  43,7915 }, {  44,7915 }, {  45,7915 }, {  46,7915 }, {  47,7915 },
+ {  48,7915 }, {  49,7915 }, {  50,7915 }, {  51,7915 }, {  52,7915 },
+ {  53,7915 }, {  54,7915 }, {  55,7915 }, {  56,7915 }, {  57,7915 },
+ {  58,7915 }, {  59,7915 }, {  60,7915 }, {  61,7915 }, {  62,7915 },
+ {  63,7915 }, {  64,7915 }, {  65,7915 }, {  66,7915 }, {  67,7915 },
+ {  68,7915 }, {  69,7915 }, {  70,7915 }, {  71,7915 }, {  72,7915 },
+ {  73,7915 }, {  74,7915 }, {  75,7915 }, {  76,7915 }, {  77,7915 },
+ {  78,7915 }, {  79,7915 }, {  80,7915 }, {  81,7915 }, {  82,7915 },
+
+ {  83,7915 }, {  84,7915 }, {  85,7915 }, {  86,7915 }, {  87,7915 },
+ {  88,7915 }, {  89,7915 }, {  90,7915 }, {  91,7915 }, {  92,7915 },
+ {  93,7915 }, {  94,7915 }, {  95,7915 }, {  96,7915 }, {  97,7915 },
+ {  98,7915 }, {  99,7915 }, { 100,7915 }, { 101,7915 }, { 102,7915 },
+ { 103,7915 }, { 104,7915 }, { 105,7915 }, { 106,7915 }, { 107,7915 },
+ { 108,7915 }, { 109,7915 }, { 110,7915 }, { 111,7915 }, { 112,7915 },
+ { 113,7915 }, { 114,7915 }, { 115,7915 }, { 116,7915 }, { 117,7915 },
+ { 118,7915 }, { 119,7915 }, { 120,7915 }, { 121,7915 }, { 122,7915 },
+ { 123,7915 }, { 124,7915 }, { 125,7915 }, { 126,7915 }, { 127,7915 },
+ { 128,7915 }, { 129,7915 }, { 130,7915 }, { 131,7915 }, { 132,7915 },
+
+ { 133,7915 }, { 134,7915 }, { 135,7915 }, { 136,7915 }, { 137,7915 },
+ { 138,7915 }, { 139,7915 }, { 140,7915 }, { 141,7915 }, { 142,7915 },
+ { 143,7915 }, { 144,7915 }, { 145,7915 }, { 146,7915 }, { 147,7915 },
+ { 148,7915 }, { 149,7915 }, { 150,7915 }, { 151,7915 }, { 152,7915 },
+ { 153,7915 }, { 154,7915 }, { 155,7915 }, { 156,7915 }, { 157,7915 },
+ { 158,7915 }, { 159,7915 }, { 160,7915 }, { 161,7915 }, { 162,7915 },
+ { 163,7915 }, { 164,7915 }, { 165,7915 }, { 166,7915 }, { 167,7915 },
+ { 168,7915 }, { 169,7915 }, { 170,7915 }, { 171,7915 }, { 172,7915 },
+ { 173,7915 }, { 174,7915 }, { 175,7915 }, { 176,7915 }, { 177,7915 },
+ { 178,7915 }, { 179,7915 }, { 180,7915 }, { 181,7915 }, { 182,7915 },
+
+ { 183,7915 }, { 184,7915 }, { 185,7915 }, { 186,7915 }, { 187,7915 },
+ { 188,7915 }, { 189,7915 }, { 190,7915 }, { 191,7915 }, { 192,7915 },
+ { 193,7915 }, { 194,7915 }, { 195,7915 }, { 196,7915 }, { 197,7915 },
+ { 198,7915 }, { 199,7915 }, { 200,7915 }, { 201,7915 }, { 202,7915 },
+ { 203,7915 }, { 204,7915 }, { 205,7915 }, { 206,7915 }, { 207,7915 },
+ { 208,7915 }, { 209,7915 }, { 210,7915 }, { 211,7915 }, { 212,7915 },
+ { 213,7915 }, { 214,7915 }, { 215,7915 }, { 216,7915 }, { 217,7915 },
+ { 218,7915 }, { 219,7915 }, { 220,7915 }, { 221,7915 }, { 222,7915 },
+ { 223,7915 }, { 224,7915 }, { 225,7915 }, { 226,7915 }, { 227,7915 },
+ { 228,7915 }, { 229,7915 }, { 230,7915 }, { 231,7915 }, { 232,7915 },
+
+ { 233,7915 }, { 234,7915 }, { 235,7915 }, { 236,7915 }, { 237,7915 },
+ { 238,7915 }, { 239,7915 }, { 240,7915 }, { 241,7915 }, { 242,7915 },
+ { 243,7915 }, { 244,7915 }, { 245,7915 }, { 246,7915 }, { 247,7915 },
+ { 248,7915 }, { 249,7915 }, { 250,7915 }, { 251,7915 }, { 252,7915 },
+ { 253,7915 }, { 254,7915 }, { 255,7915 }, { 256,7915 }, {   0,  11 },
+ {   0,34425 }, {   1,7657 }, {   2,7657 }, {   3,7657 }, {   4,7657 },
+ {   5,7657 }, {   6,7657 }, {   7,7657 }, {   8,7657 }, {   9,7657 },
+ {  10,7657 }, {  11,7657 }, {  12,7657 }, {  13,7657 }, {  14,7657 },
+ {  15,7657 }, {  16,7657 }, {  17,7657 }, {  18,7657 }, {  19,7657 },
+ {  20,7657 }, {  21,7657 }, {  22,7657 }, {  23,7657 }, {  24,7657 },
+
+ {  25,7657 }, {  26,7657 }, {  27,7657 }, {  28,7657 }, {  29,7657 },
+ {  30,7657 }, {  31,7657 }, {  32,7657 }, {  33,7657 }, {  34,7657 },
+ {  35,7657 }, {  36,7657 }, {  37,7657 }, {  38,7657 }, {  39,7915 },
+ {  40,7657 }, {  41,7657 }, {  42,7657 }, {  43,7657 }, {  44,7657 },
+ {  45,7657 }, {  46,7657 }, {  47,7657 }, {  48,7657 }, {  49,7657 },
+ {  50,7657 }, {  51,7657 }, {  52,7657 }, {  53,7657 }, {  54,7657 },
+ {  55,7657 }, {  56,7657 }, {  57,7657 }, {  58,7657 }, {  59,7657 },
+ {  60,7657 }, {  61,7657 }, {  62,7657 }, {  63,7657 }, {  64,7657 },
+ {  65,7657 }, {  66,7657 }, {  67,7657 }, {  68,7657 }, {  69,7657 },
+ {  70,7657 }, {  71,7657 }, {  72,7657 }, {  73,7657 }, {  74,7657 },
+
+ {  75,7657 }, {  76,7657 }, {  77,7657 }, {  78,7657 }, {  79,7657 },
+ {  80,7657 }, {  81,7657 }, {  82,7657 }, {  83,7657 }, {  84,7657 },
+ {  85,7657 }, {  86,7657 }, {  87,7657 }, {  88,7657 }, {  89,7657 },
+ {  90,7657 }, {  91,7657 }, {  92,7657 }, {  93,7657 }, {  94,7657 },
+ {  95,7657 }, {  96,7657 }, {  97,7657 }, {  98,7657 }, {  99,7657 },
+ { 100,7657 }, { 101,7657 }, { 102,7657 }, { 103,7657 }, { 104,7657 },
+ { 105,7657 }, { 106,7657 }, { 107,7657 }, { 108,7657 }, { 109,7657 },
+ { 110,7657 }, { 111,7657 }, { 112,7657 }, { 113,7657 }, { 114,7657 },
+ { 115,7657 }, { 116,7657 }, { 117,7657 }, { 118,7657 }, { 119,7657 },
+ { 120,7657 }, { 121,7657 }, { 122,7657 }, { 123,7657 }, { 124,7657 },
+
+ { 125,7657 }, { 126,7657 }, { 127,7657 }, { 128,7657 }, { 129,7657 },
+ { 130,7657 }, { 131,7657 }, { 132,7657 }, { 133,7657 }, { 134,7657 },
+ { 135,7657 }, { 136,7657 }, { 137,7657 }, { 138,7657 }, { 139,7657 },
+ { 140,7657 }, { 141,7657 }, { 142,7657 }, { 143,7657 }, { 144,7657 },
+ { 145,7657 }, { 146,7657 }, { 147,7657 }, { 148,7657 }, { 149,7657 },
+ { 150,7657 }, { 151,7657 }, { 152,7657 }, { 153,7657 }, { 154,7657 },
+ { 155,7657 }, { 156,7657 }, { 157,7657 }, { 158,7657 }, { 159,7657 },
+ { 160,7657 }, { 161,7657 }, { 162,7657 }, { 163,7657 }, { 164,7657 },
+ { 165,7657 }, { 166,7657 }, { 167,7657 }, { 168,7657 }, { 169,7657 },
+ { 170,7657 }, { 171,7657 }, { 172,7657 }, { 173,7657 }, { 174,7657 },
+
+ { 175,7657 }, { 176,7657 }, { 177,7657 }, { 178,7657 }, { 179,7657 },
+ { 180,7657 }, { 181,7657 }, { 182,7657 }, { 183,7657 }, { 184,7657 },
+ { 185,7657 }, { 186,7657 }, { 187,7657 }, { 188,7657 }, { 189,7657 },
+ { 190,7657 }, { 191,7657 }, { 192,7657 }, { 193,7657 }, { 194,7657 },
+ { 195,7657 }, { 196,7657 }, { 197,7657 }, { 198,7657 }, { 199,7657 },
+ { 200,7657 }, { 201,7657 }, { 202,7657 }, { 203,7657 }, { 204,7657 },
+ { 205,7657 }, { 206,7657 }, { 207,7657 }, { 208,7657 }, { 209,7657 },
+ { 210,7657 }, { 211,7657 }, { 212,7657 }, { 213,7657 }, { 214,7657 },
+ { 215,7657 }, { 216,7657 }, { 217,7657 }, { 218,7657 }, { 219,7657 },
+ { 220,7657 }, { 221,7657 }, { 222,7657 }, { 223,7657 }, { 224,7657 },
+
+ { 225,7657 }, { 226,7657 }, { 227,7657 }, { 228,7657 }, { 229,7657 },
+ { 230,7657 }, { 231,7657 }, { 232,7657 }, { 233,7657 }, { 234,7657 },
+ { 235,7657 }, { 236,7657 }, { 237,7657 }, { 238,7657 }, { 239,7657 },
+ { 240,7657 }, { 241,7657 }, { 242,7657 }, { 243,7657 }, { 244,7657 },
+ { 245,7657 }, { 246,7657 }, { 247,7657 }, { 248,7657 }, { 249,7657 },
+ { 250,7657 }, { 251,7657 }, { 252,7657 }, { 253,7657 }, { 254,7657 },
+ { 255,7657 }, { 256,7657 }, {   0,   0 }, {   0,34167 }, {   1,7704 },
+ {   2,7704 }, {   3,7704 }, {   4,7704 }, {   5,7704 }, {   6,7704 },
+ {   7,7704 }, {   8,7704 }, {   9,7704 }, {  10,7962 }, {  11,7704 },
+ {  12,7704 }, {  13,7704 }, {  14,7704 }, {  15,7704 }, {  16,7704 },
+
+ {  17,7704 }, {  18,7704 }, {  19,7704 }, {  20,7704 }, {  21,7704 },
+ {  22,7704 }, {  23,7704 }, {  24,7704 }, {  25,7704 }, {  26,7704 },
+ {  27,7704 }, {  28,7704 }, {  29,7704 }, {  30,7704 }, {  31,7704 },
+ {  32,7704 }, {  33,7704 }, {  34,7704 }, {  35,7704 }, {  36,7704 },
+ {  37,7704 }, {  38,7704 }, {  39,8220 }, {  40,7704 }, {  41,7704 },
+ {  42,7704 }, {  43,7704 }, {  44,7704 }, {  45,7704 }, {  46,7704 },
+ {  47,7704 }, {  48,7704 }, {  49,7704 }, {  50,7704 }, {  51,7704 },
+ {  52,7704 }, {  53,7704 }, {  54,7704 }, {  55,7704 }, {  56,7704 },
+ {  57,7704 }, {  58,7704 }, {  59,7704 }, {  60,7704 }, {  61,7704 },
+ {  62,7704 }, {  63,7704 }, {  64,7704 }, {  65,7704 }, {  66,7704 },
+
+ {  67,7704 }, {  68,7704 }, {  69,7704 }, {  70,7704 }, {  71,7704 },
+ {  72,7704 }, {  73,7704 }, {  74,7704 }, {  75,7704 }, {  76,7704 },
+ {  77,7704 }, {  78,7704 }, {  79,7704 }, {  80,7704 }, {  81,7704 },
+ {  82,7704 }, {  83,7704 }, {  84,7704 }, {  85,7704 }, {  86,7704 },
+ {  87,7704 }, {  88,7704 }, {  89,7704 }, {  90,7704 }, {  91,7704 },
+ {  92,8267 }, {  93,7704 }, {  94,7704 }, {  95,7704 }, {  96,7704 },
+ {  97,7704 }, {  98,7704 }, {  99,7704 }, { 100,7704 }, { 101,7704 },
+ { 102,7704 }, { 103,7704 }, { 104,7704 }, { 105,7704 }, { 106,7704 },
+ { 107,7704 }, { 108,7704 }, { 109,7704 }, { 110,7704 }, { 111,7704 },
+ { 112,7704 }, { 113,7704 }, { 114,7704 }, { 115,7704 }, { 116,7704 },
+
+ { 117,7704 }, { 118,7704 }, { 119,7704 }, { 120,7704 }, { 121,7704 },
+ { 122,7704 }, { 123,7704 }, { 124,7704 }, { 125,7704 }, { 126,7704 },
+ { 127,7704 }, { 128,7704 }, { 129,7704 }, { 130,7704 }, { 131,7704 },
+ { 132,7704 }, { 133,7704 }, { 134,7704 }, { 135,7704 }, { 136,7704 },
+ { 137,7704 }, { 138,7704 }, { 139,7704 }, { 140,7704 }, { 141,7704 },
+ { 142,7704 }, { 143,7704 }, { 144,7704 }, { 145,7704 }, { 146,7704 },
+ { 147,7704 }, { 148,7704 }, { 149,7704 }, { 150,7704 }, { 151,7704 },
+ { 152,7704 }, { 153,7704 }, { 154,7704 }, { 155,7704 }, { 156,7704 },
+ { 157,7704 }, { 158,7704 }, { 159,7704 }, { 160,7704 }, { 161,7704 },
+ { 162,7704 }, { 163,7704 }, { 164,7704 }, { 165,7704 }, { 166,7704 },
+
+ { 167,7704 }, { 168,7704 }, { 169,7704 }, { 170,7704 }, { 171,7704 },
+ { 172,7704 }, { 173,7704 }, { 174,7704 }, { 175,7704 }, { 176,7704 },
+ { 177,7704 }, { 178,7704 }, { 179,7704 }, { 180,7704 }, { 181,7704 },
+ { 182,7704 }, { 183,7704 }, { 184,7704 }, { 185,7704 }, { 186,7704 },
+ { 187,7704 }, { 188,7704 }, { 189,7704 }, { 190,7704 }, { 191,7704 },
+ { 192,7704 }, { 193,7704 }, { 194,7704 }, { 195,7704 }, { 196,7704 },
+ { 197,7704 }, { 198,7704 }, { 199,7704 }, { 200,7704 }, { 201,7704 },
+ { 202,7704 }, { 203,7704 }, { 204,7704 }, { 205,7704 }, { 206,7704 },
+ { 207,7704 }, { 208,7704 }, { 209,7704 }, { 210,7704 }, { 211,7704 },
+ { 212,7704 }, { 213,7704 }, { 214,7704 }, { 215,7704 }, { 216,7704 },
+
+ { 217,7704 }, { 218,7704 }, { 219,7704 }, { 220,7704 }, { 221,7704 },
+ { 222,7704 }, { 223,7704 }, { 224,7704 }, { 225,7704 }, { 226,7704 },
+ { 227,7704 }, { 228,7704 }, { 229,7704 }, { 230,7704 }, { 231,7704 },
+ { 232,7704 }, { 233,7704 }, { 234,7704 }, { 235,7704 }, { 236,7704 },
+ { 237,7704 }, { 238,7704 }, { 239,7704 }, { 240,7704 }, { 241,7704 },
+ { 242,7704 }, { 243,7704 }, { 244,7704 }, { 245,7704 }, { 246,7704 },
+ { 247,7704 }, { 248,7704 }, { 249,7704 }, { 250,7704 }, { 251,7704 },
+ { 252,7704 }, { 253,7704 }, { 254,7704 }, { 255,7704 }, { 256,7704 },
+ {   0,   0 }, {   0,33909 }, {   1,7446 }, {   2,7446 }, {   3,7446 },
+ {   4,7446 }, {   5,7446 }, {   6,7446 }, {   7,7446 }, {   8,7446 },
+
+ {   9,7446 }, {  10,7704 }, {  11,7446 }, {  12,7446 }, {  13,7446 },
+ {  14,7446 }, {  15,7446 }, {  16,7446 }, {  17,7446 }, {  18,7446 },
+ {  19,7446 }, {  20,7446 }, {  21,7446 }, {  22,7446 }, {  23,7446 },
+ {  24,7446 }, {  25,7446 }, {  26,7446 }, {  27,7446 }, {  28,7446 },
+ {  29,7446 }, {  30,7446 }, {  31,7446 }, {  32,7446 }, {  33,7446 },
+ {  34,7446 }, {  35,7446 }, {  36,7446 }, {  37,7446 }, {  38,7446 },
+ {  39,7962 }, {  40,7446 }, {  41,7446 }, {  42,7446 }, {  43,7446 },
+ {  44,7446 }, {  45,7446 }, {  46,7446 }, {  47,7446 }, {  48,7446 },
+ {  49,7446 }, {  50,7446 }, {  51,7446 }, {  52,7446 }, {  53,7446 },
+ {  54,7446 }, {  55,7446 }, {  56,7446 }, {  57,7446 }, {  58,7446 },
+
+ {  59,7446 }, {  60,7446 }, {  61,7446 }, {  62,7446 }, {  63,7446 },
+ {  64,7446 }, {  65,7446 }, {  66,7446 }, {  67,7446 }, {  68,7446 },
+ {  69,7446 }, {  70,7446 }, {  71,7446 }, {  72,7446 }, {  73,7446 },
+ {  74,7446 }, {  75,7446 }, {  76,7446 }, {  77,7446 }, {  78,7446 },
+ {  79,7446 }, {  80,7446 }, {  81,7446 }, {  82,7446 }, {  83,7446 },
+ {  84,7446 }, {  85,7446 }, {  86,7446 }, {  87,7446 }, {  88,7446 },
+ {  89,7446 }, {  90,7446 }, {  91,7446 }, {  92,8009 }, {  93,7446 },
+ {  94,7446 }, {  95,7446 }, {  96,7446 }, {  97,7446 }, {  98,7446 },
+ {  99,7446 }, { 100,7446 }, { 101,7446 }, { 102,7446 }, { 103,7446 },
+ { 104,7446 }, { 105,7446 }, { 106,7446 }, { 107,7446 }, { 108,7446 },
+
+ { 109,7446 }, { 110,7446 }, { 111,7446 }, { 112,7446 }, { 113,7446 },
+ { 114,7446 }, { 115,7446 }, { 116,7446 }, { 117,7446 }, { 118,7446 },
+ { 119,7446 }, { 120,7446 }, { 121,7446 }, { 122,7446 }, { 123,7446 },
+ { 124,7446 }, { 125,7446 }, { 126,7446 }, { 127,7446 }, { 128,7446 },
+ { 129,7446 }, { 130,7446 }, { 131,7446 }, { 132,7446 }, { 133,7446 },
+ { 134,7446 }, { 135,7446 }, { 136,7446 }, { 137,7446 }, { 138,7446 },
+ { 139,7446 }, { 140,7446 }, { 141,7446 }, { 142,7446 }, { 143,7446 },
+ { 144,7446 }, { 145,7446 }, { 146,7446 }, { 147,7446 }, { 148,7446 },
+ { 149,7446 }, { 150,7446 }, { 151,7446 }, { 152,7446 }, { 153,7446 },
+ { 154,7446 }, { 155,7446 }, { 156,7446 }, { 157,7446 }, { 158,7446 },
+
+ { 159,7446 }, { 160,7446 }, { 161,7446 }, { 162,7446 }, { 163,7446 },
+ { 164,7446 }, { 165,7446 }, { 166,7446 }, { 167,7446 }, { 168,7446 },
+ { 169,7446 }, { 170,7446 }, { 171,7446 }, { 172,7446 }, { 173,7446 },
+ { 174,7446 }, { 175,7446 }, { 176,7446 }, { 177,7446 }, { 178,7446 },
+ { 179,7446 }, { 180,7446 }, { 181,7446 }, { 182,7446 }, { 183,7446 },
+ { 184,7446 }, { 185,7446 }, { 186,7446 }, { 187,7446 }, { 188,7446 },
+ { 189,7446 }, { 190,7446 }, { 191,7446 }, { 192,7446 }, { 193,7446 },
+ { 194,7446 }, { 195,7446 }, { 196,7446 }, { 197,7446 }, { 198,7446 },
+ { 199,7446 }, { 200,7446 }, { 201,7446 }, { 202,7446 }, { 203,7446 },
+ { 204,7446 }, { 205,7446 }, { 206,7446 }, { 207,7446 }, { 208,7446 },
+
+ { 209,7446 }, { 210,7446 }, { 211,7446 }, { 212,7446 }, { 213,7446 },
+ { 214,7446 }, { 215,7446 }, { 216,7446 }, { 217,7446 }, { 218,7446 },
+ { 219,7446 }, { 220,7446 }, { 221,7446 }, { 222,7446 }, { 223,7446 },
+ { 224,7446 }, { 225,7446 }, { 226,7446 }, { 227,7446 }, { 228,7446 },
+ { 229,7446 }, { 230,7446 }, { 231,7446 }, { 232,7446 }, { 233,7446 },
+ { 234,7446 }, { 235,7446 }, { 236,7446 }, { 237,7446 }, { 238,7446 },
+ { 239,7446 }, { 240,7446 }, { 241,7446 }, { 242,7446 }, { 243,7446 },
+ { 244,7446 }, { 245,7446 }, { 246,7446 }, { 247,7446 }, { 248,7446 },
+ { 249,7446 }, { 250,7446 }, { 251,7446 }, { 252,7446 }, { 253,7446 },
+ { 254,7446 }, { 255,7446 }, { 256,7446 }, {   0,   0 }, {   0,33651 },
+
+ {   1,8009 }, {   2,8009 }, {   3,8009 }, {   4,8009 }, {   5,8009 },
+ {   6,8009 }, {   7,8009 }, {   8,8009 }, {   9,8009 }, {  10,8009 },
+ {  11,8009 }, {  12,8009 }, {  13,8009 }, {  14,8009 }, {  15,8009 },
+ {  16,8009 }, {  17,8009 }, {  18,8009 }, {  19,8009 }, {  20,8009 },
+ {  21,8009 }, {  22,8009 }, {  23,8009 }, {  24,8009 }, {  25,8009 },
+ {  26,8009 }, {  27,8009 }, {  28,8009 }, {  29,8009 }, {  30,8009 },
+ {  31,8009 }, {  32,8009 }, {  33,8009 }, {  34,8009 }, {  35,8009 },
+ {  36,8009 }, {  37,8009 }, {  38,8009 }, {  39,8267 }, {  40,8009 },
+ {  41,8009 }, {  42,8009 }, {  43,8009 }, {  44,8009 }, {  45,8009 },
+ {  46,8009 }, {  47,8009 }, {  48,8009 }, {  49,8009 }, {  50,8009 },
+
+ {  51,8009 }, {  52,8009 }, {  53,8009 }, {  54,8009 }, {  55,8009 },
+ {  56,8009 }, {  57,8009 }, {  58,8009 }, {  59,8009 }, {  60,8009 },
+ {  61,8009 }, {  62,8009 }, {  63,8009 }, {  64,8009 }, {  65,8009 },
+ {  66,8009 }, {  67,8009 }, {  68,8009 }, {  69,8009 }, {  70,8009 },
+ {  71,8009 }, {  72,8009 }, {  73,8009 }, {  74,8009 }, {  75,8009 },
+ {  76,8009 }, {  77,8009 }, {  78,8009 }, {  79,8009 }, {  80,8009 },
+ {  81,8009 }, {  82,8009 }, {  83,8009 }, {  84,8009 }, {  85,8009 },
+ {  86,8009 }, {  87,8009 }, {  88,8009 }, {  89,8009 }, {  90,8009 },
+ {  91,8009 }, {  92,8009 }, {  93,8009 }, {  94,8009 }, {  95,8009 },
+ {  96,8009 }, {  97,8009 }, {  98,8009 }, {  99,8009 }, { 100,8009 },
+
+ { 101,8009 }, { 102,8009 }, { 103,8009 }, { 104,8009 }, { 105,8009 },
+ { 106,8009 }, { 107,8009 }, { 108,8009 }, { 109,8009 }, { 110,8009 },
+ { 111,8009 }, { 112,8009 }, { 113,8009 }, { 114,8009 }, { 115,8009 },
+ { 116,8009 }, { 117,8009 }, { 118,8009 }, { 119,8009 }, { 120,8009 },
+ { 121,8009 }, { 122,8009 }, { 123,8009 }, { 124,8009 }, { 125,8009 },
+ { 126,8009 }, { 127,8009 }, { 128,8009 }, { 129,8009 }, { 130,8009 },
+ { 131,8009 }, { 132,8009 }, { 133,8009 }, { 134,8009 }, { 135,8009 },
+ { 136,8009 }, { 137,8009 }, { 138,8009 }, { 139,8009 }, { 140,8009 },
+ { 141,8009 }, { 142,8009 }, { 143,8009 }, { 144,8009 }, { 145,8009 },
+ { 146,8009 }, { 147,8009 }, { 148,8009 }, { 149,8009 }, { 150,8009 },
+
+ { 151,8009 }, { 152,8009 }, { 153,8009 }, { 154,8009 }, { 155,8009 },
+ { 156,8009 }, { 157,8009 }, { 158,8009 }, { 159,8009 }, { 160,8009 },
+ { 161,8009 }, { 162,8009 }, { 163,8009 }, { 164,8009 }, { 165,8009 },
+ { 166,8009 }, { 167,8009 }, { 168,8009 }, { 169,8009 }, { 170,8009 },
+ { 171,8009 }, { 172,8009 }, { 173,8009 }, { 174,8009 }, { 175,8009 },
+ { 176,8009 }, { 177,8009 }, { 178,8009 }, { 179,8009 }, { 180,8009 },
+ { 181,8009 }, { 182,8009 }, { 183,8009 }, { 184,8009 }, { 185,8009 },
+ { 186,8009 }, { 187,8009 }, { 188,8009 }, { 189,8009 }, { 190,8009 },
+ { 191,8009 }, { 192,8009 }, { 193,8009 }, { 194,8009 }, { 195,8009 },
+ { 196,8009 }, { 197,8009 }, { 198,8009 }, { 199,8009 }, { 200,8009 },
+
+ { 201,8009 }, { 202,8009 }, { 203,8009 }, { 204,8009 }, { 205,8009 },
+ { 206,8009 }, { 207,8009 }, { 208,8009 }, { 209,8009 }, { 210,8009 },
+ { 211,8009 }, { 212,8009 }, { 213,8009 }, { 214,8009 }, { 215,8009 },
+ { 216,8009 }, { 217,8009 }, { 218,8009 }, { 219,8009 }, { 220,8009 },
+ { 221,8009 }, { 222,8009 }, { 223,8009 }, { 224,8009 }, { 225,8009 },
+ { 226,8009 }, { 227,8009 }, { 228,8009 }, { 229,8009 }, { 230,8009 },
+ { 231,8009 }, { 232,8009 }, { 233,8009 }, { 234,8009 }, { 235,8009 },
+ { 236,8009 }, { 237,8009 }, { 238,8009 }, { 239,8009 }, { 240,8009 },
+ { 241,8009 }, { 242,8009 }, { 243,8009 }, { 244,8009 }, { 245,8009 },
+ { 246,8009 }, { 247,8009 }, { 248,8009 }, { 249,8009 }, { 250,8009 },
+
+ { 251,8009 }, { 252,8009 }, { 253,8009 }, { 254,8009 }, { 255,8009 },
+ { 256,8009 }, {   0,   0 }, {   0,33393 }, {   1,7751 }, {   2,7751 },
+ {   3,7751 }, {   4,7751 }, {   5,7751 }, {   6,7751 }, {   7,7751 },
+ {   8,7751 }, {   9,7751 }, {  10,7751 }, {  11,7751 }, {  12,7751 },
+ {  13,7751 }, {  14,7751 }, {  15,7751 }, {  16,7751 }, {  17,7751 },
+ {  18,7751 }, {  19,7751 }, {  20,7751 }, {  21,7751 }, {  22,7751 },
+ {  23,7751 }, {  24,7751 }, {  25,7751 }, {  26,7751 }, {  27,7751 },
+ {  28,7751 }, {  29,7751 }, {  30,7751 }, {  31,7751 }, {  32,7751 },
+ {  33,7751 }, {  34,7751 }, {  35,7751 }, {  36,7751 }, {  37,7751 },
+ {  38,7751 }, {  39,8009 }, {  40,7751 }, {  41,7751 }, {  42,7751 },
+
+ {  43,7751 }, {  44,7751 }, {  45,7751 }, {  46,7751 }, {  47,7751 },
+ {  48,7751 }, {  49,7751 }, {  50,7751 }, {  51,7751 }, {  52,7751 },
+ {  53,7751 }, {  54,7751 }, {  55,7751 }, {  56,7751 }, {  57,7751 },
+ {  58,7751 }, {  59,7751 }, {  60,7751 }, {  61,7751 }, {  62,7751 },
+ {  63,7751 }, {  64,7751 }, {  65,7751 }, {  66,7751 }, {  67,7751 },
+ {  68,7751 }, {  69,7751 }, {  70,7751 }, {  71,7751 }, {  72,7751 },
+ {  73,7751 }, {  74,7751 }, {  75,7751 }, {  76,7751 }, {  77,7751 },
+ {  78,7751 }, {  79,7751 }, {  80,7751 }, {  81,7751 }, {  82,7751 },
+ {  83,7751 }, {  84,7751 }, {  85,7751 }, {  86,7751 }, {  87,7751 },
+ {  88,7751 }, {  89,7751 }, {  90,7751 }, {  91,7751 }, {  92,7751 },
+
+ {  93,7751 }, {  94,7751 }, {  95,7751 }, {  96,7751 }, {  97,7751 },
+ {  98,7751 }, {  99,7751 }, { 100,7751 }, { 101,7751 }, { 102,7751 },
+ { 103,7751 }, { 104,7751 }, { 105,7751 }, { 106,7751 }, { 107,7751 },
+ { 108,7751 }, { 109,7751 }, { 110,7751 }, { 111,7751 }, { 112,7751 },
+ { 113,7751 }, { 114,7751 }, { 115,7751 }, { 116,7751 }, { 117,7751 },
+ { 118,7751 }, { 119,7751 }, { 120,7751 }, { 121,7751 }, { 122,7751 },
+ { 123,7751 }, { 124,7751 }, { 125,7751 }, { 126,7751 }, { 127,7751 },
+ { 128,7751 }, { 129,7751 }, { 130,7751 }, { 131,7751 }, { 132,7751 },
+ { 133,7751 }, { 134,7751 }, { 135,7751 }, { 136,7751 }, { 137,7751 },
+ { 138,7751 }, { 139,7751 }, { 140,7751 }, { 141,7751 }, { 142,7751 },
+
+ { 143,7751 }, { 144,7751 }, { 145,7751 }, { 146,7751 }, { 147,7751 },
+ { 148,7751 }, { 149,7751 }, { 150,7751 }, { 151,7751 }, { 152,7751 },
+ { 153,7751 }, { 154,7751 }, { 155,7751 }, { 156,7751 }, { 157,7751 },
+ { 158,7751 }, { 159,7751 }, { 160,7751 }, { 161,7751 }, { 162,7751 },
+ { 163,7751 }, { 164,7751 }, { 165,7751 }, { 166,7751 }, { 167,7751 },
+ { 168,7751 }, { 169,7751 }, { 170,7751 }, { 171,7751 }, { 172,7751 },
+ { 173,7751 }, { 174,7751 }, { 175,7751 }, { 176,7751 }, { 177,7751 },
+ { 178,7751 }, { 179,7751 }, { 180,7751 }, { 181,7751 }, { 182,7751 },
+ { 183,7751 }, { 184,7751 }, { 185,7751 }, { 186,7751 }, { 187,7751 },
+ { 188,7751 }, { 189,7751 }, { 190,7751 }, { 191,7751 }, { 192,7751 },
+
+ { 193,7751 }, { 194,7751 }, { 195,7751 }, { 196,7751 }, { 197,7751 },
+ { 198,7751 }, { 199,7751 }, { 200,7751 }, { 201,7751 }, { 202,7751 },
+ { 203,7751 }, { 204,7751 }, { 205,7751 }, { 206,7751 }, { 207,7751 },
+ { 208,7751 }, { 209,7751 }, { 210,7751 }, { 211,7751 }, { 212,7751 },
+ { 213,7751 }, { 214,7751 }, { 215,7751 }, { 216,7751 }, { 217,7751 },
+ { 218,7751 }, { 219,7751 }, { 220,7751 }, { 221,7751 }, { 222,7751 },
+ { 223,7751 }, { 224,7751 }, { 225,7751 }, { 226,7751 }, { 227,7751 },
+ { 228,7751 }, { 229,7751 }, { 230,7751 }, { 231,7751 }, { 232,7751 },
+ { 233,7751 }, { 234,7751 }, { 235,7751 }, { 236,7751 }, { 237,7751 },
+ { 238,7751 }, { 239,7751 }, { 240,7751 }, { 241,7751 }, { 242,7751 },
+
+ { 243,7751 }, { 244,7751 }, { 245,7751 }, { 246,7751 }, { 247,7751 },
+ { 248,7751 }, { 249,7751 }, { 250,7751 }, { 251,7751 }, { 252,7751 },
+ { 253,7751 }, { 254,7751 }, { 255,7751 }, { 256,7751 }, {   0,   0 },
+ {   0,33135 }, {   1,7798 }, {   2,7798 }, {   3,7798 }, {   4,7798 },
+ {   5,7798 }, {   6,7798 }, {   7,7798 }, {   8,7798 }, {   9,7798 },
+ {  10,8056 }, {  11,7798 }, {  12,7798 }, {  13,7798 }, {  14,7798 },
+ {  15,7798 }, {  16,7798 }, {  17,7798 }, {  18,7798 }, {  19,7798 },
+ {  20,7798 }, {  21,7798 }, {  22,7798 }, {  23,7798 }, {  24,7798 },
+ {  25,7798 }, {  26,7798 }, {  27,7798 }, {  28,7798 }, {  29,7798 },
+ {  30,7798 }, {  31,7798 }, {  32,7798 }, {  33,7798 }, {  34,7798 },
+
+ {  35,7798 }, {  36,8314 }, {  37,7798 }, {  38,7798 }, {  39,7798 },
+ {  40,7798 }, {  41,7798 }, {  42,7798 }, {  43,7798 }, {  44,7798 },
+ {  45,7798 }, {  46,7798 }, {  47,7798 }, {  48,7798 }, {  49,7798 },
+ {  50,7798 }, {  51,7798 }, {  52,7798 }, {  53,7798 }, {  54,7798 },
+ {  55,7798 }, {  56,7798 }, {  57,7798 }, {  58,7798 }, {  59,7798 },
+ {  60,7798 }, {  61,7798 }, {  62,7798 }, {  63,7798 }, {  64,7798 },
+ {  65,7798 }, {  66,7798 }, {  67,7798 }, {  68,7798 }, {  69,7798 },
+ {  70,7798 }, {  71,7798 }, {  72,7798 }, {  73,7798 }, {  74,7798 },
+ {  75,7798 }, {  76,7798 }, {  77,7798 }, {  78,7798 }, {  79,7798 },
+ {  80,7798 }, {  81,7798 }, {  82,7798 }, {  83,7798 }, {  84,7798 },
+
+ {  85,7798 }, {  86,7798 }, {  87,7798 }, {  88,7798 }, {  89,7798 },
+ {  90,7798 }, {  91,7798 }, {  92,7798 }, {  93,7798 }, {  94,7798 },
+ {  95,7798 }, {  96,7798 }, {  97,7798 }, {  98,7798 }, {  99,7798 },
+ { 100,7798 }, { 101,7798 }, { 102,7798 }, { 103,7798 }, { 104,7798 },
+ { 105,7798 }, { 106,7798 }, { 107,7798 }, { 108,7798 }, { 109,7798 },
+ { 110,7798 }, { 111,7798 }, { 112,7798 }, { 113,7798 }, { 114,7798 },
+ { 115,7798 }, { 116,7798 }, { 117,7798 }, { 118,7798 }, { 119,7798 },
+ { 120,7798 }, { 121,7798 }, { 122,7798 }, { 123,7798 }, { 124,7798 },
+ { 125,7798 }, { 126,7798 }, { 127,7798 }, { 128,7798 }, { 129,7798 },
+ { 130,7798 }, { 131,7798 }, { 132,7798 }, { 133,7798 }, { 134,7798 },
+
+ { 135,7798 }, { 136,7798 }, { 137,7798 }, { 138,7798 }, { 139,7798 },
+ { 140,7798 }, { 141,7798 }, { 142,7798 }, { 143,7798 }, { 144,7798 },
+ { 145,7798 }, { 146,7798 }, { 147,7798 }, { 148,7798 }, { 149,7798 },
+ { 150,7798 }, { 151,7798 }, { 152,7798 }, { 153,7798 }, { 154,7798 },
+ { 155,7798 }, { 156,7798 }, { 157,7798 }, { 158,7798 }, { 159,7798 },
+ { 160,7798 }, { 161,7798 }, { 162,7798 }, { 163,7798 }, { 164,7798 },
+ { 165,7798 }, { 166,7798 }, { 167,7798 }, { 168,7798 }, { 169,7798 },
+ { 170,7798 }, { 171,7798 }, { 172,7798 }, { 173,7798 }, { 174,7798 },
+ { 175,7798 }, { 176,7798 }, { 177,7798 }, { 178,7798 }, { 179,7798 },
+ { 180,7798 }, { 181,7798 }, { 182,7798 }, { 183,7798 }, { 184,7798 },
+
+ { 185,7798 }, { 186,7798 }, { 187,7798 }, { 188,7798 }, { 189,7798 },
+ { 190,7798 }, { 191,7798 }, { 192,7798 }, { 193,7798 }, { 194,7798 },
+ { 195,7798 }, { 196,7798 }, { 197,7798 }, { 198,7798 }, { 199,7798 },
+ { 200,7798 }, { 201,7798 }, { 202,7798 }, { 203,7798 }, { 204,7798 },
+ { 205,7798 }, { 206,7798 }, { 207,7798 }, { 208,7798 }, { 209,7798 },
+ { 210,7798 }, { 211,7798 }, { 212,7798 }, { 213,7798 }, { 214,7798 },
+ { 215,7798 }, { 216,7798 }, { 217,7798 }, { 218,7798 }, { 219,7798 },
+ { 220,7798 }, { 221,7798 }, { 222,7798 }, { 223,7798 }, { 224,7798 },
+ { 225,7798 }, { 226,7798 }, { 227,7798 }, { 228,7798 }, { 229,7798 },
+ { 230,7798 }, { 231,7798 }, { 232,7798 }, { 233,7798 }, { 234,7798 },
+
+ { 235,7798 }, { 236,7798 }, { 237,7798 }, { 238,7798 }, { 239,7798 },
+ { 240,7798 }, { 241,7798 }, { 242,7798 }, { 243,7798 }, { 244,7798 },
+ { 245,7798 }, { 246,7798 }, { 247,7798 }, { 248,7798 }, { 249,7798 },
+ { 250,7798 }, { 251,7798 }, { 252,7798 }, { 253,7798 }, { 254,7798 },
+ { 255,7798 }, { 256,7798 }, {   0,   0 }, {   0,32877 }, {   1,7540 },
+ {   2,7540 }, {   3,7540 }, {   4,7540 }, {   5,7540 }, {   6,7540 },
+ {   7,7540 }, {   8,7540 }, {   9,7540 }, {  10,7798 }, {  11,7540 },
+ {  12,7540 }, {  13,7540 }, {  14,7540 }, {  15,7540 }, {  16,7540 },
+ {  17,7540 }, {  18,7540 }, {  19,7540 }, {  20,7540 }, {  21,7540 },
+ {  22,7540 }, {  23,7540 }, {  24,7540 }, {  25,7540 }, {  26,7540 },
+
+ {  27,7540 }, {  28,7540 }, {  29,7540 }, {  30,7540 }, {  31,7540 },
+ {  32,7540 }, {  33,7540 }, {  34,7540 }, {  35,7540 }, {  36,8056 },
+ {  37,7540 }, {  38,7540 }, {  39,7540 }, {  40,7540 }, {  41,7540 },
+ {  42,7540 }, {  43,7540 }, {  44,7540 }, {  45,7540 }, {  46,7540 },
+ {  47,7540 }, {  48,7540 }, {  49,7540 }, {  50,7540 }, {  51,7540 },
+ {  52,7540 }, {  53,7540 }, {  54,7540 }, {  55,7540 }, {  56,7540 },
+ {  57,7540 }, {  58,7540 }, {  59,7540 }, {  60,7540 }, {  61,7540 },
+ {  62,7540 }, {  63,7540 }, {  64,7540 }, {  65,7540 }, {  66,7540 },
+ {  67,7540 }, {  68,7540 }, {  69,7540 }, {  70,7540 }, {  71,7540 },
+ {  72,7540 }, {  73,7540 }, {  74,7540 }, {  75,7540 }, {  76,7540 },
+
+ {  77,7540 }, {  78,7540 }, {  79,7540 }, {  80,7540 }, {  81,7540 },
+ {  82,7540 }, {  83,7540 }, {  84,7540 }, {  85,7540 }, {  86,7540 },
+ {  87,7540 }, {  88,7540 }, {  89,7540 }, {  90,7540 }, {  91,7540 },
+ {  92,7540 }, {  93,7540 }, {  94,7540 }, {  95,7540 }, {  96,7540 },
+ {  97,7540 }, {  98,7540 }, {  99,7540 }, { 100,7540 }, { 101,7540 },
+ { 102,7540 }, { 103,7540 }, { 104,7540 }, { 105,7540 }, { 106,7540 },
+ { 107,7540 }, { 108,7540 }, { 109,7540 }, { 110,7540 }, { 111,7540 },
+ { 112,7540 }, { 113,7540 }, { 114,7540 }, { 115,7540 }, { 116,7540 },
+ { 117,7540 }, { 118,7540 }, { 119,7540 }, { 120,7540 }, { 121,7540 },
+ { 122,7540 }, { 123,7540 }, { 124,7540 }, { 125,7540 }, { 126,7540 },
+
+ { 127,7540 }, { 128,7540 }, { 129,7540 }, { 130,7540 }, { 131,7540 },
+ { 132,7540 }, { 133,7540 }, { 134,7540 }, { 135,7540 }, { 136,7540 },
+ { 137,7540 }, { 138,7540 }, { 139,7540 }, { 140,7540 }, { 141,7540 },
+ { 142,7540 }, { 143,7540 }, { 144,7540 }, { 145,7540 }, { 146,7540 },
+ { 147,7540 }, { 148,7540 }, { 149,7540 }, { 150,7540 }, { 151,7540 },
+ { 152,7540 }, { 153,7540 }, { 154,7540 }, { 155,7540 }, { 156,7540 },
+ { 157,7540 }, { 158,7540 }, { 159,7540 }, { 160,7540 }, { 161,7540 },
+ { 162,7540 }, { 163,7540 }, { 164,7540 }, { 165,7540 }, { 166,7540 },
+ { 167,7540 }, { 168,7540 }, { 169,7540 }, { 170,7540 }, { 171,7540 },
+ { 172,7540 }, { 173,7540 }, { 174,7540 }, { 175,7540 }, { 176,7540 },
+
+ { 177,7540 }, { 178,7540 }, { 179,7540 }, { 180,7540 }, { 181,7540 },
+ { 182,7540 }, { 183,7540 }, { 184,7540 }, { 185,7540 }, { 186,7540 },
+ { 187,7540 }, { 188,7540 }, { 189,7540 }, { 190,7540 }, { 191,7540 },
+ { 192,7540 }, { 193,7540 }, { 194,7540 }, { 195,7540 }, { 196,7540 },
+ { 197,7540 }, { 198,7540 }, { 199,7540 }, { 200,7540 }, { 201,7540 },
+ { 202,7540 }, { 203,7540 }, { 204,7540 }, { 205,7540 }, { 206,7540 },
+ { 207,7540 }, { 208,7540 }, { 209,7540 }, { 210,7540 }, { 211,7540 },
+ { 212,7540 }, { 213,7540 }, { 214,7540 }, { 215,7540 }, { 216,7540 },
+ { 217,7540 }, { 218,7540 }, { 219,7540 }, { 220,7540 }, { 221,7540 },
+ { 222,7540 }, { 223,7540 }, { 224,7540 }, { 225,7540 }, { 226,7540 },
+
+ { 227,7540 }, { 228,7540 }, { 229,7540 }, { 230,7540 }, { 231,7540 },
+ { 232,7540 }, { 233,7540 }, { 234,7540 }, { 235,7540 }, { 236,7540 },
+ { 237,7540 }, { 238,7540 }, { 239,7540 }, { 240,7540 }, { 241,7540 },
+ { 242,7540 }, { 243,7540 }, { 244,7540 }, { 245,7540 }, { 246,7540 },
+ { 247,7540 }, { 248,7540 }, { 249,7540 }, { 250,7540 }, { 251,7540 },
+ { 252,7540 }, { 253,7540 }, { 254,7540 }, { 255,7540 }, { 256,7540 },
+ {   0,   0 }, {   0,32619 }, {   1,5593 }, {   2,5593 }, {   3,5593 },
+ {   4,5593 }, {   5,5593 }, {   6,5593 }, {   7,5593 }, {   8,5593 },
+ {   9,5593 }, {  10,5593 }, {  11,5593 }, {  12,5593 }, {  13,5593 },
+ {  14,5593 }, {  15,5593 }, {  16,5593 }, {  17,5593 }, {  18,5593 },
+
+ {  19,5593 }, {  20,5593 }, {  21,5593 }, {  22,5593 }, {  23,5593 },
+ {  24,5593 }, {  25,5593 }, {  26,5593 }, {  27,5593 }, {  28,5593 },
+ {  29,5593 }, {  30,5593 }, {  31,5593 }, {  32,5593 }, {  33,5593 },
+ {  34,2639 }, {  35,5593 }, {  36,5593 }, {  37,5593 }, {  38,5593 },
+ {  39,5593 }, {  40,5593 }, {  41,5593 }, {  42,5593 }, {  43,5593 },
+ {  44,5593 }, {  45,5593 }, {  46,5593 }, {  47,5593 }, {  48,5593 },
+ {  49,5593 }, {  50,5593 }, {  51,5593 }, {  52,5593 }, {  53,5593 },
+ {  54,5593 }, {  55,5593 }, {  56,5593 }, {  57,5593 }, {  58,5593 },
+ {  59,5593 }, {  60,5593 }, {  61,5593 }, {  62,5593 }, {  63,5593 },
+ {  64,5593 }, {  65,5593 }, {  66,5593 }, {  67,5593 }, {  68,5593 },
+
+ {  69,5593 }, {  70,5593 }, {  71,5593 }, {  72,5593 }, {  73,5593 },
+ {  74,5593 }, {  75,5593 }, {  76,5593 }, {  77,5593 }, {  78,5593 },
+ {  79,5593 }, {  80,5593 }, {  81,5593 }, {  82,5593 }, {  83,5593 },
+ {  84,5593 }, {  85,5593 }, {  86,5593 }, {  87,5593 }, {  88,5593 },
+ {  89,5593 }, {  90,5593 }, {  91,5593 }, {  92,5593 }, {  93,5593 },
+ {  94,5593 }, {  95,5593 }, {  96,5593 }, {  97,5593 }, {  98,5593 },
+ {  99,5593 }, { 100,5593 }, { 101,5593 }, { 102,5593 }, { 103,5593 },
+ { 104,5593 }, { 105,5593 }, { 106,5593 }, { 107,5593 }, { 108,5593 },
+ { 109,5593 }, { 110,5593 }, { 111,5593 }, { 112,5593 }, { 113,5593 },
+ { 114,5593 }, { 115,5593 }, { 116,5593 }, { 117,5593 }, { 118,5593 },
+
+ { 119,5593 }, { 120,5593 }, { 121,5593 }, { 122,5593 }, { 123,5593 },
+ { 124,5593 }, { 125,5593 }, { 126,5593 }, { 127,5593 }, { 128,5593 },
+ { 129,5593 }, { 130,5593 }, { 131,5593 }, { 132,5593 }, { 133,5593 },
+ { 134,5593 }, { 135,5593 }, { 136,5593 }, { 137,5593 }, { 138,5593 },
+ { 139,5593 }, { 140,5593 }, { 141,5593 }, { 142,5593 }, { 143,5593 },
+ { 144,5593 }, { 145,5593 }, { 146,5593 }, { 147,5593 }, { 148,5593 },
+ { 149,5593 }, { 150,5593 }, { 151,5593 }, { 152,5593 }, { 153,5593 },
+ { 154,5593 }, { 155,5593 }, { 156,5593 }, { 157,5593 }, { 158,5593 },
+ { 159,5593 }, { 160,5593 }, { 161,5593 }, { 162,5593 }, { 163,5593 },
+ { 164,5593 }, { 165,5593 }, { 166,5593 }, { 167,5593 }, { 168,5593 },
+
+ { 169,5593 }, { 170,5593 }, { 171,5593 }, { 172,5593 }, { 173,5593 },
+ { 174,5593 }, { 175,5593 }, { 176,5593 }, { 177,5593 }, { 178,5593 },
+ { 179,5593 }, { 180,5593 }, { 181,5593 }, { 182,5593 }, { 183,5593 },
+ { 184,5593 }, { 185,5593 }, { 186,5593 }, { 187,5593 }, { 188,5593 },
+ { 189,5593 }, { 190,5593 }, { 191,5593 }, { 192,5593 }, { 193,5593 },
+ { 194,5593 }, { 195,5593 }, { 196,5593 }, { 197,5593 }, { 198,5593 },
+ { 199,5593 }, { 200,5593 }, { 201,5593 }, { 202,5593 }, { 203,5593 },
+ { 204,5593 }, { 205,5593 }, { 206,5593 }, { 207,5593 }, { 208,5593 },
+ { 209,5593 }, { 210,5593 }, { 211,5593 }, { 212,5593 }, { 213,5593 },
+ { 214,5593 }, { 215,5593 }, { 216,5593 }, { 217,5593 }, { 218,5593 },
+
+ { 219,5593 }, { 220,5593 }, { 221,5593 }, { 222,5593 }, { 223,5593 },
+ { 224,5593 }, { 225,5593 }, { 226,5593 }, { 227,5593 }, { 228,5593 },
+ { 229,5593 }, { 230,5593 }, { 231,5593 }, { 232,5593 }, { 233,5593 },
+ { 234,5593 }, { 235,5593 }, { 236,5593 }, { 237,5593 }, { 238,5593 },
+ { 239,5593 }, { 240,5593 }, { 241,5593 }, { 242,5593 }, { 243,5593 },
+ { 244,5593 }, { 245,5593 }, { 246,5593 }, { 247,5593 }, { 248,5593 },
+ { 249,5593 }, { 250,5593 }, { 251,5593 }, { 252,5593 }, { 253,5593 },
+ { 254,5593 }, { 255,5593 }, { 256,5593 }, {   0,   0 }, {   0,32361 },
+ {   1,5335 }, {   2,5335 }, {   3,5335 }, {   4,5335 }, {   5,5335 },
+ {   6,5335 }, {   7,5335 }, {   8,5335 }, {   9,5335 }, {  10,5335 },
+
+ {  11,5335 }, {  12,5335 }, {  13,5335 }, {  14,5335 }, {  15,5335 },
+ {  16,5335 }, {  17,5335 }, {  18,5335 }, {  19,5335 }, {  20,5335 },
+ {  21,5335 }, {  22,5335 }, {  23,5335 }, {  24,5335 }, {  25,5335 },
+ {  26,5335 }, {  27,5335 }, {  28,5335 }, {  29,5335 }, {  30,5335 },
+ {  31,5335 }, {  32,5335 }, {  33,5335 }, {  34,2381 }, {  35,5335 },
+ {  36,5335 }, {  37,5335 }, {  38,5335 }, {  39,5335 }, {  40,5335 },
+ {  41,5335 }, {  42,5335 }, {  43,5335 }, {  44,5335 }, {  45,5335 },
+ {  46,5335 }, {  47,5335 }, {  48,5335 }, {  49,5335 }, {  50,5335 },
+ {  51,5335 }, {  52,5335 }, {  53,5335 }, {  54,5335 }, {  55,5335 },
+ {  56,5335 }, {  57,5335 }, {  58,5335 }, {  59,5335 }, {  60,5335 },
+
+ {  61,5335 }, {  62,5335 }, {  63,5335 }, {  64,5335 }, {  65,5335 },
+ {  66,5335 }, {  67,5335 }, {  68,5335 }, {  69,5335 }, {  70,5335 },
+ {  71,5335 }, {  72,5335 }, {  73,5335 }, {  74,5335 }, {  75,5335 },
+ {  76,5335 }, {  77,5335 }, {  78,5335 }, {  79,5335 }, {  80,5335 },
+ {  81,5335 }, {  82,5335 }, {  83,5335 }, {  84,5335 }, {  85,5335 },
+ {  86,5335 }, {  87,5335 }, {  88,5335 }, {  89,5335 }, {  90,5335 },
+ {  91,5335 }, {  92,5335 }, {  93,5335 }, {  94,5335 }, {  95,5335 },
+ {  96,5335 }, {  97,5335 }, {  98,5335 }, {  99,5335 }, { 100,5335 },
+ { 101,5335 }, { 102,5335 }, { 103,5335 }, { 104,5335 }, { 105,5335 },
+ { 106,5335 }, { 107,5335 }, { 108,5335 }, { 109,5335 }, { 110,5335 },
+
+ { 111,5335 }, { 112,5335 }, { 113,5335 }, { 114,5335 }, { 115,5335 },
+ { 116,5335 }, { 117,5335 }, { 118,5335 }, { 119,5335 }, { 120,5335 },
+ { 121,5335 }, { 122,5335 }, { 123,5335 }, { 124,5335 }, { 125,5335 },
+ { 126,5335 }, { 127,5335 }, { 128,5335 }, { 129,5335 }, { 130,5335 },
+ { 131,5335 }, { 132,5335 }, { 133,5335 }, { 134,5335 }, { 135,5335 },
+ { 136,5335 }, { 137,5335 }, { 138,5335 }, { 139,5335 }, { 140,5335 },
+ { 141,5335 }, { 142,5335 }, { 143,5335 }, { 144,5335 }, { 145,5335 },
+ { 146,5335 }, { 147,5335 }, { 148,5335 }, { 149,5335 }, { 150,5335 },
+ { 151,5335 }, { 152,5335 }, { 153,5335 }, { 154,5335 }, { 155,5335 },
+ { 156,5335 }, { 157,5335 }, { 158,5335 }, { 159,5335 }, { 160,5335 },
+
+ { 161,5335 }, { 162,5335 }, { 163,5335 }, { 164,5335 }, { 165,5335 },
+ { 166,5335 }, { 167,5335 }, { 168,5335 }, { 169,5335 }, { 170,5335 },
+ { 171,5335 }, { 172,5335 }, { 173,5335 }, { 174,5335 }, { 175,5335 },
+ { 176,5335 }, { 177,5335 }, { 178,5335 }, { 179,5335 }, { 180,5335 },
+ { 181,5335 }, { 182,5335 }, { 183,5335 }, { 184,5335 }, { 185,5335 },
+ { 186,5335 }, { 187,5335 }, { 188,5335 }, { 189,5335 }, { 190,5335 },
+ { 191,5335 }, { 192,5335 }, { 193,5335 }, { 194,5335 }, { 195,5335 },
+ { 196,5335 }, { 197,5335 }, { 198,5335 }, { 199,5335 }, { 200,5335 },
+ { 201,5335 }, { 202,5335 }, { 203,5335 }, { 204,5335 }, { 205,5335 },
+ { 206,5335 }, { 207,5335 }, { 208,5335 }, { 209,5335 }, { 210,5335 },
+
+ { 211,5335 }, { 212,5335 }, { 213,5335 }, { 214,5335 }, { 215,5335 },
+ { 216,5335 }, { 217,5335 }, { 218,5335 }, { 219,5335 }, { 220,5335 },
+ { 221,5335 }, { 222,5335 }, { 223,5335 }, { 224,5335 }, { 225,5335 },
+ { 226,5335 }, { 227,5335 }, { 228,5335 }, { 229,5335 }, { 230,5335 },
+ { 231,5335 }, { 232,5335 }, { 233,5335 }, { 234,5335 }, { 235,5335 },
+ { 236,5335 }, { 237,5335 }, { 238,5335 }, { 239,5335 }, { 240,5335 },
+ { 241,5335 }, { 242,5335 }, { 243,5335 }, { 244,5335 }, { 245,5335 },
+ { 246,5335 }, { 247,5335 }, { 248,5335 }, { 249,5335 }, { 250,5335 },
+ { 251,5335 }, { 252,5335 }, { 253,5335 }, { 254,5335 }, { 255,5335 },
+ { 256,5335 }, {   0,  55 }, {   0,32103 }, {   1,2125 }, {   2,2125 },
+
+ {   3,2125 }, {   4,2125 }, {   5,2125 }, {   6,2125 }, {   7,2125 },
+ {   8,2125 }, {   9,7284 }, {  10,7289 }, {  11,2125 }, {  12,7284 },
+ {  13,7284 }, {  14,2125 }, {  15,2125 }, {  16,2125 }, {  17,2125 },
+ {  18,2125 }, {  19,2125 }, {  20,2125 }, {  21,2125 }, {  22,2125 },
+ {  23,2125 }, {  24,2125 }, {  25,2125 }, {  26,2125 }, {  27,2125 },
+ {  28,2125 }, {  29,2125 }, {  30,2125 }, {  31,2125 }, {  32,7284 },
+ {  33,2125 }, {  34,2125 }, {  35,2125 }, {  36,2125 }, {  37,2125 },
+ {  38,2125 }, {  39,2125 }, {  40,2125 }, {  41,2125 }, {  42,2125 },
+ {  43,2125 }, {  44,2125 }, {  45,2127 }, {  46,2125 }, {  47,2125 },
+ {  48,2125 }, {  49,2125 }, {  50,2125 }, {  51,2125 }, {  52,2125 },
+
+ {  53,2125 }, {  54,2125 }, {  55,2125 }, {  56,2125 }, {  57,2125 },
+ {  58,2125 }, {  59,2125 }, {  60,2125 }, {  61,2125 }, {  62,2125 },
+ {  63,2125 }, {  64,2125 }, {  65,2125 }, {  66,2125 }, {  67,2125 },
+ {  68,2125 }, {  69,2125 }, {  70,2125 }, {  71,2125 }, {  72,2125 },
+ {  73,2125 }, {  74,2125 }, {  75,2125 }, {  76,2125 }, {  77,2125 },
+ {  78,2125 }, {  79,2125 }, {  80,2125 }, {  81,2125 }, {  82,2125 },
+ {  83,2125 }, {  84,2125 }, {  85,2141 }, {  86,2125 }, {  87,2125 },
+ {  88,2125 }, {  89,2125 }, {  90,2125 }, {  91,2125 }, {  92,2125 },
+ {  93,2125 }, {  94,2125 }, {  95,2125 }, {  96,2125 }, {  97,2125 },
+ {  98,2125 }, {  99,2125 }, { 100,2125 }, { 101,2125 }, { 102,2125 },
+
+ { 103,2125 }, { 104,2125 }, { 105,2125 }, { 106,2125 }, { 107,2125 },
+ { 108,2125 }, { 109,2125 }, { 110,2125 }, { 111,2125 }, { 112,2125 },
+ { 113,2125 }, { 114,2125 }, { 115,2125 }, { 116,2125 }, { 117,2141 },
+ { 118,2125 }, { 119,2125 }, { 120,2125 }, { 121,2125 }, { 122,2125 },
+ { 123,2125 }, { 124,2125 }, { 125,2125 }, { 126,2125 }, { 127,2125 },
+ { 128,2125 }, { 129,2125 }, { 130,2125 }, { 131,2125 }, { 132,2125 },
+ { 133,2125 }, { 134,2125 }, { 135,2125 }, { 136,2125 }, { 137,2125 },
+ { 138,2125 }, { 139,2125 }, { 140,2125 }, { 141,2125 }, { 142,2125 },
+ { 143,2125 }, { 144,2125 }, { 145,2125 }, { 146,2125 }, { 147,2125 },
+ { 148,2125 }, { 149,2125 }, { 150,2125 }, { 151,2125 }, { 152,2125 },
+
+ { 153,2125 }, { 154,2125 }, { 155,2125 }, { 156,2125 }, { 157,2125 },
+ { 158,2125 }, { 159,2125 }, { 160,2125 }, { 161,2125 }, { 162,2125 },
+ { 163,2125 }, { 164,2125 }, { 165,2125 }, { 166,2125 }, { 167,2125 },
+ { 168,2125 }, { 169,2125 }, { 170,2125 }, { 171,2125 }, { 172,2125 },
+ { 173,2125 }, { 174,2125 }, { 175,2125 }, { 176,2125 }, { 177,2125 },
+ { 178,2125 }, { 179,2125 }, { 180,2125 }, { 181,2125 }, { 182,2125 },
+ { 183,2125 }, { 184,2125 }, { 185,2125 }, { 186,2125 }, { 187,2125 },
+ { 188,2125 }, { 189,2125 }, { 190,2125 }, { 191,2125 }, { 192,2125 },
+ { 193,2125 }, { 194,2125 }, { 195,2125 }, { 196,2125 }, { 197,2125 },
+ { 198,2125 }, { 199,2125 }, { 200,2125 }, { 201,2125 }, { 202,2125 },
+
+ { 203,2125 }, { 204,2125 }, { 205,2125 }, { 206,2125 }, { 207,2125 },
+ { 208,2125 }, { 209,2125 }, { 210,2125 }, { 211,2125 }, { 212,2125 },
+ { 213,2125 }, { 214,2125 }, { 215,2125 }, { 216,2125 }, { 217,2125 },
+ { 218,2125 }, { 219,2125 }, { 220,2125 }, { 221,2125 }, { 222,2125 },
+ { 223,2125 }, { 224,2125 }, { 225,2125 }, { 226,2125 }, { 227,2125 },
+ { 228,2125 }, { 229,2125 }, { 230,2125 }, { 231,2125 }, { 232,2125 },
+ { 233,2125 }, { 234,2125 }, { 235,2125 }, { 236,2125 }, { 237,2125 },
+ { 238,2125 }, { 239,2125 }, { 240,2125 }, { 241,2125 }, { 242,2125 },
+ { 243,2125 }, { 244,2125 }, { 245,2125 }, { 246,2125 }, { 247,2125 },
+ { 248,2125 }, { 249,2125 }, { 250,2125 }, { 251,2125 }, { 252,2125 },
+
+ { 253,2125 }, { 254,2125 }, { 255,2125 }, { 256,2125 }, {   0,  55 },
+ {   0,31845 }, {   1,1867 }, {   2,1867 }, {   3,1867 }, {   4,1867 },
+ {   5,1867 }, {   6,1867 }, {   7,1867 }, {   8,1867 }, {   9,7026 },
+ {  10,7031 }, {  11,1867 }, {  12,7026 }, {  13,7026 }, {  14,1867 },
+ {  15,1867 }, {  16,1867 }, {  17,1867 }, {  18,1867 }, {  19,1867 },
+ {  20,1867 }, {  21,1867 }, {  22,1867 }, {  23,1867 }, {  24,1867 },
+ {  25,1867 }, {  26,1867 }, {  27,1867 }, {  28,1867 }, {  29,1867 },
+ {  30,1867 }, {  31,1867 }, {  32,7026 }, {  33,1867 }, {  34,1867 },
+ {  35,1867 }, {  36,1867 }, {  37,1867 }, {  38,1867 }, {  39,1867 },
+ {  40,1867 }, {  41,1867 }, {  42,1867 }, {  43,1867 }, {  44,1867 },
+
+ {  45,1869 }, {  46,1867 }, {  47,1867 }, {  48,1867 }, {  49,1867 },
+ {  50,1867 }, {  51,1867 }, {  52,1867 }, {  53,1867 }, {  54,1867 },
+ {  55,1867 }, {  56,1867 }, {  57,1867 }, {  58,1867 }, {  59,1867 },
+ {  60,1867 }, {  61,1867 }, {  62,1867 }, {  63,1867 }, {  64,1867 },
+ {  65,1867 }, {  66,1867 }, {  67,1867 }, {  68,1867 }, {  69,1867 },
+ {  70,1867 }, {  71,1867 }, {  72,1867 }, {  73,1867 }, {  74,1867 },
+ {  75,1867 }, {  76,1867 }, {  77,1867 }, {  78,1867 }, {  79,1867 },
+ {  80,1867 }, {  81,1867 }, {  82,1867 }, {  83,1867 }, {  84,1867 },
+ {  85,1883 }, {  86,1867 }, {  87,1867 }, {  88,1867 }, {  89,1867 },
+ {  90,1867 }, {  91,1867 }, {  92,1867 }, {  93,1867 }, {  94,1867 },
+
+ {  95,1867 }, {  96,1867 }, {  97,1867 }, {  98,1867 }, {  99,1867 },
+ { 100,1867 }, { 101,1867 }, { 102,1867 }, { 103,1867 }, { 104,1867 },
+ { 105,1867 }, { 106,1867 }, { 107,1867 }, { 108,1867 }, { 109,1867 },
+ { 110,1867 }, { 111,1867 }, { 112,1867 }, { 113,1867 }, { 114,1867 },
+ { 115,1867 }, { 116,1867 }, { 117,1883 }, { 118,1867 }, { 119,1867 },
+ { 120,1867 }, { 121,1867 }, { 122,1867 }, { 123,1867 }, { 124,1867 },
+ { 125,1867 }, { 126,1867 }, { 127,1867 }, { 128,1867 }, { 129,1867 },
+ { 130,1867 }, { 131,1867 }, { 132,1867 }, { 133,1867 }, { 134,1867 },
+ { 135,1867 }, { 136,1867 }, { 137,1867 }, { 138,1867 }, { 139,1867 },
+ { 140,1867 }, { 141,1867 }, { 142,1867 }, { 143,1867 }, { 144,1867 },
+
+ { 145,1867 }, { 146,1867 }, { 147,1867 }, { 148,1867 }, { 149,1867 },
+ { 150,1867 }, { 151,1867 }, { 152,1867 }, { 153,1867 }, { 154,1867 },
+ { 155,1867 }, { 156,1867 }, { 157,1867 }, { 158,1867 }, { 159,1867 },
+ { 160,1867 }, { 161,1867 }, { 162,1867 }, { 163,1867 }, { 164,1867 },
+ { 165,1867 }, { 166,1867 }, { 167,1867 }, { 168,1867 }, { 169,1867 },
+ { 170,1867 }, { 171,1867 }, { 172,1867 }, { 173,1867 }, { 174,1867 },
+ { 175,1867 }, { 176,1867 }, { 177,1867 }, { 178,1867 }, { 179,1867 },
+ { 180,1867 }, { 181,1867 }, { 182,1867 }, { 183,1867 }, { 184,1867 },
+ { 185,1867 }, { 186,1867 }, { 187,1867 }, { 188,1867 }, { 189,1867 },
+ { 190,1867 }, { 191,1867 }, { 192,1867 }, { 193,1867 }, { 194,1867 },
+
+ { 195,1867 }, { 196,1867 }, { 197,1867 }, { 198,1867 }, { 199,1867 },
+ { 200,1867 }, { 201,1867 }, { 202,1867 }, { 203,1867 }, { 204,1867 },
+ { 205,1867 }, { 206,1867 }, { 207,1867 }, { 208,1867 }, { 209,1867 },
+ { 210,1867 }, { 211,1867 }, { 212,1867 }, { 213,1867 }, { 214,1867 },
+ { 215,1867 }, { 216,1867 }, { 217,1867 }, { 218,1867 }, { 219,1867 },
+ { 220,1867 }, { 221,1867 }, { 222,1867 }, { 223,1867 }, { 224,1867 },
+ { 225,1867 }, { 226,1867 }, { 227,1867 }, { 228,1867 }, { 229,1867 },
+ { 230,1867 }, { 231,1867 }, { 232,1867 }, { 233,1867 }, { 234,1867 },
+ { 235,1867 }, { 236,1867 }, { 237,1867 }, { 238,1867 }, { 239,1867 },
+ { 240,1867 }, { 241,1867 }, { 242,1867 }, { 243,1867 }, { 244,1867 },
+
+ { 245,1867 }, { 246,1867 }, { 247,1867 }, { 248,1867 }, { 249,1867 },
+ { 250,1867 }, { 251,1867 }, { 252,1867 }, { 253,1867 }, { 254,1867 },
+ { 255,1867 }, { 256,1867 }, {   0,   0 }, {   0,31587 }, {   1,5945 },
+ {   2,5945 }, {   3,5945 }, {   4,5945 }, {   5,5945 }, {   6,5945 },
+ {   7,5945 }, {   8,5945 }, {   9,5945 }, {  10,5945 }, {  11,5945 },
+ {  12,5945 }, {  13,5945 }, {  14,5945 }, {  15,5945 }, {  16,5945 },
+ {  17,5945 }, {  18,5945 }, {  19,5945 }, {  20,5945 }, {  21,5945 },
+ {  22,5945 }, {  23,5945 }, {  24,5945 }, {  25,5945 }, {  26,5945 },
+ {  27,5945 }, {  28,5945 }, {  29,5945 }, {  30,5945 }, {  31,5945 },
+ {  32,5945 }, {  33,5945 }, {  34,5945 }, {  35,5945 }, {  36,5945 },
+
+ {  37,5945 }, {  38,5945 }, {  39,7023 }, {  40,5945 }, {  41,5945 },
+ {  42,5945 }, {  43,5945 }, {  44,5945 }, {  45,5945 }, {  46,5945 },
+ {  47,5945 }, {  48,5945 }, {  49,5945 }, {  50,5945 }, {  51,5945 },
+ {  52,5945 }, {  53,5945 }, {  54,5945 }, {  55,5945 }, {  56,5945 },
+ {  57,5945 }, {  58,5945 }, {  59,5945 }, {  60,5945 }, {  61,5945 },
+ {  62,5945 }, {  63,5945 }, {  64,5945 }, {  65,5945 }, {  66,5945 },
+ {  67,5945 }, {  68,5945 }, {  69,5945 }, {  70,5945 }, {  71,5945 },
+ {  72,5945 }, {  73,5945 }, {  74,5945 }, {  75,5945 }, {  76,5945 },
+ {  77,5945 }, {  78,5945 }, {  79,5945 }, {  80,5945 }, {  81,5945 },
+ {  82,5945 }, {  83,5945 }, {  84,5945 }, {  85,5945 }, {  86,5945 },
+
+ {  87,5945 }, {  88,5945 }, {  89,5945 }, {  90,5945 }, {  91,5945 },
+ {  92,5945 }, {  93,5945 }, {  94,5945 }, {  95,5945 }, {  96,5945 },
+ {  97,5945 }, {  98,5945 }, {  99,5945 }, { 100,5945 }, { 101,5945 },
+ { 102,5945 }, { 103,5945 }, { 104,5945 }, { 105,5945 }, { 106,5945 },
+ { 107,5945 }, { 108,5945 }, { 109,5945 }, { 110,5945 }, { 111,5945 },
+ { 112,5945 }, { 113,5945 }, { 114,5945 }, { 115,5945 }, { 116,5945 },
+ { 117,5945 }, { 118,5945 }, { 119,5945 }, { 120,5945 }, { 121,5945 },
+ { 122,5945 }, { 123,5945 }, { 124,5945 }, { 125,5945 }, { 126,5945 },
+ { 127,5945 }, { 128,5945 }, { 129,5945 }, { 130,5945 }, { 131,5945 },
+ { 132,5945 }, { 133,5945 }, { 134,5945 }, { 135,5945 }, { 136,5945 },
+
+ { 137,5945 }, { 138,5945 }, { 139,5945 }, { 140,5945 }, { 141,5945 },
+ { 142,5945 }, { 143,5945 }, { 144,5945 }, { 145,5945 }, { 146,5945 },
+ { 147,5945 }, { 148,5945 }, { 149,5945 }, { 150,5945 }, { 151,5945 },
+ { 152,5945 }, { 153,5945 }, { 154,5945 }, { 155,5945 }, { 156,5945 },
+ { 157,5945 }, { 158,5945 }, { 159,5945 }, { 160,5945 }, { 161,5945 },
+ { 162,5945 }, { 163,5945 }, { 164,5945 }, { 165,5945 }, { 166,5945 },
+ { 167,5945 }, { 168,5945 }, { 169,5945 }, { 170,5945 }, { 171,5945 },
+ { 172,5945 }, { 173,5945 }, { 174,5945 }, { 175,5945 }, { 176,5945 },
+ { 177,5945 }, { 178,5945 }, { 179,5945 }, { 180,5945 }, { 181,5945 },
+ { 182,5945 }, { 183,5945 }, { 184,5945 }, { 185,5945 }, { 186,5945 },
+
+ { 187,5945 }, { 188,5945 }, { 189,5945 }, { 190,5945 }, { 191,5945 },
+ { 192,5945 }, { 193,5945 }, { 194,5945 }, { 195,5945 }, { 196,5945 },
+ { 197,5945 }, { 198,5945 }, { 199,5945 }, { 200,5945 }, { 201,5945 },
+ { 202,5945 }, { 203,5945 }, { 204,5945 }, { 205,5945 }, { 206,5945 },
+ { 207,5945 }, { 208,5945 }, { 209,5945 }, { 210,5945 }, { 211,5945 },
+ { 212,5945 }, { 213,5945 }, { 214,5945 }, { 215,5945 }, { 216,5945 },
+ { 217,5945 }, { 218,5945 }, { 219,5945 }, { 220,5945 }, { 221,5945 },
+ { 222,5945 }, { 223,5945 }, { 224,5945 }, { 225,5945 }, { 226,5945 },
+ { 227,5945 }, { 228,5945 }, { 229,5945 }, { 230,5945 }, { 231,5945 },
+ { 232,5945 }, { 233,5945 }, { 234,5945 }, { 235,5945 }, { 236,5945 },
+
+ { 237,5945 }, { 238,5945 }, { 239,5945 }, { 240,5945 }, { 241,5945 },
+ { 242,5945 }, { 243,5945 }, { 244,5945 }, { 245,5945 }, { 246,5945 },
+ { 247,5945 }, { 248,5945 }, { 249,5945 }, { 250,5945 }, { 251,5945 },
+ { 252,5945 }, { 253,5945 }, { 254,5945 }, { 255,5945 }, { 256,5945 },
+ {   0,   0 }, {   0,31329 }, {   1,5687 }, {   2,5687 }, {   3,5687 },
+ {   4,5687 }, {   5,5687 }, {   6,5687 }, {   7,5687 }, {   8,5687 },
+ {   9,5687 }, {  10,5687 }, {  11,5687 }, {  12,5687 }, {  13,5687 },
+ {  14,5687 }, {  15,5687 }, {  16,5687 }, {  17,5687 }, {  18,5687 },
+ {  19,5687 }, {  20,5687 }, {  21,5687 }, {  22,5687 }, {  23,5687 },
+ {  24,5687 }, {  25,5687 }, {  26,5687 }, {  27,5687 }, {  28,5687 },
+
+ {  29,5687 }, {  30,5687 }, {  31,5687 }, {  32,5687 }, {  33,5687 },
+ {  34,5687 }, {  35,5687 }, {  36,5687 }, {  37,5687 }, {  38,5687 },
+ {  39,6765 }, {  40,5687 }, {  41,5687 }, {  42,5687 }, {  43,5687 },
+ {  44,5687 }, {  45,5687 }, {  46,5687 }, {  47,5687 }, {  48,5687 },
+ {  49,5687 }, {  50,5687 }, {  51,5687 }, {  52,5687 }, {  53,5687 },
+ {  54,5687 }, {  55,5687 }, {  56,5687 }, {  57,5687 }, {  58,5687 },
+ {  59,5687 }, {  60,5687 }, {  61,5687 }, {  62,5687 }, {  63,5687 },
+ {  64,5687 }, {  65,5687 }, {  66,5687 }, {  67,5687 }, {  68,5687 },
+ {  69,5687 }, {  70,5687 }, {  71,5687 }, {  72,5687 }, {  73,5687 },
+ {  74,5687 }, {  75,5687 }, {  76,5687 }, {  77,5687 }, {  78,5687 },
+
+ {  79,5687 }, {  80,5687 }, {  81,5687 }, {  82,5687 }, {  83,5687 },
+ {  84,5687 }, {  85,5687 }, {  86,5687 }, {  87,5687 }, {  88,5687 },
+ {  89,5687 }, {  90,5687 }, {  91,5687 }, {  92,5687 }, {  93,5687 },
+ {  94,5687 }, {  95,5687 }, {  96,5687 }, {  97,5687 }, {  98,5687 },
+ {  99,5687 }, { 100,5687 }, { 101,5687 }, { 102,5687 }, { 103,5687 },
+ { 104,5687 }, { 105,5687 }, { 106,5687 }, { 107,5687 }, { 108,5687 },
+ { 109,5687 }, { 110,5687 }, { 111,5687 }, { 112,5687 }, { 113,5687 },
+ { 114,5687 }, { 115,5687 }, { 116,5687 }, { 117,5687 }, { 118,5687 },
+ { 119,5687 }, { 120,5687 }, { 121,5687 }, { 122,5687 }, { 123,5687 },
+ { 124,5687 }, { 125,5687 }, { 126,5687 }, { 127,5687 }, { 128,5687 },
+
+ { 129,5687 }, { 130,5687 }, { 131,5687 }, { 132,5687 }, { 133,5687 },
+ { 134,5687 }, { 135,5687 }, { 136,5687 }, { 137,5687 }, { 138,5687 },
+ { 139,5687 }, { 140,5687 }, { 141,5687 }, { 142,5687 }, { 143,5687 },
+ { 144,5687 }, { 145,5687 }, { 146,5687 }, { 147,5687 }, { 148,5687 },
+ { 149,5687 }, { 150,5687 }, { 151,5687 }, { 152,5687 }, { 153,5687 },
+ { 154,5687 }, { 155,5687 }, { 156,5687 }, { 157,5687 }, { 158,5687 },
+ { 159,5687 }, { 160,5687 }, { 161,5687 }, { 162,5687 }, { 163,5687 },
+ { 164,5687 }, { 165,5687 }, { 166,5687 }, { 167,5687 }, { 168,5687 },
+ { 169,5687 }, { 170,5687 }, { 171,5687 }, { 172,5687 }, { 173,5687 },
+ { 174,5687 }, { 175,5687 }, { 176,5687 }, { 177,5687 }, { 178,5687 },
+
+ { 179,5687 }, { 180,5687 }, { 181,5687 }, { 182,5687 }, { 183,5687 },
+ { 184,5687 }, { 185,5687 }, { 186,5687 }, { 187,5687 }, { 188,5687 },
+ { 189,5687 }, { 190,5687 }, { 191,5687 }, { 192,5687 }, { 193,5687 },
+ { 194,5687 }, { 195,5687 }, { 196,5687 }, { 197,5687 }, { 198,5687 },
+ { 199,5687 }, { 200,5687 }, { 201,5687 }, { 202,5687 }, { 203,5687 },
+ { 204,5687 }, { 205,5687 }, { 206,5687 }, { 207,5687 }, { 208,5687 },
+ { 209,5687 }, { 210,5687 }, { 211,5687 }, { 212,5687 }, { 213,5687 },
+ { 214,5687 }, { 215,5687 }, { 216,5687 }, { 217,5687 }, { 218,5687 },
+ { 219,5687 }, { 220,5687 }, { 221,5687 }, { 222,5687 }, { 223,5687 },
+ { 224,5687 }, { 225,5687 }, { 226,5687 }, { 227,5687 }, { 228,5687 },
+
+ { 229,5687 }, { 230,5687 }, { 231,5687 }, { 232,5687 }, { 233,5687 },
+ { 234,5687 }, { 235,5687 }, { 236,5687 }, { 237,5687 }, { 238,5687 },
+ { 239,5687 }, { 240,5687 }, { 241,5687 }, { 242,5687 }, { 243,5687 },
+ { 244,5687 }, { 245,5687 }, { 246,5687 }, { 247,5687 }, { 248,5687 },
+ { 249,5687 }, { 250,5687 }, { 251,5687 }, { 252,5687 }, { 253,5687 },
+ { 254,5687 }, { 255,5687 }, { 256,5687 }, {   0,  28 }, {   0,31071 },
+ {   1,1113 }, {   2,1113 }, {   3,1113 }, {   4,1113 }, {   5,1113 },
+ {   6,1113 }, {   7,1113 }, {   8,1113 }, {   9,6512 }, {  10,6528 },
+ {  11,1113 }, {  12,6512 }, {  13,6512 }, {  14,1113 }, {  15,1113 },
+ {  16,1113 }, {  17,1113 }, {  18,1113 }, {  19,1113 }, {  20,1113 },
+
+ {  21,1113 }, {  22,1113 }, {  23,1113 }, {  24,1113 }, {  25,1113 },
+ {  26,1113 }, {  27,1113 }, {  28,1113 }, {  29,1113 }, {  30,1113 },
+ {  31,1113 }, {  32,6512 }, {  33,1113 }, {  34,1113 }, {  35,1113 },
+ {  36,1113 }, {  37,1113 }, {  38,1113 }, {  39,1113 }, {  40,1113 },
+ {  41,1113 }, {  42,1113 }, {  43,1113 }, {  44,1113 }, {  45,1131 },
+ {  46,1113 }, {  47,1113 }, {  48,1113 }, {  49,1113 }, {  50,1113 },
+ {  51,1113 }, {  52,1113 }, {  53,1113 }, {  54,1113 }, {  55,1113 },
+ {  56,1113 }, {  57,1113 }, {  58,1113 }, {  59,1113 }, {  60,1113 },
+ {  61,1113 }, {  62,1113 }, {  63,1113 }, {  64,1113 }, {  65,1113 },
+ {  66,1113 }, {  67,1113 }, {  68,1113 }, {  69,1113 }, {  70,1113 },
+
+ {  71,1113 }, {  72,1113 }, {  73,1113 }, {  74,1113 }, {  75,1113 },
+ {  76,1113 }, {  77,1113 }, {  78,1113 }, {  79,1113 }, {  80,1113 },
+ {  81,1113 }, {  82,1113 }, {  83,1113 }, {  84,1113 }, {  85,1139 },
+ {  86,1113 }, {  87,1113 }, {  88,1113 }, {  89,1113 }, {  90,1113 },
+ {  91,1113 }, {  92,1113 }, {  93,1113 }, {  94,1113 }, {  95,1113 },
+ {  96,1113 }, {  97,1113 }, {  98,1113 }, {  99,1113 }, { 100,1113 },
+ { 101,1113 }, { 102,1113 }, { 103,1113 }, { 104,1113 }, { 105,1113 },
+ { 106,1113 }, { 107,1113 }, { 108,1113 }, { 109,1113 }, { 110,1113 },
+ { 111,1113 }, { 112,1113 }, { 113,1113 }, { 114,1113 }, { 115,1113 },
+ { 116,1113 }, { 117,1139 }, { 118,1113 }, { 119,1113 }, { 120,1113 },
+
+ { 121,1113 }, { 122,1113 }, { 123,1113 }, { 124,1113 }, { 125,1113 },
+ { 126,1113 }, { 127,1113 }, { 128,1113 }, { 129,1113 }, { 130,1113 },
+ { 131,1113 }, { 132,1113 }, { 133,1113 }, { 134,1113 }, { 135,1113 },
+ { 136,1113 }, { 137,1113 }, { 138,1113 }, { 139,1113 }, { 140,1113 },
+ { 141,1113 }, { 142,1113 }, { 143,1113 }, { 144,1113 }, { 145,1113 },
+ { 146,1113 }, { 147,1113 }, { 148,1113 }, { 149,1113 }, { 150,1113 },
+ { 151,1113 }, { 152,1113 }, { 153,1113 }, { 154,1113 }, { 155,1113 },
+ { 156,1113 }, { 157,1113 }, { 158,1113 }, { 159,1113 }, { 160,1113 },
+ { 161,1113 }, { 162,1113 }, { 163,1113 }, { 164,1113 }, { 165,1113 },
+ { 166,1113 }, { 167,1113 }, { 168,1113 }, { 169,1113 }, { 170,1113 },
+
+ { 171,1113 }, { 172,1113 }, { 173,1113 }, { 174,1113 }, { 175,1113 },
+ { 176,1113 }, { 177,1113 }, { 178,1113 }, { 179,1113 }, { 180,1113 },
+ { 181,1113 }, { 182,1113 }, { 183,1113 }, { 184,1113 }, { 185,1113 },
+ { 186,1113 }, { 187,1113 }, { 188,1113 }, { 189,1113 }, { 190,1113 },
+ { 191,1113 }, { 192,1113 }, { 193,1113 }, { 194,1113 }, { 195,1113 },
+ { 196,1113 }, { 197,1113 }, { 198,1113 }, { 199,1113 }, { 200,1113 },
+ { 201,1113 }, { 202,1113 }, { 203,1113 }, { 204,1113 }, { 205,1113 },
+ { 206,1113 }, { 207,1113 }, { 208,1113 }, { 209,1113 }, { 210,1113 },
+ { 211,1113 }, { 212,1113 }, { 213,1113 }, { 214,1113 }, { 215,1113 },
+ { 216,1113 }, { 217,1113 }, { 218,1113 }, { 219,1113 }, { 220,1113 },
+
+ { 221,1113 }, { 222,1113 }, { 223,1113 }, { 224,1113 }, { 225,1113 },
+ { 226,1113 }, { 227,1113 }, { 228,1113 }, { 229,1113 }, { 230,1113 },
+ { 231,1113 }, { 232,1113 }, { 233,1113 }, { 234,1113 }, { 235,1113 },
+ { 236,1113 }, { 237,1113 }, { 238,1113 }, { 239,1113 }, { 240,1113 },
+ { 241,1113 }, { 242,1113 }, { 243,1113 }, { 244,1113 }, { 245,1113 },
+ { 246,1113 }, { 247,1113 }, { 248,1113 }, { 249,1113 }, { 250,1113 },
+ { 251,1113 }, { 252,1113 }, { 253,1113 }, { 254,1113 }, { 255,1113 },
+ { 256,1113 }, {   0,  28 }, {   0,30813 }, {   1, 855 }, {   2, 855 },
+ {   3, 855 }, {   4, 855 }, {   5, 855 }, {   6, 855 }, {   7, 855 },
+ {   8, 855 }, {   9,6254 }, {  10,6270 }, {  11, 855 }, {  12,6254 },
+
+ {  13,6254 }, {  14, 855 }, {  15, 855 }, {  16, 855 }, {  17, 855 },
+ {  18, 855 }, {  19, 855 }, {  20, 855 }, {  21, 855 }, {  22, 855 },
+ {  23, 855 }, {  24, 855 }, {  25, 855 }, {  26, 855 }, {  27, 855 },
+ {  28, 855 }, {  29, 855 }, {  30, 855 }, {  31, 855 }, {  32,6254 },
+ {  33, 855 }, {  34, 855 }, {  35, 855 }, {  36, 855 }, {  37, 855 },
+ {  38, 855 }, {  39, 855 }, {  40, 855 }, {  41, 855 }, {  42, 855 },
+ {  43, 855 }, {  44, 855 }, {  45, 873 }, {  46, 855 }, {  47, 855 },
+ {  48, 855 }, {  49, 855 }, {  50, 855 }, {  51, 855 }, {  52, 855 },
+ {  53, 855 }, {  54, 855 }, {  55, 855 }, {  56, 855 }, {  57, 855 },
+ {  58, 855 }, {  59, 855 }, {  60, 855 }, {  61, 855 }, {  62, 855 },
+
+ {  63, 855 }, {  64, 855 }, {  65, 855 }, {  66, 855 }, {  67, 855 },
+ {  68, 855 }, {  69, 855 }, {  70, 855 }, {  71, 855 }, {  72, 855 },
+ {  73, 855 }, {  74, 855 }, {  75, 855 }, {  76, 855 }, {  77, 855 },
+ {  78, 855 }, {  79, 855 }, {  80, 855 }, {  81, 855 }, {  82, 855 },
+ {  83, 855 }, {  84, 855 }, {  85, 881 }, {  86, 855 }, {  87, 855 },
+ {  88, 855 }, {  89, 855 }, {  90, 855 }, {  91, 855 }, {  92, 855 },
+ {  93, 855 }, {  94, 855 }, {  95, 855 }, {  96, 855 }, {  97, 855 },
+ {  98, 855 }, {  99, 855 }, { 100, 855 }, { 101, 855 }, { 102, 855 },
+ { 103, 855 }, { 104, 855 }, { 105, 855 }, { 106, 855 }, { 107, 855 },
+ { 108, 855 }, { 109, 855 }, { 110, 855 }, { 111, 855 }, { 112, 855 },
+
+ { 113, 855 }, { 114, 855 }, { 115, 855 }, { 116, 855 }, { 117, 881 },
+ { 118, 855 }, { 119, 855 }, { 120, 855 }, { 121, 855 }, { 122, 855 },
+ { 123, 855 }, { 124, 855 }, { 125, 855 }, { 126, 855 }, { 127, 855 },
+ { 128, 855 }, { 129, 855 }, { 130, 855 }, { 131, 855 }, { 132, 855 },
+ { 133, 855 }, { 134, 855 }, { 135, 855 }, { 136, 855 }, { 137, 855 },
+ { 138, 855 }, { 139, 855 }, { 140, 855 }, { 141, 855 }, { 142, 855 },
+ { 143, 855 }, { 144, 855 }, { 145, 855 }, { 146, 855 }, { 147, 855 },
+ { 148, 855 }, { 149, 855 }, { 150, 855 }, { 151, 855 }, { 152, 855 },
+ { 153, 855 }, { 154, 855 }, { 155, 855 }, { 156, 855 }, { 157, 855 },
+ { 158, 855 }, { 159, 855 }, { 160, 855 }, { 161, 855 }, { 162, 855 },
+
+ { 163, 855 }, { 164, 855 }, { 165, 855 }, { 166, 855 }, { 167, 855 },
+ { 168, 855 }, { 169, 855 }, { 170, 855 }, { 171, 855 }, { 172, 855 },
+ { 173, 855 }, { 174, 855 }, { 175, 855 }, { 176, 855 }, { 177, 855 },
+ { 178, 855 }, { 179, 855 }, { 180, 855 }, { 181, 855 }, { 182, 855 },
+ { 183, 855 }, { 184, 855 }, { 185, 855 }, { 186, 855 }, { 187, 855 },
+ { 188, 855 }, { 189, 855 }, { 190, 855 }, { 191, 855 }, { 192, 855 },
+ { 193, 855 }, { 194, 855 }, { 195, 855 }, { 196, 855 }, { 197, 855 },
+ { 198, 855 }, { 199, 855 }, { 200, 855 }, { 201, 855 }, { 202, 855 },
+ { 203, 855 }, { 204, 855 }, { 205, 855 }, { 206, 855 }, { 207, 855 },
+ { 208, 855 }, { 209, 855 }, { 210, 855 }, { 211, 855 }, { 212, 855 },
+
+ { 213, 855 }, { 214, 855 }, { 215, 855 }, { 216, 855 }, { 217, 855 },
+ { 218, 855 }, { 219, 855 }, { 220, 855 }, { 221, 855 }, { 222, 855 },
+ { 223, 855 }, { 224, 855 }, { 225, 855 }, { 226, 855 }, { 227, 855 },
+ { 228, 855 }, { 229, 855 }, { 230, 855 }, { 231, 855 }, { 232, 855 },
+ { 233, 855 }, { 234, 855 }, { 235, 855 }, { 236, 855 }, { 237, 855 },
+ { 238, 855 }, { 239, 855 }, { 240, 855 }, { 241, 855 }, { 242, 855 },
+ { 243, 855 }, { 244, 855 }, { 245, 855 }, { 246, 855 }, { 247, 855 },
+ { 248, 855 }, { 249, 855 }, { 250, 855 }, { 251, 855 }, { 252, 855 },
+ { 253, 855 }, { 254, 855 }, { 255, 855 }, { 256, 855 }, {   0,   0 },
+ {   0,30555 }, {   1, 633 }, {   2, 633 }, {   3, 633 }, {   4, 633 },
+
+ {   5, 633 }, {   6, 633 }, {   7, 633 }, {   8, 633 }, {   9, 633 },
+ {  10, 635 }, {  11, 633 }, {  12, 633 }, {  13, 633 }, {  14, 633 },
+ {  15, 633 }, {  16, 633 }, {  17, 633 }, {  18, 633 }, {  19, 633 },
+ {  20, 633 }, {  21, 633 }, {  22, 633 }, {  23, 633 }, {  24, 633 },
+ {  25, 633 }, {  26, 633 }, {  27, 633 }, {  28, 633 }, {  29, 633 },
+ {  30, 633 }, {  31, 633 }, {  32, 633 }, {  33, 633 }, {  34, 633 },
+ {  35, 633 }, {  36, 633 }, {  37, 633 }, {  38, 633 }, {  39, 633 },
+ {  40, 633 }, {  41, 633 }, {  42, 633 }, {  43, 633 }, {  44, 633 },
+ {  45, 633 }, {  46, 633 }, {  47, 633 }, {  48, 633 }, {  49, 633 },
+ {  50, 633 }, {  51, 633 }, {  52, 633 }, {  53, 633 }, {  54, 633 },
+
+ {  55, 633 }, {  56, 633 }, {  57, 633 }, {  58, 633 }, {  59, 633 },
+ {  60, 633 }, {  61, 633 }, {  62, 633 }, {  63, 633 }, {  64, 633 },
+ {  65, 633 }, {  66, 633 }, {  67, 633 }, {  68, 633 }, {  69, 633 },
+ {  70, 633 }, {  71, 633 }, {  72, 633 }, {  73, 633 }, {  74, 633 },
+ {  75, 633 }, {  76, 633 }, {  77, 633 }, {  78, 633 }, {  79, 633 },
+ {  80, 633 }, {  81, 633 }, {  82, 633 }, {  83, 633 }, {  84, 633 },
+ {  85, 633 }, {  86, 633 }, {  87, 633 }, {  88, 633 }, {  89, 633 },
+ {  90, 633 }, {  91, 633 }, {  92, 637 }, {  93, 633 }, {  94, 633 },
+ {  95, 633 }, {  96, 633 }, {  97, 633 }, {  98, 633 }, {  99, 633 },
+ { 100, 633 }, { 101, 633 }, { 102, 633 }, { 103, 633 }, { 104, 633 },
+
+ { 105, 633 }, { 106, 633 }, { 107, 633 }, { 108, 633 }, { 109, 633 },
+ { 110, 633 }, { 111, 633 }, { 112, 633 }, { 113, 633 }, { 114, 633 },
+ { 115, 633 }, { 116, 633 }, { 117, 633 }, { 118, 633 }, { 119, 633 },
+ { 120, 633 }, { 121, 633 }, { 122, 633 }, { 123, 633 }, { 124, 633 },
+ { 125, 633 }, { 126, 633 }, { 127, 633 }, { 128, 633 }, { 129, 633 },
+ { 130, 633 }, { 131, 633 }, { 132, 633 }, { 133, 633 }, { 134, 633 },
+ { 135, 633 }, { 136, 633 }, { 137, 633 }, { 138, 633 }, { 139, 633 },
+ { 140, 633 }, { 141, 633 }, { 142, 633 }, { 143, 633 }, { 144, 633 },
+ { 145, 633 }, { 146, 633 }, { 147, 633 }, { 148, 633 }, { 149, 633 },
+ { 150, 633 }, { 151, 633 }, { 152, 633 }, { 153, 633 }, { 154, 633 },
+
+ { 155, 633 }, { 156, 633 }, { 157, 633 }, { 158, 633 }, { 159, 633 },
+ { 160, 633 }, { 161, 633 }, { 162, 633 }, { 163, 633 }, { 164, 633 },
+ { 165, 633 }, { 166, 633 }, { 167, 633 }, { 168, 633 }, { 169, 633 },
+ { 170, 633 }, { 171, 633 }, { 172, 633 }, { 173, 633 }, { 174, 633 },
+ { 175, 633 }, { 176, 633 }, { 177, 633 }, { 178, 633 }, { 179, 633 },
+ { 180, 633 }, { 181, 633 }, { 182, 633 }, { 183, 633 }, { 184, 633 },
+ { 185, 633 }, { 186, 633 }, { 187, 633 }, { 188, 633 }, { 189, 633 },
+ { 190, 633 }, { 191, 633 }, { 192, 633 }, { 193, 633 }, { 194, 633 },
+ { 195, 633 }, { 196, 633 }, { 197, 633 }, { 198, 633 }, { 199, 633 },
+ { 200, 633 }, { 201, 633 }, { 202, 633 }, { 203, 633 }, { 204, 633 },
+
+ { 205, 633 }, { 206, 633 }, { 207, 633 }, { 208, 633 }, { 209, 633 },
+ { 210, 633 }, { 211, 633 }, { 212, 633 }, { 213, 633 }, { 214, 633 },
+ { 215, 633 }, { 216, 633 }, { 217, 633 }, { 218, 633 }, { 219, 633 },
+ { 220, 633 }, { 221, 633 }, { 222, 633 }, { 223, 633 }, { 224, 633 },
+ { 225, 633 }, { 226, 633 }, { 227, 633 }, { 228, 633 }, { 229, 633 },
+ { 230, 633 }, { 231, 633 }, { 232, 633 }, { 233, 633 }, { 234, 633 },
+ { 235, 633 }, { 236, 633 }, { 237, 633 }, { 238, 633 }, { 239, 633 },
+ { 240, 633 }, { 241, 633 }, { 242, 633 }, { 243, 633 }, { 244, 633 },
+ { 245, 633 }, { 246, 633 }, { 247, 633 }, { 248, 633 }, { 249, 633 },
+ { 250, 633 }, { 251, 633 }, { 252, 633 }, { 253, 633 }, { 254, 633 },
+
+ { 255, 633 }, { 256, 633 }, {   0,   0 }, {   0,30297 }, {   1, 375 },
+ {   2, 375 }, {   3, 375 }, {   4, 375 }, {   5, 375 }, {   6, 375 },
+ {   7, 375 }, {   8, 375 }, {   9, 375 }, {  10, 377 }, {  11, 375 },
+ {  12, 375 }, {  13, 375 }, {  14, 375 }, {  15, 375 }, {  16, 375 },
+ {  17, 375 }, {  18, 375 }, {  19, 375 }, {  20, 375 }, {  21, 375 },
+ {  22, 375 }, {  23, 375 }, {  24, 375 }, {  25, 375 }, {  26, 375 },
+ {  27, 375 }, {  28, 375 }, {  29, 375 }, {  30, 375 }, {  31, 375 },
+ {  32, 375 }, {  33, 375 }, {  34, 375 }, {  35, 375 }, {  36, 375 },
+ {  37, 375 }, {  38, 375 }, {  39, 375 }, {  40, 375 }, {  41, 375 },
+ {  42, 375 }, {  43, 375 }, {  44, 375 }, {  45, 375 }, {  46, 375 },
+
+ {  47, 375 }, {  48, 375 }, {  49, 375 }, {  50, 375 }, {  51, 375 },
+ {  52, 375 }, {  53, 375 }, {  54, 375 }, {  55, 375 }, {  56, 375 },
+ {  57, 375 }, {  58, 375 }, {  59, 375 }, {  60, 375 }, {  61, 375 },
+ {  62, 375 }, {  63, 375 }, {  64, 375 }, {  65, 375 }, {  66, 375 },
+ {  67, 375 }, {  68, 375 }, {  69, 375 }, {  70, 375 }, {  71, 375 },
+ {  72, 375 }, {  73, 375 }, {  74, 375 }, {  75, 375 }, {  76, 375 },
+ {  77, 375 }, {  78, 375 }, {  79, 375 }, {  80, 375 }, {  81, 375 },
+ {  82, 375 }, {  83, 375 }, {  84, 375 }, {  85, 375 }, {  86, 375 },
+ {  87, 375 }, {  88, 375 }, {  89, 375 }, {  90, 375 }, {  91, 375 },
+ {  92, 379 }, {  93, 375 }, {  94, 375 }, {  95, 375 }, {  96, 375 },
+
+ {  97, 375 }, {  98, 375 }, {  99, 375 }, { 100, 375 }, { 101, 375 },
+ { 102, 375 }, { 103, 375 }, { 104, 375 }, { 105, 375 }, { 106, 375 },
+ { 107, 375 }, { 108, 375 }, { 109, 375 }, { 110, 375 }, { 111, 375 },
+ { 112, 375 }, { 113, 375 }, { 114, 375 }, { 115, 375 }, { 116, 375 },
+ { 117, 375 }, { 118, 375 }, { 119, 375 }, { 120, 375 }, { 121, 375 },
+ { 122, 375 }, { 123, 375 }, { 124, 375 }, { 125, 375 }, { 126, 375 },
+ { 127, 375 }, { 128, 375 }, { 129, 375 }, { 130, 375 }, { 131, 375 },
+ { 132, 375 }, { 133, 375 }, { 134, 375 }, { 135, 375 }, { 136, 375 },
+ { 137, 375 }, { 138, 375 }, { 139, 375 }, { 140, 375 }, { 141, 375 },
+ { 142, 375 }, { 143, 375 }, { 144, 375 }, { 145, 375 }, { 146, 375 },
+
+ { 147, 375 }, { 148, 375 }, { 149, 375 }, { 150, 375 }, { 151, 375 },
+ { 152, 375 }, { 153, 375 }, { 154, 375 }, { 155, 375 }, { 156, 375 },
+ { 157, 375 }, { 158, 375 }, { 159, 375 }, { 160, 375 }, { 161, 375 },
+ { 162, 375 }, { 163, 375 }, { 164, 375 }, { 165, 375 }, { 166, 375 },
+ { 167, 375 }, { 168, 375 }, { 169, 375 }, { 170, 375 }, { 171, 375 },
+ { 172, 375 }, { 173, 375 }, { 174, 375 }, { 175, 375 }, { 176, 375 },
+ { 177, 375 }, { 178, 375 }, { 179, 375 }, { 180, 375 }, { 181, 375 },
+ { 182, 375 }, { 183, 375 }, { 184, 375 }, { 185, 375 }, { 186, 375 },
+ { 187, 375 }, { 188, 375 }, { 189, 375 }, { 190, 375 }, { 191, 375 },
+ { 192, 375 }, { 193, 375 }, { 194, 375 }, { 195, 375 }, { 196, 375 },
+
+ { 197, 375 }, { 198, 375 }, { 199, 375 }, { 200, 375 }, { 201, 375 },
+ { 202, 375 }, { 203, 375 }, { 204, 375 }, { 205, 375 }, { 206, 375 },
+ { 207, 375 }, { 208, 375 }, { 209, 375 }, { 210, 375 }, { 211, 375 },
+ { 212, 375 }, { 213, 375 }, { 214, 375 }, { 215, 375 }, { 216, 375 },
+ { 217, 375 }, { 218, 375 }, { 219, 375 }, { 220, 375 }, { 221, 375 },
+ { 222, 375 }, { 223, 375 }, { 224, 375 }, { 225, 375 }, { 226, 375 },
+ { 227, 375 }, { 228, 375 }, { 229, 375 }, { 230, 375 }, { 231, 375 },
+ { 232, 375 }, { 233, 375 }, { 234, 375 }, { 235, 375 }, { 236, 375 },
+ { 237, 375 }, { 238, 375 }, { 239, 375 }, { 240, 375 }, { 241, 375 },
+ { 242, 375 }, { 243, 375 }, { 244, 375 }, { 245, 375 }, { 246, 375 },
+
+ { 247, 375 }, { 248, 375 }, { 249, 375 }, { 250, 375 }, { 251, 375 },
+ { 252, 375 }, { 253, 375 }, { 254, 375 }, { 255, 375 }, { 256, 375 },
+ {   0,  79 }, {   0,30039 }, {   0,   1 }, {   0,30037 }, {   0,  49 },
+ {   0,30035 }, {   0,   0 }, {   0,   1 }, {   0,30032 }, {   0,  70 },
+ {   0,30030 }, {   0,   0 }, {   9,5515 }, {  10,5515 }, {   0,   0 },
+ {  12,5515 }, {  13,5515 }, {   9,5510 }, {  10,5510 }, {   0,   0 },
+ {  12,5510 }, {  13,5510 }, {   0,  19 }, {   0,30017 }, {   0,  69 },
+ {   0,30015 }, {   0,   0 }, {   0,  69 }, {   0,30012 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   6 }, {   0,30007 }, {   0,   0 },
+ {  32,5515 }, {   0,   6 }, {   0,30003 }, {   0,   0 }, {   0,   0 },
+
+ {  32,5510 }, {   0,  51 }, {   0,29998 }, {  33,5510 }, {   0,   0 },
+ {  35,5510 }, {   0,   0 }, {  37,5510 }, {  38,5510 }, {   0,  70 },
+ {   0,29990 }, {   0,   0 }, {  42,5510 }, {  43,5510 }, {   0,   0 },
+ {  45,5510 }, {   0,   0 }, {  47,5510 }, {   0,   0 }, {   0,  52 },
+ {   0,29980 }, {   0,  54 }, {   0,29978 }, {   0,  54 }, {   0,29976 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  60,5510 }, {  61,5550 }, {  62,5510 }, {  63,5510 }, {  64,5510 },
+ {  42, 408 }, {  34, 420 }, {   0,  54 }, {   0,29962 }, {  42,7294 },
+ {  47, 410 }, {   0,  27 }, {   0,29958 }, {  33,5470 }, {   0,   0 },
+ {  35,5470 }, {  58, 100 }, {  37,5470 }, {  38,5470 }, {  61, 102 },
+
+ {   0,   0 }, {   0,   0 }, {  42,5470 }, {  43,5470 }, {  34, 402 },
+ {  45,5470 }, {   0,   0 }, {  47,5470 }, {   0,   0 }, {   0,  27 },
+ {   0,29940 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  94,5510 },
+ {   0,   0 }, {  96,5510 }, {   0,  27 }, {   0,29932 }, {  45,9179 },
+ {  60,5470 }, {  61,5470 }, {  62,5470 }, {  63,5470 }, {  64,5470 },
+ {   0,  79 }, {   0,29924 }, {   0,  35 }, {   0,29922 }, {   0,  36 },
+ {   0,29920 }, {   0,  35 }, {   0,29918 }, {   0,  43 }, {   0,29916 },
+ {   0,  62 }, {   0,29914 }, {   0,  61 }, {   0,29912 }, {   0,  63 },
+ {   0,29910 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, { 124,5510 },
+ {   0,   0 }, { 126,5510 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  94,5470 },
+ {  45,9456 }, {  96,5470 }, {  69, 465 }, {   0,  78 }, {   0,29891 },
+ {   0,   8 }, {   0,29889 }, {  36,   8 }, {   0,  20 }, {   0,29886 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  48,5461 },
+ {  49,5461 }, {  50,5461 }, {  51,5461 }, {  52,5461 }, {  53,5461 },
+ {  54,5461 }, {  55,5461 }, {  56,5461 }, {  57,5461 }, { 124,5470 },
+ {   0,   0 }, { 126,5470 }, {  69, 447 }, {   0,   0 }, { 101, 465 },
+ {   0,   0 }, {  65,5523 }, {  66,5523 }, {  67,5523 }, {  68,5523 },
+ {  69,5523 }, {  70,5523 }, {  71,5523 }, {  72,5523 }, {  73,5523 },
+
+ {  74,5523 }, {  75,5523 }, {  76,5523 }, {  77,5523 }, {  78,5523 },
+ {  79,5523 }, {  80,5523 }, {  81,5523 }, {  82,5523 }, {  83,5523 },
+ {  84,5523 }, {  85,5523 }, {  86,5523 }, {  87,5523 }, {  88,5523 },
+ {  89,5523 }, {  90,5523 }, {  85,9692 }, {   0,   0 }, { 101, 447 },
+ {   0,   0 }, {  95,5523 }, {  63,   0 }, {  97,5523 }, {  98,5523 },
+ {  99,5523 }, { 100,5523 }, { 101,5523 }, { 102,5523 }, { 103,5523 },
+ { 104,5523 }, { 105,5523 }, { 106,5523 }, { 107,5523 }, { 108,5523 },
+ { 109,5523 }, { 110,5523 }, { 111,5523 }, { 112,5523 }, { 113,5523 },
+ { 114,5523 }, { 115,5523 }, { 116,5523 }, { 117,5523 }, { 118,5523 },
+ { 119,5523 }, { 120,5523 }, { 121,5523 }, { 122,5523 }, { 117,9715 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, { 128,5523 },
+ { 129,5523 }, { 130,5523 }, { 131,5523 }, { 132,5523 }, { 133,5523 },
+ { 134,5523 }, { 135,5523 }, { 136,5523 }, { 137,5523 }, { 138,5523 },
+ { 139,5523 }, { 140,5523 }, { 141,5523 }, { 142,5523 }, { 143,5523 },
+ { 144,5523 }, { 145,5523 }, { 146,5523 }, { 147,5523 }, { 148,5523 },
+ { 149,5523 }, { 150,5523 }, { 151,5523 }, { 152,5523 }, { 153,5523 },
+ { 154,5523 }, { 155,5523 }, { 156,5523 }, { 157,5523 }, { 158,5523 },
+ { 159,5523 }, { 160,5523 }, { 161,5523 }, { 162,5523 }, { 163,5523 },
+ { 164,5523 }, { 165,5523 }, { 166,5523 }, { 167,5523 }, { 168,5523 },
+ { 169,5523 }, { 170,5523 }, { 171,5523 }, { 172,5523 }, { 173,5523 },
+
+ { 174,5523 }, { 175,5523 }, { 176,5523 }, { 177,5523 }, { 178,5523 },
+ { 179,5523 }, { 180,5523 }, { 181,5523 }, { 182,5523 }, { 183,5523 },
+ { 184,5523 }, { 185,5523 }, { 186,5523 }, { 187,5523 }, { 188,5523 },
+ { 189,5523 }, { 190,5523 }, { 191,5523 }, { 192,5523 }, { 193,5523 },
+ { 194,5523 }, { 195,5523 }, { 196,5523 }, { 197,5523 }, { 198,5523 },
+ { 199,5523 }, { 200,5523 }, { 201,5523 }, { 202,5523 }, { 203,5523 },
+ { 204,5523 }, { 205,5523 }, { 206,5523 }, { 207,5523 }, { 208,5523 },
+ { 209,5523 }, { 210,5523 }, { 211,5523 }, { 212,5523 }, { 213,5523 },
+ { 214,5523 }, { 215,5523 }, { 216,5523 }, { 217,5523 }, { 218,5523 },
+ { 219,5523 }, { 220,5523 }, { 221,5523 }, { 222,5523 }, { 223,5523 },
+
+ { 224,5523 }, { 225,5523 }, { 226,5523 }, { 227,5523 }, { 228,5523 },
+ { 229,5523 }, { 230,5523 }, { 231,5523 }, { 232,5523 }, { 233,5523 },
+ { 234,5523 }, { 235,5523 }, { 236,5523 }, { 237,5523 }, { 238,5523 },
+ { 239,5523 }, { 240,5523 }, { 241,5523 }, { 242,5523 }, { 243,5523 },
+ { 244,5523 }, { 245,5523 }, { 246,5523 }, { 247,5523 }, { 248,5523 },
+ { 249,5523 }, { 250,5523 }, { 251,5523 }, { 252,5523 }, { 253,5523 },
+ { 254,5523 }, { 255,5523 }, {   0,  69 }, {   0,29667 }, {   0,  60 },
+ {   0,29665 }, {   0,  18 }, {   0,29663 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,  69 }, {   0,29656 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,  59 }, {   0,29651 },
+
+ {   0,  15 }, {   0,29649 }, {   0,   0 }, {   0,  10 }, {   0,29646 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,  69 }, {   0,29637 }, {   0,   0 },
+ {   0,   0 }, {  33,5147 }, {   0,   0 }, {  35,5147 }, {   0,   0 },
+ {  37,5147 }, {  38,5147 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  42,5147 }, {  43,5147 }, {  33,5136 }, {  45,5147 }, {  35,5136 },
+ {  47,5147 }, {  37,5136 }, {  38,5136 }, {  34, 170 }, {   0,   0 },
+ {   0,   0 }, {  42,5136 }, {  43,5136 }, {  39, 172 }, {  45,5512 },
+ {   0,   0 }, {  47,5136 }, {   0,   0 }, {  60,5147 }, {  61,5147 },
+ {  62,5147 }, {  63,5147 }, {  64,5147 }, {  63,-226 }, {  45,10420 },
+
+ {   0,   7 }, {   0,29599 }, {   0,   4 }, {   0,29597 }, {  60,5136 },
+ {  61,5136 }, {  62,5136 }, {  63,5136 }, {  64,5136 }, {  46,-277 },
+ {   0,   0 }, {  48,5751 }, {  49,5751 }, {  50,5751 }, {  51,5751 },
+ {  52,5751 }, {  53,5751 }, {  54,5751 }, {  55,5751 }, {  56,5751 },
+ {  57,5751 }, {   0,  57 }, {   0,29578 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  94,5147 }, {   0,   0 }, {  96,5147 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,  69 }, {   0,29566 },
+ {   0,  72 }, {   0,29564 }, {   0,   0 }, {  94,5136 }, {   0,   0 },
+ {  96,5136 }, {   0,   0 }, {   0,   0 }, {  42,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  47,   2 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,  17 }, {   0,29546 },
+ {   0,  30 }, {   0,29544 }, { 124,5147 }, {   0,   0 }, { 126,5147 },
+ {   0,  23 }, {   0,29539 }, {   0,  38 }, {   0,29537 }, {   0,  45 },
+ {   0,29535 }, {   0,   0 }, {  33,5046 }, { 124,5136 }, {  35,5046 },
+ { 126,5136 }, {  37,5046 }, {  38,5046 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  42,5705 }, {  43,5046 }, {   0,   0 }, {  45,5046 },
+ {   0,   0 }, {  47,5046 }, {  46,5705 }, {   0,   0 }, {  48,5769 },
+ {  49,5769 }, {  50,5769 }, {  51,5769 }, {  52,5769 }, {  53,5769 },
+ {  54,5769 }, {  55,5769 }, {  56,5769 }, {  57,5769 }, {  60,5046 },
+ {  61,5046 }, {  62,5046 }, {  63,5046 }, {  64,5046 }, {  45,10706 },
+
+ {   0,  69 }, {   0,29499 }, {   0,  55 }, {   0,29497 }, {   0,   0 },
+ {  69,5791 }, {  45,11004 }, {   0,  25 }, {   0,29492 }, {   0,   0 },
+ {   0,   0 }, {   0,  69 }, {   0,29488 }, {   0,   0 }, {   0,  28 },
+ {   0,29485 }, {   0,  74 }, {   0,29483 }, {   0,  50 }, {   0,29481 },
+ {   0,  21 }, {   0,29479 }, {   0,  14 }, {   0,29477 }, {   0,  10 },
+ {   0,29475 }, {   0,  13 }, {   0,29473 }, {  94,5046 }, {   0,   0 },
+ {  96,5046 }, {   0,  17 }, {   0,29468 }, {   0,   0 }, {  33,4979 },
+ {   0,   0 }, {  35,4979 }, { 101,5791 }, {  37,4979 }, {  38,4979 },
+ {   0,  41 }, {   0,29459 }, {   0,   0 }, {  42,4979 }, {  43,4979 },
+ {  33,4968 }, {  45,4979 }, {  35,4968 }, {  47,4979 }, {  37,4968 },
+
+ {  38,4968 }, {   0,   0 }, {   0,   0 }, {  45,11918 }, {  42,4968 },
+ {  43,4968 }, {   0,   0 }, {  45,4968 }, { 124,5046 }, {  47,4968 },
+ { 126,5046 }, {  60,4979 }, {  61,5766 }, {  62,5807 }, {  63,4979 },
+ {  64,4979 }, {   0,   0 }, {   0,  23 }, {   0,29432 }, {   0,   0 },
+ {  45,12544 }, {   0,   0 }, {  60,4968 }, {  61,4968 }, {  62,5863 },
+ {  63,4968 }, {  64,4968 }, {  45,13569 }, {   0,  69 }, {   0,29421 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  83, 100 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  94,4979 }, {   0,   0 }, {  96,4979 }, {  83, 377 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,  55 }, {   0,29397 }, {   0,  25 },
+ {   0,29395 }, {  94,4968 }, {   0,   0 }, {  96,4968 }, {   0,   0 },
+ {   0,  78 }, {   0,29389 }, {  33,4901 }, {  45,14565 }, {  35,4901 },
+ {   0,   0 }, {  37,4901 }, {  38,4901 }, { 115, 100 }, {   0,   0 },
+ {   0,   0 }, {  42,4901 }, {  43,4901 }, {   0,   0 }, {  45,4901 },
+ { 124,4979 }, {  47,4901 }, { 126,4979 }, {   0,   0 }, {   0,   0 },
+ { 115, 377 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, { 124,4968 }, {   0,   0 }, { 126,4968 }, {  60,4901 },
+ {  61,5807 }, {  62,4901 }, {  63,4901 }, {  64,4901 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  36,5855 }, {   0,   0 }, {   0,   0 },
+
+ {  45,15687 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  48,5855 },
+ {  49,5855 }, {  50,5855 }, {  51,5855 }, {  52,5855 }, {  53,5855 },
+ {  54,5855 }, {  55,5855 }, {  56,5855 }, {  57,5855 }, {   0,   0 },
+ {  67, 548 }, {   0,   0 }, {   0,   0 }, {  94,4901 }, {  63,-502 },
+ {  96,4901 }, {  65,5855 }, {  66,5855 }, {  67,5855 }, {  68,5855 },
+ {  69,5855 }, {  70,5855 }, {  71,5855 }, {  72,5855 }, {  73,5855 },
+ {  74,5855 }, {  75,5855 }, {  76,5855 }, {  77,5855 }, {  78,5855 },
+ {  79,5855 }, {  80,5855 }, {  81,5855 }, {  82,5855 }, {  83,5855 },
+ {  84,5855 }, {  85,5855 }, {  86,5855 }, {  87,5855 }, {  88,5855 },
+
+ {  89,5855 }, {  90,5855 }, {  99, 548 }, { 124,4901 }, {   0,   0 },
+ { 126,4901 }, {  95,5855 }, {   0,   0 }, {  97,5855 }, {  98,5855 },
+ {  99,5855 }, { 100,5855 }, { 101,5855 }, { 102,5855 }, { 103,5855 },
+ { 104,5855 }, { 105,5855 }, { 106,5855 }, { 107,5855 }, { 108,5855 },
+ { 109,5855 }, { 110,5855 }, { 111,5855 }, { 112,5855 }, { 113,5855 },
+ { 114,5855 }, { 115,5855 }, { 116,5855 }, { 117,5855 }, { 118,5855 },
+ { 119,5855 }, { 120,5855 }, { 121,5855 }, { 122,5855 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, { 128,5855 },
+ { 129,5855 }, { 130,5855 }, { 131,5855 }, { 132,5855 }, { 133,5855 },
+ { 134,5855 }, { 135,5855 }, { 136,5855 }, { 137,5855 }, { 138,5855 },
+
+ { 139,5855 }, { 140,5855 }, { 141,5855 }, { 142,5855 }, { 143,5855 },
+ { 144,5855 }, { 145,5855 }, { 146,5855 }, { 147,5855 }, { 148,5855 },
+ { 149,5855 }, { 150,5855 }, { 151,5855 }, { 152,5855 }, { 153,5855 },
+ { 154,5855 }, { 155,5855 }, { 156,5855 }, { 157,5855 }, { 158,5855 },
+ { 159,5855 }, { 160,5855 }, { 161,5855 }, { 162,5855 }, { 163,5855 },
+ { 164,5855 }, { 165,5855 }, { 166,5855 }, { 167,5855 }, { 168,5855 },
+ { 169,5855 }, { 170,5855 }, { 171,5855 }, { 172,5855 }, { 173,5855 },
+ { 174,5855 }, { 175,5855 }, { 176,5855 }, { 177,5855 }, { 178,5855 },
+ { 179,5855 }, { 180,5855 }, { 181,5855 }, { 182,5855 }, { 183,5855 },
+ { 184,5855 }, { 185,5855 }, { 186,5855 }, { 187,5855 }, { 188,5855 },
+
+ { 189,5855 }, { 190,5855 }, { 191,5855 }, { 192,5855 }, { 193,5855 },
+ { 194,5855 }, { 195,5855 }, { 196,5855 }, { 197,5855 }, { 198,5855 },
+ { 199,5855 }, { 200,5855 }, { 201,5855 }, { 202,5855 }, { 203,5855 },
+ { 204,5855 }, { 205,5855 }, { 206,5855 }, { 207,5855 }, { 208,5855 },
+ { 209,5855 }, { 210,5855 }, { 211,5855 }, { 212,5855 }, { 213,5855 },
+ { 214,5855 }, { 215,5855 }, { 216,5855 }, { 217,5855 }, { 218,5855 },
+ { 219,5855 }, { 220,5855 }, { 221,5855 }, { 222,5855 }, { 223,5855 },
+ { 224,5855 }, { 225,5855 }, { 226,5855 }, { 227,5855 }, { 228,5855 },
+ { 229,5855 }, { 230,5855 }, { 231,5855 }, { 232,5855 }, { 233,5855 },
+ { 234,5855 }, { 235,5855 }, { 236,5855 }, { 237,5855 }, { 238,5855 },
+
+ { 239,5855 }, { 240,5855 }, { 241,5855 }, { 242,5855 }, { 243,5855 },
+ { 244,5855 }, { 245,5855 }, { 246,5855 }, { 247,5855 }, { 248,5855 },
+ { 249,5855 }, { 250,5855 }, { 251,5855 }, { 252,5855 }, { 253,5855 },
+ { 254,5855 }, { 255,5855 }, {   0,  78 }, {   0,29132 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,  28 }, {   0,29108 }, {   0,  39 }, {   0,29106 },
+ {   0,  40 }, {   0,29104 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  36,5598 },
+ {   0,   0 }, {   0,   0 }, {  39,-757 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  48,5598 }, {  49,5598 }, {  50,5598 }, {  51,5598 },
+ {  52,5598 }, {  53,5598 }, {  54,5598 }, {  55,5598 }, {  56,5598 },
+ {  57,5598 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  63,-759 }, {   0,   0 }, {  65,5598 }, {  66,5598 },
+ {  67,5598 }, {  68,5598 }, {  69,5598 }, {  70,5598 }, {  71,5598 },
+ {  72,5598 }, {  73,5598 }, {  74,5598 }, {  75,5598 }, {  76,5598 },
+ {  77,5598 }, {  78,5598 }, {  79,5598 }, {  80,5598 }, {  81,5598 },
+
+ {  82,5598 }, {  83,5598 }, {  84,5598 }, {  85,5598 }, {  86,5598 },
+ {  87,5598 }, {  88,5598 }, {  89,5598 }, {  90,5598 }, {  67, 261 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  95,5598 }, {   0,   0 },
+ {  97,5598 }, {  98,5598 }, {  99,5598 }, { 100,5598 }, { 101,5598 },
+ { 102,5598 }, { 103,5598 }, { 104,5598 }, { 105,5598 }, { 106,5598 },
+ { 107,5598 }, { 108,5598 }, { 109,5598 }, { 110,5598 }, { 111,5598 },
+ { 112,5598 }, { 113,5598 }, { 114,5598 }, { 115,5598 }, { 116,5598 },
+ { 117,5598 }, { 118,5598 }, { 119,5598 }, { 120,5598 }, { 121,5598 },
+ { 122,5598 }, {  99, 261 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, { 128,5598 }, { 129,5598 }, { 130,5598 }, { 131,5598 },
+
+ { 132,5598 }, { 133,5598 }, { 134,5598 }, { 135,5598 }, { 136,5598 },
+ { 137,5598 }, { 138,5598 }, { 139,5598 }, { 140,5598 }, { 141,5598 },
+ { 142,5598 }, { 143,5598 }, { 144,5598 }, { 145,5598 }, { 146,5598 },
+ { 147,5598 }, { 148,5598 }, { 149,5598 }, { 150,5598 }, { 151,5598 },
+ { 152,5598 }, { 153,5598 }, { 154,5598 }, { 155,5598 }, { 156,5598 },
+ { 157,5598 }, { 158,5598 }, { 159,5598 }, { 160,5598 }, { 161,5598 },
+ { 162,5598 }, { 163,5598 }, { 164,5598 }, { 165,5598 }, { 166,5598 },
+ { 167,5598 }, { 168,5598 }, { 169,5598 }, { 170,5598 }, { 171,5598 },
+ { 172,5598 }, { 173,5598 }, { 174,5598 }, { 175,5598 }, { 176,5598 },
+ { 177,5598 }, { 178,5598 }, { 179,5598 }, { 180,5598 }, { 181,5598 },
+
+ { 182,5598 }, { 183,5598 }, { 184,5598 }, { 185,5598 }, { 186,5598 },
+ { 187,5598 }, { 188,5598 }, { 189,5598 }, { 190,5598 }, { 191,5598 },
+ { 192,5598 }, { 193,5598 }, { 194,5598 }, { 195,5598 }, { 196,5598 },
+ { 197,5598 }, { 198,5598 }, { 199,5598 }, { 200,5598 }, { 201,5598 },
+ { 202,5598 }, { 203,5598 }, { 204,5598 }, { 205,5598 }, { 206,5598 },
+ { 207,5598 }, { 208,5598 }, { 209,5598 }, { 210,5598 }, { 211,5598 },
+ { 212,5598 }, { 213,5598 }, { 214,5598 }, { 215,5598 }, { 216,5598 },
+ { 217,5598 }, { 218,5598 }, { 219,5598 }, { 220,5598 }, { 221,5598 },
+ { 222,5598 }, { 223,5598 }, { 224,5598 }, { 225,5598 }, { 226,5598 },
+ { 227,5598 }, { 228,5598 }, { 229,5598 }, { 230,5598 }, { 231,5598 },
+
+ { 232,5598 }, { 233,5598 }, { 234,5598 }, { 235,5598 }, { 236,5598 },
+ { 237,5598 }, { 238,5598 }, { 239,5598 }, { 240,5598 }, { 241,5598 },
+ { 242,5598 }, { 243,5598 }, { 244,5598 }, { 245,5598 }, { 246,5598 },
+ { 247,5598 }, { 248,5598 }, { 249,5598 }, { 250,5598 }, { 251,5598 },
+ { 252,5598 }, { 253,5598 }, { 254,5598 }, { 255,5598 }, {   0,  78 },
+ {   0,28875 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,  55 }, {   0,28849 }, {   0,  28 }, {   0,28847 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  36,5341 }, {   0,   0 }, {   0,   0 }, {  39,-1011 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  48,5341 }, {  49,5341 },
+ {  50,5341 }, {  51,5341 }, {  52,5341 }, {  53,5341 }, {  54,5341 },
+ {  55,5341 }, {  56,5341 }, {  57,5341 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  63,-790 }, {   0,   0 },
+ {  65,5341 }, {  66,5341 }, {  67,5341 }, {  68,5341 }, {  69,5341 },
+ {  70,5341 }, {  71,5341 }, {  72,5341 }, {  73,5341 }, {  74,5341 },
+
+ {  75,5341 }, {  76,5341 }, {  77,5341 }, {  78,5341 }, {  79,5341 },
+ {  80,5341 }, {  81,5341 }, {  82,5341 }, {  83,5341 }, {  84,5341 },
+ {  85,5341 }, {  86,5341 }, {  87,5341 }, {  88,5341 }, {  89,5341 },
+ {  90,5341 }, {  65, 242 }, {   0,   0 }, {  65, 242 }, {   0,   0 },
+ {  95,5341 }, {   0,   0 }, {  97,5341 }, {  98,5341 }, {  99,5341 },
+ { 100,5341 }, { 101,5341 }, { 102,5341 }, { 103,5341 }, { 104,5341 },
+ { 105,5341 }, { 106,5341 }, { 107,5341 }, { 108,5341 }, { 109,5341 },
+ { 110,5341 }, { 111,5341 }, { 112,5341 }, { 113,5341 }, { 114,5341 },
+ { 115,5341 }, { 116,5341 }, { 117,5341 }, { 118,5341 }, { 119,5341 },
+ { 120,5341 }, { 121,5341 }, { 122,5341 }, {  97, 242 }, {   0,   0 },
+
+ {  97, 242 }, {   0,   0 }, {   0,   0 }, { 128,5341 }, { 129,5341 },
+ { 130,5341 }, { 131,5341 }, { 132,5341 }, { 133,5341 }, { 134,5341 },
+ { 135,5341 }, { 136,5341 }, { 137,5341 }, { 138,5341 }, { 139,5341 },
+ { 140,5341 }, { 141,5341 }, { 142,5341 }, { 143,5341 }, { 144,5341 },
+ { 145,5341 }, { 146,5341 }, { 147,5341 }, { 148,5341 }, { 149,5341 },
+ { 150,5341 }, { 151,5341 }, { 152,5341 }, { 153,5341 }, { 154,5341 },
+ { 155,5341 }, { 156,5341 }, { 157,5341 }, { 158,5341 }, { 159,5341 },
+ { 160,5341 }, { 161,5341 }, { 162,5341 }, { 163,5341 }, { 164,5341 },
+ { 165,5341 }, { 166,5341 }, { 167,5341 }, { 168,5341 }, { 169,5341 },
+ { 170,5341 }, { 171,5341 }, { 172,5341 }, { 173,5341 }, { 174,5341 },
+
+ { 175,5341 }, { 176,5341 }, { 177,5341 }, { 178,5341 }, { 179,5341 },
+ { 180,5341 }, { 181,5341 }, { 182,5341 }, { 183,5341 }, { 184,5341 },
+ { 185,5341 }, { 186,5341 }, { 187,5341 }, { 188,5341 }, { 189,5341 },
+ { 190,5341 }, { 191,5341 }, { 192,5341 }, { 193,5341 }, { 194,5341 },
+ { 195,5341 }, { 196,5341 }, { 197,5341 }, { 198,5341 }, { 199,5341 },
+ { 200,5341 }, { 201,5341 }, { 202,5341 }, { 203,5341 }, { 204,5341 },
+ { 205,5341 }, { 206,5341 }, { 207,5341 }, { 208,5341 }, { 209,5341 },
+ { 210,5341 }, { 211,5341 }, { 212,5341 }, { 213,5341 }, { 214,5341 },
+ { 215,5341 }, { 216,5341 }, { 217,5341 }, { 218,5341 }, { 219,5341 },
+ { 220,5341 }, { 221,5341 }, { 222,5341 }, { 223,5341 }, { 224,5341 },
+
+ { 225,5341 }, { 226,5341 }, { 227,5341 }, { 228,5341 }, { 229,5341 },
+ { 230,5341 }, { 231,5341 }, { 232,5341 }, { 233,5341 }, { 234,5341 },
+ { 235,5341 }, { 236,5341 }, { 237,5341 }, { 238,5341 }, { 239,5341 },
+ { 240,5341 }, { 241,5341 }, { 242,5341 }, { 243,5341 }, { 244,5341 },
+ { 245,5341 }, { 246,5341 }, { 247,5341 }, { 248,5341 }, { 249,5341 },
+ { 250,5341 }, { 251,5341 }, { 252,5341 }, { 253,5341 }, { 254,5341 },
+ { 255,5341 }, {   0,  78 }, {   0,28618 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,  55 }, {   0,28607 }, {   0,  28 },
+ {   0,28605 }, {   0,  33 }, {   0,28603 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,  55 },
+ {   0,28595 }, {   0,  28 }, {   0,28593 }, {   0,  34 }, {   0,28591 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  36,5084 }, {   0,   0 },
+ {   0,   0 }, {  39,-1045 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  48,5084 }, {  49,5084 }, {  50,5084 }, {  51,5084 }, {  52,5084 },
+ {  53,5084 }, {  54,5084 }, {  55,5084 }, {  56,5084 }, {  57,5084 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  63,-1273 }, {   0,   0 }, {  65,5084 }, {  66,5084 }, {  67,5084 },
+
+ {  68,5084 }, {  69,5084 }, {  70,5084 }, {  71,5084 }, {  72,5084 },
+ {  73,5084 }, {  74,5084 }, {  75,5084 }, {  76,5084 }, {  77,5084 },
+ {  78,5084 }, {  79,5084 }, {  80,5084 }, {  81,5084 }, {  82,5084 },
+ {  83,5084 }, {  84,5084 }, {  85,5084 }, {  86,5084 }, {  87,5084 },
+ {  88,5084 }, {  89,5084 }, {  90,5084 }, {  80,  12 }, {  69,21847 },
+ {  80,  12 }, {  69,21869 }, {  95,5084 }, {   0,   0 }, {  97,5084 },
+ {  98,5084 }, {  99,5084 }, { 100,5084 }, { 101,5084 }, { 102,5084 },
+ { 103,5084 }, { 104,5084 }, { 105,5084 }, { 106,5084 }, { 107,5084 },
+ { 108,5084 }, { 109,5084 }, { 110,5084 }, { 111,5084 }, { 112,5084 },
+ { 113,5084 }, { 114,5084 }, { 115,5084 }, { 116,5084 }, { 117,5084 },
+
+ { 118,5084 }, { 119,5084 }, { 120,5084 }, { 121,5084 }, { 122,5084 },
+ { 112,  12 }, { 101,21847 }, { 112,  12 }, { 101,21869 }, {   0,   0 },
+ { 128,5084 }, { 129,5084 }, { 130,5084 }, { 131,5084 }, { 132,5084 },
+ { 133,5084 }, { 134,5084 }, { 135,5084 }, { 136,5084 }, { 137,5084 },
+ { 138,5084 }, { 139,5084 }, { 140,5084 }, { 141,5084 }, { 142,5084 },
+ { 143,5084 }, { 144,5084 }, { 145,5084 }, { 146,5084 }, { 147,5084 },
+ { 148,5084 }, { 149,5084 }, { 150,5084 }, { 151,5084 }, { 152,5084 },
+ { 153,5084 }, { 154,5084 }, { 155,5084 }, { 156,5084 }, { 157,5084 },
+ { 158,5084 }, { 159,5084 }, { 160,5084 }, { 161,5084 }, { 162,5084 },
+ { 163,5084 }, { 164,5084 }, { 165,5084 }, { 166,5084 }, { 167,5084 },
+
+ { 168,5084 }, { 169,5084 }, { 170,5084 }, { 171,5084 }, { 172,5084 },
+ { 173,5084 }, { 174,5084 }, { 175,5084 }, { 176,5084 }, { 177,5084 },
+ { 178,5084 }, { 179,5084 }, { 180,5084 }, { 181,5084 }, { 182,5084 },
+ { 183,5084 }, { 184,5084 }, { 185,5084 }, { 186,5084 }, { 187,5084 },
+ { 188,5084 }, { 189,5084 }, { 190,5084 }, { 191,5084 }, { 192,5084 },
+ { 193,5084 }, { 194,5084 }, { 195,5084 }, { 196,5084 }, { 197,5084 },
+ { 198,5084 }, { 199,5084 }, { 200,5084 }, { 201,5084 }, { 202,5084 },
+ { 203,5084 }, { 204,5084 }, { 205,5084 }, { 206,5084 }, { 207,5084 },
+ { 208,5084 }, { 209,5084 }, { 210,5084 }, { 211,5084 }, { 212,5084 },
+ { 213,5084 }, { 214,5084 }, { 215,5084 }, { 216,5084 }, { 217,5084 },
+
+ { 218,5084 }, { 219,5084 }, { 220,5084 }, { 221,5084 }, { 222,5084 },
+ { 223,5084 }, { 224,5084 }, { 225,5084 }, { 226,5084 }, { 227,5084 },
+ { 228,5084 }, { 229,5084 }, { 230,5084 }, { 231,5084 }, { 232,5084 },
+ { 233,5084 }, { 234,5084 }, { 235,5084 }, { 236,5084 }, { 237,5084 },
+ { 238,5084 }, { 239,5084 }, { 240,5084 }, { 241,5084 }, { 242,5084 },
+ { 243,5084 }, { 244,5084 }, { 245,5084 }, { 246,5084 }, { 247,5084 },
+ { 248,5084 }, { 249,5084 }, { 250,5084 }, { 251,5084 }, { 252,5084 },
+ { 253,5084 }, { 254,5084 }, { 255,5084 }, {   0,  78 }, {   0,28361 },
+ {   0,  55 }, {   0,28359 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,  28 }, {   0,28348 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,  55 }, {   0,28341 },
+ {   0,  28 }, {   0,28339 }, {   0,  56 }, {   0,28337 }, {   0,  29 },
+ {   0,28335 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  36,4827 }, {   0,   0 }, {  38,-1290 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  45,22485 }, {  48,4827 }, {  49,4827 }, {  50,4827 },
+ {  51,4827 }, {  52,4827 }, {  53,4827 }, {  54,4827 }, {  55,4827 },
+ {  56,4827 }, {  57,4827 }, {  45,22732 }, {  39,   4 }, {   0,   0 },
+
+ {  39,   4 }, {   0,   0 }, {  63,-1530 }, {   0,   0 }, {  65,4827 },
+ {  66,4827 }, {  67,4827 }, {  68,4827 }, {  69,4827 }, {  70,4827 },
+ {  71,4827 }, {  72,4827 }, {  73,4827 }, {  74,4827 }, {  75,4827 },
+ {  76,4827 }, {  77,4827 }, {  78,4827 }, {  79,4827 }, {  80,4827 },
+ {  81,4827 }, {  82,4827 }, {  83,4827 }, {  84,4827 }, {  85,4827 },
+ {  86,4827 }, {  87,4827 }, {  88,4827 }, {  89,4827 }, {  90,4827 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  95,4827 },
+ {   0,   0 }, {  97,4827 }, {  98,4827 }, {  99,4827 }, { 100,4827 },
+ { 101,4827 }, { 102,4827 }, { 103,4827 }, { 104,4827 }, { 105,4827 },
+ { 106,4827 }, { 107,4827 }, { 108,4827 }, { 109,4827 }, { 110,4827 },
+
+ { 111,4827 }, { 112,4827 }, { 113,4827 }, { 114,4827 }, { 115,4827 },
+ { 116,4827 }, { 117,4827 }, { 118,4827 }, { 119,4827 }, { 120,4827 },
+ { 121,4827 }, { 122,4827 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, { 128,4827 }, { 129,4827 }, { 130,4827 },
+ { 131,4827 }, { 132,4827 }, { 133,4827 }, { 134,4827 }, { 135,4827 },
+ { 136,4827 }, { 137,4827 }, { 138,4827 }, { 139,4827 }, { 140,4827 },
+ { 141,4827 }, { 142,4827 }, { 143,4827 }, { 144,4827 }, { 145,4827 },
+ { 146,4827 }, { 147,4827 }, { 148,4827 }, { 149,4827 }, { 150,4827 },
+ { 151,4827 }, { 152,4827 }, { 153,4827 }, { 154,4827 }, { 155,4827 },
+ { 156,4827 }, { 157,4827 }, { 158,4827 }, { 159,4827 }, { 160,4827 },
+
+ { 161,4827 }, { 162,4827 }, { 163,4827 }, { 164,4827 }, { 165,4827 },
+ { 166,4827 }, { 167,4827 }, { 168,4827 }, { 169,4827 }, { 170,4827 },
+ { 171,4827 }, { 172,4827 }, { 173,4827 }, { 174,4827 }, { 175,4827 },
+ { 176,4827 }, { 177,4827 }, { 178,4827 }, { 179,4827 }, { 180,4827 },
+ { 181,4827 }, { 182,4827 }, { 183,4827 }, { 184,4827 }, { 185,4827 },
+ { 186,4827 }, { 187,4827 }, { 188,4827 }, { 189,4827 }, { 190,4827 },
+ { 191,4827 }, { 192,4827 }, { 193,4827 }, { 194,4827 }, { 195,4827 },
+ { 196,4827 }, { 197,4827 }, { 198,4827 }, { 199,4827 }, { 200,4827 },
+ { 201,4827 }, { 202,4827 }, { 203,4827 }, { 204,4827 }, { 205,4827 },
+ { 206,4827 }, { 207,4827 }, { 208,4827 }, { 209,4827 }, { 210,4827 },
+
+ { 211,4827 }, { 212,4827 }, { 213,4827 }, { 214,4827 }, { 215,4827 },
+ { 216,4827 }, { 217,4827 }, { 218,4827 }, { 219,4827 }, { 220,4827 },
+ { 221,4827 }, { 222,4827 }, { 223,4827 }, { 224,4827 }, { 225,4827 },
+ { 226,4827 }, { 227,4827 }, { 228,4827 }, { 229,4827 }, { 230,4827 },
+ { 231,4827 }, { 232,4827 }, { 233,4827 }, { 234,4827 }, { 235,4827 },
+ { 236,4827 }, { 237,4827 }, { 238,4827 }, { 239,4827 }, { 240,4827 },
+ { 241,4827 }, { 242,4827 }, { 243,4827 }, { 244,4827 }, { 245,4827 },
+ { 246,4827 }, { 247,4827 }, { 248,4827 }, { 249,4827 }, { 250,4827 },
+ { 251,4827 }, { 252,4827 }, { 253,4827 }, { 254,4827 }, { 255,4827 },
+ {   0,  78 }, {   0,28104 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  36,4570 }, {   0,   0 }, {   0,   0 },
+ {  39,-1545 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  48,4570 },
+ {  49,4570 }, {  50,4570 }, {  51,4570 }, {  52,4570 }, {  53,4570 },
+
+ {  54,4570 }, {  55,4570 }, {  56,4570 }, {  57,4570 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  63,-1787 },
+ {   0,   0 }, {  65,4570 }, {  66,4570 }, {  67,4570 }, {  68,4570 },
+ {  69,4570 }, {  70,4570 }, {  71,4570 }, {  72,4570 }, {  73,4570 },
+ {  74,4570 }, {  75,4570 }, {  76,4570 }, {  77,4570 }, {  78,4570 },
+ {  79,4570 }, {  80,4570 }, {  81,4570 }, {  82,4570 }, {  83,4570 },
+ {  84,4570 }, {  85,4570 }, {  86,4570 }, {  87,4570 }, {  88,4570 },
+ {  89,4570 }, {  90,4570 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  95,4570 }, {   0,   0 }, {  97,4570 }, {  98,4570 },
+ {  99,4570 }, { 100,4570 }, { 101,4570 }, { 102,4570 }, { 103,4570 },
+
+ { 104,4570 }, { 105,4570 }, { 106,4570 }, { 107,4570 }, { 108,4570 },
+ { 109,4570 }, { 110,4570 }, { 111,4570 }, { 112,4570 }, { 113,4570 },
+ { 114,4570 }, { 115,4570 }, { 116,4570 }, { 117,4570 }, { 118,4570 },
+ { 119,4570 }, { 120,4570 }, { 121,4570 }, { 122,4570 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, { 128,4570 },
+ { 129,4570 }, { 130,4570 }, { 131,4570 }, { 132,4570 }, { 133,4570 },
+ { 134,4570 }, { 135,4570 }, { 136,4570 }, { 137,4570 }, { 138,4570 },
+ { 139,4570 }, { 140,4570 }, { 141,4570 }, { 142,4570 }, { 143,4570 },
+ { 144,4570 }, { 145,4570 }, { 146,4570 }, { 147,4570 }, { 148,4570 },
+ { 149,4570 }, { 150,4570 }, { 151,4570 }, { 152,4570 }, { 153,4570 },
+
+ { 154,4570 }, { 155,4570 }, { 156,4570 }, { 157,4570 }, { 158,4570 },
+ { 159,4570 }, { 160,4570 }, { 161,4570 }, { 162,4570 }, { 163,4570 },
+ { 164,4570 }, { 165,4570 }, { 166,4570 }, { 167,4570 }, { 168,4570 },
+ { 169,4570 }, { 170,4570 }, { 171,4570 }, { 172,4570 }, { 173,4570 },
+ { 174,4570 }, { 175,4570 }, { 176,4570 }, { 177,4570 }, { 178,4570 },
+ { 179,4570 }, { 180,4570 }, { 181,4570 }, { 182,4570 }, { 183,4570 },
+ { 184,4570 }, { 185,4570 }, { 186,4570 }, { 187,4570 }, { 188,4570 },
+ { 189,4570 }, { 190,4570 }, { 191,4570 }, { 192,4570 }, { 193,4570 },
+ { 194,4570 }, { 195,4570 }, { 196,4570 }, { 197,4570 }, { 198,4570 },
+ { 199,4570 }, { 200,4570 }, { 201,4570 }, { 202,4570 }, { 203,4570 },
+
+ { 204,4570 }, { 205,4570 }, { 206,4570 }, { 207,4570 }, { 208,4570 },
+ { 209,4570 }, { 210,4570 }, { 211,4570 }, { 212,4570 }, { 213,4570 },
+ { 214,4570 }, { 215,4570 }, { 216,4570 }, { 217,4570 }, { 218,4570 },
+ { 219,4570 }, { 220,4570 }, { 221,4570 }, { 222,4570 }, { 223,4570 },
+ { 224,4570 }, { 225,4570 }, { 226,4570 }, { 227,4570 }, { 228,4570 },
+ { 229,4570 }, { 230,4570 }, { 231,4570 }, { 232,4570 }, { 233,4570 },
+ { 234,4570 }, { 235,4570 }, { 236,4570 }, { 237,4570 }, { 238,4570 },
+ { 239,4570 }, { 240,4570 }, { 241,4570 }, { 242,4570 }, { 243,4570 },
+ { 244,4570 }, { 245,4570 }, { 246,4570 }, { 247,4570 }, { 248,4570 },
+ { 249,4570 }, { 250,4570 }, { 251,4570 }, { 252,4570 }, { 253,4570 },
+
+ { 254,4570 }, { 255,4570 }, {   0,  12 }, {   0,27847 }, {   1,4570 },
+ {   2,4570 }, {   3,4570 }, {   4,4570 }, {   5,4570 }, {   6,4570 },
+ {   7,4570 }, {   8,4570 }, {   9,4570 }, {  10,4570 }, {  11,4570 },
+ {  12,4570 }, {  13,4570 }, {  14,4570 }, {  15,4570 }, {  16,4570 },
+ {  17,4570 }, {  18,4570 }, {  19,4570 }, {  20,4570 }, {  21,4570 },
+ {  22,4570 }, {  23,4570 }, {  24,4570 }, {  25,4570 }, {  26,4570 },
+ {  27,4570 }, {  28,4570 }, {  29,4570 }, {  30,4570 }, {  31,4570 },
+ {  32,4570 }, {  33,4570 }, {  34,4570 }, {  35,4570 }, {  36,4570 },
+ {  37,4570 }, {  38,4570 }, {   0,   0 }, {  40,4570 }, {  41,4570 },
+ {  42,4570 }, {  43,4570 }, {  44,4570 }, {  45,4570 }, {  46,4570 },
+
+ {  47,4570 }, {  48,4570 }, {  49,4570 }, {  50,4570 }, {  51,4570 },
+ {  52,4570 }, {  53,4570 }, {  54,4570 }, {  55,4570 }, {  56,4570 },
+ {  57,4570 }, {  58,4570 }, {  59,4570 }, {  60,4570 }, {  61,4570 },
+ {  62,4570 }, {  63,4570 }, {  64,4570 }, {  65,4570 }, {  66,4570 },
+ {  67,4570 }, {  68,4570 }, {  69,4570 }, {  70,4570 }, {  71,4570 },
+ {  72,4570 }, {  73,4570 }, {  74,4570 }, {  75,4570 }, {  76,4570 },
+ {  77,4570 }, {  78,4570 }, {  79,4570 }, {  80,4570 }, {  81,4570 },
+ {  82,4570 }, {  83,4570 }, {  84,4570 }, {  85,4570 }, {  86,4570 },
+ {  87,4570 }, {  88,4570 }, {  89,4570 }, {  90,4570 }, {  91,4570 },
+ {  92,4570 }, {  93,4570 }, {  94,4570 }, {  95,4570 }, {  96,4570 },
+
+ {  97,4570 }, {  98,4570 }, {  99,4570 }, { 100,4570 }, { 101,4570 },
+ { 102,4570 }, { 103,4570 }, { 104,4570 }, { 105,4570 }, { 106,4570 },
+ { 107,4570 }, { 108,4570 }, { 109,4570 }, { 110,4570 }, { 111,4570 },
+ { 112,4570 }, { 113,4570 }, { 114,4570 }, { 115,4570 }, { 116,4570 },
+ { 117,4570 }, { 118,4570 }, { 119,4570 }, { 120,4570 }, { 121,4570 },
+ { 122,4570 }, { 123,4570 }, { 124,4570 }, { 125,4570 }, { 126,4570 },
+ { 127,4570 }, { 128,4570 }, { 129,4570 }, { 130,4570 }, { 131,4570 },
+ { 132,4570 }, { 133,4570 }, { 134,4570 }, { 135,4570 }, { 136,4570 },
+ { 137,4570 }, { 138,4570 }, { 139,4570 }, { 140,4570 }, { 141,4570 },
+ { 142,4570 }, { 143,4570 }, { 144,4570 }, { 145,4570 }, { 146,4570 },
+
+ { 147,4570 }, { 148,4570 }, { 149,4570 }, { 150,4570 }, { 151,4570 },
+ { 152,4570 }, { 153,4570 }, { 154,4570 }, { 155,4570 }, { 156,4570 },
+ { 157,4570 }, { 158,4570 }, { 159,4570 }, { 160,4570 }, { 161,4570 },
+ { 162,4570 }, { 163,4570 }, { 164,4570 }, { 165,4570 }, { 166,4570 },
+ { 167,4570 }, { 168,4570 }, { 169,4570 }, { 170,4570 }, { 171,4570 },
+ { 172,4570 }, { 173,4570 }, { 174,4570 }, { 175,4570 }, { 176,4570 },
+ { 177,4570 }, { 178,4570 }, { 179,4570 }, { 180,4570 }, { 181,4570 },
+ { 182,4570 }, { 183,4570 }, { 184,4570 }, { 185,4570 }, { 186,4570 },
+ { 187,4570 }, { 188,4570 }, { 189,4570 }, { 190,4570 }, { 191,4570 },
+ { 192,4570 }, { 193,4570 }, { 194,4570 }, { 195,4570 }, { 196,4570 },
+
+ { 197,4570 }, { 198,4570 }, { 199,4570 }, { 200,4570 }, { 201,4570 },
+ { 202,4570 }, { 203,4570 }, { 204,4570 }, { 205,4570 }, { 206,4570 },
+ { 207,4570 }, { 208,4570 }, { 209,4570 }, { 210,4570 }, { 211,4570 },
+ { 212,4570 }, { 213,4570 }, { 214,4570 }, { 215,4570 }, { 216,4570 },
+ { 217,4570 }, { 218,4570 }, { 219,4570 }, { 220,4570 }, { 221,4570 },
+ { 222,4570 }, { 223,4570 }, { 224,4570 }, { 225,4570 }, { 226,4570 },
+ { 227,4570 }, { 228,4570 }, { 229,4570 }, { 230,4570 }, { 231,4570 },
+ { 232,4570 }, { 233,4570 }, { 234,4570 }, { 235,4570 }, { 236,4570 },
+ { 237,4570 }, { 238,4570 }, { 239,4570 }, { 240,4570 }, { 241,4570 },
+ { 242,4570 }, { 243,4570 }, { 244,4570 }, { 245,4570 }, { 246,4570 },
+
+ { 247,4570 }, { 248,4570 }, { 249,4570 }, { 250,4570 }, { 251,4570 },
+ { 252,4570 }, { 253,4570 }, { 254,4570 }, { 255,4570 }, { 256,4570 },
+ {   0,   9 }, {   0,27589 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   9,4570 }, {  10,4575 }, {   0,   0 }, {  12,4570 }, {  13,4575 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  32,4570 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  45,-2057 }, {   0,   5 }, {   0,27542 }, {   1,4575 },
+ {   2,4575 }, {   3,4575 }, {   4,4575 }, {   5,4575 }, {   6,4575 },
+ {   7,4575 }, {   8,4575 }, {   9,4575 }, {  10,4575 }, {  11,4575 },
+ {  12,4575 }, {  13,4575 }, {  14,4575 }, {  15,4575 }, {  16,4575 },
+ {  17,4575 }, {  18,4575 }, {  19,4575 }, {  20,4575 }, {  21,4575 },
+ {  22,4575 }, {  23,4575 }, {  24,4575 }, {  25,4575 }, {  26,4575 },
+ {  27,4575 }, {  28,4575 }, {  29,4575 }, {  30,4575 }, {  31,4575 },
+ {  32,4575 }, {  33,4575 }, {  34,4575 }, {  35,4575 }, {  36,4575 },
+ {  37,4575 }, {  38,4575 }, {  39,4575 }, {  40,4575 }, {  41,4575 },
+
+ {   0,   0 }, {  43,4575 }, {  44,4575 }, {  45,4575 }, {  46,4575 },
+ {   0,   0 }, {  48,4575 }, {  49,4575 }, {  50,4575 }, {  51,4575 },
+ {  52,4575 }, {  53,4575 }, {  54,4575 }, {  55,4575 }, {  56,4575 },
+ {  57,4575 }, {  58,4575 }, {  59,4575 }, {  60,4575 }, {  61,4575 },
+ {  62,4575 }, {  63,4575 }, {  64,4575 }, {  65,4575 }, {  66,4575 },
+ {  67,4575 }, {  68,4575 }, {  69,4575 }, {  70,4575 }, {  71,4575 },
+ {  72,4575 }, {  73,4575 }, {  74,4575 }, {  75,4575 }, {  76,4575 },
+ {  77,4575 }, {  78,4575 }, {  79,4575 }, {  80,4575 }, {  81,4575 },
+ {  82,4575 }, {  83,4575 }, {  84,4575 }, {  85,4575 }, {  86,4575 },
+ {  87,4575 }, {  88,4575 }, {  89,4575 }, {  90,4575 }, {  91,4575 },
+
+ {  92,4575 }, {  93,4575 }, {  94,4575 }, {  95,4575 }, {  96,4575 },
+ {  97,4575 }, {  98,4575 }, {  99,4575 }, { 100,4575 }, { 101,4575 },
+ { 102,4575 }, { 103,4575 }, { 104,4575 }, { 105,4575 }, { 106,4575 },
+ { 107,4575 }, { 108,4575 }, { 109,4575 }, { 110,4575 }, { 111,4575 },
+ { 112,4575 }, { 113,4575 }, { 114,4575 }, { 115,4575 }, { 116,4575 },
+ { 117,4575 }, { 118,4575 }, { 119,4575 }, { 120,4575 }, { 121,4575 },
+ { 122,4575 }, { 123,4575 }, { 124,4575 }, { 125,4575 }, { 126,4575 },
+ { 127,4575 }, { 128,4575 }, { 129,4575 }, { 130,4575 }, { 131,4575 },
+ { 132,4575 }, { 133,4575 }, { 134,4575 }, { 135,4575 }, { 136,4575 },
+ { 137,4575 }, { 138,4575 }, { 139,4575 }, { 140,4575 }, { 141,4575 },
+
+ { 142,4575 }, { 143,4575 }, { 144,4575 }, { 145,4575 }, { 146,4575 },
+ { 147,4575 }, { 148,4575 }, { 149,4575 }, { 150,4575 }, { 151,4575 },
+ { 152,4575 }, { 153,4575 }, { 154,4575 }, { 155,4575 }, { 156,4575 },
+ { 157,4575 }, { 158,4575 }, { 159,4575 }, { 160,4575 }, { 161,4575 },
+ { 162,4575 }, { 163,4575 }, { 164,4575 }, { 165,4575 }, { 166,4575 },
+ { 167,4575 }, { 168,4575 }, { 169,4575 }, { 170,4575 }, { 171,4575 },
+ { 172,4575 }, { 173,4575 }, { 174,4575 }, { 175,4575 }, { 176,4575 },
+ { 177,4575 }, { 178,4575 }, { 179,4575 }, { 180,4575 }, { 181,4575 },
+ { 182,4575 }, { 183,4575 }, { 184,4575 }, { 185,4575 }, { 186,4575 },
+ { 187,4575 }, { 188,4575 }, { 189,4575 }, { 190,4575 }, { 191,4575 },
+
+ { 192,4575 }, { 193,4575 }, { 194,4575 }, { 195,4575 }, { 196,4575 },
+ { 197,4575 }, { 198,4575 }, { 199,4575 }, { 200,4575 }, { 201,4575 },
+ { 202,4575 }, { 203,4575 }, { 204,4575 }, { 205,4575 }, { 206,4575 },
+ { 207,4575 }, { 208,4575 }, { 209,4575 }, { 210,4575 }, { 211,4575 },
+ { 212,4575 }, { 213,4575 }, { 214,4575 }, { 215,4575 }, { 216,4575 },
+ { 217,4575 }, { 218,4575 }, { 219,4575 }, { 220,4575 }, { 221,4575 },
+ { 222,4575 }, { 223,4575 }, { 224,4575 }, { 225,4575 }, { 226,4575 },
+ { 227,4575 }, { 228,4575 }, { 229,4575 }, { 230,4575 }, { 231,4575 },
+ { 232,4575 }, { 233,4575 }, { 234,4575 }, { 235,4575 }, { 236,4575 },
+ { 237,4575 }, { 238,4575 }, { 239,4575 }, { 240,4575 }, { 241,4575 },
+
+ { 242,4575 }, { 243,4575 }, { 244,4575 }, { 245,4575 }, { 246,4575 },
+ { 247,4575 }, { 248,4575 }, { 249,4575 }, { 250,4575 }, { 251,4575 },
+ { 252,4575 }, { 253,4575 }, { 254,4575 }, { 255,4575 }, { 256,4575 },
+ {   0,   5 }, {   0,27284 }, {   1,4317 }, {   2,4317 }, {   3,4317 },
+ {   4,4317 }, {   5,4317 }, {   6,4317 }, {   7,4317 }, {   8,4317 },
+ {   9,4317 }, {  10,4317 }, {  11,4317 }, {  12,4317 }, {  13,4317 },
+ {  14,4317 }, {  15,4317 }, {  16,4317 }, {  17,4317 }, {  18,4317 },
+ {  19,4317 }, {  20,4317 }, {  21,4317 }, {  22,4317 }, {  23,4317 },
+ {  24,4317 }, {  25,4317 }, {  26,4317 }, {  27,4317 }, {  28,4317 },
+ {  29,4317 }, {  30,4317 }, {  31,4317 }, {  32,4317 }, {  33,4317 },
+
+ {  34,4317 }, {  35,4317 }, {  36,4317 }, {  37,4317 }, {  38,4317 },
+ {  39,4317 }, {  40,4317 }, {  41,4317 }, {   0,   0 }, {  43,4317 },
+ {  44,4317 }, {  45,4317 }, {  46,4317 }, {   0,   0 }, {  48,4317 },
+ {  49,4317 }, {  50,4317 }, {  51,4317 }, {  52,4317 }, {  53,4317 },
+ {  54,4317 }, {  55,4317 }, {  56,4317 }, {  57,4317 }, {  58,4317 },
+ {  59,4317 }, {  60,4317 }, {  61,4317 }, {  62,4317 }, {  63,4317 },
+ {  64,4317 }, {  65,4317 }, {  66,4317 }, {  67,4317 }, {  68,4317 },
+ {  69,4317 }, {  70,4317 }, {  71,4317 }, {  72,4317 }, {  73,4317 },
+ {  74,4317 }, {  75,4317 }, {  76,4317 }, {  77,4317 }, {  78,4317 },
+ {  79,4317 }, {  80,4317 }, {  81,4317 }, {  82,4317 }, {  83,4317 },
+
+ {  84,4317 }, {  85,4317 }, {  86,4317 }, {  87,4317 }, {  88,4317 },
+ {  89,4317 }, {  90,4317 }, {  91,4317 }, {  92,4317 }, {  93,4317 },
+ {  94,4317 }, {  95,4317 }, {  96,4317 }, {  97,4317 }, {  98,4317 },
+ {  99,4317 }, { 100,4317 }, { 101,4317 }, { 102,4317 }, { 103,4317 },
+ { 104,4317 }, { 105,4317 }, { 106,4317 }, { 107,4317 }, { 108,4317 },
+ { 109,4317 }, { 110,4317 }, { 111,4317 }, { 112,4317 }, { 113,4317 },
+ { 114,4317 }, { 115,4317 }, { 116,4317 }, { 117,4317 }, { 118,4317 },
+ { 119,4317 }, { 120,4317 }, { 121,4317 }, { 122,4317 }, { 123,4317 },
+ { 124,4317 }, { 125,4317 }, { 126,4317 }, { 127,4317 }, { 128,4317 },
+ { 129,4317 }, { 130,4317 }, { 131,4317 }, { 132,4317 }, { 133,4317 },
+
+ { 134,4317 }, { 135,4317 }, { 136,4317 }, { 137,4317 }, { 138,4317 },
+ { 139,4317 }, { 140,4317 }, { 141,4317 }, { 142,4317 }, { 143,4317 },
+ { 144,4317 }, { 145,4317 }, { 146,4317 }, { 147,4317 }, { 148,4317 },
+ { 149,4317 }, { 150,4317 }, { 151,4317 }, { 152,4317 }, { 153,4317 },
+ { 154,4317 }, { 155,4317 }, { 156,4317 }, { 157,4317 }, { 158,4317 },
+ { 159,4317 }, { 160,4317 }, { 161,4317 }, { 162,4317 }, { 163,4317 },
+ { 164,4317 }, { 165,4317 }, { 166,4317 }, { 167,4317 }, { 168,4317 },
+ { 169,4317 }, { 170,4317 }, { 171,4317 }, { 172,4317 }, { 173,4317 },
+ { 174,4317 }, { 175,4317 }, { 176,4317 }, { 177,4317 }, { 178,4317 },
+ { 179,4317 }, { 180,4317 }, { 181,4317 }, { 182,4317 }, { 183,4317 },
+
+ { 184,4317 }, { 185,4317 }, { 186,4317 }, { 187,4317 }, { 188,4317 },
+ { 189,4317 }, { 190,4317 }, { 191,4317 }, { 192,4317 }, { 193,4317 },
+ { 194,4317 }, { 195,4317 }, { 196,4317 }, { 197,4317 }, { 198,4317 },
+ { 199,4317 }, { 200,4317 }, { 201,4317 }, { 202,4317 }, { 203,4317 },
+ { 204,4317 }, { 205,4317 }, { 206,4317 }, { 207,4317 }, { 208,4317 },
+ { 209,4317 }, { 210,4317 }, { 211,4317 }, { 212,4317 }, { 213,4317 },
+ { 214,4317 }, { 215,4317 }, { 216,4317 }, { 217,4317 }, { 218,4317 },
+ { 219,4317 }, { 220,4317 }, { 221,4317 }, { 222,4317 }, { 223,4317 },
+ { 224,4317 }, { 225,4317 }, { 226,4317 }, { 227,4317 }, { 228,4317 },
+ { 229,4317 }, { 230,4317 }, { 231,4317 }, { 232,4317 }, { 233,4317 },
+
+ { 234,4317 }, { 235,4317 }, { 236,4317 }, { 237,4317 }, { 238,4317 },
+ { 239,4317 }, { 240,4317 }, { 241,4317 }, { 242,4317 }, { 243,4317 },
+ { 244,4317 }, { 245,4317 }, { 246,4317 }, { 247,4317 }, { 248,4317 },
+ { 249,4317 }, { 250,4317 }, { 251,4317 }, { 252,4317 }, { 253,4317 },
+ { 254,4317 }, { 255,4317 }, { 256,4317 }, {   0,  58 }, {   0,27026 },
+ {   1,4445 }, {   2,4445 }, {   3,4445 }, {   4,4445 }, {   5,4445 },
+ {   6,4445 }, {   7,4445 }, {   8,4445 }, {   9,4445 }, {  10,4445 },
+ {  11,4445 }, {  12,4445 }, {  13,4445 }, {  14,4445 }, {  15,4445 },
+ {  16,4445 }, {  17,4445 }, {  18,4445 }, {  19,4445 }, {  20,4445 },
+ {  21,4445 }, {  22,4445 }, {  23,4445 }, {  24,4445 }, {  25,4445 },
+
+ {  26,4445 }, {  27,4445 }, {  28,4445 }, {  29,4445 }, {  30,4445 },
+ {  31,4445 }, {  32,4445 }, {  33,4445 }, {   0,   0 }, {  35,4445 },
+ {  36,4445 }, {  37,4445 }, {  38,4445 }, {  39,4445 }, {  40,4445 },
+ {  41,4445 }, {  42,4445 }, {  43,4445 }, {  44,4445 }, {  45,4445 },
+ {  46,4445 }, {  47,4445 }, {  48,4445 }, {  49,4445 }, {  50,4445 },
+ {  51,4445 }, {  52,4445 }, {  53,4445 }, {  54,4445 }, {  55,4445 },
+ {  56,4445 }, {  57,4445 }, {  58,4445 }, {  59,4445 }, {  60,4445 },
+ {  61,4445 }, {  62,4445 }, {  63,4445 }, {  64,4445 }, {  65,4445 },
+ {  66,4445 }, {  67,4445 }, {  68,4445 }, {  69,4445 }, {  70,4445 },
+ {  71,4445 }, {  72,4445 }, {  73,4445 }, {  74,4445 }, {  75,4445 },
+
+ {  76,4445 }, {  77,4445 }, {  78,4445 }, {  79,4445 }, {  80,4445 },
+ {  81,4445 }, {  82,4445 }, {  83,4445 }, {  84,4445 }, {  85,4445 },
+ {  86,4445 }, {  87,4445 }, {  88,4445 }, {  89,4445 }, {  90,4445 },
+ {  91,4445 }, {  92,4445 }, {  93,4445 }, {  94,4445 }, {  95,4445 },
+ {  96,4445 }, {  97,4445 }, {  98,4445 }, {  99,4445 }, { 100,4445 },
+ { 101,4445 }, { 102,4445 }, { 103,4445 }, { 104,4445 }, { 105,4445 },
+ { 106,4445 }, { 107,4445 }, { 108,4445 }, { 109,4445 }, { 110,4445 },
+ { 111,4445 }, { 112,4445 }, { 113,4445 }, { 114,4445 }, { 115,4445 },
+ { 116,4445 }, { 117,4445 }, { 118,4445 }, { 119,4445 }, { 120,4445 },
+ { 121,4445 }, { 122,4445 }, { 123,4445 }, { 124,4445 }, { 125,4445 },
+
+ { 126,4445 }, { 127,4445 }, { 128,4445 }, { 129,4445 }, { 130,4445 },
+ { 131,4445 }, { 132,4445 }, { 133,4445 }, { 134,4445 }, { 135,4445 },
+ { 136,4445 }, { 137,4445 }, { 138,4445 }, { 139,4445 }, { 140,4445 },
+ { 141,4445 }, { 142,4445 }, { 143,4445 }, { 144,4445 }, { 145,4445 },
+ { 146,4445 }, { 147,4445 }, { 148,4445 }, { 149,4445 }, { 150,4445 },
+ { 151,4445 }, { 152,4445 }, { 153,4445 }, { 154,4445 }, { 155,4445 },
+ { 156,4445 }, { 157,4445 }, { 158,4445 }, { 159,4445 }, { 160,4445 },
+ { 161,4445 }, { 162,4445 }, { 163,4445 }, { 164,4445 }, { 165,4445 },
+ { 166,4445 }, { 167,4445 }, { 168,4445 }, { 169,4445 }, { 170,4445 },
+ { 171,4445 }, { 172,4445 }, { 173,4445 }, { 174,4445 }, { 175,4445 },
+
+ { 176,4445 }, { 177,4445 }, { 178,4445 }, { 179,4445 }, { 180,4445 },
+ { 181,4445 }, { 182,4445 }, { 183,4445 }, { 184,4445 }, { 185,4445 },
+ { 186,4445 }, { 187,4445 }, { 188,4445 }, { 189,4445 }, { 190,4445 },
+ { 191,4445 }, { 192,4445 }, { 193,4445 }, { 194,4445 }, { 195,4445 },
+ { 196,4445 }, { 197,4445 }, { 198,4445 }, { 199,4445 }, { 200,4445 },
+ { 201,4445 }, { 202,4445 }, { 203,4445 }, { 204,4445 }, { 205,4445 },
+ { 206,4445 }, { 207,4445 }, { 208,4445 }, { 209,4445 }, { 210,4445 },
+ { 211,4445 }, { 212,4445 }, { 213,4445 }, { 214,4445 }, { 215,4445 },
+ { 216,4445 }, { 217,4445 }, { 218,4445 }, { 219,4445 }, { 220,4445 },
+ { 221,4445 }, { 222,4445 }, { 223,4445 }, { 224,4445 }, { 225,4445 },
+
+ { 226,4445 }, { 227,4445 }, { 228,4445 }, { 229,4445 }, { 230,4445 },
+ { 231,4445 }, { 232,4445 }, { 233,4445 }, { 234,4445 }, { 235,4445 },
+ { 236,4445 }, { 237,4445 }, { 238,4445 }, { 239,4445 }, { 240,4445 },
+ { 241,4445 }, { 242,4445 }, { 243,4445 }, { 244,4445 }, { 245,4445 },
+ { 246,4445 }, { 247,4445 }, { 248,4445 }, { 249,4445 }, { 250,4445 },
+ { 251,4445 }, { 252,4445 }, { 253,4445 }, { 254,4445 }, { 255,4445 },
+ { 256,4445 }, {   0,  11 }, {   0,26768 }, {   1,4445 }, {   2,4445 },
+ {   3,4445 }, {   4,4445 }, {   5,4445 }, {   6,4445 }, {   7,4445 },
+ {   8,4445 }, {   9,4445 }, {  10,4445 }, {  11,4445 }, {  12,4445 },
+ {  13,4445 }, {  14,4445 }, {  15,4445 }, {  16,4445 }, {  17,4445 },
+
+ {  18,4445 }, {  19,4445 }, {  20,4445 }, {  21,4445 }, {  22,4445 },
+ {  23,4445 }, {  24,4445 }, {  25,4445 }, {  26,4445 }, {  27,4445 },
+ {  28,4445 }, {  29,4445 }, {  30,4445 }, {  31,4445 }, {  32,4445 },
+ {  33,4445 }, {  34,4445 }, {  35,4445 }, {  36,4445 }, {  37,4445 },
+ {  38,4445 }, {   0,   0 }, {  40,4445 }, {  41,4445 }, {  42,4445 },
+ {  43,4445 }, {  44,4445 }, {  45,4445 }, {  46,4445 }, {  47,4445 },
+ {  48,4445 }, {  49,4445 }, {  50,4445 }, {  51,4445 }, {  52,4445 },
+ {  53,4445 }, {  54,4445 }, {  55,4445 }, {  56,4445 }, {  57,4445 },
+ {  58,4445 }, {  59,4445 }, {  60,4445 }, {  61,4445 }, {  62,4445 },
+ {  63,4445 }, {  64,4445 }, {  65,4445 }, {  66,4445 }, {  67,4445 },
+
+ {  68,4445 }, {  69,4445 }, {  70,4445 }, {  71,4445 }, {  72,4445 },
+ {  73,4445 }, {  74,4445 }, {  75,4445 }, {  76,4445 }, {  77,4445 },
+ {  78,4445 }, {  79,4445 }, {  80,4445 }, {  81,4445 }, {  82,4445 },
+ {  83,4445 }, {  84,4445 }, {  85,4445 }, {  86,4445 }, {  87,4445 },
+ {  88,4445 }, {  89,4445 }, {  90,4445 }, {  91,4445 }, {  92,4445 },
+ {  93,4445 }, {  94,4445 }, {  95,4445 }, {  96,4445 }, {  97,4445 },
+ {  98,4445 }, {  99,4445 }, { 100,4445 }, { 101,4445 }, { 102,4445 },
+ { 103,4445 }, { 104,4445 }, { 105,4445 }, { 106,4445 }, { 107,4445 },
+ { 108,4445 }, { 109,4445 }, { 110,4445 }, { 111,4445 }, { 112,4445 },
+ { 113,4445 }, { 114,4445 }, { 115,4445 }, { 116,4445 }, { 117,4445 },
+
+ { 118,4445 }, { 119,4445 }, { 120,4445 }, { 121,4445 }, { 122,4445 },
+ { 123,4445 }, { 124,4445 }, { 125,4445 }, { 126,4445 }, { 127,4445 },
+ { 128,4445 }, { 129,4445 }, { 130,4445 }, { 131,4445 }, { 132,4445 },
+ { 133,4445 }, { 134,4445 }, { 135,4445 }, { 136,4445 }, { 137,4445 },
+ { 138,4445 }, { 139,4445 }, { 140,4445 }, { 141,4445 }, { 142,4445 },
+ { 143,4445 }, { 144,4445 }, { 145,4445 }, { 146,4445 }, { 147,4445 },
+ { 148,4445 }, { 149,4445 }, { 150,4445 }, { 151,4445 }, { 152,4445 },
+ { 153,4445 }, { 154,4445 }, { 155,4445 }, { 156,4445 }, { 157,4445 },
+ { 158,4445 }, { 159,4445 }, { 160,4445 }, { 161,4445 }, { 162,4445 },
+ { 163,4445 }, { 164,4445 }, { 165,4445 }, { 166,4445 }, { 167,4445 },
+
+ { 168,4445 }, { 169,4445 }, { 170,4445 }, { 171,4445 }, { 172,4445 },
+ { 173,4445 }, { 174,4445 }, { 175,4445 }, { 176,4445 }, { 177,4445 },
+ { 178,4445 }, { 179,4445 }, { 180,4445 }, { 181,4445 }, { 182,4445 },
+ { 183,4445 }, { 184,4445 }, { 185,4445 }, { 186,4445 }, { 187,4445 },
+ { 188,4445 }, { 189,4445 }, { 190,4445 }, { 191,4445 }, { 192,4445 },
+ { 193,4445 }, { 194,4445 }, { 195,4445 }, { 196,4445 }, { 197,4445 },
+ { 198,4445 }, { 199,4445 }, { 200,4445 }, { 201,4445 }, { 202,4445 },
+ { 203,4445 }, { 204,4445 }, { 205,4445 }, { 206,4445 }, { 207,4445 },
+ { 208,4445 }, { 209,4445 }, { 210,4445 }, { 211,4445 }, { 212,4445 },
+ { 213,4445 }, { 214,4445 }, { 215,4445 }, { 216,4445 }, { 217,4445 },
+
+ { 218,4445 }, { 219,4445 }, { 220,4445 }, { 221,4445 }, { 222,4445 },
+ { 223,4445 }, { 224,4445 }, { 225,4445 }, { 226,4445 }, { 227,4445 },
+ { 228,4445 }, { 229,4445 }, { 230,4445 }, { 231,4445 }, { 232,4445 },
+ { 233,4445 }, { 234,4445 }, { 235,4445 }, { 236,4445 }, { 237,4445 },
+ { 238,4445 }, { 239,4445 }, { 240,4445 }, { 241,4445 }, { 242,4445 },
+ { 243,4445 }, { 244,4445 }, { 245,4445 }, { 246,4445 }, { 247,4445 },
+ { 248,4445 }, { 249,4445 }, { 250,4445 }, { 251,4445 }, { 252,4445 },
+ { 253,4445 }, { 254,4445 }, { 255,4445 }, { 256,4445 }, {   0,  16 },
+ {   0,26510 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   9,4445 },
+
+ {  10,4450 }, {   0,   0 }, {  12,4445 }, {  13,4450 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  32,4445 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  45,-3036 }, {   0,  32 }, {   0,26463 }, {   1,4450 }, {   2,4450 },
+ {   3,4450 }, {   4,4450 }, {   5,4450 }, {   6,4450 }, {   7,4450 },
+ {   8,4450 }, {   9,4450 }, {  10,4450 }, {  11,4450 }, {  12,4450 },
+
+ {  13,4450 }, {  14,4450 }, {  15,4450 }, {  16,4450 }, {  17,4450 },
+ {  18,4450 }, {  19,4450 }, {  20,4450 }, {  21,4450 }, {  22,4450 },
+ {  23,4450 }, {  24,4450 }, {  25,4450 }, {  26,4450 }, {  27,4450 },
+ {  28,4450 }, {  29,4450 }, {  30,4450 }, {  31,4450 }, {  32,4450 },
+ {  33,4450 }, {  34,4450 }, {  35,4450 }, {  36,4450 }, {  37,4450 },
+ {  38,4450 }, {   0,   0 }, {  40,4450 }, {  41,4450 }, {  42,4450 },
+ {  43,4450 }, {  44,4450 }, {  45,4450 }, {  46,4450 }, {  47,4450 },
+ {  48,4450 }, {  49,4450 }, {  50,4450 }, {  51,4450 }, {  52,4450 },
+ {  53,4450 }, {  54,4450 }, {  55,4450 }, {  56,4450 }, {  57,4450 },
+ {  58,4450 }, {  59,4450 }, {  60,4450 }, {  61,4450 }, {  62,4450 },
+
+ {  63,4450 }, {  64,4450 }, {  65,4450 }, {  66,4450 }, {  67,4450 },
+ {  68,4450 }, {  69,4450 }, {  70,4450 }, {  71,4450 }, {  72,4450 },
+ {  73,4450 }, {  74,4450 }, {  75,4450 }, {  76,4450 }, {  77,4450 },
+ {  78,4450 }, {  79,4450 }, {  80,4450 }, {  81,4450 }, {  82,4450 },
+ {  83,4450 }, {  84,4450 }, {  85,4450 }, {  86,4450 }, {  87,4450 },
+ {  88,4450 }, {  89,4450 }, {  90,4450 }, {  91,4450 }, {   0,   0 },
+ {  93,4450 }, {  94,4450 }, {  95,4450 }, {  96,4450 }, {  97,4450 },
+ {  98,4450 }, {  99,4450 }, { 100,4450 }, { 101,4450 }, { 102,4450 },
+ { 103,4450 }, { 104,4450 }, { 105,4450 }, { 106,4450 }, { 107,4450 },
+ { 108,4450 }, { 109,4450 }, { 110,4450 }, { 111,4450 }, { 112,4450 },
+
+ { 113,4450 }, { 114,4450 }, { 115,4450 }, { 116,4450 }, { 117,4450 },
+ { 118,4450 }, { 119,4450 }, { 120,4450 }, { 121,4450 }, { 122,4450 },
+ { 123,4450 }, { 124,4450 }, { 125,4450 }, { 126,4450 }, { 127,4450 },
+ { 128,4450 }, { 129,4450 }, { 130,4450 }, { 131,4450 }, { 132,4450 },
+ { 133,4450 }, { 134,4450 }, { 135,4450 }, { 136,4450 }, { 137,4450 },
+ { 138,4450 }, { 139,4450 }, { 140,4450 }, { 141,4450 }, { 142,4450 },
+ { 143,4450 }, { 144,4450 }, { 145,4450 }, { 146,4450 }, { 147,4450 },
+ { 148,4450 }, { 149,4450 }, { 150,4450 }, { 151,4450 }, { 152,4450 },
+ { 153,4450 }, { 154,4450 }, { 155,4450 }, { 156,4450 }, { 157,4450 },
+ { 158,4450 }, { 159,4450 }, { 160,4450 }, { 161,4450 }, { 162,4450 },
+
+ { 163,4450 }, { 164,4450 }, { 165,4450 }, { 166,4450 }, { 167,4450 },
+ { 168,4450 }, { 169,4450 }, { 170,4450 }, { 171,4450 }, { 172,4450 },
+ { 173,4450 }, { 174,4450 }, { 175,4450 }, { 176,4450 }, { 177,4450 },
+ { 178,4450 }, { 179,4450 }, { 180,4450 }, { 181,4450 }, { 182,4450 },
+ { 183,4450 }, { 184,4450 }, { 185,4450 }, { 186,4450 }, { 187,4450 },
+ { 188,4450 }, { 189,4450 }, { 190,4450 }, { 191,4450 }, { 192,4450 },
+ { 193,4450 }, { 194,4450 }, { 195,4450 }, { 196,4450 }, { 197,4450 },
+ { 198,4450 }, { 199,4450 }, { 200,4450 }, { 201,4450 }, { 202,4450 },
+ { 203,4450 }, { 204,4450 }, { 205,4450 }, { 206,4450 }, { 207,4450 },
+ { 208,4450 }, { 209,4450 }, { 210,4450 }, { 211,4450 }, { 212,4450 },
+
+ { 213,4450 }, { 214,4450 }, { 215,4450 }, { 216,4450 }, { 217,4450 },
+ { 218,4450 }, { 219,4450 }, { 220,4450 }, { 221,4450 }, { 222,4450 },
+ { 223,4450 }, { 224,4450 }, { 225,4450 }, { 226,4450 }, { 227,4450 },
+ { 228,4450 }, { 229,4450 }, { 230,4450 }, { 231,4450 }, { 232,4450 },
+ { 233,4450 }, { 234,4450 }, { 235,4450 }, { 236,4450 }, { 237,4450 },
+ { 238,4450 }, { 239,4450 }, { 240,4450 }, { 241,4450 }, { 242,4450 },
+ { 243,4450 }, { 244,4450 }, { 245,4450 }, { 246,4450 }, { 247,4450 },
+ { 248,4450 }, { 249,4450 }, { 250,4450 }, { 251,4450 }, { 252,4450 },
+ { 253,4450 }, { 254,4450 }, { 255,4450 }, { 256,4450 }, {   0,  32 },
+ {   0,26205 }, {   1,4192 }, {   2,4192 }, {   3,4192 }, {   4,4192 },
+
+ {   5,4192 }, {   6,4192 }, {   7,4192 }, {   8,4192 }, {   9,4192 },
+ {  10,4192 }, {  11,4192 }, {  12,4192 }, {  13,4192 }, {  14,4192 },
+ {  15,4192 }, {  16,4192 }, {  17,4192 }, {  18,4192 }, {  19,4192 },
+ {  20,4192 }, {  21,4192 }, {  22,4192 }, {  23,4192 }, {  24,4192 },
+ {  25,4192 }, {  26,4192 }, {  27,4192 }, {  28,4192 }, {  29,4192 },
+ {  30,4192 }, {  31,4192 }, {  32,4192 }, {  33,4192 }, {  34,4192 },
+ {  35,4192 }, {  36,4192 }, {  37,4192 }, {  38,4192 }, {   0,   0 },
+ {  40,4192 }, {  41,4192 }, {  42,4192 }, {  43,4192 }, {  44,4192 },
+ {  45,4192 }, {  46,4192 }, {  47,4192 }, {  48,4192 }, {  49,4192 },
+ {  50,4192 }, {  51,4192 }, {  52,4192 }, {  53,4192 }, {  54,4192 },
+
+ {  55,4192 }, {  56,4192 }, {  57,4192 }, {  58,4192 }, {  59,4192 },
+ {  60,4192 }, {  61,4192 }, {  62,4192 }, {  63,4192 }, {  64,4192 },
+ {  65,4192 }, {  66,4192 }, {  67,4192 }, {  68,4192 }, {  69,4192 },
+ {  70,4192 }, {  71,4192 }, {  72,4192 }, {  73,4192 }, {  74,4192 },
+ {  75,4192 }, {  76,4192 }, {  77,4192 }, {  78,4192 }, {  79,4192 },
+ {  80,4192 }, {  81,4192 }, {  82,4192 }, {  83,4192 }, {  84,4192 },
+ {  85,4192 }, {  86,4192 }, {  87,4192 }, {  88,4192 }, {  89,4192 },
+ {  90,4192 }, {  91,4192 }, {   0,   0 }, {  93,4192 }, {  94,4192 },
+ {  95,4192 }, {  96,4192 }, {  97,4192 }, {  98,4192 }, {  99,4192 },
+ { 100,4192 }, { 101,4192 }, { 102,4192 }, { 103,4192 }, { 104,4192 },
+
+ { 105,4192 }, { 106,4192 }, { 107,4192 }, { 108,4192 }, { 109,4192 },
+ { 110,4192 }, { 111,4192 }, { 112,4192 }, { 113,4192 }, { 114,4192 },
+ { 115,4192 }, { 116,4192 }, { 117,4192 }, { 118,4192 }, { 119,4192 },
+ { 120,4192 }, { 121,4192 }, { 122,4192 }, { 123,4192 }, { 124,4192 },
+ { 125,4192 }, { 126,4192 }, { 127,4192 }, { 128,4192 }, { 129,4192 },
+ { 130,4192 }, { 131,4192 }, { 132,4192 }, { 133,4192 }, { 134,4192 },
+ { 135,4192 }, { 136,4192 }, { 137,4192 }, { 138,4192 }, { 139,4192 },
+ { 140,4192 }, { 141,4192 }, { 142,4192 }, { 143,4192 }, { 144,4192 },
+ { 145,4192 }, { 146,4192 }, { 147,4192 }, { 148,4192 }, { 149,4192 },
+ { 150,4192 }, { 151,4192 }, { 152,4192 }, { 153,4192 }, { 154,4192 },
+
+ { 155,4192 }, { 156,4192 }, { 157,4192 }, { 158,4192 }, { 159,4192 },
+ { 160,4192 }, { 161,4192 }, { 162,4192 }, { 163,4192 }, { 164,4192 },
+ { 165,4192 }, { 166,4192 }, { 167,4192 }, { 168,4192 }, { 169,4192 },
+ { 170,4192 }, { 171,4192 }, { 172,4192 }, { 173,4192 }, { 174,4192 },
+ { 175,4192 }, { 176,4192 }, { 177,4192 }, { 178,4192 }, { 179,4192 },
+ { 180,4192 }, { 181,4192 }, { 182,4192 }, { 183,4192 }, { 184,4192 },
+ { 185,4192 }, { 186,4192 }, { 187,4192 }, { 188,4192 }, { 189,4192 },
+ { 190,4192 }, { 191,4192 }, { 192,4192 }, { 193,4192 }, { 194,4192 },
+ { 195,4192 }, { 196,4192 }, { 197,4192 }, { 198,4192 }, { 199,4192 },
+ { 200,4192 }, { 201,4192 }, { 202,4192 }, { 203,4192 }, { 204,4192 },
+
+ { 205,4192 }, { 206,4192 }, { 207,4192 }, { 208,4192 }, { 209,4192 },
+ { 210,4192 }, { 211,4192 }, { 212,4192 }, { 213,4192 }, { 214,4192 },
+ { 215,4192 }, { 216,4192 }, { 217,4192 }, { 218,4192 }, { 219,4192 },
+ { 220,4192 }, { 221,4192 }, { 222,4192 }, { 223,4192 }, { 224,4192 },
+ { 225,4192 }, { 226,4192 }, { 227,4192 }, { 228,4192 }, { 229,4192 },
+ { 230,4192 }, { 231,4192 }, { 232,4192 }, { 233,4192 }, { 234,4192 },
+ { 235,4192 }, { 236,4192 }, { 237,4192 }, { 238,4192 }, { 239,4192 },
+ { 240,4192 }, { 241,4192 }, { 242,4192 }, { 243,4192 }, { 244,4192 },
+ { 245,4192 }, { 246,4192 }, { 247,4192 }, { 248,4192 }, { 249,4192 },
+ { 250,4192 }, { 251,4192 }, { 252,4192 }, { 253,4192 }, { 254,4192 },
+
+ { 255,4192 }, { 256,4192 }, {   0,  22 }, {   0,25947 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   9,4192 }, {  10,4197 }, {   0,   0 },
+ {  12,4192 }, {  13,4197 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  32,4192 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  39,-3597 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  45,-3592 }, {   0,  42 },
+
+ {   0,25900 }, {   1,-3637 }, {   2,-3637 }, {   3,-3637 }, {   4,-3637 },
+ {   5,-3637 }, {   6,-3637 }, {   7,-3637 }, {   8,-3637 }, {   9,-3637 },
+ {  10,-3637 }, {  11,-3637 }, {  12,-3637 }, {  13,-3637 }, {  14,-3637 },
+ {  15,-3637 }, {  16,-3637 }, {  17,-3637 }, {  18,-3637 }, {  19,-3637 },
+ {  20,-3637 }, {  21,-3637 }, {  22,-3637 }, {  23,-3637 }, {  24,-3637 },
+ {  25,-3637 }, {  26,-3637 }, {  27,-3637 }, {  28,-3637 }, {  29,-3637 },
+ {  30,-3637 }, {  31,-3637 }, {  32,-3637 }, {  33,-3637 }, {  34,-3637 },
+ {  35,-3637 }, {  36,-3637 }, {  37,-3637 }, {  38,-3637 }, {  39,-3637 },
+ {  40,-3637 }, {  41,-3637 }, {  42,-3637 }, {  43,-3637 }, {  44,-3637 },
+ {  45,-3637 }, {  46,-3637 }, {  47,-3637 }, {  48,4152 }, {  49,4152 },
+
+ {  50,4152 }, {  51,4152 }, {  52,4152 }, {  53,4152 }, {  54,4152 },
+ {  55,4152 }, {  56,-3637 }, {  57,-3637 }, {  58,-3637 }, {  59,-3637 },
+ {  60,-3637 }, {  61,-3637 }, {  62,-3637 }, {  63,-3637 }, {  64,-3637 },
+ {  65,-3637 }, {  66,-3637 }, {  67,-3637 }, {  68,-3637 }, {  69,-3637 },
+ {  70,-3637 }, {  71,-3637 }, {  72,-3637 }, {  73,-3637 }, {  74,-3637 },
+ {  75,-3637 }, {  76,-3637 }, {  77,-3637 }, {  78,-3637 }, {  79,-3637 },
+ {  80,-3637 }, {  81,-3637 }, {  82,-3637 }, {  83,-3637 }, {  84,-3637 },
+ {  85,4165 }, {  86,-3637 }, {  87,-3637 }, {  88,-3637 }, {  89,-3637 },
+ {  90,-3637 }, {  91,-3637 }, {  92,-3637 }, {  93,-3637 }, {  94,-3637 },
+ {  95,-3637 }, {  96,-3637 }, {  97,-3637 }, {  98,-3637 }, {  99,-3637 },
+
+ { 100,-3637 }, { 101,-3637 }, { 102,-3637 }, { 103,-3637 }, { 104,-3637 },
+ { 105,-3637 }, { 106,-3637 }, { 107,-3637 }, { 108,-3637 }, { 109,-3637 },
+ { 110,-3637 }, { 111,-3637 }, { 112,-3637 }, { 113,-3637 }, { 114,-3637 },
+ { 115,-3637 }, { 116,-3637 }, { 117,4188 }, { 118,-3637 }, { 119,-3637 },
+ { 120,4226 }, { 121,-3637 }, { 122,-3637 }, { 123,-3637 }, { 124,-3637 },
+ { 125,-3637 }, { 126,-3637 }, { 127,-3637 }, { 128,-3637 }, { 129,-3637 },
+ { 130,-3637 }, { 131,-3637 }, { 132,-3637 }, { 133,-3637 }, { 134,-3637 },
+ { 135,-3637 }, { 136,-3637 }, { 137,-3637 }, { 138,-3637 }, { 139,-3637 },
+ { 140,-3637 }, { 141,-3637 }, { 142,-3637 }, { 143,-3637 }, { 144,-3637 },
+ { 145,-3637 }, { 146,-3637 }, { 147,-3637 }, { 148,-3637 }, { 149,-3637 },
+
+ { 150,-3637 }, { 151,-3637 }, { 152,-3637 }, { 153,-3637 }, { 154,-3637 },
+ { 155,-3637 }, { 156,-3637 }, { 157,-3637 }, { 158,-3637 }, { 159,-3637 },
+ { 160,-3637 }, { 161,-3637 }, { 162,-3637 }, { 163,-3637 }, { 164,-3637 },
+ { 165,-3637 }, { 166,-3637 }, { 167,-3637 }, { 168,-3637 }, { 169,-3637 },
+ { 170,-3637 }, { 171,-3637 }, { 172,-3637 }, { 173,-3637 }, { 174,-3637 },
+ { 175,-3637 }, { 176,-3637 }, { 177,-3637 }, { 178,-3637 }, { 179,-3637 },
+ { 180,-3637 }, { 181,-3637 }, { 182,-3637 }, { 183,-3637 }, { 184,-3637 },
+ { 185,-3637 }, { 186,-3637 }, { 187,-3637 }, { 188,-3637 }, { 189,-3637 },
+ { 190,-3637 }, { 191,-3637 }, { 192,-3637 }, { 193,-3637 }, { 194,-3637 },
+ { 195,-3637 }, { 196,-3637 }, { 197,-3637 }, { 198,-3637 }, { 199,-3637 },
+
+ { 200,-3637 }, { 201,-3637 }, { 202,-3637 }, { 203,-3637 }, { 204,-3637 },
+ { 205,-3637 }, { 206,-3637 }, { 207,-3637 }, { 208,-3637 }, { 209,-3637 },
+ { 210,-3637 }, { 211,-3637 }, { 212,-3637 }, { 213,-3637 }, { 214,-3637 },
+ { 215,-3637 }, { 216,-3637 }, { 217,-3637 }, { 218,-3637 }, { 219,-3637 },
+ { 220,-3637 }, { 221,-3637 }, { 222,-3637 }, { 223,-3637 }, { 224,-3637 },
+ { 225,-3637 }, { 226,-3637 }, { 227,-3637 }, { 228,-3637 }, { 229,-3637 },
+ { 230,-3637 }, { 231,-3637 }, { 232,-3637 }, { 233,-3637 }, { 234,-3637 },
+ { 235,-3637 }, { 236,-3637 }, { 237,-3637 }, { 238,-3637 }, { 239,-3637 },
+ { 240,-3637 }, { 241,-3637 }, { 242,-3637 }, { 243,-3637 }, { 244,-3637 },
+ { 245,-3637 }, { 246,-3637 }, { 247,-3637 }, { 248,-3637 }, { 249,-3637 },
+
+ { 250,-3637 }, { 251,-3637 }, { 252,-3637 }, { 253,-3637 }, { 254,-3637 },
+ { 255,-3637 }, { 256,-3637 }, {   0,  31 }, {   0,25642 }, {   1,4072 },
+ {   2,4072 }, {   3,4072 }, {   4,4072 }, {   5,4072 }, {   6,4072 },
+ {   7,4072 }, {   8,4072 }, {   9,4072 }, {  10,4072 }, {  11,4072 },
+ {  12,4072 }, {  13,4072 }, {  14,4072 }, {  15,4072 }, {  16,4072 },
+ {  17,4072 }, {  18,4072 }, {  19,4072 }, {  20,4072 }, {  21,4072 },
+ {  22,4072 }, {  23,4072 }, {  24,4072 }, {  25,4072 }, {  26,4072 },
+ {  27,4072 }, {  28,4072 }, {  29,4072 }, {  30,4072 }, {  31,4072 },
+ {  32,4072 }, {  33,4072 }, {  34,4072 }, {  35,4072 }, {  36,4072 },
+ {  37,4072 }, {  38,4072 }, {   0,   0 }, {  40,4072 }, {  41,4072 },
+
+ {  42,4072 }, {  43,4072 }, {  44,4072 }, {  45,4072 }, {  46,4072 },
+ {  47,4072 }, {  48,4072 }, {  49,4072 }, {  50,4072 }, {  51,4072 },
+ {  52,4072 }, {  53,4072 }, {  54,4072 }, {  55,4072 }, {  56,4072 },
+ {  57,4072 }, {  58,4072 }, {  59,4072 }, {  60,4072 }, {  61,4072 },
+ {  62,4072 }, {  63,4072 }, {  64,4072 }, {  65,4072 }, {  66,4072 },
+ {  67,4072 }, {  68,4072 }, {  69,4072 }, {  70,4072 }, {  71,4072 },
+ {  72,4072 }, {  73,4072 }, {  74,4072 }, {  75,4072 }, {  76,4072 },
+ {  77,4072 }, {  78,4072 }, {  79,4072 }, {  80,4072 }, {  81,4072 },
+ {  82,4072 }, {  83,4072 }, {  84,4072 }, {  85,4072 }, {  86,4072 },
+ {  87,4072 }, {  88,4072 }, {  89,4072 }, {  90,4072 }, {  91,4072 },
+
+ {  92,4072 }, {  93,4072 }, {  94,4072 }, {  95,4072 }, {  96,4072 },
+ {  97,4072 }, {  98,4072 }, {  99,4072 }, { 100,4072 }, { 101,4072 },
+ { 102,4072 }, { 103,4072 }, { 104,4072 }, { 105,4072 }, { 106,4072 },
+ { 107,4072 }, { 108,4072 }, { 109,4072 }, { 110,4072 }, { 111,4072 },
+ { 112,4072 }, { 113,4072 }, { 114,4072 }, { 115,4072 }, { 116,4072 },
+ { 117,4072 }, { 118,4072 }, { 119,4072 }, { 120,4072 }, { 121,4072 },
+ { 122,4072 }, { 123,4072 }, { 124,4072 }, { 125,4072 }, { 126,4072 },
+ { 127,4072 }, { 128,4072 }, { 129,4072 }, { 130,4072 }, { 131,4072 },
+ { 132,4072 }, { 133,4072 }, { 134,4072 }, { 135,4072 }, { 136,4072 },
+ { 137,4072 }, { 138,4072 }, { 139,4072 }, { 140,4072 }, { 141,4072 },
+
+ { 142,4072 }, { 143,4072 }, { 144,4072 }, { 145,4072 }, { 146,4072 },
+ { 147,4072 }, { 148,4072 }, { 149,4072 }, { 150,4072 }, { 151,4072 },
+ { 152,4072 }, { 153,4072 }, { 154,4072 }, { 155,4072 }, { 156,4072 },
+ { 157,4072 }, { 158,4072 }, { 159,4072 }, { 160,4072 }, { 161,4072 },
+ { 162,4072 }, { 163,4072 }, { 164,4072 }, { 165,4072 }, { 166,4072 },
+ { 167,4072 }, { 168,4072 }, { 169,4072 }, { 170,4072 }, { 171,4072 },
+ { 172,4072 }, { 173,4072 }, { 174,4072 }, { 175,4072 }, { 176,4072 },
+ { 177,4072 }, { 178,4072 }, { 179,4072 }, { 180,4072 }, { 181,4072 },
+ { 182,4072 }, { 183,4072 }, { 184,4072 }, { 185,4072 }, { 186,4072 },
+ { 187,4072 }, { 188,4072 }, { 189,4072 }, { 190,4072 }, { 191,4072 },
+
+ { 192,4072 }, { 193,4072 }, { 194,4072 }, { 195,4072 }, { 196,4072 },
+ { 197,4072 }, { 198,4072 }, { 199,4072 }, { 200,4072 }, { 201,4072 },
+ { 202,4072 }, { 203,4072 }, { 204,4072 }, { 205,4072 }, { 206,4072 },
+ { 207,4072 }, { 208,4072 }, { 209,4072 }, { 210,4072 }, { 211,4072 },
+ { 212,4072 }, { 213,4072 }, { 214,4072 }, { 215,4072 }, { 216,4072 },
+ { 217,4072 }, { 218,4072 }, { 219,4072 }, { 220,4072 }, { 221,4072 },
+ { 222,4072 }, { 223,4072 }, { 224,4072 }, { 225,4072 }, { 226,4072 },
+ { 227,4072 }, { 228,4072 }, { 229,4072 }, { 230,4072 }, { 231,4072 },
+ { 232,4072 }, { 233,4072 }, { 234,4072 }, { 235,4072 }, { 236,4072 },
+ { 237,4072 }, { 238,4072 }, { 239,4072 }, { 240,4072 }, { 241,4072 },
+
+ { 242,4072 }, { 243,4072 }, { 244,4072 }, { 245,4072 }, { 246,4072 },
+ { 247,4072 }, { 248,4072 }, { 249,4072 }, { 250,4072 }, { 251,4072 },
+ { 252,4072 }, { 253,4072 }, { 254,4072 }, { 255,4072 }, { 256,4072 },
+ {   0,  22 }, {   0,25384 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   9,3629 }, {  10,3634 }, {   0,   0 }, {  12,3629 }, {  13,3634 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  32,3629 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  39,-4160 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  45,-4155 }, {   0,  46 }, {   0,25337 }, {   1,4025 },
+ {   2,4025 }, {   3,4025 }, {   4,4025 }, {   5,4025 }, {   6,4025 },
+ {   7,4025 }, {   8,4025 }, {   9,4025 }, {  10,4025 }, {  11,4025 },
+ {  12,4025 }, {  13,4025 }, {  14,4025 }, {  15,4025 }, {  16,4025 },
+ {  17,4025 }, {  18,4025 }, {  19,4025 }, {  20,4025 }, {  21,4025 },
+ {  22,4025 }, {  23,4025 }, {  24,4025 }, {  25,4025 }, {  26,4025 },
+ {  27,4025 }, {  28,4025 }, {  29,4025 }, {  30,4025 }, {  31,4025 },
+ {  32,4025 }, {  33,4025 }, {  34,4025 }, {  35,4025 }, {   0,   0 },
+
+ {  37,4025 }, {  38,4025 }, {  39,4025 }, {  40,4025 }, {  41,4025 },
+ {  42,4025 }, {  43,4025 }, {  44,4025 }, {  45,4025 }, {  46,4025 },
+ {  47,4025 }, {  48,4025 }, {  49,4025 }, {  50,4025 }, {  51,4025 },
+ {  52,4025 }, {  53,4025 }, {  54,4025 }, {  55,4025 }, {  56,4025 },
+ {  57,4025 }, {  58,4025 }, {  59,4025 }, {  60,4025 }, {  61,4025 },
+ {  62,4025 }, {  63,4025 }, {  64,4025 }, {  65,4025 }, {  66,4025 },
+ {  67,4025 }, {  68,4025 }, {  69,4025 }, {  70,4025 }, {  71,4025 },
+ {  72,4025 }, {  73,4025 }, {  74,4025 }, {  75,4025 }, {  76,4025 },
+ {  77,4025 }, {  78,4025 }, {  79,4025 }, {  80,4025 }, {  81,4025 },
+ {  82,4025 }, {  83,4025 }, {  84,4025 }, {  85,4025 }, {  86,4025 },
+
+ {  87,4025 }, {  88,4025 }, {  89,4025 }, {  90,4025 }, {  91,4025 },
+ {  92,4025 }, {  93,4025 }, {  94,4025 }, {  95,4025 }, {  96,4025 },
+ {  97,4025 }, {  98,4025 }, {  99,4025 }, { 100,4025 }, { 101,4025 },
+ { 102,4025 }, { 103,4025 }, { 104,4025 }, { 105,4025 }, { 106,4025 },
+ { 107,4025 }, { 108,4025 }, { 109,4025 }, { 110,4025 }, { 111,4025 },
+ { 112,4025 }, { 113,4025 }, { 114,4025 }, { 115,4025 }, { 116,4025 },
+ { 117,4025 }, { 118,4025 }, { 119,4025 }, { 120,4025 }, { 121,4025 },
+ { 122,4025 }, { 123,4025 }, { 124,4025 }, { 125,4025 }, { 126,4025 },
+ { 127,4025 }, { 128,4025 }, { 129,4025 }, { 130,4025 }, { 131,4025 },
+ { 132,4025 }, { 133,4025 }, { 134,4025 }, { 135,4025 }, { 136,4025 },
+
+ { 137,4025 }, { 138,4025 }, { 139,4025 }, { 140,4025 }, { 141,4025 },
+ { 142,4025 }, { 143,4025 }, { 144,4025 }, { 145,4025 }, { 146,4025 },
+ { 147,4025 }, { 148,4025 }, { 149,4025 }, { 150,4025 }, { 151,4025 },
+ { 152,4025 }, { 153,4025 }, { 154,4025 }, { 155,4025 }, { 156,4025 },
+ { 157,4025 }, { 158,4025 }, { 159,4025 }, { 160,4025 }, { 161,4025 },
+ { 162,4025 }, { 163,4025 }, { 164,4025 }, { 165,4025 }, { 166,4025 },
+ { 167,4025 }, { 168,4025 }, { 169,4025 }, { 170,4025 }, { 171,4025 },
+ { 172,4025 }, { 173,4025 }, { 174,4025 }, { 175,4025 }, { 176,4025 },
+ { 177,4025 }, { 178,4025 }, { 179,4025 }, { 180,4025 }, { 181,4025 },
+ { 182,4025 }, { 183,4025 }, { 184,4025 }, { 185,4025 }, { 186,4025 },
+
+ { 187,4025 }, { 188,4025 }, { 189,4025 }, { 190,4025 }, { 191,4025 },
+ { 192,4025 }, { 193,4025 }, { 194,4025 }, { 195,4025 }, { 196,4025 },
+ { 197,4025 }, { 198,4025 }, { 199,4025 }, { 200,4025 }, { 201,4025 },
+ { 202,4025 }, { 203,4025 }, { 204,4025 }, { 205,4025 }, { 206,4025 },
+ { 207,4025 }, { 208,4025 }, { 209,4025 }, { 210,4025 }, { 211,4025 },
+ { 212,4025 }, { 213,4025 }, { 214,4025 }, { 215,4025 }, { 216,4025 },
+ { 217,4025 }, { 218,4025 }, { 219,4025 }, { 220,4025 }, { 221,4025 },
+ { 222,4025 }, { 223,4025 }, { 224,4025 }, { 225,4025 }, { 226,4025 },
+ { 227,4025 }, { 228,4025 }, { 229,4025 }, { 230,4025 }, { 231,4025 },
+ { 232,4025 }, { 233,4025 }, { 234,4025 }, { 235,4025 }, { 236,4025 },
+
+ { 237,4025 }, { 238,4025 }, { 239,4025 }, { 240,4025 }, { 241,4025 },
+ { 242,4025 }, { 243,4025 }, { 244,4025 }, { 245,4025 }, { 246,4025 },
+ { 247,4025 }, { 248,4025 }, { 249,4025 }, { 250,4025 }, { 251,4025 },
+ { 252,4025 }, { 253,4025 }, { 254,4025 }, { 255,4025 }, { 256,4025 },
+ {   0,  46 }, {   0,25079 }, {   1,3767 }, {   2,3767 }, {   3,3767 },
+ {   4,3767 }, {   5,3767 }, {   6,3767 }, {   7,3767 }, {   8,3767 },
+ {   9,3767 }, {  10,3767 }, {  11,3767 }, {  12,3767 }, {  13,3767 },
+ {  14,3767 }, {  15,3767 }, {  16,3767 }, {  17,3767 }, {  18,3767 },
+ {  19,3767 }, {  20,3767 }, {  21,3767 }, {  22,3767 }, {  23,3767 },
+ {  24,3767 }, {  25,3767 }, {  26,3767 }, {  27,3767 }, {  28,3767 },
+
+ {  29,3767 }, {  30,3767 }, {  31,3767 }, {  32,3767 }, {  33,3767 },
+ {  34,3767 }, {  35,3767 }, {   0,   0 }, {  37,3767 }, {  38,3767 },
+ {  39,3767 }, {  40,3767 }, {  41,3767 }, {  42,3767 }, {  43,3767 },
+ {  44,3767 }, {  45,3767 }, {  46,3767 }, {  47,3767 }, {  48,3767 },
+ {  49,3767 }, {  50,3767 }, {  51,3767 }, {  52,3767 }, {  53,3767 },
+ {  54,3767 }, {  55,3767 }, {  56,3767 }, {  57,3767 }, {  58,3767 },
+ {  59,3767 }, {  60,3767 }, {  61,3767 }, {  62,3767 }, {  63,3767 },
+ {  64,3767 }, {  65,3767 }, {  66,3767 }, {  67,3767 }, {  68,3767 },
+ {  69,3767 }, {  70,3767 }, {  71,3767 }, {  72,3767 }, {  73,3767 },
+ {  74,3767 }, {  75,3767 }, {  76,3767 }, {  77,3767 }, {  78,3767 },
+
+ {  79,3767 }, {  80,3767 }, {  81,3767 }, {  82,3767 }, {  83,3767 },
+ {  84,3767 }, {  85,3767 }, {  86,3767 }, {  87,3767 }, {  88,3767 },
+ {  89,3767 }, {  90,3767 }, {  91,3767 }, {  92,3767 }, {  93,3767 },
+ {  94,3767 }, {  95,3767 }, {  96,3767 }, {  97,3767 }, {  98,3767 },
+ {  99,3767 }, { 100,3767 }, { 101,3767 }, { 102,3767 }, { 103,3767 },
+ { 104,3767 }, { 105,3767 }, { 106,3767 }, { 107,3767 }, { 108,3767 },
+ { 109,3767 }, { 110,3767 }, { 111,3767 }, { 112,3767 }, { 113,3767 },
+ { 114,3767 }, { 115,3767 }, { 116,3767 }, { 117,3767 }, { 118,3767 },
+ { 119,3767 }, { 120,3767 }, { 121,3767 }, { 122,3767 }, { 123,3767 },
+ { 124,3767 }, { 125,3767 }, { 126,3767 }, { 127,3767 }, { 128,3767 },
+
+ { 129,3767 }, { 130,3767 }, { 131,3767 }, { 132,3767 }, { 133,3767 },
+ { 134,3767 }, { 135,3767 }, { 136,3767 }, { 137,3767 }, { 138,3767 },
+ { 139,3767 }, { 140,3767 }, { 141,3767 }, { 142,3767 }, { 143,3767 },
+ { 144,3767 }, { 145,3767 }, { 146,3767 }, { 147,3767 }, { 148,3767 },
+ { 149,3767 }, { 150,3767 }, { 151,3767 }, { 152,3767 }, { 153,3767 },
+ { 154,3767 }, { 155,3767 }, { 156,3767 }, { 157,3767 }, { 158,3767 },
+ { 159,3767 }, { 160,3767 }, { 161,3767 }, { 162,3767 }, { 163,3767 },
+ { 164,3767 }, { 165,3767 }, { 166,3767 }, { 167,3767 }, { 168,3767 },
+ { 169,3767 }, { 170,3767 }, { 171,3767 }, { 172,3767 }, { 173,3767 },
+ { 174,3767 }, { 175,3767 }, { 176,3767 }, { 177,3767 }, { 178,3767 },
+
+ { 179,3767 }, { 180,3767 }, { 181,3767 }, { 182,3767 }, { 183,3767 },
+ { 184,3767 }, { 185,3767 }, { 186,3767 }, { 187,3767 }, { 188,3767 },
+ { 189,3767 }, { 190,3767 }, { 191,3767 }, { 192,3767 }, { 193,3767 },
+ { 194,3767 }, { 195,3767 }, { 196,3767 }, { 197,3767 }, { 198,3767 },
+ { 199,3767 }, { 200,3767 }, { 201,3767 }, { 202,3767 }, { 203,3767 },
+ { 204,3767 }, { 205,3767 }, { 206,3767 }, { 207,3767 }, { 208,3767 },
+ { 209,3767 }, { 210,3767 }, { 211,3767 }, { 212,3767 }, { 213,3767 },
+ { 214,3767 }, { 215,3767 }, { 216,3767 }, { 217,3767 }, { 218,3767 },
+ { 219,3767 }, { 220,3767 }, { 221,3767 }, { 222,3767 }, { 223,3767 },
+ { 224,3767 }, { 225,3767 }, { 226,3767 }, { 227,3767 }, { 228,3767 },
+
+ { 229,3767 }, { 230,3767 }, { 231,3767 }, { 232,3767 }, { 233,3767 },
+ { 234,3767 }, { 235,3767 }, { 236,3767 }, { 237,3767 }, { 238,3767 },
+ { 239,3767 }, { 240,3767 }, { 241,3767 }, { 242,3767 }, { 243,3767 },
+ { 244,3767 }, { 245,3767 }, { 246,3767 }, { 247,3767 }, { 248,3767 },
+ { 249,3767 }, { 250,3767 }, { 251,3767 }, { 252,3767 }, { 253,3767 },
+ { 254,3767 }, { 255,3767 }, { 256,3767 }, {   0,  48 }, {   0,24821 },
+ {   0,  53 }, {   0,24819 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,  53 }, {   0,24814 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   9,3767 }, {  10,3767 }, {   0,   0 }, {  12,3767 }, {  13,3767 },
+ {   9,3762 }, {  10,3762 }, {   0,   0 }, {  12,3762 }, {  13,3762 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  32,3767 }, {   0,   0 },
+ {  36,-4714 }, {   0,   0 }, {   0,   0 }, {  32,3762 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  65,3767 },
+ {  66,3767 }, {  67,3767 }, {  68,3767 }, {  69,3767 }, {  70,3767 },
+
+ {  71,3767 }, {  72,3767 }, {  73,3767 }, {  74,3767 }, {  75,3767 },
+ {  76,3767 }, {  77,3767 }, {  78,3767 }, {  79,3767 }, {  80,3767 },
+ {  81,3767 }, {  82,3767 }, {  83,3767 }, {  84,3767 }, {  85,3767 },
+ {  86,3767 }, {  87,3767 }, {  88,3767 }, {  89,3767 }, {  90,3767 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  95,3767 },
+ {   0,   0 }, {  97,3767 }, {  98,3767 }, {  99,3767 }, { 100,3767 },
+ { 101,3767 }, { 102,3767 }, { 103,3767 }, { 104,3767 }, { 105,3767 },
+ { 106,3767 }, { 107,3767 }, { 108,3767 }, { 109,3767 }, { 110,3767 },
+ { 111,3767 }, { 112,3767 }, { 113,3767 }, { 114,3767 }, { 115,3767 },
+ { 116,3767 }, { 117,3767 }, { 118,3767 }, { 119,3767 }, { 120,3767 },
+
+ { 121,3767 }, { 122,3767 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, { 128,3767 }, { 129,3767 }, { 130,3767 },
+ { 131,3767 }, { 132,3767 }, { 133,3767 }, { 134,3767 }, { 135,3767 },
+ { 136,3767 }, { 137,3767 }, { 138,3767 }, { 139,3767 }, { 140,3767 },
+ { 141,3767 }, { 142,3767 }, { 143,3767 }, { 144,3767 }, { 145,3767 },
+ { 146,3767 }, { 147,3767 }, { 148,3767 }, { 149,3767 }, { 150,3767 },
+ { 151,3767 }, { 152,3767 }, { 153,3767 }, { 154,3767 }, { 155,3767 },
+ { 156,3767 }, { 157,3767 }, { 158,3767 }, { 159,3767 }, { 160,3767 },
+ { 161,3767 }, { 162,3767 }, { 163,3767 }, { 164,3767 }, { 165,3767 },
+ { 166,3767 }, { 167,3767 }, { 168,3767 }, { 169,3767 }, { 170,3767 },
+
+ { 171,3767 }, { 172,3767 }, { 173,3767 }, { 174,3767 }, { 175,3767 },
+ { 176,3767 }, { 177,3767 }, { 178,3767 }, { 179,3767 }, { 180,3767 },
+ { 181,3767 }, { 182,3767 }, { 183,3767 }, { 184,3767 }, { 185,3767 },
+ { 186,3767 }, { 187,3767 }, { 188,3767 }, { 189,3767 }, { 190,3767 },
+ { 191,3767 }, { 192,3767 }, { 193,3767 }, { 194,3767 }, { 195,3767 },
+ { 196,3767 }, { 197,3767 }, { 198,3767 }, { 199,3767 }, { 200,3767 },
+ { 201,3767 }, { 202,3767 }, { 203,3767 }, { 204,3767 }, { 205,3767 },
+ { 206,3767 }, { 207,3767 }, { 208,3767 }, { 209,3767 }, { 210,3767 },
+ { 211,3767 }, { 212,3767 }, { 213,3767 }, { 214,3767 }, { 215,3767 },
+ { 216,3767 }, { 217,3767 }, { 218,3767 }, { 219,3767 }, { 220,3767 },
+
+ { 221,3767 }, { 222,3767 }, { 223,3767 }, { 224,3767 }, { 225,3767 },
+ { 226,3767 }, { 227,3767 }, { 228,3767 }, { 229,3767 }, { 230,3767 },
+ { 231,3767 }, { 232,3767 }, { 233,3767 }, { 234,3767 }, { 235,3767 },
+ { 236,3767 }, { 237,3767 }, { 238,3767 }, { 239,3767 }, { 240,3767 },
+ { 241,3767 }, { 242,3767 }, { 243,3767 }, { 244,3767 }, { 245,3767 },
+ { 246,3767 }, { 247,3767 }, { 248,3767 }, { 249,3767 }, { 250,3767 },
+ { 251,3767 }, { 252,3767 }, { 253,3767 }, { 254,3767 }, { 255,3767 },
+ {   0,  24 }, {   0,24564 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,  26 }, {   0,24559 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   9,4025 }, {  10,4030 }, {   0,   0 }, {  12,4025 }, {  13,4030 },
+
+ {   9,4041 }, {  10,4041 }, {   0,   0 }, {  12,4041 }, {  13,4041 },
+ {   0,   0 }, {   0,  26 }, {   0,24543 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   9,4025 }, {  10,4025 }, {  32,4025 }, {  12,4025 },
+ {  13,4025 }, {   0,   0 }, {   0,   0 }, {  32,4041 }, {   0,   0 },
+ {  39,-4980 }, {   0,   0 }, {   0,   1 }, {   0,24522 }, {   0,  70 },
+ {   0,24520 }, {  45,-4928 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   9,   0 }, {  10,   0 }, {  32,4025 },
+ {  12,   0 }, {  13,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  32,   0 }, {   0,   0 }, {   0,   0 }, {  33,   0 }, {   0,   0 },
+ {  35,   0 }, {   0,   0 }, {  37,   0 }, {  38,   0 }, {   0,  68 },
+ {   0,24480 }, {   0,   0 }, {  42,   0 }, {  43,   0 }, {   0,   0 },
+ {  45,   0 }, {   0,   0 }, {  47,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,  71 }, {   0,24463 }, {   0,   0 }, {   0,   0 },
+ {  60,   0 }, {  61,   0 }, {  62,   0 }, {  63,   0 }, {  64,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  33, -40 }, {   0,   0 },
+ {  35, -40 }, {   0,   0 }, {  37, -40 }, {  38, -40 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  42, -40 }, {  43, -40 }, {   0,   0 },
+ {  45, -40 }, {   0,   0 }, {  47, -40 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  94,   0 },
+ {   0,   0 }, {  96,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  60, -40 }, {  61, -40 }, {  62, -40 }, {  63, -40 }, {  64, -40 },
+ {  48,   0 }, {  49,   0 }, {  50,   0 }, {  51,   0 }, {  52,   0 },
+ {  53,   0 }, {  54,   0 }, {  55,   0 }, {  56,   0 }, {  57,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,  44 }, {   0,24401 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, { 124,   0 },
+ {   0,   0 }, { 126,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  94, -40 },
+ {   0,   0 }, {  96, -40 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  36,-5515 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, { 124, -40 },
+ {   0,   0 }, { 126, -40 }, {  48,4257 }, {  49,4257 }, {  50,4257 },
+
+ {  51,4257 }, {  52,4257 }, {  53,4257 }, {  54,4257 }, {  55,4257 },
+ {  56,4257 }, {  57,4257 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  65,4257 },
+ {  66,4257 }, {  67,4257 }, {  68,4257 }, {  69,4257 }, {  70,4257 },
+ {  71,4257 }, {  72,4257 }, {  73,4257 }, {  74,4257 }, {  75,4257 },
+ {  76,4257 }, {  77,4257 }, {  78,4257 }, {  79,4257 }, {  80,4257 },
+ {  81,4257 }, {  82,4257 }, {  83,4257 }, {  84,4257 }, {  85,4257 },
+ {  86,4257 }, {  87,4257 }, {  88,4257 }, {  89,4257 }, {  90,4257 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  95,4257 },
+ {   0,   0 }, {  97,4257 }, {  98,4257 }, {  99,4257 }, { 100,4257 },
+
+ { 101,4257 }, { 102,4257 }, { 103,4257 }, { 104,4257 }, { 105,4257 },
+ { 106,4257 }, { 107,4257 }, { 108,4257 }, { 109,4257 }, { 110,4257 },
+ { 111,4257 }, { 112,4257 }, { 113,4257 }, { 114,4257 }, { 115,4257 },
+ { 116,4257 }, { 117,4257 }, { 118,4257 }, { 119,4257 }, { 120,4257 },
+ { 121,4257 }, { 122,4257 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, { 128,4257 }, { 129,4257 }, { 130,4257 },
+ { 131,4257 }, { 132,4257 }, { 133,4257 }, { 134,4257 }, { 135,4257 },
+ { 136,4257 }, { 137,4257 }, { 138,4257 }, { 139,4257 }, { 140,4257 },
+ { 141,4257 }, { 142,4257 }, { 143,4257 }, { 144,4257 }, { 145,4257 },
+ { 146,4257 }, { 147,4257 }, { 148,4257 }, { 149,4257 }, { 150,4257 },
+
+ { 151,4257 }, { 152,4257 }, { 153,4257 }, { 154,4257 }, { 155,4257 },
+ { 156,4257 }, { 157,4257 }, { 158,4257 }, { 159,4257 }, { 160,4257 },
+ { 161,4257 }, { 162,4257 }, { 163,4257 }, { 164,4257 }, { 165,4257 },
+ { 166,4257 }, { 167,4257 }, { 168,4257 }, { 169,4257 }, { 170,4257 },
+ { 171,4257 }, { 172,4257 }, { 173,4257 }, { 174,4257 }, { 175,4257 },
+ { 176,4257 }, { 177,4257 }, { 178,4257 }, { 179,4257 }, { 180,4257 },
+ { 181,4257 }, { 182,4257 }, { 183,4257 }, { 184,4257 }, { 185,4257 },
+ { 186,4257 }, { 187,4257 }, { 188,4257 }, { 189,4257 }, { 190,4257 },
+ { 191,4257 }, { 192,4257 }, { 193,4257 }, { 194,4257 }, { 195,4257 },
+ { 196,4257 }, { 197,4257 }, { 198,4257 }, { 199,4257 }, { 200,4257 },
+
+ { 201,4257 }, { 202,4257 }, { 203,4257 }, { 204,4257 }, { 205,4257 },
+ { 206,4257 }, { 207,4257 }, { 208,4257 }, { 209,4257 }, { 210,4257 },
+ { 211,4257 }, { 212,4257 }, { 213,4257 }, { 214,4257 }, { 215,4257 },
+ { 216,4257 }, { 217,4257 }, { 218,4257 }, { 219,4257 }, { 220,4257 },
+ { 221,4257 }, { 222,4257 }, { 223,4257 }, { 224,4257 }, { 225,4257 },
+ { 226,4257 }, { 227,4257 }, { 228,4257 }, { 229,4257 }, { 230,4257 },
+ { 231,4257 }, { 232,4257 }, { 233,4257 }, { 234,4257 }, { 235,4257 },
+ { 236,4257 }, { 237,4257 }, { 238,4257 }, { 239,4257 }, { 240,4257 },
+ { 241,4257 }, { 242,4257 }, { 243,4257 }, { 244,4257 }, { 245,4257 },
+ { 246,4257 }, { 247,4257 }, { 248,4257 }, { 249,4257 }, { 250,4257 },
+
+ { 251,4257 }, { 252,4257 }, { 253,4257 }, { 254,4257 }, { 255,4257 },
+ {   0,   1 }, {   0,24144 }, {   1,4257 }, {   2,4257 }, {   3,4257 },
+ {   4,4257 }, {   5,4257 }, {   6,4257 }, {   7,4257 }, {   8,4257 },
+ {   9,4257 }, {   0,   0 }, {  11,4257 }, {  12,4257 }, {   0,   0 },
+ {  14,4257 }, {  15,4257 }, {  16,4257 }, {  17,4257 }, {  18,4257 },
+ {  19,4257 }, {  20,4257 }, {  21,4257 }, {  22,4257 }, {  23,4257 },
+ {  24,4257 }, {  25,4257 }, {  26,4257 }, {  27,4257 }, {  28,4257 },
+ {  29,4257 }, {  30,4257 }, {  31,4257 }, {  32,4257 }, {  33,4515 },
+ {  34,4257 }, {  35,4515 }, {  36,4257 }, {  37,4515 }, {  38,4515 },
+ {  39,4257 }, {  40,4257 }, {  41,4257 }, {  42,4515 }, {  43,4515 },
+
+ {  44,4257 }, {  45,4515 }, {  46,4257 }, {  47,4515 }, {  48,4257 },
+ {  49,4257 }, {  50,4257 }, {  51,4257 }, {  52,4257 }, {  53,4257 },
+ {  54,4257 }, {  55,4257 }, {  56,4257 }, {  57,4257 }, {  58,4257 },
+ {  59,4257 }, {  60,4515 }, {  61,4515 }, {  62,4515 }, {  63,4515 },
+ {  64,4515 }, {  65,4257 }, {  66,4257 }, {  67,4257 }, {  68,4257 },
+ {  69,4257 }, {  70,4257 }, {  71,4257 }, {  72,4257 }, {  73,4257 },
+ {  74,4257 }, {  75,4257 }, {  76,4257 }, {  77,4257 }, {  78,4257 },
+ {  79,4257 }, {  80,4257 }, {  81,4257 }, {  82,4257 }, {  83,4257 },
+ {  84,4257 }, {  85,4257 }, {  86,4257 }, {  87,4257 }, {  88,4257 },
+ {  89,4257 }, {  90,4257 }, {  91,4257 }, {  92,4257 }, {  93,4257 },
+
+ {  94,4515 }, {  95,4257 }, {  96,4515 }, {  97,4257 }, {  98,4257 },
+ {  99,4257 }, { 100,4257 }, { 101,4257 }, { 102,4257 }, { 103,4257 },
+ { 104,4257 }, { 105,4257 }, { 106,4257 }, { 107,4257 }, { 108,4257 },
+ { 109,4257 }, { 110,4257 }, { 111,4257 }, { 112,4257 }, { 113,4257 },
+ { 114,4257 }, { 115,4257 }, { 116,4257 }, { 117,4257 }, { 118,4257 },
+ { 119,4257 }, { 120,4257 }, { 121,4257 }, { 122,4257 }, { 123,4257 },
+ { 124,4515 }, { 125,4257 }, { 126,4515 }, { 127,4257 }, { 128,4257 },
+ { 129,4257 }, { 130,4257 }, { 131,4257 }, { 132,4257 }, { 133,4257 },
+ { 134,4257 }, { 135,4257 }, { 136,4257 }, { 137,4257 }, { 138,4257 },
+ { 139,4257 }, { 140,4257 }, { 141,4257 }, { 142,4257 }, { 143,4257 },
+
+ { 144,4257 }, { 145,4257 }, { 146,4257 }, { 147,4257 }, { 148,4257 },
+ { 149,4257 }, { 150,4257 }, { 151,4257 }, { 152,4257 }, { 153,4257 },
+ { 154,4257 }, { 155,4257 }, { 156,4257 }, { 157,4257 }, { 158,4257 },
+ { 159,4257 }, { 160,4257 }, { 161,4257 }, { 162,4257 }, { 163,4257 },
+ { 164,4257 }, { 165,4257 }, { 166,4257 }, { 167,4257 }, { 168,4257 },
+ { 169,4257 }, { 170,4257 }, { 171,4257 }, { 172,4257 }, { 173,4257 },
+ { 174,4257 }, { 175,4257 }, { 176,4257 }, { 177,4257 }, { 178,4257 },
+ { 179,4257 }, { 180,4257 }, { 181,4257 }, { 182,4257 }, { 183,4257 },
+ { 184,4257 }, { 185,4257 }, { 186,4257 }, { 187,4257 }, { 188,4257 },
+ { 189,4257 }, { 190,4257 }, { 191,4257 }, { 192,4257 }, { 193,4257 },
+
+ { 194,4257 }, { 195,4257 }, { 196,4257 }, { 197,4257 }, { 198,4257 },
+ { 199,4257 }, { 200,4257 }, { 201,4257 }, { 202,4257 }, { 203,4257 },
+ { 204,4257 }, { 205,4257 }, { 206,4257 }, { 207,4257 }, { 208,4257 },
+ { 209,4257 }, { 210,4257 }, { 211,4257 }, { 212,4257 }, { 213,4257 },
+ { 214,4257 }, { 215,4257 }, { 216,4257 }, { 217,4257 }, { 218,4257 },
+ { 219,4257 }, { 220,4257 }, { 221,4257 }, { 222,4257 }, { 223,4257 },
+ { 224,4257 }, { 225,4257 }, { 226,4257 }, { 227,4257 }, { 228,4257 },
+ { 229,4257 }, { 230,4257 }, { 231,4257 }, { 232,4257 }, { 233,4257 },
+ { 234,4257 }, { 235,4257 }, { 236,4257 }, { 237,4257 }, { 238,4257 },
+ { 239,4257 }, { 240,4257 }, { 241,4257 }, { 242,4257 }, { 243,4257 },
+
+ { 244,4257 }, { 245,4257 }, { 246,4257 }, { 247,4257 }, { 248,4257 },
+ { 249,4257 }, { 250,4257 }, { 251,4257 }, { 252,4257 }, { 253,4257 },
+ { 254,4257 }, { 255,4257 }, { 256,4257 }, {   0,  73 }, {   0,23886 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   2 }, {   0,23861 },
+ {   0,  73 }, {   0,23859 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  48,   0 }, {  49,   0 }, {  50,   0 },
+ {  51,   0 }, {  52,   0 }, {  53,   0 }, {  54,   0 }, {  55,   0 },
+ {  56,   0 }, {  57,   0 }, {  33,4490 }, {   0,   0 }, {  35,4490 },
+ {   0,   0 }, {  37,4490 }, {  38,4490 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  42,4490 }, {  43,4490 }, {  69, 113 }, {  45,4490 },
+ {   0,   0 }, {  47,4490 }, {  46,-5624 }, {   0,   0 }, {  48,4490 },
+ {  49,4490 }, {  50,4490 }, {  51,4490 }, {  52,4490 }, {  53,4490 },
+ {  54,4490 }, {  55,4490 }, {  56,4490 }, {  57,4490 }, {  60,4490 },
+
+ {  61,4490 }, {  62,4490 }, {  63,4490 }, {  64,4490 }, {   0,  72 },
+ {   0,23795 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  69,  86 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ { 101, 113 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,  76 }, {   0,23773 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  94,4490 }, {   0,   0 },
+ {  96,4490 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, { 101,  86 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {  46, -64 }, {   0,   0 }, {  48,   0 }, {  49,   0 },
+ {  50,   0 }, {  51,   0 }, {  52,   0 }, {  53,   0 }, {  54,   0 },
+ {  55,   0 }, {  56,   0 }, {  57,   0 }, { 124,4490 }, {   0,   0 },
+ { 126,4490 }, {   0,  65 }, {   0,23733 }, {   0,   0 }, {   0,   0 },
+ {  43,4426 }, {   0,   0 }, {  45,4426 }, {   0,   0 }, {  69,  22 },
+ {  48,4468 }, {  49,4468 }, {  50,4468 }, {  51,4468 }, {  52,4468 },
+ {  53,4468 }, {  54,4468 }, {  55,4468 }, {  56,4468 }, {  57,4468 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {  33,-787 }, {   0,   0 }, {  35,-787 }, {   0,   0 }, {  37,-787 },
+ {  38,-787 }, { 101,  22 }, {   0,  67 }, {   0,23692 }, {  42,-787 },
+ {  43,-787 }, {   0,   0 }, {  45,-787 }, {   0,   0 }, {  47,-787 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  60,-787 }, {  61,-787 }, {  62,-787 },
+ {  63,-787 }, {  64,-787 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  33,-828 }, {   0,   0 }, {  35,-828 }, {   0,   0 },
+ {  37,-828 }, {  38,-828 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {  42,-828 }, {  43,-828 }, {   0,   0 }, {  45,-828 }, {   0,   0 },
+ {  47,-828 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  94,-787 }, {   0,   0 }, {  96,-787 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  60,-828 }, {  61,-828 },
+ {  62,-828 }, {  63,-828 }, {  64,-828 }, {   0,   0 }, {   0,  64 },
+ {   0,23625 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,  66 }, {   0,23614 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, { 124,-787 }, {   0,   0 }, { 126,-787 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {  94,-828 }, {   0,   0 }, {  96,-828 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  33,-895 }, {   0,   0 },
+ {  35,-895 }, {   0,   0 }, {  37,-895 }, {  38,-895 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  42,-895 }, {  43,-895 }, {  33,-906 },
+ {  45,-895 }, {  35,-906 }, {  47,-895 }, {  37,-906 }, {  38,-906 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  42,-906 }, {  43,-906 },
+ {   0,   0 }, {  45,-906 }, { 124,-828 }, {  47,-906 }, { 126,-828 },
+ {  60,-895 }, {  61,-895 }, {  62,-895 }, {  63,-895 }, {  64,-895 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  60,-906 }, {  61,-906 }, {  62,-906 }, {  63,-906 },
+
+ {  64,-906 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,  78 }, {   0,23534 }, {   0,   0 }, {   0,   0 }, {  94,-895 },
+ {   0,   0 }, {  96,-895 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  94,-906 }, {   0,   0 }, {  96,-906 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, { 124,-895 },
+
+ {   0,   0 }, { 126,-895 }, {  36,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ { 124,-906 }, {   0,   0 }, { 126,-906 }, {   0,   0 }, {  48,   0 },
+ {  49,   0 }, {  50,   0 }, {  51,   0 }, {  52,   0 }, {  53,   0 },
+ {  54,   0 }, {  55,   0 }, {  56,   0 }, {  57,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  63,-6357 },
+ {   0,   0 }, {  65,   0 }, {  66,   0 }, {  67,   0 }, {  68,   0 },
+ {  69,   0 }, {  70,   0 }, {  71,   0 }, {  72,   0 }, {  73,   0 },
+ {  74,   0 }, {  75,   0 }, {  76,   0 }, {  77,   0 }, {  78,   0 },
+ {  79,   0 }, {  80,   0 }, {  81,   0 }, {  82,   0 }, {  83,   0 },
+
+ {  84,   0 }, {  85,   0 }, {  86,   0 }, {  87,   0 }, {  88,   0 },
+ {  89,   0 }, {  90,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  95,   0 }, {   0,   0 }, {  97,   0 }, {  98,   0 },
+ {  99,   0 }, { 100,   0 }, { 101,   0 }, { 102,   0 }, { 103,   0 },
+ { 104,   0 }, { 105,   0 }, { 106,   0 }, { 107,   0 }, { 108,   0 },
+ { 109,   0 }, { 110,   0 }, { 111,   0 }, { 112,   0 }, { 113,   0 },
+ { 114,   0 }, { 115,   0 }, { 116,   0 }, { 117,   0 }, { 118,   0 },
+ { 119,   0 }, { 120,   0 }, { 121,   0 }, { 122,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, { 128,   0 },
+ { 129,   0 }, { 130,   0 }, { 131,   0 }, { 132,   0 }, { 133,   0 },
+
+ { 134,   0 }, { 135,   0 }, { 136,   0 }, { 137,   0 }, { 138,   0 },
+ { 139,   0 }, { 140,   0 }, { 141,   0 }, { 142,   0 }, { 143,   0 },
+ { 144,   0 }, { 145,   0 }, { 146,   0 }, { 147,   0 }, { 148,   0 },
+ { 149,   0 }, { 150,   0 }, { 151,   0 }, { 152,   0 }, { 153,   0 },
+ { 154,   0 }, { 155,   0 }, { 156,   0 }, { 157,   0 }, { 158,   0 },
+ { 159,   0 }, { 160,   0 }, { 161,   0 }, { 162,   0 }, { 163,   0 },
+ { 164,   0 }, { 165,   0 }, { 166,   0 }, { 167,   0 }, { 168,   0 },
+ { 169,   0 }, { 170,   0 }, { 171,   0 }, { 172,   0 }, { 173,   0 },
+ { 174,   0 }, { 175,   0 }, { 176,   0 }, { 177,   0 }, { 178,   0 },
+ { 179,   0 }, { 180,   0 }, { 181,   0 }, { 182,   0 }, { 183,   0 },
+
+ { 184,   0 }, { 185,   0 }, { 186,   0 }, { 187,   0 }, { 188,   0 },
+ { 189,   0 }, { 190,   0 }, { 191,   0 }, { 192,   0 }, { 193,   0 },
+ { 194,   0 }, { 195,   0 }, { 196,   0 }, { 197,   0 }, { 198,   0 },
+ { 199,   0 }, { 200,   0 }, { 201,   0 }, { 202,   0 }, { 203,   0 },
+ { 204,   0 }, { 205,   0 }, { 206,   0 }, { 207,   0 }, { 208,   0 },
+ { 209,   0 }, { 210,   0 }, { 211,   0 }, { 212,   0 }, { 213,   0 },
+ { 214,   0 }, { 215,   0 }, { 216,   0 }, { 217,   0 }, { 218,   0 },
+ { 219,   0 }, { 220,   0 }, { 221,   0 }, { 222,   0 }, { 223,   0 },
+ { 224,   0 }, { 225,   0 }, { 226,   0 }, { 227,   0 }, { 228,   0 },
+ { 229,   0 }, { 230,   0 }, { 231,   0 }, { 232,   0 }, { 233,   0 },
+
+ { 234,   0 }, { 235,   0 }, { 236,   0 }, { 237,   0 }, { 238,   0 },
+ { 239,   0 }, { 240,   0 }, { 241,   0 }, { 242,   0 }, { 243,   0 },
+ { 244,   0 }, { 245,   0 }, { 246,   0 }, { 247,   0 }, { 248,   0 },
+ { 249,   0 }, { 250,   0 }, { 251,   0 }, { 252,   0 }, { 253,   0 },
+ { 254,   0 }, { 255,   0 }, {   0,  12 }, {   0,23277 }, {   1,   0 },
+ {   2,   0 }, {   3,   0 }, {   4,   0 }, {   5,   0 }, {   6,   0 },
+ {   7,   0 }, {   8,   0 }, {   9,   0 }, {  10,   0 }, {  11,   0 },
+ {  12,   0 }, {  13,   0 }, {  14,   0 }, {  15,   0 }, {  16,   0 },
+ {  17,   0 }, {  18,   0 }, {  19,   0 }, {  20,   0 }, {  21,   0 },
+ {  22,   0 }, {  23,   0 }, {  24,   0 }, {  25,   0 }, {  26,   0 },
+
+ {  27,   0 }, {  28,   0 }, {  29,   0 }, {  30,   0 }, {  31,   0 },
+ {  32,   0 }, {  33,   0 }, {  34,   0 }, {  35,   0 }, {  36,   0 },
+ {  37,   0 }, {  38,   0 }, {   0,   0 }, {  40,   0 }, {  41,   0 },
+ {  42,   0 }, {  43,   0 }, {  44,   0 }, {  45,   0 }, {  46,   0 },
+ {  47,   0 }, {  48,   0 }, {  49,   0 }, {  50,   0 }, {  51,   0 },
+ {  52,   0 }, {  53,   0 }, {  54,   0 }, {  55,   0 }, {  56,   0 },
+ {  57,   0 }, {  58,   0 }, {  59,   0 }, {  60,   0 }, {  61,   0 },
+ {  62,   0 }, {  63,   0 }, {  64,   0 }, {  65,   0 }, {  66,   0 },
+ {  67,   0 }, {  68,   0 }, {  69,   0 }, {  70,   0 }, {  71,   0 },
+ {  72,   0 }, {  73,   0 }, {  74,   0 }, {  75,   0 }, {  76,   0 },
+
+ {  77,   0 }, {  78,   0 }, {  79,   0 }, {  80,   0 }, {  81,   0 },
+ {  82,   0 }, {  83,   0 }, {  84,   0 }, {  85,   0 }, {  86,   0 },
+ {  87,   0 }, {  88,   0 }, {  89,   0 }, {  90,   0 }, {  91,   0 },
+ {  92,   0 }, {  93,   0 }, {  94,   0 }, {  95,   0 }, {  96,   0 },
+ {  97,   0 }, {  98,   0 }, {  99,   0 }, { 100,   0 }, { 101,   0 },
+ { 102,   0 }, { 103,   0 }, { 104,   0 }, { 105,   0 }, { 106,   0 },
+ { 107,   0 }, { 108,   0 }, { 109,   0 }, { 110,   0 }, { 111,   0 },
+ { 112,   0 }, { 113,   0 }, { 114,   0 }, { 115,   0 }, { 116,   0 },
+ { 117,   0 }, { 118,   0 }, { 119,   0 }, { 120,   0 }, { 121,   0 },
+ { 122,   0 }, { 123,   0 }, { 124,   0 }, { 125,   0 }, { 126,   0 },
+
+ { 127,   0 }, { 128,   0 }, { 129,   0 }, { 130,   0 }, { 131,   0 },
+ { 132,   0 }, { 133,   0 }, { 134,   0 }, { 135,   0 }, { 136,   0 },
+ { 137,   0 }, { 138,   0 }, { 139,   0 }, { 140,   0 }, { 141,   0 },
+ { 142,   0 }, { 143,   0 }, { 144,   0 }, { 145,   0 }, { 146,   0 },
+ { 147,   0 }, { 148,   0 }, { 149,   0 }, { 150,   0 }, { 151,   0 },
+ { 152,   0 }, { 153,   0 }, { 154,   0 }, { 155,   0 }, { 156,   0 },
+ { 157,   0 }, { 158,   0 }, { 159,   0 }, { 160,   0 }, { 161,   0 },
+ { 162,   0 }, { 163,   0 }, { 164,   0 }, { 165,   0 }, { 166,   0 },
+ { 167,   0 }, { 168,   0 }, { 169,   0 }, { 170,   0 }, { 171,   0 },
+ { 172,   0 }, { 173,   0 }, { 174,   0 }, { 175,   0 }, { 176,   0 },
+
+ { 177,   0 }, { 178,   0 }, { 179,   0 }, { 180,   0 }, { 181,   0 },
+ { 182,   0 }, { 183,   0 }, { 184,   0 }, { 185,   0 }, { 186,   0 },
+ { 187,   0 }, { 188,   0 }, { 189,   0 }, { 190,   0 }, { 191,   0 },
+ { 192,   0 }, { 193,   0 }, { 194,   0 }, { 195,   0 }, { 196,   0 },
+ { 197,   0 }, { 198,   0 }, { 199,   0 }, { 200,   0 }, { 201,   0 },
+ { 202,   0 }, { 203,   0 }, { 204,   0 }, { 205,   0 }, { 206,   0 },
+ { 207,   0 }, { 208,   0 }, { 209,   0 }, { 210,   0 }, { 211,   0 },
+ { 212,   0 }, { 213,   0 }, { 214,   0 }, { 215,   0 }, { 216,   0 },
+ { 217,   0 }, { 218,   0 }, { 219,   0 }, { 220,   0 }, { 221,   0 },
+ { 222,   0 }, { 223,   0 }, { 224,   0 }, { 225,   0 }, { 226,   0 },
+
+ { 227,   0 }, { 228,   0 }, { 229,   0 }, { 230,   0 }, { 231,   0 },
+ { 232,   0 }, { 233,   0 }, { 234,   0 }, { 235,   0 }, { 236,   0 },
+ { 237,   0 }, { 238,   0 }, { 239,   0 }, { 240,   0 }, { 241,   0 },
+ { 242,   0 }, { 243,   0 }, { 244,   0 }, { 245,   0 }, { 246,   0 },
+ { 247,   0 }, { 248,   0 }, { 249,   0 }, { 250,   0 }, { 251,   0 },
+ { 252,   0 }, { 253,   0 }, { 254,   0 }, { 255,   0 }, { 256,   0 },
+ {   0,   9 }, {   0,23019 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   9 }, {   0,23014 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   9,   0 }, {  10,   5 }, {   0,   0 }, {  12,   0 }, {  13,   5 },
+ {   9,3741 }, {  10,3741 }, {   0,   0 }, {  12,3741 }, {  13,3741 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  32,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  32,3741 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  39,-6463 }, {  45,-6627 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  45,-6461 }, {   0,   5 }, {   0,22967 }, {   1,   0 },
+ {   2,   0 }, {   3,   0 }, {   4,   0 }, {   5,   0 }, {   6,   0 },
+ {   7,   0 }, {   8,   0 }, {   9,   0 }, {  10,   0 }, {  11,   0 },
+ {  12,   0 }, {  13,   0 }, {  14,   0 }, {  15,   0 }, {  16,   0 },
+
+ {  17,   0 }, {  18,   0 }, {  19,   0 }, {  20,   0 }, {  21,   0 },
+ {  22,   0 }, {  23,   0 }, {  24,   0 }, {  25,   0 }, {  26,   0 },
+ {  27,   0 }, {  28,   0 }, {  29,   0 }, {  30,   0 }, {  31,   0 },
+ {  32,   0 }, {  33,   0 }, {  34,   0 }, {  35,   0 }, {  36,   0 },
+ {  37,   0 }, {  38,   0 }, {  39,   0 }, {  40,   0 }, {  41,   0 },
+ {   0,   0 }, {  43,   0 }, {  44,   0 }, {  45,   0 }, {  46,   0 },
+ {   0,   0 }, {  48,   0 }, {  49,   0 }, {  50,   0 }, {  51,   0 },
+ {  52,   0 }, {  53,   0 }, {  54,   0 }, {  55,   0 }, {  56,   0 },
+ {  57,   0 }, {  58,   0 }, {  59,   0 }, {  60,   0 }, {  61,   0 },
+ {  62,   0 }, {  63,   0 }, {  64,   0 }, {  65,   0 }, {  66,   0 },
+
+ {  67,   0 }, {  68,   0 }, {  69,   0 }, {  70,   0 }, {  71,   0 },
+ {  72,   0 }, {  73,   0 }, {  74,   0 }, {  75,   0 }, {  76,   0 },
+ {  77,   0 }, {  78,   0 }, {  79,   0 }, {  80,   0 }, {  81,   0 },
+ {  82,   0 }, {  83,   0 }, {  84,   0 }, {  85,   0 }, {  86,   0 },
+ {  87,   0 }, {  88,   0 }, {  89,   0 }, {  90,   0 }, {  91,   0 },
+ {  92,   0 }, {  93,   0 }, {  94,   0 }, {  95,   0 }, {  96,   0 },
+ {  97,   0 }, {  98,   0 }, {  99,   0 }, { 100,   0 }, { 101,   0 },
+ { 102,   0 }, { 103,   0 }, { 104,   0 }, { 105,   0 }, { 106,   0 },
+ { 107,   0 }, { 108,   0 }, { 109,   0 }, { 110,   0 }, { 111,   0 },
+ { 112,   0 }, { 113,   0 }, { 114,   0 }, { 115,   0 }, { 116,   0 },
+
+ { 117,   0 }, { 118,   0 }, { 119,   0 }, { 120,   0 }, { 121,   0 },
+ { 122,   0 }, { 123,   0 }, { 124,   0 }, { 125,   0 }, { 126,   0 },
+ { 127,   0 }, { 128,   0 }, { 129,   0 }, { 130,   0 }, { 131,   0 },
+ { 132,   0 }, { 133,   0 }, { 134,   0 }, { 135,   0 }, { 136,   0 },
+ { 137,   0 }, { 138,   0 }, { 139,   0 }, { 140,   0 }, { 141,   0 },
+ { 142,   0 }, { 143,   0 }, { 144,   0 }, { 145,   0 }, { 146,   0 },
+ { 147,   0 }, { 148,   0 }, { 149,   0 }, { 150,   0 }, { 151,   0 },
+ { 152,   0 }, { 153,   0 }, { 154,   0 }, { 155,   0 }, { 156,   0 },
+ { 157,   0 }, { 158,   0 }, { 159,   0 }, { 160,   0 }, { 161,   0 },
+ { 162,   0 }, { 163,   0 }, { 164,   0 }, { 165,   0 }, { 166,   0 },
+
+ { 167,   0 }, { 168,   0 }, { 169,   0 }, { 170,   0 }, { 171,   0 },
+ { 172,   0 }, { 173,   0 }, { 174,   0 }, { 175,   0 }, { 176,   0 },
+ { 177,   0 }, { 178,   0 }, { 179,   0 }, { 180,   0 }, { 181,   0 },
+ { 182,   0 }, { 183,   0 }, { 184,   0 }, { 185,   0 }, { 186,   0 },
+ { 187,   0 }, { 188,   0 }, { 189,   0 }, { 190,   0 }, { 191,   0 },
+ { 192,   0 }, { 193,   0 }, { 194,   0 }, { 195,   0 }, { 196,   0 },
+ { 197,   0 }, { 198,   0 }, { 199,   0 }, { 200,   0 }, { 201,   0 },
+ { 202,   0 }, { 203,   0 }, { 204,   0 }, { 205,   0 }, { 206,   0 },
+ { 207,   0 }, { 208,   0 }, { 209,   0 }, { 210,   0 }, { 211,   0 },
+ { 212,   0 }, { 213,   0 }, { 214,   0 }, { 215,   0 }, { 216,   0 },
+
+ { 217,   0 }, { 218,   0 }, { 219,   0 }, { 220,   0 }, { 221,   0 },
+ { 222,   0 }, { 223,   0 }, { 224,   0 }, { 225,   0 }, { 226,   0 },
+ { 227,   0 }, { 228,   0 }, { 229,   0 }, { 230,   0 }, { 231,   0 },
+ { 232,   0 }, { 233,   0 }, { 234,   0 }, { 235,   0 }, { 236,   0 },
+ { 237,   0 }, { 238,   0 }, { 239,   0 }, { 240,   0 }, { 241,   0 },
+ { 242,   0 }, { 243,   0 }, { 244,   0 }, { 245,   0 }, { 246,   0 },
+ { 247,   0 }, { 248,   0 }, { 249,   0 }, { 250,   0 }, { 251,   0 },
+ { 252,   0 }, { 253,   0 }, { 254,   0 }, { 255,   0 }, { 256,   0 },
+ {   0,   3 }, {   0,22709 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  33,3741 },
+ {   0,   0 }, {  35,3741 }, {   0,   0 }, {  37,3741 }, {  38,3741 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  42,3741 }, {  43,3741 },
+ {   0,   0 }, {  45,3741 }, {   0,   0 }, {  47,3741 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {  60,3741 }, {  61,3741 }, {  62,3741 }, {  63,3741 },
+ {  64,3741 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  94,3741 }, {   0,   0 }, {  96,3741 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ { 124,3741 }, {   0,   0 }, { 126,3741 }, {   0,  58 }, {   0,22581 },
+ {   1,   0 }, {   2,   0 }, {   3,   0 }, {   4,   0 }, {   5,   0 },
+ {   6,   0 }, {   7,   0 }, {   8,   0 }, {   9,   0 }, {  10,   0 },
+ {  11,   0 }, {  12,   0 }, {  13,   0 }, {  14,   0 }, {  15,   0 },
+ {  16,   0 }, {  17,   0 }, {  18,   0 }, {  19,   0 }, {  20,   0 },
+ {  21,   0 }, {  22,   0 }, {  23,   0 }, {  24,   0 }, {  25,   0 },
+ {  26,   0 }, {  27,   0 }, {  28,   0 }, {  29,   0 }, {  30,   0 },
+
+ {  31,   0 }, {  32,   0 }, {  33,   0 }, {   0,   0 }, {  35,   0 },
+ {  36,   0 }, {  37,   0 }, {  38,   0 }, {  39,   0 }, {  40,   0 },
+ {  41,   0 }, {  42,   0 }, {  43,   0 }, {  44,   0 }, {  45,   0 },
+ {  46,   0 }, {  47,   0 }, {  48,   0 }, {  49,   0 }, {  50,   0 },
+ {  51,   0 }, {  52,   0 }, {  53,   0 }, {  54,   0 }, {  55,   0 },
+ {  56,   0 }, {  57,   0 }, {  58,   0 }, {  59,   0 }, {  60,   0 },
+ {  61,   0 }, {  62,   0 }, {  63,   0 }, {  64,   0 }, {  65,   0 },
+ {  66,   0 }, {  67,   0 }, {  68,   0 }, {  69,   0 }, {  70,   0 },
+ {  71,   0 }, {  72,   0 }, {  73,   0 }, {  74,   0 }, {  75,   0 },
+ {  76,   0 }, {  77,   0 }, {  78,   0 }, {  79,   0 }, {  80,   0 },
+
+ {  81,   0 }, {  82,   0 }, {  83,   0 }, {  84,   0 }, {  85,   0 },
+ {  86,   0 }, {  87,   0 }, {  88,   0 }, {  89,   0 }, {  90,   0 },
+ {  91,   0 }, {  92,   0 }, {  93,   0 }, {  94,   0 }, {  95,   0 },
+ {  96,   0 }, {  97,   0 }, {  98,   0 }, {  99,   0 }, { 100,   0 },
+ { 101,   0 }, { 102,   0 }, { 103,   0 }, { 104,   0 }, { 105,   0 },
+ { 106,   0 }, { 107,   0 }, { 108,   0 }, { 109,   0 }, { 110,   0 },
+ { 111,   0 }, { 112,   0 }, { 113,   0 }, { 114,   0 }, { 115,   0 },
+ { 116,   0 }, { 117,   0 }, { 118,   0 }, { 119,   0 }, { 120,   0 },
+ { 121,   0 }, { 122,   0 }, { 123,   0 }, { 124,   0 }, { 125,   0 },
+ { 126,   0 }, { 127,   0 }, { 128,   0 }, { 129,   0 }, { 130,   0 },
+
+ { 131,   0 }, { 132,   0 }, { 133,   0 }, { 134,   0 }, { 135,   0 },
+ { 136,   0 }, { 137,   0 }, { 138,   0 }, { 139,   0 }, { 140,   0 },
+ { 141,   0 }, { 142,   0 }, { 143,   0 }, { 144,   0 }, { 145,   0 },
+ { 146,   0 }, { 147,   0 }, { 148,   0 }, { 149,   0 }, { 150,   0 },
+ { 151,   0 }, { 152,   0 }, { 153,   0 }, { 154,   0 }, { 155,   0 },
+ { 156,   0 }, { 157,   0 }, { 158,   0 }, { 159,   0 }, { 160,   0 },
+ { 161,   0 }, { 162,   0 }, { 163,   0 }, { 164,   0 }, { 165,   0 },
+ { 166,   0 }, { 167,   0 }, { 168,   0 }, { 169,   0 }, { 170,   0 },
+ { 171,   0 }, { 172,   0 }, { 173,   0 }, { 174,   0 }, { 175,   0 },
+ { 176,   0 }, { 177,   0 }, { 178,   0 }, { 179,   0 }, { 180,   0 },
+
+ { 181,   0 }, { 182,   0 }, { 183,   0 }, { 184,   0 }, { 185,   0 },
+ { 186,   0 }, { 187,   0 }, { 188,   0 }, { 189,   0 }, { 190,   0 },
+ { 191,   0 }, { 192,   0 }, { 193,   0 }, { 194,   0 }, { 195,   0 },
+ { 196,   0 }, { 197,   0 }, { 198,   0 }, { 199,   0 }, { 200,   0 },
+ { 201,   0 }, { 202,   0 }, { 203,   0 }, { 204,   0 }, { 205,   0 },
+ { 206,   0 }, { 207,   0 }, { 208,   0 }, { 209,   0 }, { 210,   0 },
+ { 211,   0 }, { 212,   0 }, { 213,   0 }, { 214,   0 }, { 215,   0 },
+ { 216,   0 }, { 217,   0 }, { 218,   0 }, { 219,   0 }, { 220,   0 },
+ { 221,   0 }, { 222,   0 }, { 223,   0 }, { 224,   0 }, { 225,   0 },
+ { 226,   0 }, { 227,   0 }, { 228,   0 }, { 229,   0 }, { 230,   0 },
+
+ { 231,   0 }, { 232,   0 }, { 233,   0 }, { 234,   0 }, { 235,   0 },
+ { 236,   0 }, { 237,   0 }, { 238,   0 }, { 239,   0 }, { 240,   0 },
+ { 241,   0 }, { 242,   0 }, { 243,   0 }, { 244,   0 }, { 245,   0 },
+ { 246,   0 }, { 247,   0 }, { 248,   0 }, { 249,   0 }, { 250,   0 },
+ { 251,   0 }, { 252,   0 }, { 253,   0 }, { 254,   0 }, { 255,   0 },
+ { 256,   0 }, {   0,  11 }, {   0,22323 }, {   1,   0 }, {   2,   0 },
+ {   3,   0 }, {   4,   0 }, {   5,   0 }, {   6,   0 }, {   7,   0 },
+ {   8,   0 }, {   9,   0 }, {  10,   0 }, {  11,   0 }, {  12,   0 },
+ {  13,   0 }, {  14,   0 }, {  15,   0 }, {  16,   0 }, {  17,   0 },
+ {  18,   0 }, {  19,   0 }, {  20,   0 }, {  21,   0 }, {  22,   0 },
+
+ {  23,   0 }, {  24,   0 }, {  25,   0 }, {  26,   0 }, {  27,   0 },
+ {  28,   0 }, {  29,   0 }, {  30,   0 }, {  31,   0 }, {  32,   0 },
+ {  33,   0 }, {  34,   0 }, {  35,   0 }, {  36,   0 }, {  37,   0 },
+ {  38,   0 }, {   0,   0 }, {  40,   0 }, {  41,   0 }, {  42,   0 },
+ {  43,   0 }, {  44,   0 }, {  45,   0 }, {  46,   0 }, {  47,   0 },
+ {  48,   0 }, {  49,   0 }, {  50,   0 }, {  51,   0 }, {  52,   0 },
+ {  53,   0 }, {  54,   0 }, {  55,   0 }, {  56,   0 }, {  57,   0 },
+ {  58,   0 }, {  59,   0 }, {  60,   0 }, {  61,   0 }, {  62,   0 },
+ {  63,   0 }, {  64,   0 }, {  65,   0 }, {  66,   0 }, {  67,   0 },
+ {  68,   0 }, {  69,   0 }, {  70,   0 }, {  71,   0 }, {  72,   0 },
+
+ {  73,   0 }, {  74,   0 }, {  75,   0 }, {  76,   0 }, {  77,   0 },
+ {  78,   0 }, {  79,   0 }, {  80,   0 }, {  81,   0 }, {  82,   0 },
+ {  83,   0 }, {  84,   0 }, {  85,   0 }, {  86,   0 }, {  87,   0 },
+ {  88,   0 }, {  89,   0 }, {  90,   0 }, {  91,   0 }, {  92,   0 },
+ {  93,   0 }, {  94,   0 }, {  95,   0 }, {  96,   0 }, {  97,   0 },
+ {  98,   0 }, {  99,   0 }, { 100,   0 }, { 101,   0 }, { 102,   0 },
+ { 103,   0 }, { 104,   0 }, { 105,   0 }, { 106,   0 }, { 107,   0 },
+ { 108,   0 }, { 109,   0 }, { 110,   0 }, { 111,   0 }, { 112,   0 },
+ { 113,   0 }, { 114,   0 }, { 115,   0 }, { 116,   0 }, { 117,   0 },
+ { 118,   0 }, { 119,   0 }, { 120,   0 }, { 121,   0 }, { 122,   0 },
+
+ { 123,   0 }, { 124,   0 }, { 125,   0 }, { 126,   0 }, { 127,   0 },
+ { 128,   0 }, { 129,   0 }, { 130,   0 }, { 131,   0 }, { 132,   0 },
+ { 133,   0 }, { 134,   0 }, { 135,   0 }, { 136,   0 }, { 137,   0 },
+ { 138,   0 }, { 139,   0 }, { 140,   0 }, { 141,   0 }, { 142,   0 },
+ { 143,   0 }, { 144,   0 }, { 145,   0 }, { 146,   0 }, { 147,   0 },
+ { 148,   0 }, { 149,   0 }, { 150,   0 }, { 151,   0 }, { 152,   0 },
+ { 153,   0 }, { 154,   0 }, { 155,   0 }, { 156,   0 }, { 157,   0 },
+ { 158,   0 }, { 159,   0 }, { 160,   0 }, { 161,   0 }, { 162,   0 },
+ { 163,   0 }, { 164,   0 }, { 165,   0 }, { 166,   0 }, { 167,   0 },
+ { 168,   0 }, { 169,   0 }, { 170,   0 }, { 171,   0 }, { 172,   0 },
+
+ { 173,   0 }, { 174,   0 }, { 175,   0 }, { 176,   0 }, { 177,   0 },
+ { 178,   0 }, { 179,   0 }, { 180,   0 }, { 181,   0 }, { 182,   0 },
+ { 183,   0 }, { 184,   0 }, { 185,   0 }, { 186,   0 }, { 187,   0 },
+ { 188,   0 }, { 189,   0 }, { 190,   0 }, { 191,   0 }, { 192,   0 },
+ { 193,   0 }, { 194,   0 }, { 195,   0 }, { 196,   0 }, { 197,   0 },
+ { 198,   0 }, { 199,   0 }, { 200,   0 }, { 201,   0 }, { 202,   0 },
+ { 203,   0 }, { 204,   0 }, { 205,   0 }, { 206,   0 }, { 207,   0 },
+ { 208,   0 }, { 209,   0 }, { 210,   0 }, { 211,   0 }, { 212,   0 },
+ { 213,   0 }, { 214,   0 }, { 215,   0 }, { 216,   0 }, { 217,   0 },
+ { 218,   0 }, { 219,   0 }, { 220,   0 }, { 221,   0 }, { 222,   0 },
+
+ { 223,   0 }, { 224,   0 }, { 225,   0 }, { 226,   0 }, { 227,   0 },
+ { 228,   0 }, { 229,   0 }, { 230,   0 }, { 231,   0 }, { 232,   0 },
+ { 233,   0 }, { 234,   0 }, { 235,   0 }, { 236,   0 }, { 237,   0 },
+ { 238,   0 }, { 239,   0 }, { 240,   0 }, { 241,   0 }, { 242,   0 },
+ { 243,   0 }, { 244,   0 }, { 245,   0 }, { 246,   0 }, { 247,   0 },
+ { 248,   0 }, { 249,   0 }, { 250,   0 }, { 251,   0 }, { 252,   0 },
+ { 253,   0 }, { 254,   0 }, { 255,   0 }, { 256,   0 }, {   0,  16 },
+ {   0,22065 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,  16 },
+ {   0,22060 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   9,   0 },
+ {  10,   5 }, {   0,   0 }, {  12,   0 }, {  13,   5 }, {   9,3099 },
+
+ {  10,3099 }, {   0,   0 }, {  12,3099 }, {  13,3099 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  32,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  32,3099 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  39,-7413 },
+ {  45,-7481 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  45,-7408 }, {   0,  32 }, {   0,22013 }, {   1,   0 }, {   2,   0 },
+ {   3,   0 }, {   4,   0 }, {   5,   0 }, {   6,   0 }, {   7,   0 },
+ {   8,   0 }, {   9,   0 }, {  10,   0 }, {  11,   0 }, {  12,   0 },
+
+ {  13,   0 }, {  14,   0 }, {  15,   0 }, {  16,   0 }, {  17,   0 },
+ {  18,   0 }, {  19,   0 }, {  20,   0 }, {  21,   0 }, {  22,   0 },
+ {  23,   0 }, {  24,   0 }, {  25,   0 }, {  26,   0 }, {  27,   0 },
+ {  28,   0 }, {  29,   0 }, {  30,   0 }, {  31,   0 }, {  32,   0 },
+ {  33,   0 }, {  34,   0 }, {  35,   0 }, {  36,   0 }, {  37,   0 },
+ {  38,   0 }, {   0,   0 }, {  40,   0 }, {  41,   0 }, {  42,   0 },
+ {  43,   0 }, {  44,   0 }, {  45,   0 }, {  46,   0 }, {  47,   0 },
+ {  48,   0 }, {  49,   0 }, {  50,   0 }, {  51,   0 }, {  52,   0 },
+ {  53,   0 }, {  54,   0 }, {  55,   0 }, {  56,   0 }, {  57,   0 },
+ {  58,   0 }, {  59,   0 }, {  60,   0 }, {  61,   0 }, {  62,   0 },
+
+ {  63,   0 }, {  64,   0 }, {  65,   0 }, {  66,   0 }, {  67,   0 },
+ {  68,   0 }, {  69,   0 }, {  70,   0 }, {  71,   0 }, {  72,   0 },
+ {  73,   0 }, {  74,   0 }, {  75,   0 }, {  76,   0 }, {  77,   0 },
+ {  78,   0 }, {  79,   0 }, {  80,   0 }, {  81,   0 }, {  82,   0 },
+ {  83,   0 }, {  84,   0 }, {  85,   0 }, {  86,   0 }, {  87,   0 },
+ {  88,   0 }, {  89,   0 }, {  90,   0 }, {  91,   0 }, {   0,   0 },
+ {  93,   0 }, {  94,   0 }, {  95,   0 }, {  96,   0 }, {  97,   0 },
+ {  98,   0 }, {  99,   0 }, { 100,   0 }, { 101,   0 }, { 102,   0 },
+ { 103,   0 }, { 104,   0 }, { 105,   0 }, { 106,   0 }, { 107,   0 },
+ { 108,   0 }, { 109,   0 }, { 110,   0 }, { 111,   0 }, { 112,   0 },
+
+ { 113,   0 }, { 114,   0 }, { 115,   0 }, { 116,   0 }, { 117,   0 },
+ { 118,   0 }, { 119,   0 }, { 120,   0 }, { 121,   0 }, { 122,   0 },
+ { 123,   0 }, { 124,   0 }, { 125,   0 }, { 126,   0 }, { 127,   0 },
+ { 128,   0 }, { 129,   0 }, { 130,   0 }, { 131,   0 }, { 132,   0 },
+ { 133,   0 }, { 134,   0 }, { 135,   0 }, { 136,   0 }, { 137,   0 },
+ { 138,   0 }, { 139,   0 }, { 140,   0 }, { 141,   0 }, { 142,   0 },
+ { 143,   0 }, { 144,   0 }, { 145,   0 }, { 146,   0 }, { 147,   0 },
+ { 148,   0 }, { 149,   0 }, { 150,   0 }, { 151,   0 }, { 152,   0 },
+ { 153,   0 }, { 154,   0 }, { 155,   0 }, { 156,   0 }, { 157,   0 },
+ { 158,   0 }, { 159,   0 }, { 160,   0 }, { 161,   0 }, { 162,   0 },
+
+ { 163,   0 }, { 164,   0 }, { 165,   0 }, { 166,   0 }, { 167,   0 },
+ { 168,   0 }, { 169,   0 }, { 170,   0 }, { 171,   0 }, { 172,   0 },
+ { 173,   0 }, { 174,   0 }, { 175,   0 }, { 176,   0 }, { 177,   0 },
+ { 178,   0 }, { 179,   0 }, { 180,   0 }, { 181,   0 }, { 182,   0 },
+ { 183,   0 }, { 184,   0 }, { 185,   0 }, { 186,   0 }, { 187,   0 },
+ { 188,   0 }, { 189,   0 }, { 190,   0 }, { 191,   0 }, { 192,   0 },
+ { 193,   0 }, { 194,   0 }, { 195,   0 }, { 196,   0 }, { 197,   0 },
+ { 198,   0 }, { 199,   0 }, { 200,   0 }, { 201,   0 }, { 202,   0 },
+ { 203,   0 }, { 204,   0 }, { 205,   0 }, { 206,   0 }, { 207,   0 },
+ { 208,   0 }, { 209,   0 }, { 210,   0 }, { 211,   0 }, { 212,   0 },
+
+ { 213,   0 }, { 214,   0 }, { 215,   0 }, { 216,   0 }, { 217,   0 },
+ { 218,   0 }, { 219,   0 }, { 220,   0 }, { 221,   0 }, { 222,   0 },
+ { 223,   0 }, { 224,   0 }, { 225,   0 }, { 226,   0 }, { 227,   0 },
+ { 228,   0 }, { 229,   0 }, { 230,   0 }, { 231,   0 }, { 232,   0 },
+ { 233,   0 }, { 234,   0 }, { 235,   0 }, { 236,   0 }, { 237,   0 },
+ { 238,   0 }, { 239,   0 }, { 240,   0 }, { 241,   0 }, { 242,   0 },
+ { 243,   0 }, { 244,   0 }, { 245,   0 }, { 246,   0 }, { 247,   0 },
+ { 248,   0 }, { 249,   0 }, { 250,   0 }, { 251,   0 }, { 252,   0 },
+ { 253,   0 }, { 254,   0 }, { 255,   0 }, { 256,   0 }, {   0,  22 },
+ {   0,21755 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,  22 },
+
+ {   0,21750 }, {   0,  39 }, {   0,21748 }, {   0,   0 }, {   9,   0 },
+ {  10,   5 }, {   0,   0 }, {  12,   0 }, {  13,   5 }, {   9,3168 },
+ {  10,3168 }, {   0,   0 }, {  12,3168 }, {  13,3168 }, {   0,  37 },
+ {   0,21735 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  32,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  32,3168 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,  37 }, {   0,21712 }, {  39,-7709 },
+ {  45,-7784 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  45,-7682 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {  48,3471 }, {  49,3471 }, {  50,3471 }, {  51,3471 }, {  52,3471 },
+ {  53,3471 }, {  54,3471 }, {  55,3471 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  48,3466 }, {  49,3466 },
+ {  50,3466 }, {  51,3466 }, {  52,3466 }, {  53,3466 }, {  54,3466 },
+ {  55,3466 }, {  56,3466 }, {  57,3466 }, {   0,   0 }, {   0,   0 },
+ {   0,  38 }, {   0,21674 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  65,3466 }, {  66,3466 }, {  67,3466 }, {  68,3466 }, {  69,3466 },
+ {  70,3466 }, {  48,3466 }, {  49,3466 }, {  50,3466 }, {  51,3466 },
+ {  52,3466 }, {  53,3466 }, {  54,3466 }, {  55,3466 }, {  56,3466 },
+ {  57,3466 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  65,3466 }, {  66,3466 },
+ {  67,3466 }, {  68,3466 }, {  69,3466 }, {  70,3466 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  97,3466 }, {  98,3466 }, {  99,3466 },
+ { 100,3466 }, { 101,3466 }, { 102,3466 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  48,3466 },
+ {  49,3466 }, {  50,3466 }, {  51,3466 }, {  52,3466 }, {  53,3466 },
+ {  54,3466 }, {  55,3466 }, {  56,3466 }, {  57,3466 }, {   0,   0 },
+ {  97,3466 }, {  98,3466 }, {  99,3466 }, { 100,3466 }, { 101,3466 },
+ { 102,3466 }, {  65,3466 }, {  66,3466 }, {  67,3466 }, {  68,3466 },
+ {  69,3466 }, {  70,3466 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  97,3466 }, {  98,3466 },
+ {  99,3466 }, { 100,3466 }, { 101,3466 }, { 102,3466 }, {   0,  31 },
+ {   0,21570 }, {   1,   0 }, {   2,   0 }, {   3,   0 }, {   4,   0 },
+ {   5,   0 }, {   6,   0 }, {   7,   0 }, {   8,   0 }, {   9,   0 },
+ {  10,   0 }, {  11,   0 }, {  12,   0 }, {  13,   0 }, {  14,   0 },
+ {  15,   0 }, {  16,   0 }, {  17,   0 }, {  18,   0 }, {  19,   0 },
+
+ {  20,   0 }, {  21,   0 }, {  22,   0 }, {  23,   0 }, {  24,   0 },
+ {  25,   0 }, {  26,   0 }, {  27,   0 }, {  28,   0 }, {  29,   0 },
+ {  30,   0 }, {  31,   0 }, {  32,   0 }, {  33,   0 }, {  34,   0 },
+ {  35,   0 }, {  36,   0 }, {  37,   0 }, {  38,   0 }, {   0,   0 },
+ {  40,   0 }, {  41,   0 }, {  42,   0 }, {  43,   0 }, {  44,   0 },
+ {  45,   0 }, {  46,   0 }, {  47,   0 }, {  48,   0 }, {  49,   0 },
+ {  50,   0 }, {  51,   0 }, {  52,   0 }, {  53,   0 }, {  54,   0 },
+ {  55,   0 }, {  56,   0 }, {  57,   0 }, {  58,   0 }, {  59,   0 },
+ {  60,   0 }, {  61,   0 }, {  62,   0 }, {  63,   0 }, {  64,   0 },
+ {  65,   0 }, {  66,   0 }, {  67,   0 }, {  68,   0 }, {  69,   0 },
+
+ {  70,   0 }, {  71,   0 }, {  72,   0 }, {  73,   0 }, {  74,   0 },
+ {  75,   0 }, {  76,   0 }, {  77,   0 }, {  78,   0 }, {  79,   0 },
+ {  80,   0 }, {  81,   0 }, {  82,   0 }, {  83,   0 }, {  84,   0 },
+ {  85,   0 }, {  86,   0 }, {  87,   0 }, {  88,   0 }, {  89,   0 },
+ {  90,   0 }, {  91,   0 }, {  92,   0 }, {  93,   0 }, {  94,   0 },
+ {  95,   0 }, {  96,   0 }, {  97,   0 }, {  98,   0 }, {  99,   0 },
+ { 100,   0 }, { 101,   0 }, { 102,   0 }, { 103,   0 }, { 104,   0 },
+ { 105,   0 }, { 106,   0 }, { 107,   0 }, { 108,   0 }, { 109,   0 },
+ { 110,   0 }, { 111,   0 }, { 112,   0 }, { 113,   0 }, { 114,   0 },
+ { 115,   0 }, { 116,   0 }, { 117,   0 }, { 118,   0 }, { 119,   0 },
+
+ { 120,   0 }, { 121,   0 }, { 122,   0 }, { 123,   0 }, { 124,   0 },
+ { 125,   0 }, { 126,   0 }, { 127,   0 }, { 128,   0 }, { 129,   0 },
+ { 130,   0 }, { 131,   0 }, { 132,   0 }, { 133,   0 }, { 134,   0 },
+ { 135,   0 }, { 136,   0 }, { 137,   0 }, { 138,   0 }, { 139,   0 },
+ { 140,   0 }, { 141,   0 }, { 142,   0 }, { 143,   0 }, { 144,   0 },
+ { 145,   0 }, { 146,   0 }, { 147,   0 }, { 148,   0 }, { 149,   0 },
+ { 150,   0 }, { 151,   0 }, { 152,   0 }, { 153,   0 }, { 154,   0 },
+ { 155,   0 }, { 156,   0 }, { 157,   0 }, { 158,   0 }, { 159,   0 },
+ { 160,   0 }, { 161,   0 }, { 162,   0 }, { 163,   0 }, { 164,   0 },
+ { 165,   0 }, { 166,   0 }, { 167,   0 }, { 168,   0 }, { 169,   0 },
+
+ { 170,   0 }, { 171,   0 }, { 172,   0 }, { 173,   0 }, { 174,   0 },
+ { 175,   0 }, { 176,   0 }, { 177,   0 }, { 178,   0 }, { 179,   0 },
+ { 180,   0 }, { 181,   0 }, { 182,   0 }, { 183,   0 }, { 184,   0 },
+ { 185,   0 }, { 186,   0 }, { 187,   0 }, { 188,   0 }, { 189,   0 },
+ { 190,   0 }, { 191,   0 }, { 192,   0 }, { 193,   0 }, { 194,   0 },
+ { 195,   0 }, { 196,   0 }, { 197,   0 }, { 198,   0 }, { 199,   0 },
+ { 200,   0 }, { 201,   0 }, { 202,   0 }, { 203,   0 }, { 204,   0 },
+ { 205,   0 }, { 206,   0 }, { 207,   0 }, { 208,   0 }, { 209,   0 },
+ { 210,   0 }, { 211,   0 }, { 212,   0 }, { 213,   0 }, { 214,   0 },
+ { 215,   0 }, { 216,   0 }, { 217,   0 }, { 218,   0 }, { 219,   0 },
+
+ { 220,   0 }, { 221,   0 }, { 222,   0 }, { 223,   0 }, { 224,   0 },
+ { 225,   0 }, { 226,   0 }, { 227,   0 }, { 228,   0 }, { 229,   0 },
+ { 230,   0 }, { 231,   0 }, { 232,   0 }, { 233,   0 }, { 234,   0 },
+ { 235,   0 }, { 236,   0 }, { 237,   0 }, { 238,   0 }, { 239,   0 },
+ { 240,   0 }, { 241,   0 }, { 242,   0 }, { 243,   0 }, { 244,   0 },
+ { 245,   0 }, { 246,   0 }, { 247,   0 }, { 248,   0 }, { 249,   0 },
+ { 250,   0 }, { 251,   0 }, { 252,   0 }, { 253,   0 }, { 254,   0 },
+ { 255,   0 }, { 256,   0 }, {   0,  46 }, {   0,21312 }, {   1,   0 },
+ {   2,   0 }, {   3,   0 }, {   4,   0 }, {   5,   0 }, {   6,   0 },
+ {   7,   0 }, {   8,   0 }, {   9,   0 }, {  10,   0 }, {  11,   0 },
+
+ {  12,   0 }, {  13,   0 }, {  14,   0 }, {  15,   0 }, {  16,   0 },
+ {  17,   0 }, {  18,   0 }, {  19,   0 }, {  20,   0 }, {  21,   0 },
+ {  22,   0 }, {  23,   0 }, {  24,   0 }, {  25,   0 }, {  26,   0 },
+ {  27,   0 }, {  28,   0 }, {  29,   0 }, {  30,   0 }, {  31,   0 },
+ {  32,   0 }, {  33,   0 }, {  34,   0 }, {  35,   0 }, {   0,   0 },
+ {  37,   0 }, {  38,   0 }, {  39,   0 }, {  40,   0 }, {  41,   0 },
+ {  42,   0 }, {  43,   0 }, {  44,   0 }, {  45,   0 }, {  46,   0 },
+ {  47,   0 }, {  48,   0 }, {  49,   0 }, {  50,   0 }, {  51,   0 },
+ {  52,   0 }, {  53,   0 }, {  54,   0 }, {  55,   0 }, {  56,   0 },
+ {  57,   0 }, {  58,   0 }, {  59,   0 }, {  60,   0 }, {  61,   0 },
+
+ {  62,   0 }, {  63,   0 }, {  64,   0 }, {  65,   0 }, {  66,   0 },
+ {  67,   0 }, {  68,   0 }, {  69,   0 }, {  70,   0 }, {  71,   0 },
+ {  72,   0 }, {  73,   0 }, {  74,   0 }, {  75,   0 }, {  76,   0 },
+ {  77,   0 }, {  78,   0 }, {  79,   0 }, {  80,   0 }, {  81,   0 },
+ {  82,   0 }, {  83,   0 }, {  84,   0 }, {  85,   0 }, {  86,   0 },
+ {  87,   0 }, {  88,   0 }, {  89,   0 }, {  90,   0 }, {  91,   0 },
+ {  92,   0 }, {  93,   0 }, {  94,   0 }, {  95,   0 }, {  96,   0 },
+ {  97,   0 }, {  98,   0 }, {  99,   0 }, { 100,   0 }, { 101,   0 },
+ { 102,   0 }, { 103,   0 }, { 104,   0 }, { 105,   0 }, { 106,   0 },
+ { 107,   0 }, { 108,   0 }, { 109,   0 }, { 110,   0 }, { 111,   0 },
+
+ { 112,   0 }, { 113,   0 }, { 114,   0 }, { 115,   0 }, { 116,   0 },
+ { 117,   0 }, { 118,   0 }, { 119,   0 }, { 120,   0 }, { 121,   0 },
+ { 122,   0 }, { 123,   0 }, { 124,   0 }, { 125,   0 }, { 126,   0 },
+ { 127,   0 }, { 128,   0 }, { 129,   0 }, { 130,   0 }, { 131,   0 },
+ { 132,   0 }, { 133,   0 }, { 134,   0 }, { 135,   0 }, { 136,   0 },
+ { 137,   0 }, { 138,   0 }, { 139,   0 }, { 140,   0 }, { 141,   0 },
+ { 142,   0 }, { 143,   0 }, { 144,   0 }, { 145,   0 }, { 146,   0 },
+ { 147,   0 }, { 148,   0 }, { 149,   0 }, { 150,   0 }, { 151,   0 },
+ { 152,   0 }, { 153,   0 }, { 154,   0 }, { 155,   0 }, { 156,   0 },
+ { 157,   0 }, { 158,   0 }, { 159,   0 }, { 160,   0 }, { 161,   0 },
+
+ { 162,   0 }, { 163,   0 }, { 164,   0 }, { 165,   0 }, { 166,   0 },
+ { 167,   0 }, { 168,   0 }, { 169,   0 }, { 170,   0 }, { 171,   0 },
+ { 172,   0 }, { 173,   0 }, { 174,   0 }, { 175,   0 }, { 176,   0 },
+ { 177,   0 }, { 178,   0 }, { 179,   0 }, { 180,   0 }, { 181,   0 },
+ { 182,   0 }, { 183,   0 }, { 184,   0 }, { 185,   0 }, { 186,   0 },
+ { 187,   0 }, { 188,   0 }, { 189,   0 }, { 190,   0 }, { 191,   0 },
+ { 192,   0 }, { 193,   0 }, { 194,   0 }, { 195,   0 }, { 196,   0 },
+ { 197,   0 }, { 198,   0 }, { 199,   0 }, { 200,   0 }, { 201,   0 },
+ { 202,   0 }, { 203,   0 }, { 204,   0 }, { 205,   0 }, { 206,   0 },
+ { 207,   0 }, { 208,   0 }, { 209,   0 }, { 210,   0 }, { 211,   0 },
+
+ { 212,   0 }, { 213,   0 }, { 214,   0 }, { 215,   0 }, { 216,   0 },
+ { 217,   0 }, { 218,   0 }, { 219,   0 }, { 220,   0 }, { 221,   0 },
+ { 222,   0 }, { 223,   0 }, { 224,   0 }, { 225,   0 }, { 226,   0 },
+ { 227,   0 }, { 228,   0 }, { 229,   0 }, { 230,   0 }, { 231,   0 },
+ { 232,   0 }, { 233,   0 }, { 234,   0 }, { 235,   0 }, { 236,   0 },
+ { 237,   0 }, { 238,   0 }, { 239,   0 }, { 240,   0 }, { 241,   0 },
+ { 242,   0 }, { 243,   0 }, { 244,   0 }, { 245,   0 }, { 246,   0 },
+ { 247,   0 }, { 248,   0 }, { 249,   0 }, { 250,   0 }, { 251,   0 },
+ { 252,   0 }, { 253,   0 }, { 254,   0 }, { 255,   0 }, { 256,   0 },
+ {   0,  47 }, {   0,21054 }, {   0,  53 }, {   0,21052 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   9,   0 }, {  10,   0 }, {   0,   0 },
+ {  12,   0 }, {  13,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  32,   0 }, {   0,   0 }, {  36,-8481 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  48,2918 },
+ {  49,2918 }, {  50,2918 }, {  51,2918 }, {  52,2918 }, {  53,2918 },
+
+ {  54,2918 }, {  55,2918 }, {  56,2918 }, {  57,2918 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  65,2918 }, {  66,2918 }, {  67,2918 }, {  68,2918 },
+ {  69,2918 }, {  70,2918 }, {  71,2918 }, {  72,2918 }, {  73,2918 },
+ {  74,2918 }, {  75,2918 }, {  76,2918 }, {  77,2918 }, {  78,2918 },
+ {  79,2918 }, {  80,2918 }, {  81,2918 }, {  82,2918 }, {  83,2918 },
+ {  84,2918 }, {  85,2918 }, {  86,2918 }, {  87,2918 }, {  88,2918 },
+ {  89,2918 }, {  90,2918 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  95,2918 }, {   0,   0 }, {  97,2918 }, {  98,2918 },
+ {  99,2918 }, { 100,2918 }, { 101,2918 }, { 102,2918 }, { 103,2918 },
+
+ { 104,2918 }, { 105,2918 }, { 106,2918 }, { 107,2918 }, { 108,2918 },
+ { 109,2918 }, { 110,2918 }, { 111,2918 }, { 112,2918 }, { 113,2918 },
+ { 114,2918 }, { 115,2918 }, { 116,2918 }, { 117,2918 }, { 118,2918 },
+ { 119,2918 }, { 120,2918 }, { 121,2918 }, { 122,2918 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, { 128,2918 },
+ { 129,2918 }, { 130,2918 }, { 131,2918 }, { 132,2918 }, { 133,2918 },
+ { 134,2918 }, { 135,2918 }, { 136,2918 }, { 137,2918 }, { 138,2918 },
+ { 139,2918 }, { 140,2918 }, { 141,2918 }, { 142,2918 }, { 143,2918 },
+ { 144,2918 }, { 145,2918 }, { 146,2918 }, { 147,2918 }, { 148,2918 },
+ { 149,2918 }, { 150,2918 }, { 151,2918 }, { 152,2918 }, { 153,2918 },
+
+ { 154,2918 }, { 155,2918 }, { 156,2918 }, { 157,2918 }, { 158,2918 },
+ { 159,2918 }, { 160,2918 }, { 161,2918 }, { 162,2918 }, { 163,2918 },
+ { 164,2918 }, { 165,2918 }, { 166,2918 }, { 167,2918 }, { 168,2918 },
+ { 169,2918 }, { 170,2918 }, { 171,2918 }, { 172,2918 }, { 173,2918 },
+ { 174,2918 }, { 175,2918 }, { 176,2918 }, { 177,2918 }, { 178,2918 },
+ { 179,2918 }, { 180,2918 }, { 181,2918 }, { 182,2918 }, { 183,2918 },
+ { 184,2918 }, { 185,2918 }, { 186,2918 }, { 187,2918 }, { 188,2918 },
+ { 189,2918 }, { 190,2918 }, { 191,2918 }, { 192,2918 }, { 193,2918 },
+ { 194,2918 }, { 195,2918 }, { 196,2918 }, { 197,2918 }, { 198,2918 },
+ { 199,2918 }, { 200,2918 }, { 201,2918 }, { 202,2918 }, { 203,2918 },
+
+ { 204,2918 }, { 205,2918 }, { 206,2918 }, { 207,2918 }, { 208,2918 },
+ { 209,2918 }, { 210,2918 }, { 211,2918 }, { 212,2918 }, { 213,2918 },
+ { 214,2918 }, { 215,2918 }, { 216,2918 }, { 217,2918 }, { 218,2918 },
+ { 219,2918 }, { 220,2918 }, { 221,2918 }, { 222,2918 }, { 223,2918 },
+ { 224,2918 }, { 225,2918 }, { 226,2918 }, { 227,2918 }, { 228,2918 },
+ { 229,2918 }, { 230,2918 }, { 231,2918 }, { 232,2918 }, { 233,2918 },
+ { 234,2918 }, { 235,2918 }, { 236,2918 }, { 237,2918 }, { 238,2918 },
+ { 239,2918 }, { 240,2918 }, { 241,2918 }, { 242,2918 }, { 243,2918 },
+ { 244,2918 }, { 245,2918 }, { 246,2918 }, { 247,2918 }, { 248,2918 },
+ { 249,2918 }, { 250,2918 }, { 251,2918 }, { 252,2918 }, { 253,2918 },
+
+ { 254,2918 }, { 255,2918 }, {   0,  53 }, {   0,20797 }, {   1,2918 },
+ {   2,2918 }, {   3,2918 }, {   4,2918 }, {   5,2918 }, {   6,2918 },
+ {   7,2918 }, {   8,2918 }, {   9,2918 }, {   0,   0 }, {  11,2918 },
+ {  12,2918 }, {   0,   0 }, {  14,2918 }, {  15,2918 }, {  16,2918 },
+ {  17,2918 }, {  18,2918 }, {  19,2918 }, {  20,2918 }, {  21,2918 },
+ {  22,2918 }, {  23,2918 }, {  24,2918 }, {  25,2918 }, {  26,2918 },
+ {  27,2918 }, {  28,2918 }, {  29,2918 }, {  30,2918 }, {  31,2918 },
+ {  32,2918 }, {  33,2918 }, {  34,2918 }, {  35,2918 }, {  36,2918 },
+ {  37,2918 }, {  38,2918 }, {  39,2918 }, {  40,2918 }, {  41,2918 },
+ {  42,2918 }, {  43,2918 }, {  44,2918 }, {  45,2918 }, {  46,2918 },
+
+ {  47,2918 }, {  48,2918 }, {  49,2918 }, {  50,2918 }, {  51,2918 },
+ {  52,2918 }, {  53,2918 }, {  54,2918 }, {  55,2918 }, {  56,2918 },
+ {  57,2918 }, {  58,2918 }, {  59,2918 }, {  60,2918 }, {  61,2918 },
+ {  62,2918 }, {  63,2918 }, {  64,2918 }, {  65,2918 }, {  66,2918 },
+ {  67,2918 }, {  68,2918 }, {  69,2918 }, {  70,2918 }, {  71,2918 },
+ {  72,2918 }, {  73,2918 }, {  74,2918 }, {  75,2918 }, {  76,2918 },
+ {  77,2918 }, {  78,2918 }, {  79,2918 }, {  80,2918 }, {  81,2918 },
+ {  82,2918 }, {  83,2918 }, {  84,2918 }, {  85,2918 }, {  86,2918 },
+ {  87,2918 }, {  88,2918 }, {  89,2918 }, {  90,2918 }, {  91,2918 },
+ {  92,2918 }, {  93,2918 }, {  94,2918 }, {  95,2918 }, {  96,2918 },
+
+ {  97,2918 }, {  98,2918 }, {  99,2918 }, { 100,2918 }, { 101,2918 },
+ { 102,2918 }, { 103,2918 }, { 104,2918 }, { 105,2918 }, { 106,2918 },
+ { 107,2918 }, { 108,2918 }, { 109,2918 }, { 110,2918 }, { 111,2918 },
+ { 112,2918 }, { 113,2918 }, { 114,2918 }, { 115,2918 }, { 116,2918 },
+ { 117,2918 }, { 118,2918 }, { 119,2918 }, { 120,2918 }, { 121,2918 },
+ { 122,2918 }, { 123,2918 }, { 124,2918 }, { 125,2918 }, { 126,2918 },
+ { 127,2918 }, { 128,2918 }, { 129,2918 }, { 130,2918 }, { 131,2918 },
+ { 132,2918 }, { 133,2918 }, { 134,2918 }, { 135,2918 }, { 136,2918 },
+ { 137,2918 }, { 138,2918 }, { 139,2918 }, { 140,2918 }, { 141,2918 },
+ { 142,2918 }, { 143,2918 }, { 144,2918 }, { 145,2918 }, { 146,2918 },
+
+ { 147,2918 }, { 148,2918 }, { 149,2918 }, { 150,2918 }, { 151,2918 },
+ { 152,2918 }, { 153,2918 }, { 154,2918 }, { 155,2918 }, { 156,2918 },
+ { 157,2918 }, { 158,2918 }, { 159,2918 }, { 160,2918 }, { 161,2918 },
+ { 162,2918 }, { 163,2918 }, { 164,2918 }, { 165,2918 }, { 166,2918 },
+ { 167,2918 }, { 168,2918 }, { 169,2918 }, { 170,2918 }, { 171,2918 },
+ { 172,2918 }, { 173,2918 }, { 174,2918 }, { 175,2918 }, { 176,2918 },
+ { 177,2918 }, { 178,2918 }, { 179,2918 }, { 180,2918 }, { 181,2918 },
+ { 182,2918 }, { 183,2918 }, { 184,2918 }, { 185,2918 }, { 186,2918 },
+ { 187,2918 }, { 188,2918 }, { 189,2918 }, { 190,2918 }, { 191,2918 },
+ { 192,2918 }, { 193,2918 }, { 194,2918 }, { 195,2918 }, { 196,2918 },
+
+ { 197,2918 }, { 198,2918 }, { 199,2918 }, { 200,2918 }, { 201,2918 },
+ { 202,2918 }, { 203,2918 }, { 204,2918 }, { 205,2918 }, { 206,2918 },
+ { 207,2918 }, { 208,2918 }, { 209,2918 }, { 210,2918 }, { 211,2918 },
+ { 212,2918 }, { 213,2918 }, { 214,2918 }, { 215,2918 }, { 216,2918 },
+ { 217,2918 }, { 218,2918 }, { 219,2918 }, { 220,2918 }, { 221,2918 },
+ { 222,2918 }, { 223,2918 }, { 224,2918 }, { 225,2918 }, { 226,2918 },
+ { 227,2918 }, { 228,2918 }, { 229,2918 }, { 230,2918 }, { 231,2918 },
+ { 232,2918 }, { 233,2918 }, { 234,2918 }, { 235,2918 }, { 236,2918 },
+ { 237,2918 }, { 238,2918 }, { 239,2918 }, { 240,2918 }, { 241,2918 },
+ { 242,2918 }, { 243,2918 }, { 244,2918 }, { 245,2918 }, { 246,2918 },
+
+ { 247,2918 }, { 248,2918 }, { 249,2918 }, { 250,2918 }, { 251,2918 },
+ { 252,2918 }, { 253,2918 }, { 254,2918 }, { 255,2918 }, { 256,2918 },
+ {   0,  24 }, {   0,20539 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,  24 }, {   0,20534 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   9,   0 }, {  10,   5 }, {   0,   0 }, {  12,   0 }, {  13,   5 },
+ {   9,2913 }, {  10,2913 }, {   0,   0 }, {  12,2913 }, {  13,2913 },
+ {   0,   0 }, {   0,  26 }, {   0,20518 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   9,   0 }, {  10,   0 }, {  32,   0 }, {  12,   0 },
+ {  13,   0 }, {   0,   0 }, {   0,   0 }, {  32,2913 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  39,-8925 }, {  45,-8953 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  45,-8861 }, {   0,   0 }, {   0,   0 }, {  32,   0 },
+ {   0,  26 }, {   0,20484 }, {   1,3168 }, {   2,3168 }, {   3,3168 },
+ {   4,3168 }, {   5,3168 }, {   6,3168 }, {   7,3168 }, {   8,3168 },
+ {   9,3168 }, {   0,   0 }, {  11,3168 }, {  12,3168 }, {   0,   0 },
+ {  14,3168 }, {  15,3168 }, {  16,3168 }, {  17,3168 }, {  18,3168 },
+ {  19,3168 }, {  20,3168 }, {  21,3168 }, {  22,3168 }, {  23,3168 },
+ {  24,3168 }, {  25,3168 }, {  26,3168 }, {  27,3168 }, {  28,3168 },
+ {  29,3168 }, {  30,3168 }, {  31,3168 }, {  32,3168 }, {  33,3168 },
+
+ {  34,3168 }, {  35,3168 }, {  36,3168 }, {  37,3168 }, {  38,3168 },
+ {  39,3168 }, {  40,3168 }, {  41,3168 }, {  42,3168 }, {  43,3168 },
+ {  44,3168 }, {  45,3168 }, {  46,3168 }, {  47,3168 }, {  48,3168 },
+ {  49,3168 }, {  50,3168 }, {  51,3168 }, {  52,3168 }, {  53,3168 },
+ {  54,3168 }, {  55,3168 }, {  56,3168 }, {  57,3168 }, {  58,3168 },
+ {  59,3168 }, {  60,3168 }, {  61,3168 }, {  62,3168 }, {  63,3168 },
+ {  64,3168 }, {  65,3168 }, {  66,3168 }, {  67,3168 }, {  68,3168 },
+ {  69,3168 }, {  70,3168 }, {  71,3168 }, {  72,3168 }, {  73,3168 },
+ {  74,3168 }, {  75,3168 }, {  76,3168 }, {  77,3168 }, {  78,3168 },
+ {  79,3168 }, {  80,3168 }, {  81,3168 }, {  82,3168 }, {  83,3168 },
+
+ {  84,3168 }, {  85,3168 }, {  86,3168 }, {  87,3168 }, {  88,3168 },
+ {  89,3168 }, {  90,3168 }, {  91,3168 }, {  92,3168 }, {  93,3168 },
+ {  94,3168 }, {  95,3168 }, {  96,3168 }, {  97,3168 }, {  98,3168 },
+ {  99,3168 }, { 100,3168 }, { 101,3168 }, { 102,3168 }, { 103,3168 },
+ { 104,3168 }, { 105,3168 }, { 106,3168 }, { 107,3168 }, { 108,3168 },
+ { 109,3168 }, { 110,3168 }, { 111,3168 }, { 112,3168 }, { 113,3168 },
+ { 114,3168 }, { 115,3168 }, { 116,3168 }, { 117,3168 }, { 118,3168 },
+ { 119,3168 }, { 120,3168 }, { 121,3168 }, { 122,3168 }, { 123,3168 },
+ { 124,3168 }, { 125,3168 }, { 126,3168 }, { 127,3168 }, { 128,3168 },
+ { 129,3168 }, { 130,3168 }, { 131,3168 }, { 132,3168 }, { 133,3168 },
+
+ { 134,3168 }, { 135,3168 }, { 136,3168 }, { 137,3168 }, { 138,3168 },
+ { 139,3168 }, { 140,3168 }, { 141,3168 }, { 142,3168 }, { 143,3168 },
+ { 144,3168 }, { 145,3168 }, { 146,3168 }, { 147,3168 }, { 148,3168 },
+ { 149,3168 }, { 150,3168 }, { 151,3168 }, { 152,3168 }, { 153,3168 },
+ { 154,3168 }, { 155,3168 }, { 156,3168 }, { 157,3168 }, { 158,3168 },
+ { 159,3168 }, { 160,3168 }, { 161,3168 }, { 162,3168 }, { 163,3168 },
+ { 164,3168 }, { 165,3168 }, { 166,3168 }, { 167,3168 }, { 168,3168 },
+ { 169,3168 }, { 170,3168 }, { 171,3168 }, { 172,3168 }, { 173,3168 },
+ { 174,3168 }, { 175,3168 }, { 176,3168 }, { 177,3168 }, { 178,3168 },
+ { 179,3168 }, { 180,3168 }, { 181,3168 }, { 182,3168 }, { 183,3168 },
+
+ { 184,3168 }, { 185,3168 }, { 186,3168 }, { 187,3168 }, { 188,3168 },
+ { 189,3168 }, { 190,3168 }, { 191,3168 }, { 192,3168 }, { 193,3168 },
+ { 194,3168 }, { 195,3168 }, { 196,3168 }, { 197,3168 }, { 198,3168 },
+ { 199,3168 }, { 200,3168 }, { 201,3168 }, { 202,3168 }, { 203,3168 },
+ { 204,3168 }, { 205,3168 }, { 206,3168 }, { 207,3168 }, { 208,3168 },
+ { 209,3168 }, { 210,3168 }, { 211,3168 }, { 212,3168 }, { 213,3168 },
+ { 214,3168 }, { 215,3168 }, { 216,3168 }, { 217,3168 }, { 218,3168 },
+ { 219,3168 }, { 220,3168 }, { 221,3168 }, { 222,3168 }, { 223,3168 },
+ { 224,3168 }, { 225,3168 }, { 226,3168 }, { 227,3168 }, { 228,3168 },
+ { 229,3168 }, { 230,3168 }, { 231,3168 }, { 232,3168 }, { 233,3168 },
+
+ { 234,3168 }, { 235,3168 }, { 236,3168 }, { 237,3168 }, { 238,3168 },
+ { 239,3168 }, { 240,3168 }, { 241,3168 }, { 242,3168 }, { 243,3168 },
+ { 244,3168 }, { 245,3168 }, { 246,3168 }, { 247,3168 }, { 248,3168 },
+ { 249,3168 }, { 250,3168 }, { 251,3168 }, { 252,3168 }, { 253,3168 },
+ { 254,3168 }, { 255,3168 }, { 256,3168 }, {   0,  37 }, {   0,20226 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,  37 }, {   0,20203 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  48,3168 }, {  49,3168 }, {  50,3168 },
+ {  51,3168 }, {  52,3168 }, {  53,3168 }, {  54,3168 }, {  55,3168 },
+ {  56,3168 }, {  57,3168 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  65,3168 },
+ {  66,3168 }, {  67,3168 }, {  68,3168 }, {  69,3168 }, {  70,3168 },
+ {  48,3168 }, {  49,3168 }, {  50,3168 }, {  51,3168 }, {  52,3168 },
+
+ {  53,3168 }, {  54,3168 }, {  55,3168 }, {  56,3168 }, {  57,3168 },
+ {   0,  44 }, {   0,20144 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  65,3168 }, {  66,3168 }, {  67,3168 },
+ {  68,3168 }, {  69,3168 }, {  70,3168 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  97,3168 }, {  98,3168 }, {  99,3168 }, { 100,3168 },
+ { 101,3168 }, { 102,3168 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  36,-9772 }, {   0,   0 }, {  97,3168 },
+ {  98,3168 }, {  99,3168 }, { 100,3168 }, { 101,3168 }, { 102,3168 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  48,   0 },
+ {  49,   0 }, {  50,   0 }, {  51,   0 }, {  52,   0 }, {  53,   0 },
+ {  54,   0 }, {  55,   0 }, {  56,   0 }, {  57,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  65,   0 }, {  66,   0 }, {  67,   0 }, {  68,   0 },
+ {  69,   0 }, {  70,   0 }, {  71,   0 }, {  72,   0 }, {  73,   0 },
+ {  74,   0 }, {  75,   0 }, {  76,   0 }, {  77,   0 }, {  78,   0 },
+ {  79,   0 }, {  80,   0 }, {  81,   0 }, {  82,   0 }, {  83,   0 },
+ {  84,   0 }, {  85,   0 }, {  86,   0 }, {  87,   0 }, {  88,   0 },
+ {  89,   0 }, {  90,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {  95,   0 }, {   0,   0 }, {  97,   0 }, {  98,   0 },
+ {  99,   0 }, { 100,   0 }, { 101,   0 }, { 102,   0 }, { 103,   0 },
+ { 104,   0 }, { 105,   0 }, { 106,   0 }, { 107,   0 }, { 108,   0 },
+ { 109,   0 }, { 110,   0 }, { 111,   0 }, { 112,   0 }, { 113,   0 },
+ { 114,   0 }, { 115,   0 }, { 116,   0 }, { 117,   0 }, { 118,   0 },
+ { 119,   0 }, { 120,   0 }, { 121,   0 }, { 122,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, { 128,   0 },
+ { 129,   0 }, { 130,   0 }, { 131,   0 }, { 132,   0 }, { 133,   0 },
+ { 134,   0 }, { 135,   0 }, { 136,   0 }, { 137,   0 }, { 138,   0 },
+ { 139,   0 }, { 140,   0 }, { 141,   0 }, { 142,   0 }, { 143,   0 },
+
+ { 144,   0 }, { 145,   0 }, { 146,   0 }, { 147,   0 }, { 148,   0 },
+ { 149,   0 }, { 150,   0 }, { 151,   0 }, { 152,   0 }, { 153,   0 },
+ { 154,   0 }, { 155,   0 }, { 156,   0 }, { 157,   0 }, { 158,   0 },
+ { 159,   0 }, { 160,   0 }, { 161,   0 }, { 162,   0 }, { 163,   0 },
+ { 164,   0 }, { 165,   0 }, { 166,   0 }, { 167,   0 }, { 168,   0 },
+ { 169,   0 }, { 170,   0 }, { 171,   0 }, { 172,   0 }, { 173,   0 },
+ { 174,   0 }, { 175,   0 }, { 176,   0 }, { 177,   0 }, { 178,   0 },
+ { 179,   0 }, { 180,   0 }, { 181,   0 }, { 182,   0 }, { 183,   0 },
+ { 184,   0 }, { 185,   0 }, { 186,   0 }, { 187,   0 }, { 188,   0 },
+ { 189,   0 }, { 190,   0 }, { 191,   0 }, { 192,   0 }, { 193,   0 },
+
+ { 194,   0 }, { 195,   0 }, { 196,   0 }, { 197,   0 }, { 198,   0 },
+ { 199,   0 }, { 200,   0 }, { 201,   0 }, { 202,   0 }, { 203,   0 },
+ { 204,   0 }, { 205,   0 }, { 206,   0 }, { 207,   0 }, { 208,   0 },
+ { 209,   0 }, { 210,   0 }, { 211,   0 }, { 212,   0 }, { 213,   0 },
+ { 214,   0 }, { 215,   0 }, { 216,   0 }, { 217,   0 }, { 218,   0 },
+ { 219,   0 }, { 220,   0 }, { 221,   0 }, { 222,   0 }, { 223,   0 },
+ { 224,   0 }, { 225,   0 }, { 226,   0 }, { 227,   0 }, { 228,   0 },
+ { 229,   0 }, { 230,   0 }, { 231,   0 }, { 232,   0 }, { 233,   0 },
+ { 234,   0 }, { 235,   0 }, { 236,   0 }, { 237,   0 }, { 238,   0 },
+ { 239,   0 }, { 240,   0 }, { 241,   0 }, { 242,   0 }, { 243,   0 },
+
+ { 244,   0 }, { 245,   0 }, { 246,   0 }, { 247,   0 }, { 248,   0 },
+ { 249,   0 }, { 250,   0 }, { 251,   0 }, { 252,   0 }, { 253,   0 },
+ { 254,   0 }, { 255,   0 }, {   0,   1 }, {   0,19887 }, {   1,   0 },
+ {   2,   0 }, {   3,   0 }, {   4,   0 }, {   5,   0 }, {   6,   0 },
+ {   7,   0 }, {   8,   0 }, {   9,   0 }, {   0,   0 }, {  11,   0 },
+ {  12,   0 }, {   0,   0 }, {  14,   0 }, {  15,   0 }, {  16,   0 },
+ {  17,   0 }, {  18,   0 }, {  19,   0 }, {  20,   0 }, {  21,   0 },
+ {  22,   0 }, {  23,   0 }, {  24,   0 }, {  25,   0 }, {  26,   0 },
+ {  27,   0 }, {  28,   0 }, {  29,   0 }, {  30,   0 }, {  31,   0 },
+ {  32,   0 }, {  33,   0 }, {  34,   0 }, {  35,   0 }, {  36,   0 },
+
+ {  37,   0 }, {  38,   0 }, {  39,   0 }, {  40,   0 }, {  41,   0 },
+ {  42,   0 }, {  43,   0 }, {  44,   0 }, {  45,   0 }, {  46,   0 },
+ {  47,   0 }, {  48,   0 }, {  49,   0 }, {  50,   0 }, {  51,   0 },
+ {  52,   0 }, {  53,   0 }, {  54,   0 }, {  55,   0 }, {  56,   0 },
+ {  57,   0 }, {  58,   0 }, {  59,   0 }, {  60,   0 }, {  61,   0 },
+ {  62,   0 }, {  63,   0 }, {  64,   0 }, {  65,   0 }, {  66,   0 },
+ {  67,   0 }, {  68,   0 }, {  69,   0 }, {  70,   0 }, {  71,   0 },
+ {  72,   0 }, {  73,   0 }, {  74,   0 }, {  75,   0 }, {  76,   0 },
+ {  77,   0 }, {  78,   0 }, {  79,   0 }, {  80,   0 }, {  81,   0 },
+ {  82,   0 }, {  83,   0 }, {  84,   0 }, {  85,   0 }, {  86,   0 },
+
+ {  87,   0 }, {  88,   0 }, {  89,   0 }, {  90,   0 }, {  91,   0 },
+ {  92,   0 }, {  93,   0 }, {  94,   0 }, {  95,   0 }, {  96,   0 },
+ {  97,   0 }, {  98,   0 }, {  99,   0 }, { 100,   0 }, { 101,   0 },
+ { 102,   0 }, { 103,   0 }, { 104,   0 }, { 105,   0 }, { 106,   0 },
+ { 107,   0 }, { 108,   0 }, { 109,   0 }, { 110,   0 }, { 111,   0 },
+ { 112,   0 }, { 113,   0 }, { 114,   0 }, { 115,   0 }, { 116,   0 },
+ { 117,   0 }, { 118,   0 }, { 119,   0 }, { 120,   0 }, { 121,   0 },
+ { 122,   0 }, { 123,   0 }, { 124,   0 }, { 125,   0 }, { 126,   0 },
+ { 127,   0 }, { 128,   0 }, { 129,   0 }, { 130,   0 }, { 131,   0 },
+ { 132,   0 }, { 133,   0 }, { 134,   0 }, { 135,   0 }, { 136,   0 },
+
+ { 137,   0 }, { 138,   0 }, { 139,   0 }, { 140,   0 }, { 141,   0 },
+ { 142,   0 }, { 143,   0 }, { 144,   0 }, { 145,   0 }, { 146,   0 },
+ { 147,   0 }, { 148,   0 }, { 149,   0 }, { 150,   0 }, { 151,   0 },
+ { 152,   0 }, { 153,   0 }, { 154,   0 }, { 155,   0 }, { 156,   0 },
+ { 157,   0 }, { 158,   0 }, { 159,   0 }, { 160,   0 }, { 161,   0 },
+ { 162,   0 }, { 163,   0 }, { 164,   0 }, { 165,   0 }, { 166,   0 },
+ { 167,   0 }, { 168,   0 }, { 169,   0 }, { 170,   0 }, { 171,   0 },
+ { 172,   0 }, { 173,   0 }, { 174,   0 }, { 175,   0 }, { 176,   0 },
+ { 177,   0 }, { 178,   0 }, { 179,   0 }, { 180,   0 }, { 181,   0 },
+ { 182,   0 }, { 183,   0 }, { 184,   0 }, { 185,   0 }, { 186,   0 },
+
+ { 187,   0 }, { 188,   0 }, { 189,   0 }, { 190,   0 }, { 191,   0 },
+ { 192,   0 }, { 193,   0 }, { 194,   0 }, { 195,   0 }, { 196,   0 },
+ { 197,   0 }, { 198,   0 }, { 199,   0 }, { 200,   0 }, { 201,   0 },
+ { 202,   0 }, { 203,   0 }, { 204,   0 }, { 205,   0 }, { 206,   0 },
+ { 207,   0 }, { 208,   0 }, { 209,   0 }, { 210,   0 }, { 211,   0 },
+ { 212,   0 }, { 213,   0 }, { 214,   0 }, { 215,   0 }, { 216,   0 },
+ { 217,   0 }, { 218,   0 }, { 219,   0 }, { 220,   0 }, { 221,   0 },
+ { 222,   0 }, { 223,   0 }, { 224,   0 }, { 225,   0 }, { 226,   0 },
+ { 227,   0 }, { 228,   0 }, { 229,   0 }, { 230,   0 }, { 231,   0 },
+ { 232,   0 }, { 233,   0 }, { 234,   0 }, { 235,   0 }, { 236,   0 },
+
+ { 237,   0 }, { 238,   0 }, { 239,   0 }, { 240,   0 }, { 241,   0 },
+ { 242,   0 }, { 243,   0 }, { 244,   0 }, { 245,   0 }, { 246,   0 },
+ { 247,   0 }, { 248,   0 }, { 249,   0 }, { 250,   0 }, { 251,   0 },
+ { 252,   0 }, { 253,   0 }, { 254,   0 }, { 255,   0 }, { 256,   0 },
+ {   0,   1 }, {   0,19629 }, {   1,-258 }, {   2,-258 }, {   3,-258 },
+ {   4,-258 }, {   5,-258 }, {   6,-258 }, {   7,-258 }, {   8,-258 },
+ {   9,-258 }, {   0,   0 }, {  11,-258 }, {  12,-258 }, {   0,   0 },
+ {  14,-258 }, {  15,-258 }, {  16,-258 }, {  17,-258 }, {  18,-258 },
+ {  19,-258 }, {  20,-258 }, {  21,-258 }, {  22,-258 }, {  23,-258 },
+ {  24,-258 }, {  25,-258 }, {  26,-258 }, {  27,-258 }, {  28,-258 },
+
+ {  29,-258 }, {  30,-258 }, {  31,-258 }, {  32,-258 }, {  33,   0 },
+ {  34,-258 }, {  35,   0 }, {  36,-258 }, {  37,   0 }, {  38,   0 },
+ {  39,-258 }, {  40,-258 }, {  41,-258 }, {  42,   0 }, {  43,   0 },
+ {  44,-258 }, {  45,   0 }, {  46,-258 }, {  47,   0 }, {  48,-258 },
+ {  49,-258 }, {  50,-258 }, {  51,-258 }, {  52,-258 }, {  53,-258 },
+ {  54,-258 }, {  55,-258 }, {  56,-258 }, {  57,-258 }, {  58,-258 },
+ {  59,-258 }, {  60,   0 }, {  61,   0 }, {  62,   0 }, {  63,   0 },
+ {  64,   0 }, {  65,-258 }, {  66,-258 }, {  67,-258 }, {  68,-258 },
+ {  69,-258 }, {  70,-258 }, {  71,-258 }, {  72,-258 }, {  73,-258 },
+ {  74,-258 }, {  75,-258 }, {  76,-258 }, {  77,-258 }, {  78,-258 },
+
+ {  79,-258 }, {  80,-258 }, {  81,-258 }, {  82,-258 }, {  83,-258 },
+ {  84,-258 }, {  85,-258 }, {  86,-258 }, {  87,-258 }, {  88,-258 },
+ {  89,-258 }, {  90,-258 }, {  91,-258 }, {  92,-258 }, {  93,-258 },
+ {  94,   0 }, {  95,-258 }, {  96,   0 }, {  97,-258 }, {  98,-258 },
+ {  99,-258 }, { 100,-258 }, { 101,-258 }, { 102,-258 }, { 103,-258 },
+ { 104,-258 }, { 105,-258 }, { 106,-258 }, { 107,-258 }, { 108,-258 },
+ { 109,-258 }, { 110,-258 }, { 111,-258 }, { 112,-258 }, { 113,-258 },
+ { 114,-258 }, { 115,-258 }, { 116,-258 }, { 117,-258 }, { 118,-258 },
+ { 119,-258 }, { 120,-258 }, { 121,-258 }, { 122,-258 }, { 123,-258 },
+ { 124,   0 }, { 125,-258 }, { 126,   0 }, { 127,-258 }, { 128,-258 },
+
+ { 129,-258 }, { 130,-258 }, { 131,-258 }, { 132,-258 }, { 133,-258 },
+ { 134,-258 }, { 135,-258 }, { 136,-258 }, { 137,-258 }, { 138,-258 },
+ { 139,-258 }, { 140,-258 }, { 141,-258 }, { 142,-258 }, { 143,-258 },
+ { 144,-258 }, { 145,-258 }, { 146,-258 }, { 147,-258 }, { 148,-258 },
+ { 149,-258 }, { 150,-258 }, { 151,-258 }, { 152,-258 }, { 153,-258 },
+ { 154,-258 }, { 155,-258 }, { 156,-258 }, { 157,-258 }, { 158,-258 },
+ { 159,-258 }, { 160,-258 }, { 161,-258 }, { 162,-258 }, { 163,-258 },
+ { 164,-258 }, { 165,-258 }, { 166,-258 }, { 167,-258 }, { 168,-258 },
+ { 169,-258 }, { 170,-258 }, { 171,-258 }, { 172,-258 }, { 173,-258 },
+ { 174,-258 }, { 175,-258 }, { 176,-258 }, { 177,-258 }, { 178,-258 },
+
+ { 179,-258 }, { 180,-258 }, { 181,-258 }, { 182,-258 }, { 183,-258 },
+ { 184,-258 }, { 185,-258 }, { 186,-258 }, { 187,-258 }, { 188,-258 },
+ { 189,-258 }, { 190,-258 }, { 191,-258 }, { 192,-258 }, { 193,-258 },
+ { 194,-258 }, { 195,-258 }, { 196,-258 }, { 197,-258 }, { 198,-258 },
+ { 199,-258 }, { 200,-258 }, { 201,-258 }, { 202,-258 }, { 203,-258 },
+ { 204,-258 }, { 205,-258 }, { 206,-258 }, { 207,-258 }, { 208,-258 },
+ { 209,-258 }, { 210,-258 }, { 211,-258 }, { 212,-258 }, { 213,-258 },
+ { 214,-258 }, { 215,-258 }, { 216,-258 }, { 217,-258 }, { 218,-258 },
+ { 219,-258 }, { 220,-258 }, { 221,-258 }, { 222,-258 }, { 223,-258 },
+ { 224,-258 }, { 225,-258 }, { 226,-258 }, { 227,-258 }, { 228,-258 },
+
+ { 229,-258 }, { 230,-258 }, { 231,-258 }, { 232,-258 }, { 233,-258 },
+ { 234,-258 }, { 235,-258 }, { 236,-258 }, { 237,-258 }, { 238,-258 },
+ { 239,-258 }, { 240,-258 }, { 241,-258 }, { 242,-258 }, { 243,-258 },
+ { 244,-258 }, { 245,-258 }, { 246,-258 }, { 247,-258 }, { 248,-258 },
+ { 249,-258 }, { 250,-258 }, { 251,-258 }, { 252,-258 }, { 253,-258 },
+ { 254,-258 }, { 255,-258 }, { 256,-258 }, {   0,   2 }, {   0,19371 },
+ {   0,  73 }, {   0,19369 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,  77 }, {   0,19347 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  33,   0 }, {   0,   0 }, {  35,   0 },
+ {   0,   0 }, {  37,   0 }, {  38,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  42,   0 }, {  43,   0 }, {   0,   0 }, {  45,   0 },
+ {   0,   0 }, {  47,   0 }, {   0,   0 }, {   0,   0 }, {  48,   0 },
+ {  49,   0 }, {  50,   0 }, {  51,   0 }, {  52,   0 }, {  53,   0 },
+ {  54,   0 }, {  55,   0 }, {  56,   0 }, {  57,   0 }, {  60,   0 },
+ {  61,   0 }, {  62,   0 }, {  63,   0 }, {  64,   0 }, {   0,  75 },
+ {   0,19305 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {  69,-4404 }, {  48,  42 }, {  49,  42 }, {  50,  42 }, {  51,  42 },
+ {  52,  42 }, {  53,  42 }, {  54,  42 }, {  55,  42 }, {  56,  42 },
+ {  57,  42 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  94,   0 }, {   0,   0 },
+ {  96,   0 }, {   0,   9 }, {   0,19273 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, { 101,-4404 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   9,   0 }, {  10,   0 }, {   0,   0 }, {  12,   0 },
+ {  13,   0 }, {   0,   0 }, {   0,   0 }, {  48,   0 }, {  49,   0 },
+ {  50,   0 }, {  51,   0 }, {  52,   0 }, {  53,   0 }, {  54,   0 },
+
+ {  55,   0 }, {  56,   0 }, {  57,   0 }, { 124,   0 }, {   0,   0 },
+ { 126,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  32,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  39,-10204 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  45,-10202 }, {   0,   9 }, {   0,19226 },
+ {   1,2553 }, {   2,2553 }, {   3,2553 }, {   4,2553 }, {   5,2553 },
+ {   6,2553 }, {   7,2553 }, {   8,2553 }, {   9,2811 }, {  10,-3788 },
+ {  11,2553 }, {  12,2811 }, {  13,-3788 }, {  14,2553 }, {  15,2553 },
+ {  16,2553 }, {  17,2553 }, {  18,2553 }, {  19,2553 }, {  20,2553 },
+ {  21,2553 }, {  22,2553 }, {  23,2553 }, {  24,2553 }, {  25,2553 },
+
+ {  26,2553 }, {  27,2553 }, {  28,2553 }, {  29,2553 }, {  30,2553 },
+ {  31,2553 }, {  32,2811 }, {  33,2553 }, {  34,2553 }, {  35,2553 },
+ {  36,2553 }, {  37,2553 }, {  38,2553 }, {  39,2553 }, {  40,2553 },
+ {  41,2553 }, {  42,2553 }, {  43,2553 }, {  44,2553 }, {  45,3069 },
+ {  46,2553 }, {  47,2553 }, {  48,2553 }, {  49,2553 }, {  50,2553 },
+ {  51,2553 }, {  52,2553 }, {  53,2553 }, {  54,2553 }, {  55,2553 },
+ {  56,2553 }, {  57,2553 }, {  58,2553 }, {  59,2553 }, {  60,2553 },
+ {  61,2553 }, {  62,2553 }, {  63,2553 }, {  64,2553 }, {  65,2553 },
+ {  66,2553 }, {  67,2553 }, {  68,2553 }, {  69,2553 }, {  70,2553 },
+ {  71,2553 }, {  72,2553 }, {  73,2553 }, {  74,2553 }, {  75,2553 },
+
+ {  76,2553 }, {  77,2553 }, {  78,2553 }, {  79,2553 }, {  80,2553 },
+ {  81,2553 }, {  82,2553 }, {  83,2553 }, {  84,2553 }, {  85,2553 },
+ {  86,2553 }, {  87,2553 }, {  88,2553 }, {  89,2553 }, {  90,2553 },
+ {  91,2553 }, {  92,2553 }, {  93,2553 }, {  94,2553 }, {  95,2553 },
+ {  96,2553 }, {  97,2553 }, {  98,2553 }, {  99,2553 }, { 100,2553 },
+ { 101,2553 }, { 102,2553 }, { 103,2553 }, { 104,2553 }, { 105,2553 },
+ { 106,2553 }, { 107,2553 }, { 108,2553 }, { 109,2553 }, { 110,2553 },
+ { 111,2553 }, { 112,2553 }, { 113,2553 }, { 114,2553 }, { 115,2553 },
+ { 116,2553 }, { 117,2553 }, { 118,2553 }, { 119,2553 }, { 120,2553 },
+ { 121,2553 }, { 122,2553 }, { 123,2553 }, { 124,2553 }, { 125,2553 },
+
+ { 126,2553 }, { 127,2553 }, { 128,2553 }, { 129,2553 }, { 130,2553 },
+ { 131,2553 }, { 132,2553 }, { 133,2553 }, { 134,2553 }, { 135,2553 },
+ { 136,2553 }, { 137,2553 }, { 138,2553 }, { 139,2553 }, { 140,2553 },
+ { 141,2553 }, { 142,2553 }, { 143,2553 }, { 144,2553 }, { 145,2553 },
+ { 146,2553 }, { 147,2553 }, { 148,2553 }, { 149,2553 }, { 150,2553 },
+ { 151,2553 }, { 152,2553 }, { 153,2553 }, { 154,2553 }, { 155,2553 },
+ { 156,2553 }, { 157,2553 }, { 158,2553 }, { 159,2553 }, { 160,2553 },
+ { 161,2553 }, { 162,2553 }, { 163,2553 }, { 164,2553 }, { 165,2553 },
+ { 166,2553 }, { 167,2553 }, { 168,2553 }, { 169,2553 }, { 170,2553 },
+ { 171,2553 }, { 172,2553 }, { 173,2553 }, { 174,2553 }, { 175,2553 },
+
+ { 176,2553 }, { 177,2553 }, { 178,2553 }, { 179,2553 }, { 180,2553 },
+ { 181,2553 }, { 182,2553 }, { 183,2553 }, { 184,2553 }, { 185,2553 },
+ { 186,2553 }, { 187,2553 }, { 188,2553 }, { 189,2553 }, { 190,2553 },
+ { 191,2553 }, { 192,2553 }, { 193,2553 }, { 194,2553 }, { 195,2553 },
+ { 196,2553 }, { 197,2553 }, { 198,2553 }, { 199,2553 }, { 200,2553 },
+ { 201,2553 }, { 202,2553 }, { 203,2553 }, { 204,2553 }, { 205,2553 },
+ { 206,2553 }, { 207,2553 }, { 208,2553 }, { 209,2553 }, { 210,2553 },
+ { 211,2553 }, { 212,2553 }, { 213,2553 }, { 214,2553 }, { 215,2553 },
+ { 216,2553 }, { 217,2553 }, { 218,2553 }, { 219,2553 }, { 220,2553 },
+ { 221,2553 }, { 222,2553 }, { 223,2553 }, { 224,2553 }, { 225,2553 },
+
+ { 226,2553 }, { 227,2553 }, { 228,2553 }, { 229,2553 }, { 230,2553 },
+ { 231,2553 }, { 232,2553 }, { 233,2553 }, { 234,2553 }, { 235,2553 },
+ { 236,2553 }, { 237,2553 }, { 238,2553 }, { 239,2553 }, { 240,2553 },
+ { 241,2553 }, { 242,2553 }, { 243,2553 }, { 244,2553 }, { 245,2553 },
+ { 246,2553 }, { 247,2553 }, { 248,2553 }, { 249,2553 }, { 250,2553 },
+ { 251,2553 }, { 252,2553 }, { 253,2553 }, { 254,2553 }, { 255,2553 },
+ { 256,2553 }, {   0,   3 }, {   0,18968 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,  16 }, {   0,18961 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   9,   0 }, {  10,   0 },
+
+ {   0,   0 }, {  12,   0 }, {  13,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  33,   0 }, {   0,   0 }, {  35,   0 }, {   0,   0 }, {  37,   0 },
+ {  38,   0 }, {  32,   0 }, {   0,   0 }, {   0,   0 }, {  42,   0 },
+ {  43,   0 }, {   0,   0 }, {  45,   0 }, {  39,-10512 }, {  47,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  45,-10507 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  60,   0 }, {  61,   0 }, {  62,   0 },
+ {  63,   0 }, {  64,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  94,   0 }, {   0,   0 }, {  96,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, { 124,   0 }, {   0,   0 }, { 126,   0 }, {   0,  16 },
+ {   0,18840 }, {   1,3199 }, {   2,3199 }, {   3,3199 }, {   4,3199 },
+ {   5,3199 }, {   6,3199 }, {   7,3199 }, {   8,3199 }, {   9,3457 },
+ {  10,-3220 }, {  11,3199 }, {  12,3457 }, {  13,-3220 }, {  14,3199 },
+ {  15,3199 }, {  16,3199 }, {  17,3199 }, {  18,3199 }, {  19,3199 },
+ {  20,3199 }, {  21,3199 }, {  22,3199 }, {  23,3199 }, {  24,3199 },
+ {  25,3199 }, {  26,3199 }, {  27,3199 }, {  28,3199 }, {  29,3199 },
+ {  30,3199 }, {  31,3199 }, {  32,3457 }, {  33,3199 }, {  34,3199 },
+ {  35,3199 }, {  36,3199 }, {  37,3199 }, {  38,3199 }, {  39,3199 },
+
+ {  40,3199 }, {  41,3199 }, {  42,3199 }, {  43,3199 }, {  44,3199 },
+ {  45,3715 }, {  46,3199 }, {  47,3199 }, {  48,3199 }, {  49,3199 },
+ {  50,3199 }, {  51,3199 }, {  52,3199 }, {  53,3199 }, {  54,3199 },
+ {  55,3199 }, {  56,3199 }, {  57,3199 }, {  58,3199 }, {  59,3199 },
+ {  60,3199 }, {  61,3199 }, {  62,3199 }, {  63,3199 }, {  64,3199 },
+ {  65,3199 }, {  66,3199 }, {  67,3199 }, {  68,3199 }, {  69,3199 },
+ {  70,3199 }, {  71,3199 }, {  72,3199 }, {  73,3199 }, {  74,3199 },
+ {  75,3199 }, {  76,3199 }, {  77,3199 }, {  78,3199 }, {  79,3199 },
+ {  80,3199 }, {  81,3199 }, {  82,3199 }, {  83,3199 }, {  84,3199 },
+ {  85,3199 }, {  86,3199 }, {  87,3199 }, {  88,3199 }, {  89,3199 },
+
+ {  90,3199 }, {  91,3199 }, {  92,3199 }, {  93,3199 }, {  94,3199 },
+ {  95,3199 }, {  96,3199 }, {  97,3199 }, {  98,3199 }, {  99,3199 },
+ { 100,3199 }, { 101,3199 }, { 102,3199 }, { 103,3199 }, { 104,3199 },
+ { 105,3199 }, { 106,3199 }, { 107,3199 }, { 108,3199 }, { 109,3199 },
+ { 110,3199 }, { 111,3199 }, { 112,3199 }, { 113,3199 }, { 114,3199 },
+ { 115,3199 }, { 116,3199 }, { 117,3199 }, { 118,3199 }, { 119,3199 },
+ { 120,3199 }, { 121,3199 }, { 122,3199 }, { 123,3199 }, { 124,3199 },
+ { 125,3199 }, { 126,3199 }, { 127,3199 }, { 128,3199 }, { 129,3199 },
+ { 130,3199 }, { 131,3199 }, { 132,3199 }, { 133,3199 }, { 134,3199 },
+ { 135,3199 }, { 136,3199 }, { 137,3199 }, { 138,3199 }, { 139,3199 },
+
+ { 140,3199 }, { 141,3199 }, { 142,3199 }, { 143,3199 }, { 144,3199 },
+ { 145,3199 }, { 146,3199 }, { 147,3199 }, { 148,3199 }, { 149,3199 },
+ { 150,3199 }, { 151,3199 }, { 152,3199 }, { 153,3199 }, { 154,3199 },
+ { 155,3199 }, { 156,3199 }, { 157,3199 }, { 158,3199 }, { 159,3199 },
+ { 160,3199 }, { 161,3199 }, { 162,3199 }, { 163,3199 }, { 164,3199 },
+ { 165,3199 }, { 166,3199 }, { 167,3199 }, { 168,3199 }, { 169,3199 },
+ { 170,3199 }, { 171,3199 }, { 172,3199 }, { 173,3199 }, { 174,3199 },
+ { 175,3199 }, { 176,3199 }, { 177,3199 }, { 178,3199 }, { 179,3199 },
+ { 180,3199 }, { 181,3199 }, { 182,3199 }, { 183,3199 }, { 184,3199 },
+ { 185,3199 }, { 186,3199 }, { 187,3199 }, { 188,3199 }, { 189,3199 },
+
+ { 190,3199 }, { 191,3199 }, { 192,3199 }, { 193,3199 }, { 194,3199 },
+ { 195,3199 }, { 196,3199 }, { 197,3199 }, { 198,3199 }, { 199,3199 },
+ { 200,3199 }, { 201,3199 }, { 202,3199 }, { 203,3199 }, { 204,3199 },
+ { 205,3199 }, { 206,3199 }, { 207,3199 }, { 208,3199 }, { 209,3199 },
+ { 210,3199 }, { 211,3199 }, { 212,3199 }, { 213,3199 }, { 214,3199 },
+ { 215,3199 }, { 216,3199 }, { 217,3199 }, { 218,3199 }, { 219,3199 },
+ { 220,3199 }, { 221,3199 }, { 222,3199 }, { 223,3199 }, { 224,3199 },
+ { 225,3199 }, { 226,3199 }, { 227,3199 }, { 228,3199 }, { 229,3199 },
+ { 230,3199 }, { 231,3199 }, { 232,3199 }, { 233,3199 }, { 234,3199 },
+ { 235,3199 }, { 236,3199 }, { 237,3199 }, { 238,3199 }, { 239,3199 },
+
+ { 240,3199 }, { 241,3199 }, { 242,3199 }, { 243,3199 }, { 244,3199 },
+ { 245,3199 }, { 246,3199 }, { 247,3199 }, { 248,3199 }, { 249,3199 },
+ { 250,3199 }, { 251,3199 }, { 252,3199 }, { 253,3199 }, { 254,3199 },
+ { 255,3199 }, { 256,3199 }, {   0,  22 }, {   0,18582 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   9,   0 }, {  10,   0 }, {   0,   0 },
+ {  12,   0 }, {  13,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {  32,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  39,-10877 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  45,-10850 }, {   0,  22 },
+ {   0,18535 }, {   1,3926 }, {   2,3926 }, {   3,3926 }, {   4,3926 },
+ {   5,3926 }, {   6,3926 }, {   7,3926 }, {   8,3926 }, {   9,4184 },
+ {  10,-3215 }, {  11,3926 }, {  12,4184 }, {  13,-3215 }, {  14,3926 },
+ {  15,3926 }, {  16,3926 }, {  17,3926 }, {  18,3926 }, {  19,3926 },
+ {  20,3926 }, {  21,3926 }, {  22,3926 }, {  23,3926 }, {  24,3926 },
+ {  25,3926 }, {  26,3926 }, {  27,3926 }, {  28,3926 }, {  29,3926 },
+ {  30,3926 }, {  31,3926 }, {  32,4184 }, {  33,3926 }, {  34,3926 },
+
+ {  35,3926 }, {  36,3926 }, {  37,3926 }, {  38,3926 }, {  39,3926 },
+ {  40,3926 }, {  41,3926 }, {  42,3926 }, {  43,3926 }, {  44,3926 },
+ {  45,4442 }, {  46,3926 }, {  47,3926 }, {  48,3926 }, {  49,3926 },
+ {  50,3926 }, {  51,3926 }, {  52,3926 }, {  53,3926 }, {  54,3926 },
+ {  55,3926 }, {  56,3926 }, {  57,3926 }, {  58,3926 }, {  59,3926 },
+ {  60,3926 }, {  61,3926 }, {  62,3926 }, {  63,3926 }, {  64,3926 },
+ {  65,3926 }, {  66,3926 }, {  67,3926 }, {  68,3926 }, {  69,3926 },
+ {  70,3926 }, {  71,3926 }, {  72,3926 }, {  73,3926 }, {  74,3926 },
+ {  75,3926 }, {  76,3926 }, {  77,3926 }, {  78,3926 }, {  79,3926 },
+ {  80,3926 }, {  81,3926 }, {  82,3926 }, {  83,3926 }, {  84,3926 },
+
+ {  85,3926 }, {  86,3926 }, {  87,3926 }, {  88,3926 }, {  89,3926 },
+ {  90,3926 }, {  91,3926 }, {  92,3926 }, {  93,3926 }, {  94,3926 },
+ {  95,3926 }, {  96,3926 }, {  97,3926 }, {  98,3926 }, {  99,3926 },
+ { 100,3926 }, { 101,3926 }, { 102,3926 }, { 103,3926 }, { 104,3926 },
+ { 105,3926 }, { 106,3926 }, { 107,3926 }, { 108,3926 }, { 109,3926 },
+ { 110,3926 }, { 111,3926 }, { 112,3926 }, { 113,3926 }, { 114,3926 },
+ { 115,3926 }, { 116,3926 }, { 117,3926 }, { 118,3926 }, { 119,3926 },
+ { 120,3926 }, { 121,3926 }, { 122,3926 }, { 123,3926 }, { 124,3926 },
+ { 125,3926 }, { 126,3926 }, { 127,3926 }, { 128,3926 }, { 129,3926 },
+ { 130,3926 }, { 131,3926 }, { 132,3926 }, { 133,3926 }, { 134,3926 },
+
+ { 135,3926 }, { 136,3926 }, { 137,3926 }, { 138,3926 }, { 139,3926 },
+ { 140,3926 }, { 141,3926 }, { 142,3926 }, { 143,3926 }, { 144,3926 },
+ { 145,3926 }, { 146,3926 }, { 147,3926 }, { 148,3926 }, { 149,3926 },
+ { 150,3926 }, { 151,3926 }, { 152,3926 }, { 153,3926 }, { 154,3926 },
+ { 155,3926 }, { 156,3926 }, { 157,3926 }, { 158,3926 }, { 159,3926 },
+ { 160,3926 }, { 161,3926 }, { 162,3926 }, { 163,3926 }, { 164,3926 },
+ { 165,3926 }, { 166,3926 }, { 167,3926 }, { 168,3926 }, { 169,3926 },
+ { 170,3926 }, { 171,3926 }, { 172,3926 }, { 173,3926 }, { 174,3926 },
+ { 175,3926 }, { 176,3926 }, { 177,3926 }, { 178,3926 }, { 179,3926 },
+ { 180,3926 }, { 181,3926 }, { 182,3926 }, { 183,3926 }, { 184,3926 },
+
+ { 185,3926 }, { 186,3926 }, { 187,3926 }, { 188,3926 }, { 189,3926 },
+ { 190,3926 }, { 191,3926 }, { 192,3926 }, { 193,3926 }, { 194,3926 },
+ { 195,3926 }, { 196,3926 }, { 197,3926 }, { 198,3926 }, { 199,3926 },
+ { 200,3926 }, { 201,3926 }, { 202,3926 }, { 203,3926 }, { 204,3926 },
+ { 205,3926 }, { 206,3926 }, { 207,3926 }, { 208,3926 }, { 209,3926 },
+ { 210,3926 }, { 211,3926 }, { 212,3926 }, { 213,3926 }, { 214,3926 },
+ { 215,3926 }, { 216,3926 }, { 217,3926 }, { 218,3926 }, { 219,3926 },
+ { 220,3926 }, { 221,3926 }, { 222,3926 }, { 223,3926 }, { 224,3926 },
+ { 225,3926 }, { 226,3926 }, { 227,3926 }, { 228,3926 }, { 229,3926 },
+ { 230,3926 }, { 231,3926 }, { 232,3926 }, { 233,3926 }, { 234,3926 },
+
+ { 235,3926 }, { 236,3926 }, { 237,3926 }, { 238,3926 }, { 239,3926 },
+ { 240,3926 }, { 241,3926 }, { 242,3926 }, { 243,3926 }, { 244,3926 },
+ { 245,3926 }, { 246,3926 }, { 247,3926 }, { 248,3926 }, { 249,3926 },
+ { 250,3926 }, { 251,3926 }, { 252,3926 }, { 253,3926 }, { 254,3926 },
+ { 255,3926 }, { 256,3926 }, {   0,  39 }, {   0,18277 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,  37 }, {   0,18269 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,  37 }, {   0,18246 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  48,-10829 }, {  49,-10829 }, {  50,-10829 }, {  51,-10829 },
+ {  52,-10829 }, {  53,-10829 }, {  54,-10829 }, {  55,-10829 }, {  48,4434 },
+ {  49,4434 }, {  50,4434 }, {  51,4434 }, {  52,4434 }, {  53,4434 },
+ {  54,4434 }, {  55,4434 }, {  56,4434 }, {  57,4434 }, {   0,   0 },
+ {   0,   0 }, {   0,  40 }, {   0,18208 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  65,4434 }, {  66,4434 }, {  67,4434 }, {  68,4434 },
+
+ {  69,4434 }, {  70,4434 }, {  48,4434 }, {  49,4434 }, {  50,4434 },
+ {  51,4434 }, {  52,4434 }, {  53,4434 }, {  54,4434 }, {  55,4434 },
+ {  56,4434 }, {  57,4434 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  65,4434 },
+ {  66,4434 }, {  67,4434 }, {  68,4434 }, {  69,4434 }, {  70,4434 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  97,4434 }, {  98,4434 },
+ {  99,4434 }, { 100,4434 }, { 101,4434 }, { 102,4434 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  48,-10896 }, {  49,-10896 }, {  50,-10896 }, {  51,-10896 }, {  52,-10896 },
+ {  53,-10896 }, {  54,-10896 }, {  55,-10896 }, {  56,-10896 }, {  57,-10896 },
+
+ {   0,   0 }, {  97,4434 }, {  98,4434 }, {  99,4434 }, { 100,4434 },
+ { 101,4434 }, { 102,4434 }, {  65,-10896 }, {  66,-10896 }, {  67,-10896 },
+ {  68,-10896 }, {  69,-10896 }, {  70,-10896 }, {   0,  47 }, {   0,18136 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  97,-10896 },
+ {  98,-10896 }, {  99,-10896 }, { 100,-10896 }, { 101,-10896 }, { 102,-10896 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {  36,-11399 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  48,   0 }, {  49,   0 }, {  50,   0 },
+ {  51,   0 }, {  52,   0 }, {  53,   0 }, {  54,   0 }, {  55,   0 },
+ {  56,   0 }, {  57,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  65,   0 },
+ {  66,   0 }, {  67,   0 }, {  68,   0 }, {  69,   0 }, {  70,   0 },
+ {  71,   0 }, {  72,   0 }, {  73,   0 }, {  74,   0 }, {  75,   0 },
+ {  76,   0 }, {  77,   0 }, {  78,   0 }, {  79,   0 }, {  80,   0 },
+ {  81,   0 }, {  82,   0 }, {  83,   0 }, {  84,   0 }, {  85,   0 },
+
+ {  86,   0 }, {  87,   0 }, {  88,   0 }, {  89,   0 }, {  90,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  95,   0 },
+ {   0,   0 }, {  97,   0 }, {  98,   0 }, {  99,   0 }, { 100,   0 },
+ { 101,   0 }, { 102,   0 }, { 103,   0 }, { 104,   0 }, { 105,   0 },
+ { 106,   0 }, { 107,   0 }, { 108,   0 }, { 109,   0 }, { 110,   0 },
+ { 111,   0 }, { 112,   0 }, { 113,   0 }, { 114,   0 }, { 115,   0 },
+ { 116,   0 }, { 117,   0 }, { 118,   0 }, { 119,   0 }, { 120,   0 },
+ { 121,   0 }, { 122,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, { 128,   0 }, { 129,   0 }, { 130,   0 },
+ { 131,   0 }, { 132,   0 }, { 133,   0 }, { 134,   0 }, { 135,   0 },
+
+ { 136,   0 }, { 137,   0 }, { 138,   0 }, { 139,   0 }, { 140,   0 },
+ { 141,   0 }, { 142,   0 }, { 143,   0 }, { 144,   0 }, { 145,   0 },
+ { 146,   0 }, { 147,   0 }, { 148,   0 }, { 149,   0 }, { 150,   0 },
+ { 151,   0 }, { 152,   0 }, { 153,   0 }, { 154,   0 }, { 155,   0 },
+ { 156,   0 }, { 157,   0 }, { 158,   0 }, { 159,   0 }, { 160,   0 },
+ { 161,   0 }, { 162,   0 }, { 163,   0 }, { 164,   0 }, { 165,   0 },
+ { 166,   0 }, { 167,   0 }, { 168,   0 }, { 169,   0 }, { 170,   0 },
+ { 171,   0 }, { 172,   0 }, { 173,   0 }, { 174,   0 }, { 175,   0 },
+ { 176,   0 }, { 177,   0 }, { 178,   0 }, { 179,   0 }, { 180,   0 },
+ { 181,   0 }, { 182,   0 }, { 183,   0 }, { 184,   0 }, { 185,   0 },
+
+ { 186,   0 }, { 187,   0 }, { 188,   0 }, { 189,   0 }, { 190,   0 },
+ { 191,   0 }, { 192,   0 }, { 193,   0 }, { 194,   0 }, { 195,   0 },
+ { 196,   0 }, { 197,   0 }, { 198,   0 }, { 199,   0 }, { 200,   0 },
+ { 201,   0 }, { 202,   0 }, { 203,   0 }, { 204,   0 }, { 205,   0 },
+ { 206,   0 }, { 207,   0 }, { 208,   0 }, { 209,   0 }, { 210,   0 },
+ { 211,   0 }, { 212,   0 }, { 213,   0 }, { 214,   0 }, { 215,   0 },
+ { 216,   0 }, { 217,   0 }, { 218,   0 }, { 219,   0 }, { 220,   0 },
+ { 221,   0 }, { 222,   0 }, { 223,   0 }, { 224,   0 }, { 225,   0 },
+ { 226,   0 }, { 227,   0 }, { 228,   0 }, { 229,   0 }, { 230,   0 },
+ { 231,   0 }, { 232,   0 }, { 233,   0 }, { 234,   0 }, { 235,   0 },
+
+ { 236,   0 }, { 237,   0 }, { 238,   0 }, { 239,   0 }, { 240,   0 },
+ { 241,   0 }, { 242,   0 }, { 243,   0 }, { 244,   0 }, { 245,   0 },
+ { 246,   0 }, { 247,   0 }, { 248,   0 }, { 249,   0 }, { 250,   0 },
+ { 251,   0 }, { 252,   0 }, { 253,   0 }, { 254,   0 }, { 255,   0 },
+ {   0,  53 }, {   0,17879 }, {   1,   0 }, {   2,   0 }, {   3,   0 },
+ {   4,   0 }, {   5,   0 }, {   6,   0 }, {   7,   0 }, {   8,   0 },
+ {   9,   0 }, {   0,   0 }, {  11,   0 }, {  12,   0 }, {   0,   0 },
+ {  14,   0 }, {  15,   0 }, {  16,   0 }, {  17,   0 }, {  18,   0 },
+ {  19,   0 }, {  20,   0 }, {  21,   0 }, {  22,   0 }, {  23,   0 },
+ {  24,   0 }, {  25,   0 }, {  26,   0 }, {  27,   0 }, {  28,   0 },
+
+ {  29,   0 }, {  30,   0 }, {  31,   0 }, {  32,   0 }, {  33,   0 },
+ {  34,   0 }, {  35,   0 }, {  36,   0 }, {  37,   0 }, {  38,   0 },
+ {  39,   0 }, {  40,   0 }, {  41,   0 }, {  42,   0 }, {  43,   0 },
+ {  44,   0 }, {  45,   0 }, {  46,   0 }, {  47,   0 }, {  48,   0 },
+ {  49,   0 }, {  50,   0 }, {  51,   0 }, {  52,   0 }, {  53,   0 },
+ {  54,   0 }, {  55,   0 }, {  56,   0 }, {  57,   0 }, {  58,   0 },
+ {  59,   0 }, {  60,   0 }, {  61,   0 }, {  62,   0 }, {  63,   0 },
+ {  64,   0 }, {  65,   0 }, {  66,   0 }, {  67,   0 }, {  68,   0 },
+ {  69,   0 }, {  70,   0 }, {  71,   0 }, {  72,   0 }, {  73,   0 },
+ {  74,   0 }, {  75,   0 }, {  76,   0 }, {  77,   0 }, {  78,   0 },
+
+ {  79,   0 }, {  80,   0 }, {  81,   0 }, {  82,   0 }, {  83,   0 },
+ {  84,   0 }, {  85,   0 }, {  86,   0 }, {  87,   0 }, {  88,   0 },
+ {  89,   0 }, {  90,   0 }, {  91,   0 }, {  92,   0 }, {  93,   0 },
+ {  94,   0 }, {  95,   0 }, {  96,   0 }, {  97,   0 }, {  98,   0 },
+ {  99,   0 }, { 100,   0 }, { 101,   0 }, { 102,   0 }, { 103,   0 },
+ { 104,   0 }, { 105,   0 }, { 106,   0 }, { 107,   0 }, { 108,   0 },
+ { 109,   0 }, { 110,   0 }, { 111,   0 }, { 112,   0 }, { 113,   0 },
+ { 114,   0 }, { 115,   0 }, { 116,   0 }, { 117,   0 }, { 118,   0 },
+ { 119,   0 }, { 120,   0 }, { 121,   0 }, { 122,   0 }, { 123,   0 },
+ { 124,   0 }, { 125,   0 }, { 126,   0 }, { 127,   0 }, { 128,   0 },
+
+ { 129,   0 }, { 130,   0 }, { 131,   0 }, { 132,   0 }, { 133,   0 },
+ { 134,   0 }, { 135,   0 }, { 136,   0 }, { 137,   0 }, { 138,   0 },
+ { 139,   0 }, { 140,   0 }, { 141,   0 }, { 142,   0 }, { 143,   0 },
+ { 144,   0 }, { 145,   0 }, { 146,   0 }, { 147,   0 }, { 148,   0 },
+ { 149,   0 }, { 150,   0 }, { 151,   0 }, { 152,   0 }, { 153,   0 },
+ { 154,   0 }, { 155,   0 }, { 156,   0 }, { 157,   0 }, { 158,   0 },
+ { 159,   0 }, { 160,   0 }, { 161,   0 }, { 162,   0 }, { 163,   0 },
+ { 164,   0 }, { 165,   0 }, { 166,   0 }, { 167,   0 }, { 168,   0 },
+ { 169,   0 }, { 170,   0 }, { 171,   0 }, { 172,   0 }, { 173,   0 },
+ { 174,   0 }, { 175,   0 }, { 176,   0 }, { 177,   0 }, { 178,   0 },
+
+ { 179,   0 }, { 180,   0 }, { 181,   0 }, { 182,   0 }, { 183,   0 },
+ { 184,   0 }, { 185,   0 }, { 186,   0 }, { 187,   0 }, { 188,   0 },
+ { 189,   0 }, { 190,   0 }, { 191,   0 }, { 192,   0 }, { 193,   0 },
+ { 194,   0 }, { 195,   0 }, { 196,   0 }, { 197,   0 }, { 198,   0 },
+ { 199,   0 }, { 200,   0 }, { 201,   0 }, { 202,   0 }, { 203,   0 },
+ { 204,   0 }, { 205,   0 }, { 206,   0 }, { 207,   0 }, { 208,   0 },
+ { 209,   0 }, { 210,   0 }, { 211,   0 }, { 212,   0 }, { 213,   0 },
+ { 214,   0 }, { 215,   0 }, { 216,   0 }, { 217,   0 }, { 218,   0 },
+ { 219,   0 }, { 220,   0 }, { 221,   0 }, { 222,   0 }, { 223,   0 },
+ { 224,   0 }, { 225,   0 }, { 226,   0 }, { 227,   0 }, { 228,   0 },
+
+ { 229,   0 }, { 230,   0 }, { 231,   0 }, { 232,   0 }, { 233,   0 },
+ { 234,   0 }, { 235,   0 }, { 236,   0 }, { 237,   0 }, { 238,   0 },
+ { 239,   0 }, { 240,   0 }, { 241,   0 }, { 242,   0 }, { 243,   0 },
+ { 244,   0 }, { 245,   0 }, { 246,   0 }, { 247,   0 }, { 248,   0 },
+ { 249,   0 }, { 250,   0 }, { 251,   0 }, { 252,   0 }, { 253,   0 },
+ { 254,   0 }, { 255,   0 }, { 256,   0 }, {   0,  24 }, {   0,17621 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   9,   0 }, {  10,   0 },
+ {   0,   0 }, {  12,   0 }, {  13,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  32,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  39,-11838 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  45,-11774 },
+ {   0,  24 }, {   0,17574 }, {   1,4124 }, {   2,4124 }, {   3,4124 },
+ {   4,4124 }, {   5,4124 }, {   6,4124 }, {   7,4124 }, {   8,4124 },
+ {   9,4382 }, {  10,-2960 }, {  11,4124 }, {  12,4382 }, {  13,-2960 },
+ {  14,4124 }, {  15,4124 }, {  16,4124 }, {  17,4124 }, {  18,4124 },
+ {  19,4124 }, {  20,4124 }, {  21,4124 }, {  22,4124 }, {  23,4124 },
+
+ {  24,4124 }, {  25,4124 }, {  26,4124 }, {  27,4124 }, {  28,4124 },
+ {  29,4124 }, {  30,4124 }, {  31,4124 }, {  32,4382 }, {  33,4124 },
+ {  34,4124 }, {  35,4124 }, {  36,4124 }, {  37,4124 }, {  38,4124 },
+ {  39,4124 }, {  40,4124 }, {  41,4124 }, {  42,4124 }, {  43,4124 },
+ {  44,4124 }, {  45,4640 }, {  46,4124 }, {  47,4124 }, {  48,4124 },
+ {  49,4124 }, {  50,4124 }, {  51,4124 }, {  52,4124 }, {  53,4124 },
+ {  54,4124 }, {  55,4124 }, {  56,4124 }, {  57,4124 }, {  58,4124 },
+ {  59,4124 }, {  60,4124 }, {  61,4124 }, {  62,4124 }, {  63,4124 },
+ {  64,4124 }, {  65,4124 }, {  66,4124 }, {  67,4124 }, {  68,4124 },
+ {  69,4124 }, {  70,4124 }, {  71,4124 }, {  72,4124 }, {  73,4124 },
+
+ {  74,4124 }, {  75,4124 }, {  76,4124 }, {  77,4124 }, {  78,4124 },
+ {  79,4124 }, {  80,4124 }, {  81,4124 }, {  82,4124 }, {  83,4124 },
+ {  84,4124 }, {  85,4124 }, {  86,4124 }, {  87,4124 }, {  88,4124 },
+ {  89,4124 }, {  90,4124 }, {  91,4124 }, {  92,4124 }, {  93,4124 },
+ {  94,4124 }, {  95,4124 }, {  96,4124 }, {  97,4124 }, {  98,4124 },
+ {  99,4124 }, { 100,4124 }, { 101,4124 }, { 102,4124 }, { 103,4124 },
+ { 104,4124 }, { 105,4124 }, { 106,4124 }, { 107,4124 }, { 108,4124 },
+ { 109,4124 }, { 110,4124 }, { 111,4124 }, { 112,4124 }, { 113,4124 },
+ { 114,4124 }, { 115,4124 }, { 116,4124 }, { 117,4124 }, { 118,4124 },
+ { 119,4124 }, { 120,4124 }, { 121,4124 }, { 122,4124 }, { 123,4124 },
+
+ { 124,4124 }, { 125,4124 }, { 126,4124 }, { 127,4124 }, { 128,4124 },
+ { 129,4124 }, { 130,4124 }, { 131,4124 }, { 132,4124 }, { 133,4124 },
+ { 134,4124 }, { 135,4124 }, { 136,4124 }, { 137,4124 }, { 138,4124 },
+ { 139,4124 }, { 140,4124 }, { 141,4124 }, { 142,4124 }, { 143,4124 },
+ { 144,4124 }, { 145,4124 }, { 146,4124 }, { 147,4124 }, { 148,4124 },
+ { 149,4124 }, { 150,4124 }, { 151,4124 }, { 152,4124 }, { 153,4124 },
+ { 154,4124 }, { 155,4124 }, { 156,4124 }, { 157,4124 }, { 158,4124 },
+ { 159,4124 }, { 160,4124 }, { 161,4124 }, { 162,4124 }, { 163,4124 },
+ { 164,4124 }, { 165,4124 }, { 166,4124 }, { 167,4124 }, { 168,4124 },
+ { 169,4124 }, { 170,4124 }, { 171,4124 }, { 172,4124 }, { 173,4124 },
+
+ { 174,4124 }, { 175,4124 }, { 176,4124 }, { 177,4124 }, { 178,4124 },
+ { 179,4124 }, { 180,4124 }, { 181,4124 }, { 182,4124 }, { 183,4124 },
+ { 184,4124 }, { 185,4124 }, { 186,4124 }, { 187,4124 }, { 188,4124 },
+ { 189,4124 }, { 190,4124 }, { 191,4124 }, { 192,4124 }, { 193,4124 },
+ { 194,4124 }, { 195,4124 }, { 196,4124 }, { 197,4124 }, { 198,4124 },
+ { 199,4124 }, { 200,4124 }, { 201,4124 }, { 202,4124 }, { 203,4124 },
+ { 204,4124 }, { 205,4124 }, { 206,4124 }, { 207,4124 }, { 208,4124 },
+ { 209,4124 }, { 210,4124 }, { 211,4124 }, { 212,4124 }, { 213,4124 },
+ { 214,4124 }, { 215,4124 }, { 216,4124 }, { 217,4124 }, { 218,4124 },
+ { 219,4124 }, { 220,4124 }, { 221,4124 }, { 222,4124 }, { 223,4124 },
+
+ { 224,4124 }, { 225,4124 }, { 226,4124 }, { 227,4124 }, { 228,4124 },
+ { 229,4124 }, { 230,4124 }, { 231,4124 }, { 232,4124 }, { 233,4124 },
+ { 234,4124 }, { 235,4124 }, { 236,4124 }, { 237,4124 }, { 238,4124 },
+ { 239,4124 }, { 240,4124 }, { 241,4124 }, { 242,4124 }, { 243,4124 },
+ { 244,4124 }, { 245,4124 }, { 246,4124 }, { 247,4124 }, { 248,4124 },
+ { 249,4124 }, { 250,4124 }, { 251,4124 }, { 252,4124 }, { 253,4124 },
+ { 254,4124 }, { 255,4124 }, { 256,4124 }, {   0,  26 }, {   0,17316 },
+ {   1,   0 }, {   2,   0 }, {   3,   0 }, {   4,   0 }, {   5,   0 },
+ {   6,   0 }, {   7,   0 }, {   8,   0 }, {   9,   0 }, {   0,   0 },
+ {  11,   0 }, {  12,   0 }, {   0,   0 }, {  14,   0 }, {  15,   0 },
+
+ {  16,   0 }, {  17,   0 }, {  18,   0 }, {  19,   0 }, {  20,   0 },
+ {  21,   0 }, {  22,   0 }, {  23,   0 }, {  24,   0 }, {  25,   0 },
+ {  26,   0 }, {  27,   0 }, {  28,   0 }, {  29,   0 }, {  30,   0 },
+ {  31,   0 }, {  32,   0 }, {  33,   0 }, {  34,   0 }, {  35,   0 },
+ {  36,   0 }, {  37,   0 }, {  38,   0 }, {  39,   0 }, {  40,   0 },
+ {  41,   0 }, {  42,   0 }, {  43,   0 }, {  44,   0 }, {  45,   0 },
+ {  46,   0 }, {  47,   0 }, {  48,   0 }, {  49,   0 }, {  50,   0 },
+ {  51,   0 }, {  52,   0 }, {  53,   0 }, {  54,   0 }, {  55,   0 },
+ {  56,   0 }, {  57,   0 }, {  58,   0 }, {  59,   0 }, {  60,   0 },
+ {  61,   0 }, {  62,   0 }, {  63,   0 }, {  64,   0 }, {  65,   0 },
+
+ {  66,   0 }, {  67,   0 }, {  68,   0 }, {  69,   0 }, {  70,   0 },
+ {  71,   0 }, {  72,   0 }, {  73,   0 }, {  74,   0 }, {  75,   0 },
+ {  76,   0 }, {  77,   0 }, {  78,   0 }, {  79,   0 }, {  80,   0 },
+ {  81,   0 }, {  82,   0 }, {  83,   0 }, {  84,   0 }, {  85,   0 },
+ {  86,   0 }, {  87,   0 }, {  88,   0 }, {  89,   0 }, {  90,   0 },
+ {  91,   0 }, {  92,   0 }, {  93,   0 }, {  94,   0 }, {  95,   0 },
+ {  96,   0 }, {  97,   0 }, {  98,   0 }, {  99,   0 }, { 100,   0 },
+ { 101,   0 }, { 102,   0 }, { 103,   0 }, { 104,   0 }, { 105,   0 },
+ { 106,   0 }, { 107,   0 }, { 108,   0 }, { 109,   0 }, { 110,   0 },
+ { 111,   0 }, { 112,   0 }, { 113,   0 }, { 114,   0 }, { 115,   0 },
+
+ { 116,   0 }, { 117,   0 }, { 118,   0 }, { 119,   0 }, { 120,   0 },
+ { 121,   0 }, { 122,   0 }, { 123,   0 }, { 124,   0 }, { 125,   0 },
+ { 126,   0 }, { 127,   0 }, { 128,   0 }, { 129,   0 }, { 130,   0 },
+ { 131,   0 }, { 132,   0 }, { 133,   0 }, { 134,   0 }, { 135,   0 },
+ { 136,   0 }, { 137,   0 }, { 138,   0 }, { 139,   0 }, { 140,   0 },
+ { 141,   0 }, { 142,   0 }, { 143,   0 }, { 144,   0 }, { 145,   0 },
+ { 146,   0 }, { 147,   0 }, { 148,   0 }, { 149,   0 }, { 150,   0 },
+ { 151,   0 }, { 152,   0 }, { 153,   0 }, { 154,   0 }, { 155,   0 },
+ { 156,   0 }, { 157,   0 }, { 158,   0 }, { 159,   0 }, { 160,   0 },
+ { 161,   0 }, { 162,   0 }, { 163,   0 }, { 164,   0 }, { 165,   0 },
+
+ { 166,   0 }, { 167,   0 }, { 168,   0 }, { 169,   0 }, { 170,   0 },
+ { 171,   0 }, { 172,   0 }, { 173,   0 }, { 174,   0 }, { 175,   0 },
+ { 176,   0 }, { 177,   0 }, { 178,   0 }, { 179,   0 }, { 180,   0 },
+ { 181,   0 }, { 182,   0 }, { 183,   0 }, { 184,   0 }, { 185,   0 },
+ { 186,   0 }, { 187,   0 }, { 188,   0 }, { 189,   0 }, { 190,   0 },
+ { 191,   0 }, { 192,   0 }, { 193,   0 }, { 194,   0 }, { 195,   0 },
+ { 196,   0 }, { 197,   0 }, { 198,   0 }, { 199,   0 }, { 200,   0 },
+ { 201,   0 }, { 202,   0 }, { 203,   0 }, { 204,   0 }, { 205,   0 },
+ { 206,   0 }, { 207,   0 }, { 208,   0 }, { 209,   0 }, { 210,   0 },
+ { 211,   0 }, { 212,   0 }, { 213,   0 }, { 214,   0 }, { 215,   0 },
+
+ { 216,   0 }, { 217,   0 }, { 218,   0 }, { 219,   0 }, { 220,   0 },
+ { 221,   0 }, { 222,   0 }, { 223,   0 }, { 224,   0 }, { 225,   0 },
+ { 226,   0 }, { 227,   0 }, { 228,   0 }, { 229,   0 }, { 230,   0 },
+ { 231,   0 }, { 232,   0 }, { 233,   0 }, { 234,   0 }, { 235,   0 },
+ { 236,   0 }, { 237,   0 }, { 238,   0 }, { 239,   0 }, { 240,   0 },
+ { 241,   0 }, { 242,   0 }, { 243,   0 }, { 244,   0 }, { 245,   0 },
+ { 246,   0 }, { 247,   0 }, { 248,   0 }, { 249,   0 }, { 250,   0 },
+ { 251,   0 }, { 252,   0 }, { 253,   0 }, { 254,   0 }, { 255,   0 },
+ { 256,   0 }, {   0,  37 }, {   0,17058 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,  37 },
+ {   0,17035 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  48,4382 }, {  49,4382 }, {  50,4382 }, {  51,4382 }, {  52,4382 },
+ {  53,4382 }, {  54,4382 }, {  55,4382 }, {  56,4382 }, {  57,4382 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  65,4382 }, {  66,4382 }, {  67,4382 },
+ {  68,4382 }, {  69,4382 }, {  70,4382 }, {  48,4382 }, {  49,4382 },
+ {  50,4382 }, {  51,4382 }, {  52,4382 }, {  53,4382 }, {  54,4382 },
+ {  55,4382 }, {  56,4382 }, {  57,4382 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  65,4382 }, {  66,4382 }, {  67,4382 }, {  68,4382 }, {  69,4382 },
+ {  70,4382 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  97,4382 },
+ {  98,4382 }, {  99,4382 }, { 100,4382 }, { 101,4382 }, { 102,4382 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  97,4382 }, {  98,4382 }, {  99,4382 },
+ { 100,4382 }, { 101,4382 }, { 102,4382 }, {   0,   9 }, {   0,16931 },
+ {   1,4382 }, {   2,4382 }, {   3,4382 }, {   4,4382 }, {   5,4382 },
+ {   6,4382 }, {   7,4382 }, {   8,4382 }, {   9,4640 }, {  10,4898 },
+ {  11,4382 }, {  12,4640 }, {  13,4898 }, {  14,4382 }, {  15,4382 },
+ {  16,4382 }, {  17,4382 }, {  18,4382 }, {  19,4382 }, {  20,4382 },
+ {  21,4382 }, {  22,4382 }, {  23,4382 }, {  24,4382 }, {  25,4382 },
+ {  26,4382 }, {  27,4382 }, {  28,4382 }, {  29,4382 }, {  30,4382 },
+
+ {  31,4382 }, {  32,4640 }, {  33,4382 }, {  34,4382 }, {  35,4382 },
+ {  36,4382 }, {  37,4382 }, {  38,4382 }, {  39,4382 }, {  40,4382 },
+ {  41,4382 }, {  42,4382 }, {  43,4382 }, {  44,4382 }, {  45,4945 },
+ {  46,4382 }, {  47,4382 }, {  48,4382 }, {  49,4382 }, {  50,4382 },
+ {  51,4382 }, {  52,4382 }, {  53,4382 }, {  54,4382 }, {  55,4382 },
+ {  56,4382 }, {  57,4382 }, {  58,4382 }, {  59,4382 }, {  60,4382 },
+ {  61,4382 }, {  62,4382 }, {  63,4382 }, {  64,4382 }, {  65,4382 },
+ {  66,4382 }, {  67,4382 }, {  68,4382 }, {  69,4382 }, {  70,4382 },
+ {  71,4382 }, {  72,4382 }, {  73,4382 }, {  74,4382 }, {  75,4382 },
+ {  76,4382 }, {  77,4382 }, {  78,4382 }, {  79,4382 }, {  80,4382 },
+
+ {  81,4382 }, {  82,4382 }, {  83,4382 }, {  84,4382 }, {  85,4382 },
+ {  86,4382 }, {  87,4382 }, {  88,4382 }, {  89,4382 }, {  90,4382 },
+ {  91,4382 }, {  92,4382 }, {  93,4382 }, {  94,4382 }, {  95,4382 },
+ {  96,4382 }, {  97,4382 }, {  98,4382 }, {  99,4382 }, { 100,4382 },
+ { 101,4382 }, { 102,4382 }, { 103,4382 }, { 104,4382 }, { 105,4382 },
+ { 106,4382 }, { 107,4382 }, { 108,4382 }, { 109,4382 }, { 110,4382 },
+ { 111,4382 }, { 112,4382 }, { 113,4382 }, { 114,4382 }, { 115,4382 },
+ { 116,4382 }, { 117,4382 }, { 118,4382 }, { 119,4382 }, { 120,4382 },
+ { 121,4382 }, { 122,4382 }, { 123,4382 }, { 124,4382 }, { 125,4382 },
+ { 126,4382 }, { 127,4382 }, { 128,4382 }, { 129,4382 }, { 130,4382 },
+
+ { 131,4382 }, { 132,4382 }, { 133,4382 }, { 134,4382 }, { 135,4382 },
+ { 136,4382 }, { 137,4382 }, { 138,4382 }, { 139,4382 }, { 140,4382 },
+ { 141,4382 }, { 142,4382 }, { 143,4382 }, { 144,4382 }, { 145,4382 },
+ { 146,4382 }, { 147,4382 }, { 148,4382 }, { 149,4382 }, { 150,4382 },
+ { 151,4382 }, { 152,4382 }, { 153,4382 }, { 154,4382 }, { 155,4382 },
+ { 156,4382 }, { 157,4382 }, { 158,4382 }, { 159,4382 }, { 160,4382 },
+ { 161,4382 }, { 162,4382 }, { 163,4382 }, { 164,4382 }, { 165,4382 },
+ { 166,4382 }, { 167,4382 }, { 168,4382 }, { 169,4382 }, { 170,4382 },
+ { 171,4382 }, { 172,4382 }, { 173,4382 }, { 174,4382 }, { 175,4382 },
+ { 176,4382 }, { 177,4382 }, { 178,4382 }, { 179,4382 }, { 180,4382 },
+
+ { 181,4382 }, { 182,4382 }, { 183,4382 }, { 184,4382 }, { 185,4382 },
+ { 186,4382 }, { 187,4382 }, { 188,4382 }, { 189,4382 }, { 190,4382 },
+ { 191,4382 }, { 192,4382 }, { 193,4382 }, { 194,4382 }, { 195,4382 },
+ { 196,4382 }, { 197,4382 }, { 198,4382 }, { 199,4382 }, { 200,4382 },
+ { 201,4382 }, { 202,4382 }, { 203,4382 }, { 204,4382 }, { 205,4382 },
+ { 206,4382 }, { 207,4382 }, { 208,4382 }, { 209,4382 }, { 210,4382 },
+ { 211,4382 }, { 212,4382 }, { 213,4382 }, { 214,4382 }, { 215,4382 },
+ { 216,4382 }, { 217,4382 }, { 218,4382 }, { 219,4382 }, { 220,4382 },
+ { 221,4382 }, { 222,4382 }, { 223,4382 }, { 224,4382 }, { 225,4382 },
+ { 226,4382 }, { 227,4382 }, { 228,4382 }, { 229,4382 }, { 230,4382 },
+
+ { 231,4382 }, { 232,4382 }, { 233,4382 }, { 234,4382 }, { 235,4382 },
+ { 236,4382 }, { 237,4382 }, { 238,4382 }, { 239,4382 }, { 240,4382 },
+ { 241,4382 }, { 242,4382 }, { 243,4382 }, { 244,4382 }, { 245,4382 },
+ { 246,4382 }, { 247,4382 }, { 248,4382 }, { 249,4382 }, { 250,4382 },
+ { 251,4382 }, { 252,4382 }, { 253,4382 }, { 254,4382 }, { 255,4382 },
+ { 256,4382 }, {   0,   9 }, {   0,16673 }, {   1,   0 }, {   2,   0 },
+ {   3,   0 }, {   4,   0 }, {   5,   0 }, {   6,   0 }, {   7,   0 },
+ {   8,   0 }, {   9, 258 }, {  10,-6341 }, {  11,   0 }, {  12, 258 },
+ {  13,-6341 }, {  14,   0 }, {  15,   0 }, {  16,   0 }, {  17,   0 },
+ {  18,   0 }, {  19,   0 }, {  20,   0 }, {  21,   0 }, {  22,   0 },
+
+ {  23,   0 }, {  24,   0 }, {  25,   0 }, {  26,   0 }, {  27,   0 },
+ {  28,   0 }, {  29,   0 }, {  30,   0 }, {  31,   0 }, {  32, 258 },
+ {  33,   0 }, {  34,   0 }, {  35,   0 }, {  36,   0 }, {  37,   0 },
+ {  38,   0 }, {  39,   0 }, {  40,   0 }, {  41,   0 }, {  42,   0 },
+ {  43,   0 }, {  44,   0 }, {  45, 516 }, {  46,   0 }, {  47,   0 },
+ {  48,   0 }, {  49,   0 }, {  50,   0 }, {  51,   0 }, {  52,   0 },
+ {  53,   0 }, {  54,   0 }, {  55,   0 }, {  56,   0 }, {  57,   0 },
+ {  58,   0 }, {  59,   0 }, {  60,   0 }, {  61,   0 }, {  62,   0 },
+ {  63,   0 }, {  64,   0 }, {  65,   0 }, {  66,   0 }, {  67,   0 },
+ {  68,   0 }, {  69,   0 }, {  70,   0 }, {  71,   0 }, {  72,   0 },
+
+ {  73,   0 }, {  74,   0 }, {  75,   0 }, {  76,   0 }, {  77,   0 },
+ {  78,   0 }, {  79,   0 }, {  80,   0 }, {  81,   0 }, {  82,   0 },
+ {  83,   0 }, {  84,   0 }, {  85,   0 }, {  86,   0 }, {  87,   0 },
+ {  88,   0 }, {  89,   0 }, {  90,   0 }, {  91,   0 }, {  92,   0 },
+ {  93,   0 }, {  94,   0 }, {  95,   0 }, {  96,   0 }, {  97,   0 },
+ {  98,   0 }, {  99,   0 }, { 100,   0 }, { 101,   0 }, { 102,   0 },
+ { 103,   0 }, { 104,   0 }, { 105,   0 }, { 106,   0 }, { 107,   0 },
+ { 108,   0 }, { 109,   0 }, { 110,   0 }, { 111,   0 }, { 112,   0 },
+ { 113,   0 }, { 114,   0 }, { 115,   0 }, { 116,   0 }, { 117,   0 },
+ { 118,   0 }, { 119,   0 }, { 120,   0 }, { 121,   0 }, { 122,   0 },
+
+ { 123,   0 }, { 124,   0 }, { 125,   0 }, { 126,   0 }, { 127,   0 },
+ { 128,   0 }, { 129,   0 }, { 130,   0 }, { 131,   0 }, { 132,   0 },
+ { 133,   0 }, { 134,   0 }, { 135,   0 }, { 136,   0 }, { 137,   0 },
+ { 138,   0 }, { 139,   0 }, { 140,   0 }, { 141,   0 }, { 142,   0 },
+ { 143,   0 }, { 144,   0 }, { 145,   0 }, { 146,   0 }, { 147,   0 },
+ { 148,   0 }, { 149,   0 }, { 150,   0 }, { 151,   0 }, { 152,   0 },
+ { 153,   0 }, { 154,   0 }, { 155,   0 }, { 156,   0 }, { 157,   0 },
+ { 158,   0 }, { 159,   0 }, { 160,   0 }, { 161,   0 }, { 162,   0 },
+ { 163,   0 }, { 164,   0 }, { 165,   0 }, { 166,   0 }, { 167,   0 },
+ { 168,   0 }, { 169,   0 }, { 170,   0 }, { 171,   0 }, { 172,   0 },
+
+ { 173,   0 }, { 174,   0 }, { 175,   0 }, { 176,   0 }, { 177,   0 },
+ { 178,   0 }, { 179,   0 }, { 180,   0 }, { 181,   0 }, { 182,   0 },
+ { 183,   0 }, { 184,   0 }, { 185,   0 }, { 186,   0 }, { 187,   0 },
+ { 188,   0 }, { 189,   0 }, { 190,   0 }, { 191,   0 }, { 192,   0 },
+ { 193,   0 }, { 194,   0 }, { 195,   0 }, { 196,   0 }, { 197,   0 },
+ { 198,   0 }, { 199,   0 }, { 200,   0 }, { 201,   0 }, { 202,   0 },
+ { 203,   0 }, { 204,   0 }, { 205,   0 }, { 206,   0 }, { 207,   0 },
+ { 208,   0 }, { 209,   0 }, { 210,   0 }, { 211,   0 }, { 212,   0 },
+ { 213,   0 }, { 214,   0 }, { 215,   0 }, { 216,   0 }, { 217,   0 },
+ { 218,   0 }, { 219,   0 }, { 220,   0 }, { 221,   0 }, { 222,   0 },
+
+ { 223,   0 }, { 224,   0 }, { 225,   0 }, { 226,   0 }, { 227,   0 },
+ { 228,   0 }, { 229,   0 }, { 230,   0 }, { 231,   0 }, { 232,   0 },
+ { 233,   0 }, { 234,   0 }, { 235,   0 }, { 236,   0 }, { 237,   0 },
+ { 238,   0 }, { 239,   0 }, { 240,   0 }, { 241,   0 }, { 242,   0 },
+ { 243,   0 }, { 244,   0 }, { 245,   0 }, { 246,   0 }, { 247,   0 },
+ { 248,   0 }, { 249,   0 }, { 250,   0 }, { 251,   0 }, { 252,   0 },
+ { 253,   0 }, { 254,   0 }, { 255,   0 }, { 256,   0 }, {   0,   9 },
+ {   0,16415 }, {   1,-258 }, {   2,-258 }, {   3,-258 }, {   4,-258 },
+ {   5,-258 }, {   6,-258 }, {   7,-258 }, {   8,-258 }, {   9,   0 },
+ {  10,-6599 }, {  11,-258 }, {  12,   0 }, {  13,-6599 }, {  14,-258 },
+
+ {  15,-258 }, {  16,-258 }, {  17,-258 }, {  18,-258 }, {  19,-258 },
+ {  20,-258 }, {  21,-258 }, {  22,-258 }, {  23,-258 }, {  24,-258 },
+ {  25,-258 }, {  26,-258 }, {  27,-258 }, {  28,-258 }, {  29,-258 },
+ {  30,-258 }, {  31,-258 }, {  32,   0 }, {  33,-258 }, {  34,-258 },
+ {  35,-258 }, {  36,-258 }, {  37,-258 }, {  38,-258 }, {  39,-258 },
+ {  40,-258 }, {  41,-258 }, {  42,-258 }, {  43,-258 }, {  44,-258 },
+ {  45, 258 }, {  46,-258 }, {  47,-258 }, {  48,-258 }, {  49,-258 },
+ {  50,-258 }, {  51,-258 }, {  52,-258 }, {  53,-258 }, {  54,-258 },
+ {  55,-258 }, {  56,-258 }, {  57,-258 }, {  58,-258 }, {  59,-258 },
+ {  60,-258 }, {  61,-258 }, {  62,-258 }, {  63,-258 }, {  64,-258 },
+
+ {  65,-258 }, {  66,-258 }, {  67,-258 }, {  68,-258 }, {  69,-258 },
+ {  70,-258 }, {  71,-258 }, {  72,-258 }, {  73,-258 }, {  74,-258 },
+ {  75,-258 }, {  76,-258 }, {  77,-258 }, {  78,-258 }, {  79,-258 },
+ {  80,-258 }, {  81,-258 }, {  82,-258 }, {  83,-258 }, {  84,-258 },
+ {  85,-258 }, {  86,-258 }, {  87,-258 }, {  88,-258 }, {  89,-258 },
+ {  90,-258 }, {  91,-258 }, {  92,-258 }, {  93,-258 }, {  94,-258 },
+ {  95,-258 }, {  96,-258 }, {  97,-258 }, {  98,-258 }, {  99,-258 },
+ { 100,-258 }, { 101,-258 }, { 102,-258 }, { 103,-258 }, { 104,-258 },
+ { 105,-258 }, { 106,-258 }, { 107,-258 }, { 108,-258 }, { 109,-258 },
+ { 110,-258 }, { 111,-258 }, { 112,-258 }, { 113,-258 }, { 114,-258 },
+
+ { 115,-258 }, { 116,-258 }, { 117,-258 }, { 118,-258 }, { 119,-258 },
+ { 120,-258 }, { 121,-258 }, { 122,-258 }, { 123,-258 }, { 124,-258 },
+ { 125,-258 }, { 126,-258 }, { 127,-258 }, { 128,-258 }, { 129,-258 },
+ { 130,-258 }, { 131,-258 }, { 132,-258 }, { 133,-258 }, { 134,-258 },
+ { 135,-258 }, { 136,-258 }, { 137,-258 }, { 138,-258 }, { 139,-258 },
+ { 140,-258 }, { 141,-258 }, { 142,-258 }, { 143,-258 }, { 144,-258 },
+ { 145,-258 }, { 146,-258 }, { 147,-258 }, { 148,-258 }, { 149,-258 },
+ { 150,-258 }, { 151,-258 }, { 152,-258 }, { 153,-258 }, { 154,-258 },
+ { 155,-258 }, { 156,-258 }, { 157,-258 }, { 158,-258 }, { 159,-258 },
+ { 160,-258 }, { 161,-258 }, { 162,-258 }, { 163,-258 }, { 164,-258 },
+
+ { 165,-258 }, { 166,-258 }, { 167,-258 }, { 168,-258 }, { 169,-258 },
+ { 170,-258 }, { 171,-258 }, { 172,-258 }, { 173,-258 }, { 174,-258 },
+ { 175,-258 }, { 176,-258 }, { 177,-258 }, { 178,-258 }, { 179,-258 },
+ { 180,-258 }, { 181,-258 }, { 182,-258 }, { 183,-258 }, { 184,-258 },
+ { 185,-258 }, { 186,-258 }, { 187,-258 }, { 188,-258 }, { 189,-258 },
+ { 190,-258 }, { 191,-258 }, { 192,-258 }, { 193,-258 }, { 194,-258 },
+ { 195,-258 }, { 196,-258 }, { 197,-258 }, { 198,-258 }, { 199,-258 },
+ { 200,-258 }, { 201,-258 }, { 202,-258 }, { 203,-258 }, { 204,-258 },
+ { 205,-258 }, { 206,-258 }, { 207,-258 }, { 208,-258 }, { 209,-258 },
+ { 210,-258 }, { 211,-258 }, { 212,-258 }, { 213,-258 }, { 214,-258 },
+
+ { 215,-258 }, { 216,-258 }, { 217,-258 }, { 218,-258 }, { 219,-258 },
+ { 220,-258 }, { 221,-258 }, { 222,-258 }, { 223,-258 }, { 224,-258 },
+ { 225,-258 }, { 226,-258 }, { 227,-258 }, { 228,-258 }, { 229,-258 },
+ { 230,-258 }, { 231,-258 }, { 232,-258 }, { 233,-258 }, { 234,-258 },
+ { 235,-258 }, { 236,-258 }, { 237,-258 }, { 238,-258 }, { 239,-258 },
+ { 240,-258 }, { 241,-258 }, { 242,-258 }, { 243,-258 }, { 244,-258 },
+ { 245,-258 }, { 246,-258 }, { 247,-258 }, { 248,-258 }, { 249,-258 },
+ { 250,-258 }, { 251,-258 }, { 252,-258 }, { 253,-258 }, { 254,-258 },
+ { 255,-258 }, { 256,-258 }, {   0,   9 }, {   0,16157 }, {   1,-516 },
+ {   2,-516 }, {   3,-516 }, {   4,-516 }, {   5,-516 }, {   6,-516 },
+
+ {   7,-516 }, {   8,-516 }, {   9,-258 }, {  10,-6857 }, {  11,-516 },
+ {  12,-258 }, {  13,-6857 }, {  14,-516 }, {  15,-516 }, {  16,-516 },
+ {  17,-516 }, {  18,-516 }, {  19,-516 }, {  20,-516 }, {  21,-516 },
+ {  22,-516 }, {  23,-516 }, {  24,-516 }, {  25,-516 }, {  26,-516 },
+ {  27,-516 }, {  28,-516 }, {  29,-516 }, {  30,-516 }, {  31,-516 },
+ {  32,-258 }, {  33,-516 }, {  34,-516 }, {  35,-516 }, {  36,-516 },
+ {  37,-516 }, {  38,-516 }, {  39,-516 }, {  40,-516 }, {  41,-516 },
+ {  42,-516 }, {  43,-516 }, {  44,-516 }, {  45,4429 }, {  46,-516 },
+ {  47,-516 }, {  48,-516 }, {  49,-516 }, {  50,-516 }, {  51,-516 },
+ {  52,-516 }, {  53,-516 }, {  54,-516 }, {  55,-516 }, {  56,-516 },
+
+ {  57,-516 }, {  58,-516 }, {  59,-516 }, {  60,-516 }, {  61,-516 },
+ {  62,-516 }, {  63,-516 }, {  64,-516 }, {  65,-516 }, {  66,-516 },
+ {  67,-516 }, {  68,-516 }, {  69,-516 }, {  70,-516 }, {  71,-516 },
+ {  72,-516 }, {  73,-516 }, {  74,-516 }, {  75,-516 }, {  76,-516 },
+ {  77,-516 }, {  78,-516 }, {  79,-516 }, {  80,-516 }, {  81,-516 },
+ {  82,-516 }, {  83,-516 }, {  84,-516 }, {  85,-516 }, {  86,-516 },
+ {  87,-516 }, {  88,-516 }, {  89,-516 }, {  90,-516 }, {  91,-516 },
+ {  92,-516 }, {  93,-516 }, {  94,-516 }, {  95,-516 }, {  96,-516 },
+ {  97,-516 }, {  98,-516 }, {  99,-516 }, { 100,-516 }, { 101,-516 },
+ { 102,-516 }, { 103,-516 }, { 104,-516 }, { 105,-516 }, { 106,-516 },
+
+ { 107,-516 }, { 108,-516 }, { 109,-516 }, { 110,-516 }, { 111,-516 },
+ { 112,-516 }, { 113,-516 }, { 114,-516 }, { 115,-516 }, { 116,-516 },
+ { 117,-516 }, { 118,-516 }, { 119,-516 }, { 120,-516 }, { 121,-516 },
+ { 122,-516 }, { 123,-516 }, { 124,-516 }, { 125,-516 }, { 126,-516 },
+ { 127,-516 }, { 128,-516 }, { 129,-516 }, { 130,-516 }, { 131,-516 },
+ { 132,-516 }, { 133,-516 }, { 134,-516 }, { 135,-516 }, { 136,-516 },
+ { 137,-516 }, { 138,-516 }, { 139,-516 }, { 140,-516 }, { 141,-516 },
+ { 142,-516 }, { 143,-516 }, { 144,-516 }, { 145,-516 }, { 146,-516 },
+ { 147,-516 }, { 148,-516 }, { 149,-516 }, { 150,-516 }, { 151,-516 },
+ { 152,-516 }, { 153,-516 }, { 154,-516 }, { 155,-516 }, { 156,-516 },
+
+ { 157,-516 }, { 158,-516 }, { 159,-516 }, { 160,-516 }, { 161,-516 },
+ { 162,-516 }, { 163,-516 }, { 164,-516 }, { 165,-516 }, { 166,-516 },
+ { 167,-516 }, { 168,-516 }, { 169,-516 }, { 170,-516 }, { 171,-516 },
+ { 172,-516 }, { 173,-516 }, { 174,-516 }, { 175,-516 }, { 176,-516 },
+ { 177,-516 }, { 178,-516 }, { 179,-516 }, { 180,-516 }, { 181,-516 },
+ { 182,-516 }, { 183,-516 }, { 184,-516 }, { 185,-516 }, { 186,-516 },
+ { 187,-516 }, { 188,-516 }, { 189,-516 }, { 190,-516 }, { 191,-516 },
+ { 192,-516 }, { 193,-516 }, { 194,-516 }, { 195,-516 }, { 196,-516 },
+ { 197,-516 }, { 198,-516 }, { 199,-516 }, { 200,-516 }, { 201,-516 },
+ { 202,-516 }, { 203,-516 }, { 204,-516 }, { 205,-516 }, { 206,-516 },
+
+ { 207,-516 }, { 208,-516 }, { 209,-516 }, { 210,-516 }, { 211,-516 },
+ { 212,-516 }, { 213,-516 }, { 214,-516 }, { 215,-516 }, { 216,-516 },
+ { 217,-516 }, { 218,-516 }, { 219,-516 }, { 220,-516 }, { 221,-516 },
+ { 222,-516 }, { 223,-516 }, { 224,-516 }, { 225,-516 }, { 226,-516 },
+ { 227,-516 }, { 228,-516 }, { 229,-516 }, { 230,-516 }, { 231,-516 },
+ { 232,-516 }, { 233,-516 }, { 234,-516 }, { 235,-516 }, { 236,-516 },
+ { 237,-516 }, { 238,-516 }, { 239,-516 }, { 240,-516 }, { 241,-516 },
+ { 242,-516 }, { 243,-516 }, { 244,-516 }, { 245,-516 }, { 246,-516 },
+ { 247,-516 }, { 248,-516 }, { 249,-516 }, { 250,-516 }, { 251,-516 },
+ { 252,-516 }, { 253,-516 }, { 254,-516 }, { 255,-516 }, { 256,-516 },
+
+ {   0,  16 }, {   0,15899 }, {   1,4429 }, {   2,4429 }, {   3,4429 },
+ {   4,4429 }, {   5,4429 }, {   6,4429 }, {   7,4429 }, {   8,4429 },
+ {   9,4687 }, {  10,4945 }, {  11,4429 }, {  12,4687 }, {  13,4945 },
+ {  14,4429 }, {  15,4429 }, {  16,4429 }, {  17,4429 }, {  18,4429 },
+ {  19,4429 }, {  20,4429 }, {  21,4429 }, {  22,4429 }, {  23,4429 },
+ {  24,4429 }, {  25,4429 }, {  26,4429 }, {  27,4429 }, {  28,4429 },
+ {  29,4429 }, {  30,4429 }, {  31,4429 }, {  32,4687 }, {  33,4429 },
+ {  34,4429 }, {  35,4429 }, {  36,4429 }, {  37,4429 }, {  38,4429 },
+ {  39,4429 }, {  40,4429 }, {  41,4429 }, {  42,4429 }, {  43,4429 },
+ {  44,4429 }, {  45,4992 }, {  46,4429 }, {  47,4429 }, {  48,4429 },
+
+ {  49,4429 }, {  50,4429 }, {  51,4429 }, {  52,4429 }, {  53,4429 },
+ {  54,4429 }, {  55,4429 }, {  56,4429 }, {  57,4429 }, {  58,4429 },
+ {  59,4429 }, {  60,4429 }, {  61,4429 }, {  62,4429 }, {  63,4429 },
+ {  64,4429 }, {  65,4429 }, {  66,4429 }, {  67,4429 }, {  68,4429 },
+ {  69,4429 }, {  70,4429 }, {  71,4429 }, {  72,4429 }, {  73,4429 },
+ {  74,4429 }, {  75,4429 }, {  76,4429 }, {  77,4429 }, {  78,4429 },
+ {  79,4429 }, {  80,4429 }, {  81,4429 }, {  82,4429 }, {  83,4429 },
+ {  84,4429 }, {  85,4429 }, {  86,4429 }, {  87,4429 }, {  88,4429 },
+ {  89,4429 }, {  90,4429 }, {  91,4429 }, {  92,4429 }, {  93,4429 },
+ {  94,4429 }, {  95,4429 }, {  96,4429 }, {  97,4429 }, {  98,4429 },
+
+ {  99,4429 }, { 100,4429 }, { 101,4429 }, { 102,4429 }, { 103,4429 },
+ { 104,4429 }, { 105,4429 }, { 106,4429 }, { 107,4429 }, { 108,4429 },
+ { 109,4429 }, { 110,4429 }, { 111,4429 }, { 112,4429 }, { 113,4429 },
+ { 114,4429 }, { 115,4429 }, { 116,4429 }, { 117,4429 }, { 118,4429 },
+ { 119,4429 }, { 120,4429 }, { 121,4429 }, { 122,4429 }, { 123,4429 },
+ { 124,4429 }, { 125,4429 }, { 126,4429 }, { 127,4429 }, { 128,4429 },
+ { 129,4429 }, { 130,4429 }, { 131,4429 }, { 132,4429 }, { 133,4429 },
+ { 134,4429 }, { 135,4429 }, { 136,4429 }, { 137,4429 }, { 138,4429 },
+ { 139,4429 }, { 140,4429 }, { 141,4429 }, { 142,4429 }, { 143,4429 },
+ { 144,4429 }, { 145,4429 }, { 146,4429 }, { 147,4429 }, { 148,4429 },
+
+ { 149,4429 }, { 150,4429 }, { 151,4429 }, { 152,4429 }, { 153,4429 },
+ { 154,4429 }, { 155,4429 }, { 156,4429 }, { 157,4429 }, { 158,4429 },
+ { 159,4429 }, { 160,4429 }, { 161,4429 }, { 162,4429 }, { 163,4429 },
+ { 164,4429 }, { 165,4429 }, { 166,4429 }, { 167,4429 }, { 168,4429 },
+ { 169,4429 }, { 170,4429 }, { 171,4429 }, { 172,4429 }, { 173,4429 },
+ { 174,4429 }, { 175,4429 }, { 176,4429 }, { 177,4429 }, { 178,4429 },
+ { 179,4429 }, { 180,4429 }, { 181,4429 }, { 182,4429 }, { 183,4429 },
+ { 184,4429 }, { 185,4429 }, { 186,4429 }, { 187,4429 }, { 188,4429 },
+ { 189,4429 }, { 190,4429 }, { 191,4429 }, { 192,4429 }, { 193,4429 },
+ { 194,4429 }, { 195,4429 }, { 196,4429 }, { 197,4429 }, { 198,4429 },
+
+ { 199,4429 }, { 200,4429 }, { 201,4429 }, { 202,4429 }, { 203,4429 },
+ { 204,4429 }, { 205,4429 }, { 206,4429 }, { 207,4429 }, { 208,4429 },
+ { 209,4429 }, { 210,4429 }, { 211,4429 }, { 212,4429 }, { 213,4429 },
+ { 214,4429 }, { 215,4429 }, { 216,4429 }, { 217,4429 }, { 218,4429 },
+ { 219,4429 }, { 220,4429 }, { 221,4429 }, { 222,4429 }, { 223,4429 },
+ { 224,4429 }, { 225,4429 }, { 226,4429 }, { 227,4429 }, { 228,4429 },
+ { 229,4429 }, { 230,4429 }, { 231,4429 }, { 232,4429 }, { 233,4429 },
+ { 234,4429 }, { 235,4429 }, { 236,4429 }, { 237,4429 }, { 238,4429 },
+ { 239,4429 }, { 240,4429 }, { 241,4429 }, { 242,4429 }, { 243,4429 },
+ { 244,4429 }, { 245,4429 }, { 246,4429 }, { 247,4429 }, { 248,4429 },
+
+ { 249,4429 }, { 250,4429 }, { 251,4429 }, { 252,4429 }, { 253,4429 },
+ { 254,4429 }, { 255,4429 }, { 256,4429 }, {   0,  16 }, {   0,15641 },
+ {   1,   0 }, {   2,   0 }, {   3,   0 }, {   4,   0 }, {   5,   0 },
+ {   6,   0 }, {   7,   0 }, {   8,   0 }, {   9, 258 }, {  10,-6419 },
+ {  11,   0 }, {  12, 258 }, {  13,-6419 }, {  14,   0 }, {  15,   0 },
+ {  16,   0 }, {  17,   0 }, {  18,   0 }, {  19,   0 }, {  20,   0 },
+ {  21,   0 }, {  22,   0 }, {  23,   0 }, {  24,   0 }, {  25,   0 },
+ {  26,   0 }, {  27,   0 }, {  28,   0 }, {  29,   0 }, {  30,   0 },
+ {  31,   0 }, {  32, 258 }, {  33,   0 }, {  34,   0 }, {  35,   0 },
+ {  36,   0 }, {  37,   0 }, {  38,   0 }, {  39,   0 }, {  40,   0 },
+
+ {  41,   0 }, {  42,   0 }, {  43,   0 }, {  44,   0 }, {  45, 516 },
+ {  46,   0 }, {  47,   0 }, {  48,   0 }, {  49,   0 }, {  50,   0 },
+ {  51,   0 }, {  52,   0 }, {  53,   0 }, {  54,   0 }, {  55,   0 },
+ {  56,   0 }, {  57,   0 }, {  58,   0 }, {  59,   0 }, {  60,   0 },
+ {  61,   0 }, {  62,   0 }, {  63,   0 }, {  64,   0 }, {  65,   0 },
+ {  66,   0 }, {  67,   0 }, {  68,   0 }, {  69,   0 }, {  70,   0 },
+ {  71,   0 }, {  72,   0 }, {  73,   0 }, {  74,   0 }, {  75,   0 },
+ {  76,   0 }, {  77,   0 }, {  78,   0 }, {  79,   0 }, {  80,   0 },
+ {  81,   0 }, {  82,   0 }, {  83,   0 }, {  84,   0 }, {  85,   0 },
+ {  86,   0 }, {  87,   0 }, {  88,   0 }, {  89,   0 }, {  90,   0 },
+
+ {  91,   0 }, {  92,   0 }, {  93,   0 }, {  94,   0 }, {  95,   0 },
+ {  96,   0 }, {  97,   0 }, {  98,   0 }, {  99,   0 }, { 100,   0 },
+ { 101,   0 }, { 102,   0 }, { 103,   0 }, { 104,   0 }, { 105,   0 },
+ { 106,   0 }, { 107,   0 }, { 108,   0 }, { 109,   0 }, { 110,   0 },
+ { 111,   0 }, { 112,   0 }, { 113,   0 }, { 114,   0 }, { 115,   0 },
+ { 116,   0 }, { 117,   0 }, { 118,   0 }, { 119,   0 }, { 120,   0 },
+ { 121,   0 }, { 122,   0 }, { 123,   0 }, { 124,   0 }, { 125,   0 },
+ { 126,   0 }, { 127,   0 }, { 128,   0 }, { 129,   0 }, { 130,   0 },
+ { 131,   0 }, { 132,   0 }, { 133,   0 }, { 134,   0 }, { 135,   0 },
+ { 136,   0 }, { 137,   0 }, { 138,   0 }, { 139,   0 }, { 140,   0 },
+
+ { 141,   0 }, { 142,   0 }, { 143,   0 }, { 144,   0 }, { 145,   0 },
+ { 146,   0 }, { 147,   0 }, { 148,   0 }, { 149,   0 }, { 150,   0 },
+ { 151,   0 }, { 152,   0 }, { 153,   0 }, { 154,   0 }, { 155,   0 },
+ { 156,   0 }, { 157,   0 }, { 158,   0 }, { 159,   0 }, { 160,   0 },
+ { 161,   0 }, { 162,   0 }, { 163,   0 }, { 164,   0 }, { 165,   0 },
+ { 166,   0 }, { 167,   0 }, { 168,   0 }, { 169,   0 }, { 170,   0 },
+ { 171,   0 }, { 172,   0 }, { 173,   0 }, { 174,   0 }, { 175,   0 },
+ { 176,   0 }, { 177,   0 }, { 178,   0 }, { 179,   0 }, { 180,   0 },
+ { 181,   0 }, { 182,   0 }, { 183,   0 }, { 184,   0 }, { 185,   0 },
+ { 186,   0 }, { 187,   0 }, { 188,   0 }, { 189,   0 }, { 190,   0 },
+
+ { 191,   0 }, { 192,   0 }, { 193,   0 }, { 194,   0 }, { 195,   0 },
+ { 196,   0 }, { 197,   0 }, { 198,   0 }, { 199,   0 }, { 200,   0 },
+ { 201,   0 }, { 202,   0 }, { 203,   0 }, { 204,   0 }, { 205,   0 },
+ { 206,   0 }, { 207,   0 }, { 208,   0 }, { 209,   0 }, { 210,   0 },
+ { 211,   0 }, { 212,   0 }, { 213,   0 }, { 214,   0 }, { 215,   0 },
+ { 216,   0 }, { 217,   0 }, { 218,   0 }, { 219,   0 }, { 220,   0 },
+ { 221,   0 }, { 222,   0 }, { 223,   0 }, { 224,   0 }, { 225,   0 },
+ { 226,   0 }, { 227,   0 }, { 228,   0 }, { 229,   0 }, { 230,   0 },
+ { 231,   0 }, { 232,   0 }, { 233,   0 }, { 234,   0 }, { 235,   0 },
+ { 236,   0 }, { 237,   0 }, { 238,   0 }, { 239,   0 }, { 240,   0 },
+
+ { 241,   0 }, { 242,   0 }, { 243,   0 }, { 244,   0 }, { 245,   0 },
+ { 246,   0 }, { 247,   0 }, { 248,   0 }, { 249,   0 }, { 250,   0 },
+ { 251,   0 }, { 252,   0 }, { 253,   0 }, { 254,   0 }, { 255,   0 },
+ { 256,   0 }, {   0,  16 }, {   0,15383 }, {   1,-258 }, {   2,-258 },
+ {   3,-258 }, {   4,-258 }, {   5,-258 }, {   6,-258 }, {   7,-258 },
+ {   8,-258 }, {   9,   0 }, {  10,-6677 }, {  11,-258 }, {  12,   0 },
+ {  13,-6677 }, {  14,-258 }, {  15,-258 }, {  16,-258 }, {  17,-258 },
+ {  18,-258 }, {  19,-258 }, {  20,-258 }, {  21,-258 }, {  22,-258 },
+ {  23,-258 }, {  24,-258 }, {  25,-258 }, {  26,-258 }, {  27,-258 },
+ {  28,-258 }, {  29,-258 }, {  30,-258 }, {  31,-258 }, {  32,   0 },
+
+ {  33,-258 }, {  34,-258 }, {  35,-258 }, {  36,-258 }, {  37,-258 },
+ {  38,-258 }, {  39,-258 }, {  40,-258 }, {  41,-258 }, {  42,-258 },
+ {  43,-258 }, {  44,-258 }, {  45, 258 }, {  46,-258 }, {  47,-258 },
+ {  48,-258 }, {  49,-258 }, {  50,-258 }, {  51,-258 }, {  52,-258 },
+ {  53,-258 }, {  54,-258 }, {  55,-258 }, {  56,-258 }, {  57,-258 },
+ {  58,-258 }, {  59,-258 }, {  60,-258 }, {  61,-258 }, {  62,-258 },
+ {  63,-258 }, {  64,-258 }, {  65,-258 }, {  66,-258 }, {  67,-258 },
+ {  68,-258 }, {  69,-258 }, {  70,-258 }, {  71,-258 }, {  72,-258 },
+ {  73,-258 }, {  74,-258 }, {  75,-258 }, {  76,-258 }, {  77,-258 },
+ {  78,-258 }, {  79,-258 }, {  80,-258 }, {  81,-258 }, {  82,-258 },
+
+ {  83,-258 }, {  84,-258 }, {  85,-258 }, {  86,-258 }, {  87,-258 },
+ {  88,-258 }, {  89,-258 }, {  90,-258 }, {  91,-258 }, {  92,-258 },
+ {  93,-258 }, {  94,-258 }, {  95,-258 }, {  96,-258 }, {  97,-258 },
+ {  98,-258 }, {  99,-258 }, { 100,-258 }, { 101,-258 }, { 102,-258 },
+ { 103,-258 }, { 104,-258 }, { 105,-258 }, { 106,-258 }, { 107,-258 },
+ { 108,-258 }, { 109,-258 }, { 110,-258 }, { 111,-258 }, { 112,-258 },
+ { 113,-258 }, { 114,-258 }, { 115,-258 }, { 116,-258 }, { 117,-258 },
+ { 118,-258 }, { 119,-258 }, { 120,-258 }, { 121,-258 }, { 122,-258 },
+ { 123,-258 }, { 124,-258 }, { 125,-258 }, { 126,-258 }, { 127,-258 },
+ { 128,-258 }, { 129,-258 }, { 130,-258 }, { 131,-258 }, { 132,-258 },
+
+ { 133,-258 }, { 134,-258 }, { 135,-258 }, { 136,-258 }, { 137,-258 },
+ { 138,-258 }, { 139,-258 }, { 140,-258 }, { 141,-258 }, { 142,-258 },
+ { 143,-258 }, { 144,-258 }, { 145,-258 }, { 146,-258 }, { 147,-258 },
+ { 148,-258 }, { 149,-258 }, { 150,-258 }, { 151,-258 }, { 152,-258 },
+ { 153,-258 }, { 154,-258 }, { 155,-258 }, { 156,-258 }, { 157,-258 },
+ { 158,-258 }, { 159,-258 }, { 160,-258 }, { 161,-258 }, { 162,-258 },
+ { 163,-258 }, { 164,-258 }, { 165,-258 }, { 166,-258 }, { 167,-258 },
+ { 168,-258 }, { 169,-258 }, { 170,-258 }, { 171,-258 }, { 172,-258 },
+ { 173,-258 }, { 174,-258 }, { 175,-258 }, { 176,-258 }, { 177,-258 },
+ { 178,-258 }, { 179,-258 }, { 180,-258 }, { 181,-258 }, { 182,-258 },
+
+ { 183,-258 }, { 184,-258 }, { 185,-258 }, { 186,-258 }, { 187,-258 },
+ { 188,-258 }, { 189,-258 }, { 190,-258 }, { 191,-258 }, { 192,-258 },
+ { 193,-258 }, { 194,-258 }, { 195,-258 }, { 196,-258 }, { 197,-258 },
+ { 198,-258 }, { 199,-258 }, { 200,-258 }, { 201,-258 }, { 202,-258 },
+ { 203,-258 }, { 204,-258 }, { 205,-258 }, { 206,-258 }, { 207,-258 },
+ { 208,-258 }, { 209,-258 }, { 210,-258 }, { 211,-258 }, { 212,-258 },
+ { 213,-258 }, { 214,-258 }, { 215,-258 }, { 216,-258 }, { 217,-258 },
+ { 218,-258 }, { 219,-258 }, { 220,-258 }, { 221,-258 }, { 222,-258 },
+ { 223,-258 }, { 224,-258 }, { 225,-258 }, { 226,-258 }, { 227,-258 },
+ { 228,-258 }, { 229,-258 }, { 230,-258 }, { 231,-258 }, { 232,-258 },
+
+ { 233,-258 }, { 234,-258 }, { 235,-258 }, { 236,-258 }, { 237,-258 },
+ { 238,-258 }, { 239,-258 }, { 240,-258 }, { 241,-258 }, { 242,-258 },
+ { 243,-258 }, { 244,-258 }, { 245,-258 }, { 246,-258 }, { 247,-258 },
+ { 248,-258 }, { 249,-258 }, { 250,-258 }, { 251,-258 }, { 252,-258 },
+ { 253,-258 }, { 254,-258 }, { 255,-258 }, { 256,-258 }, {   0,  16 },
+ {   0,15125 }, {   1,-516 }, {   2,-516 }, {   3,-516 }, {   4,-516 },
+ {   5,-516 }, {   6,-516 }, {   7,-516 }, {   8,-516 }, {   9,-258 },
+ {  10,-6935 }, {  11,-516 }, {  12,-258 }, {  13,-6935 }, {  14,-516 },
+ {  15,-516 }, {  16,-516 }, {  17,-516 }, {  18,-516 }, {  19,-516 },
+ {  20,-516 }, {  21,-516 }, {  22,-516 }, {  23,-516 }, {  24,-516 },
+
+ {  25,-516 }, {  26,-516 }, {  27,-516 }, {  28,-516 }, {  29,-516 },
+ {  30,-516 }, {  31,-516 }, {  32,-258 }, {  33,-516 }, {  34,-516 },
+ {  35,-516 }, {  36,-516 }, {  37,-516 }, {  38,-516 }, {  39,-516 },
+ {  40,-516 }, {  41,-516 }, {  42,-516 }, {  43,-516 }, {  44,-516 },
+ {  45,4476 }, {  46,-516 }, {  47,-516 }, {  48,-516 }, {  49,-516 },
+ {  50,-516 }, {  51,-516 }, {  52,-516 }, {  53,-516 }, {  54,-516 },
+ {  55,-516 }, {  56,-516 }, {  57,-516 }, {  58,-516 }, {  59,-516 },
+ {  60,-516 }, {  61,-516 }, {  62,-516 }, {  63,-516 }, {  64,-516 },
+ {  65,-516 }, {  66,-516 }, {  67,-516 }, {  68,-516 }, {  69,-516 },
+ {  70,-516 }, {  71,-516 }, {  72,-516 }, {  73,-516 }, {  74,-516 },
+
+ {  75,-516 }, {  76,-516 }, {  77,-516 }, {  78,-516 }, {  79,-516 },
+ {  80,-516 }, {  81,-516 }, {  82,-516 }, {  83,-516 }, {  84,-516 },
+ {  85,-516 }, {  86,-516 }, {  87,-516 }, {  88,-516 }, {  89,-516 },
+ {  90,-516 }, {  91,-516 }, {  92,-516 }, {  93,-516 }, {  94,-516 },
+ {  95,-516 }, {  96,-516 }, {  97,-516 }, {  98,-516 }, {  99,-516 },
+ { 100,-516 }, { 101,-516 }, { 102,-516 }, { 103,-516 }, { 104,-516 },
+ { 105,-516 }, { 106,-516 }, { 107,-516 }, { 108,-516 }, { 109,-516 },
+ { 110,-516 }, { 111,-516 }, { 112,-516 }, { 113,-516 }, { 114,-516 },
+ { 115,-516 }, { 116,-516 }, { 117,-516 }, { 118,-516 }, { 119,-516 },
+ { 120,-516 }, { 121,-516 }, { 122,-516 }, { 123,-516 }, { 124,-516 },
+
+ { 125,-516 }, { 126,-516 }, { 127,-516 }, { 128,-516 }, { 129,-516 },
+ { 130,-516 }, { 131,-516 }, { 132,-516 }, { 133,-516 }, { 134,-516 },
+ { 135,-516 }, { 136,-516 }, { 137,-516 }, { 138,-516 }, { 139,-516 },
+ { 140,-516 }, { 141,-516 }, { 142,-516 }, { 143,-516 }, { 144,-516 },
+ { 145,-516 }, { 146,-516 }, { 147,-516 }, { 148,-516 }, { 149,-516 },
+ { 150,-516 }, { 151,-516 }, { 152,-516 }, { 153,-516 }, { 154,-516 },
+ { 155,-516 }, { 156,-516 }, { 157,-516 }, { 158,-516 }, { 159,-516 },
+ { 160,-516 }, { 161,-516 }, { 162,-516 }, { 163,-516 }, { 164,-516 },
+ { 165,-516 }, { 166,-516 }, { 167,-516 }, { 168,-516 }, { 169,-516 },
+ { 170,-516 }, { 171,-516 }, { 172,-516 }, { 173,-516 }, { 174,-516 },
+
+ { 175,-516 }, { 176,-516 }, { 177,-516 }, { 178,-516 }, { 179,-516 },
+ { 180,-516 }, { 181,-516 }, { 182,-516 }, { 183,-516 }, { 184,-516 },
+ { 185,-516 }, { 186,-516 }, { 187,-516 }, { 188,-516 }, { 189,-516 },
+ { 190,-516 }, { 191,-516 }, { 192,-516 }, { 193,-516 }, { 194,-516 },
+ { 195,-516 }, { 196,-516 }, { 197,-516 }, { 198,-516 }, { 199,-516 },
+ { 200,-516 }, { 201,-516 }, { 202,-516 }, { 203,-516 }, { 204,-516 },
+ { 205,-516 }, { 206,-516 }, { 207,-516 }, { 208,-516 }, { 209,-516 },
+ { 210,-516 }, { 211,-516 }, { 212,-516 }, { 213,-516 }, { 214,-516 },
+ { 215,-516 }, { 216,-516 }, { 217,-516 }, { 218,-516 }, { 219,-516 },
+ { 220,-516 }, { 221,-516 }, { 222,-516 }, { 223,-516 }, { 224,-516 },
+
+ { 225,-516 }, { 226,-516 }, { 227,-516 }, { 228,-516 }, { 229,-516 },
+ { 230,-516 }, { 231,-516 }, { 232,-516 }, { 233,-516 }, { 234,-516 },
+ { 235,-516 }, { 236,-516 }, { 237,-516 }, { 238,-516 }, { 239,-516 },
+ { 240,-516 }, { 241,-516 }, { 242,-516 }, { 243,-516 }, { 244,-516 },
+ { 245,-516 }, { 246,-516 }, { 247,-516 }, { 248,-516 }, { 249,-516 },
+ { 250,-516 }, { 251,-516 }, { 252,-516 }, { 253,-516 }, { 254,-516 },
+ { 255,-516 }, { 256,-516 }, {   0,  22 }, {   0,14867 }, {   1,4476 },
+ {   2,4476 }, {   3,4476 }, {   4,4476 }, {   5,4476 }, {   6,4476 },
+ {   7,4476 }, {   8,4476 }, {   9,4734 }, {  10,4992 }, {  11,4476 },
+ {  12,4734 }, {  13,4992 }, {  14,4476 }, {  15,4476 }, {  16,4476 },
+
+ {  17,4476 }, {  18,4476 }, {  19,4476 }, {  20,4476 }, {  21,4476 },
+ {  22,4476 }, {  23,4476 }, {  24,4476 }, {  25,4476 }, {  26,4476 },
+ {  27,4476 }, {  28,4476 }, {  29,4476 }, {  30,4476 }, {  31,4476 },
+ {  32,4734 }, {  33,4476 }, {  34,4476 }, {  35,4476 }, {  36,4476 },
+ {  37,4476 }, {  38,4476 }, {  39,4476 }, {  40,4476 }, {  41,4476 },
+ {  42,4476 }, {  43,4476 }, {  44,4476 }, {  45,5039 }, {  46,4476 },
+ {  47,4476 }, {  48,4476 }, {  49,4476 }, {  50,4476 }, {  51,4476 },
+ {  52,4476 }, {  53,4476 }, {  54,4476 }, {  55,4476 }, {  56,4476 },
+ {  57,4476 }, {  58,4476 }, {  59,4476 }, {  60,4476 }, {  61,4476 },
+ {  62,4476 }, {  63,4476 }, {  64,4476 }, {  65,4476 }, {  66,4476 },
+
+ {  67,4476 }, {  68,4476 }, {  69,4476 }, {  70,4476 }, {  71,4476 },
+ {  72,4476 }, {  73,4476 }, {  74,4476 }, {  75,4476 }, {  76,4476 },
+ {  77,4476 }, {  78,4476 }, {  79,4476 }, {  80,4476 }, {  81,4476 },
+ {  82,4476 }, {  83,4476 }, {  84,4476 }, {  85,4476 }, {  86,4476 },
+ {  87,4476 }, {  88,4476 }, {  89,4476 }, {  90,4476 }, {  91,4476 },
+ {  92,4476 }, {  93,4476 }, {  94,4476 }, {  95,4476 }, {  96,4476 },
+ {  97,4476 }, {  98,4476 }, {  99,4476 }, { 100,4476 }, { 101,4476 },
+ { 102,4476 }, { 103,4476 }, { 104,4476 }, { 105,4476 }, { 106,4476 },
+ { 107,4476 }, { 108,4476 }, { 109,4476 }, { 110,4476 }, { 111,4476 },
+ { 112,4476 }, { 113,4476 }, { 114,4476 }, { 115,4476 }, { 116,4476 },
+
+ { 117,4476 }, { 118,4476 }, { 119,4476 }, { 120,4476 }, { 121,4476 },
+ { 122,4476 }, { 123,4476 }, { 124,4476 }, { 125,4476 }, { 126,4476 },
+ { 127,4476 }, { 128,4476 }, { 129,4476 }, { 130,4476 }, { 131,4476 },
+ { 132,4476 }, { 133,4476 }, { 134,4476 }, { 135,4476 }, { 136,4476 },
+ { 137,4476 }, { 138,4476 }, { 139,4476 }, { 140,4476 }, { 141,4476 },
+ { 142,4476 }, { 143,4476 }, { 144,4476 }, { 145,4476 }, { 146,4476 },
+ { 147,4476 }, { 148,4476 }, { 149,4476 }, { 150,4476 }, { 151,4476 },
+ { 152,4476 }, { 153,4476 }, { 154,4476 }, { 155,4476 }, { 156,4476 },
+ { 157,4476 }, { 158,4476 }, { 159,4476 }, { 160,4476 }, { 161,4476 },
+ { 162,4476 }, { 163,4476 }, { 164,4476 }, { 165,4476 }, { 166,4476 },
+
+ { 167,4476 }, { 168,4476 }, { 169,4476 }, { 170,4476 }, { 171,4476 },
+ { 172,4476 }, { 173,4476 }, { 174,4476 }, { 175,4476 }, { 176,4476 },
+ { 177,4476 }, { 178,4476 }, { 179,4476 }, { 180,4476 }, { 181,4476 },
+ { 182,4476 }, { 183,4476 }, { 184,4476 }, { 185,4476 }, { 186,4476 },
+ { 187,4476 }, { 188,4476 }, { 189,4476 }, { 190,4476 }, { 191,4476 },
+ { 192,4476 }, { 193,4476 }, { 194,4476 }, { 195,4476 }, { 196,4476 },
+ { 197,4476 }, { 198,4476 }, { 199,4476 }, { 200,4476 }, { 201,4476 },
+ { 202,4476 }, { 203,4476 }, { 204,4476 }, { 205,4476 }, { 206,4476 },
+ { 207,4476 }, { 208,4476 }, { 209,4476 }, { 210,4476 }, { 211,4476 },
+ { 212,4476 }, { 213,4476 }, { 214,4476 }, { 215,4476 }, { 216,4476 },
+
+ { 217,4476 }, { 218,4476 }, { 219,4476 }, { 220,4476 }, { 221,4476 },
+ { 222,4476 }, { 223,4476 }, { 224,4476 }, { 225,4476 }, { 226,4476 },
+ { 227,4476 }, { 228,4476 }, { 229,4476 }, { 230,4476 }, { 231,4476 },
+ { 232,4476 }, { 233,4476 }, { 234,4476 }, { 235,4476 }, { 236,4476 },
+ { 237,4476 }, { 238,4476 }, { 239,4476 }, { 240,4476 }, { 241,4476 },
+ { 242,4476 }, { 243,4476 }, { 244,4476 }, { 245,4476 }, { 246,4476 },
+ { 247,4476 }, { 248,4476 }, { 249,4476 }, { 250,4476 }, { 251,4476 },
+ { 252,4476 }, { 253,4476 }, { 254,4476 }, { 255,4476 }, { 256,4476 },
+ {   0,  22 }, {   0,14609 }, {   1,   0 }, {   2,   0 }, {   3,   0 },
+ {   4,   0 }, {   5,   0 }, {   6,   0 }, {   7,   0 }, {   8,   0 },
+
+ {   9, 258 }, {  10,-7141 }, {  11,   0 }, {  12, 258 }, {  13,-7141 },
+ {  14,   0 }, {  15,   0 }, {  16,   0 }, {  17,   0 }, {  18,   0 },
+ {  19,   0 }, {  20,   0 }, {  21,   0 }, {  22,   0 }, {  23,   0 },
+ {  24,   0 }, {  25,   0 }, {  26,   0 }, {  27,   0 }, {  28,   0 },
+ {  29,   0 }, {  30,   0 }, {  31,   0 }, {  32, 258 }, {  33,   0 },
+ {  34,   0 }, {  35,   0 }, {  36,   0 }, {  37,   0 }, {  38,   0 },
+ {  39,   0 }, {  40,   0 }, {  41,   0 }, {  42,   0 }, {  43,   0 },
+ {  44,   0 }, {  45, 516 }, {  46,   0 }, {  47,   0 }, {  48,   0 },
+ {  49,   0 }, {  50,   0 }, {  51,   0 }, {  52,   0 }, {  53,   0 },
+ {  54,   0 }, {  55,   0 }, {  56,   0 }, {  57,   0 }, {  58,   0 },
+
+ {  59,   0 }, {  60,   0 }, {  61,   0 }, {  62,   0 }, {  63,   0 },
+ {  64,   0 }, {  65,   0 }, {  66,   0 }, {  67,   0 }, {  68,   0 },
+ {  69,   0 }, {  70,   0 }, {  71,   0 }, {  72,   0 }, {  73,   0 },
+ {  74,   0 }, {  75,   0 }, {  76,   0 }, {  77,   0 }, {  78,   0 },
+ {  79,   0 }, {  80,   0 }, {  81,   0 }, {  82,   0 }, {  83,   0 },
+ {  84,   0 }, {  85,   0 }, {  86,   0 }, {  87,   0 }, {  88,   0 },
+ {  89,   0 }, {  90,   0 }, {  91,   0 }, {  92,   0 }, {  93,   0 },
+ {  94,   0 }, {  95,   0 }, {  96,   0 }, {  97,   0 }, {  98,   0 },
+ {  99,   0 }, { 100,   0 }, { 101,   0 }, { 102,   0 }, { 103,   0 },
+ { 104,   0 }, { 105,   0 }, { 106,   0 }, { 107,   0 }, { 108,   0 },
+
+ { 109,   0 }, { 110,   0 }, { 111,   0 }, { 112,   0 }, { 113,   0 },
+ { 114,   0 }, { 115,   0 }, { 116,   0 }, { 117,   0 }, { 118,   0 },
+ { 119,   0 }, { 120,   0 }, { 121,   0 }, { 122,   0 }, { 123,   0 },
+ { 124,   0 }, { 125,   0 }, { 126,   0 }, { 127,   0 }, { 128,   0 },
+ { 129,   0 }, { 130,   0 }, { 131,   0 }, { 132,   0 }, { 133,   0 },
+ { 134,   0 }, { 135,   0 }, { 136,   0 }, { 137,   0 }, { 138,   0 },
+ { 139,   0 }, { 140,   0 }, { 141,   0 }, { 142,   0 }, { 143,   0 },
+ { 144,   0 }, { 145,   0 }, { 146,   0 }, { 147,   0 }, { 148,   0 },
+ { 149,   0 }, { 150,   0 }, { 151,   0 }, { 152,   0 }, { 153,   0 },
+ { 154,   0 }, { 155,   0 }, { 156,   0 }, { 157,   0 }, { 158,   0 },
+
+ { 159,   0 }, { 160,   0 }, { 161,   0 }, { 162,   0 }, { 163,   0 },
+ { 164,   0 }, { 165,   0 }, { 166,   0 }, { 167,   0 }, { 168,   0 },
+ { 169,   0 }, { 170,   0 }, { 171,   0 }, { 172,   0 }, { 173,   0 },
+ { 174,   0 }, { 175,   0 }, { 176,   0 }, { 177,   0 }, { 178,   0 },
+ { 179,   0 }, { 180,   0 }, { 181,   0 }, { 182,   0 }, { 183,   0 },
+ { 184,   0 }, { 185,   0 }, { 186,   0 }, { 187,   0 }, { 188,   0 },
+ { 189,   0 }, { 190,   0 }, { 191,   0 }, { 192,   0 }, { 193,   0 },
+ { 194,   0 }, { 195,   0 }, { 196,   0 }, { 197,   0 }, { 198,   0 },
+ { 199,   0 }, { 200,   0 }, { 201,   0 }, { 202,   0 }, { 203,   0 },
+ { 204,   0 }, { 205,   0 }, { 206,   0 }, { 207,   0 }, { 208,   0 },
+
+ { 209,   0 }, { 210,   0 }, { 211,   0 }, { 212,   0 }, { 213,   0 },
+ { 214,   0 }, { 215,   0 }, { 216,   0 }, { 217,   0 }, { 218,   0 },
+ { 219,   0 }, { 220,   0 }, { 221,   0 }, { 222,   0 }, { 223,   0 },
+ { 224,   0 }, { 225,   0 }, { 226,   0 }, { 227,   0 }, { 228,   0 },
+ { 229,   0 }, { 230,   0 }, { 231,   0 }, { 232,   0 }, { 233,   0 },
+ { 234,   0 }, { 235,   0 }, { 236,   0 }, { 237,   0 }, { 238,   0 },
+ { 239,   0 }, { 240,   0 }, { 241,   0 }, { 242,   0 }, { 243,   0 },
+ { 244,   0 }, { 245,   0 }, { 246,   0 }, { 247,   0 }, { 248,   0 },
+ { 249,   0 }, { 250,   0 }, { 251,   0 }, { 252,   0 }, { 253,   0 },
+ { 254,   0 }, { 255,   0 }, { 256,   0 }, {   0,  22 }, {   0,14351 },
+
+ {   1,-258 }, {   2,-258 }, {   3,-258 }, {   4,-258 }, {   5,-258 },
+ {   6,-258 }, {   7,-258 }, {   8,-258 }, {   9,   0 }, {  10,-7399 },
+ {  11,-258 }, {  12,   0 }, {  13,-7399 }, {  14,-258 }, {  15,-258 },
+ {  16,-258 }, {  17,-258 }, {  18,-258 }, {  19,-258 }, {  20,-258 },
+ {  21,-258 }, {  22,-258 }, {  23,-258 }, {  24,-258 }, {  25,-258 },
+ {  26,-258 }, {  27,-258 }, {  28,-258 }, {  29,-258 }, {  30,-258 },
+ {  31,-258 }, {  32,   0 }, {  33,-258 }, {  34,-258 }, {  35,-258 },
+ {  36,-258 }, {  37,-258 }, {  38,-258 }, {  39,-258 }, {  40,-258 },
+ {  41,-258 }, {  42,-258 }, {  43,-258 }, {  44,-258 }, {  45, 258 },
+ {  46,-258 }, {  47,-258 }, {  48,-258 }, {  49,-258 }, {  50,-258 },
+
+ {  51,-258 }, {  52,-258 }, {  53,-258 }, {  54,-258 }, {  55,-258 },
+ {  56,-258 }, {  57,-258 }, {  58,-258 }, {  59,-258 }, {  60,-258 },
+ {  61,-258 }, {  62,-258 }, {  63,-258 }, {  64,-258 }, {  65,-258 },
+ {  66,-258 }, {  67,-258 }, {  68,-258 }, {  69,-258 }, {  70,-258 },
+ {  71,-258 }, {  72,-258 }, {  73,-258 }, {  74,-258 }, {  75,-258 },
+ {  76,-258 }, {  77,-258 }, {  78,-258 }, {  79,-258 }, {  80,-258 },
+ {  81,-258 }, {  82,-258 }, {  83,-258 }, {  84,-258 }, {  85,-258 },
+ {  86,-258 }, {  87,-258 }, {  88,-258 }, {  89,-258 }, {  90,-258 },
+ {  91,-258 }, {  92,-258 }, {  93,-258 }, {  94,-258 }, {  95,-258 },
+ {  96,-258 }, {  97,-258 }, {  98,-258 }, {  99,-258 }, { 100,-258 },
+
+ { 101,-258 }, { 102,-258 }, { 103,-258 }, { 104,-258 }, { 105,-258 },
+ { 106,-258 }, { 107,-258 }, { 108,-258 }, { 109,-258 }, { 110,-258 },
+ { 111,-258 }, { 112,-258 }, { 113,-258 }, { 114,-258 }, { 115,-258 },
+ { 116,-258 }, { 117,-258 }, { 118,-258 }, { 119,-258 }, { 120,-258 },
+ { 121,-258 }, { 122,-258 }, { 123,-258 }, { 124,-258 }, { 125,-258 },
+ { 126,-258 }, { 127,-258 }, { 128,-258 }, { 129,-258 }, { 130,-258 },
+ { 131,-258 }, { 132,-258 }, { 133,-258 }, { 134,-258 }, { 135,-258 },
+ { 136,-258 }, { 137,-258 }, { 138,-258 }, { 139,-258 }, { 140,-258 },
+ { 141,-258 }, { 142,-258 }, { 143,-258 }, { 144,-258 }, { 145,-258 },
+ { 146,-258 }, { 147,-258 }, { 148,-258 }, { 149,-258 }, { 150,-258 },
+
+ { 151,-258 }, { 152,-258 }, { 153,-258 }, { 154,-258 }, { 155,-258 },
+ { 156,-258 }, { 157,-258 }, { 158,-258 }, { 159,-258 }, { 160,-258 },
+ { 161,-258 }, { 162,-258 }, { 163,-258 }, { 164,-258 }, { 165,-258 },
+ { 166,-258 }, { 167,-258 }, { 168,-258 }, { 169,-258 }, { 170,-258 },
+ { 171,-258 }, { 172,-258 }, { 173,-258 }, { 174,-258 }, { 175,-258 },
+ { 176,-258 }, { 177,-258 }, { 178,-258 }, { 179,-258 }, { 180,-258 },
+ { 181,-258 }, { 182,-258 }, { 183,-258 }, { 184,-258 }, { 185,-258 },
+ { 186,-258 }, { 187,-258 }, { 188,-258 }, { 189,-258 }, { 190,-258 },
+ { 191,-258 }, { 192,-258 }, { 193,-258 }, { 194,-258 }, { 195,-258 },
+ { 196,-258 }, { 197,-258 }, { 198,-258 }, { 199,-258 }, { 200,-258 },
+
+ { 201,-258 }, { 202,-258 }, { 203,-258 }, { 204,-258 }, { 205,-258 },
+ { 206,-258 }, { 207,-258 }, { 208,-258 }, { 209,-258 }, { 210,-258 },
+ { 211,-258 }, { 212,-258 }, { 213,-258 }, { 214,-258 }, { 215,-258 },
+ { 216,-258 }, { 217,-258 }, { 218,-258 }, { 219,-258 }, { 220,-258 },
+ { 221,-258 }, { 222,-258 }, { 223,-258 }, { 224,-258 }, { 225,-258 },
+ { 226,-258 }, { 227,-258 }, { 228,-258 }, { 229,-258 }, { 230,-258 },
+ { 231,-258 }, { 232,-258 }, { 233,-258 }, { 234,-258 }, { 235,-258 },
+ { 236,-258 }, { 237,-258 }, { 238,-258 }, { 239,-258 }, { 240,-258 },
+ { 241,-258 }, { 242,-258 }, { 243,-258 }, { 244,-258 }, { 245,-258 },
+ { 246,-258 }, { 247,-258 }, { 248,-258 }, { 249,-258 }, { 250,-258 },
+
+ { 251,-258 }, { 252,-258 }, { 253,-258 }, { 254,-258 }, { 255,-258 },
+ { 256,-258 }, {   0,  22 }, {   0,14093 }, {   1,-516 }, {   2,-516 },
+ {   3,-516 }, {   4,-516 }, {   5,-516 }, {   6,-516 }, {   7,-516 },
+ {   8,-516 }, {   9,-258 }, {  10,-7657 }, {  11,-516 }, {  12,-258 },
+ {  13,-7657 }, {  14,-516 }, {  15,-516 }, {  16,-516 }, {  17,-516 },
+ {  18,-516 }, {  19,-516 }, {  20,-516 }, {  21,-516 }, {  22,-516 },
+ {  23,-516 }, {  24,-516 }, {  25,-516 }, {  26,-516 }, {  27,-516 },
+ {  28,-516 }, {  29,-516 }, {  30,-516 }, {  31,-516 }, {  32,-258 },
+ {  33,-516 }, {  34,-516 }, {  35,-516 }, {  36,-516 }, {  37,-516 },
+ {  38,-516 }, {  39,-516 }, {  40,-516 }, {  41,-516 }, {  42,-516 },
+
+ {  43,-516 }, {  44,-516 }, {  45,4523 }, {  46,-516 }, {  47,-516 },
+ {  48,-516 }, {  49,-516 }, {  50,-516 }, {  51,-516 }, {  52,-516 },
+ {  53,-516 }, {  54,-516 }, {  55,-516 }, {  56,-516 }, {  57,-516 },
+ {  58,-516 }, {  59,-516 }, {  60,-516 }, {  61,-516 }, {  62,-516 },
+ {  63,-516 }, {  64,-516 }, {  65,-516 }, {  66,-516 }, {  67,-516 },
+ {  68,-516 }, {  69,-516 }, {  70,-516 }, {  71,-516 }, {  72,-516 },
+ {  73,-516 }, {  74,-516 }, {  75,-516 }, {  76,-516 }, {  77,-516 },
+ {  78,-516 }, {  79,-516 }, {  80,-516 }, {  81,-516 }, {  82,-516 },
+ {  83,-516 }, {  84,-516 }, {  85,-516 }, {  86,-516 }, {  87,-516 },
+ {  88,-516 }, {  89,-516 }, {  90,-516 }, {  91,-516 }, {  92,-516 },
+
+ {  93,-516 }, {  94,-516 }, {  95,-516 }, {  96,-516 }, {  97,-516 },
+ {  98,-516 }, {  99,-516 }, { 100,-516 }, { 101,-516 }, { 102,-516 },
+ { 103,-516 }, { 104,-516 }, { 105,-516 }, { 106,-516 }, { 107,-516 },
+ { 108,-516 }, { 109,-516 }, { 110,-516 }, { 111,-516 }, { 112,-516 },
+ { 113,-516 }, { 114,-516 }, { 115,-516 }, { 116,-516 }, { 117,-516 },
+ { 118,-516 }, { 119,-516 }, { 120,-516 }, { 121,-516 }, { 122,-516 },
+ { 123,-516 }, { 124,-516 }, { 125,-516 }, { 126,-516 }, { 127,-516 },
+ { 128,-516 }, { 129,-516 }, { 130,-516 }, { 131,-516 }, { 132,-516 },
+ { 133,-516 }, { 134,-516 }, { 135,-516 }, { 136,-516 }, { 137,-516 },
+ { 138,-516 }, { 139,-516 }, { 140,-516 }, { 141,-516 }, { 142,-516 },
+
+ { 143,-516 }, { 144,-516 }, { 145,-516 }, { 146,-516 }, { 147,-516 },
+ { 148,-516 }, { 149,-516 }, { 150,-516 }, { 151,-516 }, { 152,-516 },
+ { 153,-516 }, { 154,-516 }, { 155,-516 }, { 156,-516 }, { 157,-516 },
+ { 158,-516 }, { 159,-516 }, { 160,-516 }, { 161,-516 }, { 162,-516 },
+ { 163,-516 }, { 164,-516 }, { 165,-516 }, { 166,-516 }, { 167,-516 },
+ { 168,-516 }, { 169,-516 }, { 170,-516 }, { 171,-516 }, { 172,-516 },
+ { 173,-516 }, { 174,-516 }, { 175,-516 }, { 176,-516 }, { 177,-516 },
+ { 178,-516 }, { 179,-516 }, { 180,-516 }, { 181,-516 }, { 182,-516 },
+ { 183,-516 }, { 184,-516 }, { 185,-516 }, { 186,-516 }, { 187,-516 },
+ { 188,-516 }, { 189,-516 }, { 190,-516 }, { 191,-516 }, { 192,-516 },
+
+ { 193,-516 }, { 194,-516 }, { 195,-516 }, { 196,-516 }, { 197,-516 },
+ { 198,-516 }, { 199,-516 }, { 200,-516 }, { 201,-516 }, { 202,-516 },
+ { 203,-516 }, { 204,-516 }, { 205,-516 }, { 206,-516 }, { 207,-516 },
+ { 208,-516 }, { 209,-516 }, { 210,-516 }, { 211,-516 }, { 212,-516 },
+ { 213,-516 }, { 214,-516 }, { 215,-516 }, { 216,-516 }, { 217,-516 },
+ { 218,-516 }, { 219,-516 }, { 220,-516 }, { 221,-516 }, { 222,-516 },
+ { 223,-516 }, { 224,-516 }, { 225,-516 }, { 226,-516 }, { 227,-516 },
+ { 228,-516 }, { 229,-516 }, { 230,-516 }, { 231,-516 }, { 232,-516 },
+ { 233,-516 }, { 234,-516 }, { 235,-516 }, { 236,-516 }, { 237,-516 },
+ { 238,-516 }, { 239,-516 }, { 240,-516 }, { 241,-516 }, { 242,-516 },
+
+ { 243,-516 }, { 244,-516 }, { 245,-516 }, { 246,-516 }, { 247,-516 },
+ { 248,-516 }, { 249,-516 }, { 250,-516 }, { 251,-516 }, { 252,-516 },
+ { 253,-516 }, { 254,-516 }, { 255,-516 }, { 256,-516 }, {   0,  37 },
+ {   0,13835 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,  37 }, {   0,13812 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  48,4523 }, {  49,4523 },
+ {  50,4523 }, {  51,4523 }, {  52,4523 }, {  53,4523 }, {  54,4523 },
+ {  55,4523 }, {  56,4523 }, {  57,4523 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  65,4523 }, {  66,4523 }, {  67,4523 }, {  68,4523 }, {  69,4523 },
+ {  70,4523 }, {  48,4523 }, {  49,4523 }, {  50,4523 }, {  51,4523 },
+ {  52,4523 }, {  53,4523 }, {  54,4523 }, {  55,4523 }, {  56,4523 },
+ {  57,4523 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  65,4523 }, {  66,4523 },
+ {  67,4523 }, {  68,4523 }, {  69,4523 }, {  70,4523 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  97,4523 }, {  98,4523 }, {  99,4523 },
+ { 100,4523 }, { 101,4523 }, { 102,4523 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  97,4523 }, {  98,4523 }, {  99,4523 }, { 100,4523 }, { 101,4523 },
+ { 102,4523 }, {   0,  24 }, {   0,13708 }, {   1,4523 }, {   2,4523 },
+ {   3,4523 }, {   4,4523 }, {   5,4523 }, {   6,4523 }, {   7,4523 },
+
+ {   8,4523 }, {   9,4781 }, {  10,5039 }, {  11,4523 }, {  12,4781 },
+ {  13,5039 }, {  14,4523 }, {  15,4523 }, {  16,4523 }, {  17,4523 },
+ {  18,4523 }, {  19,4523 }, {  20,4523 }, {  21,4523 }, {  22,4523 },
+ {  23,4523 }, {  24,4523 }, {  25,4523 }, {  26,4523 }, {  27,4523 },
+ {  28,4523 }, {  29,4523 }, {  30,4523 }, {  31,4523 }, {  32,4781 },
+ {  33,4523 }, {  34,4523 }, {  35,4523 }, {  36,4523 }, {  37,4523 },
+ {  38,4523 }, {  39,4523 }, {  40,4523 }, {  41,4523 }, {  42,4523 },
+ {  43,4523 }, {  44,4523 }, {  45,5086 }, {  46,4523 }, {  47,4523 },
+ {  48,4523 }, {  49,4523 }, {  50,4523 }, {  51,4523 }, {  52,4523 },
+ {  53,4523 }, {  54,4523 }, {  55,4523 }, {  56,4523 }, {  57,4523 },
+
+ {  58,4523 }, {  59,4523 }, {  60,4523 }, {  61,4523 }, {  62,4523 },
+ {  63,4523 }, {  64,4523 }, {  65,4523 }, {  66,4523 }, {  67,4523 },
+ {  68,4523 }, {  69,4523 }, {  70,4523 }, {  71,4523 }, {  72,4523 },
+ {  73,4523 }, {  74,4523 }, {  75,4523 }, {  76,4523 }, {  77,4523 },
+ {  78,4523 }, {  79,4523 }, {  80,4523 }, {  81,4523 }, {  82,4523 },
+ {  83,4523 }, {  84,4523 }, {  85,4523 }, {  86,4523 }, {  87,4523 },
+ {  88,4523 }, {  89,4523 }, {  90,4523 }, {  91,4523 }, {  92,4523 },
+ {  93,4523 }, {  94,4523 }, {  95,4523 }, {  96,4523 }, {  97,4523 },
+ {  98,4523 }, {  99,4523 }, { 100,4523 }, { 101,4523 }, { 102,4523 },
+ { 103,4523 }, { 104,4523 }, { 105,4523 }, { 106,4523 }, { 107,4523 },
+
+ { 108,4523 }, { 109,4523 }, { 110,4523 }, { 111,4523 }, { 112,4523 },
+ { 113,4523 }, { 114,4523 }, { 115,4523 }, { 116,4523 }, { 117,4523 },
+ { 118,4523 }, { 119,4523 }, { 120,4523 }, { 121,4523 }, { 122,4523 },
+ { 123,4523 }, { 124,4523 }, { 125,4523 }, { 126,4523 }, { 127,4523 },
+ { 128,4523 }, { 129,4523 }, { 130,4523 }, { 131,4523 }, { 132,4523 },
+ { 133,4523 }, { 134,4523 }, { 135,4523 }, { 136,4523 }, { 137,4523 },
+ { 138,4523 }, { 139,4523 }, { 140,4523 }, { 141,4523 }, { 142,4523 },
+ { 143,4523 }, { 144,4523 }, { 145,4523 }, { 146,4523 }, { 147,4523 },
+ { 148,4523 }, { 149,4523 }, { 150,4523 }, { 151,4523 }, { 152,4523 },
+ { 153,4523 }, { 154,4523 }, { 155,4523 }, { 156,4523 }, { 157,4523 },
+
+ { 158,4523 }, { 159,4523 }, { 160,4523 }, { 161,4523 }, { 162,4523 },
+ { 163,4523 }, { 164,4523 }, { 165,4523 }, { 166,4523 }, { 167,4523 },
+ { 168,4523 }, { 169,4523 }, { 170,4523 }, { 171,4523 }, { 172,4523 },
+ { 173,4523 }, { 174,4523 }, { 175,4523 }, { 176,4523 }, { 177,4523 },
+ { 178,4523 }, { 179,4523 }, { 180,4523 }, { 181,4523 }, { 182,4523 },
+ { 183,4523 }, { 184,4523 }, { 185,4523 }, { 186,4523 }, { 187,4523 },
+ { 188,4523 }, { 189,4523 }, { 190,4523 }, { 191,4523 }, { 192,4523 },
+ { 193,4523 }, { 194,4523 }, { 195,4523 }, { 196,4523 }, { 197,4523 },
+ { 198,4523 }, { 199,4523 }, { 200,4523 }, { 201,4523 }, { 202,4523 },
+ { 203,4523 }, { 204,4523 }, { 205,4523 }, { 206,4523 }, { 207,4523 },
+
+ { 208,4523 }, { 209,4523 }, { 210,4523 }, { 211,4523 }, { 212,4523 },
+ { 213,4523 }, { 214,4523 }, { 215,4523 }, { 216,4523 }, { 217,4523 },
+ { 218,4523 }, { 219,4523 }, { 220,4523 }, { 221,4523 }, { 222,4523 },
+ { 223,4523 }, { 224,4523 }, { 225,4523 }, { 226,4523 }, { 227,4523 },
+ { 228,4523 }, { 229,4523 }, { 230,4523 }, { 231,4523 }, { 232,4523 },
+ { 233,4523 }, { 234,4523 }, { 235,4523 }, { 236,4523 }, { 237,4523 },
+ { 238,4523 }, { 239,4523 }, { 240,4523 }, { 241,4523 }, { 242,4523 },
+ { 243,4523 }, { 244,4523 }, { 245,4523 }, { 246,4523 }, { 247,4523 },
+ { 248,4523 }, { 249,4523 }, { 250,4523 }, { 251,4523 }, { 252,4523 },
+ { 253,4523 }, { 254,4523 }, { 255,4523 }, { 256,4523 }, {   0,  24 },
+
+ {   0,13450 }, {   1,   0 }, {   2,   0 }, {   3,   0 }, {   4,   0 },
+ {   5,   0 }, {   6,   0 }, {   7,   0 }, {   8,   0 }, {   9, 258 },
+ {  10,-7084 }, {  11,   0 }, {  12, 258 }, {  13,-7084 }, {  14,   0 },
+ {  15,   0 }, {  16,   0 }, {  17,   0 }, {  18,   0 }, {  19,   0 },
+ {  20,   0 }, {  21,   0 }, {  22,   0 }, {  23,   0 }, {  24,   0 },
+ {  25,   0 }, {  26,   0 }, {  27,   0 }, {  28,   0 }, {  29,   0 },
+ {  30,   0 }, {  31,   0 }, {  32, 258 }, {  33,   0 }, {  34,   0 },
+ {  35,   0 }, {  36,   0 }, {  37,   0 }, {  38,   0 }, {  39,   0 },
+ {  40,   0 }, {  41,   0 }, {  42,   0 }, {  43,   0 }, {  44,   0 },
+ {  45, 516 }, {  46,   0 }, {  47,   0 }, {  48,   0 }, {  49,   0 },
+
+ {  50,   0 }, {  51,   0 }, {  52,   0 }, {  53,   0 }, {  54,   0 },
+ {  55,   0 }, {  56,   0 }, {  57,   0 }, {  58,   0 }, {  59,   0 },
+ {  60,   0 }, {  61,   0 }, {  62,   0 }, {  63,   0 }, {  64,   0 },
+ {  65,   0 }, {  66,   0 }, {  67,   0 }, {  68,   0 }, {  69,   0 },
+ {  70,   0 }, {  71,   0 }, {  72,   0 }, {  73,   0 }, {  74,   0 },
+ {  75,   0 }, {  76,   0 }, {  77,   0 }, {  78,   0 }, {  79,   0 },
+ {  80,   0 }, {  81,   0 }, {  82,   0 }, {  83,   0 }, {  84,   0 },
+ {  85,   0 }, {  86,   0 }, {  87,   0 }, {  88,   0 }, {  89,   0 },
+ {  90,   0 }, {  91,   0 }, {  92,   0 }, {  93,   0 }, {  94,   0 },
+ {  95,   0 }, {  96,   0 }, {  97,   0 }, {  98,   0 }, {  99,   0 },
+
+ { 100,   0 }, { 101,   0 }, { 102,   0 }, { 103,   0 }, { 104,   0 },
+ { 105,   0 }, { 106,   0 }, { 107,   0 }, { 108,   0 }, { 109,   0 },
+ { 110,   0 }, { 111,   0 }, { 112,   0 }, { 113,   0 }, { 114,   0 },
+ { 115,   0 }, { 116,   0 }, { 117,   0 }, { 118,   0 }, { 119,   0 },
+ { 120,   0 }, { 121,   0 }, { 122,   0 }, { 123,   0 }, { 124,   0 },
+ { 125,   0 }, { 126,   0 }, { 127,   0 }, { 128,   0 }, { 129,   0 },
+ { 130,   0 }, { 131,   0 }, { 132,   0 }, { 133,   0 }, { 134,   0 },
+ { 135,   0 }, { 136,   0 }, { 137,   0 }, { 138,   0 }, { 139,   0 },
+ { 140,   0 }, { 141,   0 }, { 142,   0 }, { 143,   0 }, { 144,   0 },
+ { 145,   0 }, { 146,   0 }, { 147,   0 }, { 148,   0 }, { 149,   0 },
+
+ { 150,   0 }, { 151,   0 }, { 152,   0 }, { 153,   0 }, { 154,   0 },
+ { 155,   0 }, { 156,   0 }, { 157,   0 }, { 158,   0 }, { 159,   0 },
+ { 160,   0 }, { 161,   0 }, { 162,   0 }, { 163,   0 }, { 164,   0 },
+ { 165,   0 }, { 166,   0 }, { 167,   0 }, { 168,   0 }, { 169,   0 },
+ { 170,   0 }, { 171,   0 }, { 172,   0 }, { 173,   0 }, { 174,   0 },
+ { 175,   0 }, { 176,   0 }, { 177,   0 }, { 178,   0 }, { 179,   0 },
+ { 180,   0 }, { 181,   0 }, { 182,   0 }, { 183,   0 }, { 184,   0 },
+ { 185,   0 }, { 186,   0 }, { 187,   0 }, { 188,   0 }, { 189,   0 },
+ { 190,   0 }, { 191,   0 }, { 192,   0 }, { 193,   0 }, { 194,   0 },
+ { 195,   0 }, { 196,   0 }, { 197,   0 }, { 198,   0 }, { 199,   0 },
+
+ { 200,   0 }, { 201,   0 }, { 202,   0 }, { 203,   0 }, { 204,   0 },
+ { 205,   0 }, { 206,   0 }, { 207,   0 }, { 208,   0 }, { 209,   0 },
+ { 210,   0 }, { 211,   0 }, { 212,   0 }, { 213,   0 }, { 214,   0 },
+ { 215,   0 }, { 216,   0 }, { 217,   0 }, { 218,   0 }, { 219,   0 },
+ { 220,   0 }, { 221,   0 }, { 222,   0 }, { 223,   0 }, { 224,   0 },
+ { 225,   0 }, { 226,   0 }, { 227,   0 }, { 228,   0 }, { 229,   0 },
+ { 230,   0 }, { 231,   0 }, { 232,   0 }, { 233,   0 }, { 234,   0 },
+ { 235,   0 }, { 236,   0 }, { 237,   0 }, { 238,   0 }, { 239,   0 },
+ { 240,   0 }, { 241,   0 }, { 242,   0 }, { 243,   0 }, { 244,   0 },
+ { 245,   0 }, { 246,   0 }, { 247,   0 }, { 248,   0 }, { 249,   0 },
+
+ { 250,   0 }, { 251,   0 }, { 252,   0 }, { 253,   0 }, { 254,   0 },
+ { 255,   0 }, { 256,   0 }, {   0,  24 }, {   0,13192 }, {   1,-258 },
+ {   2,-258 }, {   3,-258 }, {   4,-258 }, {   5,-258 }, {   6,-258 },
+ {   7,-258 }, {   8,-258 }, {   9,   0 }, {  10,-7342 }, {  11,-258 },
+ {  12,   0 }, {  13,-7342 }, {  14,-258 }, {  15,-258 }, {  16,-258 },
+ {  17,-258 }, {  18,-258 }, {  19,-258 }, {  20,-258 }, {  21,-258 },
+ {  22,-258 }, {  23,-258 }, {  24,-258 }, {  25,-258 }, {  26,-258 },
+ {  27,-258 }, {  28,-258 }, {  29,-258 }, {  30,-258 }, {  31,-258 },
+ {  32,   0 }, {  33,-258 }, {  34,-258 }, {  35,-258 }, {  36,-258 },
+ {  37,-258 }, {  38,-258 }, {  39,-258 }, {  40,-258 }, {  41,-258 },
+
+ {  42,-258 }, {  43,-258 }, {  44,-258 }, {  45, 258 }, {  46,-258 },
+ {  47,-258 }, {  48,-258 }, {  49,-258 }, {  50,-258 }, {  51,-258 },
+ {  52,-258 }, {  53,-258 }, {  54,-258 }, {  55,-258 }, {  56,-258 },
+ {  57,-258 }, {  58,-258 }, {  59,-258 }, {  60,-258 }, {  61,-258 },
+ {  62,-258 }, {  63,-258 }, {  64,-258 }, {  65,-258 }, {  66,-258 },
+ {  67,-258 }, {  68,-258 }, {  69,-258 }, {  70,-258 }, {  71,-258 },
+ {  72,-258 }, {  73,-258 }, {  74,-258 }, {  75,-258 }, {  76,-258 },
+ {  77,-258 }, {  78,-258 }, {  79,-258 }, {  80,-258 }, {  81,-258 },
+ {  82,-258 }, {  83,-258 }, {  84,-258 }, {  85,-258 }, {  86,-258 },
+ {  87,-258 }, {  88,-258 }, {  89,-258 }, {  90,-258 }, {  91,-258 },
+
+ {  92,-258 }, {  93,-258 }, {  94,-258 }, {  95,-258 }, {  96,-258 },
+ {  97,-258 }, {  98,-258 }, {  99,-258 }, { 100,-258 }, { 101,-258 },
+ { 102,-258 }, { 103,-258 }, { 104,-258 }, { 105,-258 }, { 106,-258 },
+ { 107,-258 }, { 108,-258 }, { 109,-258 }, { 110,-258 }, { 111,-258 },
+ { 112,-258 }, { 113,-258 }, { 114,-258 }, { 115,-258 }, { 116,-258 },
+ { 117,-258 }, { 118,-258 }, { 119,-258 }, { 120,-258 }, { 121,-258 },
+ { 122,-258 }, { 123,-258 }, { 124,-258 }, { 125,-258 }, { 126,-258 },
+ { 127,-258 }, { 128,-258 }, { 129,-258 }, { 130,-258 }, { 131,-258 },
+ { 132,-258 }, { 133,-258 }, { 134,-258 }, { 135,-258 }, { 136,-258 },
+ { 137,-258 }, { 138,-258 }, { 139,-258 }, { 140,-258 }, { 141,-258 },
+
+ { 142,-258 }, { 143,-258 }, { 144,-258 }, { 145,-258 }, { 146,-258 },
+ { 147,-258 }, { 148,-258 }, { 149,-258 }, { 150,-258 }, { 151,-258 },
+ { 152,-258 }, { 153,-258 }, { 154,-258 }, { 155,-258 }, { 156,-258 },
+ { 157,-258 }, { 158,-258 }, { 159,-258 }, { 160,-258 }, { 161,-258 },
+ { 162,-258 }, { 163,-258 }, { 164,-258 }, { 165,-258 }, { 166,-258 },
+ { 167,-258 }, { 168,-258 }, { 169,-258 }, { 170,-258 }, { 171,-258 },
+ { 172,-258 }, { 173,-258 }, { 174,-258 }, { 175,-258 }, { 176,-258 },
+ { 177,-258 }, { 178,-258 }, { 179,-258 }, { 180,-258 }, { 181,-258 },
+ { 182,-258 }, { 183,-258 }, { 184,-258 }, { 185,-258 }, { 186,-258 },
+ { 187,-258 }, { 188,-258 }, { 189,-258 }, { 190,-258 }, { 191,-258 },
+
+ { 192,-258 }, { 193,-258 }, { 194,-258 }, { 195,-258 }, { 196,-258 },
+ { 197,-258 }, { 198,-258 }, { 199,-258 }, { 200,-258 }, { 201,-258 },
+ { 202,-258 }, { 203,-258 }, { 204,-258 }, { 205,-258 }, { 206,-258 },
+ { 207,-258 }, { 208,-258 }, { 209,-258 }, { 210,-258 }, { 211,-258 },
+ { 212,-258 }, { 213,-258 }, { 214,-258 }, { 215,-258 }, { 216,-258 },
+ { 217,-258 }, { 218,-258 }, { 219,-258 }, { 220,-258 }, { 221,-258 },
+ { 222,-258 }, { 223,-258 }, { 224,-258 }, { 225,-258 }, { 226,-258 },
+ { 227,-258 }, { 228,-258 }, { 229,-258 }, { 230,-258 }, { 231,-258 },
+ { 232,-258 }, { 233,-258 }, { 234,-258 }, { 235,-258 }, { 236,-258 },
+ { 237,-258 }, { 238,-258 }, { 239,-258 }, { 240,-258 }, { 241,-258 },
+
+ { 242,-258 }, { 243,-258 }, { 244,-258 }, { 245,-258 }, { 246,-258 },
+ { 247,-258 }, { 248,-258 }, { 249,-258 }, { 250,-258 }, { 251,-258 },
+ { 252,-258 }, { 253,-258 }, { 254,-258 }, { 255,-258 }, { 256,-258 },
+ {   0,  24 }, {   0,12934 }, {   1,-516 }, {   2,-516 }, {   3,-516 },
+ {   4,-516 }, {   5,-516 }, {   6,-516 }, {   7,-516 }, {   8,-516 },
+ {   9,-258 }, {  10,-7600 }, {  11,-516 }, {  12,-258 }, {  13,-7600 },
+ {  14,-516 }, {  15,-516 }, {  16,-516 }, {  17,-516 }, {  18,-516 },
+ {  19,-516 }, {  20,-516 }, {  21,-516 }, {  22,-516 }, {  23,-516 },
+ {  24,-516 }, {  25,-516 }, {  26,-516 }, {  27,-516 }, {  28,-516 },
+ {  29,-516 }, {  30,-516 }, {  31,-516 }, {  32,-258 }, {  33,-516 },
+
+ {  34,-516 }, {  35,-516 }, {  36,-516 }, {  37,-516 }, {  38,-516 },
+ {  39,-516 }, {  40,-516 }, {  41,-516 }, {  42,-516 }, {  43,-516 },
+ {  44,-516 }, {  45,4570 }, {  46,-516 }, {  47,-516 }, {  48,-516 },
+ {  49,-516 }, {  50,-516 }, {  51,-516 }, {  52,-516 }, {  53,-516 },
+ {  54,-516 }, {  55,-516 }, {  56,-516 }, {  57,-516 }, {  58,-516 },
+ {  59,-516 }, {  60,-516 }, {  61,-516 }, {  62,-516 }, {  63,-516 },
+ {  64,-516 }, {  65,-516 }, {  66,-516 }, {  67,-516 }, {  68,-516 },
+ {  69,-516 }, {  70,-516 }, {  71,-516 }, {  72,-516 }, {  73,-516 },
+ {  74,-516 }, {  75,-516 }, {  76,-516 }, {  77,-516 }, {  78,-516 },
+ {  79,-516 }, {  80,-516 }, {  81,-516 }, {  82,-516 }, {  83,-516 },
+
+ {  84,-516 }, {  85,-516 }, {  86,-516 }, {  87,-516 }, {  88,-516 },
+ {  89,-516 }, {  90,-516 }, {  91,-516 }, {  92,-516 }, {  93,-516 },
+ {  94,-516 }, {  95,-516 }, {  96,-516 }, {  97,-516 }, {  98,-516 },
+ {  99,-516 }, { 100,-516 }, { 101,-516 }, { 102,-516 }, { 103,-516 },
+ { 104,-516 }, { 105,-516 }, { 106,-516 }, { 107,-516 }, { 108,-516 },
+ { 109,-516 }, { 110,-516 }, { 111,-516 }, { 112,-516 }, { 113,-516 },
+ { 114,-516 }, { 115,-516 }, { 116,-516 }, { 117,-516 }, { 118,-516 },
+ { 119,-516 }, { 120,-516 }, { 121,-516 }, { 122,-516 }, { 123,-516 },
+ { 124,-516 }, { 125,-516 }, { 126,-516 }, { 127,-516 }, { 128,-516 },
+ { 129,-516 }, { 130,-516 }, { 131,-516 }, { 132,-516 }, { 133,-516 },
+
+ { 134,-516 }, { 135,-516 }, { 136,-516 }, { 137,-516 }, { 138,-516 },
+ { 139,-516 }, { 140,-516 }, { 141,-516 }, { 142,-516 }, { 143,-516 },
+ { 144,-516 }, { 145,-516 }, { 146,-516 }, { 147,-516 }, { 148,-516 },
+ { 149,-516 }, { 150,-516 }, { 151,-516 }, { 152,-516 }, { 153,-516 },
+ { 154,-516 }, { 155,-516 }, { 156,-516 }, { 157,-516 }, { 158,-516 },
+ { 159,-516 }, { 160,-516 }, { 161,-516 }, { 162,-516 }, { 163,-516 },
+ { 164,-516 }, { 165,-516 }, { 166,-516 }, { 167,-516 }, { 168,-516 },
+ { 169,-516 }, { 170,-516 }, { 171,-516 }, { 172,-516 }, { 173,-516 },
+ { 174,-516 }, { 175,-516 }, { 176,-516 }, { 177,-516 }, { 178,-516 },
+ { 179,-516 }, { 180,-516 }, { 181,-516 }, { 182,-516 }, { 183,-516 },
+
+ { 184,-516 }, { 185,-516 }, { 186,-516 }, { 187,-516 }, { 188,-516 },
+ { 189,-516 }, { 190,-516 }, { 191,-516 }, { 192,-516 }, { 193,-516 },
+ { 194,-516 }, { 195,-516 }, { 196,-516 }, { 197,-516 }, { 198,-516 },
+ { 199,-516 }, { 200,-516 }, { 201,-516 }, { 202,-516 }, { 203,-516 },
+ { 204,-516 }, { 205,-516 }, { 206,-516 }, { 207,-516 }, { 208,-516 },
+ { 209,-516 }, { 210,-516 }, { 211,-516 }, { 212,-516 }, { 213,-516 },
+ { 214,-516 }, { 215,-516 }, { 216,-516 }, { 217,-516 }, { 218,-516 },
+ { 219,-516 }, { 220,-516 }, { 221,-516 }, { 222,-516 }, { 223,-516 },
+ { 224,-516 }, { 225,-516 }, { 226,-516 }, { 227,-516 }, { 228,-516 },
+ { 229,-516 }, { 230,-516 }, { 231,-516 }, { 232,-516 }, { 233,-516 },
+
+ { 234,-516 }, { 235,-516 }, { 236,-516 }, { 237,-516 }, { 238,-516 },
+ { 239,-516 }, { 240,-516 }, { 241,-516 }, { 242,-516 }, { 243,-516 },
+ { 244,-516 }, { 245,-516 }, { 246,-516 }, { 247,-516 }, { 248,-516 },
+ { 249,-516 }, { 250,-516 }, { 251,-516 }, { 252,-516 }, { 253,-516 },
+ { 254,-516 }, { 255,-516 }, { 256,-516 }, {   0,  37 }, {   0,12676 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,  37 }, {   0,12653 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  48,4570 }, {  49,4570 }, {  50,4570 },
+ {  51,4570 }, {  52,4570 }, {  53,4570 }, {  54,4570 }, {  55,4570 },
+ {  56,4570 }, {  57,4570 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  65,4570 },
+ {  66,4570 }, {  67,4570 }, {  68,4570 }, {  69,4570 }, {  70,4570 },
+ {  48,4570 }, {  49,4570 }, {  50,4570 }, {  51,4570 }, {  52,4570 },
+
+ {  53,4570 }, {  54,4570 }, {  55,4570 }, {  56,4570 }, {  57,4570 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  65,4570 }, {  66,4570 }, {  67,4570 },
+ {  68,4570 }, {  69,4570 }, {  70,4570 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  97,4570 }, {  98,4570 }, {  99,4570 }, { 100,4570 },
+ { 101,4570 }, { 102,4570 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  97,4570 },
+ {  98,4570 }, {  99,4570 }, { 100,4570 }, { 101,4570 }, { 102,4570 },
+
+ {   0,   9 }, {   0,12549 }, {   1,   0 }, {   2,   0 }, {   3,   0 },
+ {   4,   0 }, {   5,   0 }, {   6,   0 }, {   7,   0 }, {   8,   0 },
+ {   9, 258 }, {  10, 516 }, {  11,   0 }, {  12, 258 }, {  13, 516 },
+ {  14,   0 }, {  15,   0 }, {  16,   0 }, {  17,   0 }, {  18,   0 },
+ {  19,   0 }, {  20,   0 }, {  21,   0 }, {  22,   0 }, {  23,   0 },
+ {  24,   0 }, {  25,   0 }, {  26,   0 }, {  27,   0 }, {  28,   0 },
+ {  29,   0 }, {  30,   0 }, {  31,   0 }, {  32, 258 }, {  33,   0 },
+ {  34,   0 }, {  35,   0 }, {  36,   0 }, {  37,   0 }, {  38,   0 },
+ {  39,   0 }, {  40,   0 }, {  41,   0 }, {  42,   0 }, {  43,   0 },
+ {  44,   0 }, {  45, 563 }, {  46,   0 }, {  47,   0 }, {  48,   0 },
+
+ {  49,   0 }, {  50,   0 }, {  51,   0 }, {  52,   0 }, {  53,   0 },
+ {  54,   0 }, {  55,   0 }, {  56,   0 }, {  57,   0 }, {  58,   0 },
+ {  59,   0 }, {  60,   0 }, {  61,   0 }, {  62,   0 }, {  63,   0 },
+ {  64,   0 }, {  65,   0 }, {  66,   0 }, {  67,   0 }, {  68,   0 },
+ {  69,   0 }, {  70,   0 }, {  71,   0 }, {  72,   0 }, {  73,   0 },
+ {  74,   0 }, {  75,   0 }, {  76,   0 }, {  77,   0 }, {  78,   0 },
+ {  79,   0 }, {  80,   0 }, {  81,   0 }, {  82,   0 }, {  83,   0 },
+ {  84,   0 }, {  85,   0 }, {  86,   0 }, {  87,   0 }, {  88,   0 },
+ {  89,   0 }, {  90,   0 }, {  91,   0 }, {  92,   0 }, {  93,   0 },
+ {  94,   0 }, {  95,   0 }, {  96,   0 }, {  97,   0 }, {  98,   0 },
+
+ {  99,   0 }, { 100,   0 }, { 101,   0 }, { 102,   0 }, { 103,   0 },
+ { 104,   0 }, { 105,   0 }, { 106,   0 }, { 107,   0 }, { 108,   0 },
+ { 109,   0 }, { 110,   0 }, { 111,   0 }, { 112,   0 }, { 113,   0 },
+ { 114,   0 }, { 115,   0 }, { 116,   0 }, { 117,   0 }, { 118,   0 },
+ { 119,   0 }, { 120,   0 }, { 121,   0 }, { 122,   0 }, { 123,   0 },
+ { 124,   0 }, { 125,   0 }, { 126,   0 }, { 127,   0 }, { 128,   0 },
+ { 129,   0 }, { 130,   0 }, { 131,   0 }, { 132,   0 }, { 133,   0 },
+ { 134,   0 }, { 135,   0 }, { 136,   0 }, { 137,   0 }, { 138,   0 },
+ { 139,   0 }, { 140,   0 }, { 141,   0 }, { 142,   0 }, { 143,   0 },
+ { 144,   0 }, { 145,   0 }, { 146,   0 }, { 147,   0 }, { 148,   0 },
+
+ { 149,   0 }, { 150,   0 }, { 151,   0 }, { 152,   0 }, { 153,   0 },
+ { 154,   0 }, { 155,   0 }, { 156,   0 }, { 157,   0 }, { 158,   0 },
+ { 159,   0 }, { 160,   0 }, { 161,   0 }, { 162,   0 }, { 163,   0 },
+ { 164,   0 }, { 165,   0 }, { 166,   0 }, { 167,   0 }, { 168,   0 },
+ { 169,   0 }, { 170,   0 }, { 171,   0 }, { 172,   0 }, { 173,   0 },
+ { 174,   0 }, { 175,   0 }, { 176,   0 }, { 177,   0 }, { 178,   0 },
+ { 179,   0 }, { 180,   0 }, { 181,   0 }, { 182,   0 }, { 183,   0 },
+ { 184,   0 }, { 185,   0 }, { 186,   0 }, { 187,   0 }, { 188,   0 },
+ { 189,   0 }, { 190,   0 }, { 191,   0 }, { 192,   0 }, { 193,   0 },
+ { 194,   0 }, { 195,   0 }, { 196,   0 }, { 197,   0 }, { 198,   0 },
+
+ { 199,   0 }, { 200,   0 }, { 201,   0 }, { 202,   0 }, { 203,   0 },
+ { 204,   0 }, { 205,   0 }, { 206,   0 }, { 207,   0 }, { 208,   0 },
+ { 209,   0 }, { 210,   0 }, { 211,   0 }, { 212,   0 }, { 213,   0 },
+ { 214,   0 }, { 215,   0 }, { 216,   0 }, { 217,   0 }, { 218,   0 },
+ { 219,   0 }, { 220,   0 }, { 221,   0 }, { 222,   0 }, { 223,   0 },
+ { 224,   0 }, { 225,   0 }, { 226,   0 }, { 227,   0 }, { 228,   0 },
+ { 229,   0 }, { 230,   0 }, { 231,   0 }, { 232,   0 }, { 233,   0 },
+ { 234,   0 }, { 235,   0 }, { 236,   0 }, { 237,   0 }, { 238,   0 },
+ { 239,   0 }, { 240,   0 }, { 241,   0 }, { 242,   0 }, { 243,   0 },
+ { 244,   0 }, { 245,   0 }, { 246,   0 }, { 247,   0 }, { 248,   0 },
+
+ { 249,   0 }, { 250,   0 }, { 251,   0 }, { 252,   0 }, { 253,   0 },
+ { 254,   0 }, { 255,   0 }, { 256,   0 }, {   0,   9 }, {   0,12291 },
+ {   1,-258 }, {   2,-258 }, {   3,-258 }, {   4,-258 }, {   5,-258 },
+ {   6,-258 }, {   7,-258 }, {   8,-258 }, {   9,   0 }, {  10, 258 },
+ {  11,-258 }, {  12,   0 }, {  13, 258 }, {  14,-258 }, {  15,-258 },
+ {  16,-258 }, {  17,-258 }, {  18,-258 }, {  19,-258 }, {  20,-258 },
+ {  21,-258 }, {  22,-258 }, {  23,-258 }, {  24,-258 }, {  25,-258 },
+ {  26,-258 }, {  27,-258 }, {  28,-258 }, {  29,-258 }, {  30,-258 },
+ {  31,-258 }, {  32,   0 }, {  33,-258 }, {  34,-258 }, {  35,-258 },
+ {  36,-258 }, {  37,-258 }, {  38,-258 }, {  39,-258 }, {  40,-258 },
+
+ {  41,-258 }, {  42,-258 }, {  43,-258 }, {  44,-258 }, {  45, 305 },
+ {  46,-258 }, {  47,-258 }, {  48,-258 }, {  49,-258 }, {  50,-258 },
+ {  51,-258 }, {  52,-258 }, {  53,-258 }, {  54,-258 }, {  55,-258 },
+ {  56,-258 }, {  57,-258 }, {  58,-258 }, {  59,-258 }, {  60,-258 },
+ {  61,-258 }, {  62,-258 }, {  63,-258 }, {  64,-258 }, {  65,-258 },
+ {  66,-258 }, {  67,-258 }, {  68,-258 }, {  69,-258 }, {  70,-258 },
+ {  71,-258 }, {  72,-258 }, {  73,-258 }, {  74,-258 }, {  75,-258 },
+ {  76,-258 }, {  77,-258 }, {  78,-258 }, {  79,-258 }, {  80,-258 },
+ {  81,-258 }, {  82,-258 }, {  83,-258 }, {  84,-258 }, {  85,-258 },
+ {  86,-258 }, {  87,-258 }, {  88,-258 }, {  89,-258 }, {  90,-258 },
+
+ {  91,-258 }, {  92,-258 }, {  93,-258 }, {  94,-258 }, {  95,-258 },
+ {  96,-258 }, {  97,-258 }, {  98,-258 }, {  99,-258 }, { 100,-258 },
+ { 101,-258 }, { 102,-258 }, { 103,-258 }, { 104,-258 }, { 105,-258 },
+ { 106,-258 }, { 107,-258 }, { 108,-258 }, { 109,-258 }, { 110,-258 },
+ { 111,-258 }, { 112,-258 }, { 113,-258 }, { 114,-258 }, { 115,-258 },
+ { 116,-258 }, { 117,-258 }, { 118,-258 }, { 119,-258 }, { 120,-258 },
+ { 121,-258 }, { 122,-258 }, { 123,-258 }, { 124,-258 }, { 125,-258 },
+ { 126,-258 }, { 127,-258 }, { 128,-258 }, { 129,-258 }, { 130,-258 },
+ { 131,-258 }, { 132,-258 }, { 133,-258 }, { 134,-258 }, { 135,-258 },
+ { 136,-258 }, { 137,-258 }, { 138,-258 }, { 139,-258 }, { 140,-258 },
+
+ { 141,-258 }, { 142,-258 }, { 143,-258 }, { 144,-258 }, { 145,-258 },
+ { 146,-258 }, { 147,-258 }, { 148,-258 }, { 149,-258 }, { 150,-258 },
+ { 151,-258 }, { 152,-258 }, { 153,-258 }, { 154,-258 }, { 155,-258 },
+ { 156,-258 }, { 157,-258 }, { 158,-258 }, { 159,-258 }, { 160,-258 },
+ { 161,-258 }, { 162,-258 }, { 163,-258 }, { 164,-258 }, { 165,-258 },
+ { 166,-258 }, { 167,-258 }, { 168,-258 }, { 169,-258 }, { 170,-258 },
+ { 171,-258 }, { 172,-258 }, { 173,-258 }, { 174,-258 }, { 175,-258 },
+ { 176,-258 }, { 177,-258 }, { 178,-258 }, { 179,-258 }, { 180,-258 },
+ { 181,-258 }, { 182,-258 }, { 183,-258 }, { 184,-258 }, { 185,-258 },
+ { 186,-258 }, { 187,-258 }, { 188,-258 }, { 189,-258 }, { 190,-258 },
+
+ { 191,-258 }, { 192,-258 }, { 193,-258 }, { 194,-258 }, { 195,-258 },
+ { 196,-258 }, { 197,-258 }, { 198,-258 }, { 199,-258 }, { 200,-258 },
+ { 201,-258 }, { 202,-258 }, { 203,-258 }, { 204,-258 }, { 205,-258 },
+ { 206,-258 }, { 207,-258 }, { 208,-258 }, { 209,-258 }, { 210,-258 },
+ { 211,-258 }, { 212,-258 }, { 213,-258 }, { 214,-258 }, { 215,-258 },
+ { 216,-258 }, { 217,-258 }, { 218,-258 }, { 219,-258 }, { 220,-258 },
+ { 221,-258 }, { 222,-258 }, { 223,-258 }, { 224,-258 }, { 225,-258 },
+ { 226,-258 }, { 227,-258 }, { 228,-258 }, { 229,-258 }, { 230,-258 },
+ { 231,-258 }, { 232,-258 }, { 233,-258 }, { 234,-258 }, { 235,-258 },
+ { 236,-258 }, { 237,-258 }, { 238,-258 }, { 239,-258 }, { 240,-258 },
+
+ { 241,-258 }, { 242,-258 }, { 243,-258 }, { 244,-258 }, { 245,-258 },
+ { 246,-258 }, { 247,-258 }, { 248,-258 }, { 249,-258 }, { 250,-258 },
+ { 251,-258 }, { 252,-258 }, { 253,-258 }, { 254,-258 }, { 255,-258 },
+ { 256,-258 }, {   0,   9 }, {   0,12033 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   9,-7240 }, {  10,-7240 }, {   0,   0 }, {  12,-7240 },
+ {  13,-7240 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  32,-7240 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  39,-17444 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  45,-17442 }, {   0,   9 }, {   0,11986 },
+ {   1,-563 }, {   2,-563 }, {   3,-563 }, {   4,-563 }, {   5,-563 },
+ {   6,-563 }, {   7,-563 }, {   8,-563 }, {   9,-305 }, {  10, -47 },
+ {  11,-563 }, {  12,-305 }, {  13, -47 }, {  14,-563 }, {  15,-563 },
+ {  16,-563 }, {  17,-563 }, {  18,-563 }, {  19,-563 }, {  20,-563 },
+ {  21,-563 }, {  22,-563 }, {  23,-563 }, {  24,-563 }, {  25,-563 },
+ {  26,-563 }, {  27,-563 }, {  28,-563 }, {  29,-563 }, {  30,-563 },
+ {  31,-563 }, {  32,-305 }, {  33,-563 }, {  34,-563 }, {  35,-563 },
+
+ {  36,-563 }, {  37,-563 }, {  38,-563 }, {  39,-563 }, {  40,-563 },
+ {  41,-563 }, {  42,-563 }, {  43,-563 }, {  44,-563 }, {  45,4007 },
+ {  46,-563 }, {  47,-563 }, {  48,-563 }, {  49,-563 }, {  50,-563 },
+ {  51,-563 }, {  52,-563 }, {  53,-563 }, {  54,-563 }, {  55,-563 },
+ {  56,-563 }, {  57,-563 }, {  58,-563 }, {  59,-563 }, {  60,-563 },
+ {  61,-563 }, {  62,-563 }, {  63,-563 }, {  64,-563 }, {  65,-563 },
+ {  66,-563 }, {  67,-563 }, {  68,-563 }, {  69,-563 }, {  70,-563 },
+ {  71,-563 }, {  72,-563 }, {  73,-563 }, {  74,-563 }, {  75,-563 },
+ {  76,-563 }, {  77,-563 }, {  78,-563 }, {  79,-563 }, {  80,-563 },
+ {  81,-563 }, {  82,-563 }, {  83,-563 }, {  84,-563 }, {  85,-563 },
+
+ {  86,-563 }, {  87,-563 }, {  88,-563 }, {  89,-563 }, {  90,-563 },
+ {  91,-563 }, {  92,-563 }, {  93,-563 }, {  94,-563 }, {  95,-563 },
+ {  96,-563 }, {  97,-563 }, {  98,-563 }, {  99,-563 }, { 100,-563 },
+ { 101,-563 }, { 102,-563 }, { 103,-563 }, { 104,-563 }, { 105,-563 },
+ { 106,-563 }, { 107,-563 }, { 108,-563 }, { 109,-563 }, { 110,-563 },
+ { 111,-563 }, { 112,-563 }, { 113,-563 }, { 114,-563 }, { 115,-563 },
+ { 116,-563 }, { 117,-563 }, { 118,-563 }, { 119,-563 }, { 120,-563 },
+ { 121,-563 }, { 122,-563 }, { 123,-563 }, { 124,-563 }, { 125,-563 },
+ { 126,-563 }, { 127,-563 }, { 128,-563 }, { 129,-563 }, { 130,-563 },
+ { 131,-563 }, { 132,-563 }, { 133,-563 }, { 134,-563 }, { 135,-563 },
+
+ { 136,-563 }, { 137,-563 }, { 138,-563 }, { 139,-563 }, { 140,-563 },
+ { 141,-563 }, { 142,-563 }, { 143,-563 }, { 144,-563 }, { 145,-563 },
+ { 146,-563 }, { 147,-563 }, { 148,-563 }, { 149,-563 }, { 150,-563 },
+ { 151,-563 }, { 152,-563 }, { 153,-563 }, { 154,-563 }, { 155,-563 },
+ { 156,-563 }, { 157,-563 }, { 158,-563 }, { 159,-563 }, { 160,-563 },
+ { 161,-563 }, { 162,-563 }, { 163,-563 }, { 164,-563 }, { 165,-563 },
+ { 166,-563 }, { 167,-563 }, { 168,-563 }, { 169,-563 }, { 170,-563 },
+ { 171,-563 }, { 172,-563 }, { 173,-563 }, { 174,-563 }, { 175,-563 },
+ { 176,-563 }, { 177,-563 }, { 178,-563 }, { 179,-563 }, { 180,-563 },
+ { 181,-563 }, { 182,-563 }, { 183,-563 }, { 184,-563 }, { 185,-563 },
+
+ { 186,-563 }, { 187,-563 }, { 188,-563 }, { 189,-563 }, { 190,-563 },
+ { 191,-563 }, { 192,-563 }, { 193,-563 }, { 194,-563 }, { 195,-563 },
+ { 196,-563 }, { 197,-563 }, { 198,-563 }, { 199,-563 }, { 200,-563 },
+ { 201,-563 }, { 202,-563 }, { 203,-563 }, { 204,-563 }, { 205,-563 },
+ { 206,-563 }, { 207,-563 }, { 208,-563 }, { 209,-563 }, { 210,-563 },
+ { 211,-563 }, { 212,-563 }, { 213,-563 }, { 214,-563 }, { 215,-563 },
+ { 216,-563 }, { 217,-563 }, { 218,-563 }, { 219,-563 }, { 220,-563 },
+ { 221,-563 }, { 222,-563 }, { 223,-563 }, { 224,-563 }, { 225,-563 },
+ { 226,-563 }, { 227,-563 }, { 228,-563 }, { 229,-563 }, { 230,-563 },
+ { 231,-563 }, { 232,-563 }, { 233,-563 }, { 234,-563 }, { 235,-563 },
+
+ { 236,-563 }, { 237,-563 }, { 238,-563 }, { 239,-563 }, { 240,-563 },
+ { 241,-563 }, { 242,-563 }, { 243,-563 }, { 244,-563 }, { 245,-563 },
+ { 246,-563 }, { 247,-563 }, { 248,-563 }, { 249,-563 }, { 250,-563 },
+ { 251,-563 }, { 252,-563 }, { 253,-563 }, { 254,-563 }, { 255,-563 },
+ { 256,-563 }, {   0,   9 }, {   0,11728 }, {   1,-4945 }, {   2,-4945 },
+ {   3,-4945 }, {   4,-4945 }, {   5,-4945 }, {   6,-4945 }, {   7,-4945 },
+ {   8,-4945 }, {   9,-4687 }, {  10,-11286 }, {  11,-4945 }, {  12,-4687 },
+ {  13,-11286 }, {  14,-4945 }, {  15,-4945 }, {  16,-4945 }, {  17,-4945 },
+ {  18,-4945 }, {  19,-4945 }, {  20,-4945 }, {  21,-4945 }, {  22,-4945 },
+ {  23,-4945 }, {  24,-4945 }, {  25,-4945 }, {  26,-4945 }, {  27,-4945 },
+
+ {  28,-4945 }, {  29,-4945 }, {  30,-4945 }, {  31,-4945 }, {  32,-4687 },
+ {  33,-4945 }, {  34,-4945 }, {  35,-4945 }, {  36,-4945 }, {  37,-4945 },
+ {  38,-4945 }, {  39,-4945 }, {  40,-4945 }, {  41,-4945 }, {  42,-4945 },
+ {  43,-4945 }, {  44,-4945 }, {  45,   0 }, {  46,-4945 }, {  47,-4945 },
+ {  48,-4945 }, {  49,-4945 }, {  50,-4945 }, {  51,-4945 }, {  52,-4945 },
+ {  53,-4945 }, {  54,-4945 }, {  55,-4945 }, {  56,-4945 }, {  57,-4945 },
+ {  58,-4945 }, {  59,-4945 }, {  60,-4945 }, {  61,-4945 }, {  62,-4945 },
+ {  63,-4945 }, {  64,-4945 }, {  65,-4945 }, {  66,-4945 }, {  67,-4945 },
+ {  68,-4945 }, {  69,-4945 }, {  70,-4945 }, {  71,-4945 }, {  72,-4945 },
+ {  73,-4945 }, {  74,-4945 }, {  75,-4945 }, {  76,-4945 }, {  77,-4945 },
+
+ {  78,-4945 }, {  79,-4945 }, {  80,-4945 }, {  81,-4945 }, {  82,-4945 },
+ {  83,-4945 }, {  84,-4945 }, {  85,-4945 }, {  86,-4945 }, {  87,-4945 },
+ {  88,-4945 }, {  89,-4945 }, {  90,-4945 }, {  91,-4945 }, {  92,-4945 },
+ {  93,-4945 }, {  94,-4945 }, {  95,-4945 }, {  96,-4945 }, {  97,-4945 },
+ {  98,-4945 }, {  99,-4945 }, { 100,-4945 }, { 101,-4945 }, { 102,-4945 },
+ { 103,-4945 }, { 104,-4945 }, { 105,-4945 }, { 106,-4945 }, { 107,-4945 },
+ { 108,-4945 }, { 109,-4945 }, { 110,-4945 }, { 111,-4945 }, { 112,-4945 },
+ { 113,-4945 }, { 114,-4945 }, { 115,-4945 }, { 116,-4945 }, { 117,-4945 },
+ { 118,-4945 }, { 119,-4945 }, { 120,-4945 }, { 121,-4945 }, { 122,-4945 },
+ { 123,-4945 }, { 124,-4945 }, { 125,-4945 }, { 126,-4945 }, { 127,-4945 },
+
+ { 128,-4945 }, { 129,-4945 }, { 130,-4945 }, { 131,-4945 }, { 132,-4945 },
+ { 133,-4945 }, { 134,-4945 }, { 135,-4945 }, { 136,-4945 }, { 137,-4945 },
+ { 138,-4945 }, { 139,-4945 }, { 140,-4945 }, { 141,-4945 }, { 142,-4945 },
+ { 143,-4945 }, { 144,-4945 }, { 145,-4945 }, { 146,-4945 }, { 147,-4945 },
+ { 148,-4945 }, { 149,-4945 }, { 150,-4945 }, { 151,-4945 }, { 152,-4945 },
+ { 153,-4945 }, { 154,-4945 }, { 155,-4945 }, { 156,-4945 }, { 157,-4945 },
+ { 158,-4945 }, { 159,-4945 }, { 160,-4945 }, { 161,-4945 }, { 162,-4945 },
+ { 163,-4945 }, { 164,-4945 }, { 165,-4945 }, { 166,-4945 }, { 167,-4945 },
+ { 168,-4945 }, { 169,-4945 }, { 170,-4945 }, { 171,-4945 }, { 172,-4945 },
+ { 173,-4945 }, { 174,-4945 }, { 175,-4945 }, { 176,-4945 }, { 177,-4945 },
+
+ { 178,-4945 }, { 179,-4945 }, { 180,-4945 }, { 181,-4945 }, { 182,-4945 },
+ { 183,-4945 }, { 184,-4945 }, { 185,-4945 }, { 186,-4945 }, { 187,-4945 },
+ { 188,-4945 }, { 189,-4945 }, { 190,-4945 }, { 191,-4945 }, { 192,-4945 },
+ { 193,-4945 }, { 194,-4945 }, { 195,-4945 }, { 196,-4945 }, { 197,-4945 },
+ { 198,-4945 }, { 199,-4945 }, { 200,-4945 }, { 201,-4945 }, { 202,-4945 },
+ { 203,-4945 }, { 204,-4945 }, { 205,-4945 }, { 206,-4945 }, { 207,-4945 },
+ { 208,-4945 }, { 209,-4945 }, { 210,-4945 }, { 211,-4945 }, { 212,-4945 },
+ { 213,-4945 }, { 214,-4945 }, { 215,-4945 }, { 216,-4945 }, { 217,-4945 },
+ { 218,-4945 }, { 219,-4945 }, { 220,-4945 }, { 221,-4945 }, { 222,-4945 },
+ { 223,-4945 }, { 224,-4945 }, { 225,-4945 }, { 226,-4945 }, { 227,-4945 },
+
+ { 228,-4945 }, { 229,-4945 }, { 230,-4945 }, { 231,-4945 }, { 232,-4945 },
+ { 233,-4945 }, { 234,-4945 }, { 235,-4945 }, { 236,-4945 }, { 237,-4945 },
+ { 238,-4945 }, { 239,-4945 }, { 240,-4945 }, { 241,-4945 }, { 242,-4945 },
+ { 243,-4945 }, { 244,-4945 }, { 245,-4945 }, { 246,-4945 }, { 247,-4945 },
+ { 248,-4945 }, { 249,-4945 }, { 250,-4945 }, { 251,-4945 }, { 252,-4945 },
+ { 253,-4945 }, { 254,-4945 }, { 255,-4945 }, { 256,-4945 }, {   0,  16 },
+ {   0,11470 }, {   1,   0 }, {   2,   0 }, {   3,   0 }, {   4,   0 },
+ {   5,   0 }, {   6,   0 }, {   7,   0 }, {   8,   0 }, {   9, 258 },
+ {  10, 516 }, {  11,   0 }, {  12, 258 }, {  13, 516 }, {  14,   0 },
+ {  15,   0 }, {  16,   0 }, {  17,   0 }, {  18,   0 }, {  19,   0 },
+
+ {  20,   0 }, {  21,   0 }, {  22,   0 }, {  23,   0 }, {  24,   0 },
+ {  25,   0 }, {  26,   0 }, {  27,   0 }, {  28,   0 }, {  29,   0 },
+ {  30,   0 }, {  31,   0 }, {  32, 258 }, {  33,   0 }, {  34,   0 },
+ {  35,   0 }, {  36,   0 }, {  37,   0 }, {  38,   0 }, {  39,   0 },
+ {  40,   0 }, {  41,   0 }, {  42,   0 }, {  43,   0 }, {  44,   0 },
+ {  45, 563 }, {  46,   0 }, {  47,   0 }, {  48,   0 }, {  49,   0 },
+ {  50,   0 }, {  51,   0 }, {  52,   0 }, {  53,   0 }, {  54,   0 },
+ {  55,   0 }, {  56,   0 }, {  57,   0 }, {  58,   0 }, {  59,   0 },
+ {  60,   0 }, {  61,   0 }, {  62,   0 }, {  63,   0 }, {  64,   0 },
+ {  65,   0 }, {  66,   0 }, {  67,   0 }, {  68,   0 }, {  69,   0 },
+
+ {  70,   0 }, {  71,   0 }, {  72,   0 }, {  73,   0 }, {  74,   0 },
+ {  75,   0 }, {  76,   0 }, {  77,   0 }, {  78,   0 }, {  79,   0 },
+ {  80,   0 }, {  81,   0 }, {  82,   0 }, {  83,   0 }, {  84,   0 },
+ {  85,   0 }, {  86,   0 }, {  87,   0 }, {  88,   0 }, {  89,   0 },
+ {  90,   0 }, {  91,   0 }, {  92,   0 }, {  93,   0 }, {  94,   0 },
+ {  95,   0 }, {  96,   0 }, {  97,   0 }, {  98,   0 }, {  99,   0 },
+ { 100,   0 }, { 101,   0 }, { 102,   0 }, { 103,   0 }, { 104,   0 },
+ { 105,   0 }, { 106,   0 }, { 107,   0 }, { 108,   0 }, { 109,   0 },
+ { 110,   0 }, { 111,   0 }, { 112,   0 }, { 113,   0 }, { 114,   0 },
+ { 115,   0 }, { 116,   0 }, { 117,   0 }, { 118,   0 }, { 119,   0 },
+
+ { 120,   0 }, { 121,   0 }, { 122,   0 }, { 123,   0 }, { 124,   0 },
+ { 125,   0 }, { 126,   0 }, { 127,   0 }, { 128,   0 }, { 129,   0 },
+ { 130,   0 }, { 131,   0 }, { 132,   0 }, { 133,   0 }, { 134,   0 },
+ { 135,   0 }, { 136,   0 }, { 137,   0 }, { 138,   0 }, { 139,   0 },
+ { 140,   0 }, { 141,   0 }, { 142,   0 }, { 143,   0 }, { 144,   0 },
+ { 145,   0 }, { 146,   0 }, { 147,   0 }, { 148,   0 }, { 149,   0 },
+ { 150,   0 }, { 151,   0 }, { 152,   0 }, { 153,   0 }, { 154,   0 },
+ { 155,   0 }, { 156,   0 }, { 157,   0 }, { 158,   0 }, { 159,   0 },
+ { 160,   0 }, { 161,   0 }, { 162,   0 }, { 163,   0 }, { 164,   0 },
+ { 165,   0 }, { 166,   0 }, { 167,   0 }, { 168,   0 }, { 169,   0 },
+
+ { 170,   0 }, { 171,   0 }, { 172,   0 }, { 173,   0 }, { 174,   0 },
+ { 175,   0 }, { 176,   0 }, { 177,   0 }, { 178,   0 }, { 179,   0 },
+ { 180,   0 }, { 181,   0 }, { 182,   0 }, { 183,   0 }, { 184,   0 },
+ { 185,   0 }, { 186,   0 }, { 187,   0 }, { 188,   0 }, { 189,   0 },
+ { 190,   0 }, { 191,   0 }, { 192,   0 }, { 193,   0 }, { 194,   0 },
+ { 195,   0 }, { 196,   0 }, { 197,   0 }, { 198,   0 }, { 199,   0 },
+ { 200,   0 }, { 201,   0 }, { 202,   0 }, { 203,   0 }, { 204,   0 },
+ { 205,   0 }, { 206,   0 }, { 207,   0 }, { 208,   0 }, { 209,   0 },
+ { 210,   0 }, { 211,   0 }, { 212,   0 }, { 213,   0 }, { 214,   0 },
+ { 215,   0 }, { 216,   0 }, { 217,   0 }, { 218,   0 }, { 219,   0 },
+
+ { 220,   0 }, { 221,   0 }, { 222,   0 }, { 223,   0 }, { 224,   0 },
+ { 225,   0 }, { 226,   0 }, { 227,   0 }, { 228,   0 }, { 229,   0 },
+ { 230,   0 }, { 231,   0 }, { 232,   0 }, { 233,   0 }, { 234,   0 },
+ { 235,   0 }, { 236,   0 }, { 237,   0 }, { 238,   0 }, { 239,   0 },
+ { 240,   0 }, { 241,   0 }, { 242,   0 }, { 243,   0 }, { 244,   0 },
+ { 245,   0 }, { 246,   0 }, { 247,   0 }, { 248,   0 }, { 249,   0 },
+ { 250,   0 }, { 251,   0 }, { 252,   0 }, { 253,   0 }, { 254,   0 },
+ { 255,   0 }, { 256,   0 }, {   0,  16 }, {   0,11212 }, {   1,-258 },
+ {   2,-258 }, {   3,-258 }, {   4,-258 }, {   5,-258 }, {   6,-258 },
+ {   7,-258 }, {   8,-258 }, {   9,   0 }, {  10, 258 }, {  11,-258 },
+
+ {  12,   0 }, {  13, 258 }, {  14,-258 }, {  15,-258 }, {  16,-258 },
+ {  17,-258 }, {  18,-258 }, {  19,-258 }, {  20,-258 }, {  21,-258 },
+ {  22,-258 }, {  23,-258 }, {  24,-258 }, {  25,-258 }, {  26,-258 },
+ {  27,-258 }, {  28,-258 }, {  29,-258 }, {  30,-258 }, {  31,-258 },
+ {  32,   0 }, {  33,-258 }, {  34,-258 }, {  35,-258 }, {  36,-258 },
+ {  37,-258 }, {  38,-258 }, {  39,-258 }, {  40,-258 }, {  41,-258 },
+ {  42,-258 }, {  43,-258 }, {  44,-258 }, {  45, 305 }, {  46,-258 },
+ {  47,-258 }, {  48,-258 }, {  49,-258 }, {  50,-258 }, {  51,-258 },
+ {  52,-258 }, {  53,-258 }, {  54,-258 }, {  55,-258 }, {  56,-258 },
+ {  57,-258 }, {  58,-258 }, {  59,-258 }, {  60,-258 }, {  61,-258 },
+
+ {  62,-258 }, {  63,-258 }, {  64,-258 }, {  65,-258 }, {  66,-258 },
+ {  67,-258 }, {  68,-258 }, {  69,-258 }, {  70,-258 }, {  71,-258 },
+ {  72,-258 }, {  73,-258 }, {  74,-258 }, {  75,-258 }, {  76,-258 },
+ {  77,-258 }, {  78,-258 }, {  79,-258 }, {  80,-258 }, {  81,-258 },
+ {  82,-258 }, {  83,-258 }, {  84,-258 }, {  85,-258 }, {  86,-258 },
+ {  87,-258 }, {  88,-258 }, {  89,-258 }, {  90,-258 }, {  91,-258 },
+ {  92,-258 }, {  93,-258 }, {  94,-258 }, {  95,-258 }, {  96,-258 },
+ {  97,-258 }, {  98,-258 }, {  99,-258 }, { 100,-258 }, { 101,-258 },
+ { 102,-258 }, { 103,-258 }, { 104,-258 }, { 105,-258 }, { 106,-258 },
+ { 107,-258 }, { 108,-258 }, { 109,-258 }, { 110,-258 }, { 111,-258 },
+
+ { 112,-258 }, { 113,-258 }, { 114,-258 }, { 115,-258 }, { 116,-258 },
+ { 117,-258 }, { 118,-258 }, { 119,-258 }, { 120,-258 }, { 121,-258 },
+ { 122,-258 }, { 123,-258 }, { 124,-258 }, { 125,-258 }, { 126,-258 },
+ { 127,-258 }, { 128,-258 }, { 129,-258 }, { 130,-258 }, { 131,-258 },
+ { 132,-258 }, { 133,-258 }, { 134,-258 }, { 135,-258 }, { 136,-258 },
+ { 137,-258 }, { 138,-258 }, { 139,-258 }, { 140,-258 }, { 141,-258 },
+ { 142,-258 }, { 143,-258 }, { 144,-258 }, { 145,-258 }, { 146,-258 },
+ { 147,-258 }, { 148,-258 }, { 149,-258 }, { 150,-258 }, { 151,-258 },
+ { 152,-258 }, { 153,-258 }, { 154,-258 }, { 155,-258 }, { 156,-258 },
+ { 157,-258 }, { 158,-258 }, { 159,-258 }, { 160,-258 }, { 161,-258 },
+
+ { 162,-258 }, { 163,-258 }, { 164,-258 }, { 165,-258 }, { 166,-258 },
+ { 167,-258 }, { 168,-258 }, { 169,-258 }, { 170,-258 }, { 171,-258 },
+ { 172,-258 }, { 173,-258 }, { 174,-258 }, { 175,-258 }, { 176,-258 },
+ { 177,-258 }, { 178,-258 }, { 179,-258 }, { 180,-258 }, { 181,-258 },
+ { 182,-258 }, { 183,-258 }, { 184,-258 }, { 185,-258 }, { 186,-258 },
+ { 187,-258 }, { 188,-258 }, { 189,-258 }, { 190,-258 }, { 191,-258 },
+ { 192,-258 }, { 193,-258 }, { 194,-258 }, { 195,-258 }, { 196,-258 },
+ { 197,-258 }, { 198,-258 }, { 199,-258 }, { 200,-258 }, { 201,-258 },
+ { 202,-258 }, { 203,-258 }, { 204,-258 }, { 205,-258 }, { 206,-258 },
+ { 207,-258 }, { 208,-258 }, { 209,-258 }, { 210,-258 }, { 211,-258 },
+
+ { 212,-258 }, { 213,-258 }, { 214,-258 }, { 215,-258 }, { 216,-258 },
+ { 217,-258 }, { 218,-258 }, { 219,-258 }, { 220,-258 }, { 221,-258 },
+ { 222,-258 }, { 223,-258 }, { 224,-258 }, { 225,-258 }, { 226,-258 },
+ { 227,-258 }, { 228,-258 }, { 229,-258 }, { 230,-258 }, { 231,-258 },
+ { 232,-258 }, { 233,-258 }, { 234,-258 }, { 235,-258 }, { 236,-258 },
+ { 237,-258 }, { 238,-258 }, { 239,-258 }, { 240,-258 }, { 241,-258 },
+ { 242,-258 }, { 243,-258 }, { 244,-258 }, { 245,-258 }, { 246,-258 },
+ { 247,-258 }, { 248,-258 }, { 249,-258 }, { 250,-258 }, { 251,-258 },
+ { 252,-258 }, { 253,-258 }, { 254,-258 }, { 255,-258 }, { 256,-258 },
+ {   0,  16 }, {   0,10954 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   9,-8007 }, {  10,-8007 }, {   0,   0 }, {  12,-8007 }, {  13,-8007 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  32,-8007 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  39,-18519 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  45,-18514 }, {   0,  16 }, {   0,10907 }, {   1,-563 },
+ {   2,-563 }, {   3,-563 }, {   4,-563 }, {   5,-563 }, {   6,-563 },
+
+ {   7,-563 }, {   8,-563 }, {   9,-305 }, {  10, -47 }, {  11,-563 },
+ {  12,-305 }, {  13, -47 }, {  14,-563 }, {  15,-563 }, {  16,-563 },
+ {  17,-563 }, {  18,-563 }, {  19,-563 }, {  20,-563 }, {  21,-563 },
+ {  22,-563 }, {  23,-563 }, {  24,-563 }, {  25,-563 }, {  26,-563 },
+ {  27,-563 }, {  28,-563 }, {  29,-563 }, {  30,-563 }, {  31,-563 },
+ {  32,-305 }, {  33,-563 }, {  34,-563 }, {  35,-563 }, {  36,-563 },
+ {  37,-563 }, {  38,-563 }, {  39,-563 }, {  40,-563 }, {  41,-563 },
+ {  42,-563 }, {  43,-563 }, {  44,-563 }, {  45,3186 }, {  46,-563 },
+ {  47,-563 }, {  48,-563 }, {  49,-563 }, {  50,-563 }, {  51,-563 },
+ {  52,-563 }, {  53,-563 }, {  54,-563 }, {  55,-563 }, {  56,-563 },
+
+ {  57,-563 }, {  58,-563 }, {  59,-563 }, {  60,-563 }, {  61,-563 },
+ {  62,-563 }, {  63,-563 }, {  64,-563 }, {  65,-563 }, {  66,-563 },
+ {  67,-563 }, {  68,-563 }, {  69,-563 }, {  70,-563 }, {  71,-563 },
+ {  72,-563 }, {  73,-563 }, {  74,-563 }, {  75,-563 }, {  76,-563 },
+ {  77,-563 }, {  78,-563 }, {  79,-563 }, {  80,-563 }, {  81,-563 },
+ {  82,-563 }, {  83,-563 }, {  84,-563 }, {  85,-563 }, {  86,-563 },
+ {  87,-563 }, {  88,-563 }, {  89,-563 }, {  90,-563 }, {  91,-563 },
+ {  92,-563 }, {  93,-563 }, {  94,-563 }, {  95,-563 }, {  96,-563 },
+ {  97,-563 }, {  98,-563 }, {  99,-563 }, { 100,-563 }, { 101,-563 },
+ { 102,-563 }, { 103,-563 }, { 104,-563 }, { 105,-563 }, { 106,-563 },
+
+ { 107,-563 }, { 108,-563 }, { 109,-563 }, { 110,-563 }, { 111,-563 },
+ { 112,-563 }, { 113,-563 }, { 114,-563 }, { 115,-563 }, { 116,-563 },
+ { 117,-563 }, { 118,-563 }, { 119,-563 }, { 120,-563 }, { 121,-563 },
+ { 122,-563 }, { 123,-563 }, { 124,-563 }, { 125,-563 }, { 126,-563 },
+ { 127,-563 }, { 128,-563 }, { 129,-563 }, { 130,-563 }, { 131,-563 },
+ { 132,-563 }, { 133,-563 }, { 134,-563 }, { 135,-563 }, { 136,-563 },
+ { 137,-563 }, { 138,-563 }, { 139,-563 }, { 140,-563 }, { 141,-563 },
+ { 142,-563 }, { 143,-563 }, { 144,-563 }, { 145,-563 }, { 146,-563 },
+ { 147,-563 }, { 148,-563 }, { 149,-563 }, { 150,-563 }, { 151,-563 },
+ { 152,-563 }, { 153,-563 }, { 154,-563 }, { 155,-563 }, { 156,-563 },
+
+ { 157,-563 }, { 158,-563 }, { 159,-563 }, { 160,-563 }, { 161,-563 },
+ { 162,-563 }, { 163,-563 }, { 164,-563 }, { 165,-563 }, { 166,-563 },
+ { 167,-563 }, { 168,-563 }, { 169,-563 }, { 170,-563 }, { 171,-563 },
+ { 172,-563 }, { 173,-563 }, { 174,-563 }, { 175,-563 }, { 176,-563 },
+ { 177,-563 }, { 178,-563 }, { 179,-563 }, { 180,-563 }, { 181,-563 },
+ { 182,-563 }, { 183,-563 }, { 184,-563 }, { 185,-563 }, { 186,-563 },
+ { 187,-563 }, { 188,-563 }, { 189,-563 }, { 190,-563 }, { 191,-563 },
+ { 192,-563 }, { 193,-563 }, { 194,-563 }, { 195,-563 }, { 196,-563 },
+ { 197,-563 }, { 198,-563 }, { 199,-563 }, { 200,-563 }, { 201,-563 },
+ { 202,-563 }, { 203,-563 }, { 204,-563 }, { 205,-563 }, { 206,-563 },
+
+ { 207,-563 }, { 208,-563 }, { 209,-563 }, { 210,-563 }, { 211,-563 },
+ { 212,-563 }, { 213,-563 }, { 214,-563 }, { 215,-563 }, { 216,-563 },
+ { 217,-563 }, { 218,-563 }, { 219,-563 }, { 220,-563 }, { 221,-563 },
+ { 222,-563 }, { 223,-563 }, { 224,-563 }, { 225,-563 }, { 226,-563 },
+ { 227,-563 }, { 228,-563 }, { 229,-563 }, { 230,-563 }, { 231,-563 },
+ { 232,-563 }, { 233,-563 }, { 234,-563 }, { 235,-563 }, { 236,-563 },
+ { 237,-563 }, { 238,-563 }, { 239,-563 }, { 240,-563 }, { 241,-563 },
+ { 242,-563 }, { 243,-563 }, { 244,-563 }, { 245,-563 }, { 246,-563 },
+ { 247,-563 }, { 248,-563 }, { 249,-563 }, { 250,-563 }, { 251,-563 },
+ { 252,-563 }, { 253,-563 }, { 254,-563 }, { 255,-563 }, { 256,-563 },
+
+ {   0,  16 }, {   0,10649 }, {   1,-4992 }, {   2,-4992 }, {   3,-4992 },
+ {   4,-4992 }, {   5,-4992 }, {   6,-4992 }, {   7,-4992 }, {   8,-4992 },
+ {   9,-4734 }, {  10,-11411 }, {  11,-4992 }, {  12,-4734 }, {  13,-11411 },
+ {  14,-4992 }, {  15,-4992 }, {  16,-4992 }, {  17,-4992 }, {  18,-4992 },
+ {  19,-4992 }, {  20,-4992 }, {  21,-4992 }, {  22,-4992 }, {  23,-4992 },
+ {  24,-4992 }, {  25,-4992 }, {  26,-4992 }, {  27,-4992 }, {  28,-4992 },
+ {  29,-4992 }, {  30,-4992 }, {  31,-4992 }, {  32,-4734 }, {  33,-4992 },
+ {  34,-4992 }, {  35,-4992 }, {  36,-4992 }, {  37,-4992 }, {  38,-4992 },
+ {  39,-4992 }, {  40,-4992 }, {  41,-4992 }, {  42,-4992 }, {  43,-4992 },
+ {  44,-4992 }, {  45,   0 }, {  46,-4992 }, {  47,-4992 }, {  48,-4992 },
+
+ {  49,-4992 }, {  50,-4992 }, {  51,-4992 }, {  52,-4992 }, {  53,-4992 },
+ {  54,-4992 }, {  55,-4992 }, {  56,-4992 }, {  57,-4992 }, {  58,-4992 },
+ {  59,-4992 }, {  60,-4992 }, {  61,-4992 }, {  62,-4992 }, {  63,-4992 },
+ {  64,-4992 }, {  65,-4992 }, {  66,-4992 }, {  67,-4992 }, {  68,-4992 },
+ {  69,-4992 }, {  70,-4992 }, {  71,-4992 }, {  72,-4992 }, {  73,-4992 },
+ {  74,-4992 }, {  75,-4992 }, {  76,-4992 }, {  77,-4992 }, {  78,-4992 },
+ {  79,-4992 }, {  80,-4992 }, {  81,-4992 }, {  82,-4992 }, {  83,-4992 },
+ {  84,-4992 }, {  85,-4992 }, {  86,-4992 }, {  87,-4992 }, {  88,-4992 },
+ {  89,-4992 }, {  90,-4992 }, {  91,-4992 }, {  92,-4992 }, {  93,-4992 },
+ {  94,-4992 }, {  95,-4992 }, {  96,-4992 }, {  97,-4992 }, {  98,-4992 },
+
+ {  99,-4992 }, { 100,-4992 }, { 101,-4992 }, { 102,-4992 }, { 103,-4992 },
+ { 104,-4992 }, { 105,-4992 }, { 106,-4992 }, { 107,-4992 }, { 108,-4992 },
+ { 109,-4992 }, { 110,-4992 }, { 111,-4992 }, { 112,-4992 }, { 113,-4992 },
+ { 114,-4992 }, { 115,-4992 }, { 116,-4992 }, { 117,-4992 }, { 118,-4992 },
+ { 119,-4992 }, { 120,-4992 }, { 121,-4992 }, { 122,-4992 }, { 123,-4992 },
+ { 124,-4992 }, { 125,-4992 }, { 126,-4992 }, { 127,-4992 }, { 128,-4992 },
+ { 129,-4992 }, { 130,-4992 }, { 131,-4992 }, { 132,-4992 }, { 133,-4992 },
+ { 134,-4992 }, { 135,-4992 }, { 136,-4992 }, { 137,-4992 }, { 138,-4992 },
+ { 139,-4992 }, { 140,-4992 }, { 141,-4992 }, { 142,-4992 }, { 143,-4992 },
+ { 144,-4992 }, { 145,-4992 }, { 146,-4992 }, { 147,-4992 }, { 148,-4992 },
+
+ { 149,-4992 }, { 150,-4992 }, { 151,-4992 }, { 152,-4992 }, { 153,-4992 },
+ { 154,-4992 }, { 155,-4992 }, { 156,-4992 }, { 157,-4992 }, { 158,-4992 },
+ { 159,-4992 }, { 160,-4992 }, { 161,-4992 }, { 162,-4992 }, { 163,-4992 },
+ { 164,-4992 }, { 165,-4992 }, { 166,-4992 }, { 167,-4992 }, { 168,-4992 },
+ { 169,-4992 }, { 170,-4992 }, { 171,-4992 }, { 172,-4992 }, { 173,-4992 },
+ { 174,-4992 }, { 175,-4992 }, { 176,-4992 }, { 177,-4992 }, { 178,-4992 },
+ { 179,-4992 }, { 180,-4992 }, { 181,-4992 }, { 182,-4992 }, { 183,-4992 },
+ { 184,-4992 }, { 185,-4992 }, { 186,-4992 }, { 187,-4992 }, { 188,-4992 },
+ { 189,-4992 }, { 190,-4992 }, { 191,-4992 }, { 192,-4992 }, { 193,-4992 },
+ { 194,-4992 }, { 195,-4992 }, { 196,-4992 }, { 197,-4992 }, { 198,-4992 },
+
+ { 199,-4992 }, { 200,-4992 }, { 201,-4992 }, { 202,-4992 }, { 203,-4992 },
+ { 204,-4992 }, { 205,-4992 }, { 206,-4992 }, { 207,-4992 }, { 208,-4992 },
+ { 209,-4992 }, { 210,-4992 }, { 211,-4992 }, { 212,-4992 }, { 213,-4992 },
+ { 214,-4992 }, { 215,-4992 }, { 216,-4992 }, { 217,-4992 }, { 218,-4992 },
+ { 219,-4992 }, { 220,-4992 }, { 221,-4992 }, { 222,-4992 }, { 223,-4992 },
+ { 224,-4992 }, { 225,-4992 }, { 226,-4992 }, { 227,-4992 }, { 228,-4992 },
+ { 229,-4992 }, { 230,-4992 }, { 231,-4992 }, { 232,-4992 }, { 233,-4992 },
+ { 234,-4992 }, { 235,-4992 }, { 236,-4992 }, { 237,-4992 }, { 238,-4992 },
+ { 239,-4992 }, { 240,-4992 }, { 241,-4992 }, { 242,-4992 }, { 243,-4992 },
+ { 244,-4992 }, { 245,-4992 }, { 246,-4992 }, { 247,-4992 }, { 248,-4992 },
+
+ { 249,-4992 }, { 250,-4992 }, { 251,-4992 }, { 252,-4992 }, { 253,-4992 },
+ { 254,-4992 }, { 255,-4992 }, { 256,-4992 }, {   0,  22 }, {   0,10391 },
+ {   1,   0 }, {   2,   0 }, {   3,   0 }, {   4,   0 }, {   5,   0 },
+ {   6,   0 }, {   7,   0 }, {   8,   0 }, {   9, 258 }, {  10, 516 },
+ {  11,   0 }, {  12, 258 }, {  13, 516 }, {  14,   0 }, {  15,   0 },
+ {  16,   0 }, {  17,   0 }, {  18,   0 }, {  19,   0 }, {  20,   0 },
+ {  21,   0 }, {  22,   0 }, {  23,   0 }, {  24,   0 }, {  25,   0 },
+ {  26,   0 }, {  27,   0 }, {  28,   0 }, {  29,   0 }, {  30,   0 },
+ {  31,   0 }, {  32, 258 }, {  33,   0 }, {  34,   0 }, {  35,   0 },
+ {  36,   0 }, {  37,   0 }, {  38,   0 }, {  39,   0 }, {  40,   0 },
+
+ {  41,   0 }, {  42,   0 }, {  43,   0 }, {  44,   0 }, {  45, 563 },
+ {  46,   0 }, {  47,   0 }, {  48,   0 }, {  49,   0 }, {  50,   0 },
+ {  51,   0 }, {  52,   0 }, {  53,   0 }, {  54,   0 }, {  55,   0 },
+ {  56,   0 }, {  57,   0 }, {  58,   0 }, {  59,   0 }, {  60,   0 },
+ {  61,   0 }, {  62,   0 }, {  63,   0 }, {  64,   0 }, {  65,   0 },
+ {  66,   0 }, {  67,   0 }, {  68,   0 }, {  69,   0 }, {  70,   0 },
+ {  71,   0 }, {  72,   0 }, {  73,   0 }, {  74,   0 }, {  75,   0 },
+ {  76,   0 }, {  77,   0 }, {  78,   0 }, {  79,   0 }, {  80,   0 },
+ {  81,   0 }, {  82,   0 }, {  83,   0 }, {  84,   0 }, {  85,   0 },
+ {  86,   0 }, {  87,   0 }, {  88,   0 }, {  89,   0 }, {  90,   0 },
+
+ {  91,   0 }, {  92,   0 }, {  93,   0 }, {  94,   0 }, {  95,   0 },
+ {  96,   0 }, {  97,   0 }, {  98,   0 }, {  99,   0 }, { 100,   0 },
+ { 101,   0 }, { 102,   0 }, { 103,   0 }, { 104,   0 }, { 105,   0 },
+ { 106,   0 }, { 107,   0 }, { 108,   0 }, { 109,   0 }, { 110,   0 },
+ { 111,   0 }, { 112,   0 }, { 113,   0 }, { 114,   0 }, { 115,   0 },
+ { 116,   0 }, { 117,   0 }, { 118,   0 }, { 119,   0 }, { 120,   0 },
+ { 121,   0 }, { 122,   0 }, { 123,   0 }, { 124,   0 }, { 125,   0 },
+ { 126,   0 }, { 127,   0 }, { 128,   0 }, { 129,   0 }, { 130,   0 },
+ { 131,   0 }, { 132,   0 }, { 133,   0 }, { 134,   0 }, { 135,   0 },
+ { 136,   0 }, { 137,   0 }, { 138,   0 }, { 139,   0 }, { 140,   0 },
+
+ { 141,   0 }, { 142,   0 }, { 143,   0 }, { 144,   0 }, { 145,   0 },
+ { 146,   0 }, { 147,   0 }, { 148,   0 }, { 149,   0 }, { 150,   0 },
+ { 151,   0 }, { 152,   0 }, { 153,   0 }, { 154,   0 }, { 155,   0 },
+ { 156,   0 }, { 157,   0 }, { 158,   0 }, { 159,   0 }, { 160,   0 },
+ { 161,   0 }, { 162,   0 }, { 163,   0 }, { 164,   0 }, { 165,   0 },
+ { 166,   0 }, { 167,   0 }, { 168,   0 }, { 169,   0 }, { 170,   0 },
+ { 171,   0 }, { 172,   0 }, { 173,   0 }, { 174,   0 }, { 175,   0 },
+ { 176,   0 }, { 177,   0 }, { 178,   0 }, { 179,   0 }, { 180,   0 },
+ { 181,   0 }, { 182,   0 }, { 183,   0 }, { 184,   0 }, { 185,   0 },
+ { 186,   0 }, { 187,   0 }, { 188,   0 }, { 189,   0 }, { 190,   0 },
+
+ { 191,   0 }, { 192,   0 }, { 193,   0 }, { 194,   0 }, { 195,   0 },
+ { 196,   0 }, { 197,   0 }, { 198,   0 }, { 199,   0 }, { 200,   0 },
+ { 201,   0 }, { 202,   0 }, { 203,   0 }, { 204,   0 }, { 205,   0 },
+ { 206,   0 }, { 207,   0 }, { 208,   0 }, { 209,   0 }, { 210,   0 },
+ { 211,   0 }, { 212,   0 }, { 213,   0 }, { 214,   0 }, { 215,   0 },
+ { 216,   0 }, { 217,   0 }, { 218,   0 }, { 219,   0 }, { 220,   0 },
+ { 221,   0 }, { 222,   0 }, { 223,   0 }, { 224,   0 }, { 225,   0 },
+ { 226,   0 }, { 227,   0 }, { 228,   0 }, { 229,   0 }, { 230,   0 },
+ { 231,   0 }, { 232,   0 }, { 233,   0 }, { 234,   0 }, { 235,   0 },
+ { 236,   0 }, { 237,   0 }, { 238,   0 }, { 239,   0 }, { 240,   0 },
+
+ { 241,   0 }, { 242,   0 }, { 243,   0 }, { 244,   0 }, { 245,   0 },
+ { 246,   0 }, { 247,   0 }, { 248,   0 }, { 249,   0 }, { 250,   0 },
+ { 251,   0 }, { 252,   0 }, { 253,   0 }, { 254,   0 }, { 255,   0 },
+ { 256,   0 }, {   0,  22 }, {   0,10133 }, {   1,-258 }, {   2,-258 },
+ {   3,-258 }, {   4,-258 }, {   5,-258 }, {   6,-258 }, {   7,-258 },
+ {   8,-258 }, {   9,   0 }, {  10, 258 }, {  11,-258 }, {  12,   0 },
+ {  13, 258 }, {  14,-258 }, {  15,-258 }, {  16,-258 }, {  17,-258 },
+ {  18,-258 }, {  19,-258 }, {  20,-258 }, {  21,-258 }, {  22,-258 },
+ {  23,-258 }, {  24,-258 }, {  25,-258 }, {  26,-258 }, {  27,-258 },
+ {  28,-258 }, {  29,-258 }, {  30,-258 }, {  31,-258 }, {  32,   0 },
+
+ {  33,-258 }, {  34,-258 }, {  35,-258 }, {  36,-258 }, {  37,-258 },
+ {  38,-258 }, {  39,-258 }, {  40,-258 }, {  41,-258 }, {  42,-258 },
+ {  43,-258 }, {  44,-258 }, {  45, 305 }, {  46,-258 }, {  47,-258 },
+ {  48,-258 }, {  49,-258 }, {  50,-258 }, {  51,-258 }, {  52,-258 },
+ {  53,-258 }, {  54,-258 }, {  55,-258 }, {  56,-258 }, {  57,-258 },
+ {  58,-258 }, {  59,-258 }, {  60,-258 }, {  61,-258 }, {  62,-258 },
+ {  63,-258 }, {  64,-258 }, {  65,-258 }, {  66,-258 }, {  67,-258 },
+ {  68,-258 }, {  69,-258 }, {  70,-258 }, {  71,-258 }, {  72,-258 },
+ {  73,-258 }, {  74,-258 }, {  75,-258 }, {  76,-258 }, {  77,-258 },
+ {  78,-258 }, {  79,-258 }, {  80,-258 }, {  81,-258 }, {  82,-258 },
+
+ {  83,-258 }, {  84,-258 }, {  85,-258 }, {  86,-258 }, {  87,-258 },
+ {  88,-258 }, {  89,-258 }, {  90,-258 }, {  91,-258 }, {  92,-258 },
+ {  93,-258 }, {  94,-258 }, {  95,-258 }, {  96,-258 }, {  97,-258 },
+ {  98,-258 }, {  99,-258 }, { 100,-258 }, { 101,-258 }, { 102,-258 },
+ { 103,-258 }, { 104,-258 }, { 105,-258 }, { 106,-258 }, { 107,-258 },
+ { 108,-258 }, { 109,-258 }, { 110,-258 }, { 111,-258 }, { 112,-258 },
+ { 113,-258 }, { 114,-258 }, { 115,-258 }, { 116,-258 }, { 117,-258 },
+ { 118,-258 }, { 119,-258 }, { 120,-258 }, { 121,-258 }, { 122,-258 },
+ { 123,-258 }, { 124,-258 }, { 125,-258 }, { 126,-258 }, { 127,-258 },
+ { 128,-258 }, { 129,-258 }, { 130,-258 }, { 131,-258 }, { 132,-258 },
+
+ { 133,-258 }, { 134,-258 }, { 135,-258 }, { 136,-258 }, { 137,-258 },
+ { 138,-258 }, { 139,-258 }, { 140,-258 }, { 141,-258 }, { 142,-258 },
+ { 143,-258 }, { 144,-258 }, { 145,-258 }, { 146,-258 }, { 147,-258 },
+ { 148,-258 }, { 149,-258 }, { 150,-258 }, { 151,-258 }, { 152,-258 },
+ { 153,-258 }, { 154,-258 }, { 155,-258 }, { 156,-258 }, { 157,-258 },
+ { 158,-258 }, { 159,-258 }, { 160,-258 }, { 161,-258 }, { 162,-258 },
+ { 163,-258 }, { 164,-258 }, { 165,-258 }, { 166,-258 }, { 167,-258 },
+ { 168,-258 }, { 169,-258 }, { 170,-258 }, { 171,-258 }, { 172,-258 },
+ { 173,-258 }, { 174,-258 }, { 175,-258 }, { 176,-258 }, { 177,-258 },
+ { 178,-258 }, { 179,-258 }, { 180,-258 }, { 181,-258 }, { 182,-258 },
+
+ { 183,-258 }, { 184,-258 }, { 185,-258 }, { 186,-258 }, { 187,-258 },
+ { 188,-258 }, { 189,-258 }, { 190,-258 }, { 191,-258 }, { 192,-258 },
+ { 193,-258 }, { 194,-258 }, { 195,-258 }, { 196,-258 }, { 197,-258 },
+ { 198,-258 }, { 199,-258 }, { 200,-258 }, { 201,-258 }, { 202,-258 },
+ { 203,-258 }, { 204,-258 }, { 205,-258 }, { 206,-258 }, { 207,-258 },
+ { 208,-258 }, { 209,-258 }, { 210,-258 }, { 211,-258 }, { 212,-258 },
+ { 213,-258 }, { 214,-258 }, { 215,-258 }, { 216,-258 }, { 217,-258 },
+ { 218,-258 }, { 219,-258 }, { 220,-258 }, { 221,-258 }, { 222,-258 },
+ { 223,-258 }, { 224,-258 }, { 225,-258 }, { 226,-258 }, { 227,-258 },
+ { 228,-258 }, { 229,-258 }, { 230,-258 }, { 231,-258 }, { 232,-258 },
+
+ { 233,-258 }, { 234,-258 }, { 235,-258 }, { 236,-258 }, { 237,-258 },
+ { 238,-258 }, { 239,-258 }, { 240,-258 }, { 241,-258 }, { 242,-258 },
+ { 243,-258 }, { 244,-258 }, { 245,-258 }, { 246,-258 }, { 247,-258 },
+ { 248,-258 }, { 249,-258 }, { 250,-258 }, { 251,-258 }, { 252,-258 },
+ { 253,-258 }, { 254,-258 }, { 255,-258 }, { 256,-258 }, {   0,  22 },
+ {   0,9875 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   9,-8707 },
+ {  10,-8707 }, {   0,   0 }, {  12,-8707 }, {  13,-8707 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  32,-8707 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  39,-19584 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  45,-19557 }, {   0,  22 }, {   0,9828 }, {   1,-563 }, {   2,-563 },
+ {   3,-563 }, {   4,-563 }, {   5,-563 }, {   6,-563 }, {   7,-563 },
+ {   8,-563 }, {   9,-305 }, {  10, -47 }, {  11,-563 }, {  12,-305 },
+ {  13, -47 }, {  14,-563 }, {  15,-563 }, {  16,-563 }, {  17,-563 },
+ {  18,-563 }, {  19,-563 }, {  20,-563 }, {  21,-563 }, {  22,-563 },
+ {  23,-563 }, {  24,-563 }, {  25,-563 }, {  26,-563 }, {  27,-563 },
+
+ {  28,-563 }, {  29,-563 }, {  30,-563 }, {  31,-563 }, {  32,-305 },
+ {  33,-563 }, {  34,-563 }, {  35,-563 }, {  36,-563 }, {  37,-563 },
+ {  38,-563 }, {  39,-563 }, {  40,-563 }, {  41,-563 }, {  42,-563 },
+ {  43,-563 }, {  44,-563 }, {  45,2365 }, {  46,-563 }, {  47,-563 },
+ {  48,-563 }, {  49,-563 }, {  50,-563 }, {  51,-563 }, {  52,-563 },
+ {  53,-563 }, {  54,-563 }, {  55,-563 }, {  56,-563 }, {  57,-563 },
+ {  58,-563 }, {  59,-563 }, {  60,-563 }, {  61,-563 }, {  62,-563 },
+ {  63,-563 }, {  64,-563 }, {  65,-563 }, {  66,-563 }, {  67,-563 },
+ {  68,-563 }, {  69,-563 }, {  70,-563 }, {  71,-563 }, {  72,-563 },
+ {  73,-563 }, {  74,-563 }, {  75,-563 }, {  76,-563 }, {  77,-563 },
+
+ {  78,-563 }, {  79,-563 }, {  80,-563 }, {  81,-563 }, {  82,-563 },
+ {  83,-563 }, {  84,-563 }, {  85,-563 }, {  86,-563 }, {  87,-563 },
+ {  88,-563 }, {  89,-563 }, {  90,-563 }, {  91,-563 }, {  92,-563 },
+ {  93,-563 }, {  94,-563 }, {  95,-563 }, {  96,-563 }, {  97,-563 },
+ {  98,-563 }, {  99,-563 }, { 100,-563 }, { 101,-563 }, { 102,-563 },
+ { 103,-563 }, { 104,-563 }, { 105,-563 }, { 106,-563 }, { 107,-563 },
+ { 108,-563 }, { 109,-563 }, { 110,-563 }, { 111,-563 }, { 112,-563 },
+ { 113,-563 }, { 114,-563 }, { 115,-563 }, { 116,-563 }, { 117,-563 },
+ { 118,-563 }, { 119,-563 }, { 120,-563 }, { 121,-563 }, { 122,-563 },
+ { 123,-563 }, { 124,-563 }, { 125,-563 }, { 126,-563 }, { 127,-563 },
+
+ { 128,-563 }, { 129,-563 }, { 130,-563 }, { 131,-563 }, { 132,-563 },
+ { 133,-563 }, { 134,-563 }, { 135,-563 }, { 136,-563 }, { 137,-563 },
+ { 138,-563 }, { 139,-563 }, { 140,-563 }, { 141,-563 }, { 142,-563 },
+ { 143,-563 }, { 144,-563 }, { 145,-563 }, { 146,-563 }, { 147,-563 },
+ { 148,-563 }, { 149,-563 }, { 150,-563 }, { 151,-563 }, { 152,-563 },
+ { 153,-563 }, { 154,-563 }, { 155,-563 }, { 156,-563 }, { 157,-563 },
+ { 158,-563 }, { 159,-563 }, { 160,-563 }, { 161,-563 }, { 162,-563 },
+ { 163,-563 }, { 164,-563 }, { 165,-563 }, { 166,-563 }, { 167,-563 },
+ { 168,-563 }, { 169,-563 }, { 170,-563 }, { 171,-563 }, { 172,-563 },
+ { 173,-563 }, { 174,-563 }, { 175,-563 }, { 176,-563 }, { 177,-563 },
+
+ { 178,-563 }, { 179,-563 }, { 180,-563 }, { 181,-563 }, { 182,-563 },
+ { 183,-563 }, { 184,-563 }, { 185,-563 }, { 186,-563 }, { 187,-563 },
+ { 188,-563 }, { 189,-563 }, { 190,-563 }, { 191,-563 }, { 192,-563 },
+ { 193,-563 }, { 194,-563 }, { 195,-563 }, { 196,-563 }, { 197,-563 },
+ { 198,-563 }, { 199,-563 }, { 200,-563 }, { 201,-563 }, { 202,-563 },
+ { 203,-563 }, { 204,-563 }, { 205,-563 }, { 206,-563 }, { 207,-563 },
+ { 208,-563 }, { 209,-563 }, { 210,-563 }, { 211,-563 }, { 212,-563 },
+ { 213,-563 }, { 214,-563 }, { 215,-563 }, { 216,-563 }, { 217,-563 },
+ { 218,-563 }, { 219,-563 }, { 220,-563 }, { 221,-563 }, { 222,-563 },
+ { 223,-563 }, { 224,-563 }, { 225,-563 }, { 226,-563 }, { 227,-563 },
+
+ { 228,-563 }, { 229,-563 }, { 230,-563 }, { 231,-563 }, { 232,-563 },
+ { 233,-563 }, { 234,-563 }, { 235,-563 }, { 236,-563 }, { 237,-563 },
+ { 238,-563 }, { 239,-563 }, { 240,-563 }, { 241,-563 }, { 242,-563 },
+ { 243,-563 }, { 244,-563 }, { 245,-563 }, { 246,-563 }, { 247,-563 },
+ { 248,-563 }, { 249,-563 }, { 250,-563 }, { 251,-563 }, { 252,-563 },
+ { 253,-563 }, { 254,-563 }, { 255,-563 }, { 256,-563 }, {   0,  22 },
+ {   0,9570 }, {   1,-5039 }, {   2,-5039 }, {   3,-5039 }, {   4,-5039 },
+ {   5,-5039 }, {   6,-5039 }, {   7,-5039 }, {   8,-5039 }, {   9,-4781 },
+ {  10,-12180 }, {  11,-5039 }, {  12,-4781 }, {  13,-12180 }, {  14,-5039 },
+ {  15,-5039 }, {  16,-5039 }, {  17,-5039 }, {  18,-5039 }, {  19,-5039 },
+
+ {  20,-5039 }, {  21,-5039 }, {  22,-5039 }, {  23,-5039 }, {  24,-5039 },
+ {  25,-5039 }, {  26,-5039 }, {  27,-5039 }, {  28,-5039 }, {  29,-5039 },
+ {  30,-5039 }, {  31,-5039 }, {  32,-4781 }, {  33,-5039 }, {  34,-5039 },
+ {  35,-5039 }, {  36,-5039 }, {  37,-5039 }, {  38,-5039 }, {  39,-5039 },
+ {  40,-5039 }, {  41,-5039 }, {  42,-5039 }, {  43,-5039 }, {  44,-5039 },
+ {  45,   0 }, {  46,-5039 }, {  47,-5039 }, {  48,-5039 }, {  49,-5039 },
+ {  50,-5039 }, {  51,-5039 }, {  52,-5039 }, {  53,-5039 }, {  54,-5039 },
+ {  55,-5039 }, {  56,-5039 }, {  57,-5039 }, {  58,-5039 }, {  59,-5039 },
+ {  60,-5039 }, {  61,-5039 }, {  62,-5039 }, {  63,-5039 }, {  64,-5039 },
+ {  65,-5039 }, {  66,-5039 }, {  67,-5039 }, {  68,-5039 }, {  69,-5039 },
+
+ {  70,-5039 }, {  71,-5039 }, {  72,-5039 }, {  73,-5039 }, {  74,-5039 },
+ {  75,-5039 }, {  76,-5039 }, {  77,-5039 }, {  78,-5039 }, {  79,-5039 },
+ {  80,-5039 }, {  81,-5039 }, {  82,-5039 }, {  83,-5039 }, {  84,-5039 },
+ {  85,-5039 }, {  86,-5039 }, {  87,-5039 }, {  88,-5039 }, {  89,-5039 },
+ {  90,-5039 }, {  91,-5039 }, {  92,-5039 }, {  93,-5039 }, {  94,-5039 },
+ {  95,-5039 }, {  96,-5039 }, {  97,-5039 }, {  98,-5039 }, {  99,-5039 },
+ { 100,-5039 }, { 101,-5039 }, { 102,-5039 }, { 103,-5039 }, { 104,-5039 },
+ { 105,-5039 }, { 106,-5039 }, { 107,-5039 }, { 108,-5039 }, { 109,-5039 },
+ { 110,-5039 }, { 111,-5039 }, { 112,-5039 }, { 113,-5039 }, { 114,-5039 },
+ { 115,-5039 }, { 116,-5039 }, { 117,-5039 }, { 118,-5039 }, { 119,-5039 },
+
+ { 120,-5039 }, { 121,-5039 }, { 122,-5039 }, { 123,-5039 }, { 124,-5039 },
+ { 125,-5039 }, { 126,-5039 }, { 127,-5039 }, { 128,-5039 }, { 129,-5039 },
+ { 130,-5039 }, { 131,-5039 }, { 132,-5039 }, { 133,-5039 }, { 134,-5039 },
+ { 135,-5039 }, { 136,-5039 }, { 137,-5039 }, { 138,-5039 }, { 139,-5039 },
+ { 140,-5039 }, { 141,-5039 }, { 142,-5039 }, { 143,-5039 }, { 144,-5039 },
+ { 145,-5039 }, { 146,-5039 }, { 147,-5039 }, { 148,-5039 }, { 149,-5039 },
+ { 150,-5039 }, { 151,-5039 }, { 152,-5039 }, { 153,-5039 }, { 154,-5039 },
+ { 155,-5039 }, { 156,-5039 }, { 157,-5039 }, { 158,-5039 }, { 159,-5039 },
+ { 160,-5039 }, { 161,-5039 }, { 162,-5039 }, { 163,-5039 }, { 164,-5039 },
+ { 165,-5039 }, { 166,-5039 }, { 167,-5039 }, { 168,-5039 }, { 169,-5039 },
+
+ { 170,-5039 }, { 171,-5039 }, { 172,-5039 }, { 173,-5039 }, { 174,-5039 },
+ { 175,-5039 }, { 176,-5039 }, { 177,-5039 }, { 178,-5039 }, { 179,-5039 },
+ { 180,-5039 }, { 181,-5039 }, { 182,-5039 }, { 183,-5039 }, { 184,-5039 },
+ { 185,-5039 }, { 186,-5039 }, { 187,-5039 }, { 188,-5039 }, { 189,-5039 },
+ { 190,-5039 }, { 191,-5039 }, { 192,-5039 }, { 193,-5039 }, { 194,-5039 },
+ { 195,-5039 }, { 196,-5039 }, { 197,-5039 }, { 198,-5039 }, { 199,-5039 },
+ { 200,-5039 }, { 201,-5039 }, { 202,-5039 }, { 203,-5039 }, { 204,-5039 },
+ { 205,-5039 }, { 206,-5039 }, { 207,-5039 }, { 208,-5039 }, { 209,-5039 },
+ { 210,-5039 }, { 211,-5039 }, { 212,-5039 }, { 213,-5039 }, { 214,-5039 },
+ { 215,-5039 }, { 216,-5039 }, { 217,-5039 }, { 218,-5039 }, { 219,-5039 },
+
+ { 220,-5039 }, { 221,-5039 }, { 222,-5039 }, { 223,-5039 }, { 224,-5039 },
+ { 225,-5039 }, { 226,-5039 }, { 227,-5039 }, { 228,-5039 }, { 229,-5039 },
+ { 230,-5039 }, { 231,-5039 }, { 232,-5039 }, { 233,-5039 }, { 234,-5039 },
+ { 235,-5039 }, { 236,-5039 }, { 237,-5039 }, { 238,-5039 }, { 239,-5039 },
+ { 240,-5039 }, { 241,-5039 }, { 242,-5039 }, { 243,-5039 }, { 244,-5039 },
+ { 245,-5039 }, { 246,-5039 }, { 247,-5039 }, { 248,-5039 }, { 249,-5039 },
+ { 250,-5039 }, { 251,-5039 }, { 252,-5039 }, { 253,-5039 }, { 254,-5039 },
+ { 255,-5039 }, { 256,-5039 }, {   0,  37 }, {   0,9312 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,  37 }, {   0,9289 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  48,2107 }, {  49,2107 }, {  50,2107 }, {  51,2107 },
+ {  52,2107 }, {  53,2107 }, {  54,2107 }, {  55,2107 }, {  56,2107 },
+ {  57,2107 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  65,2107 }, {  66,2107 },
+ {  67,2107 }, {  68,2107 }, {  69,2107 }, {  70,2107 }, {  48,-19314 },
+ {  49,-19314 }, {  50,-19314 }, {  51,-19314 }, {  52,-19314 }, {  53,-19314 },
+ {  54,-19314 }, {  55,-19314 }, {  56,-19314 }, {  57,-19314 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  65,-19314 }, {  66,-19314 }, {  67,-19314 }, {  68,-19314 },
+ {  69,-19314 }, {  70,-19314 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  97,2107 }, {  98,2107 }, {  99,2107 }, { 100,2107 }, { 101,2107 },
+ { 102,2107 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  97,-19314 }, {  98,-19314 },
+ {  99,-19314 }, { 100,-19314 }, { 101,-19314 }, { 102,-19314 }, {   0,  24 },
+ {   0,9185 }, {   1,   0 }, {   2,   0 }, {   3,   0 }, {   4,   0 },
+ {   5,   0 }, {   6,   0 }, {   7,   0 }, {   8,   0 }, {   9, 258 },
+ {  10, 516 }, {  11,   0 }, {  12, 258 }, {  13, 516 }, {  14,   0 },
+ {  15,   0 }, {  16,   0 }, {  17,   0 }, {  18,   0 }, {  19,   0 },
+ {  20,   0 }, {  21,   0 }, {  22,   0 }, {  23,   0 }, {  24,   0 },
+ {  25,   0 }, {  26,   0 }, {  27,   0 }, {  28,   0 }, {  29,   0 },
+ {  30,   0 }, {  31,   0 }, {  32, 258 }, {  33,   0 }, {  34,   0 },
+
+ {  35,   0 }, {  36,   0 }, {  37,   0 }, {  38,   0 }, {  39,   0 },
+ {  40,   0 }, {  41,   0 }, {  42,   0 }, {  43,   0 }, {  44,   0 },
+ {  45, 563 }, {  46,   0 }, {  47,   0 }, {  48,   0 }, {  49,   0 },
+ {  50,   0 }, {  51,   0 }, {  52,   0 }, {  53,   0 }, {  54,   0 },
+ {  55,   0 }, {  56,   0 }, {  57,   0 }, {  58,   0 }, {  59,   0 },
+ {  60,   0 }, {  61,   0 }, {  62,   0 }, {  63,   0 }, {  64,   0 },
+ {  65,   0 }, {  66,   0 }, {  67,   0 }, {  68,   0 }, {  69,   0 },
+ {  70,   0 }, {  71,   0 }, {  72,   0 }, {  73,   0 }, {  74,   0 },
+ {  75,   0 }, {  76,   0 }, {  77,   0 }, {  78,   0 }, {  79,   0 },
+ {  80,   0 }, {  81,   0 }, {  82,   0 }, {  83,   0 }, {  84,   0 },
+
+ {  85,   0 }, {  86,   0 }, {  87,   0 }, {  88,   0 }, {  89,   0 },
+ {  90,   0 }, {  91,   0 }, {  92,   0 }, {  93,   0 }, {  94,   0 },
+ {  95,   0 }, {  96,   0 }, {  97,   0 }, {  98,   0 }, {  99,   0 },
+ { 100,   0 }, { 101,   0 }, { 102,   0 }, { 103,   0 }, { 104,   0 },
+ { 105,   0 }, { 106,   0 }, { 107,   0 }, { 108,   0 }, { 109,   0 },
+ { 110,   0 }, { 111,   0 }, { 112,   0 }, { 113,   0 }, { 114,   0 },
+ { 115,   0 }, { 116,   0 }, { 117,   0 }, { 118,   0 }, { 119,   0 },
+ { 120,   0 }, { 121,   0 }, { 122,   0 }, { 123,   0 }, { 124,   0 },
+ { 125,   0 }, { 126,   0 }, { 127,   0 }, { 128,   0 }, { 129,   0 },
+ { 130,   0 }, { 131,   0 }, { 132,   0 }, { 133,   0 }, { 134,   0 },
+
+ { 135,   0 }, { 136,   0 }, { 137,   0 }, { 138,   0 }, { 139,   0 },
+ { 140,   0 }, { 141,   0 }, { 142,   0 }, { 143,   0 }, { 144,   0 },
+ { 145,   0 }, { 146,   0 }, { 147,   0 }, { 148,   0 }, { 149,   0 },
+ { 150,   0 }, { 151,   0 }, { 152,   0 }, { 153,   0 }, { 154,   0 },
+ { 155,   0 }, { 156,   0 }, { 157,   0 }, { 158,   0 }, { 159,   0 },
+ { 160,   0 }, { 161,   0 }, { 162,   0 }, { 163,   0 }, { 164,   0 },
+ { 165,   0 }, { 166,   0 }, { 167,   0 }, { 168,   0 }, { 169,   0 },
+ { 170,   0 }, { 171,   0 }, { 172,   0 }, { 173,   0 }, { 174,   0 },
+ { 175,   0 }, { 176,   0 }, { 177,   0 }, { 178,   0 }, { 179,   0 },
+ { 180,   0 }, { 181,   0 }, { 182,   0 }, { 183,   0 }, { 184,   0 },
+
+ { 185,   0 }, { 186,   0 }, { 187,   0 }, { 188,   0 }, { 189,   0 },
+ { 190,   0 }, { 191,   0 }, { 192,   0 }, { 193,   0 }, { 194,   0 },
+ { 195,   0 }, { 196,   0 }, { 197,   0 }, { 198,   0 }, { 199,   0 },
+ { 200,   0 }, { 201,   0 }, { 202,   0 }, { 203,   0 }, { 204,   0 },
+ { 205,   0 }, { 206,   0 }, { 207,   0 }, { 208,   0 }, { 209,   0 },
+ { 210,   0 }, { 211,   0 }, { 212,   0 }, { 213,   0 }, { 214,   0 },
+ { 215,   0 }, { 216,   0 }, { 217,   0 }, { 218,   0 }, { 219,   0 },
+ { 220,   0 }, { 221,   0 }, { 222,   0 }, { 223,   0 }, { 224,   0 },
+ { 225,   0 }, { 226,   0 }, { 227,   0 }, { 228,   0 }, { 229,   0 },
+ { 230,   0 }, { 231,   0 }, { 232,   0 }, { 233,   0 }, { 234,   0 },
+
+ { 235,   0 }, { 236,   0 }, { 237,   0 }, { 238,   0 }, { 239,   0 },
+ { 240,   0 }, { 241,   0 }, { 242,   0 }, { 243,   0 }, { 244,   0 },
+ { 245,   0 }, { 246,   0 }, { 247,   0 }, { 248,   0 }, { 249,   0 },
+ { 250,   0 }, { 251,   0 }, { 252,   0 }, { 253,   0 }, { 254,   0 },
+ { 255,   0 }, { 256,   0 }, {   0,  24 }, {   0,8927 }, {   1,-258 },
+ {   2,-258 }, {   3,-258 }, {   4,-258 }, {   5,-258 }, {   6,-258 },
+ {   7,-258 }, {   8,-258 }, {   9,   0 }, {  10, 258 }, {  11,-258 },
+ {  12,   0 }, {  13, 258 }, {  14,-258 }, {  15,-258 }, {  16,-258 },
+ {  17,-258 }, {  18,-258 }, {  19,-258 }, {  20,-258 }, {  21,-258 },
+ {  22,-258 }, {  23,-258 }, {  24,-258 }, {  25,-258 }, {  26,-258 },
+
+ {  27,-258 }, {  28,-258 }, {  29,-258 }, {  30,-258 }, {  31,-258 },
+ {  32,   0 }, {  33,-258 }, {  34,-258 }, {  35,-258 }, {  36,-258 },
+ {  37,-258 }, {  38,-258 }, {  39,-258 }, {  40,-258 }, {  41,-258 },
+ {  42,-258 }, {  43,-258 }, {  44,-258 }, {  45, 305 }, {  46,-258 },
+ {  47,-258 }, {  48,-258 }, {  49,-258 }, {  50,-258 }, {  51,-258 },
+ {  52,-258 }, {  53,-258 }, {  54,-258 }, {  55,-258 }, {  56,-258 },
+ {  57,-258 }, {  58,-258 }, {  59,-258 }, {  60,-258 }, {  61,-258 },
+ {  62,-258 }, {  63,-258 }, {  64,-258 }, {  65,-258 }, {  66,-258 },
+ {  67,-258 }, {  68,-258 }, {  69,-258 }, {  70,-258 }, {  71,-258 },
+ {  72,-258 }, {  73,-258 }, {  74,-258 }, {  75,-258 }, {  76,-258 },
+
+ {  77,-258 }, {  78,-258 }, {  79,-258 }, {  80,-258 }, {  81,-258 },
+ {  82,-258 }, {  83,-258 }, {  84,-258 }, {  85,-258 }, {  86,-258 },
+ {  87,-258 }, {  88,-258 }, {  89,-258 }, {  90,-258 }, {  91,-258 },
+ {  92,-258 }, {  93,-258 }, {  94,-258 }, {  95,-258 }, {  96,-258 },
+ {  97,-258 }, {  98,-258 }, {  99,-258 }, { 100,-258 }, { 101,-258 },
+ { 102,-258 }, { 103,-258 }, { 104,-258 }, { 105,-258 }, { 106,-258 },
+ { 107,-258 }, { 108,-258 }, { 109,-258 }, { 110,-258 }, { 111,-258 },
+ { 112,-258 }, { 113,-258 }, { 114,-258 }, { 115,-258 }, { 116,-258 },
+ { 117,-258 }, { 118,-258 }, { 119,-258 }, { 120,-258 }, { 121,-258 },
+ { 122,-258 }, { 123,-258 }, { 124,-258 }, { 125,-258 }, { 126,-258 },
+
+ { 127,-258 }, { 128,-258 }, { 129,-258 }, { 130,-258 }, { 131,-258 },
+ { 132,-258 }, { 133,-258 }, { 134,-258 }, { 135,-258 }, { 136,-258 },
+ { 137,-258 }, { 138,-258 }, { 139,-258 }, { 140,-258 }, { 141,-258 },
+ { 142,-258 }, { 143,-258 }, { 144,-258 }, { 145,-258 }, { 146,-258 },
+ { 147,-258 }, { 148,-258 }, { 149,-258 }, { 150,-258 }, { 151,-258 },
+ { 152,-258 }, { 153,-258 }, { 154,-258 }, { 155,-258 }, { 156,-258 },
+ { 157,-258 }, { 158,-258 }, { 159,-258 }, { 160,-258 }, { 161,-258 },
+ { 162,-258 }, { 163,-258 }, { 164,-258 }, { 165,-258 }, { 166,-258 },
+ { 167,-258 }, { 168,-258 }, { 169,-258 }, { 170,-258 }, { 171,-258 },
+ { 172,-258 }, { 173,-258 }, { 174,-258 }, { 175,-258 }, { 176,-258 },
+
+ { 177,-258 }, { 178,-258 }, { 179,-258 }, { 180,-258 }, { 181,-258 },
+ { 182,-258 }, { 183,-258 }, { 184,-258 }, { 185,-258 }, { 186,-258 },
+ { 187,-258 }, { 188,-258 }, { 189,-258 }, { 190,-258 }, { 191,-258 },
+ { 192,-258 }, { 193,-258 }, { 194,-258 }, { 195,-258 }, { 196,-258 },
+ { 197,-258 }, { 198,-258 }, { 199,-258 }, { 200,-258 }, { 201,-258 },
+ { 202,-258 }, { 203,-258 }, { 204,-258 }, { 205,-258 }, { 206,-258 },
+ { 207,-258 }, { 208,-258 }, { 209,-258 }, { 210,-258 }, { 211,-258 },
+ { 212,-258 }, { 213,-258 }, { 214,-258 }, { 215,-258 }, { 216,-258 },
+ { 217,-258 }, { 218,-258 }, { 219,-258 }, { 220,-258 }, { 221,-258 },
+ { 222,-258 }, { 223,-258 }, { 224,-258 }, { 225,-258 }, { 226,-258 },
+
+ { 227,-258 }, { 228,-258 }, { 229,-258 }, { 230,-258 }, { 231,-258 },
+ { 232,-258 }, { 233,-258 }, { 234,-258 }, { 235,-258 }, { 236,-258 },
+ { 237,-258 }, { 238,-258 }, { 239,-258 }, { 240,-258 }, { 241,-258 },
+ { 242,-258 }, { 243,-258 }, { 244,-258 }, { 245,-258 }, { 246,-258 },
+ { 247,-258 }, { 248,-258 }, { 249,-258 }, { 250,-258 }, { 251,-258 },
+ { 252,-258 }, { 253,-258 }, { 254,-258 }, { 255,-258 }, { 256,-258 },
+ {   0,  24 }, {   0,8669 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   9,-8952 }, {  10,-8952 }, {   0,   0 }, {  12,-8952 }, {  13,-8952 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  32,-8952 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  39,-20790 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  45,-20726 }, {   0,  24 }, {   0,8622 }, {   1,-563 },
+ {   2,-563 }, {   3,-563 }, {   4,-563 }, {   5,-563 }, {   6,-563 },
+ {   7,-563 }, {   8,-563 }, {   9,-305 }, {  10, -47 }, {  11,-563 },
+ {  12,-305 }, {  13, -47 }, {  14,-563 }, {  15,-563 }, {  16,-563 },
+ {  17,-563 }, {  18,-563 }, {  19,-563 }, {  20,-563 }, {  21,-563 },
+
+ {  22,-563 }, {  23,-563 }, {  24,-563 }, {  25,-563 }, {  26,-563 },
+ {  27,-563 }, {  28,-563 }, {  29,-563 }, {  30,-563 }, {  31,-563 },
+ {  32,-305 }, {  33,-563 }, {  34,-563 }, {  35,-563 }, {  36,-563 },
+ {  37,-563 }, {  38,-563 }, {  39,-563 }, {  40,-563 }, {  41,-563 },
+ {  42,-563 }, {  43,-563 }, {  44,-563 }, {  45,1521 }, {  46,-563 },
+ {  47,-563 }, {  48,-563 }, {  49,-563 }, {  50,-563 }, {  51,-563 },
+ {  52,-563 }, {  53,-563 }, {  54,-563 }, {  55,-563 }, {  56,-563 },
+ {  57,-563 }, {  58,-563 }, {  59,-563 }, {  60,-563 }, {  61,-563 },
+ {  62,-563 }, {  63,-563 }, {  64,-563 }, {  65,-563 }, {  66,-563 },
+ {  67,-563 }, {  68,-563 }, {  69,-563 }, {  70,-563 }, {  71,-563 },
+
+ {  72,-563 }, {  73,-563 }, {  74,-563 }, {  75,-563 }, {  76,-563 },
+ {  77,-563 }, {  78,-563 }, {  79,-563 }, {  80,-563 }, {  81,-563 },
+ {  82,-563 }, {  83,-563 }, {  84,-563 }, {  85,-563 }, {  86,-563 },
+ {  87,-563 }, {  88,-563 }, {  89,-563 }, {  90,-563 }, {  91,-563 },
+ {  92,-563 }, {  93,-563 }, {  94,-563 }, {  95,-563 }, {  96,-563 },
+ {  97,-563 }, {  98,-563 }, {  99,-563 }, { 100,-563 }, { 101,-563 },
+ { 102,-563 }, { 103,-563 }, { 104,-563 }, { 105,-563 }, { 106,-563 },
+ { 107,-563 }, { 108,-563 }, { 109,-563 }, { 110,-563 }, { 111,-563 },
+ { 112,-563 }, { 113,-563 }, { 114,-563 }, { 115,-563 }, { 116,-563 },
+ { 117,-563 }, { 118,-563 }, { 119,-563 }, { 120,-563 }, { 121,-563 },
+
+ { 122,-563 }, { 123,-563 }, { 124,-563 }, { 125,-563 }, { 126,-563 },
+ { 127,-563 }, { 128,-563 }, { 129,-563 }, { 130,-563 }, { 131,-563 },
+ { 132,-563 }, { 133,-563 }, { 134,-563 }, { 135,-563 }, { 136,-563 },
+ { 137,-563 }, { 138,-563 }, { 139,-563 }, { 140,-563 }, { 141,-563 },
+ { 142,-563 }, { 143,-563 }, { 144,-563 }, { 145,-563 }, { 146,-563 },
+ { 147,-563 }, { 148,-563 }, { 149,-563 }, { 150,-563 }, { 151,-563 },
+ { 152,-563 }, { 153,-563 }, { 154,-563 }, { 155,-563 }, { 156,-563 },
+ { 157,-563 }, { 158,-563 }, { 159,-563 }, { 160,-563 }, { 161,-563 },
+ { 162,-563 }, { 163,-563 }, { 164,-563 }, { 165,-563 }, { 166,-563 },
+ { 167,-563 }, { 168,-563 }, { 169,-563 }, { 170,-563 }, { 171,-563 },
+
+ { 172,-563 }, { 173,-563 }, { 174,-563 }, { 175,-563 }, { 176,-563 },
+ { 177,-563 }, { 178,-563 }, { 179,-563 }, { 180,-563 }, { 181,-563 },
+ { 182,-563 }, { 183,-563 }, { 184,-563 }, { 185,-563 }, { 186,-563 },
+ { 187,-563 }, { 188,-563 }, { 189,-563 }, { 190,-563 }, { 191,-563 },
+ { 192,-563 }, { 193,-563 }, { 194,-563 }, { 195,-563 }, { 196,-563 },
+ { 197,-563 }, { 198,-563 }, { 199,-563 }, { 200,-563 }, { 201,-563 },
+ { 202,-563 }, { 203,-563 }, { 204,-563 }, { 205,-563 }, { 206,-563 },
+ { 207,-563 }, { 208,-563 }, { 209,-563 }, { 210,-563 }, { 211,-563 },
+ { 212,-563 }, { 213,-563 }, { 214,-563 }, { 215,-563 }, { 216,-563 },
+ { 217,-563 }, { 218,-563 }, { 219,-563 }, { 220,-563 }, { 221,-563 },
+
+ { 222,-563 }, { 223,-563 }, { 224,-563 }, { 225,-563 }, { 226,-563 },
+ { 227,-563 }, { 228,-563 }, { 229,-563 }, { 230,-563 }, { 231,-563 },
+ { 232,-563 }, { 233,-563 }, { 234,-563 }, { 235,-563 }, { 236,-563 },
+ { 237,-563 }, { 238,-563 }, { 239,-563 }, { 240,-563 }, { 241,-563 },
+ { 242,-563 }, { 243,-563 }, { 244,-563 }, { 245,-563 }, { 246,-563 },
+ { 247,-563 }, { 248,-563 }, { 249,-563 }, { 250,-563 }, { 251,-563 },
+ { 252,-563 }, { 253,-563 }, { 254,-563 }, { 255,-563 }, { 256,-563 },
+ {   0,  24 }, {   0,8364 }, {   1,-5086 }, {   2,-5086 }, {   3,-5086 },
+ {   4,-5086 }, {   5,-5086 }, {   6,-5086 }, {   7,-5086 }, {   8,-5086 },
+ {   9,-4828 }, {  10,-12170 }, {  11,-5086 }, {  12,-4828 }, {  13,-12170 },
+
+ {  14,-5086 }, {  15,-5086 }, {  16,-5086 }, {  17,-5086 }, {  18,-5086 },
+ {  19,-5086 }, {  20,-5086 }, {  21,-5086 }, {  22,-5086 }, {  23,-5086 },
+ {  24,-5086 }, {  25,-5086 }, {  26,-5086 }, {  27,-5086 }, {  28,-5086 },
+ {  29,-5086 }, {  30,-5086 }, {  31,-5086 }, {  32,-4828 }, {  33,-5086 },
+ {  34,-5086 }, {  35,-5086 }, {  36,-5086 }, {  37,-5086 }, {  38,-5086 },
+ {  39,-5086 }, {  40,-5086 }, {  41,-5086 }, {  42,-5086 }, {  43,-5086 },
+ {  44,-5086 }, {  45,   0 }, {  46,-5086 }, {  47,-5086 }, {  48,-5086 },
+ {  49,-5086 }, {  50,-5086 }, {  51,-5086 }, {  52,-5086 }, {  53,-5086 },
+ {  54,-5086 }, {  55,-5086 }, {  56,-5086 }, {  57,-5086 }, {  58,-5086 },
+ {  59,-5086 }, {  60,-5086 }, {  61,-5086 }, {  62,-5086 }, {  63,-5086 },
+
+ {  64,-5086 }, {  65,-5086 }, {  66,-5086 }, {  67,-5086 }, {  68,-5086 },
+ {  69,-5086 }, {  70,-5086 }, {  71,-5086 }, {  72,-5086 }, {  73,-5086 },
+ {  74,-5086 }, {  75,-5086 }, {  76,-5086 }, {  77,-5086 }, {  78,-5086 },
+ {  79,-5086 }, {  80,-5086 }, {  81,-5086 }, {  82,-5086 }, {  83,-5086 },
+ {  84,-5086 }, {  85,-5086 }, {  86,-5086 }, {  87,-5086 }, {  88,-5086 },
+ {  89,-5086 }, {  90,-5086 }, {  91,-5086 }, {  92,-5086 }, {  93,-5086 },
+ {  94,-5086 }, {  95,-5086 }, {  96,-5086 }, {  97,-5086 }, {  98,-5086 },
+ {  99,-5086 }, { 100,-5086 }, { 101,-5086 }, { 102,-5086 }, { 103,-5086 },
+ { 104,-5086 }, { 105,-5086 }, { 106,-5086 }, { 107,-5086 }, { 108,-5086 },
+ { 109,-5086 }, { 110,-5086 }, { 111,-5086 }, { 112,-5086 }, { 113,-5086 },
+
+ { 114,-5086 }, { 115,-5086 }, { 116,-5086 }, { 117,-5086 }, { 118,-5086 },
+ { 119,-5086 }, { 120,-5086 }, { 121,-5086 }, { 122,-5086 }, { 123,-5086 },
+ { 124,-5086 }, { 125,-5086 }, { 126,-5086 }, { 127,-5086 }, { 128,-5086 },
+ { 129,-5086 }, { 130,-5086 }, { 131,-5086 }, { 132,-5086 }, { 133,-5086 },
+ { 134,-5086 }, { 135,-5086 }, { 136,-5086 }, { 137,-5086 }, { 138,-5086 },
+ { 139,-5086 }, { 140,-5086 }, { 141,-5086 }, { 142,-5086 }, { 143,-5086 },
+ { 144,-5086 }, { 145,-5086 }, { 146,-5086 }, { 147,-5086 }, { 148,-5086 },
+ { 149,-5086 }, { 150,-5086 }, { 151,-5086 }, { 152,-5086 }, { 153,-5086 },
+ { 154,-5086 }, { 155,-5086 }, { 156,-5086 }, { 157,-5086 }, { 158,-5086 },
+ { 159,-5086 }, { 160,-5086 }, { 161,-5086 }, { 162,-5086 }, { 163,-5086 },
+
+ { 164,-5086 }, { 165,-5086 }, { 166,-5086 }, { 167,-5086 }, { 168,-5086 },
+ { 169,-5086 }, { 170,-5086 }, { 171,-5086 }, { 172,-5086 }, { 173,-5086 },
+ { 174,-5086 }, { 175,-5086 }, { 176,-5086 }, { 177,-5086 }, { 178,-5086 },
+ { 179,-5086 }, { 180,-5086 }, { 181,-5086 }, { 182,-5086 }, { 183,-5086 },
+ { 184,-5086 }, { 185,-5086 }, { 186,-5086 }, { 187,-5086 }, { 188,-5086 },
+ { 189,-5086 }, { 190,-5086 }, { 191,-5086 }, { 192,-5086 }, { 193,-5086 },
+ { 194,-5086 }, { 195,-5086 }, { 196,-5086 }, { 197,-5086 }, { 198,-5086 },
+ { 199,-5086 }, { 200,-5086 }, { 201,-5086 }, { 202,-5086 }, { 203,-5086 },
+ { 204,-5086 }, { 205,-5086 }, { 206,-5086 }, { 207,-5086 }, { 208,-5086 },
+ { 209,-5086 }, { 210,-5086 }, { 211,-5086 }, { 212,-5086 }, { 213,-5086 },
+
+ { 214,-5086 }, { 215,-5086 }, { 216,-5086 }, { 217,-5086 }, { 218,-5086 },
+ { 219,-5086 }, { 220,-5086 }, { 221,-5086 }, { 222,-5086 }, { 223,-5086 },
+ { 224,-5086 }, { 225,-5086 }, { 226,-5086 }, { 227,-5086 }, { 228,-5086 },
+ { 229,-5086 }, { 230,-5086 }, { 231,-5086 }, { 232,-5086 }, { 233,-5086 },
+ { 234,-5086 }, { 235,-5086 }, { 236,-5086 }, { 237,-5086 }, { 238,-5086 },
+ { 239,-5086 }, { 240,-5086 }, { 241,-5086 }, { 242,-5086 }, { 243,-5086 },
+ { 244,-5086 }, { 245,-5086 }, { 246,-5086 }, { 247,-5086 }, { 248,-5086 },
+ { 249,-5086 }, { 250,-5086 }, { 251,-5086 }, { 252,-5086 }, { 253,-5086 },
+ { 254,-5086 }, { 255,-5086 }, { 256,-5086 }, {   0,  37 }, {   0,8106 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,  37 }, {   0,8083 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  48,1263 }, {  49,1263 }, {  50,1263 },
+ {  51,1263 }, {  52,1263 }, {  53,1263 }, {  54,1263 }, {  55,1263 },
+
+ {  56,1263 }, {  57,1263 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  65,1263 },
+ {  66,1263 }, {  67,1263 }, {  68,1263 }, {  69,1263 }, {  70,1263 },
+ {  48,-20508 }, {  49,-20508 }, {  50,-20508 }, {  51,-20508 }, {  52,-20508 },
+ {  53,-20508 }, {  54,-20508 }, {  55,-20508 }, {  56,-20508 }, {  57,-20508 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  65,-20508 }, {  66,-20508 }, {  67,-20508 },
+ {  68,-20508 }, {  69,-20508 }, {  70,-20508 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  97,1263 }, {  98,1263 }, {  99,1263 }, { 100,1263 },
+ { 101,1263 }, { 102,1263 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  97,-20508 },
+ {  98,-20508 }, {  99,-20508 }, { 100,-20508 }, { 101,-20508 }, { 102,-20508 },
+ {   0,   9 }, {   0,7979 }, {   1,-4570 }, {   2,-4570 }, {   3,-4570 },
+ {   4,-4570 }, {   5,-4570 }, {   6,-4570 }, {   7,-4570 }, {   8,-4570 },
+ {   9,-4312 }, {  10,-4054 }, {  11,-4570 }, {  12,-4312 }, {  13,-4054 },
+ {  14,-4570 }, {  15,-4570 }, {  16,-4570 }, {  17,-4570 }, {  18,-4570 },
+ {  19,-4570 }, {  20,-4570 }, {  21,-4570 }, {  22,-4570 }, {  23,-4570 },
+ {  24,-4570 }, {  25,-4570 }, {  26,-4570 }, {  27,-4570 }, {  28,-4570 },
+
+ {  29,-4570 }, {  30,-4570 }, {  31,-4570 }, {  32,-4312 }, {  33,-4570 },
+ {  34,-4570 }, {  35,-4570 }, {  36,-4570 }, {  37,-4570 }, {  38,-4570 },
+ {  39,-4570 }, {  40,-4570 }, {  41,-4570 }, {  42,-4570 }, {  43,-4570 },
+ {  44,-4570 }, {  45,   0 }, {  46,-4570 }, {  47,-4570 }, {  48,-4570 },
+ {  49,-4570 }, {  50,-4570 }, {  51,-4570 }, {  52,-4570 }, {  53,-4570 },
+ {  54,-4570 }, {  55,-4570 }, {  56,-4570 }, {  57,-4570 }, {  58,-4570 },
+ {  59,-4570 }, {  60,-4570 }, {  61,-4570 }, {  62,-4570 }, {  63,-4570 },
+ {  64,-4570 }, {  65,-4570 }, {  66,-4570 }, {  67,-4570 }, {  68,-4570 },
+ {  69,-4570 }, {  70,-4570 }, {  71,-4570 }, {  72,-4570 }, {  73,-4570 },
+ {  74,-4570 }, {  75,-4570 }, {  76,-4570 }, {  77,-4570 }, {  78,-4570 },
+
+ {  79,-4570 }, {  80,-4570 }, {  81,-4570 }, {  82,-4570 }, {  83,-4570 },
+ {  84,-4570 }, {  85,-4570 }, {  86,-4570 }, {  87,-4570 }, {  88,-4570 },
+ {  89,-4570 }, {  90,-4570 }, {  91,-4570 }, {  92,-4570 }, {  93,-4570 },
+ {  94,-4570 }, {  95,-4570 }, {  96,-4570 }, {  97,-4570 }, {  98,-4570 },
+ {  99,-4570 }, { 100,-4570 }, { 101,-4570 }, { 102,-4570 }, { 103,-4570 },
+ { 104,-4570 }, { 105,-4570 }, { 106,-4570 }, { 107,-4570 }, { 108,-4570 },
+ { 109,-4570 }, { 110,-4570 }, { 111,-4570 }, { 112,-4570 }, { 113,-4570 },
+ { 114,-4570 }, { 115,-4570 }, { 116,-4570 }, { 117,-4570 }, { 118,-4570 },
+ { 119,-4570 }, { 120,-4570 }, { 121,-4570 }, { 122,-4570 }, { 123,-4570 },
+ { 124,-4570 }, { 125,-4570 }, { 126,-4570 }, { 127,-4570 }, { 128,-4570 },
+
+ { 129,-4570 }, { 130,-4570 }, { 131,-4570 }, { 132,-4570 }, { 133,-4570 },
+ { 134,-4570 }, { 135,-4570 }, { 136,-4570 }, { 137,-4570 }, { 138,-4570 },
+ { 139,-4570 }, { 140,-4570 }, { 141,-4570 }, { 142,-4570 }, { 143,-4570 },
+ { 144,-4570 }, { 145,-4570 }, { 146,-4570 }, { 147,-4570 }, { 148,-4570 },
+ { 149,-4570 }, { 150,-4570 }, { 151,-4570 }, { 152,-4570 }, { 153,-4570 },
+ { 154,-4570 }, { 155,-4570 }, { 156,-4570 }, { 157,-4570 }, { 158,-4570 },
+ { 159,-4570 }, { 160,-4570 }, { 161,-4570 }, { 162,-4570 }, { 163,-4570 },
+ { 164,-4570 }, { 165,-4570 }, { 166,-4570 }, { 167,-4570 }, { 168,-4570 },
+ { 169,-4570 }, { 170,-4570 }, { 171,-4570 }, { 172,-4570 }, { 173,-4570 },
+ { 174,-4570 }, { 175,-4570 }, { 176,-4570 }, { 177,-4570 }, { 178,-4570 },
+
+ { 179,-4570 }, { 180,-4570 }, { 181,-4570 }, { 182,-4570 }, { 183,-4570 },
+ { 184,-4570 }, { 185,-4570 }, { 186,-4570 }, { 187,-4570 }, { 188,-4570 },
+ { 189,-4570 }, { 190,-4570 }, { 191,-4570 }, { 192,-4570 }, { 193,-4570 },
+ { 194,-4570 }, { 195,-4570 }, { 196,-4570 }, { 197,-4570 }, { 198,-4570 },
+ { 199,-4570 }, { 200,-4570 }, { 201,-4570 }, { 202,-4570 }, { 203,-4570 },
+ { 204,-4570 }, { 205,-4570 }, { 206,-4570 }, { 207,-4570 }, { 208,-4570 },
+ { 209,-4570 }, { 210,-4570 }, { 211,-4570 }, { 212,-4570 }, { 213,-4570 },
+ { 214,-4570 }, { 215,-4570 }, { 216,-4570 }, { 217,-4570 }, { 218,-4570 },
+ { 219,-4570 }, { 220,-4570 }, { 221,-4570 }, { 222,-4570 }, { 223,-4570 },
+ { 224,-4570 }, { 225,-4570 }, { 226,-4570 }, { 227,-4570 }, { 228,-4570 },
+
+ { 229,-4570 }, { 230,-4570 }, { 231,-4570 }, { 232,-4570 }, { 233,-4570 },
+ { 234,-4570 }, { 235,-4570 }, { 236,-4570 }, { 237,-4570 }, { 238,-4570 },
+ { 239,-4570 }, { 240,-4570 }, { 241,-4570 }, { 242,-4570 }, { 243,-4570 },
+ { 244,-4570 }, { 245,-4570 }, { 246,-4570 }, { 247,-4570 }, { 248,-4570 },
+ { 249,-4570 }, { 250,-4570 }, { 251,-4570 }, { 252,-4570 }, { 253,-4570 },
+ { 254,-4570 }, { 255,-4570 }, { 256,-4570 }, {   0,  16 }, {   0,7721 },
+ {   1,-3749 }, {   2,-3749 }, {   3,-3749 }, {   4,-3749 }, {   5,-3749 },
+ {   6,-3749 }, {   7,-3749 }, {   8,-3749 }, {   9,-3491 }, {  10,-3233 },
+ {  11,-3749 }, {  12,-3491 }, {  13,-3233 }, {  14,-3749 }, {  15,-3749 },
+ {  16,-3749 }, {  17,-3749 }, {  18,-3749 }, {  19,-3749 }, {  20,-3749 },
+
+ {  21,-3749 }, {  22,-3749 }, {  23,-3749 }, {  24,-3749 }, {  25,-3749 },
+ {  26,-3749 }, {  27,-3749 }, {  28,-3749 }, {  29,-3749 }, {  30,-3749 },
+ {  31,-3749 }, {  32,-3491 }, {  33,-3749 }, {  34,-3749 }, {  35,-3749 },
+ {  36,-3749 }, {  37,-3749 }, {  38,-3749 }, {  39,-3749 }, {  40,-3749 },
+ {  41,-3749 }, {  42,-3749 }, {  43,-3749 }, {  44,-3749 }, {  45,   0 },
+ {  46,-3749 }, {  47,-3749 }, {  48,-3749 }, {  49,-3749 }, {  50,-3749 },
+ {  51,-3749 }, {  52,-3749 }, {  53,-3749 }, {  54,-3749 }, {  55,-3749 },
+ {  56,-3749 }, {  57,-3749 }, {  58,-3749 }, {  59,-3749 }, {  60,-3749 },
+ {  61,-3749 }, {  62,-3749 }, {  63,-3749 }, {  64,-3749 }, {  65,-3749 },
+ {  66,-3749 }, {  67,-3749 }, {  68,-3749 }, {  69,-3749 }, {  70,-3749 },
+
+ {  71,-3749 }, {  72,-3749 }, {  73,-3749 }, {  74,-3749 }, {  75,-3749 },
+ {  76,-3749 }, {  77,-3749 }, {  78,-3749 }, {  79,-3749 }, {  80,-3749 },
+ {  81,-3749 }, {  82,-3749 }, {  83,-3749 }, {  84,-3749 }, {  85,-3749 },
+ {  86,-3749 }, {  87,-3749 }, {  88,-3749 }, {  89,-3749 }, {  90,-3749 },
+ {  91,-3749 }, {  92,-3749 }, {  93,-3749 }, {  94,-3749 }, {  95,-3749 },
+ {  96,-3749 }, {  97,-3749 }, {  98,-3749 }, {  99,-3749 }, { 100,-3749 },
+ { 101,-3749 }, { 102,-3749 }, { 103,-3749 }, { 104,-3749 }, { 105,-3749 },
+ { 106,-3749 }, { 107,-3749 }, { 108,-3749 }, { 109,-3749 }, { 110,-3749 },
+ { 111,-3749 }, { 112,-3749 }, { 113,-3749 }, { 114,-3749 }, { 115,-3749 },
+ { 116,-3749 }, { 117,-3749 }, { 118,-3749 }, { 119,-3749 }, { 120,-3749 },
+
+ { 121,-3749 }, { 122,-3749 }, { 123,-3749 }, { 124,-3749 }, { 125,-3749 },
+ { 126,-3749 }, { 127,-3749 }, { 128,-3749 }, { 129,-3749 }, { 130,-3749 },
+ { 131,-3749 }, { 132,-3749 }, { 133,-3749 }, { 134,-3749 }, { 135,-3749 },
+ { 136,-3749 }, { 137,-3749 }, { 138,-3749 }, { 139,-3749 }, { 140,-3749 },
+ { 141,-3749 }, { 142,-3749 }, { 143,-3749 }, { 144,-3749 }, { 145,-3749 },
+ { 146,-3749 }, { 147,-3749 }, { 148,-3749 }, { 149,-3749 }, { 150,-3749 },
+ { 151,-3749 }, { 152,-3749 }, { 153,-3749 }, { 154,-3749 }, { 155,-3749 },
+ { 156,-3749 }, { 157,-3749 }, { 158,-3749 }, { 159,-3749 }, { 160,-3749 },
+ { 161,-3749 }, { 162,-3749 }, { 163,-3749 }, { 164,-3749 }, { 165,-3749 },
+ { 166,-3749 }, { 167,-3749 }, { 168,-3749 }, { 169,-3749 }, { 170,-3749 },
+
+ { 171,-3749 }, { 172,-3749 }, { 173,-3749 }, { 174,-3749 }, { 175,-3749 },
+ { 176,-3749 }, { 177,-3749 }, { 178,-3749 }, { 179,-3749 }, { 180,-3749 },
+ { 181,-3749 }, { 182,-3749 }, { 183,-3749 }, { 184,-3749 }, { 185,-3749 },
+ { 186,-3749 }, { 187,-3749 }, { 188,-3749 }, { 189,-3749 }, { 190,-3749 },
+ { 191,-3749 }, { 192,-3749 }, { 193,-3749 }, { 194,-3749 }, { 195,-3749 },
+ { 196,-3749 }, { 197,-3749 }, { 198,-3749 }, { 199,-3749 }, { 200,-3749 },
+ { 201,-3749 }, { 202,-3749 }, { 203,-3749 }, { 204,-3749 }, { 205,-3749 },
+ { 206,-3749 }, { 207,-3749 }, { 208,-3749 }, { 209,-3749 }, { 210,-3749 },
+ { 211,-3749 }, { 212,-3749 }, { 213,-3749 }, { 214,-3749 }, { 215,-3749 },
+ { 216,-3749 }, { 217,-3749 }, { 218,-3749 }, { 219,-3749 }, { 220,-3749 },
+
+ { 221,-3749 }, { 222,-3749 }, { 223,-3749 }, { 224,-3749 }, { 225,-3749 },
+ { 226,-3749 }, { 227,-3749 }, { 228,-3749 }, { 229,-3749 }, { 230,-3749 },
+ { 231,-3749 }, { 232,-3749 }, { 233,-3749 }, { 234,-3749 }, { 235,-3749 },
+ { 236,-3749 }, { 237,-3749 }, { 238,-3749 }, { 239,-3749 }, { 240,-3749 },
+ { 241,-3749 }, { 242,-3749 }, { 243,-3749 }, { 244,-3749 }, { 245,-3749 },
+ { 246,-3749 }, { 247,-3749 }, { 248,-3749 }, { 249,-3749 }, { 250,-3749 },
+ { 251,-3749 }, { 252,-3749 }, { 253,-3749 }, { 254,-3749 }, { 255,-3749 },
+ { 256,-3749 }, {   0,  22 }, {   0,7463 }, {   1,-2928 }, {   2,-2928 },
+ {   3,-2928 }, {   4,-2928 }, {   5,-2928 }, {   6,-2928 }, {   7,-2928 },
+ {   8,-2928 }, {   9,-2670 }, {  10,-2412 }, {  11,-2928 }, {  12,-2670 },
+
+ {  13,-2412 }, {  14,-2928 }, {  15,-2928 }, {  16,-2928 }, {  17,-2928 },
+ {  18,-2928 }, {  19,-2928 }, {  20,-2928 }, {  21,-2928 }, {  22,-2928 },
+ {  23,-2928 }, {  24,-2928 }, {  25,-2928 }, {  26,-2928 }, {  27,-2928 },
+ {  28,-2928 }, {  29,-2928 }, {  30,-2928 }, {  31,-2928 }, {  32,-2670 },
+ {  33,-2928 }, {  34,-2928 }, {  35,-2928 }, {  36,-2928 }, {  37,-2928 },
+ {  38,-2928 }, {  39,-2928 }, {  40,-2928 }, {  41,-2928 }, {  42,-2928 },
+ {  43,-2928 }, {  44,-2928 }, {  45,   0 }, {  46,-2928 }, {  47,-2928 },
+ {  48,-2928 }, {  49,-2928 }, {  50,-2928 }, {  51,-2928 }, {  52,-2928 },
+ {  53,-2928 }, {  54,-2928 }, {  55,-2928 }, {  56,-2928 }, {  57,-2928 },
+ {  58,-2928 }, {  59,-2928 }, {  60,-2928 }, {  61,-2928 }, {  62,-2928 },
+
+ {  63,-2928 }, {  64,-2928 }, {  65,-2928 }, {  66,-2928 }, {  67,-2928 },
+ {  68,-2928 }, {  69,-2928 }, {  70,-2928 }, {  71,-2928 }, {  72,-2928 },
+ {  73,-2928 }, {  74,-2928 }, {  75,-2928 }, {  76,-2928 }, {  77,-2928 },
+ {  78,-2928 }, {  79,-2928 }, {  80,-2928 }, {  81,-2928 }, {  82,-2928 },
+ {  83,-2928 }, {  84,-2928 }, {  85,-2928 }, {  86,-2928 }, {  87,-2928 },
+ {  88,-2928 }, {  89,-2928 }, {  90,-2928 }, {  91,-2928 }, {  92,-2928 },
+ {  93,-2928 }, {  94,-2928 }, {  95,-2928 }, {  96,-2928 }, {  97,-2928 },
+ {  98,-2928 }, {  99,-2928 }, { 100,-2928 }, { 101,-2928 }, { 102,-2928 },
+ { 103,-2928 }, { 104,-2928 }, { 105,-2928 }, { 106,-2928 }, { 107,-2928 },
+ { 108,-2928 }, { 109,-2928 }, { 110,-2928 }, { 111,-2928 }, { 112,-2928 },
+
+ { 113,-2928 }, { 114,-2928 }, { 115,-2928 }, { 116,-2928 }, { 117,-2928 },
+ { 118,-2928 }, { 119,-2928 }, { 120,-2928 }, { 121,-2928 }, { 122,-2928 },
+ { 123,-2928 }, { 124,-2928 }, { 125,-2928 }, { 126,-2928 }, { 127,-2928 },
+ { 128,-2928 }, { 129,-2928 }, { 130,-2928 }, { 131,-2928 }, { 132,-2928 },
+ { 133,-2928 }, { 134,-2928 }, { 135,-2928 }, { 136,-2928 }, { 137,-2928 },
+ { 138,-2928 }, { 139,-2928 }, { 140,-2928 }, { 141,-2928 }, { 142,-2928 },
+ { 143,-2928 }, { 144,-2928 }, { 145,-2928 }, { 146,-2928 }, { 147,-2928 },
+ { 148,-2928 }, { 149,-2928 }, { 150,-2928 }, { 151,-2928 }, { 152,-2928 },
+ { 153,-2928 }, { 154,-2928 }, { 155,-2928 }, { 156,-2928 }, { 157,-2928 },
+ { 158,-2928 }, { 159,-2928 }, { 160,-2928 }, { 161,-2928 }, { 162,-2928 },
+
+ { 163,-2928 }, { 164,-2928 }, { 165,-2928 }, { 166,-2928 }, { 167,-2928 },
+ { 168,-2928 }, { 169,-2928 }, { 170,-2928 }, { 171,-2928 }, { 172,-2928 },
+ { 173,-2928 }, { 174,-2928 }, { 175,-2928 }, { 176,-2928 }, { 177,-2928 },
+ { 178,-2928 }, { 179,-2928 }, { 180,-2928 }, { 181,-2928 }, { 182,-2928 },
+ { 183,-2928 }, { 184,-2928 }, { 185,-2928 }, { 186,-2928 }, { 187,-2928 },
+ { 188,-2928 }, { 189,-2928 }, { 190,-2928 }, { 191,-2928 }, { 192,-2928 },
+ { 193,-2928 }, { 194,-2928 }, { 195,-2928 }, { 196,-2928 }, { 197,-2928 },
+ { 198,-2928 }, { 199,-2928 }, { 200,-2928 }, { 201,-2928 }, { 202,-2928 },
+ { 203,-2928 }, { 204,-2928 }, { 205,-2928 }, { 206,-2928 }, { 207,-2928 },
+ { 208,-2928 }, { 209,-2928 }, { 210,-2928 }, { 211,-2928 }, { 212,-2928 },
+
+ { 213,-2928 }, { 214,-2928 }, { 215,-2928 }, { 216,-2928 }, { 217,-2928 },
+ { 218,-2928 }, { 219,-2928 }, { 220,-2928 }, { 221,-2928 }, { 222,-2928 },
+ { 223,-2928 }, { 224,-2928 }, { 225,-2928 }, { 226,-2928 }, { 227,-2928 },
+ { 228,-2928 }, { 229,-2928 }, { 230,-2928 }, { 231,-2928 }, { 232,-2928 },
+ { 233,-2928 }, { 234,-2928 }, { 235,-2928 }, { 236,-2928 }, { 237,-2928 },
+ { 238,-2928 }, { 239,-2928 }, { 240,-2928 }, { 241,-2928 }, { 242,-2928 },
+ { 243,-2928 }, { 244,-2928 }, { 245,-2928 }, { 246,-2928 }, { 247,-2928 },
+ { 248,-2928 }, { 249,-2928 }, { 250,-2928 }, { 251,-2928 }, { 252,-2928 },
+ { 253,-2928 }, { 254,-2928 }, { 255,-2928 }, { 256,-2928 }, {   0,  37 },
+ {   0,7205 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  48, 385 }, {  49, 385 },
+ {  50, 385 }, {  51, 385 }, {  52, 385 }, {  53, 385 }, {  54, 385 },
+
+ {  55, 385 }, {  56, 385 }, {  57, 385 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  65, 385 }, {  66, 385 }, {  67, 385 }, {  68, 385 }, {  69, 385 },
+ {  70, 385 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  97, 385 }, {  98, 385 }, {  99, 385 },
+ { 100, 385 }, { 101, 385 }, { 102, 385 }, {   0,  24 }, {   0,7101 },
+
+ {   1,-2084 }, {   2,-2084 }, {   3,-2084 }, {   4,-2084 }, {   5,-2084 },
+ {   6,-2084 }, {   7,-2084 }, {   8,-2084 }, {   9,-1826 }, {  10,-1568 },
+ {  11,-2084 }, {  12,-1826 }, {  13,-1568 }, {  14,-2084 }, {  15,-2084 },
+ {  16,-2084 }, {  17,-2084 }, {  18,-2084 }, {  19,-2084 }, {  20,-2084 },
+ {  21,-2084 }, {  22,-2084 }, {  23,-2084 }, {  24,-2084 }, {  25,-2084 },
+ {  26,-2084 }, {  27,-2084 }, {  28,-2084 }, {  29,-2084 }, {  30,-2084 },
+ {  31,-2084 }, {  32,-1826 }, {  33,-2084 }, {  34,-2084 }, {  35,-2084 },
+ {  36,-2084 }, {  37,-2084 }, {  38,-2084 }, {  39,-2084 }, {  40,-2084 },
+ {  41,-2084 }, {  42,-2084 }, {  43,-2084 }, {  44,-2084 }, {  45,   0 },
+ {  46,-2084 }, {  47,-2084 }, {  48,-2084 }, {  49,-2084 }, {  50,-2084 },
+
+ {  51,-2084 }, {  52,-2084 }, {  53,-2084 }, {  54,-2084 }, {  55,-2084 },
+ {  56,-2084 }, {  57,-2084 }, {  58,-2084 }, {  59,-2084 }, {  60,-2084 },
+ {  61,-2084 }, {  62,-2084 }, {  63,-2084 }, {  64,-2084 }, {  65,-2084 },
+ {  66,-2084 }, {  67,-2084 }, {  68,-2084 }, {  69,-2084 }, {  70,-2084 },
+ {  71,-2084 }, {  72,-2084 }, {  73,-2084 }, {  74,-2084 }, {  75,-2084 },
+ {  76,-2084 }, {  77,-2084 }, {  78,-2084 }, {  79,-2084 }, {  80,-2084 },
+ {  81,-2084 }, {  82,-2084 }, {  83,-2084 }, {  84,-2084 }, {  85,-2084 },
+ {  86,-2084 }, {  87,-2084 }, {  88,-2084 }, {  89,-2084 }, {  90,-2084 },
+ {  91,-2084 }, {  92,-2084 }, {  93,-2084 }, {  94,-2084 }, {  95,-2084 },
+ {  96,-2084 }, {  97,-2084 }, {  98,-2084 }, {  99,-2084 }, { 100,-2084 },
+
+ { 101,-2084 }, { 102,-2084 }, { 103,-2084 }, { 104,-2084 }, { 105,-2084 },
+ { 106,-2084 }, { 107,-2084 }, { 108,-2084 }, { 109,-2084 }, { 110,-2084 },
+ { 111,-2084 }, { 112,-2084 }, { 113,-2084 }, { 114,-2084 }, { 115,-2084 },
+ { 116,-2084 }, { 117,-2084 }, { 118,-2084 }, { 119,-2084 }, { 120,-2084 },
+ { 121,-2084 }, { 122,-2084 }, { 123,-2084 }, { 124,-2084 }, { 125,-2084 },
+ { 126,-2084 }, { 127,-2084 }, { 128,-2084 }, { 129,-2084 }, { 130,-2084 },
+ { 131,-2084 }, { 132,-2084 }, { 133,-2084 }, { 134,-2084 }, { 135,-2084 },
+ { 136,-2084 }, { 137,-2084 }, { 138,-2084 }, { 139,-2084 }, { 140,-2084 },
+ { 141,-2084 }, { 142,-2084 }, { 143,-2084 }, { 144,-2084 }, { 145,-2084 },
+ { 146,-2084 }, { 147,-2084 }, { 148,-2084 }, { 149,-2084 }, { 150,-2084 },
+
+ { 151,-2084 }, { 152,-2084 }, { 153,-2084 }, { 154,-2084 }, { 155,-2084 },
+ { 156,-2084 }, { 157,-2084 }, { 158,-2084 }, { 159,-2084 }, { 160,-2084 },
+ { 161,-2084 }, { 162,-2084 }, { 163,-2084 }, { 164,-2084 }, { 165,-2084 },
+ { 166,-2084 }, { 167,-2084 }, { 168,-2084 }, { 169,-2084 }, { 170,-2084 },
+ { 171,-2084 }, { 172,-2084 }, { 173,-2084 }, { 174,-2084 }, { 175,-2084 },
+ { 176,-2084 }, { 177,-2084 }, { 178,-2084 }, { 179,-2084 }, { 180,-2084 },
+ { 181,-2084 }, { 182,-2084 }, { 183,-2084 }, { 184,-2084 }, { 185,-2084 },
+ { 186,-2084 }, { 187,-2084 }, { 188,-2084 }, { 189,-2084 }, { 190,-2084 },
+ { 191,-2084 }, { 192,-2084 }, { 193,-2084 }, { 194,-2084 }, { 195,-2084 },
+ { 196,-2084 }, { 197,-2084 }, { 198,-2084 }, { 199,-2084 }, { 200,-2084 },
+
+ { 201,-2084 }, { 202,-2084 }, { 203,-2084 }, { 204,-2084 }, { 205,-2084 },
+ { 206,-2084 }, { 207,-2084 }, { 208,-2084 }, { 209,-2084 }, { 210,-2084 },
+ { 211,-2084 }, { 212,-2084 }, { 213,-2084 }, { 214,-2084 }, { 215,-2084 },
+ { 216,-2084 }, { 217,-2084 }, { 218,-2084 }, { 219,-2084 }, { 220,-2084 },
+ { 221,-2084 }, { 222,-2084 }, { 223,-2084 }, { 224,-2084 }, { 225,-2084 },
+ { 226,-2084 }, { 227,-2084 }, { 228,-2084 }, { 229,-2084 }, { 230,-2084 },
+ { 231,-2084 }, { 232,-2084 }, { 233,-2084 }, { 234,-2084 }, { 235,-2084 },
+ { 236,-2084 }, { 237,-2084 }, { 238,-2084 }, { 239,-2084 }, { 240,-2084 },
+ { 241,-2084 }, { 242,-2084 }, { 243,-2084 }, { 244,-2084 }, { 245,-2084 },
+ { 246,-2084 }, { 247,-2084 }, { 248,-2084 }, { 249,-2084 }, { 250,-2084 },
+
+ { 251,-2084 }, { 252,-2084 }, { 253,-2084 }, { 254,-2084 }, { 255,-2084 },
+ { 256,-2084 }, {   0,  37 }, {   0,6843 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,  37 },
+ {   0,6820 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  48, 136 }, {  49, 136 }, {  50, 136 }, {  51, 136 }, {  52, 136 },
+ {  53, 136 }, {  54, 136 }, {  55, 136 }, {  56, 136 }, {  57, 136 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  65, 136 }, {  66, 136 }, {  67, 136 },
+ {  68, 136 }, {  69, 136 }, {  70, 136 }, {  48, 137 }, {  49, 137 },
+ {  50, 137 }, {  51, 137 }, {  52, 137 }, {  53, 137 }, {  54, 137 },
+ {  55, 137 }, {  56, 137 }, {  57, 137 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  65, 137 }, {  66, 137 }, {  67, 137 }, {  68, 137 }, {  69, 137 },
+
+ {  70, 137 }, {   0,  55 }, {   0,6748 }, {   0,   0 }, {  97, 136 },
+ {  98, 136 }, {  99, 136 }, { 100, 136 }, { 101, 136 }, { 102, 136 },
+ {   0,   0 }, {   9, 137 }, {  10, 137 }, {   0,   0 }, {  12, 137 },
+ {  13, 137 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,  28 }, {   0,6724 }, {  97, 137 }, {  98, 137 }, {  99, 137 },
+ { 100, 137 }, { 101, 137 }, { 102, 137 }, {   0,   0 }, {  32, 137 },
+ {   9, 418 }, {  10, 418 }, {   0,   0 }, {  12, 418 }, {  13, 418 },
+ {   0,   0 }, {  39, 184 }, {   0,  37 }, {   0,6707 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  45,-21611 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  32, 418 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  39, 465 }, {   0,  37 }, {   0,6683 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  45,-21624 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  48, 706 }, {  49, 706 }, {  50, 706 }, {  51, 706 },
+ {  52, 706 }, {  53, 706 }, {  54, 706 }, {  55, 706 }, {  56, 706 },
+
+ {  57, 706 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  65, 706 }, {  66, 706 },
+ {  67, 706 }, {  68, 706 }, {  69, 706 }, {  70, 706 }, {   0,   0 },
+ {  48, 705 }, {  49, 705 }, {  50, 705 }, {  51, 705 }, {  52, 705 },
+ {  53, 705 }, {  54, 705 }, {  55, 705 }, {  56, 705 }, {  57, 705 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  65, 705 }, {  66, 705 }, {  67, 705 },
+ {  68, 705 }, {  69, 705 }, {  70, 705 }, {   0,  55 }, {   0,6611 },
+ {  97, 706 }, {  98, 706 }, {  99, 706 }, { 100, 706 }, { 101, 706 },
+ { 102, 706 }, {   0,   0 }, {   0,   0 }, {   9,   0 }, {  10,   0 },
+
+ {   0,   0 }, {  12,   0 }, {  13,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  97, 705 },
+ {  98, 705 }, {  99, 705 }, { 100, 705 }, { 101, 705 }, { 102, 705 },
+ {   0,   0 }, {  32,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  39,  47 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  45,-21748 },
+ {   0,  55 }, {   0,6564 }, {   1,-21777 }, {   2,-21777 }, {   3,-21777 },
+ {   4,-21777 }, {   5,-21777 }, {   6,-21777 }, {   7,-21777 }, {   8,-21777 },
+ {   9,-21777 }, {  10,-21777 }, {  11,-21777 }, {  12,-21777 }, {  13,-21777 },
+
+ {  14,-21777 }, {  15,-21777 }, {  16,-21777 }, {  17,-21777 }, {  18,-21777 },
+ {  19,-21777 }, {  20,-21777 }, {  21,-21777 }, {  22,-21777 }, {  23,-21777 },
+ {  24,-21777 }, {  25,-21777 }, {  26,-21777 }, {  27,-21777 }, {  28,-21777 },
+ {  29,-21777 }, {  30,-21777 }, {  31,-21777 }, {  32,-21777 }, {  33,-21777 },
+ {  34,-21777 }, {  35,-21777 }, {  36,-21777 }, {  37,-21777 }, {  38,-21777 },
+ {   0,   0 }, {  40,-21777 }, {  41,-21777 }, {  42,-21777 }, {  43,-21777 },
+ {  44,-21777 }, {  45,-21777 }, {  46,-21777 }, {  47,-21777 }, {  48,-21777 },
+ {  49,-21777 }, {  50,-21777 }, {  51,-21777 }, {  52,-21777 }, {  53,-21777 },
+ {  54,-21777 }, {  55,-21777 }, {  56,-21777 }, {  57,-21777 }, {  58,-21777 },
+ {  59,-21777 }, {  60,-21777 }, {  61,-21777 }, {  62,-21777 }, {  63,-21777 },
+
+ {  64,-21777 }, {  65,-21777 }, {  66,-21777 }, {  67,-21777 }, {  68,-21777 },
+ {  69,-21777 }, {  70,-21777 }, {  71,-21777 }, {  72,-21777 }, {  73,-21777 },
+ {  74,-21777 }, {  75,-21777 }, {  76,-21777 }, {  77,-21777 }, {  78,-21777 },
+ {  79,-21777 }, {  80,-21777 }, {  81,-21777 }, {  82,-21777 }, {  83,-21777 },
+ {  84,-21777 }, {  85,-21777 }, {  86,-21777 }, {  87,-21777 }, {  88,-21777 },
+ {  89,-21777 }, {  90,-21777 }, {  91,-21777 }, {  92,-21777 }, {  93,-21777 },
+ {  94,-21777 }, {  95,-21777 }, {  96,-21777 }, {  97,-21777 }, {  98,-21777 },
+ {  99,-21777 }, { 100,-21777 }, { 101,-21777 }, { 102,-21777 }, { 103,-21777 },
+ { 104,-21777 }, { 105,-21777 }, { 106,-21777 }, { 107,-21777 }, { 108,-21777 },
+ { 109,-21777 }, { 110,-21777 }, { 111,-21777 }, { 112,-21777 }, { 113,-21777 },
+
+ { 114,-21777 }, { 115,-21777 }, { 116,-21777 }, { 117,-21777 }, { 118,-21777 },
+ { 119,-21777 }, { 120,-21777 }, { 121,-21777 }, { 122,-21777 }, { 123,-21777 },
+ { 124,-21777 }, { 125,-21777 }, { 126,-21777 }, { 127,-21777 }, { 128,-21777 },
+ { 129,-21777 }, { 130,-21777 }, { 131,-21777 }, { 132,-21777 }, { 133,-21777 },
+ { 134,-21777 }, { 135,-21777 }, { 136,-21777 }, { 137,-21777 }, { 138,-21777 },
+ { 139,-21777 }, { 140,-21777 }, { 141,-21777 }, { 142,-21777 }, { 143,-21777 },
+ { 144,-21777 }, { 145,-21777 }, { 146,-21777 }, { 147,-21777 }, { 148,-21777 },
+ { 149,-21777 }, { 150,-21777 }, { 151,-21777 }, { 152,-21777 }, { 153,-21777 },
+ { 154,-21777 }, { 155,-21777 }, { 156,-21777 }, { 157,-21777 }, { 158,-21777 },
+ { 159,-21777 }, { 160,-21777 }, { 161,-21777 }, { 162,-21777 }, { 163,-21777 },
+
+ { 164,-21777 }, { 165,-21777 }, { 166,-21777 }, { 167,-21777 }, { 168,-21777 },
+ { 169,-21777 }, { 170,-21777 }, { 171,-21777 }, { 172,-21777 }, { 173,-21777 },
+ { 174,-21777 }, { 175,-21777 }, { 176,-21777 }, { 177,-21777 }, { 178,-21777 },
+ { 179,-21777 }, { 180,-21777 }, { 181,-21777 }, { 182,-21777 }, { 183,-21777 },
+ { 184,-21777 }, { 185,-21777 }, { 186,-21777 }, { 187,-21777 }, { 188,-21777 },
+ { 189,-21777 }, { 190,-21777 }, { 191,-21777 }, { 192,-21777 }, { 193,-21777 },
+ { 194,-21777 }, { 195,-21777 }, { 196,-21777 }, { 197,-21777 }, { 198,-21777 },
+ { 199,-21777 }, { 200,-21777 }, { 201,-21777 }, { 202,-21777 }, { 203,-21777 },
+ { 204,-21777 }, { 205,-21777 }, { 206,-21777 }, { 207,-21777 }, { 208,-21777 },
+ { 209,-21777 }, { 210,-21777 }, { 211,-21777 }, { 212,-21777 }, { 213,-21777 },
+
+ { 214,-21777 }, { 215,-21777 }, { 216,-21777 }, { 217,-21777 }, { 218,-21777 },
+ { 219,-21777 }, { 220,-21777 }, { 221,-21777 }, { 222,-21777 }, { 223,-21777 },
+ { 224,-21777 }, { 225,-21777 }, { 226,-21777 }, { 227,-21777 }, { 228,-21777 },
+ { 229,-21777 }, { 230,-21777 }, { 231,-21777 }, { 232,-21777 }, { 233,-21777 },
+ { 234,-21777 }, { 235,-21777 }, { 236,-21777 }, { 237,-21777 }, { 238,-21777 },
+ { 239,-21777 }, { 240,-21777 }, { 241,-21777 }, { 242,-21777 }, { 243,-21777 },
+ { 244,-21777 }, { 245,-21777 }, { 246,-21777 }, { 247,-21777 }, { 248,-21777 },
+ { 249,-21777 }, { 250,-21777 }, { 251,-21777 }, { 252,-21777 }, { 253,-21777 },
+ { 254,-21777 }, { 255,-21777 }, { 256,-21777 }, {   0,  28 }, {   0,6306 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   9,   0 }, {  10,   0 },
+ {   0,   0 }, {  12,   0 }, {  13,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  32,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  39,  47 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  45,-22042 },
+ {   0,  28 }, {   0,6259 }, {   1,-22080 }, {   2,-22080 }, {   3,-22080 },
+ {   4,-22080 }, {   5,-22080 }, {   6,-22080 }, {   7,-22080 }, {   8,-22080 },
+
+ {   9,-22080 }, {  10,-22080 }, {  11,-22080 }, {  12,-22080 }, {  13,-22080 },
+ {  14,-22080 }, {  15,-22080 }, {  16,-22080 }, {  17,-22080 }, {  18,-22080 },
+ {  19,-22080 }, {  20,-22080 }, {  21,-22080 }, {  22,-22080 }, {  23,-22080 },
+ {  24,-22080 }, {  25,-22080 }, {  26,-22080 }, {  27,-22080 }, {  28,-22080 },
+ {  29,-22080 }, {  30,-22080 }, {  31,-22080 }, {  32,-22080 }, {  33,-22080 },
+ {  34,-22080 }, {  35,-22080 }, {  36,-22080 }, {  37,-22080 }, {  38,-22080 },
+ {   0,   0 }, {  40,-22080 }, {  41,-22080 }, {  42,-22080 }, {  43,-22080 },
+ {  44,-22080 }, {  45,-22080 }, {  46,-22080 }, {  47,-22080 }, {  48,-22080 },
+ {  49,-22080 }, {  50,-22080 }, {  51,-22080 }, {  52,-22080 }, {  53,-22080 },
+ {  54,-22080 }, {  55,-22080 }, {  56,-22080 }, {  57,-22080 }, {  58,-22080 },
+
+ {  59,-22080 }, {  60,-22080 }, {  61,-22080 }, {  62,-22080 }, {  63,-22080 },
+ {  64,-22080 }, {  65,-22080 }, {  66,-22080 }, {  67,-22080 }, {  68,-22080 },
+ {  69,-22080 }, {  70,-22080 }, {  71,-22080 }, {  72,-22080 }, {  73,-22080 },
+ {  74,-22080 }, {  75,-22080 }, {  76,-22080 }, {  77,-22080 }, {  78,-22080 },
+ {  79,-22080 }, {  80,-22080 }, {  81,-22080 }, {  82,-22080 }, {  83,-22080 },
+ {  84,-22080 }, {  85,-22080 }, {  86,-22080 }, {  87,-22080 }, {  88,-22080 },
+ {  89,-22080 }, {  90,-22080 }, {  91,-22080 }, {  92,-22080 }, {  93,-22080 },
+ {  94,-22080 }, {  95,-22080 }, {  96,-22080 }, {  97,-22080 }, {  98,-22080 },
+ {  99,-22080 }, { 100,-22080 }, { 101,-22080 }, { 102,-22080 }, { 103,-22080 },
+ { 104,-22080 }, { 105,-22080 }, { 106,-22080 }, { 107,-22080 }, { 108,-22080 },
+
+ { 109,-22080 }, { 110,-22080 }, { 111,-22080 }, { 112,-22080 }, { 113,-22080 },
+ { 114,-22080 }, { 115,-22080 }, { 116,-22080 }, { 117,-22080 }, { 118,-22080 },
+ { 119,-22080 }, { 120,-22080 }, { 121,-22080 }, { 122,-22080 }, { 123,-22080 },
+ { 124,-22080 }, { 125,-22080 }, { 126,-22080 }, { 127,-22080 }, { 128,-22080 },
+ { 129,-22080 }, { 130,-22080 }, { 131,-22080 }, { 132,-22080 }, { 133,-22080 },
+ { 134,-22080 }, { 135,-22080 }, { 136,-22080 }, { 137,-22080 }, { 138,-22080 },
+ { 139,-22080 }, { 140,-22080 }, { 141,-22080 }, { 142,-22080 }, { 143,-22080 },
+ { 144,-22080 }, { 145,-22080 }, { 146,-22080 }, { 147,-22080 }, { 148,-22080 },
+ { 149,-22080 }, { 150,-22080 }, { 151,-22080 }, { 152,-22080 }, { 153,-22080 },
+ { 154,-22080 }, { 155,-22080 }, { 156,-22080 }, { 157,-22080 }, { 158,-22080 },
+
+ { 159,-22080 }, { 160,-22080 }, { 161,-22080 }, { 162,-22080 }, { 163,-22080 },
+ { 164,-22080 }, { 165,-22080 }, { 166,-22080 }, { 167,-22080 }, { 168,-22080 },
+ { 169,-22080 }, { 170,-22080 }, { 171,-22080 }, { 172,-22080 }, { 173,-22080 },
+ { 174,-22080 }, { 175,-22080 }, { 176,-22080 }, { 177,-22080 }, { 178,-22080 },
+ { 179,-22080 }, { 180,-22080 }, { 181,-22080 }, { 182,-22080 }, { 183,-22080 },
+ { 184,-22080 }, { 185,-22080 }, { 186,-22080 }, { 187,-22080 }, { 188,-22080 },
+ { 189,-22080 }, { 190,-22080 }, { 191,-22080 }, { 192,-22080 }, { 193,-22080 },
+ { 194,-22080 }, { 195,-22080 }, { 196,-22080 }, { 197,-22080 }, { 198,-22080 },
+ { 199,-22080 }, { 200,-22080 }, { 201,-22080 }, { 202,-22080 }, { 203,-22080 },
+ { 204,-22080 }, { 205,-22080 }, { 206,-22080 }, { 207,-22080 }, { 208,-22080 },
+
+ { 209,-22080 }, { 210,-22080 }, { 211,-22080 }, { 212,-22080 }, { 213,-22080 },
+ { 214,-22080 }, { 215,-22080 }, { 216,-22080 }, { 217,-22080 }, { 218,-22080 },
+ { 219,-22080 }, { 220,-22080 }, { 221,-22080 }, { 222,-22080 }, { 223,-22080 },
+ { 224,-22080 }, { 225,-22080 }, { 226,-22080 }, { 227,-22080 }, { 228,-22080 },
+ { 229,-22080 }, { 230,-22080 }, { 231,-22080 }, { 232,-22080 }, { 233,-22080 },
+ { 234,-22080 }, { 235,-22080 }, { 236,-22080 }, { 237,-22080 }, { 238,-22080 },
+ { 239,-22080 }, { 240,-22080 }, { 241,-22080 }, { 242,-22080 }, { 243,-22080 },
+ { 244,-22080 }, { 245,-22080 }, { 246,-22080 }, { 247,-22080 }, { 248,-22080 },
+ { 249,-22080 }, { 250,-22080 }, { 251,-22080 }, { 252,-22080 }, { 253,-22080 },
+ { 254,-22080 }, { 255,-22080 }, { 256,-22080 }, {   0,  37 }, {   0,6001 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,  37 }, {   0,5978 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  48, 643 }, {  49, 643 }, {  50, 643 },
+
+ {  51, 643 }, {  52, 643 }, {  53, 643 }, {  54, 643 }, {  55, 643 },
+ {  56, 643 }, {  57, 643 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  65, 643 },
+ {  66, 643 }, {  67, 643 }, {  68, 643 }, {  69, 643 }, {  70, 643 },
+ {  48,-22625 }, {  49,-22625 }, {  50,-22625 }, {  51,-22625 }, {  52,-22625 },
+ {  53,-22625 }, {  54,-22625 }, {  55,-22625 }, {  56,-22625 }, {  57,-22625 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  65,-22625 }, {  66,-22625 }, {  67,-22625 },
+ {  68,-22625 }, {  69,-22625 }, {  70,-22625 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  97, 643 }, {  98, 643 }, {  99, 643 }, { 100, 643 },
+
+ { 101, 643 }, { 102, 643 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  97,-22625 },
+ {  98,-22625 }, {  99,-22625 }, { 100,-22625 }, { 101,-22625 }, { 102,-22625 },
+ {   0,  55 }, {   0,5874 }, {   1, 620 }, {   2, 620 }, {   3, 620 },
+ {   4, 620 }, {   5, 620 }, {   6, 620 }, {   7, 620 }, {   8, 620 },
+ {   9, 878 }, {  10,-737 }, {  11, 620 }, {  12, 878 }, {  13,-737 },
+ {  14, 620 }, {  15, 620 }, {  16, 620 }, {  17, 620 }, {  18, 620 },
+ {  19, 620 }, {  20, 620 }, {  21, 620 }, {  22, 620 }, {  23, 620 },
+
+ {  24, 620 }, {  25, 620 }, {  26, 620 }, {  27, 620 }, {  28, 620 },
+ {  29, 620 }, {  30, 620 }, {  31, 620 }, {  32, 878 }, {  33, 620 },
+ {  34, 620 }, {  35, 620 }, {  36, 620 }, {  37, 620 }, {  38, 620 },
+ {  39,1136 }, {  40, 620 }, {  41, 620 }, {  42, 620 }, {  43, 620 },
+ {  44, 620 }, {  45,1394 }, {  46, 620 }, {  47, 620 }, {  48, 620 },
+ {  49, 620 }, {  50, 620 }, {  51, 620 }, {  52, 620 }, {  53, 620 },
+ {  54, 620 }, {  55, 620 }, {  56, 620 }, {  57, 620 }, {  58, 620 },
+ {  59, 620 }, {  60, 620 }, {  61, 620 }, {  62, 620 }, {  63, 620 },
+ {  64, 620 }, {  65, 620 }, {  66, 620 }, {  67, 620 }, {  68, 620 },
+ {  69, 620 }, {  70, 620 }, {  71, 620 }, {  72, 620 }, {  73, 620 },
+
+ {  74, 620 }, {  75, 620 }, {  76, 620 }, {  77, 620 }, {  78, 620 },
+ {  79, 620 }, {  80, 620 }, {  81, 620 }, {  82, 620 }, {  83, 620 },
+ {  84, 620 }, {  85, 620 }, {  86, 620 }, {  87, 620 }, {  88, 620 },
+ {  89, 620 }, {  90, 620 }, {  91, 620 }, {  92, 620 }, {  93, 620 },
+ {  94, 620 }, {  95, 620 }, {  96, 620 }, {  97, 620 }, {  98, 620 },
+ {  99, 620 }, { 100, 620 }, { 101, 620 }, { 102, 620 }, { 103, 620 },
+ { 104, 620 }, { 105, 620 }, { 106, 620 }, { 107, 620 }, { 108, 620 },
+ { 109, 620 }, { 110, 620 }, { 111, 620 }, { 112, 620 }, { 113, 620 },
+ { 114, 620 }, { 115, 620 }, { 116, 620 }, { 117, 620 }, { 118, 620 },
+ { 119, 620 }, { 120, 620 }, { 121, 620 }, { 122, 620 }, { 123, 620 },
+
+ { 124, 620 }, { 125, 620 }, { 126, 620 }, { 127, 620 }, { 128, 620 },
+ { 129, 620 }, { 130, 620 }, { 131, 620 }, { 132, 620 }, { 133, 620 },
+ { 134, 620 }, { 135, 620 }, { 136, 620 }, { 137, 620 }, { 138, 620 },
+ { 139, 620 }, { 140, 620 }, { 141, 620 }, { 142, 620 }, { 143, 620 },
+ { 144, 620 }, { 145, 620 }, { 146, 620 }, { 147, 620 }, { 148, 620 },
+ { 149, 620 }, { 150, 620 }, { 151, 620 }, { 152, 620 }, { 153, 620 },
+ { 154, 620 }, { 155, 620 }, { 156, 620 }, { 157, 620 }, { 158, 620 },
+ { 159, 620 }, { 160, 620 }, { 161, 620 }, { 162, 620 }, { 163, 620 },
+ { 164, 620 }, { 165, 620 }, { 166, 620 }, { 167, 620 }, { 168, 620 },
+ { 169, 620 }, { 170, 620 }, { 171, 620 }, { 172, 620 }, { 173, 620 },
+
+ { 174, 620 }, { 175, 620 }, { 176, 620 }, { 177, 620 }, { 178, 620 },
+ { 179, 620 }, { 180, 620 }, { 181, 620 }, { 182, 620 }, { 183, 620 },
+ { 184, 620 }, { 185, 620 }, { 186, 620 }, { 187, 620 }, { 188, 620 },
+ { 189, 620 }, { 190, 620 }, { 191, 620 }, { 192, 620 }, { 193, 620 },
+ { 194, 620 }, { 195, 620 }, { 196, 620 }, { 197, 620 }, { 198, 620 },
+ { 199, 620 }, { 200, 620 }, { 201, 620 }, { 202, 620 }, { 203, 620 },
+ { 204, 620 }, { 205, 620 }, { 206, 620 }, { 207, 620 }, { 208, 620 },
+ { 209, 620 }, { 210, 620 }, { 211, 620 }, { 212, 620 }, { 213, 620 },
+ { 214, 620 }, { 215, 620 }, { 216, 620 }, { 217, 620 }, { 218, 620 },
+ { 219, 620 }, { 220, 620 }, { 221, 620 }, { 222, 620 }, { 223, 620 },
+
+ { 224, 620 }, { 225, 620 }, { 226, 620 }, { 227, 620 }, { 228, 620 },
+ { 229, 620 }, { 230, 620 }, { 231, 620 }, { 232, 620 }, { 233, 620 },
+ { 234, 620 }, { 235, 620 }, { 236, 620 }, { 237, 620 }, { 238, 620 },
+ { 239, 620 }, { 240, 620 }, { 241, 620 }, { 242, 620 }, { 243, 620 },
+ { 244, 620 }, { 245, 620 }, { 246, 620 }, { 247, 620 }, { 248, 620 },
+ { 249, 620 }, { 250, 620 }, { 251, 620 }, { 252, 620 }, { 253, 620 },
+ { 254, 620 }, { 255, 620 }, { 256, 620 }, {   0,  28 }, {   0,5616 },
+ {   1,1394 }, {   2,1394 }, {   3,1394 }, {   4,1394 }, {   5,1394 },
+ {   6,1394 }, {   7,1394 }, {   8,1394 }, {   9,1652 }, {  10,-690 },
+ {  11,1394 }, {  12,1652 }, {  13,-690 }, {  14,1394 }, {  15,1394 },
+
+ {  16,1394 }, {  17,1394 }, {  18,1394 }, {  19,1394 }, {  20,1394 },
+ {  21,1394 }, {  22,1394 }, {  23,1394 }, {  24,1394 }, {  25,1394 },
+ {  26,1394 }, {  27,1394 }, {  28,1394 }, {  29,1394 }, {  30,1394 },
+ {  31,1394 }, {  32,1652 }, {  33,1394 }, {  34,1394 }, {  35,1394 },
+ {  36,1394 }, {  37,1394 }, {  38,1394 }, {  39,1910 }, {  40,1394 },
+ {  41,1394 }, {  42,1394 }, {  43,1394 }, {  44,1394 }, {  45,2168 },
+ {  46,1394 }, {  47,1394 }, {  48,1394 }, {  49,1394 }, {  50,1394 },
+ {  51,1394 }, {  52,1394 }, {  53,1394 }, {  54,1394 }, {  55,1394 },
+ {  56,1394 }, {  57,1394 }, {  58,1394 }, {  59,1394 }, {  60,1394 },
+ {  61,1394 }, {  62,1394 }, {  63,1394 }, {  64,1394 }, {  65,1394 },
+
+ {  66,1394 }, {  67,1394 }, {  68,1394 }, {  69,1394 }, {  70,1394 },
+ {  71,1394 }, {  72,1394 }, {  73,1394 }, {  74,1394 }, {  75,1394 },
+ {  76,1394 }, {  77,1394 }, {  78,1394 }, {  79,1394 }, {  80,1394 },
+ {  81,1394 }, {  82,1394 }, {  83,1394 }, {  84,1394 }, {  85,1394 },
+ {  86,1394 }, {  87,1394 }, {  88,1394 }, {  89,1394 }, {  90,1394 },
+ {  91,1394 }, {  92,1394 }, {  93,1394 }, {  94,1394 }, {  95,1394 },
+ {  96,1394 }, {  97,1394 }, {  98,1394 }, {  99,1394 }, { 100,1394 },
+ { 101,1394 }, { 102,1394 }, { 103,1394 }, { 104,1394 }, { 105,1394 },
+ { 106,1394 }, { 107,1394 }, { 108,1394 }, { 109,1394 }, { 110,1394 },
+ { 111,1394 }, { 112,1394 }, { 113,1394 }, { 114,1394 }, { 115,1394 },
+
+ { 116,1394 }, { 117,1394 }, { 118,1394 }, { 119,1394 }, { 120,1394 },
+ { 121,1394 }, { 122,1394 }, { 123,1394 }, { 124,1394 }, { 125,1394 },
+ { 126,1394 }, { 127,1394 }, { 128,1394 }, { 129,1394 }, { 130,1394 },
+ { 131,1394 }, { 132,1394 }, { 133,1394 }, { 134,1394 }, { 135,1394 },
+ { 136,1394 }, { 137,1394 }, { 138,1394 }, { 139,1394 }, { 140,1394 },
+ { 141,1394 }, { 142,1394 }, { 143,1394 }, { 144,1394 }, { 145,1394 },
+ { 146,1394 }, { 147,1394 }, { 148,1394 }, { 149,1394 }, { 150,1394 },
+ { 151,1394 }, { 152,1394 }, { 153,1394 }, { 154,1394 }, { 155,1394 },
+ { 156,1394 }, { 157,1394 }, { 158,1394 }, { 159,1394 }, { 160,1394 },
+ { 161,1394 }, { 162,1394 }, { 163,1394 }, { 164,1394 }, { 165,1394 },
+
+ { 166,1394 }, { 167,1394 }, { 168,1394 }, { 169,1394 }, { 170,1394 },
+ { 171,1394 }, { 172,1394 }, { 173,1394 }, { 174,1394 }, { 175,1394 },
+ { 176,1394 }, { 177,1394 }, { 178,1394 }, { 179,1394 }, { 180,1394 },
+ { 181,1394 }, { 182,1394 }, { 183,1394 }, { 184,1394 }, { 185,1394 },
+ { 186,1394 }, { 187,1394 }, { 188,1394 }, { 189,1394 }, { 190,1394 },
+ { 191,1394 }, { 192,1394 }, { 193,1394 }, { 194,1394 }, { 195,1394 },
+ { 196,1394 }, { 197,1394 }, { 198,1394 }, { 199,1394 }, { 200,1394 },
+ { 201,1394 }, { 202,1394 }, { 203,1394 }, { 204,1394 }, { 205,1394 },
+ { 206,1394 }, { 207,1394 }, { 208,1394 }, { 209,1394 }, { 210,1394 },
+ { 211,1394 }, { 212,1394 }, { 213,1394 }, { 214,1394 }, { 215,1394 },
+
+ { 216,1394 }, { 217,1394 }, { 218,1394 }, { 219,1394 }, { 220,1394 },
+ { 221,1394 }, { 222,1394 }, { 223,1394 }, { 224,1394 }, { 225,1394 },
+ { 226,1394 }, { 227,1394 }, { 228,1394 }, { 229,1394 }, { 230,1394 },
+ { 231,1394 }, { 232,1394 }, { 233,1394 }, { 234,1394 }, { 235,1394 },
+ { 236,1394 }, { 237,1394 }, { 238,1394 }, { 239,1394 }, { 240,1394 },
+ { 241,1394 }, { 242,1394 }, { 243,1394 }, { 244,1394 }, { 245,1394 },
+ { 246,1394 }, { 247,1394 }, { 248,1394 }, { 249,1394 }, { 250,1394 },
+ { 251,1394 }, { 252,1394 }, { 253,1394 }, { 254,1394 }, { 255,1394 },
+ { 256,1394 }, {   0,  37 }, {   0,5358 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  48,-23233 }, {  49,-23233 }, {  50,-23233 }, {  51,-23233 }, {  52,-23233 },
+ {  53,-23233 }, {  54,-23233 }, {  55,-23233 }, {  56,-23233 }, {  57,-23233 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  65,-23233 }, {  66,-23233 }, {  67,-23233 },
+ {  68,-23233 }, {  69,-23233 }, {  70,-23233 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  97,-23233 },
+ {  98,-23233 }, {  99,-23233 }, { 100,-23233 }, { 101,-23233 }, { 102,-23233 },
+ {   0,  55 }, {   0,5254 }, {   1,   0 }, {   2,   0 }, {   3,   0 },
+
+ {   4,   0 }, {   5,   0 }, {   6,   0 }, {   7,   0 }, {   8,   0 },
+ {   9, 258 }, {  10,-1357 }, {  11,   0 }, {  12, 258 }, {  13,-1357 },
+ {  14,   0 }, {  15,   0 }, {  16,   0 }, {  17,   0 }, {  18,   0 },
+ {  19,   0 }, {  20,   0 }, {  21,   0 }, {  22,   0 }, {  23,   0 },
+ {  24,   0 }, {  25,   0 }, {  26,   0 }, {  27,   0 }, {  28,   0 },
+ {  29,   0 }, {  30,   0 }, {  31,   0 }, {  32, 258 }, {  33,   0 },
+ {  34,   0 }, {  35,   0 }, {  36,   0 }, {  37,   0 }, {  38,   0 },
+ {  39, 516 }, {  40,   0 }, {  41,   0 }, {  42,   0 }, {  43,   0 },
+ {  44,   0 }, {  45, 774 }, {  46,   0 }, {  47,   0 }, {  48,   0 },
+ {  49,   0 }, {  50,   0 }, {  51,   0 }, {  52,   0 }, {  53,   0 },
+
+ {  54,   0 }, {  55,   0 }, {  56,   0 }, {  57,   0 }, {  58,   0 },
+ {  59,   0 }, {  60,   0 }, {  61,   0 }, {  62,   0 }, {  63,   0 },
+ {  64,   0 }, {  65,   0 }, {  66,   0 }, {  67,   0 }, {  68,   0 },
+ {  69,   0 }, {  70,   0 }, {  71,   0 }, {  72,   0 }, {  73,   0 },
+ {  74,   0 }, {  75,   0 }, {  76,   0 }, {  77,   0 }, {  78,   0 },
+ {  79,   0 }, {  80,   0 }, {  81,   0 }, {  82,   0 }, {  83,   0 },
+ {  84,   0 }, {  85,   0 }, {  86,   0 }, {  87,   0 }, {  88,   0 },
+ {  89,   0 }, {  90,   0 }, {  91,   0 }, {  92,   0 }, {  93,   0 },
+ {  94,   0 }, {  95,   0 }, {  96,   0 }, {  97,   0 }, {  98,   0 },
+ {  99,   0 }, { 100,   0 }, { 101,   0 }, { 102,   0 }, { 103,   0 },
+
+ { 104,   0 }, { 105,   0 }, { 106,   0 }, { 107,   0 }, { 108,   0 },
+ { 109,   0 }, { 110,   0 }, { 111,   0 }, { 112,   0 }, { 113,   0 },
+ { 114,   0 }, { 115,   0 }, { 116,   0 }, { 117,   0 }, { 118,   0 },
+ { 119,   0 }, { 120,   0 }, { 121,   0 }, { 122,   0 }, { 123,   0 },
+ { 124,   0 }, { 125,   0 }, { 126,   0 }, { 127,   0 }, { 128,   0 },
+ { 129,   0 }, { 130,   0 }, { 131,   0 }, { 132,   0 }, { 133,   0 },
+ { 134,   0 }, { 135,   0 }, { 136,   0 }, { 137,   0 }, { 138,   0 },
+ { 139,   0 }, { 140,   0 }, { 141,   0 }, { 142,   0 }, { 143,   0 },
+ { 144,   0 }, { 145,   0 }, { 146,   0 }, { 147,   0 }, { 148,   0 },
+ { 149,   0 }, { 150,   0 }, { 151,   0 }, { 152,   0 }, { 153,   0 },
+
+ { 154,   0 }, { 155,   0 }, { 156,   0 }, { 157,   0 }, { 158,   0 },
+ { 159,   0 }, { 160,   0 }, { 161,   0 }, { 162,   0 }, { 163,   0 },
+ { 164,   0 }, { 165,   0 }, { 166,   0 }, { 167,   0 }, { 168,   0 },
+ { 169,   0 }, { 170,   0 }, { 171,   0 }, { 172,   0 }, { 173,   0 },
+ { 174,   0 }, { 175,   0 }, { 176,   0 }, { 177,   0 }, { 178,   0 },
+ { 179,   0 }, { 180,   0 }, { 181,   0 }, { 182,   0 }, { 183,   0 },
+ { 184,   0 }, { 185,   0 }, { 186,   0 }, { 187,   0 }, { 188,   0 },
+ { 189,   0 }, { 190,   0 }, { 191,   0 }, { 192,   0 }, { 193,   0 },
+ { 194,   0 }, { 195,   0 }, { 196,   0 }, { 197,   0 }, { 198,   0 },
+ { 199,   0 }, { 200,   0 }, { 201,   0 }, { 202,   0 }, { 203,   0 },
+
+ { 204,   0 }, { 205,   0 }, { 206,   0 }, { 207,   0 }, { 208,   0 },
+ { 209,   0 }, { 210,   0 }, { 211,   0 }, { 212,   0 }, { 213,   0 },
+ { 214,   0 }, { 215,   0 }, { 216,   0 }, { 217,   0 }, { 218,   0 },
+ { 219,   0 }, { 220,   0 }, { 221,   0 }, { 222,   0 }, { 223,   0 },
+ { 224,   0 }, { 225,   0 }, { 226,   0 }, { 227,   0 }, { 228,   0 },
+ { 229,   0 }, { 230,   0 }, { 231,   0 }, { 232,   0 }, { 233,   0 },
+ { 234,   0 }, { 235,   0 }, { 236,   0 }, { 237,   0 }, { 238,   0 },
+ { 239,   0 }, { 240,   0 }, { 241,   0 }, { 242,   0 }, { 243,   0 },
+ { 244,   0 }, { 245,   0 }, { 246,   0 }, { 247,   0 }, { 248,   0 },
+ { 249,   0 }, { 250,   0 }, { 251,   0 }, { 252,   0 }, { 253,   0 },
+
+ { 254,   0 }, { 255,   0 }, { 256,   0 }, {   0,  55 }, {   0,4996 },
+ {   1,-258 }, {   2,-258 }, {   3,-258 }, {   4,-258 }, {   5,-258 },
+ {   6,-258 }, {   7,-258 }, {   8,-258 }, {   9,   0 }, {  10,-1615 },
+ {  11,-258 }, {  12,   0 }, {  13,-1615 }, {  14,-258 }, {  15,-258 },
+ {  16,-258 }, {  17,-258 }, {  18,-258 }, {  19,-258 }, {  20,-258 },
+ {  21,-258 }, {  22,-258 }, {  23,-258 }, {  24,-258 }, {  25,-258 },
+ {  26,-258 }, {  27,-258 }, {  28,-258 }, {  29,-258 }, {  30,-258 },
+ {  31,-258 }, {  32,   0 }, {  33,-258 }, {  34,-258 }, {  35,-258 },
+ {  36,-258 }, {  37,-258 }, {  38,-258 }, {  39, 258 }, {  40,-258 },
+ {  41,-258 }, {  42,-258 }, {  43,-258 }, {  44,-258 }, {  45, 516 },
+
+ {  46,-258 }, {  47,-258 }, {  48,-258 }, {  49,-258 }, {  50,-258 },
+ {  51,-258 }, {  52,-258 }, {  53,-258 }, {  54,-258 }, {  55,-258 },
+ {  56,-258 }, {  57,-258 }, {  58,-258 }, {  59,-258 }, {  60,-258 },
+ {  61,-258 }, {  62,-258 }, {  63,-258 }, {  64,-258 }, {  65,-258 },
+ {  66,-258 }, {  67,-258 }, {  68,-258 }, {  69,-258 }, {  70,-258 },
+ {  71,-258 }, {  72,-258 }, {  73,-258 }, {  74,-258 }, {  75,-258 },
+ {  76,-258 }, {  77,-258 }, {  78,-258 }, {  79,-258 }, {  80,-258 },
+ {  81,-258 }, {  82,-258 }, {  83,-258 }, {  84,-258 }, {  85,-258 },
+ {  86,-258 }, {  87,-258 }, {  88,-258 }, {  89,-258 }, {  90,-258 },
+ {  91,-258 }, {  92,-258 }, {  93,-258 }, {  94,-258 }, {  95,-258 },
+
+ {  96,-258 }, {  97,-258 }, {  98,-258 }, {  99,-258 }, { 100,-258 },
+ { 101,-258 }, { 102,-258 }, { 103,-258 }, { 104,-258 }, { 105,-258 },
+ { 106,-258 }, { 107,-258 }, { 108,-258 }, { 109,-258 }, { 110,-258 },
+ { 111,-258 }, { 112,-258 }, { 113,-258 }, { 114,-258 }, { 115,-258 },
+ { 116,-258 }, { 117,-258 }, { 118,-258 }, { 119,-258 }, { 120,-258 },
+ { 121,-258 }, { 122,-258 }, { 123,-258 }, { 124,-258 }, { 125,-258 },
+ { 126,-258 }, { 127,-258 }, { 128,-258 }, { 129,-258 }, { 130,-258 },
+ { 131,-258 }, { 132,-258 }, { 133,-258 }, { 134,-258 }, { 135,-258 },
+ { 136,-258 }, { 137,-258 }, { 138,-258 }, { 139,-258 }, { 140,-258 },
+ { 141,-258 }, { 142,-258 }, { 143,-258 }, { 144,-258 }, { 145,-258 },
+
+ { 146,-258 }, { 147,-258 }, { 148,-258 }, { 149,-258 }, { 150,-258 },
+ { 151,-258 }, { 152,-258 }, { 153,-258 }, { 154,-258 }, { 155,-258 },
+ { 156,-258 }, { 157,-258 }, { 158,-258 }, { 159,-258 }, { 160,-258 },
+ { 161,-258 }, { 162,-258 }, { 163,-258 }, { 164,-258 }, { 165,-258 },
+ { 166,-258 }, { 167,-258 }, { 168,-258 }, { 169,-258 }, { 170,-258 },
+ { 171,-258 }, { 172,-258 }, { 173,-258 }, { 174,-258 }, { 175,-258 },
+ { 176,-258 }, { 177,-258 }, { 178,-258 }, { 179,-258 }, { 180,-258 },
+ { 181,-258 }, { 182,-258 }, { 183,-258 }, { 184,-258 }, { 185,-258 },
+ { 186,-258 }, { 187,-258 }, { 188,-258 }, { 189,-258 }, { 190,-258 },
+ { 191,-258 }, { 192,-258 }, { 193,-258 }, { 194,-258 }, { 195,-258 },
+
+ { 196,-258 }, { 197,-258 }, { 198,-258 }, { 199,-258 }, { 200,-258 },
+ { 201,-258 }, { 202,-258 }, { 203,-258 }, { 204,-258 }, { 205,-258 },
+ { 206,-258 }, { 207,-258 }, { 208,-258 }, { 209,-258 }, { 210,-258 },
+ { 211,-258 }, { 212,-258 }, { 213,-258 }, { 214,-258 }, { 215,-258 },
+ { 216,-258 }, { 217,-258 }, { 218,-258 }, { 219,-258 }, { 220,-258 },
+ { 221,-258 }, { 222,-258 }, { 223,-258 }, { 224,-258 }, { 225,-258 },
+ { 226,-258 }, { 227,-258 }, { 228,-258 }, { 229,-258 }, { 230,-258 },
+ { 231,-258 }, { 232,-258 }, { 233,-258 }, { 234,-258 }, { 235,-258 },
+ { 236,-258 }, { 237,-258 }, { 238,-258 }, { 239,-258 }, { 240,-258 },
+ { 241,-258 }, { 242,-258 }, { 243,-258 }, { 244,-258 }, { 245,-258 },
+
+ { 246,-258 }, { 247,-258 }, { 248,-258 }, { 249,-258 }, { 250,-258 },
+ { 251,-258 }, { 252,-258 }, { 253,-258 }, { 254,-258 }, { 255,-258 },
+ { 256,-258 }, {   0,  55 }, {   0,4738 }, {   1,1548 }, {   2,1548 },
+ {   3,1548 }, {   4,1548 }, {   5,1548 }, {   6,1548 }, {   7,1548 },
+ {   8,1548 }, {   9,1806 }, {  10,2064 }, {  11,1548 }, {  12,1806 },
+ {  13,2064 }, {  14,1548 }, {  15,1548 }, {  16,1548 }, {  17,1548 },
+ {  18,1548 }, {  19,1548 }, {  20,1548 }, {  21,1548 }, {  22,1548 },
+ {  23,1548 }, {  24,1548 }, {  25,1548 }, {  26,1548 }, {  27,1548 },
+ {  28,1548 }, {  29,1548 }, {  30,1548 }, {  31,1548 }, {  32,1806 },
+ {  33,1548 }, {  34,1548 }, {  35,1548 }, {  36,1548 }, {  37,1548 },
+
+ {  38,1548 }, {  39,   0 }, {  40,1548 }, {  41,1548 }, {  42,1548 },
+ {  43,1548 }, {  44,1548 }, {  45,2111 }, {  46,1548 }, {  47,1548 },
+ {  48,1548 }, {  49,1548 }, {  50,1548 }, {  51,1548 }, {  52,1548 },
+ {  53,1548 }, {  54,1548 }, {  55,1548 }, {  56,1548 }, {  57,1548 },
+ {  58,1548 }, {  59,1548 }, {  60,1548 }, {  61,1548 }, {  62,1548 },
+ {  63,1548 }, {  64,1548 }, {  65,1548 }, {  66,1548 }, {  67,1548 },
+ {  68,1548 }, {  69,1548 }, {  70,1548 }, {  71,1548 }, {  72,1548 },
+ {  73,1548 }, {  74,1548 }, {  75,1548 }, {  76,1548 }, {  77,1548 },
+ {  78,1548 }, {  79,1548 }, {  80,1548 }, {  81,1548 }, {  82,1548 },
+ {  83,1548 }, {  84,1548 }, {  85,1548 }, {  86,1548 }, {  87,1548 },
+
+ {  88,1548 }, {  89,1548 }, {  90,1548 }, {  91,1548 }, {  92,1548 },
+ {  93,1548 }, {  94,1548 }, {  95,1548 }, {  96,1548 }, {  97,1548 },
+ {  98,1548 }, {  99,1548 }, { 100,1548 }, { 101,1548 }, { 102,1548 },
+ { 103,1548 }, { 104,1548 }, { 105,1548 }, { 106,1548 }, { 107,1548 },
+ { 108,1548 }, { 109,1548 }, { 110,1548 }, { 111,1548 }, { 112,1548 },
+ { 113,1548 }, { 114,1548 }, { 115,1548 }, { 116,1548 }, { 117,1548 },
+ { 118,1548 }, { 119,1548 }, { 120,1548 }, { 121,1548 }, { 122,1548 },
+ { 123,1548 }, { 124,1548 }, { 125,1548 }, { 126,1548 }, { 127,1548 },
+ { 128,1548 }, { 129,1548 }, { 130,1548 }, { 131,1548 }, { 132,1548 },
+ { 133,1548 }, { 134,1548 }, { 135,1548 }, { 136,1548 }, { 137,1548 },
+
+ { 138,1548 }, { 139,1548 }, { 140,1548 }, { 141,1548 }, { 142,1548 },
+ { 143,1548 }, { 144,1548 }, { 145,1548 }, { 146,1548 }, { 147,1548 },
+ { 148,1548 }, { 149,1548 }, { 150,1548 }, { 151,1548 }, { 152,1548 },
+ { 153,1548 }, { 154,1548 }, { 155,1548 }, { 156,1548 }, { 157,1548 },
+ { 158,1548 }, { 159,1548 }, { 160,1548 }, { 161,1548 }, { 162,1548 },
+ { 163,1548 }, { 164,1548 }, { 165,1548 }, { 166,1548 }, { 167,1548 },
+ { 168,1548 }, { 169,1548 }, { 170,1548 }, { 171,1548 }, { 172,1548 },
+ { 173,1548 }, { 174,1548 }, { 175,1548 }, { 176,1548 }, { 177,1548 },
+ { 178,1548 }, { 179,1548 }, { 180,1548 }, { 181,1548 }, { 182,1548 },
+ { 183,1548 }, { 184,1548 }, { 185,1548 }, { 186,1548 }, { 187,1548 },
+
+ { 188,1548 }, { 189,1548 }, { 190,1548 }, { 191,1548 }, { 192,1548 },
+ { 193,1548 }, { 194,1548 }, { 195,1548 }, { 196,1548 }, { 197,1548 },
+ { 198,1548 }, { 199,1548 }, { 200,1548 }, { 201,1548 }, { 202,1548 },
+ { 203,1548 }, { 204,1548 }, { 205,1548 }, { 206,1548 }, { 207,1548 },
+ { 208,1548 }, { 209,1548 }, { 210,1548 }, { 211,1548 }, { 212,1548 },
+ { 213,1548 }, { 214,1548 }, { 215,1548 }, { 216,1548 }, { 217,1548 },
+ { 218,1548 }, { 219,1548 }, { 220,1548 }, { 221,1548 }, { 222,1548 },
+ { 223,1548 }, { 224,1548 }, { 225,1548 }, { 226,1548 }, { 227,1548 },
+ { 228,1548 }, { 229,1548 }, { 230,1548 }, { 231,1548 }, { 232,1548 },
+ { 233,1548 }, { 234,1548 }, { 235,1548 }, { 236,1548 }, { 237,1548 },
+
+ { 238,1548 }, { 239,1548 }, { 240,1548 }, { 241,1548 }, { 242,1548 },
+ { 243,1548 }, { 244,1548 }, { 245,1548 }, { 246,1548 }, { 247,1548 },
+ { 248,1548 }, { 249,1548 }, { 250,1548 }, { 251,1548 }, { 252,1548 },
+ { 253,1548 }, { 254,1548 }, { 255,1548 }, { 256,1548 }, {   0,  55 },
+ {   0,4480 }, {   1,-774 }, {   2,-774 }, {   3,-774 }, {   4,-774 },
+ {   5,-774 }, {   6,-774 }, {   7,-774 }, {   8,-774 }, {   9,-516 },
+ {  10,-2131 }, {  11,-774 }, {  12,-516 }, {  13,-2131 }, {  14,-774 },
+ {  15,-774 }, {  16,-774 }, {  17,-774 }, {  18,-774 }, {  19,-774 },
+ {  20,-774 }, {  21,-774 }, {  22,-774 }, {  23,-774 }, {  24,-774 },
+ {  25,-774 }, {  26,-774 }, {  27,-774 }, {  28,-774 }, {  29,-774 },
+
+ {  30,-774 }, {  31,-774 }, {  32,-516 }, {  33,-774 }, {  34,-774 },
+ {  35,-774 }, {  36,-774 }, {  37,-774 }, {  38,-774 }, {  39,-258 },
+ {  40,-774 }, {  41,-774 }, {  42,-774 }, {  43,-774 }, {  44,-774 },
+ {  45,2111 }, {  46,-774 }, {  47,-774 }, {  48,-774 }, {  49,-774 },
+ {  50,-774 }, {  51,-774 }, {  52,-774 }, {  53,-774 }, {  54,-774 },
+ {  55,-774 }, {  56,-774 }, {  57,-774 }, {  58,-774 }, {  59,-774 },
+ {  60,-774 }, {  61,-774 }, {  62,-774 }, {  63,-774 }, {  64,-774 },
+ {  65,-774 }, {  66,-774 }, {  67,-774 }, {  68,-774 }, {  69,-774 },
+ {  70,-774 }, {  71,-774 }, {  72,-774 }, {  73,-774 }, {  74,-774 },
+ {  75,-774 }, {  76,-774 }, {  77,-774 }, {  78,-774 }, {  79,-774 },
+
+ {  80,-774 }, {  81,-774 }, {  82,-774 }, {  83,-774 }, {  84,-774 },
+ {  85,-774 }, {  86,-774 }, {  87,-774 }, {  88,-774 }, {  89,-774 },
+ {  90,-774 }, {  91,-774 }, {  92,-774 }, {  93,-774 }, {  94,-774 },
+ {  95,-774 }, {  96,-774 }, {  97,-774 }, {  98,-774 }, {  99,-774 },
+ { 100,-774 }, { 101,-774 }, { 102,-774 }, { 103,-774 }, { 104,-774 },
+ { 105,-774 }, { 106,-774 }, { 107,-774 }, { 108,-774 }, { 109,-774 },
+ { 110,-774 }, { 111,-774 }, { 112,-774 }, { 113,-774 }, { 114,-774 },
+ { 115,-774 }, { 116,-774 }, { 117,-774 }, { 118,-774 }, { 119,-774 },
+ { 120,-774 }, { 121,-774 }, { 122,-774 }, { 123,-774 }, { 124,-774 },
+ { 125,-774 }, { 126,-774 }, { 127,-774 }, { 128,-774 }, { 129,-774 },
+
+ { 130,-774 }, { 131,-774 }, { 132,-774 }, { 133,-774 }, { 134,-774 },
+ { 135,-774 }, { 136,-774 }, { 137,-774 }, { 138,-774 }, { 139,-774 },
+ { 140,-774 }, { 141,-774 }, { 142,-774 }, { 143,-774 }, { 144,-774 },
+ { 145,-774 }, { 146,-774 }, { 147,-774 }, { 148,-774 }, { 149,-774 },
+ { 150,-774 }, { 151,-774 }, { 152,-774 }, { 153,-774 }, { 154,-774 },
+ { 155,-774 }, { 156,-774 }, { 157,-774 }, { 158,-774 }, { 159,-774 },
+ { 160,-774 }, { 161,-774 }, { 162,-774 }, { 163,-774 }, { 164,-774 },
+ { 165,-774 }, { 166,-774 }, { 167,-774 }, { 168,-774 }, { 169,-774 },
+ { 170,-774 }, { 171,-774 }, { 172,-774 }, { 173,-774 }, { 174,-774 },
+ { 175,-774 }, { 176,-774 }, { 177,-774 }, { 178,-774 }, { 179,-774 },
+
+ { 180,-774 }, { 181,-774 }, { 182,-774 }, { 183,-774 }, { 184,-774 },
+ { 185,-774 }, { 186,-774 }, { 187,-774 }, { 188,-774 }, { 189,-774 },
+ { 190,-774 }, { 191,-774 }, { 192,-774 }, { 193,-774 }, { 194,-774 },
+ { 195,-774 }, { 196,-774 }, { 197,-774 }, { 198,-774 }, { 199,-774 },
+ { 200,-774 }, { 201,-774 }, { 202,-774 }, { 203,-774 }, { 204,-774 },
+ { 205,-774 }, { 206,-774 }, { 207,-774 }, { 208,-774 }, { 209,-774 },
+ { 210,-774 }, { 211,-774 }, { 212,-774 }, { 213,-774 }, { 214,-774 },
+ { 215,-774 }, { 216,-774 }, { 217,-774 }, { 218,-774 }, { 219,-774 },
+ { 220,-774 }, { 221,-774 }, { 222,-774 }, { 223,-774 }, { 224,-774 },
+ { 225,-774 }, { 226,-774 }, { 227,-774 }, { 228,-774 }, { 229,-774 },
+
+ { 230,-774 }, { 231,-774 }, { 232,-774 }, { 233,-774 }, { 234,-774 },
+ { 235,-774 }, { 236,-774 }, { 237,-774 }, { 238,-774 }, { 239,-774 },
+ { 240,-774 }, { 241,-774 }, { 242,-774 }, { 243,-774 }, { 244,-774 },
+ { 245,-774 }, { 246,-774 }, { 247,-774 }, { 248,-774 }, { 249,-774 },
+ { 250,-774 }, { 251,-774 }, { 252,-774 }, { 253,-774 }, { 254,-774 },
+ { 255,-774 }, { 256,-774 }, {   0,  28 }, {   0,4222 }, {   1,   0 },
+ {   2,   0 }, {   3,   0 }, {   4,   0 }, {   5,   0 }, {   6,   0 },
+ {   7,   0 }, {   8,   0 }, {   9, 258 }, {  10,-2084 }, {  11,   0 },
+ {  12, 258 }, {  13,-2084 }, {  14,   0 }, {  15,   0 }, {  16,   0 },
+ {  17,   0 }, {  18,   0 }, {  19,   0 }, {  20,   0 }, {  21,   0 },
+
+ {  22,   0 }, {  23,   0 }, {  24,   0 }, {  25,   0 }, {  26,   0 },
+ {  27,   0 }, {  28,   0 }, {  29,   0 }, {  30,   0 }, {  31,   0 },
+ {  32, 258 }, {  33,   0 }, {  34,   0 }, {  35,   0 }, {  36,   0 },
+ {  37,   0 }, {  38,   0 }, {  39, 516 }, {  40,   0 }, {  41,   0 },
+ {  42,   0 }, {  43,   0 }, {  44,   0 }, {  45, 774 }, {  46,   0 },
+ {  47,   0 }, {  48,   0 }, {  49,   0 }, {  50,   0 }, {  51,   0 },
+ {  52,   0 }, {  53,   0 }, {  54,   0 }, {  55,   0 }, {  56,   0 },
+ {  57,   0 }, {  58,   0 }, {  59,   0 }, {  60,   0 }, {  61,   0 },
+ {  62,   0 }, {  63,   0 }, {  64,   0 }, {  65,   0 }, {  66,   0 },
+ {  67,   0 }, {  68,   0 }, {  69,   0 }, {  70,   0 }, {  71,   0 },
+
+ {  72,   0 }, {  73,   0 }, {  74,   0 }, {  75,   0 }, {  76,   0 },
+ {  77,   0 }, {  78,   0 }, {  79,   0 }, {  80,   0 }, {  81,   0 },
+ {  82,   0 }, {  83,   0 }, {  84,   0 }, {  85,   0 }, {  86,   0 },
+ {  87,   0 }, {  88,   0 }, {  89,   0 }, {  90,   0 }, {  91,   0 },
+ {  92,   0 }, {  93,   0 }, {  94,   0 }, {  95,   0 }, {  96,   0 },
+ {  97,   0 }, {  98,   0 }, {  99,   0 }, { 100,   0 }, { 101,   0 },
+ { 102,   0 }, { 103,   0 }, { 104,   0 }, { 105,   0 }, { 106,   0 },
+ { 107,   0 }, { 108,   0 }, { 109,   0 }, { 110,   0 }, { 111,   0 },
+ { 112,   0 }, { 113,   0 }, { 114,   0 }, { 115,   0 }, { 116,   0 },
+ { 117,   0 }, { 118,   0 }, { 119,   0 }, { 120,   0 }, { 121,   0 },
+
+ { 122,   0 }, { 123,   0 }, { 124,   0 }, { 125,   0 }, { 126,   0 },
+ { 127,   0 }, { 128,   0 }, { 129,   0 }, { 130,   0 }, { 131,   0 },
+ { 132,   0 }, { 133,   0 }, { 134,   0 }, { 135,   0 }, { 136,   0 },
+ { 137,   0 }, { 138,   0 }, { 139,   0 }, { 140,   0 }, { 141,   0 },
+ { 142,   0 }, { 143,   0 }, { 144,   0 }, { 145,   0 }, { 146,   0 },
+ { 147,   0 }, { 148,   0 }, { 149,   0 }, { 150,   0 }, { 151,   0 },
+ { 152,   0 }, { 153,   0 }, { 154,   0 }, { 155,   0 }, { 156,   0 },
+ { 157,   0 }, { 158,   0 }, { 159,   0 }, { 160,   0 }, { 161,   0 },
+ { 162,   0 }, { 163,   0 }, { 164,   0 }, { 165,   0 }, { 166,   0 },
+ { 167,   0 }, { 168,   0 }, { 169,   0 }, { 170,   0 }, { 171,   0 },
+
+ { 172,   0 }, { 173,   0 }, { 174,   0 }, { 175,   0 }, { 176,   0 },
+ { 177,   0 }, { 178,   0 }, { 179,   0 }, { 180,   0 }, { 181,   0 },
+ { 182,   0 }, { 183,   0 }, { 184,   0 }, { 185,   0 }, { 186,   0 },
+ { 187,   0 }, { 188,   0 }, { 189,   0 }, { 190,   0 }, { 191,   0 },
+ { 192,   0 }, { 193,   0 }, { 194,   0 }, { 195,   0 }, { 196,   0 },
+ { 197,   0 }, { 198,   0 }, { 199,   0 }, { 200,   0 }, { 201,   0 },
+ { 202,   0 }, { 203,   0 }, { 204,   0 }, { 205,   0 }, { 206,   0 },
+ { 207,   0 }, { 208,   0 }, { 209,   0 }, { 210,   0 }, { 211,   0 },
+ { 212,   0 }, { 213,   0 }, { 214,   0 }, { 215,   0 }, { 216,   0 },
+ { 217,   0 }, { 218,   0 }, { 219,   0 }, { 220,   0 }, { 221,   0 },
+
+ { 222,   0 }, { 223,   0 }, { 224,   0 }, { 225,   0 }, { 226,   0 },
+ { 227,   0 }, { 228,   0 }, { 229,   0 }, { 230,   0 }, { 231,   0 },
+ { 232,   0 }, { 233,   0 }, { 234,   0 }, { 235,   0 }, { 236,   0 },
+ { 237,   0 }, { 238,   0 }, { 239,   0 }, { 240,   0 }, { 241,   0 },
+ { 242,   0 }, { 243,   0 }, { 244,   0 }, { 245,   0 }, { 246,   0 },
+ { 247,   0 }, { 248,   0 }, { 249,   0 }, { 250,   0 }, { 251,   0 },
+ { 252,   0 }, { 253,   0 }, { 254,   0 }, { 255,   0 }, { 256,   0 },
+ {   0,  28 }, {   0,3964 }, {   1,-258 }, {   2,-258 }, {   3,-258 },
+ {   4,-258 }, {   5,-258 }, {   6,-258 }, {   7,-258 }, {   8,-258 },
+ {   9,   0 }, {  10,-2342 }, {  11,-258 }, {  12,   0 }, {  13,-2342 },
+
+ {  14,-258 }, {  15,-258 }, {  16,-258 }, {  17,-258 }, {  18,-258 },
+ {  19,-258 }, {  20,-258 }, {  21,-258 }, {  22,-258 }, {  23,-258 },
+ {  24,-258 }, {  25,-258 }, {  26,-258 }, {  27,-258 }, {  28,-258 },
+ {  29,-258 }, {  30,-258 }, {  31,-258 }, {  32,   0 }, {  33,-258 },
+ {  34,-258 }, {  35,-258 }, {  36,-258 }, {  37,-258 }, {  38,-258 },
+ {  39, 258 }, {  40,-258 }, {  41,-258 }, {  42,-258 }, {  43,-258 },
+ {  44,-258 }, {  45, 516 }, {  46,-258 }, {  47,-258 }, {  48,-258 },
+ {  49,-258 }, {  50,-258 }, {  51,-258 }, {  52,-258 }, {  53,-258 },
+ {  54,-258 }, {  55,-258 }, {  56,-258 }, {  57,-258 }, {  58,-258 },
+ {  59,-258 }, {  60,-258 }, {  61,-258 }, {  62,-258 }, {  63,-258 },
+
+ {  64,-258 }, {  65,-258 }, {  66,-258 }, {  67,-258 }, {  68,-258 },
+ {  69,-258 }, {  70,-258 }, {  71,-258 }, {  72,-258 }, {  73,-258 },
+ {  74,-258 }, {  75,-258 }, {  76,-258 }, {  77,-258 }, {  78,-258 },
+ {  79,-258 }, {  80,-258 }, {  81,-258 }, {  82,-258 }, {  83,-258 },
+ {  84,-258 }, {  85,-258 }, {  86,-258 }, {  87,-258 }, {  88,-258 },
+ {  89,-258 }, {  90,-258 }, {  91,-258 }, {  92,-258 }, {  93,-258 },
+ {  94,-258 }, {  95,-258 }, {  96,-258 }, {  97,-258 }, {  98,-258 },
+ {  99,-258 }, { 100,-258 }, { 101,-258 }, { 102,-258 }, { 103,-258 },
+ { 104,-258 }, { 105,-258 }, { 106,-258 }, { 107,-258 }, { 108,-258 },
+ { 109,-258 }, { 110,-258 }, { 111,-258 }, { 112,-258 }, { 113,-258 },
+
+ { 114,-258 }, { 115,-258 }, { 116,-258 }, { 117,-258 }, { 118,-258 },
+ { 119,-258 }, { 120,-258 }, { 121,-258 }, { 122,-258 }, { 123,-258 },
+ { 124,-258 }, { 125,-258 }, { 126,-258 }, { 127,-258 }, { 128,-258 },
+ { 129,-258 }, { 130,-258 }, { 131,-258 }, { 132,-258 }, { 133,-258 },
+ { 134,-258 }, { 135,-258 }, { 136,-258 }, { 137,-258 }, { 138,-258 },
+ { 139,-258 }, { 140,-258 }, { 141,-258 }, { 142,-258 }, { 143,-258 },
+ { 144,-258 }, { 145,-258 }, { 146,-258 }, { 147,-258 }, { 148,-258 },
+ { 149,-258 }, { 150,-258 }, { 151,-258 }, { 152,-258 }, { 153,-258 },
+ { 154,-258 }, { 155,-258 }, { 156,-258 }, { 157,-258 }, { 158,-258 },
+ { 159,-258 }, { 160,-258 }, { 161,-258 }, { 162,-258 }, { 163,-258 },
+
+ { 164,-258 }, { 165,-258 }, { 166,-258 }, { 167,-258 }, { 168,-258 },
+ { 169,-258 }, { 170,-258 }, { 171,-258 }, { 172,-258 }, { 173,-258 },
+ { 174,-258 }, { 175,-258 }, { 176,-258 }, { 177,-258 }, { 178,-258 },
+ { 179,-258 }, { 180,-258 }, { 181,-258 }, { 182,-258 }, { 183,-258 },
+ { 184,-258 }, { 185,-258 }, { 186,-258 }, { 187,-258 }, { 188,-258 },
+ { 189,-258 }, { 190,-258 }, { 191,-258 }, { 192,-258 }, { 193,-258 },
+ { 194,-258 }, { 195,-258 }, { 196,-258 }, { 197,-258 }, { 198,-258 },
+ { 199,-258 }, { 200,-258 }, { 201,-258 }, { 202,-258 }, { 203,-258 },
+ { 204,-258 }, { 205,-258 }, { 206,-258 }, { 207,-258 }, { 208,-258 },
+ { 209,-258 }, { 210,-258 }, { 211,-258 }, { 212,-258 }, { 213,-258 },
+
+ { 214,-258 }, { 215,-258 }, { 216,-258 }, { 217,-258 }, { 218,-258 },
+ { 219,-258 }, { 220,-258 }, { 221,-258 }, { 222,-258 }, { 223,-258 },
+ { 224,-258 }, { 225,-258 }, { 226,-258 }, { 227,-258 }, { 228,-258 },
+ { 229,-258 }, { 230,-258 }, { 231,-258 }, { 232,-258 }, { 233,-258 },
+ { 234,-258 }, { 235,-258 }, { 236,-258 }, { 237,-258 }, { 238,-258 },
+ { 239,-258 }, { 240,-258 }, { 241,-258 }, { 242,-258 }, { 243,-258 },
+ { 244,-258 }, { 245,-258 }, { 246,-258 }, { 247,-258 }, { 248,-258 },
+ { 249,-258 }, { 250,-258 }, { 251,-258 }, { 252,-258 }, { 253,-258 },
+ { 254,-258 }, { 255,-258 }, { 256,-258 }, {   0,  28 }, {   0,3706 },
+ {   1,1595 }, {   2,1595 }, {   3,1595 }, {   4,1595 }, {   5,1595 },
+
+ {   6,1595 }, {   7,1595 }, {   8,1595 }, {   9,1853 }, {  10,2111 },
+ {  11,1595 }, {  12,1853 }, {  13,2111 }, {  14,1595 }, {  15,1595 },
+ {  16,1595 }, {  17,1595 }, {  18,1595 }, {  19,1595 }, {  20,1595 },
+ {  21,1595 }, {  22,1595 }, {  23,1595 }, {  24,1595 }, {  25,1595 },
+ {  26,1595 }, {  27,1595 }, {  28,1595 }, {  29,1595 }, {  30,1595 },
+ {  31,1595 }, {  32,1853 }, {  33,1595 }, {  34,1595 }, {  35,1595 },
+ {  36,1595 }, {  37,1595 }, {  38,1595 }, {  39,   0 }, {  40,1595 },
+ {  41,1595 }, {  42,1595 }, {  43,1595 }, {  44,1595 }, {  45,2158 },
+ {  46,1595 }, {  47,1595 }, {  48,1595 }, {  49,1595 }, {  50,1595 },
+ {  51,1595 }, {  52,1595 }, {  53,1595 }, {  54,1595 }, {  55,1595 },
+
+ {  56,1595 }, {  57,1595 }, {  58,1595 }, {  59,1595 }, {  60,1595 },
+ {  61,1595 }, {  62,1595 }, {  63,1595 }, {  64,1595 }, {  65,1595 },
+ {  66,1595 }, {  67,1595 }, {  68,1595 }, {  69,1595 }, {  70,1595 },
+ {  71,1595 }, {  72,1595 }, {  73,1595 }, {  74,1595 }, {  75,1595 },
+ {  76,1595 }, {  77,1595 }, {  78,1595 }, {  79,1595 }, {  80,1595 },
+ {  81,1595 }, {  82,1595 }, {  83,1595 }, {  84,1595 }, {  85,1595 },
+ {  86,1595 }, {  87,1595 }, {  88,1595 }, {  89,1595 }, {  90,1595 },
+ {  91,1595 }, {  92,1595 }, {  93,1595 }, {  94,1595 }, {  95,1595 },
+ {  96,1595 }, {  97,1595 }, {  98,1595 }, {  99,1595 }, { 100,1595 },
+ { 101,1595 }, { 102,1595 }, { 103,1595 }, { 104,1595 }, { 105,1595 },
+
+ { 106,1595 }, { 107,1595 }, { 108,1595 }, { 109,1595 }, { 110,1595 },
+ { 111,1595 }, { 112,1595 }, { 113,1595 }, { 114,1595 }, { 115,1595 },
+ { 116,1595 }, { 117,1595 }, { 118,1595 }, { 119,1595 }, { 120,1595 },
+ { 121,1595 }, { 122,1595 }, { 123,1595 }, { 124,1595 }, { 125,1595 },
+ { 126,1595 }, { 127,1595 }, { 128,1595 }, { 129,1595 }, { 130,1595 },
+ { 131,1595 }, { 132,1595 }, { 133,1595 }, { 134,1595 }, { 135,1595 },
+ { 136,1595 }, { 137,1595 }, { 138,1595 }, { 139,1595 }, { 140,1595 },
+ { 141,1595 }, { 142,1595 }, { 143,1595 }, { 144,1595 }, { 145,1595 },
+ { 146,1595 }, { 147,1595 }, { 148,1595 }, { 149,1595 }, { 150,1595 },
+ { 151,1595 }, { 152,1595 }, { 153,1595 }, { 154,1595 }, { 155,1595 },
+
+ { 156,1595 }, { 157,1595 }, { 158,1595 }, { 159,1595 }, { 160,1595 },
+ { 161,1595 }, { 162,1595 }, { 163,1595 }, { 164,1595 }, { 165,1595 },
+ { 166,1595 }, { 167,1595 }, { 168,1595 }, { 169,1595 }, { 170,1595 },
+ { 171,1595 }, { 172,1595 }, { 173,1595 }, { 174,1595 }, { 175,1595 },
+ { 176,1595 }, { 177,1595 }, { 178,1595 }, { 179,1595 }, { 180,1595 },
+ { 181,1595 }, { 182,1595 }, { 183,1595 }, { 184,1595 }, { 185,1595 },
+ { 186,1595 }, { 187,1595 }, { 188,1595 }, { 189,1595 }, { 190,1595 },
+ { 191,1595 }, { 192,1595 }, { 193,1595 }, { 194,1595 }, { 195,1595 },
+ { 196,1595 }, { 197,1595 }, { 198,1595 }, { 199,1595 }, { 200,1595 },
+ { 201,1595 }, { 202,1595 }, { 203,1595 }, { 204,1595 }, { 205,1595 },
+
+ { 206,1595 }, { 207,1595 }, { 208,1595 }, { 209,1595 }, { 210,1595 },
+ { 211,1595 }, { 212,1595 }, { 213,1595 }, { 214,1595 }, { 215,1595 },
+ { 216,1595 }, { 217,1595 }, { 218,1595 }, { 219,1595 }, { 220,1595 },
+ { 221,1595 }, { 222,1595 }, { 223,1595 }, { 224,1595 }, { 225,1595 },
+ { 226,1595 }, { 227,1595 }, { 228,1595 }, { 229,1595 }, { 230,1595 },
+ { 231,1595 }, { 232,1595 }, { 233,1595 }, { 234,1595 }, { 235,1595 },
+ { 236,1595 }, { 237,1595 }, { 238,1595 }, { 239,1595 }, { 240,1595 },
+ { 241,1595 }, { 242,1595 }, { 243,1595 }, { 244,1595 }, { 245,1595 },
+ { 246,1595 }, { 247,1595 }, { 248,1595 }, { 249,1595 }, { 250,1595 },
+ { 251,1595 }, { 252,1595 }, { 253,1595 }, { 254,1595 }, { 255,1595 },
+
+ { 256,1595 }, {   0,  28 }, {   0,3448 }, {   1,-774 }, {   2,-774 },
+ {   3,-774 }, {   4,-774 }, {   5,-774 }, {   6,-774 }, {   7,-774 },
+ {   8,-774 }, {   9,-516 }, {  10,-2858 }, {  11,-774 }, {  12,-516 },
+ {  13,-2858 }, {  14,-774 }, {  15,-774 }, {  16,-774 }, {  17,-774 },
+ {  18,-774 }, {  19,-774 }, {  20,-774 }, {  21,-774 }, {  22,-774 },
+ {  23,-774 }, {  24,-774 }, {  25,-774 }, {  26,-774 }, {  27,-774 },
+ {  28,-774 }, {  29,-774 }, {  30,-774 }, {  31,-774 }, {  32,-516 },
+ {  33,-774 }, {  34,-774 }, {  35,-774 }, {  36,-774 }, {  37,-774 },
+ {  38,-774 }, {  39,-258 }, {  40,-774 }, {  41,-774 }, {  42,-774 },
+ {  43,-774 }, {  44,-774 }, {  45,2158 }, {  46,-774 }, {  47,-774 },
+
+ {  48,-774 }, {  49,-774 }, {  50,-774 }, {  51,-774 }, {  52,-774 },
+ {  53,-774 }, {  54,-774 }, {  55,-774 }, {  56,-774 }, {  57,-774 },
+ {  58,-774 }, {  59,-774 }, {  60,-774 }, {  61,-774 }, {  62,-774 },
+ {  63,-774 }, {  64,-774 }, {  65,-774 }, {  66,-774 }, {  67,-774 },
+ {  68,-774 }, {  69,-774 }, {  70,-774 }, {  71,-774 }, {  72,-774 },
+ {  73,-774 }, {  74,-774 }, {  75,-774 }, {  76,-774 }, {  77,-774 },
+ {  78,-774 }, {  79,-774 }, {  80,-774 }, {  81,-774 }, {  82,-774 },
+ {  83,-774 }, {  84,-774 }, {  85,-774 }, {  86,-774 }, {  87,-774 },
+ {  88,-774 }, {  89,-774 }, {  90,-774 }, {  91,-774 }, {  92,-774 },
+ {  93,-774 }, {  94,-774 }, {  95,-774 }, {  96,-774 }, {  97,-774 },
+
+ {  98,-774 }, {  99,-774 }, { 100,-774 }, { 101,-774 }, { 102,-774 },
+ { 103,-774 }, { 104,-774 }, { 105,-774 }, { 106,-774 }, { 107,-774 },
+ { 108,-774 }, { 109,-774 }, { 110,-774 }, { 111,-774 }, { 112,-774 },
+ { 113,-774 }, { 114,-774 }, { 115,-774 }, { 116,-774 }, { 117,-774 },
+ { 118,-774 }, { 119,-774 }, { 120,-774 }, { 121,-774 }, { 122,-774 },
+ { 123,-774 }, { 124,-774 }, { 125,-774 }, { 126,-774 }, { 127,-774 },
+ { 128,-774 }, { 129,-774 }, { 130,-774 }, { 131,-774 }, { 132,-774 },
+ { 133,-774 }, { 134,-774 }, { 135,-774 }, { 136,-774 }, { 137,-774 },
+ { 138,-774 }, { 139,-774 }, { 140,-774 }, { 141,-774 }, { 142,-774 },
+ { 143,-774 }, { 144,-774 }, { 145,-774 }, { 146,-774 }, { 147,-774 },
+
+ { 148,-774 }, { 149,-774 }, { 150,-774 }, { 151,-774 }, { 152,-774 },
+ { 153,-774 }, { 154,-774 }, { 155,-774 }, { 156,-774 }, { 157,-774 },
+ { 158,-774 }, { 159,-774 }, { 160,-774 }, { 161,-774 }, { 162,-774 },
+ { 163,-774 }, { 164,-774 }, { 165,-774 }, { 166,-774 }, { 167,-774 },
+ { 168,-774 }, { 169,-774 }, { 170,-774 }, { 171,-774 }, { 172,-774 },
+ { 173,-774 }, { 174,-774 }, { 175,-774 }, { 176,-774 }, { 177,-774 },
+ { 178,-774 }, { 179,-774 }, { 180,-774 }, { 181,-774 }, { 182,-774 },
+ { 183,-774 }, { 184,-774 }, { 185,-774 }, { 186,-774 }, { 187,-774 },
+ { 188,-774 }, { 189,-774 }, { 190,-774 }, { 191,-774 }, { 192,-774 },
+ { 193,-774 }, { 194,-774 }, { 195,-774 }, { 196,-774 }, { 197,-774 },
+
+ { 198,-774 }, { 199,-774 }, { 200,-774 }, { 201,-774 }, { 202,-774 },
+ { 203,-774 }, { 204,-774 }, { 205,-774 }, { 206,-774 }, { 207,-774 },
+ { 208,-774 }, { 209,-774 }, { 210,-774 }, { 211,-774 }, { 212,-774 },
+ { 213,-774 }, { 214,-774 }, { 215,-774 }, { 216,-774 }, { 217,-774 },
+ { 218,-774 }, { 219,-774 }, { 220,-774 }, { 221,-774 }, { 222,-774 },
+ { 223,-774 }, { 224,-774 }, { 225,-774 }, { 226,-774 }, { 227,-774 },
+ { 228,-774 }, { 229,-774 }, { 230,-774 }, { 231,-774 }, { 232,-774 },
+ { 233,-774 }, { 234,-774 }, { 235,-774 }, { 236,-774 }, { 237,-774 },
+ { 238,-774 }, { 239,-774 }, { 240,-774 }, { 241,-774 }, { 242,-774 },
+ { 243,-774 }, { 244,-774 }, { 245,-774 }, { 246,-774 }, { 247,-774 },
+
+ { 248,-774 }, { 249,-774 }, { 250,-774 }, { 251,-774 }, { 252,-774 },
+ { 253,-774 }, { 254,-774 }, { 255,-774 }, { 256,-774 }, {   0,  55 },
+ {   0,3190 }, {   1,-2064 }, {   2,-2064 }, {   3,-2064 }, {   4,-2064 },
+ {   5,-2064 }, {   6,-2064 }, {   7,-2064 }, {   8,-2064 }, {   9,-1806 },
+ {  10,-3421 }, {  11,-2064 }, {  12,-1806 }, {  13,-3421 }, {  14,-2064 },
+ {  15,-2064 }, {  16,-2064 }, {  17,-2064 }, {  18,-2064 }, {  19,-2064 },
+ {  20,-2064 }, {  21,-2064 }, {  22,-2064 }, {  23,-2064 }, {  24,-2064 },
+ {  25,-2064 }, {  26,-2064 }, {  27,-2064 }, {  28,-2064 }, {  29,-2064 },
+ {  30,-2064 }, {  31,-2064 }, {  32,-1806 }, {  33,-2064 }, {  34,-2064 },
+ {  35,-2064 }, {  36,-2064 }, {  37,-2064 }, {  38,-2064 }, {  39,2158 },
+
+ {  40,-2064 }, {  41,-2064 }, {  42,-2064 }, {  43,-2064 }, {  44,-2064 },
+ {  45,-1290 }, {  46,-2064 }, {  47,-2064 }, {  48,-2064 }, {  49,-2064 },
+ {  50,-2064 }, {  51,-2064 }, {  52,-2064 }, {  53,-2064 }, {  54,-2064 },
+ {  55,-2064 }, {  56,-2064 }, {  57,-2064 }, {  58,-2064 }, {  59,-2064 },
+ {  60,-2064 }, {  61,-2064 }, {  62,-2064 }, {  63,-2064 }, {  64,-2064 },
+ {  65,-2064 }, {  66,-2064 }, {  67,-2064 }, {  68,-2064 }, {  69,-2064 },
+ {  70,-2064 }, {  71,-2064 }, {  72,-2064 }, {  73,-2064 }, {  74,-2064 },
+ {  75,-2064 }, {  76,-2064 }, {  77,-2064 }, {  78,-2064 }, {  79,-2064 },
+ {  80,-2064 }, {  81,-2064 }, {  82,-2064 }, {  83,-2064 }, {  84,-2064 },
+ {  85,-2064 }, {  86,-2064 }, {  87,-2064 }, {  88,-2064 }, {  89,-2064 },
+
+ {  90,-2064 }, {  91,-2064 }, {  92,-2064 }, {  93,-2064 }, {  94,-2064 },
+ {  95,-2064 }, {  96,-2064 }, {  97,-2064 }, {  98,-2064 }, {  99,-2064 },
+ { 100,-2064 }, { 101,-2064 }, { 102,-2064 }, { 103,-2064 }, { 104,-2064 },
+ { 105,-2064 }, { 106,-2064 }, { 107,-2064 }, { 108,-2064 }, { 109,-2064 },
+ { 110,-2064 }, { 111,-2064 }, { 112,-2064 }, { 113,-2064 }, { 114,-2064 },
+ { 115,-2064 }, { 116,-2064 }, { 117,-2064 }, { 118,-2064 }, { 119,-2064 },
+ { 120,-2064 }, { 121,-2064 }, { 122,-2064 }, { 123,-2064 }, { 124,-2064 },
+ { 125,-2064 }, { 126,-2064 }, { 127,-2064 }, { 128,-2064 }, { 129,-2064 },
+ { 130,-2064 }, { 131,-2064 }, { 132,-2064 }, { 133,-2064 }, { 134,-2064 },
+ { 135,-2064 }, { 136,-2064 }, { 137,-2064 }, { 138,-2064 }, { 139,-2064 },
+
+ { 140,-2064 }, { 141,-2064 }, { 142,-2064 }, { 143,-2064 }, { 144,-2064 },
+ { 145,-2064 }, { 146,-2064 }, { 147,-2064 }, { 148,-2064 }, { 149,-2064 },
+ { 150,-2064 }, { 151,-2064 }, { 152,-2064 }, { 153,-2064 }, { 154,-2064 },
+ { 155,-2064 }, { 156,-2064 }, { 157,-2064 }, { 158,-2064 }, { 159,-2064 },
+ { 160,-2064 }, { 161,-2064 }, { 162,-2064 }, { 163,-2064 }, { 164,-2064 },
+ { 165,-2064 }, { 166,-2064 }, { 167,-2064 }, { 168,-2064 }, { 169,-2064 },
+ { 170,-2064 }, { 171,-2064 }, { 172,-2064 }, { 173,-2064 }, { 174,-2064 },
+ { 175,-2064 }, { 176,-2064 }, { 177,-2064 }, { 178,-2064 }, { 179,-2064 },
+ { 180,-2064 }, { 181,-2064 }, { 182,-2064 }, { 183,-2064 }, { 184,-2064 },
+ { 185,-2064 }, { 186,-2064 }, { 187,-2064 }, { 188,-2064 }, { 189,-2064 },
+
+ { 190,-2064 }, { 191,-2064 }, { 192,-2064 }, { 193,-2064 }, { 194,-2064 },
+ { 195,-2064 }, { 196,-2064 }, { 197,-2064 }, { 198,-2064 }, { 199,-2064 },
+ { 200,-2064 }, { 201,-2064 }, { 202,-2064 }, { 203,-2064 }, { 204,-2064 },
+ { 205,-2064 }, { 206,-2064 }, { 207,-2064 }, { 208,-2064 }, { 209,-2064 },
+ { 210,-2064 }, { 211,-2064 }, { 212,-2064 }, { 213,-2064 }, { 214,-2064 },
+ { 215,-2064 }, { 216,-2064 }, { 217,-2064 }, { 218,-2064 }, { 219,-2064 },
+ { 220,-2064 }, { 221,-2064 }, { 222,-2064 }, { 223,-2064 }, { 224,-2064 },
+ { 225,-2064 }, { 226,-2064 }, { 227,-2064 }, { 228,-2064 }, { 229,-2064 },
+ { 230,-2064 }, { 231,-2064 }, { 232,-2064 }, { 233,-2064 }, { 234,-2064 },
+ { 235,-2064 }, { 236,-2064 }, { 237,-2064 }, { 238,-2064 }, { 239,-2064 },
+
+ { 240,-2064 }, { 241,-2064 }, { 242,-2064 }, { 243,-2064 }, { 244,-2064 },
+ { 245,-2064 }, { 246,-2064 }, { 247,-2064 }, { 248,-2064 }, { 249,-2064 },
+ { 250,-2064 }, { 251,-2064 }, { 252,-2064 }, { 253,-2064 }, { 254,-2064 },
+ { 255,-2064 }, { 256,-2064 }, {   0,  55 }, {   0,2932 }, {   1,-2322 },
+ {   2,-2322 }, {   3,-2322 }, {   4,-2322 }, {   5,-2322 }, {   6,-2322 },
+ {   7,-2322 }, {   8,-2322 }, {   9,-2064 }, {  10,-3679 }, {  11,-2322 },
+ {  12,-2064 }, {  13,-3679 }, {  14,-2322 }, {  15,-2322 }, {  16,-2322 },
+ {  17,-2322 }, {  18,-2322 }, {  19,-2322 }, {  20,-2322 }, {  21,-2322 },
+ {  22,-2322 }, {  23,-2322 }, {  24,-2322 }, {  25,-2322 }, {  26,-2322 },
+ {  27,-2322 }, {  28,-2322 }, {  29,-2322 }, {  30,-2322 }, {  31,-2322 },
+
+ {  32,-2064 }, {  33,-2322 }, {  34,-2322 }, {  35,-2322 }, {  36,-2322 },
+ {  37,-2322 }, {  38,-2322 }, {  39,1900 }, {  40,-2322 }, {  41,-2322 },
+ {  42,-2322 }, {  43,-2322 }, {  44,-2322 }, {  45,-1548 }, {  46,-2322 },
+ {  47,-2322 }, {  48,-2322 }, {  49,-2322 }, {  50,-2322 }, {  51,-2322 },
+ {  52,-2322 }, {  53,-2322 }, {  54,-2322 }, {  55,-2322 }, {  56,-2322 },
+ {  57,-2322 }, {  58,-2322 }, {  59,-2322 }, {  60,-2322 }, {  61,-2322 },
+ {  62,-2322 }, {  63,-2322 }, {  64,-2322 }, {  65,-2322 }, {  66,-2322 },
+ {  67,-2322 }, {  68,-2322 }, {  69,-2322 }, {  70,-2322 }, {  71,-2322 },
+ {  72,-2322 }, {  73,-2322 }, {  74,-2322 }, {  75,-2322 }, {  76,-2322 },
+ {  77,-2322 }, {  78,-2322 }, {  79,-2322 }, {  80,-2322 }, {  81,-2322 },
+
+ {  82,-2322 }, {  83,-2322 }, {  84,-2322 }, {  85,-2322 }, {  86,-2322 },
+ {  87,-2322 }, {  88,-2322 }, {  89,-2322 }, {  90,-2322 }, {  91,-2322 },
+ {  92,-2322 }, {  93,-2322 }, {  94,-2322 }, {  95,-2322 }, {  96,-2322 },
+ {  97,-2322 }, {  98,-2322 }, {  99,-2322 }, { 100,-2322 }, { 101,-2322 },
+ { 102,-2322 }, { 103,-2322 }, { 104,-2322 }, { 105,-2322 }, { 106,-2322 },
+ { 107,-2322 }, { 108,-2322 }, { 109,-2322 }, { 110,-2322 }, { 111,-2322 },
+ { 112,-2322 }, { 113,-2322 }, { 114,-2322 }, { 115,-2322 }, { 116,-2322 },
+ { 117,-2322 }, { 118,-2322 }, { 119,-2322 }, { 120,-2322 }, { 121,-2322 },
+ { 122,-2322 }, { 123,-2322 }, { 124,-2322 }, { 125,-2322 }, { 126,-2322 },
+ { 127,-2322 }, { 128,-2322 }, { 129,-2322 }, { 130,-2322 }, { 131,-2322 },
+
+ { 132,-2322 }, { 133,-2322 }, { 134,-2322 }, { 135,-2322 }, { 136,-2322 },
+ { 137,-2322 }, { 138,-2322 }, { 139,-2322 }, { 140,-2322 }, { 141,-2322 },
+ { 142,-2322 }, { 143,-2322 }, { 144,-2322 }, { 145,-2322 }, { 146,-2322 },
+ { 147,-2322 }, { 148,-2322 }, { 149,-2322 }, { 150,-2322 }, { 151,-2322 },
+ { 152,-2322 }, { 153,-2322 }, { 154,-2322 }, { 155,-2322 }, { 156,-2322 },
+ { 157,-2322 }, { 158,-2322 }, { 159,-2322 }, { 160,-2322 }, { 161,-2322 },
+ { 162,-2322 }, { 163,-2322 }, { 164,-2322 }, { 165,-2322 }, { 166,-2322 },
+ { 167,-2322 }, { 168,-2322 }, { 169,-2322 }, { 170,-2322 }, { 171,-2322 },
+ { 172,-2322 }, { 173,-2322 }, { 174,-2322 }, { 175,-2322 }, { 176,-2322 },
+ { 177,-2322 }, { 178,-2322 }, { 179,-2322 }, { 180,-2322 }, { 181,-2322 },
+
+ { 182,-2322 }, { 183,-2322 }, { 184,-2322 }, { 185,-2322 }, { 186,-2322 },
+ { 187,-2322 }, { 188,-2322 }, { 189,-2322 }, { 190,-2322 }, { 191,-2322 },
+ { 192,-2322 }, { 193,-2322 }, { 194,-2322 }, { 195,-2322 }, { 196,-2322 },
+ { 197,-2322 }, { 198,-2322 }, { 199,-2322 }, { 200,-2322 }, { 201,-2322 },
+ { 202,-2322 }, { 203,-2322 }, { 204,-2322 }, { 205,-2322 }, { 206,-2322 },
+ { 207,-2322 }, { 208,-2322 }, { 209,-2322 }, { 210,-2322 }, { 211,-2322 },
+ { 212,-2322 }, { 213,-2322 }, { 214,-2322 }, { 215,-2322 }, { 216,-2322 },
+ { 217,-2322 }, { 218,-2322 }, { 219,-2322 }, { 220,-2322 }, { 221,-2322 },
+ { 222,-2322 }, { 223,-2322 }, { 224,-2322 }, { 225,-2322 }, { 226,-2322 },
+ { 227,-2322 }, { 228,-2322 }, { 229,-2322 }, { 230,-2322 }, { 231,-2322 },
+
+ { 232,-2322 }, { 233,-2322 }, { 234,-2322 }, { 235,-2322 }, { 236,-2322 },
+ { 237,-2322 }, { 238,-2322 }, { 239,-2322 }, { 240,-2322 }, { 241,-2322 },
+ { 242,-2322 }, { 243,-2322 }, { 244,-2322 }, { 245,-2322 }, { 246,-2322 },
+ { 247,-2322 }, { 248,-2322 }, { 249,-2322 }, { 250,-2322 }, { 251,-2322 },
+ { 252,-2322 }, { 253,-2322 }, { 254,-2322 }, { 255,-2322 }, { 256,-2322 },
+ {   0,  55 }, {   0,2674 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   9,-3937 }, {  10,-3937 }, {   0,   0 }, {  12,-3937 }, {  13,-3937 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {  32,-3937 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {  39,1900 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {  45,-25685 }, {   0,  55 }, {   0,2627 }, {   1,-2627 },
+ {   2,-2627 }, {   3,-2627 }, {   4,-2627 }, {   5,-2627 }, {   6,-2627 },
+ {   7,-2627 }, {   8,-2627 }, {   9,-2369 }, {  10,-3984 }, {  11,-2627 },
+ {  12,-2369 }, {  13,-3984 }, {  14,-2627 }, {  15,-2627 }, {  16,-2627 },
+ {  17,-2627 }, {  18,-2627 }, {  19,-2627 }, {  20,-2627 }, {  21,-2627 },
+ {  22,-2627 }, {  23,-2627 }, {  24,-2627 }, {  25,-2627 }, {  26,-2627 },
+
+ {  27,-2627 }, {  28,-2627 }, {  29,-2627 }, {  30,-2627 }, {  31,-2627 },
+ {  32,-2369 }, {  33,-2627 }, {  34,-2627 }, {  35,-2627 }, {  36,-2627 },
+ {  37,-2627 }, {  38,-2627 }, {  39,1595 }, {  40,-2627 }, {  41,-2627 },
+ {  42,-2627 }, {  43,-2627 }, {  44,-2627 }, {  45, 258 }, {  46,-2627 },
+ {  47,-2627 }, {  48,-2627 }, {  49,-2627 }, {  50,-2627 }, {  51,-2627 },
+ {  52,-2627 }, {  53,-2627 }, {  54,-2627 }, {  55,-2627 }, {  56,-2627 },
+ {  57,-2627 }, {  58,-2627 }, {  59,-2627 }, {  60,-2627 }, {  61,-2627 },
+ {  62,-2627 }, {  63,-2627 }, {  64,-2627 }, {  65,-2627 }, {  66,-2627 },
+ {  67,-2627 }, {  68,-2627 }, {  69,-2627 }, {  70,-2627 }, {  71,-2627 },
+ {  72,-2627 }, {  73,-2627 }, {  74,-2627 }, {  75,-2627 }, {  76,-2627 },
+
+ {  77,-2627 }, {  78,-2627 }, {  79,-2627 }, {  80,-2627 }, {  81,-2627 },
+ {  82,-2627 }, {  83,-2627 }, {  84,-2627 }, {  85,-2627 }, {  86,-2627 },
+ {  87,-2627 }, {  88,-2627 }, {  89,-2627 }, {  90,-2627 }, {  91,-2627 },
+ {  92,-2627 }, {  93,-2627 }, {  94,-2627 }, {  95,-2627 }, {  96,-2627 },
+ {  97,-2627 }, {  98,-2627 }, {  99,-2627 }, { 100,-2627 }, { 101,-2627 },
+ { 102,-2627 }, { 103,-2627 }, { 104,-2627 }, { 105,-2627 }, { 106,-2627 },
+ { 107,-2627 }, { 108,-2627 }, { 109,-2627 }, { 110,-2627 }, { 111,-2627 },
+ { 112,-2627 }, { 113,-2627 }, { 114,-2627 }, { 115,-2627 }, { 116,-2627 },
+ { 117,-2627 }, { 118,-2627 }, { 119,-2627 }, { 120,-2627 }, { 121,-2627 },
+ { 122,-2627 }, { 123,-2627 }, { 124,-2627 }, { 125,-2627 }, { 126,-2627 },
+
+ { 127,-2627 }, { 128,-2627 }, { 129,-2627 }, { 130,-2627 }, { 131,-2627 },
+ { 132,-2627 }, { 133,-2627 }, { 134,-2627 }, { 135,-2627 }, { 136,-2627 },
+ { 137,-2627 }, { 138,-2627 }, { 139,-2627 }, { 140,-2627 }, { 141,-2627 },
+ { 142,-2627 }, { 143,-2627 }, { 144,-2627 }, { 145,-2627 }, { 146,-2627 },
+ { 147,-2627 }, { 148,-2627 }, { 149,-2627 }, { 150,-2627 }, { 151,-2627 },
+ { 152,-2627 }, { 153,-2627 }, { 154,-2627 }, { 155,-2627 }, { 156,-2627 },
+ { 157,-2627 }, { 158,-2627 }, { 159,-2627 }, { 160,-2627 }, { 161,-2627 },
+ { 162,-2627 }, { 163,-2627 }, { 164,-2627 }, { 165,-2627 }, { 166,-2627 },
+ { 167,-2627 }, { 168,-2627 }, { 169,-2627 }, { 170,-2627 }, { 171,-2627 },
+ { 172,-2627 }, { 173,-2627 }, { 174,-2627 }, { 175,-2627 }, { 176,-2627 },
+
+ { 177,-2627 }, { 178,-2627 }, { 179,-2627 }, { 180,-2627 }, { 181,-2627 },
+ { 182,-2627 }, { 183,-2627 }, { 184,-2627 }, { 185,-2627 }, { 186,-2627 },
+ { 187,-2627 }, { 188,-2627 }, { 189,-2627 }, { 190,-2627 }, { 191,-2627 },
+ { 192,-2627 }, { 193,-2627 }, { 194,-2627 }, { 195,-2627 }, { 196,-2627 },
+ { 197,-2627 }, { 198,-2627 }, { 199,-2627 }, { 200,-2627 }, { 201,-2627 },
+ { 202,-2627 }, { 203,-2627 }, { 204,-2627 }, { 205,-2627 }, { 206,-2627 },
+ { 207,-2627 }, { 208,-2627 }, { 209,-2627 }, { 210,-2627 }, { 211,-2627 },
+ { 212,-2627 }, { 213,-2627 }, { 214,-2627 }, { 215,-2627 }, { 216,-2627 },
+ { 217,-2627 }, { 218,-2627 }, { 219,-2627 }, { 220,-2627 }, { 221,-2627 },
+ { 222,-2627 }, { 223,-2627 }, { 224,-2627 }, { 225,-2627 }, { 226,-2627 },
+
+ { 227,-2627 }, { 228,-2627 }, { 229,-2627 }, { 230,-2627 }, { 231,-2627 },
+ { 232,-2627 }, { 233,-2627 }, { 234,-2627 }, { 235,-2627 }, { 236,-2627 },
+ { 237,-2627 }, { 238,-2627 }, { 239,-2627 }, { 240,-2627 }, { 241,-2627 },
+ { 242,-2627 }, { 243,-2627 }, { 244,-2627 }, { 245,-2627 }, { 246,-2627 },
+ { 247,-2627 }, { 248,-2627 }, { 249,-2627 }, { 250,-2627 }, { 251,-2627 },
+ { 252,-2627 }, { 253,-2627 }, { 254,-2627 }, { 255,-2627 }, { 256,-2627 },
+ {   0,  55 }, {   0,2369 }, {   1,-2885 }, {   2,-2885 }, {   3,-2885 },
+ {   4,-2885 }, {   5,-2885 }, {   6,-2885 }, {   7,-2885 }, {   8,-2885 },
+ {   9,-2627 }, {  10,-4242 }, {  11,-2885 }, {  12,-2627 }, {  13,-4242 },
+ {  14,-2885 }, {  15,-2885 }, {  16,-2885 }, {  17,-2885 }, {  18,-2885 },
+
+ {  19,-2885 }, {  20,-2885 }, {  21,-2885 }, {  22,-2885 }, {  23,-2885 },
+ {  24,-2885 }, {  25,-2885 }, {  26,-2885 }, {  27,-2885 }, {  28,-2885 },
+ {  29,-2885 }, {  30,-2885 }, {  31,-2885 }, {  32,-2627 }, {  33,-2885 },
+ {  34,-2885 }, {  35,-2885 }, {  36,-2885 }, {  37,-2885 }, {  38,-2885 },
+ {  39,-2369 }, {  40,-2885 }, {  41,-2885 }, {  42,-2885 }, {  43,-2885 },
+ {  44,-2885 }, {  45,   0 }, {  46,-2885 }, {  47,-2885 }, {  48,-2885 },
+ {  49,-2885 }, {  50,-2885 }, {  51,-2885 }, {  52,-2885 }, {  53,-2885 },
+ {  54,-2885 }, {  55,-2885 }, {  56,-2885 }, {  57,-2885 }, {  58,-2885 },
+ {  59,-2885 }, {  60,-2885 }, {  61,-2885 }, {  62,-2885 }, {  63,-2885 },
+ {  64,-2885 }, {  65,-2885 }, {  66,-2885 }, {  67,-2885 }, {  68,-2885 },
+
+ {  69,-2885 }, {  70,-2885 }, {  71,-2885 }, {  72,-2885 }, {  73,-2885 },
+ {  74,-2885 }, {  75,-2885 }, {  76,-2885 }, {  77,-2885 }, {  78,-2885 },
+ {  79,-2885 }, {  80,-2885 }, {  81,-2885 }, {  82,-2885 }, {  83,-2885 },
+ {  84,-2885 }, {  85,-2885 }, {  86,-2885 }, {  87,-2885 }, {  88,-2885 },
+ {  89,-2885 }, {  90,-2885 }, {  91,-2885 }, {  92,-2885 }, {  93,-2885 },
+ {  94,-2885 }, {  95,-2885 }, {  96,-2885 }, {  97,-2885 }, {  98,-2885 },
+ {  99,-2885 }, { 100,-2885 }, { 101,-2885 }, { 102,-2885 }, { 103,-2885 },
+ { 104,-2885 }, { 105,-2885 }, { 106,-2885 }, { 107,-2885 }, { 108,-2885 },
+ { 109,-2885 }, { 110,-2885 }, { 111,-2885 }, { 112,-2885 }, { 113,-2885 },
+ { 114,-2885 }, { 115,-2885 }, { 116,-2885 }, { 117,-2885 }, { 118,-2885 },
+
+ { 119,-2885 }, { 120,-2885 }, { 121,-2885 }, { 122,-2885 }, { 123,-2885 },
+ { 124,-2885 }, { 125,-2885 }, { 126,-2885 }, { 127,-2885 }, { 128,-2885 },
+ { 129,-2885 }, { 130,-2885 }, { 131,-2885 }, { 132,-2885 }, { 133,-2885 },
+ { 134,-2885 }, { 135,-2885 }, { 136,-2885 }, { 137,-2885 }, { 138,-2885 },
+ { 139,-2885 }, { 140,-2885 }, { 141,-2885 }, { 142,-2885 }, { 143,-2885 },
+ { 144,-2885 }, { 145,-2885 }, { 146,-2885 }, { 147,-2885 }, { 148,-2885 },
+ { 149,-2885 }, { 150,-2885 }, { 151,-2885 }, { 152,-2885 }, { 153,-2885 },
+ { 154,-2885 }, { 155,-2885 }, { 156,-2885 }, { 157,-2885 }, { 158,-2885 },
+ { 159,-2885 }, { 160,-2885 }, { 161,-2885 }, { 162,-2885 }, { 163,-2885 },
+ { 164,-2885 }, { 165,-2885 }, { 166,-2885 }, { 167,-2885 }, { 168,-2885 },
+
+ { 169,-2885 }, { 170,-2885 }, { 171,-2885 }, { 172,-2885 }, { 173,-2885 },
+ { 174,-2885 }, { 175,-2885 }, { 176,-2885 }, { 177,-2885 }, { 178,-2885 },
+ { 179,-2885 }, { 180,-2885 }, { 181,-2885 }, { 182,-2885 }, { 183,-2885 },
+ { 184,-2885 }, { 185,-2885 }, { 186,-2885 }, { 187,-2885 }, { 188,-2885 },
+ { 189,-2885 }, { 190,-2885 }, { 191,-2885 }, { 192,-2885 }, { 193,-2885 },
+ { 194,-2885 }, { 195,-2885 }, { 196,-2885 }, { 197,-2885 }, { 198,-2885 },
+ { 199,-2885 }, { 200,-2885 }, { 201,-2885 }, { 202,-2885 }, { 203,-2885 },
+ { 204,-2885 }, { 205,-2885 }, { 206,-2885 }, { 207,-2885 }, { 208,-2885 },
+ { 209,-2885 }, { 210,-2885 }, { 211,-2885 }, { 212,-2885 }, { 213,-2885 },
+ { 214,-2885 }, { 215,-2885 }, { 216,-2885 }, { 217,-2885 }, { 218,-2885 },
+
+ { 219,-2885 }, { 220,-2885 }, { 221,-2885 }, { 222,-2885 }, { 223,-2885 },
+ { 224,-2885 }, { 225,-2885 }, { 226,-2885 }, { 227,-2885 }, { 228,-2885 },
+ { 229,-2885 }, { 230,-2885 }, { 231,-2885 }, { 232,-2885 }, { 233,-2885 },
+ { 234,-2885 }, { 235,-2885 }, { 236,-2885 }, { 237,-2885 }, { 238,-2885 },
+ { 239,-2885 }, { 240,-2885 }, { 241,-2885 }, { 242,-2885 }, { 243,-2885 },
+ { 244,-2885 }, { 245,-2885 }, { 246,-2885 }, { 247,-2885 }, { 248,-2885 },
+ { 249,-2885 }, { 250,-2885 }, { 251,-2885 }, { 252,-2885 }, { 253,-2885 },
+ { 254,-2885 }, { 255,-2885 }, { 256,-2885 }, {   0,  28 }, {   0,2111 },
+ {   1,-2111 }, {   2,-2111 }, {   3,-2111 }, {   4,-2111 }, {   5,-2111 },
+ {   6,-2111 }, {   7,-2111 }, {   8,-2111 }, {   9,-1853 }, {  10,-4195 },
+
+ {  11,-2111 }, {  12,-1853 }, {  13,-4195 }, {  14,-2111 }, {  15,-2111 },
+ {  16,-2111 }, {  17,-2111 }, {  18,-2111 }, {  19,-2111 }, {  20,-2111 },
+ {  21,-2111 }, {  22,-2111 }, {  23,-2111 }, {  24,-2111 }, {  25,-2111 },
+ {  26,-2111 }, {  27,-2111 }, {  28,-2111 }, {  29,-2111 }, {  30,-2111 },
+ {  31,-2111 }, {  32,-1853 }, {  33,-2111 }, {  34,-2111 }, {  35,-2111 },
+ {  36,-2111 }, {  37,-2111 }, {  38,-2111 }, {  39,1595 }, {  40,-2111 },
+ {  41,-2111 }, {  42,-2111 }, {  43,-2111 }, {  44,-2111 }, {  45,-1337 },
+ {  46,-2111 }, {  47,-2111 }, {  48,-2111 }, {  49,-2111 }, {  50,-2111 },
+ {  51,-2111 }, {  52,-2111 }, {  53,-2111 }, {  54,-2111 }, {  55,-2111 },
+ {  56,-2111 }, {  57,-2111 }, {  58,-2111 }, {  59,-2111 }, {  60,-2111 },
+
+ {  61,-2111 }, {  62,-2111 }, {  63,-2111 }, {  64,-2111 }, {  65,-2111 },
+ {  66,-2111 }, {  67,-2111 }, {  68,-2111 }, {  69,-2111 }, {  70,-2111 },
+ {  71,-2111 }, {  72,-2111 }, {  73,-2111 }, {  74,-2111 }, {  75,-2111 },
+ {  76,-2111 }, {  77,-2111 }, {  78,-2111 }, {  79,-2111 }, {  80,-2111 },
+ {  81,-2111 }, {  82,-2111 }, {  83,-2111 }, {  84,-2111 }, {  85,-2111 },
+ {  86,-2111 }, {  87,-2111 }, {  88,-2111 }, {  89,-2111 }, {  90,-2111 },
+ {  91,-2111 }, {  92,-2111 }, {  93,-2111 }, {  94,-2111 }, {  95,-2111 },
+ {  96,-2111 }, {  97,-2111 }, {  98,-2111 }, {  99,-2111 }, { 100,-2111 },
+ { 101,-2111 }, { 102,-2111 }, { 103,-2111 }, { 104,-2111 }, { 105,-2111 },
+ { 106,-2111 }, { 107,-2111 }, { 108,-2111 }, { 109,-2111 }, { 110,-2111 },
+
+ { 111,-2111 }, { 112,-2111 }, { 113,-2111 }, { 114,-2111 }, { 115,-2111 },
+ { 116,-2111 }, { 117,-2111 }, { 118,-2111 }, { 119,-2111 }, { 120,-2111 },
+ { 121,-2111 }, { 122,-2111 }, { 123,-2111 }, { 124,-2111 }, { 125,-2111 },
+ { 126,-2111 }, { 127,-2111 }, { 128,-2111 }, { 129,-2111 }, { 130,-2111 },
+ { 131,-2111 }, { 132,-2111 }, { 133,-2111 }, { 134,-2111 }, { 135,-2111 },
+ { 136,-2111 }, { 137,-2111 }, { 138,-2111 }, { 139,-2111 }, { 140,-2111 },
+ { 141,-2111 }, { 142,-2111 }, { 143,-2111 }, { 144,-2111 }, { 145,-2111 },
+ { 146,-2111 }, { 147,-2111 }, { 148,-2111 }, { 149,-2111 }, { 150,-2111 },
+ { 151,-2111 }, { 152,-2111 }, { 153,-2111 }, { 154,-2111 }, { 155,-2111 },
+ { 156,-2111 }, { 157,-2111 }, { 158,-2111 }, { 159,-2111 }, { 160,-2111 },
+
+ { 161,-2111 }, { 162,-2111 }, { 163,-2111 }, { 164,-2111 }, { 165,-2111 },
+ { 166,-2111 }, { 167,-2111 }, { 168,-2111 }, { 169,-2111 }, { 170,-2111 },
+ { 171,-2111 }, { 172,-2111 }, { 173,-2111 }, { 174,-2111 }, { 175,-2111 },
+ { 176,-2111 }, { 177,-2111 }, { 178,-2111 }, { 179,-2111 }, { 180,-2111 },
+ { 181,-2111 }, { 182,-2111 }, { 183,-2111 }, { 184,-2111 }, { 185,-2111 },
+ { 186,-2111 }, { 187,-2111 }, { 188,-2111 }, { 189,-2111 }, { 190,-2111 },
+ { 191,-2111 }, { 192,-2111 }, { 193,-2111 }, { 194,-2111 }, { 195,-2111 },
+ { 196,-2111 }, { 197,-2111 }, { 198,-2111 }, { 199,-2111 }, { 200,-2111 },
+ { 201,-2111 }, { 202,-2111 }, { 203,-2111 }, { 204,-2111 }, { 205,-2111 },
+ { 206,-2111 }, { 207,-2111 }, { 208,-2111 }, { 209,-2111 }, { 210,-2111 },
+
+ { 211,-2111 }, { 212,-2111 }, { 213,-2111 }, { 214,-2111 }, { 215,-2111 },
+ { 216,-2111 }, { 217,-2111 }, { 218,-2111 }, { 219,-2111 }, { 220,-2111 },
+ { 221,-2111 }, { 222,-2111 }, { 223,-2111 }, { 224,-2111 }, { 225,-2111 },
+ { 226,-2111 }, { 227,-2111 }, { 228,-2111 }, { 229,-2111 }, { 230,-2111 },
+ { 231,-2111 }, { 232,-2111 }, { 233,-2111 }, { 234,-2111 }, { 235,-2111 },
+ { 236,-2111 }, { 237,-2111 }, { 238,-2111 }, { 239,-2111 }, { 240,-2111 },
+ { 241,-2111 }, { 242,-2111 }, { 243,-2111 }, { 244,-2111 }, { 245,-2111 },
+ { 246,-2111 }, { 247,-2111 }, { 248,-2111 }, { 249,-2111 }, { 250,-2111 },
+ { 251,-2111 }, { 252,-2111 }, { 253,-2111 }, { 254,-2111 }, { 255,-2111 },
+ { 256,-2111 }, {   0,  28 }, {   0,1853 }, {   1,-2369 }, {   2,-2369 },
+
+ {   3,-2369 }, {   4,-2369 }, {   5,-2369 }, {   6,-2369 }, {   7,-2369 },
+ {   8,-2369 }, {   9,-2111 }, {  10,-4453 }, {  11,-2369 }, {  12,-2111 },
+ {  13,-4453 }, {  14,-2369 }, {  15,-2369 }, {  16,-2369 }, {  17,-2369 },
+ {  18,-2369 }, {  19,-2369 }, {  20,-2369 }, {  21,-2369 }, {  22,-2369 },
+ {  23,-2369 }, {  24,-2369 }, {  25,-2369 }, {  26,-2369 }, {  27,-2369 },
+ {  28,-2369 }, {  29,-2369 }, {  30,-2369 }, {  31,-2369 }, {  32,-2111 },
+ {  33,-2369 }, {  34,-2369 }, {  35,-2369 }, {  36,-2369 }, {  37,-2369 },
+ {  38,-2369 }, {  39,1337 }, {  40,-2369 }, {  41,-2369 }, {  42,-2369 },
+ {  43,-2369 }, {  44,-2369 }, {  45,-1595 }, {  46,-2369 }, {  47,-2369 },
+ {  48,-2369 }, {  49,-2369 }, {  50,-2369 }, {  51,-2369 }, {  52,-2369 },
+
+ {  53,-2369 }, {  54,-2369 }, {  55,-2369 }, {  56,-2369 }, {  57,-2369 },
+ {  58,-2369 }, {  59,-2369 }, {  60,-2369 }, {  61,-2369 }, {  62,-2369 },
+ {  63,-2369 }, {  64,-2369 }, {  65,-2369 }, {  66,-2369 }, {  67,-2369 },
+ {  68,-2369 }, {  69,-2369 }, {  70,-2369 }, {  71,-2369 }, {  72,-2369 },
+ {  73,-2369 }, {  74,-2369 }, {  75,-2369 }, {  76,-2369 }, {  77,-2369 },
+ {  78,-2369 }, {  79,-2369 }, {  80,-2369 }, {  81,-2369 }, {  82,-2369 },
+ {  83,-2369 }, {  84,-2369 }, {  85,-2369 }, {  86,-2369 }, {  87,-2369 },
+ {  88,-2369 }, {  89,-2369 }, {  90,-2369 }, {  91,-2369 }, {  92,-2369 },
+ {  93,-2369 }, {  94,-2369 }, {  95,-2369 }, {  96,-2369 }, {  97,-2369 },
+ {  98,-2369 }, {  99,-2369 }, { 100,-2369 }, { 101,-2369 }, { 102,-2369 },
+
+ { 103,-2369 }, { 104,-2369 }, { 105,-2369 }, { 106,-2369 }, { 107,-2369 },
+ { 108,-2369 }, { 109,-2369 }, { 110,-2369 }, { 111,-2369 }, { 112,-2369 },
+ { 113,-2369 }, { 114,-2369 }, { 115,-2369 }, { 116,-2369 }, { 117,-2369 },
+ { 118,-2369 }, { 119,-2369 }, { 120,-2369 }, { 121,-2369 }, { 122,-2369 },
+ { 123,-2369 }, { 124,-2369 }, { 125,-2369 }, { 126,-2369 }, { 127,-2369 },
+ { 128,-2369 }, { 129,-2369 }, { 130,-2369 }, { 131,-2369 }, { 132,-2369 },
+ { 133,-2369 }, { 134,-2369 }, { 135,-2369 }, { 136,-2369 }, { 137,-2369 },
+ { 138,-2369 }, { 139,-2369 }, { 140,-2369 }, { 141,-2369 }, { 142,-2369 },
+ { 143,-2369 }, { 144,-2369 }, { 145,-2369 }, { 146,-2369 }, { 147,-2369 },
+ { 148,-2369 }, { 149,-2369 }, { 150,-2369 }, { 151,-2369 }, { 152,-2369 },
+
+ { 153,-2369 }, { 154,-2369 }, { 155,-2369 }, { 156,-2369 }, { 157,-2369 },
+ { 158,-2369 }, { 159,-2369 }, { 160,-2369 }, { 161,-2369 }, { 162,-2369 },
+ { 163,-2369 }, { 164,-2369 }, { 165,-2369 }, { 166,-2369 }, { 167,-2369 },
+ { 168,-2369 }, { 169,-2369 }, { 170,-2369 }, { 171,-2369 }, { 172,-2369 },
+ { 173,-2369 }, { 174,-2369 }, { 175,-2369 }, { 176,-2369 }, { 177,-2369 },
+ { 178,-2369 }, { 179,-2369 }, { 180,-2369 }, { 181,-2369 }, { 182,-2369 },
+ { 183,-2369 }, { 184,-2369 }, { 185,-2369 }, { 186,-2369 }, { 187,-2369 },
+ { 188,-2369 }, { 189,-2369 }, { 190,-2369 }, { 191,-2369 }, { 192,-2369 },
+ { 193,-2369 }, { 194,-2369 }, { 195,-2369 }, { 196,-2369 }, { 197,-2369 },
+ { 198,-2369 }, { 199,-2369 }, { 200,-2369 }, { 201,-2369 }, { 202,-2369 },
+
+ { 203,-2369 }, { 204,-2369 }, { 205,-2369 }, { 206,-2369 }, { 207,-2369 },
+ { 208,-2369 }, { 209,-2369 }, { 210,-2369 }, { 211,-2369 }, { 212,-2369 },
+ { 213,-2369 }, { 214,-2369 }, { 215,-2369 }, { 216,-2369 }, { 217,-2369 },
+ { 218,-2369 }, { 219,-2369 }, { 220,-2369 }, { 221,-2369 }, { 222,-2369 },
+ { 223,-2369 }, { 224,-2369 }, { 225,-2369 }, { 226,-2369 }, { 227,-2369 },
+ { 228,-2369 }, { 229,-2369 }, { 230,-2369 }, { 231,-2369 }, { 232,-2369 },
+ { 233,-2369 }, { 234,-2369 }, { 235,-2369 }, { 236,-2369 }, { 237,-2369 },
+ { 238,-2369 }, { 239,-2369 }, { 240,-2369 }, { 241,-2369 }, { 242,-2369 },
+ { 243,-2369 }, { 244,-2369 }, { 245,-2369 }, { 246,-2369 }, { 247,-2369 },
+ { 248,-2369 }, { 249,-2369 }, { 250,-2369 }, { 251,-2369 }, { 252,-2369 },
+
+ { 253,-2369 }, { 254,-2369 }, { 255,-2369 }, { 256,-2369 }, {   0,  28 },
+ {   0,1595 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   9,-4711 },
+ {  10,-4711 }, {   0,   0 }, {  12,-4711 }, {  13,-4711 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {  32,-4711 }, {   0,   0 }, {   0,   0 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {  39,1337 },
+ {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 }, {   0,   0 },
+
+ {  45,-26753 }, {   0,  28 }, {   0,1548 }, {   1,-2674 }, {   2,-2674 },
+ {   3,-2674 }, {   4,-2674 }, {   5,-2674 }, {   6,-2674 }, {   7,-2674 },
+ {   8,-2674 }, {   9,-2416 }, {  10,-4758 }, {  11,-2674 }, {  12,-2416 },
+ {  13,-4758 }, {  14,-2674 }, {  15,-2674 }, {  16,-2674 }, {  17,-2674 },
+ {  18,-2674 }, {  19,-2674 }, {  20,-2674 }, {  21,-2674 }, {  22,-2674 },
+ {  23,-2674 }, {  24,-2674 }, {  25,-2674 }, {  26,-2674 }, {  27,-2674 },
+ {  28,-2674 }, {  29,-2674 }, {  30,-2674 }, {  31,-2674 }, {  32,-2416 },
+ {  33,-2674 }, {  34,-2674 }, {  35,-2674 }, {  36,-2674 }, {  37,-2674 },
+ {  38,-2674 }, {  39,1032 }, {  40,-2674 }, {  41,-2674 }, {  42,-2674 },
+ {  43,-2674 }, {  44,-2674 }, {  45, 258 }, {  46,-2674 }, {  47,-2674 },
+
+ {  48,-2674 }, {  49,-2674 }, {  50,-2674 }, {  51,-2674 }, {  52,-2674 },
+ {  53,-2674 }, {  54,-2674 }, {  55,-2674 }, {  56,-2674 }, {  57,-2674 },
+ {  58,-2674 }, {  59,-2674 }, {  60,-2674 }, {  61,-2674 }, {  62,-2674 },
+ {  63,-2674 }, {  64,-2674 }, {  65,-2674 }, {  66,-2674 }, {  67,-2674 },
+ {  68,-2674 }, {  69,-2674 }, {  70,-2674 }, {  71,-2674 }, {  72,-2674 },
+ {  73,-2674 }, {  74,-2674 }, {  75,-2674 }, {  76,-2674 }, {  77,-2674 },
+ {  78,-2674 }, {  79,-2674 }, {  80,-2674 }, {  81,-2674 }, {  82,-2674 },
+ {  83,-2674 }, {  84,-2674 }, {  85,-2674 }, {  86,-2674 }, {  87,-2674 },
+ {  88,-2674 }, {  89,-2674 }, {  90,-2674 }, {  91,-2674 }, {  92,-2674 },
+ {  93,-2674 }, {  94,-2674 }, {  95,-2674 }, {  96,-2674 }, {  97,-2674 },
+
+ {  98,-2674 }, {  99,-2674 }, { 100,-2674 }, { 101,-2674 }, { 102,-2674 },
+ { 103,-2674 }, { 104,-2674 }, { 105,-2674 }, { 106,-2674 }, { 107,-2674 },
+ { 108,-2674 }, { 109,-2674 }, { 110,-2674 }, { 111,-2674 }, { 112,-2674 },
+ { 113,-2674 }, { 114,-2674 }, { 115,-2674 }, { 116,-2674 }, { 117,-2674 },
+ { 118,-2674 }, { 119,-2674 }, { 120,-2674 }, { 121,-2674 }, { 122,-2674 },
+ { 123,-2674 }, { 124,-2674 }, { 125,-2674 }, { 126,-2674 }, { 127,-2674 },
+ { 128,-2674 }, { 129,-2674 }, { 130,-2674 }, { 131,-2674 }, { 132,-2674 },
+ { 133,-2674 }, { 134,-2674 }, { 135,-2674 }, { 136,-2674 }, { 137,-2674 },
+ { 138,-2674 }, { 139,-2674 }, { 140,-2674 }, { 141,-2674 }, { 142,-2674 },
+ { 143,-2674 }, { 144,-2674 }, { 145,-2674 }, { 146,-2674 }, { 147,-2674 },
+
+ { 148,-2674 }, { 149,-2674 }, { 150,-2674 }, { 151,-2674 }, { 152,-2674 },
+ { 153,-2674 }, { 154,-2674 }, { 155,-2674 }, { 156,-2674 }, { 157,-2674 },
+ { 158,-2674 }, { 159,-2674 }, { 160,-2674 }, { 161,-2674 }, { 162,-2674 },
+ { 163,-2674 }, { 164,-2674 }, { 165,-2674 }, { 166,-2674 }, { 167,-2674 },
+ { 168,-2674 }, { 169,-2674 }, { 170,-2674 }, { 171,-2674 }, { 172,-2674 },
+ { 173,-2674 }, { 174,-2674 }, { 175,-2674 }, { 176,-2674 }, { 177,-2674 },
+ { 178,-2674 }, { 179,-2674 }, { 180,-2674 }, { 181,-2674 }, { 182,-2674 },
+ { 183,-2674 }, { 184,-2674 }, { 185,-2674 }, { 186,-2674 }, { 187,-2674 },
+ { 188,-2674 }, { 189,-2674 }, { 190,-2674 }, { 191,-2674 }, { 192,-2674 },
+ { 193,-2674 }, { 194,-2674 }, { 195,-2674 }, { 196,-2674 }, { 197,-2674 },
+
+ { 198,-2674 }, { 199,-2674 }, { 200,-2674 }, { 201,-2674 }, { 202,-2674 },
+ { 203,-2674 }, { 204,-2674 }, { 205,-2674 }, { 206,-2674 }, { 207,-2674 },
+ { 208,-2674 }, { 209,-2674 }, { 210,-2674 }, { 211,-2674 }, { 212,-2674 },
+ { 213,-2674 }, { 214,-2674 }, { 215,-2674 }, { 216,-2674 }, { 217,-2674 },
+ { 218,-2674 }, { 219,-2674 }, { 220,-2674 }, { 221,-2674 }, { 222,-2674 },
+ { 223,-2674 }, { 224,-2674 }, { 225,-2674 }, { 226,-2674 }, { 227,-2674 },
+ { 228,-2674 }, { 229,-2674 }, { 230,-2674 }, { 231,-2674 }, { 232,-2674 },
+ { 233,-2674 }, { 234,-2674 }, { 235,-2674 }, { 236,-2674 }, { 237,-2674 },
+ { 238,-2674 }, { 239,-2674 }, { 240,-2674 }, { 241,-2674 }, { 242,-2674 },
+ { 243,-2674 }, { 244,-2674 }, { 245,-2674 }, { 246,-2674 }, { 247,-2674 },
+
+ { 248,-2674 }, { 249,-2674 }, { 250,-2674 }, { 251,-2674 }, { 252,-2674 },
+ { 253,-2674 }, { 254,-2674 }, { 255,-2674 }, { 256,-2674 }, {   0,  28 },
+ {   0,1290 }, {   1,-2932 }, {   2,-2932 }, {   3,-2932 }, {   4,-2932 },
+ {   5,-2932 }, {   6,-2932 }, {   7,-2932 }, {   8,-2932 }, {   9,-2674 },
+ {  10,-5016 }, {  11,-2932 }, {  12,-2674 }, {  13,-5016 }, {  14,-2932 },
+ {  15,-2932 }, {  16,-2932 }, {  17,-2932 }, {  18,-2932 }, {  19,-2932 },
+ {  20,-2932 }, {  21,-2932 }, {  22,-2932 }, {  23,-2932 }, {  24,-2932 },
+ {  25,-2932 }, {  26,-2932 }, {  27,-2932 }, {  28,-2932 }, {  29,-2932 },
+ {  30,-2932 }, {  31,-2932 }, {  32,-2674 }, {  33,-2932 }, {  34,-2932 },
+ {  35,-2932 }, {  36,-2932 }, {  37,-2932 }, {  38,-2932 }, {  39,-2416 },
+
+ {  40,-2932 }, {  41,-2932 }, {  42,-2932 }, {  43,-2932 }, {  44,-2932 },
+ {  45,   0 }, {  46,-2932 }, {  47,-2932 }, {  48,-2932 }, {  49,-2932 },
+ {  50,-2932 }, {  51,-2932 }, {  52,-2932 }, {  53,-2932 }, {  54,-2932 },
+ {  55,-2932 }, {  56,-2932 }, {  57,-2932 }, {  58,-2932 }, {  59,-2932 },
+ {  60,-2932 }, {  61,-2932 }, {  62,-2932 }, {  63,-2932 }, {  64,-2932 },
+ {  65,-2932 }, {  66,-2932 }, {  67,-2932 }, {  68,-2932 }, {  69,-2932 },
+ {  70,-2932 }, {  71,-2932 }, {  72,-2932 }, {  73,-2932 }, {  74,-2932 },
+ {  75,-2932 }, {  76,-2932 }, {  77,-2932 }, {  78,-2932 }, {  79,-2932 },
+ {  80,-2932 }, {  81,-2932 }, {  82,-2932 }, {  83,-2932 }, {  84,-2932 },
+ {  85,-2932 }, {  86,-2932 }, {  87,-2932 }, {  88,-2932 }, {  89,-2932 },
+
+ {  90,-2932 }, {  91,-2932 }, {  92,-2932 }, {  93,-2932 }, {  94,-2932 },
+ {  95,-2932 }, {  96,-2932 }, {  97,-2932 }, {  98,-2932 }, {  99,-2932 },
+ { 100,-2932 }, { 101,-2932 }, { 102,-2932 }, { 103,-2932 }, { 104,-2932 },
+ { 105,-2932 }, { 106,-2932 }, { 107,-2932 }, { 108,-2932 }, { 109,-2932 },
+ { 110,-2932 }, { 111,-2932 }, { 112,-2932 }, { 113,-2932 }, { 114,-2932 },
+ { 115,-2932 }, { 116,-2932 }, { 117,-2932 }, { 118,-2932 }, { 119,-2932 },
+ { 120,-2932 }, { 121,-2932 }, { 122,-2932 }, { 123,-2932 }, { 124,-2932 },
+ { 125,-2932 }, { 126,-2932 }, { 127,-2932 }, { 128,-2932 }, { 129,-2932 },
+ { 130,-2932 }, { 131,-2932 }, { 132,-2932 }, { 133,-2932 }, { 134,-2932 },
+ { 135,-2932 }, { 136,-2932 }, { 137,-2932 }, { 138,-2932 }, { 139,-2932 },
+
+ { 140,-2932 }, { 141,-2932 }, { 142,-2932 }, { 143,-2932 }, { 144,-2932 },
+ { 145,-2932 }, { 146,-2932 }, { 147,-2932 }, { 148,-2932 }, { 149,-2932 },
+ { 150,-2932 }, { 151,-2932 }, { 152,-2932 }, { 153,-2932 }, { 154,-2932 },
+ { 155,-2932 }, { 156,-2932 }, { 157,-2932 }, { 158,-2932 }, { 159,-2932 },
+ { 160,-2932 }, { 161,-2932 }, { 162,-2932 }, { 163,-2932 }, { 164,-2932 },
+ { 165,-2932 }, { 166,-2932 }, { 167,-2932 }, { 168,-2932 }, { 169,-2932 },
+ { 170,-2932 }, { 171,-2932 }, { 172,-2932 }, { 173,-2932 }, { 174,-2932 },
+ { 175,-2932 }, { 176,-2932 }, { 177,-2932 }, { 178,-2932 }, { 179,-2932 },
+ { 180,-2932 }, { 181,-2932 }, { 182,-2932 }, { 183,-2932 }, { 184,-2932 },
+ { 185,-2932 }, { 186,-2932 }, { 187,-2932 }, { 188,-2932 }, { 189,-2932 },
+
+ { 190,-2932 }, { 191,-2932 }, { 192,-2932 }, { 193,-2932 }, { 194,-2932 },
+ { 195,-2932 }, { 196,-2932 }, { 197,-2932 }, { 198,-2932 }, { 199,-2932 },
+ { 200,-2932 }, { 201,-2932 }, { 202,-2932 }, { 203,-2932 }, { 204,-2932 },
+ { 205,-2932 }, { 206,-2932 }, { 207,-2932 }, { 208,-2932 }, { 209,-2932 },
+ { 210,-2932 }, { 211,-2932 }, { 212,-2932 }, { 213,-2932 }, { 214,-2932 },
+ { 215,-2932 }, { 216,-2932 }, { 217,-2932 }, { 218,-2932 }, { 219,-2932 },
+ { 220,-2932 }, { 221,-2932 }, { 222,-2932 }, { 223,-2932 }, { 224,-2932 },
+ { 225,-2932 }, { 226,-2932 }, { 227,-2932 }, { 228,-2932 }, { 229,-2932 },
+ { 230,-2932 }, { 231,-2932 }, { 232,-2932 }, { 233,-2932 }, { 234,-2932 },
+ { 235,-2932 }, { 236,-2932 }, { 237,-2932 }, { 238,-2932 }, { 239,-2932 },
+
+ { 240,-2932 }, { 241,-2932 }, { 242,-2932 }, { 243,-2932 }, { 244,-2932 },
+ { 245,-2932 }, { 246,-2932 }, { 247,-2932 }, { 248,-2932 }, { 249,-2932 },
+ { 250,-2932 }, { 251,-2932 }, { 252,-2932 }, { 253,-2932 }, { 254,-2932 },
+ { 255,-2932 }, { 256,-2932 }, {   0,  55 }, {   0,1032 }, {   1,-2158 },
+ {   2,-2158 }, {   3,-2158 }, {   4,-2158 }, {   5,-2158 }, {   6,-2158 },
+ {   7,-2158 }, {   8,-2158 }, {   9,-1900 }, {  10,-1642 }, {  11,-2158 },
+ {  12,-1900 }, {  13,-1642 }, {  14,-2158 }, {  15,-2158 }, {  16,-2158 },
+ {  17,-2158 }, {  18,-2158 }, {  19,-2158 }, {  20,-2158 }, {  21,-2158 },
+ {  22,-2158 }, {  23,-2158 }, {  24,-2158 }, {  25,-2158 }, {  26,-2158 },
+ {  27,-2158 }, {  28,-2158 }, {  29,-2158 }, {  30,-2158 }, {  31,-2158 },
+
+ {  32,-1900 }, {  33,-2158 }, {  34,-2158 }, {  35,-2158 }, {  36,-2158 },
+ {  37,-2158 }, {  38,-2158 }, {  39,-3706 }, {  40,-2158 }, {  41,-2158 },
+ {  42,-2158 }, {  43,-2158 }, {  44,-2158 }, {  45,-1595 }, {  46,-2158 },
+ {  47,-2158 }, {  48,-2158 }, {  49,-2158 }, {  50,-2158 }, {  51,-2158 },
+ {  52,-2158 }, {  53,-2158 }, {  54,-2158 }, {  55,-2158 }, {  56,-2158 },
+ {  57,-2158 }, {  58,-2158 }, {  59,-2158 }, {  60,-2158 }, {  61,-2158 },
+ {  62,-2158 }, {  63,-2158 }, {  64,-2158 }, {  65,-2158 }, {  66,-2158 },
+ {  67,-2158 }, {  68,-2158 }, {  69,-2158 }, {  70,-2158 }, {  71,-2158 },
+ {  72,-2158 }, {  73,-2158 }, {  74,-2158 }, {  75,-2158 }, {  76,-2158 },
+ {  77,-2158 }, {  78,-2158 }, {  79,-2158 }, {  80,-2158 }, {  81,-2158 },
+
+ {  82,-2158 }, {  83,-2158 }, {  84,-2158 }, {  85,-2158 }, {  86,-2158 },
+ {  87,-2158 }, {  88,-2158 }, {  89,-2158 }, {  90,-2158 }, {  91,-2158 },
+ {  92,-2158 }, {  93,-2158 }, {  94,-2158 }, {  95,-2158 }, {  96,-2158 },
+ {  97,-2158 }, {  98,-2158 }, {  99,-2158 }, { 100,-2158 }, { 101,-2158 },
+ { 102,-2158 }, { 103,-2158 }, { 104,-2158 }, { 105,-2158 }, { 106,-2158 },
+ { 107,-2158 }, { 108,-2158 }, { 109,-2158 }, { 110,-2158 }, { 111,-2158 },
+ { 112,-2158 }, { 113,-2158 }, { 114,-2158 }, { 115,-2158 }, { 116,-2158 },
+ { 117,-2158 }, { 118,-2158 }, { 119,-2158 }, { 120,-2158 }, { 121,-2158 },
+ { 122,-2158 }, { 123,-2158 }, { 124,-2158 }, { 125,-2158 }, { 126,-2158 },
+ { 127,-2158 }, { 128,-2158 }, { 129,-2158 }, { 130,-2158 }, { 131,-2158 },
+
+ { 132,-2158 }, { 133,-2158 }, { 134,-2158 }, { 135,-2158 }, { 136,-2158 },
+ { 137,-2158 }, { 138,-2158 }, { 139,-2158 }, { 140,-2158 }, { 141,-2158 },
+ { 142,-2158 }, { 143,-2158 }, { 144,-2158 }, { 145,-2158 }, { 146,-2158 },
+ { 147,-2158 }, { 148,-2158 }, { 149,-2158 }, { 150,-2158 }, { 151,-2158 },
+ { 152,-2158 }, { 153,-2158 }, { 154,-2158 }, { 155,-2158 }, { 156,-2158 },
+ { 157,-2158 }, { 158,-2158 }, { 159,-2158 }, { 160,-2158 }, { 161,-2158 },
+ { 162,-2158 }, { 163,-2158 }, { 164,-2158 }, { 165,-2158 }, { 166,-2158 },
+ { 167,-2158 }, { 168,-2158 }, { 169,-2158 }, { 170,-2158 }, { 171,-2158 },
+ { 172,-2158 }, { 173,-2158 }, { 174,-2158 }, { 175,-2158 }, { 176,-2158 },
+ { 177,-2158 }, { 178,-2158 }, { 179,-2158 }, { 180,-2158 }, { 181,-2158 },
+
+ { 182,-2158 }, { 183,-2158 }, { 184,-2158 }, { 185,-2158 }, { 186,-2158 },
+ { 187,-2158 }, { 188,-2158 }, { 189,-2158 }, { 190,-2158 }, { 191,-2158 },
+ { 192,-2158 }, { 193,-2158 }, { 194,-2158 }, { 195,-2158 }, { 196,-2158 },
+ { 197,-2158 }, { 198,-2158 }, { 199,-2158 }, { 200,-2158 }, { 201,-2158 },
+ { 202,-2158 }, { 203,-2158 }, { 204,-2158 }, { 205,-2158 }, { 206,-2158 },
+ { 207,-2158 }, { 208,-2158 }, { 209,-2158 }, { 210,-2158 }, { 211,-2158 },
+ { 212,-2158 }, { 213,-2158 }, { 214,-2158 }, { 215,-2158 }, { 216,-2158 },
+ { 217,-2158 }, { 218,-2158 }, { 219,-2158 }, { 220,-2158 }, { 221,-2158 },
+ { 222,-2158 }, { 223,-2158 }, { 224,-2158 }, { 225,-2158 }, { 226,-2158 },
+ { 227,-2158 }, { 228,-2158 }, { 229,-2158 }, { 230,-2158 }, { 231,-2158 },
+
+ { 232,-2158 }, { 233,-2158 }, { 234,-2158 }, { 235,-2158 }, { 236,-2158 },
+ { 237,-2158 }, { 238,-2158 }, { 239,-2158 }, { 240,-2158 }, { 241,-2158 },
+ { 242,-2158 }, { 243,-2158 }, { 244,-2158 }, { 245,-2158 }, { 246,-2158 },
+ { 247,-2158 }, { 248,-2158 }, { 249,-2158 }, { 250,-2158 }, { 251,-2158 },
+ { 252,-2158 }, { 253,-2158 }, { 254,-2158 }, { 255,-2158 }, { 256,-2158 },
+ {   0,  55 }, {   0, 774 }, {   1,-27567 }, {   2,-27567 }, {   3,-27567 },
+ {   4,-27567 }, {   5,-27567 }, {   6,-27567 }, {   7,-27567 }, {   8,-27567 },
+ {   9,-27567 }, {  10,-27567 }, {  11,-27567 }, {  12,-27567 }, {  13,-27567 },
+ {  14,-27567 }, {  15,-27567 }, {  16,-27567 }, {  17,-27567 }, {  18,-27567 },
+ {  19,-27567 }, {  20,-27567 }, {  21,-27567 }, {  22,-27567 }, {  23,-27567 },
+
+ {  24,-27567 }, {  25,-27567 }, {  26,-27567 }, {  27,-27567 }, {  28,-27567 },
+ {  29,-27567 }, {  30,-27567 }, {  31,-27567 }, {  32,-27567 }, {  33,-27567 },
+ {  34,-27567 }, {  35,-27567 }, {  36,-27567 }, {  37,-27567 }, {  38,-27567 },
+ {   0,   0 }, {  40,-27567 }, {  41,-27567 }, {  42,-27567 }, {  43,-27567 },
+ {  44,-27567 }, {  45,-27567 }, {  46,-27567 }, {  47,-27567 }, {  48,-27567 },
+ {  49,-27567 }, {  50,-27567 }, {  51,-27567 }, {  52,-27567 }, {  53,-27567 },
+ {  54,-27567 }, {  55,-27567 }, {  56,-27567 }, {  57,-27567 }, {  58,-27567 },
+ {  59,-27567 }, {  60,-27567 }, {  61,-27567 }, {  62,-27567 }, {  63,-27567 },
+ {  64,-27567 }, {  65,-27567 }, {  66,-27567 }, {  67,-27567 }, {  68,-27567 },
+ {  69,-27567 }, {  70,-27567 }, {  71,-27567 }, {  72,-27567 }, {  73,-27567 },
+
+ {  74,-27567 }, {  75,-27567 }, {  76,-27567 }, {  77,-27567 }, {  78,-27567 },
+ {  79,-27567 }, {  80,-27567 }, {  81,-27567 }, {  82,-27567 }, {  83,-27567 },
+ {  84,-27567 }, {  85,-27567 }, {  86,-27567 }, {  87,-27567 }, {  88,-27567 },
+ {  89,-27567 }, {  90,-27567 }, {  91,-27567 }, {  92,-27567 }, {  93,-27567 },
+ {  94,-27567 }, {  95,-27567 }, {  96,-27567 }, {  97,-27567 }, {  98,-27567 },
+ {  99,-27567 }, { 100,-27567 }, { 101,-27567 }, { 102,-27567 }, { 103,-27567 },
+ { 104,-27567 }, { 105,-27567 }, { 106,-27567 }, { 107,-27567 }, { 108,-27567 },
+ { 109,-27567 }, { 110,-27567 }, { 111,-27567 }, { 112,-27567 }, { 113,-27567 },
+ { 114,-27567 }, { 115,-27567 }, { 116,-27567 }, { 117,-27567 }, { 118,-27567 },
+ { 119,-27567 }, { 120,-27567 }, { 121,-27567 }, { 122,-27567 }, { 123,-27567 },
+
+ { 124,-27567 }, { 125,-27567 }, { 126,-27567 }, { 127,-27567 }, { 128,-27567 },
+ { 129,-27567 }, { 130,-27567 }, { 131,-27567 }, { 132,-27567 }, { 133,-27567 },
+ { 134,-27567 }, { 135,-27567 }, { 136,-27567 }, { 137,-27567 }, { 138,-27567 },
+ { 139,-27567 }, { 140,-27567 }, { 141,-27567 }, { 142,-27567 }, { 143,-27567 },
+ { 144,-27567 }, { 145,-27567 }, { 146,-27567 }, { 147,-27567 }, { 148,-27567 },
+ { 149,-27567 }, { 150,-27567 }, { 151,-27567 }, { 152,-27567 }, { 153,-27567 },
+ { 154,-27567 }, { 155,-27567 }, { 156,-27567 }, { 157,-27567 }, { 158,-27567 },
+ { 159,-27567 }, { 160,-27567 }, { 161,-27567 }, { 162,-27567 }, { 163,-27567 },
+ { 164,-27567 }, { 165,-27567 }, { 166,-27567 }, { 167,-27567 }, { 168,-27567 },
+ { 169,-27567 }, { 170,-27567 }, { 171,-27567 }, { 172,-27567 }, { 173,-27567 },
+
+ { 174,-27567 }, { 175,-27567 }, { 176,-27567 }, { 177,-27567 }, { 178,-27567 },
+ { 179,-27567 }, { 180,-27567 }, { 181,-27567 }, { 182,-27567 }, { 183,-27567 },
+ { 184,-27567 }, { 185,-27567 }, { 186,-27567 }, { 187,-27567 }, { 188,-27567 },
+ { 189,-27567 }, { 190,-27567 }, { 191,-27567 }, { 192,-27567 }, { 193,-27567 },
+ { 194,-27567 }, { 195,-27567 }, { 196,-27567 }, { 197,-27567 }, { 198,-27567 },
+ { 199,-27567 }, { 200,-27567 }, { 201,-27567 }, { 202,-27567 }, { 203,-27567 },
+ { 204,-27567 }, { 205,-27567 }, { 206,-27567 }, { 207,-27567 }, { 208,-27567 },
+ { 209,-27567 }, { 210,-27567 }, { 211,-27567 }, { 212,-27567 }, { 213,-27567 },
+ { 214,-27567 }, { 215,-27567 }, { 216,-27567 }, { 217,-27567 }, { 218,-27567 },
+ { 219,-27567 }, { 220,-27567 }, { 221,-27567 }, { 222,-27567 }, { 223,-27567 },
+
+ { 224,-27567 }, { 225,-27567 }, { 226,-27567 }, { 227,-27567 }, { 228,-27567 },
+ { 229,-27567 }, { 230,-27567 }, { 231,-27567 }, { 232,-27567 }, { 233,-27567 },
+ { 234,-27567 }, { 235,-27567 }, { 236,-27567 }, { 237,-27567 }, { 238,-27567 },
+ { 239,-27567 }, { 240,-27567 }, { 241,-27567 }, { 242,-27567 }, { 243,-27567 },
+ { 244,-27567 }, { 245,-27567 }, { 246,-27567 }, { 247,-27567 }, { 248,-27567 },
+ { 249,-27567 }, { 250,-27567 }, { 251,-27567 }, { 252,-27567 }, { 253,-27567 },
+ { 254,-27567 }, { 255,-27567 }, { 256,-27567 }, {   0,  28 }, {   0, 516 },
+ {   1,-1595 }, {   2,-1595 }, {   3,-1595 }, {   4,-1595 }, {   5,-1595 },
+ {   6,-1595 }, {   7,-1595 }, {   8,-1595 }, {   9,-1337 }, {  10,-1079 },
+ {  11,-1595 }, {  12,-1337 }, {  13,-1079 }, {  14,-1595 }, {  15,-1595 },
+
+ {  16,-1595 }, {  17,-1595 }, {  18,-1595 }, {  19,-1595 }, {  20,-1595 },
+ {  21,-1595 }, {  22,-1595 }, {  23,-1595 }, {  24,-1595 }, {  25,-1595 },
+ {  26,-1595 }, {  27,-1595 }, {  28,-1595 }, {  29,-1595 }, {  30,-1595 },
+ {  31,-1595 }, {  32,-1337 }, {  33,-1595 }, {  34,-1595 }, {  35,-1595 },
+ {  36,-1595 }, {  37,-1595 }, {  38,-1595 }, {  39,-3190 }, {  40,-1595 },
+ {  41,-1595 }, {  42,-1595 }, {  43,-1595 }, {  44,-1595 }, {  45,-1032 },
+ {  46,-1595 }, {  47,-1595 }, {  48,-1595 }, {  49,-1595 }, {  50,-1595 },
+ {  51,-1595 }, {  52,-1595 }, {  53,-1595 }, {  54,-1595 }, {  55,-1595 },
+ {  56,-1595 }, {  57,-1595 }, {  58,-1595 }, {  59,-1595 }, {  60,-1595 },
+ {  61,-1595 }, {  62,-1595 }, {  63,-1595 }, {  64,-1595 }, {  65,-1595 },
+
+ {  66,-1595 }, {  67,-1595 }, {  68,-1595 }, {  69,-1595 }, {  70,-1595 },
+ {  71,-1595 }, {  72,-1595 }, {  73,-1595 }, {  74,-1595 }, {  75,-1595 },
+ {  76,-1595 }, {  77,-1595 }, {  78,-1595 }, {  79,-1595 }, {  80,-1595 },
+ {  81,-1595 }, {  82,-1595 }, {  83,-1595 }, {  84,-1595 }, {  85,-1595 },
+ {  86,-1595 }, {  87,-1595 }, {  88,-1595 }, {  89,-1595 }, {  90,-1595 },
+ {  91,-1595 }, {  92,-1595 }, {  93,-1595 }, {  94,-1595 }, {  95,-1595 },
+ {  96,-1595 }, {  97,-1595 }, {  98,-1595 }, {  99,-1595 }, { 100,-1595 },
+ { 101,-1595 }, { 102,-1595 }, { 103,-1595 }, { 104,-1595 }, { 105,-1595 },
+ { 106,-1595 }, { 107,-1595 }, { 108,-1595 }, { 109,-1595 }, { 110,-1595 },
+ { 111,-1595 }, { 112,-1595 }, { 113,-1595 }, { 114,-1595 }, { 115,-1595 },
+
+ { 116,-1595 }, { 117,-1595 }, { 118,-1595 }, { 119,-1595 }, { 120,-1595 },
+ { 121,-1595 }, { 122,-1595 }, { 123,-1595 }, { 124,-1595 }, { 125,-1595 },
+ { 126,-1595 }, { 127,-1595 }, { 128,-1595 }, { 129,-1595 }, { 130,-1595 },
+ { 131,-1595 }, { 132,-1595 }, { 133,-1595 }, { 134,-1595 }, { 135,-1595 },
+ { 136,-1595 }, { 137,-1595 }, { 138,-1595 }, { 139,-1595 }, { 140,-1595 },
+ { 141,-1595 }, { 142,-1595 }, { 143,-1595 }, { 144,-1595 }, { 145,-1595 },
+ { 146,-1595 }, { 147,-1595 }, { 148,-1595 }, { 149,-1595 }, { 150,-1595 },
+ { 151,-1595 }, { 152,-1595 }, { 153,-1595 }, { 154,-1595 }, { 155,-1595 },
+ { 156,-1595 }, { 157,-1595 }, { 158,-1595 }, { 159,-1595 }, { 160,-1595 },
+ { 161,-1595 }, { 162,-1595 }, { 163,-1595 }, { 164,-1595 }, { 165,-1595 },
+
+ { 166,-1595 }, { 167,-1595 }, { 168,-1595 }, { 169,-1595 }, { 170,-1595 },
+ { 171,-1595 }, { 172,-1595 }, { 173,-1595 }, { 174,-1595 }, { 175,-1595 },
+ { 176,-1595 }, { 177,-1595 }, { 178,-1595 }, { 179,-1595 }, { 180,-1595 },
+ { 181,-1595 }, { 182,-1595 }, { 183,-1595 }, { 184,-1595 }, { 185,-1595 },
+ { 186,-1595 }, { 187,-1595 }, { 188,-1595 }, { 189,-1595 }, { 190,-1595 },
+ { 191,-1595 }, { 192,-1595 }, { 193,-1595 }, { 194,-1595 }, { 195,-1595 },
+ { 196,-1595 }, { 197,-1595 }, { 198,-1595 }, { 199,-1595 }, { 200,-1595 },
+ { 201,-1595 }, { 202,-1595 }, { 203,-1595 }, { 204,-1595 }, { 205,-1595 },
+ { 206,-1595 }, { 207,-1595 }, { 208,-1595 }, { 209,-1595 }, { 210,-1595 },
+ { 211,-1595 }, { 212,-1595 }, { 213,-1595 }, { 214,-1595 }, { 215,-1595 },
+
+ { 216,-1595 }, { 217,-1595 }, { 218,-1595 }, { 219,-1595 }, { 220,-1595 },
+ { 221,-1595 }, { 222,-1595 }, { 223,-1595 }, { 224,-1595 }, { 225,-1595 },
+ { 226,-1595 }, { 227,-1595 }, { 228,-1595 }, { 229,-1595 }, { 230,-1595 },
+ { 231,-1595 }, { 232,-1595 }, { 233,-1595 }, { 234,-1595 }, { 235,-1595 },
+ { 236,-1595 }, { 237,-1595 }, { 238,-1595 }, { 239,-1595 }, { 240,-1595 },
+ { 241,-1595 }, { 242,-1595 }, { 243,-1595 }, { 244,-1595 }, { 245,-1595 },
+ { 246,-1595 }, { 247,-1595 }, { 248,-1595 }, { 249,-1595 }, { 250,-1595 },
+ { 251,-1595 }, { 252,-1595 }, { 253,-1595 }, { 254,-1595 }, { 255,-1595 },
+ { 256,-1595 }, {   0,  28 }, {   0, 258 }, {   1,-28081 }, {   2,-28081 },
+ {   3,-28081 }, {   4,-28081 }, {   5,-28081 }, {   6,-28081 }, {   7,-28081 },
+
+ {   8,-28081 }, {   9,-28081 }, {  10,-28081 }, {  11,-28081 }, {  12,-28081 },
+ {  13,-28081 }, {  14,-28081 }, {  15,-28081 }, {  16,-28081 }, {  17,-28081 },
+ {  18,-28081 }, {  19,-28081 }, {  20,-28081 }, {  21,-28081 }, {  22,-28081 },
+ {  23,-28081 }, {  24,-28081 }, {  25,-28081 }, {  26,-28081 }, {  27,-28081 },
+ {  28,-28081 }, {  29,-28081 }, {  30,-28081 }, {  31,-28081 }, {  32,-28081 },
+ {  33,-28081 }, {  34,-28081 }, {  35,-28081 }, {  36,-28081 }, {  37,-28081 },
+ {  38,-28081 }, {   0,   0 }, {  40,-28081 }, {  41,-28081 }, {  42,-28081 },
+ {  43,-28081 }, {  44,-28081 }, {  45,-28081 }, {  46,-28081 }, {  47,-28081 },
+ {  48,-28081 }, {  49,-28081 }, {  50,-28081 }, {  51,-28081 }, {  52,-28081 },
+ {  53,-28081 }, {  54,-28081 }, {  55,-28081 }, {  56,-28081 }, {  57,-28081 },
+
+ {  58,-28081 }, {  59,-28081 }, {  60,-28081 }, {  61,-28081 }, {  62,-28081 },
+ {  63,-28081 }, {  64,-28081 }, {  65,-28081 }, {  66,-28081 }, {  67,-28081 },
+ {  68,-28081 }, {  69,-28081 }, {  70,-28081 }, {  71,-28081 }, {  72,-28081 },
+ {  73,-28081 }, {  74,-28081 }, {  75,-28081 }, {  76,-28081 }, {  77,-28081 },
+ {  78,-28081 }, {  79,-28081 }, {  80,-28081 }, {  81,-28081 }, {  82,-28081 },
+ {  83,-28081 }, {  84,-28081 }, {  85,-28081 }, {  86,-28081 }, {  87,-28081 },
+ {  88,-28081 }, {  89,-28081 }, {  90,-28081 }, {  91,-28081 }, {  92,-28081 },
+ {  93,-28081 }, {  94,-28081 }, {  95,-28081 }, {  96,-28081 }, {  97,-28081 },
+ {  98,-28081 }, {  99,-28081 }, { 100,-28081 }, { 101,-28081 }, { 102,-28081 },
+ { 103,-28081 }, { 104,-28081 }, { 105,-28081 }, { 106,-28081 }, { 107,-28081 },
+
+ { 108,-28081 }, { 109,-28081 }, { 110,-28081 }, { 111,-28081 }, { 112,-28081 },
+ { 113,-28081 }, { 114,-28081 }, { 115,-28081 }, { 116,-28081 }, { 117,-28081 },
+ { 118,-28081 }, { 119,-28081 }, { 120,-28081 }, { 121,-28081 }, { 122,-28081 },
+ { 123,-28081 }, { 124,-28081 }, { 125,-28081 }, { 126,-28081 }, { 127,-28081 },
+ { 128,-28081 }, { 129,-28081 }, { 130,-28081 }, { 131,-28081 }, { 132,-28081 },
+ { 133,-28081 }, { 134,-28081 }, { 135,-28081 }, { 136,-28081 }, { 137,-28081 },
+ { 138,-28081 }, { 139,-28081 }, { 140,-28081 }, { 141,-28081 }, { 142,-28081 },
+ { 143,-28081 }, { 144,-28081 }, { 145,-28081 }, { 146,-28081 }, { 147,-28081 },
+ { 148,-28081 }, { 149,-28081 }, { 150,-28081 }, { 151,-28081 }, { 152,-28081 },
+ { 153,-28081 }, { 154,-28081 }, { 155,-28081 }, { 156,-28081 }, { 157,-28081 },
+
+ { 158,-28081 }, { 159,-28081 }, { 160,-28081 }, { 161,-28081 }, { 162,-28081 },
+ { 163,-28081 }, { 164,-28081 }, { 165,-28081 }, { 166,-28081 }, { 167,-28081 },
+ { 168,-28081 }, { 169,-28081 }, { 170,-28081 }, { 171,-28081 }, { 172,-28081 },
+ { 173,-28081 }, { 174,-28081 }, { 175,-28081 }, { 176,-28081 }, { 177,-28081 },
+ { 178,-28081 }, { 179,-28081 }, { 180,-28081 }, { 181,-28081 }, { 182,-28081 },
+ { 183,-28081 }, { 184,-28081 }, { 185,-28081 }, { 186,-28081 }, { 187,-28081 },
+ { 188,-28081 }, { 189,-28081 }, { 190,-28081 }, { 191,-28081 }, { 192,-28081 },
+ { 193,-28081 }, { 194,-28081 }, { 195,-28081 }, { 196,-28081 }, { 197,-28081 },
+ { 198,-28081 }, { 199,-28081 }, { 200,-28081 }, { 201,-28081 }, { 202,-28081 },
+ { 203,-28081 }, { 204,-28081 }, { 205,-28081 }, { 206,-28081 }, { 207,-28081 },
+
+ { 208,-28081 }, { 209,-28081 }, { 210,-28081 }, { 211,-28081 }, { 212,-28081 },
+ { 213,-28081 }, { 214,-28081 }, { 215,-28081 }, { 216,-28081 }, { 217,-28081 },
+ { 218,-28081 }, { 219,-28081 }, { 220,-28081 }, { 221,-28081 }, { 222,-28081 },
+ { 223,-28081 }, { 224,-28081 }, { 225,-28081 }, { 226,-28081 }, { 227,-28081 },
+ { 228,-28081 }, { 229,-28081 }, { 230,-28081 }, { 231,-28081 }, { 232,-28081 },
+ { 233,-28081 }, { 234,-28081 }, { 235,-28081 }, { 236,-28081 }, { 237,-28081 },
+ { 238,-28081 }, { 239,-28081 }, { 240,-28081 }, { 241,-28081 }, { 242,-28081 },
+ { 243,-28081 }, { 244,-28081 }, { 245,-28081 }, { 246,-28081 }, { 247,-28081 },
+ { 248,-28081 }, { 249,-28081 }, { 250,-28081 }, { 251,-28081 }, { 252,-28081 },
+ { 253,-28081 }, { 254,-28081 }, { 255,-28081 }, { 256,-28081 }, { 257,  81 },
+
+ {   1,   0 },    };
+
+static yyconst struct yy_trans_info *yy_start_state_list[27] =
+    {
+    &yy_transition[1],
+    &yy_transition[3],
+    &yy_transition[261],
+    &yy_transition[519],
+    &yy_transition[777],
+    &yy_transition[1035],
+    &yy_transition[1293],
+    &yy_transition[1551],
+    &yy_transition[1809],
+    &yy_transition[2067],
+    &yy_transition[2325],
+    &yy_transition[2583],
+    &yy_transition[2841],
+    &yy_transition[3099],
+    &yy_transition[3357],
+    &yy_transition[3615],
+    &yy_transition[3873],
+    &yy_transition[4131],
+    &yy_transition[4389],
+    &yy_transition[4647],
+    &yy_transition[4905],
+    &yy_transition[5163],
+    &yy_transition[5421],
+    &yy_transition[5679],
+    &yy_transition[5937],
+    &yy_transition[6195],
+    &yy_transition[6453],
+
+    } ;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+#line 1 "scan.l"
+#line 2 "scan.l"
+/*-------------------------------------------------------------------------
+ *
+ * scan.l
+ *	  lexical scanner for PostgreSQL
+ *
+ * NOTE NOTE NOTE:
+ *
+ * The rules in this file must be kept in sync with psql's lexer!!!
+ *
+ * The rules are designed so that the scanner never has to backtrack,
+ * in the sense that there is always a rule that can match the input
+ * consumed so far (the rule action may internally throw back some input
+ * with yyless(), however).  As explained in the flex manual, this makes
+ * for a useful speed increase --- about a third faster than a plain -CF
+ * lexer, in simple testing.  The extra complexity is mostly in the rules
+ * for handling float numbers and continued string literals.  If you change
+ * the lexical rules, verify that you haven't broken the no-backtrack
+ * property by running flex with the "-b" option and checking that the
+ * resulting "lex.backup" file says that no backing up is needed.  (As of
+ * Postgres 9.2, this check is made automatically by the Makefile.)
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ *	  src/backend/parser/scan.l
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include <ctype.h>
+#include <unistd.h>
+
+#include "parser/parser.h"				/* only needed for GUC variables */
+#include "parser/scanner.h"
+#include "parser/scansup.h"
+#include "mb/pg_wchar.h"
+
+
+/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
+#undef fprintf
+#define fprintf(file, fmt, msg)  fprintf_to_ereport(fmt, msg)
+
+static void
+fprintf_to_ereport(const char *fmt, const char *msg)
+{
+	ereport(ERROR, (errmsg_internal("%s", msg)));
+}
+
+/*
+ * GUC variables.  This is a DIRECT violation of the warning given at the
+ * head of gram.y, ie flex/bison code must not depend on any GUC variables;
+ * as such, changing their values can induce very unintuitive behavior.
+ * But we shall have to live with it as a short-term thing until the switch
+ * to SQL-standard string syntax is complete.
+ */
+__thread int				backslash_quote = BACKSLASH_QUOTE_SAFE_ENCODING;
+
+__thread bool			escape_string_warning = true;
+
+__thread bool			standard_conforming_strings = true;
+
+
+/*
+ * Set the type of YYSTYPE.
+ */
+#define YYSTYPE core_YYSTYPE
+
+/*
+ * Set the type of yyextra.  All state variables used by the scanner should
+ * be in yyextra, *not* statically allocated.
+ */
+#define YY_EXTRA_TYPE core_yy_extra_type *
+
+/*
+ * Each call to core_yylex must set yylloc to the location of the found token
+ * (expressed as a byte offset from the start of the input text).
+ * When we parse a token that requires multiple lexer rules to process,
+ * this should be done in the first such rule, else yylloc will point
+ * into the middle of the token.
+ */
+#define SET_YYLLOC()  (*(yylloc) = yytext - yyextra->scanbuf)
+
+/*
+ * Advance yylloc by the given number of bytes.
+ */
+#define ADVANCE_YYLLOC(delta)  ( *(yylloc) += (delta) )
+
+#define startlit()  ( yyextra->literallen = 0 )
+static void addlit(char *ytext, int yleng, core_yyscan_t yyscanner);
+static void addlitchar(unsigned char ychar, core_yyscan_t yyscanner);
+static char *litbufdup(core_yyscan_t yyscanner);
+static char *litbuf_udeescape(unsigned char escape, core_yyscan_t yyscanner);
+static unsigned char unescape_single_char(unsigned char c, core_yyscan_t yyscanner);
+static int	process_integer_literal(const char *token, YYSTYPE *lval);
+static bool is_utf16_surrogate_first(pg_wchar c);
+static bool is_utf16_surrogate_second(pg_wchar c);
+static pg_wchar surrogate_pair_to_codepoint(pg_wchar first, pg_wchar second);
+static void addunicode(pg_wchar c, yyscan_t yyscanner);
+static bool check_uescapechar(unsigned char escape);
+
+#define yyerror(msg)  scanner_yyerror(msg, yyscanner)
+
+#define lexer_errposition()  scanner_errposition(*(yylloc), yyscanner)
+
+static void check_string_escape_warning(unsigned char ychar, core_yyscan_t yyscanner);
+static void check_escape_warning(core_yyscan_t yyscanner);
+
+/*
+ * Work around a bug in flex 2.5.35: it emits a couple of functions that
+ * it forgets to emit declarations for.  Since we use -Wmissing-prototypes,
+ * this would cause warnings.  Providing our own declarations should be
+ * harmless even when the bug gets fixed.
+ */
+extern int	core_yyget_column(yyscan_t yyscanner);
+extern void core_yyset_column(int column_no, yyscan_t yyscanner);
+
+#define YY_NO_INPUT 1
+/*
+ * OK, here is a short description of lex/flex rules behavior.
+ * The longest pattern which matches an input string is always chosen.
+ * For equal-length patterns, the first occurring in the rules list is chosen.
+ * INITIAL is the starting state, to which all non-conditional rules apply.
+ * Exclusive states change parsing rules while the state is active.  When in
+ * an exclusive state, only those rules defined for that state apply.
+ *
+ * We use exclusive states for quoted strings, extended comments,
+ * and to eliminate parsing troubles for numeric strings.
+ * Exclusive states:
+ *  <xb> bit string literal
+ *  <xc> extended C-style comments
+ *  <xd> delimited identifiers (double-quoted identifiers)
+ *  <xh> hexadecimal numeric string
+ *  <xq> standard quoted strings
+ *  <xe> extended quoted strings (support backslash escape sequences)
+ *  <xdolq> $foo$ quoted strings
+ *  <xui> quoted identifier with Unicode escapes
+ *  <xuiend> end of a quoted identifier with Unicode escapes, UESCAPE can follow
+ *  <xus> quoted string with Unicode escapes
+ *  <xusend> end of a quoted string with Unicode escapes, UESCAPE can follow
+ *  <xeu> Unicode surrogate pair in extended quoted string
+ *
+ * Remember to add an <<EOF>> case whenever you add a new exclusive state!
+ * The default one is probably not the right thing.
+ */
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * In order to make the world safe for Windows and Mac clients as well as
+ * Unix ones, we accept either \n or \r as a newline.  A DOS-style \r\n
+ * sequence will be seen as two successive newlines, but that doesn't cause
+ * any problems.  Comments that start with -- and extend to the next
+ * newline are treated as equivalent to a single whitespace character.
+ *
+ * NOTE a fine point: if there is no newline following --, we will absorb
+ * everything to the end of the input as a comment.  This is correct.  Older
+ * versions of Postgres failed to recognize -- as a comment if the input
+ * did not end with a newline.
+ *
+ * XXX perhaps \f (formfeed) should be treated as a newline as well?
+ *
+ * XXX if you change the set of whitespace characters, fix scanner_isspace()
+ * to agree, and see also the plpgsql lexer.
+ */
+/*
+ * SQL requires at least one newline in the whitespace separating
+ * string literals that are to be concatenated.  Silly, but who are we
+ * to argue?  Note that {whitespace_with_newline} should not have * after
+ * it, whereas {whitespace} should generally have a * after it...
+ */
+/*
+ * To ensure that {quotecontinue} can be scanned without having to back up
+ * if the full pattern isn't matched, we include trailing whitespace in
+ * {quotestop}.  This matches all cases where {quotecontinue} fails to match,
+ * except for {quote} followed by whitespace and just one "-" (not two,
+ * which would start a {comment}).  To cover that we have {quotefail}.
+ * The actions for {quotestop} and {quotefail} must throw back characters
+ * beyond the quote proper.
+ */
+/* Bit string
+ * It is tempting to scan the string for only those characters
+ * which are allowed. However, this leads to silently swallowed
+ * characters if illegal characters are included in the string.
+ * For example, if xbinside is [01] then B'ABCD' is interpreted
+ * as a zero-length string, and the ABCD' is lost!
+ * Better to pass the string forward and let the input routines
+ * validate the contents.
+ */
+/* Hexadecimal number */
+/* National character */
+/* Quoted string that allows backslash escapes */
+/* Normalized escaped string */
+/* Extended quote
+ * xqdouble implements embedded quote, ''''
+ */
+/* $foo$ style quotes ("dollar quoting")
+ * The quoted string starts with $foo$ where "foo" is an optional string
+ * in the form of an identifier, except that it may not contain "$",
+ * and extends to the first occurrence of an identical string.
+ * There is *no* processing of the quoted text.
+ *
+ * {dolqfailed} is an error rule to avoid scanner backup when {dolqdelim}
+ * fails to match its trailing "$".
+ */
+/* Double quote
+ * Allows embedded spaces and other special characters into identifiers.
+ */
+/* Unicode escapes */
+/* error rule to avoid backup */
+/* Quoted identifier with Unicode escapes */
+/* Quoted string with Unicode escapes */
+/* Optional UESCAPE after a quoted string or identifier with Unicode escapes. */
+/* error rule to avoid backup */
+/* C-style comments
+ *
+ * The "extended comment" syntax closely resembles allowable operator syntax.
+ * The tricky part here is to get lex to recognize a string starting with
+ * slash-star as a comment, when interpreting it as an operator would produce
+ * a longer match --- remember lex will prefer a longer match!  Also, if we
+ * have something like plus-slash-star, lex will think this is a 3-character
+ * operator whereas we want to see it as a + operator and a comment start.
+ * The solution is two-fold:
+ * 1. append {op_chars}* to xcstart so that it matches as much text as
+ *    {operator} would. Then the tie-breaker (first matching rule of same
+ *    length) ensures xcstart wins.  We put back the extra stuff with yyless()
+ *    in case it contains a star-slash that should terminate the comment.
+ * 2. In the operator rule, check for slash-star within the operator, and
+ *    if found throw it back with yyless().  This handles the plus-slash-star
+ *    problem.
+ * Dash-dash comments have similar interactions with the operator rule.
+ */
+/* Assorted special-case operators and operator-like tokens */
+/*
+ * "self" is the set of chars that should be returned as single-character
+ * tokens.  "op_chars" is the set of chars that can make up "Op" tokens,
+ * which can be one or more characters long (but if a single-char token
+ * appears in the "self" set, it is not to be returned as an Op).  Note
+ * that the sets overlap, but each has some chars that are not in the other.
+ *
+ * If you change either set, adjust the character lists appearing in the
+ * rule for "operator"!
+ */
+/* we no longer allow unary minus in numbers.
+ * instead we pass it separately to parser. there it gets
+ * coerced via doNegate() -- Leon aug 20 1999
+ *
+* {decimalfail} is used because we would like "1..10" to lex as 1, dot_dot, 10.
+*
+ * {realfail1} and {realfail2} are added to prevent the need for scanner
+ * backup when the {real} rule fails to match completely.
+ */
+/*
+ * Dollar quoted strings are totally opaque, and no escaping is done on them.
+ * Other quoted strings must allow some special characters such as single-quote
+ *  and newline.
+ * Embedded single-quotes are implemented both in the SQL standard
+ *  style of two adjacent single quotes "''" and in the Postgres/Java style
+ *  of escaped-quote "\'".
+ * Other embedded escaped characters are matched explicitly and the leading
+ *  backslash is dropped from the string.
+ * Note that xcstart must appear before operator, as explained above!
+ *  Also whitespace (comment) must appear before operator.
+ */
+#line 8763 "scan.c"
+
+#define INITIAL 0
+#define xb 1
+#define xc 2
+#define xd 3
+#define xh 4
+#define xe 5
+#define xq 6
+#define xdolq 7
+#define xui 8
+#define xuiend 9
+#define xus 10
+#define xusend 11
+#define xeu 12
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+/* Holds the entire state of the reentrant scanner. */
+struct yyguts_t
+    {
+
+    /* User-defined. Not touched by flex. */
+    YY_EXTRA_TYPE yyextra_r;
+
+    /* The rest are the same as the globals declared in the non-reentrant scanner. */
+    FILE *yyin_r, *yyout_r;
+    size_t yy_buffer_stack_top; /**< index of top of stack. */
+    size_t yy_buffer_stack_max; /**< capacity of stack. */
+    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
+    char yy_hold_char;
+    yy_size_t yy_n_chars;
+    yy_size_t yyleng_r;
+    char *yy_c_buf_p;
+    int yy_init;
+    int yy_start;
+    int yy_did_buffer_switch_on_eof;
+    int yy_start_stack_ptr;
+    int yy_start_stack_depth;
+    int *yy_start_stack;
+    yy_state_type yy_last_accepting_state;
+    char* yy_last_accepting_cpos;
+
+    int yylineno_r;
+    int yy_flex_debug_r;
+
+    char *yytext_r;
+    int yy_more_flag;
+    int yy_more_len;
+
+    YYSTYPE * yylval_r;
+
+    YYLTYPE * yylloc_r;
+
+    }; /* end struct yyguts_t */
+
+static int yy_init_globals (yyscan_t yyscanner );
+
+    /* This must go here because YYSTYPE and YYLTYPE are included
+     * from bison output in section 1.*/
+    #    define yylval yyg->yylval_r
+    
+    #    define yylloc yyg->yylloc_r
+    
+int core_yylex_init (yyscan_t* scanner);
+
+int core_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
+
+/* Accessor methods to globals.
+   These are made visible to non-reentrant scanners for convenience. */
+
+int core_yylex_destroy (yyscan_t yyscanner );
+
+int core_yyget_debug (yyscan_t yyscanner );
+
+void core_yyset_debug (int debug_flag ,yyscan_t yyscanner );
+
+YY_EXTRA_TYPE core_yyget_extra (yyscan_t yyscanner );
+
+void core_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
+
+FILE *core_yyget_in (yyscan_t yyscanner );
+
+void core_yyset_in  (FILE * in_str ,yyscan_t yyscanner );
+
+FILE *core_yyget_out (yyscan_t yyscanner );
+
+void core_yyset_out  (FILE * out_str ,yyscan_t yyscanner );
+
+yy_size_t core_yyget_leng (yyscan_t yyscanner );
+
+char *core_yyget_text (yyscan_t yyscanner );
+
+int core_yyget_lineno (yyscan_t yyscanner );
+
+void core_yyset_lineno (int line_number ,yyscan_t yyscanner );
+
+YYSTYPE * core_yyget_lval (yyscan_t yyscanner );
+
+void core_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
+
+       YYLTYPE *core_yyget_lloc (yyscan_t yyscanner );
+    
+        void core_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
+    
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int core_yywrap (yyscan_t yyscanner );
+#else
+extern int core_yywrap (yyscan_t yyscanner );
+#endif
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
+#endif
+
+#ifndef YY_NO_INPUT
+
+#ifdef __cplusplus
+static int yyinput (yyscan_t yyscanner );
+#else
+static int input (yyscan_t yyscanner );
+#endif
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+		{ \
+		int c = '*'; \
+		yy_size_t n; \
+		for ( n = 0; n < max_size && \
+			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+			buf[n] = (char) c; \
+		if ( c == '\n' ) \
+			buf[n++] = (char) c; \
+		if ( c == EOF && ferror( yyin ) ) \
+			YY_FATAL_ERROR( "input in flex scanner failed" ); \
+		result = n; \
+		} \
+	else \
+		{ \
+		errno=0; \
+		while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+			{ \
+			if( errno != EINTR) \
+				{ \
+				YY_FATAL_ERROR( "input in flex scanner failed" ); \
+				break; \
+				} \
+			errno=0; \
+			clearerr(yyin); \
+			} \
+		}\
+\
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+
+extern int core_yylex \
+               (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
+
+#define YY_DECL int core_yylex \
+               (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+	YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+	register yy_state_type yy_current_state;
+	register char *yy_cp, *yy_bp;
+	register int yy_act;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+#line 396 "scan.l"
+
+
+#line 9017 "scan.c"
+
+    yylval = yylval_param;
+
+    yylloc = yylloc_param;
+
+	if ( !yyg->yy_init )
+		{
+		yyg->yy_init = 1;
+
+#ifdef YY_USER_INIT
+		YY_USER_INIT;
+#endif
+
+		if ( ! yyg->yy_start )
+			yyg->yy_start = 1;	/* first start state */
+
+		if ( ! yyin )
+			yyin = stdin;
+
+		if ( ! yyout )
+			yyout = stdout;
+
+		if ( ! YY_CURRENT_BUFFER ) {
+			core_yyensure_buffer_stack (yyscanner);
+			YY_CURRENT_BUFFER_LVALUE =
+				core_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+		}
+
+		core_yy_load_buffer_state(yyscanner );
+		}
+
+	while ( 1 )		/* loops until end-of-file is reached */
+		{
+		yy_cp = yyg->yy_c_buf_p;
+
+		/* Support of yytext. */
+		*yy_cp = yyg->yy_hold_char;
+
+		/* yy_bp points to the position in yy_ch_buf of the start of
+		 * the current run.
+		 */
+		yy_bp = yy_cp;
+
+		yy_current_state = yy_start_state_list[yyg->yy_start];
+yy_match:
+		{
+		register yyconst struct yy_trans_info *yy_trans_info;
+
+		register YY_CHAR yy_c;
+
+		for ( yy_c = YY_SC_TO_UI(*yy_cp);
+		      (yy_trans_info = &yy_current_state[(unsigned int) yy_c])->
+		yy_verify == yy_c;
+		      yy_c = YY_SC_TO_UI(*++yy_cp) )
+			yy_current_state += yy_trans_info->yy_nxt;
+		}
+
+yy_find_action:
+		yy_act = yy_current_state[-1].yy_nxt;
+
+		YY_DO_BEFORE_ACTION;
+
+do_action:	/* This label is used only to access EOF actions. */
+
+		switch ( yy_act )
+	{ /* beginning of action switch */
+case 1:
+/* rule 1 can match eol */
+YY_RULE_SETUP
+#line 398 "scan.l"
+{
+					/* ignore */
+				}
+	YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 402 "scan.l"
+{
+					/* Set location in case of syntax error in comment */
+					SET_YYLLOC();
+					yyextra->xcdepth = 0;
+					BEGIN(xc);
+					/* Put back any characters past slash-star; see above */
+					yyless(2);
+				}
+	YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 411 "scan.l"
+{
+					(yyextra->xcdepth)++;
+					/* Put back any characters past slash-star; see above */
+					yyless(2);
+				}
+	YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 417 "scan.l"
+{
+					if (yyextra->xcdepth <= 0)
+						BEGIN(INITIAL);
+					else
+						(yyextra->xcdepth)--;
+				}
+	YY_BREAK
+case 5:
+/* rule 5 can match eol */
+YY_RULE_SETUP
+#line 424 "scan.l"
+{
+					/* ignore */
+				}
+	YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 428 "scan.l"
+{
+					/* ignore */
+				}
+	YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 432 "scan.l"
+{
+					/* ignore */
+				}
+	YY_BREAK
+case YY_STATE_EOF(xc):
+#line 436 "scan.l"
+{ yyerror("unterminated /* comment"); }
+	YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 438 "scan.l"
+{
+					/* Binary bit type.
+					 * At some point we should simply pass the string
+					 * forward to the parser and label it there.
+					 * In the meantime, place a leading "b" on the string
+					 * to mark it for the input routine as a binary string.
+					 */
+					SET_YYLLOC();
+					BEGIN(xb);
+					startlit();
+					addlitchar('b', yyscanner);
+				}
+	YY_BREAK
+case 9:
+/* rule 9 can match eol */
+#line 451 "scan.l"
+case 10:
+/* rule 10 can match eol */
+YY_RULE_SETUP
+#line 451 "scan.l"
+{
+					yyless(1);
+					BEGIN(INITIAL);
+					yylval->str = litbufdup(yyscanner);
+					return BCONST;
+				}
+	YY_BREAK
+case 11:
+/* rule 11 can match eol */
+#line 458 "scan.l"
+case 12:
+/* rule 12 can match eol */
+YY_RULE_SETUP
+#line 458 "scan.l"
+{
+					addlit(yytext, yyleng, yyscanner);
+				}
+	YY_BREAK
+case 13:
+/* rule 13 can match eol */
+#line 462 "scan.l"
+case 14:
+/* rule 14 can match eol */
+YY_RULE_SETUP
+#line 462 "scan.l"
+{
+					/* ignore */
+				}
+	YY_BREAK
+case YY_STATE_EOF(xb):
+#line 465 "scan.l"
+{ yyerror("unterminated bit string literal"); }
+	YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 467 "scan.l"
+{
+					/* Hexadecimal bit type.
+					 * At some point we should simply pass the string
+					 * forward to the parser and label it there.
+					 * In the meantime, place a leading "x" on the string
+					 * to mark it for the input routine as a hex string.
+					 */
+					SET_YYLLOC();
+					BEGIN(xh);
+					startlit();
+					addlitchar('x', yyscanner);
+				}
+	YY_BREAK
+case 16:
+/* rule 16 can match eol */
+#line 480 "scan.l"
+case 17:
+/* rule 17 can match eol */
+YY_RULE_SETUP
+#line 480 "scan.l"
+{
+					yyless(1);
+					BEGIN(INITIAL);
+					yylval->str = litbufdup(yyscanner);
+					return XCONST;
+				}
+	YY_BREAK
+case YY_STATE_EOF(xh):
+#line 486 "scan.l"
+{ yyerror("unterminated hexadecimal string literal"); }
+	YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 488 "scan.l"
+{
+					/* National character.
+					 * We will pass this along as a normal character string,
+					 * but preceded with an internally-generated "NCHAR".
+					 */
+					const ScanKeyword *keyword;
+
+					SET_YYLLOC();
+					yyless(1);				/* eat only 'n' this time */
+
+					keyword = ScanKeywordLookup("nchar",
+												yyextra->keywords,
+												yyextra->num_keywords);
+					if (keyword != NULL)
+					{
+						yylval->keyword = keyword->name;
+						return keyword->value;
+					}
+					else
+					{
+						/* If NCHAR isn't a keyword, just return "n" */
+						yylval->str = pstrdup("n");
+						return IDENT;
+					}
+				}
+	YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 514 "scan.l"
+{
+					yyextra->warn_on_first_escape = true;
+					yyextra->saw_non_ascii = false;
+					SET_YYLLOC();
+					if (yyextra->standard_conforming_strings)
+						BEGIN(xq);
+					else
+						BEGIN(xe);
+					startlit();
+				}
+	YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 524 "scan.l"
+{
+					yyextra->warn_on_first_escape = false;
+					yyextra->saw_non_ascii = false;
+					SET_YYLLOC();
+					BEGIN(xe);
+					startlit();
+				}
+	YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 531 "scan.l"
+{
+					SET_YYLLOC();
+					if (!yyextra->standard_conforming_strings)
+						ereport(ERROR,
+								(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+								 errmsg("unsafe use of string constant with Unicode escapes"),
+								 errdetail("String constants with Unicode escapes cannot be used when standard_conforming_strings is off."),
+								 lexer_errposition()));
+					BEGIN(xus);
+					startlit();
+				}
+	YY_BREAK
+case 22:
+/* rule 22 can match eol */
+#line 543 "scan.l"
+case 23:
+/* rule 23 can match eol */
+YY_RULE_SETUP
+#line 543 "scan.l"
+{
+					yyless(1);
+					BEGIN(INITIAL);
+					/*
+					 * check that the data remains valid if it might have been
+					 * made invalid by unescaping any chars.
+					 */
+					if (yyextra->saw_non_ascii)
+						pg_verifymbstr(yyextra->literalbuf,
+									   yyextra->literallen,
+									   false);
+					yylval->str = litbufdup(yyscanner);
+					return SCONST;
+				}
+	YY_BREAK
+case 24:
+/* rule 24 can match eol */
+#line 558 "scan.l"
+case 25:
+/* rule 25 can match eol */
+YY_RULE_SETUP
+#line 558 "scan.l"
+{
+					/* throw back all but the quote */
+					yyless(1);
+					/* xusend state looks for possible UESCAPE */
+					BEGIN(xusend);
+				}
+	YY_BREAK
+case 26:
+/* rule 26 can match eol */
+YY_RULE_SETUP
+#line 564 "scan.l"
+{ /* stay in xusend state over whitespace */ }
+	YY_BREAK
+case 27:
+#line 566 "scan.l"
+case 28:
+/* rule 28 can match eol */
+#line 567 "scan.l"
+case YY_STATE_EOF(xusend):
+#line 567 "scan.l"
+{
+					/* no UESCAPE after the quote, throw back everything */
+					yyless(0);
+					BEGIN(INITIAL);
+					yylval->str = litbuf_udeescape('\\', yyscanner);
+					return SCONST;
+				}
+	YY_BREAK
+case 29:
+/* rule 29 can match eol */
+YY_RULE_SETUP
+#line 574 "scan.l"
+{
+					/* found UESCAPE after the end quote */
+					BEGIN(INITIAL);
+					if (!check_uescapechar(yytext[yyleng-2]))
+					{
+						SET_YYLLOC();
+						ADVANCE_YYLLOC(yyleng-2);
+						yyerror("invalid Unicode escape character");
+					}
+					yylval->str = litbuf_udeescape(yytext[yyleng-2], yyscanner);
+					return SCONST;
+				}
+	YY_BREAK
+case 30:
+YY_RULE_SETUP
+#line 586 "scan.l"
+{
+					addlitchar('\'', yyscanner);
+				}
+	YY_BREAK
+case 31:
+/* rule 31 can match eol */
+YY_RULE_SETUP
+#line 589 "scan.l"
+{
+					addlit(yytext, yyleng, yyscanner);
+				}
+	YY_BREAK
+case 32:
+/* rule 32 can match eol */
+YY_RULE_SETUP
+#line 592 "scan.l"
+{
+					addlit(yytext, yyleng, yyscanner);
+				}
+	YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 595 "scan.l"
+{
+					pg_wchar c = strtoul(yytext+2, NULL, 16);
+
+					check_escape_warning(yyscanner);
+
+					if (is_utf16_surrogate_first(c))
+					{
+						yyextra->utf16_first_part = c;
+						BEGIN(xeu);
+					}
+					else if (is_utf16_surrogate_second(c))
+						yyerror("invalid Unicode surrogate pair");
+					else
+						addunicode(c, yyscanner);
+				}
+	YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 610 "scan.l"
+{
+					pg_wchar c = strtoul(yytext+2, NULL, 16);
+
+					if (!is_utf16_surrogate_second(c))
+						yyerror("invalid Unicode surrogate pair");
+
+					c = surrogate_pair_to_codepoint(yyextra->utf16_first_part, c);
+
+					addunicode(c, yyscanner);
+
+					BEGIN(xe);
+				}
+	YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 622 "scan.l"
+{ yyerror("invalid Unicode surrogate pair"); }
+	YY_BREAK
+case 36:
+/* rule 36 can match eol */
+YY_RULE_SETUP
+#line 623 "scan.l"
+{ yyerror("invalid Unicode surrogate pair"); }
+	YY_BREAK
+case YY_STATE_EOF(xeu):
+#line 624 "scan.l"
+{ yyerror("invalid Unicode surrogate pair"); }
+	YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 625 "scan.l"
+{
+						ereport(ERROR,
+								(errcode(ERRCODE_INVALID_ESCAPE_SEQUENCE),
+								 errmsg("invalid Unicode escape"),
+								 errhint("Unicode escapes must be \\uXXXX or \\UXXXXXXXX."),
+								 lexer_errposition()));
+				}
+	YY_BREAK
+case 38:
+/* rule 38 can match eol */
+YY_RULE_SETUP
+#line 632 "scan.l"
+{
+					if (yytext[1] == '\'')
+					{
+						if (yyextra->backslash_quote == BACKSLASH_QUOTE_OFF ||
+							(yyextra->backslash_quote == BACKSLASH_QUOTE_SAFE_ENCODING &&
+							 PG_ENCODING_IS_CLIENT_ONLY(pg_get_client_encoding())))
+							ereport(ERROR,
+									(errcode(ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER),
+									 errmsg("unsafe use of \\' in a string literal"),
+									 errhint("Use '' to write quotes in strings. \\' is insecure in client-only encodings."),
+									 lexer_errposition()));
+					}
+					check_string_escape_warning(yytext[1], yyscanner);
+					addlitchar(unescape_single_char(yytext[1], yyscanner),
+							   yyscanner);
+				}
+	YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 648 "scan.l"
+{
+					unsigned char c = strtoul(yytext+1, NULL, 8);
+
+					check_escape_warning(yyscanner);
+					addlitchar(c, yyscanner);
+					if (c == '\0' || IS_HIGHBIT_SET(c))
+						yyextra->saw_non_ascii = true;
+				}
+	YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 656 "scan.l"
+{
+					unsigned char c = strtoul(yytext+2, NULL, 16);
+
+					check_escape_warning(yyscanner);
+					addlitchar(c, yyscanner);
+					if (c == '\0' || IS_HIGHBIT_SET(c))
+						yyextra->saw_non_ascii = true;
+				}
+	YY_BREAK
+case 41:
+/* rule 41 can match eol */
+YY_RULE_SETUP
+#line 664 "scan.l"
+{
+					/* ignore */
+				}
+	YY_BREAK
+case 42:
+YY_RULE_SETUP
+#line 667 "scan.l"
+{
+					/* This is only needed for \ just before EOF */
+					addlitchar(yytext[0], yyscanner);
+				}
+	YY_BREAK
+case YY_STATE_EOF(xq):
+case YY_STATE_EOF(xe):
+case YY_STATE_EOF(xus):
+#line 671 "scan.l"
+{ yyerror("unterminated quoted string"); }
+	YY_BREAK
+case 43:
+YY_RULE_SETUP
+#line 673 "scan.l"
+{
+					SET_YYLLOC();
+					yyextra->dolqstart = pstrdup(yytext);
+					BEGIN(xdolq);
+					startlit();
+				}
+	YY_BREAK
+case 44:
+YY_RULE_SETUP
+#line 679 "scan.l"
+{
+					SET_YYLLOC();
+					/* throw back all but the initial "$" */
+					yyless(1);
+					/* and treat it as {other} */
+					return yytext[0];
+				}
+	YY_BREAK
+case 45:
+YY_RULE_SETUP
+#line 686 "scan.l"
+{
+					if (strcmp(yytext, yyextra->dolqstart) == 0)
+					{
+						pfree(yyextra->dolqstart);
+						yyextra->dolqstart = NULL;
+						BEGIN(INITIAL);
+						yylval->str = litbufdup(yyscanner);
+						return SCONST;
+					}
+					else
+					{
+						/*
+						 * When we fail to match $...$ to dolqstart, transfer
+						 * the $... part to the output, but put back the final
+						 * $ for rescanning.  Consider $delim$...$junk$delim$
+						 */
+						addlit(yytext, yyleng-1, yyscanner);
+						yyless(yyleng-1);
+					}
+				}
+	YY_BREAK
+case 46:
+/* rule 46 can match eol */
+YY_RULE_SETUP
+#line 706 "scan.l"
+{
+					addlit(yytext, yyleng, yyscanner);
+				}
+	YY_BREAK
+case 47:
+YY_RULE_SETUP
+#line 709 "scan.l"
+{
+					addlit(yytext, yyleng, yyscanner);
+				}
+	YY_BREAK
+case 48:
+YY_RULE_SETUP
+#line 712 "scan.l"
+{
+					/* This is only needed for $ inside the quoted text */
+					addlitchar(yytext[0], yyscanner);
+				}
+	YY_BREAK
+case YY_STATE_EOF(xdolq):
+#line 716 "scan.l"
+{ yyerror("unterminated dollar-quoted string"); }
+	YY_BREAK
+case 49:
+YY_RULE_SETUP
+#line 718 "scan.l"
+{
+					SET_YYLLOC();
+					BEGIN(xd);
+					startlit();
+				}
+	YY_BREAK
+case 50:
+YY_RULE_SETUP
+#line 723 "scan.l"
+{
+					SET_YYLLOC();
+					BEGIN(xui);
+					startlit();
+				}
+	YY_BREAK
+case 51:
+YY_RULE_SETUP
+#line 728 "scan.l"
+{
+					char		   *ident;
+
+					BEGIN(INITIAL);
+					if (yyextra->literallen == 0)
+						yyerror("zero-length delimited identifier");
+					ident = litbufdup(yyscanner);
+					if (yyextra->literallen >= NAMEDATALEN)
+						truncate_identifier(ident, yyextra->literallen, true);
+					yylval->str = ident;
+					return IDENT;
+				}
+	YY_BREAK
+case 52:
+YY_RULE_SETUP
+#line 740 "scan.l"
+{
+					yyless(1);
+					/* xuiend state looks for possible UESCAPE */
+					BEGIN(xuiend);
+				}
+	YY_BREAK
+case 53:
+/* rule 53 can match eol */
+YY_RULE_SETUP
+#line 745 "scan.l"
+{ /* stay in xuiend state over whitespace */ }
+	YY_BREAK
+case 54:
+#line 747 "scan.l"
+case 55:
+/* rule 55 can match eol */
+#line 748 "scan.l"
+case YY_STATE_EOF(xuiend):
+#line 748 "scan.l"
+{
+					/* no UESCAPE after the quote, throw back everything */
+					char	   *ident;
+					int			identlen;
+
+					yyless(0);
+
+					BEGIN(INITIAL);
+					if (yyextra->literallen == 0)
+						yyerror("zero-length delimited identifier");
+					ident = litbuf_udeescape('\\', yyscanner);
+					identlen = strlen(ident);
+					if (identlen >= NAMEDATALEN)
+						truncate_identifier(ident, identlen, true);
+					yylval->str = ident;
+					return IDENT;
+				}
+	YY_BREAK
+case 56:
+/* rule 56 can match eol */
+YY_RULE_SETUP
+#line 765 "scan.l"
+{
+					/* found UESCAPE after the end quote */
+					char	   *ident;
+					int			identlen;
+
+					BEGIN(INITIAL);
+					if (yyextra->literallen == 0)
+						yyerror("zero-length delimited identifier");
+					if (!check_uescapechar(yytext[yyleng-2]))
+					{
+						SET_YYLLOC();
+						ADVANCE_YYLLOC(yyleng-2);
+						yyerror("invalid Unicode escape character");
+					}
+					ident = litbuf_udeescape(yytext[yyleng - 2], yyscanner);
+					identlen = strlen(ident);
+					if (identlen >= NAMEDATALEN)
+						truncate_identifier(ident, identlen, true);
+					yylval->str = ident;
+					return IDENT;
+				}
+	YY_BREAK
+case 57:
+YY_RULE_SETUP
+#line 786 "scan.l"
+{
+					addlitchar('"', yyscanner);
+				}
+	YY_BREAK
+case 58:
+/* rule 58 can match eol */
+YY_RULE_SETUP
+#line 789 "scan.l"
+{
+					addlit(yytext, yyleng, yyscanner);
+				}
+	YY_BREAK
+case YY_STATE_EOF(xd):
+case YY_STATE_EOF(xui):
+#line 792 "scan.l"
+{ yyerror("unterminated quoted identifier"); }
+	YY_BREAK
+case 59:
+YY_RULE_SETUP
+#line 794 "scan.l"
+{
+					char		   *ident;
+
+					SET_YYLLOC();
+					/* throw back all but the initial u/U */
+					yyless(1);
+					/* and treat it as {identifier} */
+					ident = downcase_truncate_identifier(yytext, yyleng, true);
+					yylval->str = ident;
+					return IDENT;
+				}
+	YY_BREAK
+case 60:
+YY_RULE_SETUP
+#line 806 "scan.l"
+{
+          /* ignore E */
+          return yytext[1];
+        }
+	YY_BREAK
+case 61:
+YY_RULE_SETUP
+#line 811 "scan.l"
+{
+					SET_YYLLOC();
+					return TYPECAST;
+				}
+	YY_BREAK
+case 62:
+YY_RULE_SETUP
+#line 816 "scan.l"
+{
+					SET_YYLLOC();
+					return DOT_DOT;
+				}
+	YY_BREAK
+case 63:
+YY_RULE_SETUP
+#line 821 "scan.l"
+{
+					SET_YYLLOC();
+					return COLON_EQUALS;
+				}
+	YY_BREAK
+case 64:
+YY_RULE_SETUP
+#line 826 "scan.l"
+{
+					SET_YYLLOC();
+					return EQUALS_GREATER;
+				}
+	YY_BREAK
+case 65:
+YY_RULE_SETUP
+#line 831 "scan.l"
+{
+					SET_YYLLOC();
+					return LESS_EQUALS;
+				}
+	YY_BREAK
+case 66:
+YY_RULE_SETUP
+#line 836 "scan.l"
+{
+					SET_YYLLOC();
+					return GREATER_EQUALS;
+				}
+	YY_BREAK
+case 67:
+YY_RULE_SETUP
+#line 841 "scan.l"
+{
+					/* We accept both "<>" and "!=" as meaning NOT_EQUALS */
+					SET_YYLLOC();
+					return NOT_EQUALS;
+				}
+	YY_BREAK
+case 68:
+YY_RULE_SETUP
+#line 847 "scan.l"
+{
+					/* We accept both "<>" and "!=" as meaning NOT_EQUALS */
+					SET_YYLLOC();
+					return NOT_EQUALS;
+				}
+	YY_BREAK
+case 69:
+YY_RULE_SETUP
+#line 853 "scan.l"
+{
+					SET_YYLLOC();
+					return yytext[0];
+				}
+	YY_BREAK
+case 70:
+YY_RULE_SETUP
+#line 858 "scan.l"
+{
+					/*
+					 * Check for embedded slash-star or dash-dash; those
+					 * are comment starts, so operator must stop there.
+					 * Note that slash-star or dash-dash at the first
+					 * character will match a prior rule, not this one.
+					 */
+					int		nchars = yyleng;
+					char   *slashstar = strstr(yytext, "/*");
+					char   *dashdash = strstr(yytext, "--");
+
+					if (slashstar && dashdash)
+					{
+						/* if both appear, take the first one */
+						if (slashstar > dashdash)
+							slashstar = dashdash;
+					}
+					else if (!slashstar)
+						slashstar = dashdash;
+					if (slashstar)
+						nchars = slashstar - yytext;
+
+					/*
+					 * For SQL compatibility, '+' and '-' cannot be the
+					 * last char of a multi-char operator unless the operator
+					 * contains chars that are not in SQL operators.
+					 * The idea is to lex '=-' as two operators, but not
+					 * to forbid operator names like '?-' that could not be
+					 * sequences of SQL operators.
+					 */
+					while (nchars > 1 &&
+						   (yytext[nchars-1] == '+' ||
+							yytext[nchars-1] == '-'))
+					{
+						int		ic;
+
+						for (ic = nchars-2; ic >= 0; ic--)
+						{
+							if (strchr("~!@#^&|`?%", yytext[ic]))
+								break;
+						}
+						if (ic >= 0)
+							break; /* found a char that makes it OK */
+						nchars--; /* else remove the +/-, and check again */
+					}
+
+          /* We don't accept leading ? in any multi-character operators
+           * except for those in use by hstore, JSON and geometric operators.
+           *
+           * We don't accept contained or trailing ? in any
+           * multi-character operators.
+           *
+           * This is necessary in order to support normalized queries without
+           * spacing between ? as a substition character and a simple operator (e.g. "?=?")
+           */
+          if (yytext[0] == '?' &&
+              strcmp(yytext, "?|") != 0 && strcmp(yytext, "?&") != 0 &&
+              strcmp(yytext, "?#") != 0 && strcmp(yytext, "?-") != 0 &&
+              strcmp(yytext, "?-|") != 0 && strcmp(yytext, "?||") != 0)
+            nchars = 1;
+
+          if (yytext[0] != '?' && strchr(yytext, '?'))
+            /* Lex up to just before the ? character */
+            nchars = strchr(yytext, '?') - yytext;
+
+					SET_YYLLOC();
+
+					if (nchars < yyleng)
+					{
+						/* Strip the unwanted chars from the token */
+						yyless(nchars);
+						/*
+						 * If what we have left is only one char, and it's
+						 * one of the characters matching "self", then
+						 * return it as a character token the same way
+						 * that the "self" rule would have.
+						 */
+						if (nchars == 1 &&
+							strchr(",()[].;:+-*/%^<>=?", yytext[0]))
+							return yytext[0];
+					}
+
+					/*
+					 * Complain if operator is too long.  Unlike the case
+					 * for identifiers, we make this an error not a notice-
+					 * and-truncate, because the odds are we are looking at
+					 * a syntactic mistake anyway.
+					 */
+					if (nchars >= NAMEDATALEN)
+						yyerror("operator too long");
+
+					yylval->str = pstrdup(yytext);
+					return Op;
+				}
+	YY_BREAK
+case 71:
+YY_RULE_SETUP
+#line 953 "scan.l"
+{
+					SET_YYLLOC();
+					yylval->ival = atol(yytext + 1);
+					return PARAM;
+				}
+	YY_BREAK
+case 72:
+YY_RULE_SETUP
+#line 959 "scan.l"
+{
+					SET_YYLLOC();
+					return process_integer_literal(yytext, yylval);
+				}
+	YY_BREAK
+case 73:
+YY_RULE_SETUP
+#line 963 "scan.l"
+{
+					SET_YYLLOC();
+					yylval->str = pstrdup(yytext);
+					return FCONST;
+				}
+	YY_BREAK
+case 74:
+YY_RULE_SETUP
+#line 968 "scan.l"
+{
+					/* throw back the .., and treat as integer */
+					yyless(yyleng-2);
+					SET_YYLLOC();
+					return process_integer_literal(yytext, yylval);
+				}
+	YY_BREAK
+case 75:
+YY_RULE_SETUP
+#line 974 "scan.l"
+{
+					SET_YYLLOC();
+					yylval->str = pstrdup(yytext);
+					return FCONST;
+				}
+	YY_BREAK
+case 76:
+YY_RULE_SETUP
+#line 979 "scan.l"
+{
+					/*
+					 * throw back the [Ee], and treat as {decimal}.  Note
+					 * that it is possible the input is actually {integer},
+					 * but since this case will almost certainly lead to a
+					 * syntax error anyway, we don't bother to distinguish.
+					 */
+					yyless(yyleng-1);
+					SET_YYLLOC();
+					yylval->str = pstrdup(yytext);
+					return FCONST;
+				}
+	YY_BREAK
+case 77:
+YY_RULE_SETUP
+#line 991 "scan.l"
+{
+					/* throw back the [Ee][+-], and proceed as above */
+					yyless(yyleng-2);
+					SET_YYLLOC();
+					yylval->str = pstrdup(yytext);
+					return FCONST;
+				}
+	YY_BREAK
+case 78:
+YY_RULE_SETUP
+#line 1000 "scan.l"
+{
+					const ScanKeyword *keyword;
+					char		   *ident;
+          char       *keyword_text = pstrdup(yytext);
+
+					SET_YYLLOC();
+
+					/* Is it a keyword? */
+          if (yytext[yyleng - 1] == '?')
+            keyword_text[yyleng - 1] = '\0';
+
+					keyword = ScanKeywordLookup(keyword_text,
+												yyextra->keywords,
+												yyextra->num_keywords);
+					if (keyword != NULL)
+					{
+            if (keyword_text[yyleng - 1] == '\0')
+              yyless(yyleng - 1);
+						yylval->keyword = keyword->name;
+						return keyword->value;
+					}
+
+					/*
+					 * No.  Convert the identifier to lower case, and truncate
+					 * if necessary.
+					 */
+					ident = downcase_truncate_identifier(yytext, yyleng, true);
+					yylval->str = ident;
+					return IDENT;
+				}
+	YY_BREAK
+case 79:
+YY_RULE_SETUP
+#line 1031 "scan.l"
+{
+					SET_YYLLOC();
+					return yytext[0];
+				}
+	YY_BREAK
+case YY_STATE_EOF(INITIAL):
+#line 1036 "scan.l"
+{
+					SET_YYLLOC();
+					yyterminate();
+				}
+	YY_BREAK
+case 80:
+YY_RULE_SETUP
+#line 1041 "scan.l"
+YY_FATAL_ERROR( "flex scanner jammed" );
+	YY_BREAK
+#line 10046 "scan.c"
+
+	case YY_END_OF_BUFFER:
+		{
+		/* Amount of text matched not including the EOB char. */
+		int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
+
+		/* Undo the effects of YY_DO_BEFORE_ACTION. */
+		*yy_cp = yyg->yy_hold_char;
+		YY_RESTORE_YY_MORE_OFFSET
+
+		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+			{
+			/* We're scanning a new file or input source.  It's
+			 * possible that this happened because the user
+			 * just pointed yyin at a new source and called
+			 * core_yylex().  If so, then we have to assure
+			 * consistency between YY_CURRENT_BUFFER and our
+			 * globals.  Here is the right place to do so, because
+			 * this is the first action (other than possibly a
+			 * back-up) that will match for the new input source.
+			 */
+			yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+			}
+
+		/* Note that here we test for yy_c_buf_p "<=" to the position
+		 * of the first EOB in the buffer, since yy_c_buf_p will
+		 * already have been incremented past the NUL character
+		 * (since all states make transitions on EOB to the
+		 * end-of-buffer state).  Contrast this with the test
+		 * in input().
+		 */
+		if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
+			{ /* This was really a NUL. */
+			yy_state_type yy_next_state;
+
+			yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
+
+			yy_current_state = yy_get_previous_state( yyscanner );
+
+			/* Okay, we're now positioned to make the NUL
+			 * transition.  We couldn't have
+			 * yy_get_previous_state() go ahead and do it
+			 * for us because it doesn't know how to deal
+			 * with the possibility of jamming (and we don't
+			 * want to build jamming into it because then it
+			 * will run more slowly).
+			 */
+
+			yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
+
+			yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+
+			if ( yy_next_state )
+				{
+				/* Consume the NUL. */
+				yy_cp = ++yyg->yy_c_buf_p;
+				yy_current_state = yy_next_state;
+				goto yy_match;
+				}
+
+			else
+				{
+				yy_cp = yyg->yy_c_buf_p;
+				goto yy_find_action;
+				}
+			}
+
+		else switch ( yy_get_next_buffer( yyscanner ) )
+			{
+			case EOB_ACT_END_OF_FILE:
+				{
+				yyg->yy_did_buffer_switch_on_eof = 0;
+
+				if ( core_yywrap(yyscanner ) )
+					{
+					/* Note: because we've taken care in
+					 * yy_get_next_buffer() to have set up
+					 * yytext, we can now set up
+					 * yy_c_buf_p so that if some total
+					 * hoser (like flex itself) wants to
+					 * call the scanner after we return the
+					 * YY_NULL, it'll still work - another
+					 * YY_NULL will get returned.
+					 */
+					yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
+
+					yy_act = YY_STATE_EOF(YY_START);
+					goto do_action;
+					}
+
+				else
+					{
+					if ( ! yyg->yy_did_buffer_switch_on_eof )
+						YY_NEW_FILE;
+					}
+				break;
+				}
+
+			case EOB_ACT_CONTINUE_SCAN:
+				yyg->yy_c_buf_p =
+					yyg->yytext_ptr + yy_amount_of_matched_text;
+
+				yy_current_state = yy_get_previous_state( yyscanner );
+
+				yy_cp = yyg->yy_c_buf_p;
+				yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+				goto yy_match;
+
+			case EOB_ACT_LAST_MATCH:
+				yyg->yy_c_buf_p =
+				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
+
+				yy_current_state = yy_get_previous_state( yyscanner );
+
+				yy_cp = yyg->yy_c_buf_p;
+				yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+				goto yy_find_action;
+			}
+		break;
+		}
+
+	default:
+		YY_FATAL_ERROR(
+			"fatal flex scanner internal error--no action found" );
+	} /* end of action switch */
+		} /* end of scanning one token */
+} /* end of core_yylex */
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ *	EOB_ACT_LAST_MATCH -
+ *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *	EOB_ACT_END_OF_FILE - end of file
+ */
+static int yy_get_next_buffer (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+	register char *source = yyg->yytext_ptr;
+	register int number_to_move, i;
+	int ret_val;
+
+	if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
+		YY_FATAL_ERROR(
+		"fatal flex scanner internal error--end of buffer missed" );
+
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+		{ /* Don't try to fill the buffer, so this is an EOF. */
+		if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
+			{
+			/* We matched a single character, the EOB, so
+			 * treat this as a final EOF.
+			 */
+			return EOB_ACT_END_OF_FILE;
+			}
+
+		else
+			{
+			/* We matched some text prior to the EOB, first
+			 * process it.
+			 */
+			return EOB_ACT_LAST_MATCH;
+			}
+		}
+
+	/* Try to read more data. */
+
+	/* First move last chars to start of buffer. */
+	number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
+
+	for ( i = 0; i < number_to_move; ++i )
+		*(dest++) = *(source++);
+
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+		/* don't do the read, it's not guaranteed to return an EOF,
+		 * just force an EOF
+		 */
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
+
+	else
+		{
+			yy_size_t num_to_read =
+			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+		while ( num_to_read <= 0 )
+			{ /* Not enough room in the buffer - grow it. */
+
+			/* just a shorter name for the current buffer */
+			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+
+			int yy_c_buf_p_offset =
+				(int) (yyg->yy_c_buf_p - b->yy_ch_buf);
+
+			if ( b->yy_is_our_buffer )
+				{
+				yy_size_t new_size = b->yy_buf_size * 2;
+
+				if ( new_size <= 0 )
+					b->yy_buf_size += b->yy_buf_size / 8;
+				else
+					b->yy_buf_size *= 2;
+
+				b->yy_ch_buf = (char *)
+					/* Include room in for 2 EOB chars. */
+					core_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
+				}
+			else
+				/* Can't grow it, we don't own it. */
+				b->yy_ch_buf = 0;
+
+			if ( ! b->yy_ch_buf )
+				YY_FATAL_ERROR(
+				"fatal error - scanner input buffer overflow" );
+
+			yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+						number_to_move - 1;
+
+			}
+
+		if ( num_to_read > YY_READ_BUF_SIZE )
+			num_to_read = YY_READ_BUF_SIZE;
+
+		/* Read in more data. */
+		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+			yyg->yy_n_chars, num_to_read );
+
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+		}
+
+	if ( yyg->yy_n_chars == 0 )
+		{
+		if ( number_to_move == YY_MORE_ADJ )
+			{
+			ret_val = EOB_ACT_END_OF_FILE;
+			core_yyrestart(yyin  ,yyscanner);
+			}
+
+		else
+			{
+			ret_val = EOB_ACT_LAST_MATCH;
+			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+				YY_BUFFER_EOF_PENDING;
+			}
+		}
+
+	else
+		ret_val = EOB_ACT_CONTINUE_SCAN;
+
+	if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+		/* Extend the array by 50%, plus the number we really need. */
+		yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
+		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) core_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
+		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+	}
+
+	yyg->yy_n_chars += number_to_move;
+	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+
+	yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+	return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+    static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
+{
+	register yy_state_type yy_current_state;
+	register char *yy_cp;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	yy_current_state = yy_start_state_list[yyg->yy_start];
+
+	for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
+		{
+		yy_current_state += yy_current_state[(*yy_cp ? YY_SC_TO_UI(*yy_cp) : 256)].yy_nxt;
+		}
+
+	return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ *	next_state = yy_try_NUL_trans( current_state );
+ */
+    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
+{
+	register int yy_is_jam;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
+
+	register int yy_c = 256;
+	register yyconst struct yy_trans_info *yy_trans_info;
+
+	yy_trans_info = &yy_current_state[(unsigned int) yy_c];
+	yy_current_state += yy_trans_info->yy_nxt;
+	yy_is_jam = (yy_trans_info->yy_verify != yy_c);
+
+	return yy_is_jam ? 0 : yy_current_state;
+}
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+    static int yyinput (yyscan_t yyscanner)
+#else
+    static int input  (yyscan_t yyscanner)
+#endif
+
+{
+	int c;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	*yyg->yy_c_buf_p = yyg->yy_hold_char;
+
+	if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+		{
+		/* yy_c_buf_p now points to the character we want to return.
+		 * If this occurs *before* the EOB characters, then it's a
+		 * valid NUL; if not, then we've hit the end of the buffer.
+		 */
+		if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
+			/* This was really a NUL. */
+			*yyg->yy_c_buf_p = '\0';
+
+		else
+			{ /* need more input */
+			yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
+			++yyg->yy_c_buf_p;
+
+			switch ( yy_get_next_buffer( yyscanner ) )
+				{
+				case EOB_ACT_LAST_MATCH:
+					/* This happens because yy_g_n_b()
+					 * sees that we've accumulated a
+					 * token and flags that we need to
+					 * try matching the token before
+					 * proceeding.  But for input(),
+					 * there's no matching to consider.
+					 * So convert the EOB_ACT_LAST_MATCH
+					 * to EOB_ACT_END_OF_FILE.
+					 */
+
+					/* Reset buffer status. */
+					core_yyrestart(yyin ,yyscanner);
+
+					/*FALLTHROUGH*/
+
+				case EOB_ACT_END_OF_FILE:
+					{
+					if ( core_yywrap(yyscanner ) )
+						return 0;
+
+					if ( ! yyg->yy_did_buffer_switch_on_eof )
+						YY_NEW_FILE;
+#ifdef __cplusplus
+					return yyinput(yyscanner);
+#else
+					return input(yyscanner);
+#endif
+					}
+
+				case EOB_ACT_CONTINUE_SCAN:
+					yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
+					break;
+				}
+			}
+		}
+
+	c = *(unsigned char *) yyg->yy_c_buf_p;	/* cast for 8-bit char's */
+	*yyg->yy_c_buf_p = '\0';	/* preserve yytext */
+	yyg->yy_hold_char = *++yyg->yy_c_buf_p;
+
+	return c;
+}
+#endif	/* ifndef YY_NO_INPUT */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ * @param yyscanner The scanner object.
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+    void core_yyrestart  (FILE * input_file , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	if ( ! YY_CURRENT_BUFFER ){
+        core_yyensure_buffer_stack (yyscanner);
+		YY_CURRENT_BUFFER_LVALUE =
+            core_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+	}
+
+	core_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
+	core_yy_load_buffer_state(yyscanner );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ * @param yyscanner The scanner object.
+ */
+    void core_yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	/* TODO. We should be able to replace this entire function body
+	 * with
+	 *		core_yypop_buffer_state();
+	 *		core_yypush_buffer_state(new_buffer);
+     */
+	core_yyensure_buffer_stack (yyscanner);
+	if ( YY_CURRENT_BUFFER == new_buffer )
+		return;
+
+	if ( YY_CURRENT_BUFFER )
+		{
+		/* Flush out information for old buffer. */
+		*yyg->yy_c_buf_p = yyg->yy_hold_char;
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+		}
+
+	YY_CURRENT_BUFFER_LVALUE = new_buffer;
+	core_yy_load_buffer_state(yyscanner );
+
+	/* We don't actually know whether we did this switch during
+	 * EOF (core_yywrap()) processing, but the only time this flag
+	 * is looked at is after core_yywrap() is called, so it's safe
+	 * to go ahead and always set it.
+	 */
+	yyg->yy_did_buffer_switch_on_eof = 1;
+}
+
+static void core_yy_load_buffer_state  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+	yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+	yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+	yyg->yy_hold_char = *yyg->yy_c_buf_p;
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * @param yyscanner The scanner object.
+ * @return the allocated buffer state.
+ */
+    YY_BUFFER_STATE core_yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
+{
+	YY_BUFFER_STATE b;
+    
+	b = (YY_BUFFER_STATE) core_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in core_yy_create_buffer()" );
+
+	b->yy_buf_size = size;
+
+	/* yy_ch_buf has to be 2 characters longer than the size given because
+	 * we need to put in 2 end-of-buffer characters.
+	 */
+	b->yy_ch_buf = (char *) core_yyalloc(b->yy_buf_size + 2 ,yyscanner );
+	if ( ! b->yy_ch_buf )
+		YY_FATAL_ERROR( "out of dynamic memory in core_yy_create_buffer()" );
+
+	b->yy_is_our_buffer = 1;
+
+	core_yy_init_buffer(b,file ,yyscanner);
+
+	return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with core_yy_create_buffer()
+ * @param yyscanner The scanner object.
+ */
+   
+
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a core_yyrestart() or at EOF.
+ */
+    static void core_yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
+
+{
+	int oerrno = errno;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	core_yy_flush_buffer(b ,yyscanner);
+
+	b->yy_input_file = file;
+	b->yy_fill_buffer = 1;
+
+    /* If b is the current buffer, then core_yy_init_buffer was _probably_
+     * called from core_yyrestart() or through yy_get_next_buffer.
+     * In that case, we don't want to reset the lineno or column.
+     */
+    if (b != YY_CURRENT_BUFFER){
+        b->yy_bs_lineno = 1;
+        b->yy_bs_column = 0;
+    }
+
+        b->yy_is_interactive = 0;
+    
+	errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ * @param yyscanner The scanner object.
+ */
+    void core_yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+	if ( ! b )
+		return;
+
+	b->yy_n_chars = 0;
+
+	/* We always need two end-of-buffer characters.  The first causes
+	 * a transition to the end-of-buffer state.  The second causes
+	 * a jam in that state.
+	 */
+	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+	b->yy_buf_pos = &b->yy_ch_buf[0];
+
+	b->yy_at_bol = 1;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	if ( b == YY_CURRENT_BUFFER )
+		core_yy_load_buffer_state(yyscanner );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ *  the current state. This function will allocate the stack
+ *  if necessary.
+ *  @param new_buffer The new state.
+ *  @param yyscanner The scanner object.
+ */
+
+
+/** Removes and deletes the top of the stack, if present.
+ *  The next element becomes the new top.
+ *  @param yyscanner The scanner object.
+ */
+
+
+/* Allocates the stack if it does not exist.
+ *  Guarantees space for at least one push.
+ */
+static void core_yyensure_buffer_stack (yyscan_t yyscanner)
+{
+	yy_size_t num_to_alloc;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	if (!yyg->yy_buffer_stack) {
+
+		/* First allocation is just for 2 elements, since we don't know if this
+		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
+		 * immediate realloc on the next call.
+         */
+		num_to_alloc = 1;
+		yyg->yy_buffer_stack = (struct yy_buffer_state**)core_yyalloc
+								(num_to_alloc * sizeof(struct yy_buffer_state*)
+								, yyscanner);
+		if ( ! yyg->yy_buffer_stack )
+			YY_FATAL_ERROR( "out of dynamic memory in core_yyensure_buffer_stack()" );
+								  
+		memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+				
+		yyg->yy_buffer_stack_max = num_to_alloc;
+		yyg->yy_buffer_stack_top = 0;
+		return;
+	}
+
+	if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
+
+		/* Increase the buffer to prepare for a possible push. */
+		int grow_size = 8 /* arbitrary grow size */;
+
+		num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
+		yyg->yy_buffer_stack = (struct yy_buffer_state**)core_yyrealloc
+								(yyg->yy_buffer_stack,
+								num_to_alloc * sizeof(struct yy_buffer_state*)
+								, yyscanner);
+		if ( ! yyg->yy_buffer_stack )
+			YY_FATAL_ERROR( "out of dynamic memory in core_yyensure_buffer_stack()" );
+
+		/* zero only the new slots.*/
+		memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
+		yyg->yy_buffer_stack_max = num_to_alloc;
+	}
+}
+
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object. 
+ */
+YY_BUFFER_STATE core_yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
+{
+	YY_BUFFER_STATE b;
+    
+	if ( size < 2 ||
+	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
+	     base[size-1] != YY_END_OF_BUFFER_CHAR )
+		/* They forgot to leave room for the EOB's. */
+		return 0;
+
+	b = (YY_BUFFER_STATE) core_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in core_yy_scan_buffer()" );
+
+	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
+	b->yy_buf_pos = b->yy_ch_buf = base;
+	b->yy_is_our_buffer = 0;
+	b->yy_input_file = 0;
+	b->yy_n_chars = b->yy_buf_size;
+	b->yy_is_interactive = 0;
+	b->yy_at_bol = 1;
+	b->yy_fill_buffer = 0;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	core_yy_switch_to_buffer(b ,yyscanner );
+
+	return b;
+}
+
+/** Setup the input buffer state to scan a string. The next call to core_yylex() will
+ * scan from a @e copy of @a str.
+ * @param yystr a NUL-terminated string to scan
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ *       core_yy_scan_bytes() instead.
+ */
+
+
+/** Setup the input buffer state to scan the given bytes. The next call to core_yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
+ */
+
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
+{
+    	(void) fprintf( stderr, "%s\n", msg );
+	exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+		yytext[yyleng] = yyg->yy_hold_char; \
+		yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
+		yyg->yy_hold_char = *yyg->yy_c_buf_p; \
+		*yyg->yy_c_buf_p = '\0'; \
+		yyleng = yyless_macro_arg; \
+		} \
+	while ( 0 )
+
+/* Accessor  methods (get/set functions) to struct members. */
+
+/** Get the user-defined data for this scanner.
+ * @param yyscanner The scanner object.
+ */
+
+
+/** Get the current line number.
+ * @param yyscanner The scanner object.
+ */
+
+
+/** Get the current column number.
+ * @param yyscanner The scanner object.
+ */
+
+
+/** Get the input stream.
+ * @param yyscanner The scanner object.
+ */
+
+
+/** Get the output stream.
+ * @param yyscanner The scanner object.
+ */
+
+
+/** Get the length of the current token.
+ * @param yyscanner The scanner object.
+ */
+
+
+/** Get the current token.
+ * @param yyscanner The scanner object.
+ */
+
+
+
+/** Set the user-defined data. This data is never touched by the scanner.
+ * @param user_defined The data to be associated with this scanner.
+ * @param yyscanner The scanner object.
+ */
+void core_yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    yyextra = user_defined ;
+}
+
+/** Set the current line number.
+ * @param line_number
+ * @param yyscanner The scanner object.
+ */
+
+
+/** Set the current column.
+ * @param line_number
+ * @param yyscanner The scanner object.
+ */
+
+
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param in_str A readable stream.
+ * @param yyscanner The scanner object.
+ * @see core_yy_switch_to_buffer
+ */
+
+
+
+
+
+
+
+
+/* Accessor methods for yylval and yylloc */
+
+
+
+
+
+
+    
+
+    
+/* User-visible API */
+
+/* core_yylex_init is special because it creates the scanner itself, so it is
+ * the ONLY reentrant function that doesn't take the scanner as the last argument.
+ * That's why we explicitly handle the declaration, instead of using our macros.
+ */
+
+int core_yylex_init(yyscan_t* ptr_yy_globals)
+
+{
+    if (ptr_yy_globals == NULL){
+        errno = EINVAL;
+        return 1;
+    }
+
+    *ptr_yy_globals = (yyscan_t) core_yyalloc ( sizeof( struct yyguts_t ), NULL );
+
+    if (*ptr_yy_globals == NULL){
+        errno = ENOMEM;
+        return 1;
+    }
+
+    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
+    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+
+    return yy_init_globals ( *ptr_yy_globals );
+}
+
+/* core_yylex_init_extra has the same functionality as core_yylex_init, but follows the
+ * convention of taking the scanner as the last argument. Note however, that
+ * this is a *pointer* to a scanner, as it will be allocated by this call (and
+ * is the reason, too, why this function also must handle its own declaration).
+ * The user defined value in the first argument will be available to core_yyalloc in
+ * the yyextra field.
+ */
+
+
+
+static int yy_init_globals (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    /* Initialization is the same as for the non-reentrant scanner.
+     * This function is called from core_yylex_destroy(), so don't allocate here.
+     */
+
+    yyg->yy_buffer_stack = 0;
+    yyg->yy_buffer_stack_top = 0;
+    yyg->yy_buffer_stack_max = 0;
+    yyg->yy_c_buf_p = (char *) 0;
+    yyg->yy_init = 0;
+    yyg->yy_start = 0;
+
+    yyg->yy_start_stack_ptr = 0;
+    yyg->yy_start_stack_depth = 0;
+    yyg->yy_start_stack =  NULL;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+    yyin = stdin;
+    yyout = stdout;
+#else
+    yyin = (FILE *) 0;
+    yyout = (FILE *) 0;
+#endif
+
+    /* For future reference: Set errno on error, since we are called by
+     * core_yylex_init()
+     */
+    return 0;
+}
+
+/* core_yylex_destroy is for both reentrant and non-reentrant scanners. */
+
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
+{
+	register int i;
+	for ( i = 0; i < n; ++i )
+		s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
+{
+	register int n;
+	for ( n = 0; s[n]; ++n )
+		;
+
+	return n;
+}
+#endif
+
+#define YYTABLES_NAME "yytables"
+
+#line 1041 "scan.l"
+
+
+
+/*
+ * Arrange access to yyextra for subroutines of the main core_yylex() function.
+ * We expect each subroutine to have a yyscanner parameter.  Rather than
+ * use the yyget_xxx functions, which might or might not get inlined by the
+ * compiler, we cheat just a bit and cast yyscanner to the right type.
+ */
+#undef yyextra
+#define yyextra  (((struct yyguts_t *) yyscanner)->yyextra_r)
+
+/* Likewise for a couple of other things we need. */
+#undef yylloc
+#define yylloc  (((struct yyguts_t *) yyscanner)->yylloc_r)
+#undef yyleng
+#define yyleng  (((struct yyguts_t *) yyscanner)->yyleng_r)
+
+
+/*
+ * scanner_errposition
+ *		Report a lexer or grammar error cursor position, if possible.
+ *
+ * This is expected to be used within an ereport() call.  The return value
+ * is a dummy (always 0, in fact).
+ *
+ * Note that this can only be used for messages emitted during raw parsing
+ * (essentially, scan.l and gram.y), since it requires the yyscanner struct
+ * to still be available.
+ */
+int
+scanner_errposition(int location, core_yyscan_t yyscanner)
+{
+	int		pos;
+
+	if (location < 0)
+		return 0;				/* no-op if location is unknown */
+
+	/* Convert byte offset to character number */
+	pos = pg_mbstrlen_with_len(yyextra->scanbuf, location) + 1;
+	/* And pass it to the ereport mechanism */
+	return errposition(pos);
+}
+
+/*
+ * scanner_yyerror
+ *		Report a lexer or grammar error.
+ *
+ * The message's cursor position is whatever YYLLOC was last set to,
+ * ie, the start of the current token if called within core_yylex(), or the
+ * most recently lexed token if called from the grammar.
+ * This is OK for syntax error messages from the Bison parser, because Bison
+ * parsers report error as soon as the first unparsable token is reached.
+ * Beware of using yyerror for other purposes, as the cursor position might
+ * be misleading!
+ */
+void
+scanner_yyerror(const char *message, core_yyscan_t yyscanner)
+{
+	const char *loc = yyextra->scanbuf + *yylloc;
+
+	if (*loc == YY_END_OF_BUFFER_CHAR)
+	{
+		ereport(ERROR,
+				(errcode(ERRCODE_SYNTAX_ERROR),
+				 /* translator: %s is typically the translation of "syntax error" */
+				 errmsg("%s at end of input", _(message)),
+				 lexer_errposition()));
+	}
+	else
+	{
+		ereport(ERROR,
+				(errcode(ERRCODE_SYNTAX_ERROR),
+				 /* translator: first %s is typically the translation of "syntax error" */
+				 errmsg("%s at or near \"%s\"", _(message), loc),
+				 lexer_errposition()));
+	}
+}
+
+
+/*
+ * Called before any actual parsing is done
+ */
+core_yyscan_t
+scanner_init(const char *str,
+			 core_yy_extra_type *yyext,
+			 const ScanKeyword *keywords,
+			 int num_keywords)
+{
+	Size		slen = strlen(str);
+	yyscan_t	scanner;
+
+	if (core_yylex_init(&scanner) != 0)
+		elog(ERROR, "core_yylex_init() failed: %m");
+
+	core_yyset_extra(yyext, scanner);
+
+	yyext->keywords = keywords;
+	yyext->num_keywords = num_keywords;
+
+	yyext->backslash_quote = backslash_quote;
+	yyext->escape_string_warning = escape_string_warning;
+	yyext->standard_conforming_strings = standard_conforming_strings;
+
+	/*
+	 * Make a scan buffer with special termination needed by flex.
+	 */
+	yyext->scanbuf = (char *) palloc(slen + 2);
+	yyext->scanbuflen = slen;
+	memcpy(yyext->scanbuf, str, slen);
+	yyext->scanbuf[slen] = yyext->scanbuf[slen + 1] = YY_END_OF_BUFFER_CHAR;
+	core_yy_scan_buffer(yyext->scanbuf,slen + 2,scanner);
+
+	/* initialize literal buffer to a reasonable but expansible size */
+	yyext->literalalloc = 1024;
+	yyext->literalbuf = (char *) palloc(yyext->literalalloc);
+	yyext->literallen = 0;
+
+	return scanner;
+}
+
+
+/*
+ * Called after parsing is done to clean up after scanner_init()
+ */
+void
+scanner_finish(core_yyscan_t yyscanner)
+{
+	/*
+	 * We don't bother to call core_yylex_destroy(), because all it would do
+	 * is pfree a small amount of control storage.  It's cheaper to leak
+	 * the storage until the parsing context is destroyed.  The amount of
+	 * space involved is usually negligible compared to the output parse
+	 * tree anyway.
+	 *
+	 * We do bother to pfree the scanbuf and literal buffer, but only if they
+	 * represent a nontrivial amount of space.  The 8K cutoff is arbitrary.
+	 */
+	if (yyextra->scanbuflen >= 8192)
+		pfree(yyextra->scanbuf);
+	if (yyextra->literalalloc >= 8192)
+		pfree(yyextra->literalbuf);
+}
+
+
+static void
+addlit(char *ytext, int yleng, core_yyscan_t yyscanner)
+{
+	/* enlarge buffer if needed */
+	if ((yyextra->literallen + yleng) >= yyextra->literalalloc)
+	{
+		do {
+			yyextra->literalalloc *= 2;
+		} while ((yyextra->literallen + yleng) >= yyextra->literalalloc);
+		yyextra->literalbuf = (char *) repalloc(yyextra->literalbuf,
+												yyextra->literalalloc);
+	}
+	/* append new data */
+	memcpy(yyextra->literalbuf + yyextra->literallen, ytext, yleng);
+	yyextra->literallen += yleng;
+}
+
+
+static void
+addlitchar(unsigned char ychar, core_yyscan_t yyscanner)
+{
+	/* enlarge buffer if needed */
+	if ((yyextra->literallen + 1) >= yyextra->literalalloc)
+	{
+		yyextra->literalalloc *= 2;
+		yyextra->literalbuf = (char *) repalloc(yyextra->literalbuf,
+												yyextra->literalalloc);
+	}
+	/* append new data */
+	yyextra->literalbuf[yyextra->literallen] = ychar;
+	yyextra->literallen += 1;
+}
+
+
+/*
+ * Create a palloc'd copy of literalbuf, adding a trailing null.
+ */
+static char *
+litbufdup(core_yyscan_t yyscanner)
+{
+	int			llen = yyextra->literallen;
+	char	   *new;
+
+	new = palloc(llen + 1);
+	memcpy(new, yyextra->literalbuf, llen);
+	new[llen] = '\0';
+	return new;
+}
+
+static int
+process_integer_literal(const char *token, YYSTYPE *lval)
+{
+	long		val;
+	char	   *endptr;
+
+	errno = 0;
+	val = strtol(token, &endptr, 10);
+	if (*endptr != '\0' || errno == ERANGE
+#ifdef HAVE_LONG_INT_64
+		/* if long > 32 bits, check for overflow of int4 */
+		|| val != (long) ((int32) val)
+#endif
+		)
+	{
+		/* integer too large, treat it as a float */
+		lval->str = pstrdup(token);
+		return FCONST;
+	}
+	lval->ival = val;
+	return ICONST;
+}
+
+static unsigned int
+hexval(unsigned char c)
+{
+	if (c >= '0' && c <= '9')
+		return c - '0';
+	if (c >= 'a' && c <= 'f')
+		return c - 'a' + 0xA;
+	if (c >= 'A' && c <= 'F')
+		return c - 'A' + 0xA;
+	elog(ERROR, "invalid hexadecimal digit");
+	return 0; /* not reached */
+}
+
+static void
+check_unicode_value(pg_wchar c, char *loc, core_yyscan_t yyscanner)
+{
+	if (GetDatabaseEncoding() == PG_UTF8)
+		return;
+
+	if (c > 0x7F)
+	{
+		ADVANCE_YYLLOC(loc - yyextra->literalbuf + 3);   /* 3 for U&" */
+		yyerror("Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8");
+	}
+}
+
+static bool
+is_utf16_surrogate_first(pg_wchar c)
+{
+	return (c >= 0xD800 && c <= 0xDBFF);
+}
+
+static bool
+is_utf16_surrogate_second(pg_wchar c)
+{
+	return (c >= 0xDC00 && c <= 0xDFFF);
+}
+
+static pg_wchar
+surrogate_pair_to_codepoint(pg_wchar first, pg_wchar second)
+{
+	return ((first & 0x3FF) << 10) + 0x10000 + (second & 0x3FF);
+}
+
+static void
+addunicode(pg_wchar c, core_yyscan_t yyscanner)
+{
+	char buf[8];
+
+	if (c == 0 || c > 0x10FFFF)
+		yyerror("invalid Unicode escape value");
+	if (c > 0x7F)
+	{
+		if (GetDatabaseEncoding() != PG_UTF8)
+			yyerror("Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8");
+		yyextra->saw_non_ascii = true;
+	}
+	unicode_to_utf8(c, (unsigned char *) buf);
+	addlit(buf, pg_mblen(buf), yyscanner);
+}
+
+/* is 'escape' acceptable as Unicode escape character (UESCAPE syntax) ? */
+static bool
+check_uescapechar(unsigned char escape)
+{
+	if (isxdigit(escape)
+		|| escape == '+'
+		|| escape == '\''
+		|| escape == '"'
+		|| scanner_isspace(escape))
+	{
+		return false;
+	}
+	else
+		return true;
+}
+
+/* like litbufdup, but handle unicode escapes */
+static char *
+litbuf_udeescape(unsigned char escape, core_yyscan_t yyscanner)
+{
+	char *new;
+	char *litbuf, *in, *out;
+	pg_wchar pair_first = 0;
+
+	/* Make literalbuf null-terminated to simplify the scanning loop */
+	litbuf = yyextra->literalbuf;
+	litbuf[yyextra->literallen] = '\0';
+
+	/*
+	 * This relies on the subtle assumption that a UTF-8 expansion
+	 * cannot be longer than its escaped representation.
+	 */
+	new = palloc(yyextra->literallen + 1);
+
+	in = litbuf;
+	out = new;
+	while (*in)
+	{
+		if (in[0] == escape)
+		{
+			if (in[1] == escape)
+			{
+				if (pair_first)
+				{
+					ADVANCE_YYLLOC(in - litbuf + 3);   /* 3 for U&" */
+					yyerror("invalid Unicode surrogate pair");
+				}
+				*out++ = escape;
+				in += 2;
+			}
+			else if (isxdigit((unsigned char) in[1]) &&
+					 isxdigit((unsigned char) in[2]) &&
+					 isxdigit((unsigned char) in[3]) &&
+					 isxdigit((unsigned char) in[4]))
+			{
+				pg_wchar unicode;
+
+				unicode = (hexval(in[1]) << 12) +
+					(hexval(in[2]) << 8) +
+					(hexval(in[3]) << 4) +
+					hexval(in[4]);
+				check_unicode_value(unicode, in, yyscanner);
+				if (pair_first)
+				{
+					if (is_utf16_surrogate_second(unicode))
+					{
+						unicode = surrogate_pair_to_codepoint(pair_first, unicode);
+						pair_first = 0;
+					}
+					else
+					{
+						ADVANCE_YYLLOC(in - litbuf + 3);   /* 3 for U&" */
+						yyerror("invalid Unicode surrogate pair");
+					}
+				}
+				else if (is_utf16_surrogate_second(unicode))
+					yyerror("invalid Unicode surrogate pair");
+
+				if (is_utf16_surrogate_first(unicode))
+					pair_first = unicode;
+				else
+				{
+					unicode_to_utf8(unicode, (unsigned char *) out);
+					out += pg_mblen(out);
+				}
+				in += 5;
+			}
+			else if (in[1] == '+' &&
+					 isxdigit((unsigned char) in[2]) &&
+					 isxdigit((unsigned char) in[3]) &&
+					 isxdigit((unsigned char) in[4]) &&
+					 isxdigit((unsigned char) in[5]) &&
+					 isxdigit((unsigned char) in[6]) &&
+					 isxdigit((unsigned char) in[7]))
+			{
+				pg_wchar unicode;
+
+				unicode = (hexval(in[2]) << 20) +
+					(hexval(in[3]) << 16) +
+					(hexval(in[4]) << 12) +
+					(hexval(in[5]) << 8) +
+					(hexval(in[6]) << 4) +
+					hexval(in[7]);
+				check_unicode_value(unicode, in, yyscanner);
+				if (pair_first)
+				{
+					if (is_utf16_surrogate_second(unicode))
+					{
+						unicode = surrogate_pair_to_codepoint(pair_first, unicode);
+						pair_first = 0;
+					}
+					else
+					{
+						ADVANCE_YYLLOC(in - litbuf + 3);   /* 3 for U&" */
+						yyerror("invalid Unicode surrogate pair");
+					}
+				}
+				else if (is_utf16_surrogate_second(unicode))
+					yyerror("invalid Unicode surrogate pair");
+
+				if (is_utf16_surrogate_first(unicode))
+					pair_first = unicode;
+				else
+				{
+					unicode_to_utf8(unicode, (unsigned char *) out);
+					out += pg_mblen(out);
+				}
+				in += 8;
+			}
+			else
+			{
+				ADVANCE_YYLLOC(in - litbuf + 3);   /* 3 for U&" */
+				yyerror("invalid Unicode escape value");
+			}
+		}
+		else
+		{
+			if (pair_first)
+			{
+				ADVANCE_YYLLOC(in - litbuf + 3);   /* 3 for U&" */
+				yyerror("invalid Unicode surrogate pair");
+			}
+			*out++ = *in++;
+		}
+	}
+
+	*out = '\0';
+	/*
+	 * We could skip pg_verifymbstr if we didn't process any non-7-bit-ASCII
+	 * codes; but it's probably not worth the trouble, since this isn't
+	 * likely to be a performance-critical path.
+	 */
+	pg_verifymbstr(new, out - new, false);
+	return new;
+}
+
+static unsigned char
+unescape_single_char(unsigned char c, core_yyscan_t yyscanner)
+{
+	switch (c)
+	{
+		case 'b':
+			return '\b';
+		case 'f':
+			return '\f';
+		case 'n':
+			return '\n';
+		case 'r':
+			return '\r';
+		case 't':
+			return '\t';
+		default:
+			/* check for backslash followed by non-7-bit-ASCII */
+			if (c == '\0' || IS_HIGHBIT_SET(c))
+				yyextra->saw_non_ascii = true;
+
+			return c;
+	}
+}
+
+static void
+check_string_escape_warning(unsigned char ychar, core_yyscan_t yyscanner)
+{
+	if (ychar == '\'')
+	{
+		if (yyextra->warn_on_first_escape && yyextra->escape_string_warning)
+			ereport(WARNING,
+					(errcode(ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER),
+					 errmsg("nonstandard use of \\' in a string literal"),
+					 errhint("Use '' to write quotes in strings, or use the escape string syntax (E'...')."),
+					 lexer_errposition()));
+		yyextra->warn_on_first_escape = false;	/* warn only once per string */
+	}
+	else if (ychar == '\\')
+	{
+		if (yyextra->warn_on_first_escape && yyextra->escape_string_warning)
+			ereport(WARNING,
+					(errcode(ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER),
+					 errmsg("nonstandard use of \\\\ in a string literal"),
+					 errhint("Use the escape string syntax for backslashes, e.g., E'\\\\'."),
+					 lexer_errposition()));
+		yyextra->warn_on_first_escape = false;	/* warn only once per string */
+	}
+	else
+		check_escape_warning(yyscanner);
+}
+
+static void
+check_escape_warning(core_yyscan_t yyscanner)
+{
+	if (yyextra->warn_on_first_escape && yyextra->escape_string_warning)
+		ereport(WARNING,
+				(errcode(ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER),
+				 errmsg("nonstandard use of escape in a string literal"),
+				 errhint("Use the escape string syntax for escapes, e.g., E'\\r\\n'."),
+				 lexer_errposition()));
+	yyextra->warn_on_first_escape = false;	/* warn only once per string */
+}
+
+/*
+ * Interface functions to make flex use palloc() instead of malloc().
+ * It'd be better to make these static, but flex insists otherwise.
+ */
+
+void *
+core_yyalloc(yy_size_t bytes, core_yyscan_t yyscanner)
+{
+	return palloc(bytes);
+}
+
+void *
+core_yyrealloc(void *ptr, yy_size_t bytes, core_yyscan_t yyscanner)
+{
+	if (ptr)
+		return repalloc(ptr, bytes);
+	else
+		return palloc(bytes);
+}
+
+
+
diff --git a/foreign/libpg_query/src/postgres/src_backend_catalog_namespace.c b/foreign/libpg_query/src/postgres/src_backend_catalog_namespace.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_catalog_namespace.c
@@ -0,0 +1,963 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - NameListToString
+ * - get_collation_oid
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * namespace.c
+ *	  code to support accessing and searching namespaces
+ *
+ * This is separate from pg_namespace.c, which contains the routines that
+ * directly manipulate the pg_namespace system catalog.  This module
+ * provides routines associated with defining a "namespace search path"
+ * and implementing search-path-controlled searches.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ *	  src/backend/catalog/namespace.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include "access/htup_details.h"
+#include "access/parallel.h"
+#include "access/xact.h"
+#include "access/xlog.h"
+#include "catalog/dependency.h"
+#include "catalog/objectaccess.h"
+#include "catalog/pg_authid.h"
+#include "catalog/pg_collation.h"
+#include "catalog/pg_conversion.h"
+#include "catalog/pg_conversion_fn.h"
+#include "catalog/pg_namespace.h"
+#include "catalog/pg_opclass.h"
+#include "catalog/pg_operator.h"
+#include "catalog/pg_opfamily.h"
+#include "catalog/pg_proc.h"
+#include "catalog/pg_ts_config.h"
+#include "catalog/pg_ts_dict.h"
+#include "catalog/pg_ts_parser.h"
+#include "catalog/pg_ts_template.h"
+#include "catalog/pg_type.h"
+#include "commands/dbcommands.h"
+#include "funcapi.h"
+#include "mb/pg_wchar.h"
+#include "miscadmin.h"
+#include "nodes/makefuncs.h"
+#include "parser/parse_func.h"
+#include "storage/ipc.h"
+#include "storage/lmgr.h"
+#include "storage/sinval.h"
+#include "utils/acl.h"
+#include "utils/builtins.h"
+#include "utils/catcache.h"
+#include "utils/guc.h"
+#include "utils/inval.h"
+#include "utils/lsyscache.h"
+#include "utils/memutils.h"
+#include "utils/syscache.h"
+
+
+/*
+ * The namespace search path is a possibly-empty list of namespace OIDs.
+ * In addition to the explicit list, implicitly-searched namespaces
+ * may be included:
+ *
+ * 1. If a TEMP table namespace has been initialized in this session, it
+ * is implicitly searched first.  (The only time this doesn't happen is
+ * when we are obeying an override search path spec that says not to use the
+ * temp namespace, or the temp namespace is included in the explicit list.)
+ *
+ * 2. The system catalog namespace is always searched.  If the system
+ * namespace is present in the explicit path then it will be searched in
+ * the specified order; otherwise it will be searched after TEMP tables and
+ * *before* the explicit list.  (It might seem that the system namespace
+ * should be implicitly last, but this behavior appears to be required by
+ * SQL99.  Also, this provides a way to search the system namespace first
+ * without thereby making it the default creation target namespace.)
+ *
+ * For security reasons, searches using the search path will ignore the temp
+ * namespace when searching for any object type other than relations and
+ * types.  (We must allow types since temp tables have rowtypes.)
+ *
+ * The default creation target namespace is always the first element of the
+ * explicit list.  If the explicit list is empty, there is no default target.
+ *
+ * The textual specification of search_path can include "$user" to refer to
+ * the namespace named the same as the current user, if any.  (This is just
+ * ignored if there is no such namespace.)	Also, it can include "pg_temp"
+ * to refer to the current backend's temp namespace.  This is usually also
+ * ignorable if the temp namespace hasn't been set up, but there's a special
+ * case: if "pg_temp" appears first then it should be the default creation
+ * target.  We kluge this case a little bit so that the temp namespace isn't
+ * set up until the first attempt to create something in it.  (The reason for
+ * klugery is that we can't create the temp namespace outside a transaction,
+ * but initial GUC processing of search_path happens outside a transaction.)
+ * activeTempCreationPending is TRUE if "pg_temp" appears first in the string
+ * but is not reflected in activeCreationNamespace because the namespace isn't
+ * set up yet.
+ *
+ * In bootstrap mode, the search path is set equal to "pg_catalog", so that
+ * the system namespace is the only one searched or inserted into.
+ * initdb is also careful to set search_path to "pg_catalog" for its
+ * post-bootstrap standalone backend runs.  Otherwise the default search
+ * path is determined by GUC.  The factory default path contains the PUBLIC
+ * namespace (if it exists), preceded by the user's personal namespace
+ * (if one exists).
+ *
+ * We support a stack of "override" search path settings for use within
+ * specific sections of backend code.  namespace_search_path is ignored
+ * whenever the override stack is nonempty.  activeSearchPath is always
+ * the actually active path; it points either to the search list of the
+ * topmost stack entry, or to baseSearchPath which is the list derived
+ * from namespace_search_path.
+ *
+ * If baseSearchPathValid is false, then baseSearchPath (and other
+ * derived variables) need to be recomputed from namespace_search_path.
+ * We mark it invalid upon an assignment to namespace_search_path or receipt
+ * of a syscache invalidation event for pg_namespace.  The recomputation
+ * is done during the next non-overridden lookup attempt.  Note that an
+ * override spec is never subject to recomputation.
+ *
+ * Any namespaces mentioned in namespace_search_path that are not readable
+ * by the current user ID are simply left out of baseSearchPath; so
+ * we have to be willing to recompute the path when current userid changes.
+ * namespaceUser is the userid the path has been computed for.
+ *
+ * Note: all data pointed to by these List variables is in TopMemoryContext.
+ */
+
+/* These variables define the actually active state: */
+
+
+
+/* default place to create stuff; if InvalidOid, no default */
+
+
+/* if TRUE, activeCreationNamespace is wrong, it should be temp namespace */
+
+
+/* These variables are the values last derived from namespace_search_path: */
+
+
+
+
+
+
+
+
+
+/* The above four values are valid only if baseSearchPathValid */
+
+
+/* Override requests are remembered in a stack of OverrideStackEntry structs */
+
+typedef struct
+{
+	List	   *searchPath;		/* the desired search path */
+	Oid			creationNamespace;		/* the desired creation namespace */
+	int			nestLevel;		/* subtransaction nesting level */
+} OverrideStackEntry;
+
+
+
+/*
+ * myTempNamespace is InvalidOid until and unless a TEMP namespace is set up
+ * in a particular backend session (this happens when a CREATE TEMP TABLE
+ * command is first executed).  Thereafter it's the OID of the temp namespace.
+ *
+ * myTempToastNamespace is the OID of the namespace for my temp tables' toast
+ * tables.  It is set when myTempNamespace is, and is InvalidOid before that.
+ *
+ * myTempNamespaceSubID shows whether we've created the TEMP namespace in the
+ * current subtransaction.  The flag propagates up the subtransaction tree,
+ * so the main transaction will correctly recognize the flag if all
+ * intermediate subtransactions commit.  When it is InvalidSubTransactionId,
+ * we either haven't made the TEMP namespace yet, or have successfully
+ * committed its creation, depending on whether myTempNamespace is valid.
+ */
+
+
+
+
+
+
+/*
+ * This is the user's textual search path specification --- it's the value
+ * of the GUC variable 'search_path'.
+ */
+
+
+
+/* Local functions */
+static void recomputeNamespacePath(void);
+static void InitTempTableNamespace(void);
+static void RemoveTempRelations(Oid tempNamespaceId);
+static void RemoveTempRelationsCallback(int code, Datum arg);
+static void NamespaceCallback(Datum arg, int cacheid, uint32 hashvalue);
+static bool MatchNamedCall(HeapTuple proctup, int nargs, List *argnames,
+			   int **argnumbers);
+
+/* These don't really need to appear in any header file */
+Datum		pg_table_is_visible(PG_FUNCTION_ARGS);
+Datum		pg_type_is_visible(PG_FUNCTION_ARGS);
+Datum		pg_function_is_visible(PG_FUNCTION_ARGS);
+Datum		pg_operator_is_visible(PG_FUNCTION_ARGS);
+Datum		pg_opclass_is_visible(PG_FUNCTION_ARGS);
+Datum		pg_opfamily_is_visible(PG_FUNCTION_ARGS);
+Datum		pg_collation_is_visible(PG_FUNCTION_ARGS);
+Datum		pg_conversion_is_visible(PG_FUNCTION_ARGS);
+Datum		pg_ts_parser_is_visible(PG_FUNCTION_ARGS);
+Datum		pg_ts_dict_is_visible(PG_FUNCTION_ARGS);
+Datum		pg_ts_template_is_visible(PG_FUNCTION_ARGS);
+Datum		pg_ts_config_is_visible(PG_FUNCTION_ARGS);
+Datum		pg_my_temp_schema(PG_FUNCTION_ARGS);
+Datum		pg_is_other_temp_schema(PG_FUNCTION_ARGS);
+
+
+/*
+ * RangeVarGetRelid
+ *		Given a RangeVar describing an existing relation,
+ *		select the proper namespace and look up the relation OID.
+ *
+ * If the schema or relation is not found, return InvalidOid if missing_ok
+ * = true, otherwise raise an error.
+ *
+ * If nowait = true, throw an error if we'd have to wait for a lock.
+ *
+ * Callback allows caller to check permissions or acquire additional locks
+ * prior to grabbing the relation lock.
+ */
+
+
+/*
+ * RangeVarGetCreationNamespace
+ *		Given a RangeVar describing a to-be-created relation,
+ *		choose which namespace to create it in.
+ *
+ * Note: calling this may result in a CommandCounterIncrement operation.
+ * That will happen on the first request for a temp table in any particular
+ * backend run; we will need to either create or clean out the temp schema.
+ */
+
+
+/*
+ * RangeVarGetAndCheckCreationNamespace
+ *
+ * This function returns the OID of the namespace in which a new relation
+ * with a given name should be created.  If the user does not have CREATE
+ * permission on the target namespace, this function will instead signal
+ * an ERROR.
+ *
+ * If non-NULL, *existing_oid is set to the OID of any existing relation with
+ * the same name which already exists in that namespace, or to InvalidOid if
+ * no such relation exists.
+ *
+ * If lockmode != NoLock, the specified lock mode is acquired on the existing
+ * relation, if any, provided that the current user owns the target relation.
+ * However, if lockmode != NoLock and the user does not own the target
+ * relation, we throw an ERROR, as we must not try to lock relations the
+ * user does not have permissions on.
+ *
+ * As a side effect, this function acquires AccessShareLock on the target
+ * namespace.  Without this, the namespace could be dropped before our
+ * transaction commits, leaving behind relations with relnamespace pointing
+ * to a no-longer-exstant namespace.
+ *
+ * As a further side-effect, if the select namespace is a temporary namespace,
+ * we mark the RangeVar as RELPERSISTENCE_TEMP.
+ */
+
+
+/*
+ * Adjust the relpersistence for an about-to-be-created relation based on the
+ * creation namespace, and throw an error for invalid combinations.
+ */
+
+
+/*
+ * RelnameGetRelid
+ *		Try to resolve an unqualified relation name.
+ *		Returns OID if relation found in search path, else InvalidOid.
+ */
+
+
+
+/*
+ * RelationIsVisible
+ *		Determine whether a relation (identified by OID) is visible in the
+ *		current search path.  Visible means "would be found by searching
+ *		for the unqualified relation name".
+ */
+
+
+
+/*
+ * TypenameGetTypid
+ *		Try to resolve an unqualified datatype name.
+ *		Returns OID if type found in search path, else InvalidOid.
+ *
+ * This is essentially the same as RelnameGetRelid.
+ */
+
+
+/*
+ * TypeIsVisible
+ *		Determine whether a type (identified by OID) is visible in the
+ *		current search path.  Visible means "would be found by searching
+ *		for the unqualified type name".
+ */
+
+
+
+/*
+ * FuncnameGetCandidates
+ *		Given a possibly-qualified function name and argument count,
+ *		retrieve a list of the possible matches.
+ *
+ * If nargs is -1, we return all functions matching the given name,
+ * regardless of argument count.  (argnames must be NIL, and expand_variadic
+ * and expand_defaults must be false, in this case.)
+ *
+ * If argnames isn't NIL, we are considering a named- or mixed-notation call,
+ * and only functions having all the listed argument names will be returned.
+ * (We assume that length(argnames) <= nargs and all the passed-in names are
+ * distinct.)  The returned structs will include an argnumbers array showing
+ * the actual argument index for each logical argument position.
+ *
+ * If expand_variadic is true, then variadic functions having the same number
+ * or fewer arguments will be retrieved, with the variadic argument and any
+ * additional argument positions filled with the variadic element type.
+ * nvargs in the returned struct is set to the number of such arguments.
+ * If expand_variadic is false, variadic arguments are not treated specially,
+ * and the returned nvargs will always be zero.
+ *
+ * If expand_defaults is true, functions that could match after insertion of
+ * default argument values will also be retrieved.  In this case the returned
+ * structs could have nargs > passed-in nargs, and ndargs is set to the number
+ * of additional args (which can be retrieved from the function's
+ * proargdefaults entry).
+ *
+ * It is not possible for nvargs and ndargs to both be nonzero in the same
+ * list entry, since default insertion allows matches to functions with more
+ * than nargs arguments while the variadic transformation requires the same
+ * number or less.
+ *
+ * When argnames isn't NIL, the returned args[] type arrays are not ordered
+ * according to the functions' declarations, but rather according to the call:
+ * first any positional arguments, then the named arguments, then defaulted
+ * arguments (if needed and allowed by expand_defaults).  The argnumbers[]
+ * array can be used to map this back to the catalog information.
+ * argnumbers[k] is set to the proargtypes index of the k'th call argument.
+ *
+ * We search a single namespace if the function name is qualified, else
+ * all namespaces in the search path.  In the multiple-namespace case,
+ * we arrange for entries in earlier namespaces to mask identical entries in
+ * later namespaces.
+ *
+ * When expanding variadics, we arrange for non-variadic functions to mask
+ * variadic ones if the expanded argument list is the same.  It is still
+ * possible for there to be conflicts between different variadic functions,
+ * however.
+ *
+ * It is guaranteed that the return list will never contain multiple entries
+ * with identical argument lists.  When expand_defaults is true, the entries
+ * could have more than nargs positions, but we still guarantee that they are
+ * distinct in the first nargs positions.  However, if argnames isn't NIL or
+ * either expand_variadic or expand_defaults is true, there might be multiple
+ * candidate functions that expand to identical argument lists.  Rather than
+ * throw error here, we report such situations by returning a single entry
+ * with oid = 0 that represents a set of such conflicting candidates.
+ * The caller might end up discarding such an entry anyway, but if it selects
+ * such an entry it should react as though the call were ambiguous.
+ *
+ * If missing_ok is true, an empty list (NULL) is returned if the name was
+ * schema- qualified with a schema that does not exist.  Likewise if no
+ * candidate is found for other reasons.
+ */
+
+
+/*
+ * MatchNamedCall
+ *		Given a pg_proc heap tuple and a call's list of argument names,
+ *		check whether the function could match the call.
+ *
+ * The call could match if all supplied argument names are accepted by
+ * the function, in positions after the last positional argument, and there
+ * are defaults for all unsupplied arguments.
+ *
+ * The number of positional arguments is nargs - list_length(argnames).
+ * Note caller has already done basic checks on argument count.
+ *
+ * On match, return true and fill *argnumbers with a palloc'd array showing
+ * the mapping from call argument positions to actual function argument
+ * numbers.  Defaulted arguments are included in this map, at positions
+ * after the last supplied argument.
+ */
+
+
+/*
+ * FunctionIsVisible
+ *		Determine whether a function (identified by OID) is visible in the
+ *		current search path.  Visible means "would be found by searching
+ *		for the unqualified function name with exact argument matches".
+ */
+
+
+
+/*
+ * OpernameGetOprid
+ *		Given a possibly-qualified operator name and exact input datatypes,
+ *		look up the operator.  Returns InvalidOid if not found.
+ *
+ * Pass oprleft = InvalidOid for a prefix op, oprright = InvalidOid for
+ * a postfix op.
+ *
+ * If the operator name is not schema-qualified, it is sought in the current
+ * namespace search path.  If the name is schema-qualified and the given
+ * schema does not exist, InvalidOid is returned.
+ */
+
+
+/*
+ * OpernameGetCandidates
+ *		Given a possibly-qualified operator name and operator kind,
+ *		retrieve a list of the possible matches.
+ *
+ * If oprkind is '\0', we return all operators matching the given name,
+ * regardless of arguments.
+ *
+ * We search a single namespace if the operator name is qualified, else
+ * all namespaces in the search path.  The return list will never contain
+ * multiple entries with identical argument lists --- in the multiple-
+ * namespace case, we arrange for entries in earlier namespaces to mask
+ * identical entries in later namespaces.
+ *
+ * The returned items always have two args[] entries --- one or the other
+ * will be InvalidOid for a prefix or postfix oprkind.  nargs is 2, too.
+ */
+#define SPACE_PER_OP MAXALIGN(offsetof(struct _FuncCandidateList, args) + \
+							  2 * sizeof(Oid))
+
+/*
+ * OperatorIsVisible
+ *		Determine whether an operator (identified by OID) is visible in the
+ *		current search path.  Visible means "would be found by searching
+ *		for the unqualified operator name with exact argument matches".
+ */
+
+
+
+/*
+ * OpclassnameGetOpcid
+ *		Try to resolve an unqualified index opclass name.
+ *		Returns OID if opclass found in search path, else InvalidOid.
+ *
+ * This is essentially the same as TypenameGetTypid, but we have to have
+ * an extra argument for the index AM OID.
+ */
+
+
+/*
+ * OpclassIsVisible
+ *		Determine whether an opclass (identified by OID) is visible in the
+ *		current search path.  Visible means "would be found by searching
+ *		for the unqualified opclass name".
+ */
+
+
+/*
+ * OpfamilynameGetOpfid
+ *		Try to resolve an unqualified index opfamily name.
+ *		Returns OID if opfamily found in search path, else InvalidOid.
+ *
+ * This is essentially the same as TypenameGetTypid, but we have to have
+ * an extra argument for the index AM OID.
+ */
+
+
+/*
+ * OpfamilyIsVisible
+ *		Determine whether an opfamily (identified by OID) is visible in the
+ *		current search path.  Visible means "would be found by searching
+ *		for the unqualified opfamily name".
+ */
+
+
+/*
+ * CollationGetCollid
+ *		Try to resolve an unqualified collation name.
+ *		Returns OID if collation found in search path, else InvalidOid.
+ */
+
+
+/*
+ * CollationIsVisible
+ *		Determine whether a collation (identified by OID) is visible in the
+ *		current search path.  Visible means "would be found by searching
+ *		for the unqualified collation name".
+ */
+
+
+
+/*
+ * ConversionGetConid
+ *		Try to resolve an unqualified conversion name.
+ *		Returns OID if conversion found in search path, else InvalidOid.
+ *
+ * This is essentially the same as RelnameGetRelid.
+ */
+
+
+/*
+ * ConversionIsVisible
+ *		Determine whether a conversion (identified by OID) is visible in the
+ *		current search path.  Visible means "would be found by searching
+ *		for the unqualified conversion name".
+ */
+
+
+/*
+ * get_ts_parser_oid - find a TS parser by possibly qualified name
+ *
+ * If not found, returns InvalidOid if missing_ok, else throws error
+ */
+
+
+/*
+ * TSParserIsVisible
+ *		Determine whether a parser (identified by OID) is visible in the
+ *		current search path.  Visible means "would be found by searching
+ *		for the unqualified parser name".
+ */
+
+
+/*
+ * get_ts_dict_oid - find a TS dictionary by possibly qualified name
+ *
+ * If not found, returns InvalidOid if failOK, else throws error
+ */
+
+
+/*
+ * TSDictionaryIsVisible
+ *		Determine whether a dictionary (identified by OID) is visible in the
+ *		current search path.  Visible means "would be found by searching
+ *		for the unqualified dictionary name".
+ */
+
+
+/*
+ * get_ts_template_oid - find a TS template by possibly qualified name
+ *
+ * If not found, returns InvalidOid if missing_ok, else throws error
+ */
+
+
+/*
+ * TSTemplateIsVisible
+ *		Determine whether a template (identified by OID) is visible in the
+ *		current search path.  Visible means "would be found by searching
+ *		for the unqualified template name".
+ */
+
+
+/*
+ * get_ts_config_oid - find a TS config by possibly qualified name
+ *
+ * If not found, returns InvalidOid if missing_ok, else throws error
+ */
+
+
+/*
+ * TSConfigIsVisible
+ *		Determine whether a text search configuration (identified by OID)
+ *		is visible in the current search path.  Visible means "would be found
+ *		by searching for the unqualified text search configuration name".
+ */
+
+
+
+/*
+ * DeconstructQualifiedName
+ *		Given a possibly-qualified name expressed as a list of String nodes,
+ *		extract the schema name and object name.
+ *
+ * *nspname_p is set to NULL if there is no explicit schema name.
+ */
+
+
+/*
+ * LookupNamespaceNoError
+ *		Look up a schema name.
+ *
+ * Returns the namespace OID, or InvalidOid if not found.
+ *
+ * Note this does NOT perform any permissions check --- callers are
+ * responsible for being sure that an appropriate check is made.
+ * In the majority of cases LookupExplicitNamespace is preferable.
+ */
+
+
+/*
+ * LookupExplicitNamespace
+ *		Process an explicitly-specified schema name: look up the schema
+ *		and verify we have USAGE (lookup) rights in it.
+ *
+ * Returns the namespace OID
+ */
+
+
+/*
+ * LookupCreationNamespace
+ *		Look up the schema and verify we have CREATE rights on it.
+ *
+ * This is just like LookupExplicitNamespace except for the different
+ * permission check, and that we are willing to create pg_temp if needed.
+ *
+ * Note: calling this may result in a CommandCounterIncrement operation,
+ * if we have to create or clean out the temp namespace.
+ */
+
+
+/*
+ * Common checks on switching namespaces.
+ *
+ * We complain if (1) the old and new namespaces are the same, (2) either the
+ * old or new namespaces is a temporary schema (or temporary toast schema), or
+ * (3) either the old or new namespaces is the TOAST schema.
+ */
+
+
+/*
+ * QualifiedNameGetCreationNamespace
+ *		Given a possibly-qualified name for an object (in List-of-Values
+ *		format), determine what namespace the object should be created in.
+ *		Also extract and return the object name (last component of list).
+ *
+ * Note: this does not apply any permissions check.  Callers must check
+ * for CREATE rights on the selected namespace when appropriate.
+ *
+ * Note: calling this may result in a CommandCounterIncrement operation,
+ * if we have to create or clean out the temp namespace.
+ */
+
+
+/*
+ * get_namespace_oid - given a namespace name, look up the OID
+ *
+ * If missing_ok is false, throw an error if namespace name not found.  If
+ * true, just return InvalidOid.
+ */
+
+
+/*
+ * makeRangeVarFromNameList
+ *		Utility routine to convert a qualified-name list into RangeVar form.
+ */
+
+
+/*
+ * NameListToString
+ *		Utility routine to convert a qualified-name list into a string.
+ *
+ * This is used primarily to form error messages, and so we do not quote
+ * the list elements, for the sake of legibility.
+ *
+ * In most scenarios the list elements should always be Value strings,
+ * but we also allow A_Star for the convenience of ColumnRef processing.
+ */
+char *
+NameListToString(List *names)
+{
+	StringInfoData string;
+	ListCell   *l;
+
+	initStringInfo(&string);
+
+	foreach(l, names)
+	{
+		Node	   *name = (Node *) lfirst(l);
+
+		if (l != list_head(names))
+			appendStringInfoChar(&string, '.');
+
+		if (IsA(name, String))
+			appendStringInfoString(&string, strVal(name));
+		else if (IsA(name, A_Star))
+			appendStringInfoChar(&string, '*');
+		else
+			elog(ERROR, "unexpected node type in name list: %d",
+				 (int) nodeTag(name));
+	}
+
+	return string.data;
+}
+
+/*
+ * NameListToQuotedString
+ *		Utility routine to convert a qualified-name list into a string.
+ *
+ * Same as above except that names will be double-quoted where necessary,
+ * so the string could be re-parsed (eg, by textToQualifiedNameList).
+ */
+
+
+/*
+ * isTempNamespace - is the given namespace my temporary-table namespace?
+ */
+
+
+/*
+ * isTempToastNamespace - is the given namespace my temporary-toast-table
+ *		namespace?
+ */
+
+
+/*
+ * isTempOrTempToastNamespace - is the given namespace my temporary-table
+ *		namespace or my temporary-toast-table namespace?
+ */
+
+
+/*
+ * isAnyTempNamespace - is the given namespace a temporary-table namespace
+ * (either my own, or another backend's)?  Temporary-toast-table namespaces
+ * are included, too.
+ */
+
+
+/*
+ * isOtherTempNamespace - is the given namespace some other backend's
+ * temporary-table namespace (including temporary-toast-table namespaces)?
+ *
+ * Note: for most purposes in the C code, this function is obsolete.  Use
+ * RELATION_IS_OTHER_TEMP() instead to detect non-local temp relations.
+ */
+
+
+/*
+ * GetTempNamespaceBackendId - if the given namespace is a temporary-table
+ * namespace (either my own, or another backend's), return the BackendId
+ * that owns it.  Temporary-toast-table namespaces are included, too.
+ * If it isn't a temp namespace, return InvalidBackendId.
+ */
+
+
+/*
+ * GetTempToastNamespace - get the OID of my temporary-toast-table namespace,
+ * which must already be assigned.  (This is only used when creating a toast
+ * table for a temp table, so we must have already done InitTempTableNamespace)
+ */
+
+
+
+/*
+ * GetOverrideSearchPath - fetch current search path definition in form
+ * used by PushOverrideSearchPath.
+ *
+ * The result structure is allocated in the specified memory context
+ * (which might or might not be equal to CurrentMemoryContext); but any
+ * junk created by revalidation calculations will be in CurrentMemoryContext.
+ */
+
+
+/*
+ * CopyOverrideSearchPath - copy the specified OverrideSearchPath.
+ *
+ * The result structure is allocated in CurrentMemoryContext.
+ */
+
+
+/*
+ * OverrideSearchPathMatchesCurrent - does path match current setting?
+ */
+
+
+/*
+ * PushOverrideSearchPath - temporarily override the search path
+ *
+ * We allow nested overrides, hence the push/pop terminology.  The GUC
+ * search_path variable is ignored while an override is active.
+ *
+ * It's possible that newpath->useTemp is set but there is no longer any
+ * active temp namespace, if the path was saved during a transaction that
+ * created a temp namespace and was later rolled back.  In that case we just
+ * ignore useTemp.  A plausible alternative would be to create a new temp
+ * namespace, but for existing callers that's not necessary because an empty
+ * temp namespace wouldn't affect their results anyway.
+ *
+ * It's also worth noting that other schemas listed in newpath might not
+ * exist anymore either.  We don't worry about this because OIDs that match
+ * no existing namespace will simply not produce any hits during searches.
+ */
+
+
+/*
+ * PopOverrideSearchPath - undo a previous PushOverrideSearchPath
+ *
+ * Any push during a (sub)transaction will be popped automatically at abort.
+ * But it's caller error if a push isn't popped in normal control flow.
+ */
+
+
+
+/*
+ * get_collation_oid - find a collation by possibly qualified name
+ */
+Oid get_collation_oid(List *name, bool missing_ok) { return -1; }
+
+
+/*
+ * get_conversion_oid - find a conversion by possibly qualified name
+ */
+
+
+/*
+ * FindDefaultConversionProc - find default encoding conversion proc
+ */
+
+
+/*
+ * recomputeNamespacePath - recompute path derived variables if needed.
+ */
+
+
+/*
+ * InitTempTableNamespace
+ *		Initialize temp table namespace on first use in a particular backend
+ */
+
+
+/*
+ * End-of-transaction cleanup for namespaces.
+ */
+
+
+/*
+ * AtEOSubXact_Namespace
+ *
+ * At subtransaction commit, propagate the temp-namespace-creation
+ * flag to the parent subtransaction.
+ *
+ * At subtransaction abort, forget the flag if we set it up.
+ */
+
+
+/*
+ * Remove all relations in the specified temp namespace.
+ *
+ * This is called at backend shutdown (if we made any temp relations).
+ * It is also called when we begin using a pre-existing temp namespace,
+ * in order to clean out any relations that might have been created by
+ * a crashed backend.
+ */
+
+
+/*
+ * Callback to remove temp relations at backend exit.
+ */
+
+
+/*
+ * Remove all temp tables from the temporary namespace.
+ */
+
+
+
+/*
+ * Routines for handling the GUC variable 'search_path'.
+ */
+
+/* check_hook: validate new search_path value */
+
+
+/* assign_hook: do extra actions as needed */
+
+
+/*
+ * InitializeSearchPath: initialize module during InitPostgres.
+ *
+ * This is called after we are up enough to be able to do catalog lookups.
+ */
+
+
+/*
+ * NamespaceCallback
+ *		Syscache inval callback function
+ */
+
+
+/*
+ * Fetch the active search path. The return value is a palloc'ed list
+ * of OIDs; the caller is responsible for freeing this storage as
+ * appropriate.
+ *
+ * The returned list includes the implicitly-prepended namespaces only if
+ * includeImplicit is true.
+ *
+ * Note: calling this may result in a CommandCounterIncrement operation,
+ * if we have to create or clean out the temp namespace.
+ */
+
+
+/*
+ * Fetch the active search path into a caller-allocated array of OIDs.
+ * Returns the number of path entries.  (If this is more than sarray_len,
+ * then the data didn't fit and is not all stored.)
+ *
+ * The returned list always includes the implicitly-prepended namespaces,
+ * but never includes the temp namespace.  (This is suitable for existing
+ * users, which would want to ignore the temp namespace anyway.)  This
+ * definition allows us to not worry about initializing the temp namespace.
+ */
+
+
+
+/*
+ * Export the FooIsVisible functions as SQL-callable functions.
+ *
+ * Note: as of Postgres 8.4, these will silently return NULL if called on
+ * a nonexistent object OID, rather than failing.  This is to avoid race
+ * condition errors when a query that's scanning a catalog using an MVCC
+ * snapshot uses one of these functions.  The underlying IsVisible functions
+ * always use an up-to-date snapshot and so might see the object as already
+ * gone when it's still visible to the transaction snapshot.  (There is no race
+ * condition in the current coding because we don't accept sinval messages
+ * between the SearchSysCacheExists test and the subsequent lookup.)
+ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/foreign/libpg_query/src/postgres/src_backend_catalog_pg_proc.c b/foreign/libpg_query/src/postgres/src_backend_catalog_pg_proc.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_catalog_pg_proc.c
@@ -0,0 +1,143 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - function_parse_error_transpose
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * pg_proc.c
+ *	  routines to support manipulation of the pg_proc relation
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/catalog/pg_proc.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include "access/htup_details.h"
+#include "access/xact.h"
+#include "catalog/dependency.h"
+#include "catalog/indexing.h"
+#include "catalog/objectaccess.h"
+#include "catalog/pg_language.h"
+#include "catalog/pg_namespace.h"
+#include "catalog/pg_proc.h"
+#include "catalog/pg_proc_fn.h"
+#include "catalog/pg_transform.h"
+#include "catalog/pg_type.h"
+#include "commands/defrem.h"
+#include "executor/functions.h"
+#include "funcapi.h"
+#include "mb/pg_wchar.h"
+#include "miscadmin.h"
+#include "nodes/nodeFuncs.h"
+#include "parser/parse_type.h"
+#include "tcop/pquery.h"
+#include "tcop/tcopprot.h"
+#include "utils/acl.h"
+#include "utils/builtins.h"
+#include "utils/lsyscache.h"
+#include "utils/rel.h"
+#include "utils/syscache.h"
+
+
+Datum		fmgr_internal_validator(PG_FUNCTION_ARGS);
+Datum		fmgr_c_validator(PG_FUNCTION_ARGS);
+Datum		fmgr_sql_validator(PG_FUNCTION_ARGS);
+
+typedef struct
+{
+	char	   *proname;
+	char	   *prosrc;
+} parse_error_callback_arg;
+
+static void sql_function_parse_error_callback(void *arg);
+static int match_prosrc_to_query(const char *prosrc, const char *queryText,
+					  int cursorpos);
+static bool match_prosrc_to_literal(const char *prosrc, const char *literal,
+						int cursorpos, int *newcursorpos);
+
+
+/* ----------------------------------------------------------------
+ *		ProcedureCreate
+ *
+ * Note: allParameterTypes, parameterModes, parameterNames, trftypes, and proconfig
+ * are either arrays of the proper types or NULL.  We declare them Datum,
+ * not "ArrayType *", to avoid importing array.h into pg_proc_fn.h.
+ * ----------------------------------------------------------------
+ */
+
+
+
+
+/*
+ * Validator for internal functions
+ *
+ * Check that the given internal function name (the "prosrc" value) is
+ * a known builtin function.
+ */
+
+
+
+
+/*
+ * Validator for C language functions
+ *
+ * Make sure that the library file exists, is loadable, and contains
+ * the specified link symbol. Also check for a valid function
+ * information record.
+ */
+
+
+
+/*
+ * Validator for SQL language functions
+ *
+ * Parse it here in order to be sure that it contains no syntax errors.
+ */
+
+
+/*
+ * Error context callback for handling errors in SQL function definitions
+ */
+
+
+/*
+ * Adjust a syntax error occurring inside the function body of a CREATE
+ * FUNCTION or DO command.  This can be used by any function validator or
+ * anonymous-block handler, not only for SQL-language functions.
+ * It is assumed that the syntax error position is initially relative to the
+ * function body string (as passed in).  If possible, we adjust the position
+ * to reference the original command text; if we can't manage that, we set
+ * up an "internal query" syntax error instead.
+ *
+ * Returns true if a syntax error was processed, false if not.
+ */
+bool function_parse_error_transpose(const char *prosrc) { return false; }
+
+
+/*
+ * Try to locate the string literal containing the function body in the
+ * given text of the CREATE FUNCTION or DO command.  If successful, return
+ * the character (not byte) index within the command corresponding to the
+ * given character index within the literal.  If not successful, return 0.
+ */
+
+
+/*
+ * Try to match the given source text to a single-quoted literal.
+ * If successful, adjust newcursorpos to correspond to the character
+ * (not byte) index corresponding to cursorpos in the source text.
+ *
+ * At entry, literal points just past a ' character.  We must check for the
+ * trailing quote.
+ */
+
+
+
diff --git a/foreign/libpg_query/src/postgres/src_backend_commands_define.c b/foreign/libpg_query/src/postgres/src_backend_commands_define.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_commands_define.c
@@ -0,0 +1,102 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - defWithOids
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * define.c
+ *	  Support routines for various kinds of object creation.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/commands/define.c
+ *
+ * DESCRIPTION
+ *	  The "DefineFoo" routines take the parse tree and pick out the
+ *	  appropriate arguments/flags, passing the results to the
+ *	  corresponding "FooDefine" routines (in src/catalog) that do
+ *	  the actual catalog-munging.  These routines also verify permission
+ *	  of the user to execute the command.
+ *
+ * NOTES
+ *	  These things must be defined and committed in the following order:
+ *		"create function":
+ *				input/output, recv/send procedures
+ *		"create type":
+ *				type
+ *		"create operator":
+ *				operators
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include <ctype.h>
+#include <math.h>
+
+#include "catalog/namespace.h"
+#include "commands/defrem.h"
+#include "nodes/makefuncs.h"
+#include "parser/parse_type.h"
+#include "parser/scansup.h"
+#include "utils/int8.h"
+
+/*
+ * Extract a string value (otherwise uninterpreted) from a DefElem.
+ */
+
+
+/*
+ * Extract a numeric value (actually double) from a DefElem.
+ */
+
+
+/*
+ * Extract a boolean value from a DefElem.
+ */
+
+
+/*
+ * Extract an int32 value from a DefElem.
+ */
+
+
+/*
+ * Extract an int64 value from a DefElem.
+ */
+
+
+/*
+ * Extract a possibly-qualified name (as a List of Strings) from a DefElem.
+ */
+
+
+/*
+ * Extract a TypeName from a DefElem.
+ *
+ * Note: we do not accept a List arg here, because the parser will only
+ * return a bare List when the name looks like an operator name.
+ */
+
+
+/*
+ * Extract a type length indicator (either absolute bytes, or
+ * -1 for "variable") from a DefElem.
+ */
+
+
+/*
+ * Create a DefElem setting "oids" to the specified value.
+ */
+DefElem *
+defWithOids(bool value)
+{
+	return makeDefElem("oids", (Node *) makeInteger(value));
+}
diff --git a/foreign/libpg_query/src/postgres/src_backend_lib_stringinfo.c b/foreign/libpg_query/src/postgres/src_backend_lib_stringinfo.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_lib_stringinfo.c
@@ -0,0 +1,293 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - initStringInfo
+ * - resetStringInfo
+ * - appendStringInfoString
+ * - appendBinaryStringInfo
+ * - appendStringInfoChar
+ * - appendStringInfoVA
+ * - enlargeStringInfo
+ * - appendStringInfo
+ * - appendStringInfoSpaces
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * stringinfo.c
+ *
+ * StringInfo provides an indefinitely-extensible string data type.
+ * It can be used to buffer either ordinary C strings (null-terminated text)
+ * or arbitrary binary data.  All storage is allocated with palloc().
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *	  src/backend/lib/stringinfo.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include "lib/stringinfo.h"
+#include "utils/memutils.h"
+
+
+/*
+ * makeStringInfo
+ *
+ * Create an empty 'StringInfoData' & return a pointer to it.
+ */
+
+
+/*
+ * initStringInfo
+ *
+ * Initialize a StringInfoData struct (with previously undefined contents)
+ * to describe an empty string.
+ */
+void
+initStringInfo(StringInfo str)
+{
+	int			size = 1024;	/* initial default buffer size */
+
+	str->data = (char *) palloc(size);
+	str->maxlen = size;
+	resetStringInfo(str);
+}
+
+/*
+ * resetStringInfo
+ *
+ * Reset the StringInfo: the data buffer remains valid, but its
+ * previous content, if any, is cleared.
+ */
+void
+resetStringInfo(StringInfo str)
+{
+	str->data[0] = '\0';
+	str->len = 0;
+	str->cursor = 0;
+}
+
+/*
+ * appendStringInfo
+ *
+ * Format text data under the control of fmt (an sprintf-style format string)
+ * and append it to whatever is already in str.  More space is allocated
+ * to str if necessary.  This is sort of like a combination of sprintf and
+ * strcat.
+ */
+void
+appendStringInfo(StringInfo str, const char *fmt,...)
+{
+	for (;;)
+	{
+		va_list		args;
+		int			needed;
+
+		/* Try to format the data. */
+		va_start(args, fmt);
+		needed = appendStringInfoVA(str, fmt, args);
+		va_end(args);
+
+		if (needed == 0)
+			break;				/* success */
+
+		/* Increase the buffer size and try again. */
+		enlargeStringInfo(str, needed);
+	}
+}
+
+/*
+ * appendStringInfoVA
+ *
+ * Attempt to format text data under the control of fmt (an sprintf-style
+ * format string) and append it to whatever is already in str.  If successful
+ * return zero; if not (because there's not enough space), return an estimate
+ * of the space needed, without modifying str.  Typically the caller should
+ * pass the return value to enlargeStringInfo() before trying again; see
+ * appendStringInfo for standard usage pattern.
+ *
+ * XXX This API is ugly, but there seems no alternative given the C spec's
+ * restrictions on what can portably be done with va_list arguments: you have
+ * to redo va_start before you can rescan the argument list, and we can't do
+ * that from here.
+ */
+int
+appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
+{
+	int			avail;
+	size_t		nprinted;
+
+	Assert(str != NULL);
+
+	/*
+	 * If there's hardly any space, don't bother trying, just fail to make the
+	 * caller enlarge the buffer first.  We have to guess at how much to
+	 * enlarge, since we're skipping the formatting work.
+	 */
+	avail = str->maxlen - str->len;
+	if (avail < 16)
+		return 32;
+
+	nprinted = pvsnprintf(str->data + str->len, (size_t) avail, fmt, args);
+
+	if (nprinted < (size_t) avail)
+	{
+		/* Success.  Note nprinted does not include trailing null. */
+		str->len += (int) nprinted;
+		return 0;
+	}
+
+	/* Restore the trailing null so that str is unmodified. */
+	str->data[str->len] = '\0';
+
+	/*
+	 * Return pvsnprintf's estimate of the space needed.  (Although this is
+	 * given as a size_t, we know it will fit in int because it's not more
+	 * than MaxAllocSize.)
+	 */
+	return (int) nprinted;
+}
+
+/*
+ * appendStringInfoString
+ *
+ * Append a null-terminated string to str.
+ * Like appendStringInfo(str, "%s", s) but faster.
+ */
+void
+appendStringInfoString(StringInfo str, const char *s)
+{
+	appendBinaryStringInfo(str, s, strlen(s));
+}
+
+/*
+ * appendStringInfoChar
+ *
+ * Append a single byte to str.
+ * Like appendStringInfo(str, "%c", ch) but much faster.
+ */
+void
+appendStringInfoChar(StringInfo str, char ch)
+{
+	/* Make more room if needed */
+	if (str->len + 1 >= str->maxlen)
+		enlargeStringInfo(str, 1);
+
+	/* OK, append the character */
+	str->data[str->len] = ch;
+	str->len++;
+	str->data[str->len] = '\0';
+}
+
+/*
+ * appendStringInfoSpaces
+ *
+ * Append the specified number of spaces to a buffer.
+ */
+void
+appendStringInfoSpaces(StringInfo str, int count)
+{
+	if (count > 0)
+	{
+		/* Make more room if needed */
+		enlargeStringInfo(str, count);
+
+		/* OK, append the spaces */
+		while (--count >= 0)
+			str->data[str->len++] = ' ';
+		str->data[str->len] = '\0';
+	}
+}
+
+/*
+ * appendBinaryStringInfo
+ *
+ * Append arbitrary binary data to a StringInfo, allocating more space
+ * if necessary.
+ */
+void
+appendBinaryStringInfo(StringInfo str, const char *data, int datalen)
+{
+	Assert(str != NULL);
+
+	/* Make more room if needed */
+	enlargeStringInfo(str, datalen);
+
+	/* OK, append the data */
+	memcpy(str->data + str->len, data, datalen);
+	str->len += datalen;
+
+	/*
+	 * Keep a trailing null in place, even though it's probably useless for
+	 * binary data.  (Some callers are dealing with text but call this because
+	 * their input isn't null-terminated.)
+	 */
+	str->data[str->len] = '\0';
+}
+
+/*
+ * enlargeStringInfo
+ *
+ * Make sure there is enough space for 'needed' more bytes
+ * ('needed' does not include the terminating null).
+ *
+ * External callers usually need not concern themselves with this, since
+ * all stringinfo.c routines do it automatically.  However, if a caller
+ * knows that a StringInfo will eventually become X bytes large, it
+ * can save some palloc overhead by enlarging the buffer before starting
+ * to store data in it.
+ *
+ * NB: because we use repalloc() to enlarge the buffer, the string buffer
+ * will remain allocated in the same memory context that was current when
+ * initStringInfo was called, even if another context is now current.
+ * This is the desired and indeed critical behavior!
+ */
+void
+enlargeStringInfo(StringInfo str, int needed)
+{
+	int			newlen;
+
+	/*
+	 * Guard against out-of-range "needed" values.  Without this, we can get
+	 * an overflow or infinite loop in the following.
+	 */
+	if (needed < 0)				/* should not happen */
+		elog(ERROR, "invalid string enlargement request size: %d", needed);
+	if (((Size) needed) >= (MaxAllocSize - (Size) str->len))
+		ereport(ERROR,
+				(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
+				 errmsg("out of memory"),
+				 errdetail("Cannot enlarge string buffer containing %d bytes by %d more bytes.",
+						   str->len, needed)));
+
+	needed += str->len + 1;		/* total space required now */
+
+	/* Because of the above test, we now have needed <= MaxAllocSize */
+
+	if (needed <= str->maxlen)
+		return;					/* got enough space already */
+
+	/*
+	 * We don't want to allocate just a little more space with each append;
+	 * for efficiency, double the buffer size each time it overflows.
+	 * Actually, we might need to more than double it if 'needed' is big...
+	 */
+	newlen = 2 * str->maxlen;
+	while (needed > newlen)
+		newlen = 2 * newlen;
+
+	/*
+	 * Clamp to MaxAllocSize in case we went past it.  Note we are assuming
+	 * here that MaxAllocSize <= INT_MAX/2, else the above loop could
+	 * overflow.  We will still have newlen >= needed.
+	 */
+	if (newlen > (int) MaxAllocSize)
+		newlen = (int) MaxAllocSize;
+
+	str->data = (char *) repalloc(str->data, newlen);
+
+	str->maxlen = newlen;
+}
diff --git a/foreign/libpg_query/src/postgres/src_backend_libpq_pqcomm.c b/foreign/libpg_query/src/postgres/src_backend_libpq_pqcomm.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_libpq_pqcomm.c
@@ -0,0 +1,634 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - PqCommMethods
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * pqcomm.c
+ *	  Communication functions between the Frontend and the Backend
+ *
+ * These routines handle the low-level details of communication between
+ * frontend and backend.  They just shove data across the communication
+ * channel, and are ignorant of the semantics of the data --- or would be,
+ * except for major brain damage in the design of the old COPY OUT protocol.
+ * Unfortunately, COPY OUT was designed to commandeer the communication
+ * channel (it just transfers data without wrapping it into messages).
+ * No other messages can be sent while COPY OUT is in progress; and if the
+ * copy is aborted by an ereport(ERROR), we need to close out the copy so that
+ * the frontend gets back into sync.  Therefore, these routines have to be
+ * aware of COPY OUT state.  (New COPY-OUT is message-based and does *not*
+ * set the DoingCopyOut flag.)
+ *
+ * NOTE: generally, it's a bad idea to emit outgoing messages directly with
+ * pq_putbytes(), especially if the message would require multiple calls
+ * to send.  Instead, use the routines in pqformat.c to construct the message
+ * in a buffer and then emit it in one call to pq_putmessage.  This ensures
+ * that the channel will not be clogged by an incomplete message if execution
+ * is aborted by ereport(ERROR) partway through the message.  The only
+ * non-libpq code that should call pq_putbytes directly is old-style COPY OUT.
+ *
+ * At one time, libpq was shared between frontend and backend, but now
+ * the backend's "backend/libpq" is quite separate from "interfaces/libpq".
+ * All that remains is similarities of names to trap the unwary...
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *	src/backend/libpq/pqcomm.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/*------------------------
+ * INTERFACE ROUTINES
+ *
+ * setup/teardown:
+ *		StreamServerPort	- Open postmaster's server port
+ *		StreamConnection	- Create new connection with client
+ *		StreamClose			- Close a client/backend connection
+ *		TouchSocketFiles	- Protect socket files against /tmp cleaners
+ *		pq_init			- initialize libpq at backend startup
+ *		pq_comm_reset	- reset libpq during error recovery
+ *		pq_close		- shutdown libpq at backend exit
+ *
+ * low-level I/O:
+ *		pq_getbytes		- get a known number of bytes from connection
+ *		pq_getstring	- get a null terminated string from connection
+ *		pq_getmessage	- get a message with length word from connection
+ *		pq_getbyte		- get next byte from connection
+ *		pq_peekbyte		- peek at next byte from connection
+ *		pq_putbytes		- send bytes to connection (not flushed until pq_flush)
+ *		pq_flush		- flush pending output
+ *		pq_flush_if_writable - flush pending output if writable without blocking
+ *		pq_getbyte_if_available - get a byte if available without blocking
+ *
+ * message-level I/O (and old-style-COPY-OUT cruft):
+ *		pq_putmessage	- send a normal message (suppressed in COPY OUT mode)
+ *		pq_putmessage_noblock - buffer a normal message (suppressed in COPY OUT)
+ *		pq_startcopyout - inform libpq that a COPY OUT transfer is beginning
+ *		pq_endcopyout	- end a COPY OUT transfer
+ *
+ *------------------------
+ */
+#include "postgres.h"
+
+#include <signal.h>
+#include <fcntl.h>
+#include <grp.h>
+#include <unistd.h>
+#include <sys/file.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#ifdef HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
+#include <arpa/inet.h>
+#ifdef HAVE_UTIME_H
+#include <utime.h>
+#endif
+#ifdef WIN32_ONLY_COMPILER		/* mstcpip.h is missing on mingw */
+#include <mstcpip.h>
+#endif
+
+#include "libpq/ip.h"
+#include "libpq/libpq.h"
+#include "miscadmin.h"
+#include "storage/ipc.h"
+#include "utils/guc.h"
+#include "utils/memutils.h"
+
+/*
+ * Configuration options
+ */
+
+
+
+/* Where the Unix socket files are (list of palloc'd strings) */
+
+
+/*
+ * Buffers for low-level I/O.
+ *
+ * The receive buffer is fixed size. Send buffer is usually 8k, but can be
+ * enlarged by pq_putmessage_noblock() if the message doesn't fit otherwise.
+ */
+
+#define PQ_SEND_BUFFER_SIZE 8192
+#define PQ_RECV_BUFFER_SIZE 8192
+
+
+	/* Size send buffer */
+		/* Next index to store a byte in PqSendBuffer */
+		/* Next index to send a byte in PqSendBuffer */
+
+
+		/* Next index to read a byte from PqRecvBuffer */
+		/* End of data available in PqRecvBuffer */
+
+/*
+ * Message status
+ */
+			/* busy sending data to the client */
+	/* in the middle of reading a message */
+		/* in old-protocol COPY OUT processing */
+
+
+/* Internal functions */
+static void socket_comm_reset(void);
+static void socket_close(int code, Datum arg);
+static void socket_set_nonblocking(bool nonblocking);
+static int	socket_flush(void);
+static int	socket_flush_if_writable(void);
+static bool socket_is_send_pending(void);
+static int	socket_putmessage(char msgtype, const char *s, size_t len);
+static void socket_putmessage_noblock(char msgtype, const char *s, size_t len);
+static void socket_startcopyout(void);
+static void socket_endcopyout(bool errorAbort);
+static int	internal_putbytes(const char *s, size_t len);
+static int	internal_flush(void);
+static void socket_set_nonblocking(bool nonblocking);
+
+#ifdef HAVE_UNIX_SOCKETS
+static int	Lock_AF_UNIX(char *unixSocketDir, char *unixSocketPath);
+static int	Setup_AF_UNIX(char *sock_path);
+#endif   /* HAVE_UNIX_SOCKETS */
+
+
+
+PQcommMethods *PqCommMethods = NULL;
+
+
+
+
+/* --------------------------------
+ *		pq_init - initialize libpq at backend startup
+ * --------------------------------
+ */
+#ifndef WIN32
+#endif
+
+/* --------------------------------
+ *		socket_comm_reset - reset libpq during error recovery
+ *
+ * This is called from error recovery at the outer idle loop.  It's
+ * just to get us out of trouble if we somehow manage to elog() from
+ * inside a pqcomm.c routine (which ideally will never happen, but...)
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ *		socket_close - shutdown libpq at backend exit
+ *
+ * This is the one pg_on_exit_callback in place during BackendInitialize().
+ * That function's unusual signal handling constrains that this callback be
+ * safe to run at any instant.
+ * --------------------------------
+ */
+#if defined(ENABLE_GSS) || defined(ENABLE_SSPI)
+#ifdef ENABLE_GSS
+#endif   /* ENABLE_GSS */
+#endif   /* ENABLE_GSS || ENABLE_SSPI */
+
+
+
+/*
+ * Streams -- wrapper around Unix socket system calls
+ *
+ *
+ *		Stream functions are used for vanilla TCP connection protocol.
+ */
+
+
+/*
+ * StreamServerPort -- open a "listening" port to accept connections.
+ *
+ * family should be AF_UNIX or AF_UNSPEC; portNumber is the port number.
+ * For AF_UNIX ports, hostName should be NULL and unixSocketDir must be
+ * specified.  For TCP ports, hostName is either NULL for all interfaces or
+ * the interface to listen on, and unixSocketDir is ignored (can be NULL).
+ *
+ * Successfully opened sockets are added to the ListenSocket[] array (of
+ * length MaxListen), at the first position that isn't PGINVALID_SOCKET.
+ *
+ * RETURNS: STATUS_OK or STATUS_ERROR
+ */
+
+#ifdef HAVE_UNIX_SOCKETS
+#endif
+#if !defined(WIN32) || defined(IPV6_V6ONLY)
+#endif
+#ifdef HAVE_UNIX_SOCKETS
+#endif   /* HAVE_UNIX_SOCKETS */
+#ifdef HAVE_IPV6
+#endif
+#ifdef HAVE_UNIX_SOCKETS
+#endif
+#ifndef WIN32
+#endif
+#ifdef IPV6_V6ONLY
+#endif
+#ifdef HAVE_UNIX_SOCKETS
+#endif
+
+
+#ifdef HAVE_UNIX_SOCKETS
+
+/*
+ * Lock_AF_UNIX -- configure unix socket file path
+ */
+
+
+
+/*
+ * Setup_AF_UNIX -- configure unix socket permissions
+ */
+#ifdef WIN32
+#else
+#endif
+#endif   /* HAVE_UNIX_SOCKETS */
+
+
+/*
+ * StreamConnection -- create a new connection with client using
+ *		server port.  Set port->sock to the FD of the new connection.
+ *
+ * ASSUME: that this doesn't need to be non-blocking because
+ *		the Postmaster uses select() to tell when the server master
+ *		socket is ready for accept().
+ *
+ * RETURNS: STATUS_OK or STATUS_ERROR
+ */
+#ifdef SCO_ACCEPT_BUG
+#endif
+#ifdef	TCP_NODELAY
+#endif
+#ifdef WIN32
+#endif
+
+/*
+ * StreamClose -- close a client/backend connection
+ *
+ * NOTE: this is NOT used to terminate a session; it is just used to release
+ * the file descriptor in a process that should no longer have the socket
+ * open.  (For example, the postmaster calls this after passing ownership
+ * of the connection to a child process.)  It is expected that someone else
+ * still has the socket open.  So, we only want to close the descriptor,
+ * we do NOT want to send anything to the far end.
+ */
+
+
+/*
+ * TouchSocketFiles -- mark socket files as recently accessed
+ *
+ * This routine should be called every so often to ensure that the socket
+ * files have a recent mod date (ordinary operations on sockets usually won't
+ * change the mod date).  That saves them from being removed by
+ * overenthusiastic /tmp-directory-cleaner daemons.  (Another reason we should
+ * never have put the socket file in /tmp...)
+ */
+#ifdef HAVE_UTIME
+#else							/* !HAVE_UTIME */
+#ifdef HAVE_UTIMES
+#endif   /* HAVE_UTIMES */
+#endif   /* HAVE_UTIME */
+
+/*
+ * RemoveSocketFiles -- unlink socket files at postmaster shutdown
+ */
+
+
+
+/* --------------------------------
+ * Low-level I/O routines begin here.
+ *
+ * These routines communicate with a frontend client across a connection
+ * already established by the preceding routines.
+ * --------------------------------
+ */
+
+/* --------------------------------
+ *			  socket_set_nonblocking - set socket blocking/non-blocking
+ *
+ * Sets the socket non-blocking if nonblocking is TRUE, or sets it
+ * blocking otherwise.
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ *		pq_recvbuf - load some bytes into the input buffer
+ *
+ *		returns 0 if OK, EOF if trouble
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ *		pq_getbyte	- get a single byte from connection, or return EOF
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ *		pq_peekbyte		- peek at next byte from connection
+ *
+ *	 Same as pq_getbyte() except we don't advance the pointer.
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ *		pq_getbyte_if_available - get a single byte from connection,
+ *			if available
+ *
+ * The received byte is stored in *c. Returns 1 if a byte was read,
+ * 0 if no data was available, or EOF if trouble.
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ *		pq_getbytes		- get a known number of bytes from connection
+ *
+ *		returns 0 if OK, EOF if trouble
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ *		pq_discardbytes		- throw away a known number of bytes
+ *
+ *		same as pq_getbytes except we do not copy the data to anyplace.
+ *		this is used for resynchronizing after read errors.
+ *
+ *		returns 0 if OK, EOF if trouble
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ *		pq_getstring	- get a null terminated string from connection
+ *
+ *		The return value is placed in an expansible StringInfo, which has
+ *		already been initialized by the caller.
+ *
+ *		This is used only for dealing with old-protocol clients.  The idea
+ *		is to produce a StringInfo that looks the same as we would get from
+ *		pq_getmessage() with a newer client; we will then process it with
+ *		pq_getmsgstring.  Therefore, no character set conversion is done here,
+ *		even though this is presumably useful only for text.
+ *
+ *		returns 0 if OK, EOF if trouble
+ * --------------------------------
+ */
+
+
+
+/* --------------------------------
+ *		pq_startmsgread - begin reading a message from the client.
+ *
+ *		This must be called before any of the pq_get* functions.
+ * --------------------------------
+ */
+
+
+
+/* --------------------------------
+ *		pq_endmsgread	- finish reading message.
+ *
+ *		This must be called after reading a V2 protocol message with
+ *		pq_getstring() and friends, to indicate that we have read the whole
+ *		message. In V3 protocol, pq_getmessage() does this implicitly.
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ *		pq_is_reading_msg - are we currently reading a message?
+ *
+ * This is used in error recovery at the outer idle loop to detect if we have
+ * lost protocol sync, and need to terminate the connection. pq_startmsgread()
+ * will check for that too, but it's nicer to detect it earlier.
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ *		pq_getmessage	- get a message with length word from connection
+ *
+ *		The return value is placed in an expansible StringInfo, which has
+ *		already been initialized by the caller.
+ *		Only the message body is placed in the StringInfo; the length word
+ *		is removed.  Also, s->cursor is initialized to zero for convenience
+ *		in scanning the message contents.
+ *
+ *		If maxlen is not zero, it is an upper limit on the length of the
+ *		message we are willing to accept.  We abort the connection (by
+ *		returning EOF) if client tries to send more than that.
+ *
+ *		returns 0 if OK, EOF if trouble
+ * --------------------------------
+ */
+
+
+
+/* --------------------------------
+ *		pq_putbytes		- send bytes to connection (not flushed until pq_flush)
+ *
+ *		returns 0 if OK, EOF if trouble
+ * --------------------------------
+ */
+
+
+
+
+/* --------------------------------
+ *		socket_flush		- flush pending output
+ *
+ *		returns 0 if OK, EOF if trouble
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ *		internal_flush - flush pending output
+ *
+ * Returns 0 if OK (meaning everything was sent, or operation would block
+ * and the socket is in non-blocking mode), or EOF if trouble.
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ *		pq_flush_if_writable - flush pending output if writable without blocking
+ *
+ * Returns 0 if OK, or EOF if trouble.
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ *	socket_is_send_pending	- is there any pending data in the output buffer?
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ * Message-level I/O routines begin here.
+ *
+ * These routines understand about the old-style COPY OUT protocol.
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ *		socket_putmessage - send a normal message (suppressed in COPY OUT mode)
+ *
+ *		If msgtype is not '\0', it is a message type code to place before
+ *		the message body.  If msgtype is '\0', then the message has no type
+ *		code (this is only valid in pre-3.0 protocols).
+ *
+ *		len is the length of the message body data at *s.  In protocol 3.0
+ *		and later, a message length word (equal to len+4 because it counts
+ *		itself too) is inserted by this routine.
+ *
+ *		All normal messages are suppressed while old-style COPY OUT is in
+ *		progress.  (In practice only a few notice messages might get emitted
+ *		then; dropping them is annoying, but at least they will still appear
+ *		in the postmaster log.)
+ *
+ *		We also suppress messages generated while pqcomm.c is busy.  This
+ *		avoids any possibility of messages being inserted within other
+ *		messages.  The only known trouble case arises if SIGQUIT occurs
+ *		during a pqcomm.c routine --- quickdie() will try to send a warning
+ *		message, and the most reasonable approach seems to be to drop it.
+ *
+ *		returns 0 if OK, EOF if trouble
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ *		pq_putmessage_noblock	- like pq_putmessage, but never blocks
+ *
+ *		If the output buffer is too small to hold the message, the buffer
+ *		is enlarged.
+ */
+
+
+
+/* --------------------------------
+ *		socket_startcopyout - inform libpq that an old-style COPY OUT transfer
+ *			is beginning
+ * --------------------------------
+ */
+
+
+/* --------------------------------
+ *		socket_endcopyout	- end an old-style COPY OUT transfer
+ *
+ *		If errorAbort is indicated, we are aborting a COPY OUT due to an error,
+ *		and must send a terminator line.  Since a partial data line might have
+ *		been emitted, send a couple of newlines first (the first one could
+ *		get absorbed by a backslash...)  Note that old-style COPY OUT does
+ *		not allow binary transfers, so a textual terminator is always correct.
+ * --------------------------------
+ */
+
+
+/*
+ * Support for TCP Keepalive parameters
+ */
+
+/*
+ * On Windows, we need to set both idle and interval at the same time.
+ * We also cannot reset them to the default (setting to zero will
+ * actually set them to zero, not default), therefore we fallback to
+ * the out-of-the-box default instead.
+ */
+#if defined(WIN32) && defined(SIO_KEEPALIVE_VALS)
+static int
+pq_setkeepaliveswin32(Port *port, int idle, int interval)
+{
+	struct tcp_keepalive ka;
+	DWORD		retsize;
+
+	if (idle <= 0)
+		idle = 2 * 60 * 60;		/* default = 2 hours */
+	if (interval <= 0)
+		interval = 1;			/* default = 1 second */
+
+	ka.onoff = 1;
+	ka.keepalivetime = idle * 1000;
+	ka.keepaliveinterval = interval * 1000;
+
+	if (WSAIoctl(port->sock,
+				 SIO_KEEPALIVE_VALS,
+				 (LPVOID) &ka,
+				 sizeof(ka),
+				 NULL,
+				 0,
+				 &retsize,
+				 NULL,
+				 NULL)
+		!= 0)
+	{
+		elog(LOG, "WSAIoctl(SIO_KEEPALIVE_VALS) failed: %ui",
+			 WSAGetLastError());
+		return STATUS_ERROR;
+	}
+	if (port->keepalives_idle != idle)
+		port->keepalives_idle = idle;
+	if (port->keepalives_interval != interval)
+		port->keepalives_interval = interval;
+	return STATUS_OK;
+}
+#endif
+
+#if defined(TCP_KEEPIDLE) || defined(TCP_KEEPALIVE) || defined(WIN32)
+#ifndef WIN32
+#ifdef TCP_KEEPIDLE
+#else
+#endif   /* TCP_KEEPIDLE */
+#else							/* WIN32 */
+#endif   /* WIN32 */
+#else
+#endif
+
+#if defined(TCP_KEEPIDLE) || defined(TCP_KEEPALIVE) || defined(SIO_KEEPALIVE_VALS)
+#ifndef WIN32
+#ifdef TCP_KEEPIDLE
+#else
+#endif
+#else							/* WIN32 */
+#endif
+#else							/* TCP_KEEPIDLE || SIO_KEEPALIVE_VALS */
+#endif
+
+#if defined(TCP_KEEPINTVL) || defined(SIO_KEEPALIVE_VALS)
+#ifndef WIN32
+#else
+#endif   /* WIN32 */
+#else
+#endif
+
+#if defined(TCP_KEEPINTVL) || defined (SIO_KEEPALIVE_VALS)
+#ifndef WIN32
+#else							/* WIN32 */
+#endif
+#else
+#endif
+
+#ifdef TCP_KEEPCNT
+#else
+#endif
+
+#ifdef TCP_KEEPCNT
+#else
+#endif
diff --git a/foreign/libpg_query/src/postgres/src_backend_nodes_bitmapset.c b/foreign/libpg_query/src/postgres/src_backend_nodes_bitmapset.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_nodes_bitmapset.c
@@ -0,0 +1,413 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - bms_copy
+ * - bms_equal
+ * - bms_is_empty
+ * - bms_first_member
+ * - rightmost_one_pos
+ * - bms_free
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * bitmapset.c
+ *	  PostgreSQL generic bitmap set package
+ *
+ * A bitmap set can represent any set of nonnegative integers, although
+ * it is mainly intended for sets where the maximum value is not large,
+ * say at most a few hundred.  By convention, a NULL pointer is always
+ * accepted by all operations to represent the empty set.  (But beware
+ * that this is not the only representation of the empty set.  Use
+ * bms_is_empty() in preference to testing for NULL.)
+ *
+ *
+ * Copyright (c) 2003-2015, PostgreSQL Global Development Group
+ *
+ * IDENTIFICATION
+ *	  src/backend/nodes/bitmapset.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include "access/hash.h"
+
+
+#define WORDNUM(x)	((x) / BITS_PER_BITMAPWORD)
+#define BITNUM(x)	((x) % BITS_PER_BITMAPWORD)
+
+#define BITMAPSET_SIZE(nwords)	\
+	(offsetof(Bitmapset, words) + (nwords) * sizeof(bitmapword))
+
+/*----------
+ * This is a well-known cute trick for isolating the rightmost one-bit
+ * in a word.  It assumes two's complement arithmetic.  Consider any
+ * nonzero value, and focus attention on the rightmost one.  The value is
+ * then something like
+ *				xxxxxx10000
+ * where x's are unspecified bits.  The two's complement negative is formed
+ * by inverting all the bits and adding one.  Inversion gives
+ *				yyyyyy01111
+ * where each y is the inverse of the corresponding x.  Incrementing gives
+ *				yyyyyy10000
+ * and then ANDing with the original value gives
+ *				00000010000
+ * This works for all cases except original value = zero, where of course
+ * we get zero.
+ *----------
+ */
+#define RIGHTMOST_ONE(x) ((signedbitmapword) (x) & -((signedbitmapword) (x)))
+
+#define HAS_MULTIPLE_ONES(x)	((bitmapword) RIGHTMOST_ONE(x) != (x))
+
+
+/*
+ * Lookup tables to avoid need for bit-by-bit groveling
+ *
+ * rightmost_one_pos[x] gives the bit number (0-7) of the rightmost one bit
+ * in a nonzero byte value x.  The entry for x=0 is never used.
+ *
+ * number_of_ones[x] gives the number of one-bits (0-8) in a byte value x.
+ *
+ * We could make these tables larger and reduce the number of iterations
+ * in the functions that use them, but bytewise shifts and masks are
+ * especially fast on many machines, so working a byte at a time seems best.
+ */
+
+static const uint8 rightmost_one_pos[256] = {
+	0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
+	4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
+	5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
+	4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
+	6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
+	4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
+	5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
+	4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
+	7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
+	4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
+	5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
+	4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
+	6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
+	4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
+	5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
+	4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
+};
+
+
+
+
+/*
+ * bms_copy - make a palloc'd copy of a bitmapset
+ */
+Bitmapset *
+bms_copy(const Bitmapset *a)
+{
+	Bitmapset  *result;
+	size_t		size;
+
+	if (a == NULL)
+		return NULL;
+	size = BITMAPSET_SIZE(a->nwords);
+	result = (Bitmapset *) palloc(size);
+	memcpy(result, a, size);
+	return result;
+}
+
+/*
+ * bms_equal - are two bitmapsets equal?
+ *
+ * This is logical not physical equality; in particular, a NULL pointer will
+ * be reported as equal to a palloc'd value containing no members.
+ */
+bool
+bms_equal(const Bitmapset *a, const Bitmapset *b)
+{
+	const Bitmapset *shorter;
+	const Bitmapset *longer;
+	int			shortlen;
+	int			longlen;
+	int			i;
+
+	/* Handle cases where either input is NULL */
+	if (a == NULL)
+	{
+		if (b == NULL)
+			return true;
+		return bms_is_empty(b);
+	}
+	else if (b == NULL)
+		return bms_is_empty(a);
+	/* Identify shorter and longer input */
+	if (a->nwords <= b->nwords)
+	{
+		shorter = a;
+		longer = b;
+	}
+	else
+	{
+		shorter = b;
+		longer = a;
+	}
+	/* And process */
+	shortlen = shorter->nwords;
+	for (i = 0; i < shortlen; i++)
+	{
+		if (shorter->words[i] != longer->words[i])
+			return false;
+	}
+	longlen = longer->nwords;
+	for (; i < longlen; i++)
+	{
+		if (longer->words[i] != 0)
+			return false;
+	}
+	return true;
+}
+
+/*
+ * bms_make_singleton - build a bitmapset containing a single member
+ */
+
+
+/*
+ * bms_free - free a bitmapset
+ *
+ * Same as pfree except for allowing NULL input
+ */
+void
+bms_free(Bitmapset *a)
+{
+	if (a)
+		pfree(a);
+}
+
+
+/*
+ * These operations all make a freshly palloc'd result,
+ * leaving their inputs untouched
+ */
+
+
+/*
+ * bms_union - set union
+ */
+
+
+/*
+ * bms_intersect - set intersection
+ */
+
+
+/*
+ * bms_difference - set difference (ie, A without members of B)
+ */
+
+
+/*
+ * bms_is_subset - is A a subset of B?
+ */
+
+
+/*
+ * bms_subset_compare - compare A and B for equality/subset relationships
+ *
+ * This is more efficient than testing bms_is_subset in both directions.
+ */
+
+
+/*
+ * bms_is_member - is X a member of A?
+ */
+
+
+/*
+ * bms_overlap - do sets overlap (ie, have a nonempty intersection)?
+ */
+
+
+/*
+ * bms_nonempty_difference - do sets have a nonempty difference?
+ */
+
+
+/*
+ * bms_singleton_member - return the sole integer member of set
+ *
+ * Raises error if |a| is not 1.
+ */
+
+
+/*
+ * bms_get_singleton_member
+ *
+ * Test whether the given set is a singleton.
+ * If so, set *member to the value of its sole member, and return TRUE.
+ * If not, return FALSE, without changing *member.
+ *
+ * This is more convenient and faster than calling bms_membership() and then
+ * bms_singleton_member(), if we don't care about distinguishing empty sets
+ * from multiple-member sets.
+ */
+
+
+/*
+ * bms_num_members - count members of set
+ */
+
+
+/*
+ * bms_membership - does a set have zero, one, or multiple members?
+ *
+ * This is faster than making an exact count with bms_num_members().
+ */
+
+
+/*
+ * bms_is_empty - is a set empty?
+ *
+ * This is even faster than bms_membership().
+ */
+bool
+bms_is_empty(const Bitmapset *a)
+{
+	int			nwords;
+	int			wordnum;
+
+	if (a == NULL)
+		return true;
+	nwords = a->nwords;
+	for (wordnum = 0; wordnum < nwords; wordnum++)
+	{
+		bitmapword	w = a->words[wordnum];
+
+		if (w != 0)
+			return false;
+	}
+	return true;
+}
+
+
+/*
+ * These operations all "recycle" their non-const inputs, ie, either
+ * return the modified input or pfree it if it can't hold the result.
+ *
+ * These should generally be used in the style
+ *
+ *		foo = bms_add_member(foo, x);
+ */
+
+
+/*
+ * bms_add_member - add a specified member to set
+ *
+ * Input set is modified or recycled!
+ */
+
+
+/*
+ * bms_del_member - remove a specified member from set
+ *
+ * No error if x is not currently a member of set
+ *
+ * Input set is modified in-place!
+ */
+
+
+/*
+ * bms_add_members - like bms_union, but left input is recycled
+ */
+
+
+/*
+ * bms_int_members - like bms_intersect, but left input is recycled
+ */
+
+
+/*
+ * bms_del_members - like bms_difference, but left input is recycled
+ */
+
+
+/*
+ * bms_join - like bms_union, but *both* inputs are recycled
+ */
+
+
+/*
+ * bms_first_member - find and remove first member of a set
+ *
+ * Returns -1 if set is empty.  NB: set is destructively modified!
+ *
+ * This is intended as support for iterating through the members of a set.
+ * The typical pattern is
+ *
+ *			while ((x = bms_first_member(inputset)) >= 0)
+ *				process member x;
+ *
+ * CAUTION: this destroys the content of "inputset".  If the set must
+ * not be modified, use bms_next_member instead.
+ */
+int
+bms_first_member(Bitmapset *a)
+{
+	int			nwords;
+	int			wordnum;
+
+	if (a == NULL)
+		return -1;
+	nwords = a->nwords;
+	for (wordnum = 0; wordnum < nwords; wordnum++)
+	{
+		bitmapword	w = a->words[wordnum];
+
+		if (w != 0)
+		{
+			int			result;
+
+			w = RIGHTMOST_ONE(w);
+			a->words[wordnum] &= ~w;
+
+			result = wordnum * BITS_PER_BITMAPWORD;
+			while ((w & 255) == 0)
+			{
+				w >>= 8;
+				result += 8;
+			}
+			result += rightmost_one_pos[w & 255];
+			return result;
+		}
+	}
+	return -1;
+}
+
+/*
+ * bms_next_member - find next member of a set
+ *
+ * Returns smallest member greater than "prevbit", or -2 if there is none.
+ * "prevbit" must NOT be less than -1, or the behavior is unpredictable.
+ *
+ * This is intended as support for iterating through the members of a set.
+ * The typical pattern is
+ *
+ *			x = -1;
+ *			while ((x = bms_next_member(inputset, x)) >= 0)
+ *				process member x;
+ *
+ * Notice that when there are no more members, we return -2, not -1 as you
+ * might expect.  The rationale for that is to allow distinguishing the
+ * loop-not-started state (x == -1) from the loop-completed state (x == -2).
+ * It makes no difference in simple loop usage, but complex iteration logic
+ * might need such an ability.
+ */
+
+
+/*
+ * bms_hash_value - compute a hash key for a Bitmapset
+ *
+ * Note: we must ensure that any two bitmapsets that are bms_equal() will
+ * hash to the same value; in practice this means that trailing all-zero
+ * words must not affect the result.  Hence we strip those before applying
+ * hash_any().
+ */
+
diff --git a/foreign/libpg_query/src/postgres/src_backend_nodes_copyfuncs.c b/foreign/libpg_query/src/postgres/src_backend_nodes_copyfuncs.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_nodes_copyfuncs.c
@@ -0,0 +1,5195 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - copyObject
+ * - _copyPlannedStmt
+ * - _copyPlan
+ * - CopyPlanFields
+ * - _copyResult
+ * - _copyModifyTable
+ * - _copyAppend
+ * - _copyMergeAppend
+ * - _copyRecursiveUnion
+ * - _copyBitmapAnd
+ * - _copyBitmapOr
+ * - _copyScan
+ * - CopyScanFields
+ * - _copySeqScan
+ * - _copySampleScan
+ * - _copyIndexScan
+ * - _copyIndexOnlyScan
+ * - _copyBitmapIndexScan
+ * - _copyBitmapHeapScan
+ * - _copyTidScan
+ * - _copySubqueryScan
+ * - _copyFunctionScan
+ * - _copyValuesScan
+ * - _copyCteScan
+ * - _copyWorkTableScan
+ * - _copyForeignScan
+ * - _copyCustomScan
+ * - _copyJoin
+ * - CopyJoinFields
+ * - _copyNestLoop
+ * - _copyMergeJoin
+ * - _copyHashJoin
+ * - _copyMaterial
+ * - _copySort
+ * - _copyGroup
+ * - _copyAgg
+ * - _copyWindowAgg
+ * - _copyUnique
+ * - _copyHash
+ * - _copySetOp
+ * - _copyLockRows
+ * - _copyLimit
+ * - _copyNestLoopParam
+ * - _copyPlanRowMark
+ * - _copyPlanInvalItem
+ * - _copyAlias
+ * - _copyRangeVar
+ * - _copyIntoClause
+ * - _copyVar
+ * - _copyConst
+ * - _copyParam
+ * - _copyAggref
+ * - _copyGroupingFunc
+ * - _copyWindowFunc
+ * - _copyArrayRef
+ * - _copyFuncExpr
+ * - _copyNamedArgExpr
+ * - _copyOpExpr
+ * - _copyDistinctExpr
+ * - _copyNullIfExpr
+ * - _copyScalarArrayOpExpr
+ * - _copyBoolExpr
+ * - _copySubLink
+ * - _copySubPlan
+ * - _copyAlternativeSubPlan
+ * - _copyFieldSelect
+ * - _copyFieldStore
+ * - _copyRelabelType
+ * - _copyCoerceViaIO
+ * - _copyArrayCoerceExpr
+ * - _copyConvertRowtypeExpr
+ * - _copyCollateExpr
+ * - _copyCaseExpr
+ * - _copyCaseWhen
+ * - _copyCaseTestExpr
+ * - _copyArrayExpr
+ * - _copyRowExpr
+ * - _copyRowCompareExpr
+ * - _copyCoalesceExpr
+ * - _copyMinMaxExpr
+ * - _copyXmlExpr
+ * - _copyNullTest
+ * - _copyBooleanTest
+ * - _copyCoerceToDomain
+ * - _copyCoerceToDomainValue
+ * - _copySetToDefault
+ * - _copyCurrentOfExpr
+ * - _copyInferenceElem
+ * - _copyTargetEntry
+ * - _copyRangeTblRef
+ * - _copyJoinExpr
+ * - _copyFromExpr
+ * - _copyOnConflictExpr
+ * - _copyPathKey
+ * - _copyRestrictInfo
+ * - _copyPlaceHolderVar
+ * - _copySpecialJoinInfo
+ * - _copyAppendRelInfo
+ * - _copyPlaceHolderInfo
+ * - _copyValue
+ * - _copyList
+ * - _copyQuery
+ * - _copyInsertStmt
+ * - _copyDeleteStmt
+ * - _copyUpdateStmt
+ * - _copySelectStmt
+ * - _copySetOperationStmt
+ * - _copyAlterTableStmt
+ * - _copyAlterTableCmd
+ * - _copyAlterDomainStmt
+ * - _copyGrantStmt
+ * - _copyGrantRoleStmt
+ * - _copyAlterDefaultPrivilegesStmt
+ * - _copyDeclareCursorStmt
+ * - _copyClosePortalStmt
+ * - _copyClusterStmt
+ * - _copyCopyStmt
+ * - _copyCreateStmt
+ * - CopyCreateStmtFields
+ * - _copyTableLikeClause
+ * - _copyDefineStmt
+ * - _copyDropStmt
+ * - _copyTruncateStmt
+ * - _copyCommentStmt
+ * - _copySecLabelStmt
+ * - _copyFetchStmt
+ * - _copyIndexStmt
+ * - _copyCreateFunctionStmt
+ * - _copyFunctionParameter
+ * - _copyAlterFunctionStmt
+ * - _copyDoStmt
+ * - _copyRenameStmt
+ * - _copyAlterObjectSchemaStmt
+ * - _copyAlterOwnerStmt
+ * - _copyRuleStmt
+ * - _copyNotifyStmt
+ * - _copyListenStmt
+ * - _copyUnlistenStmt
+ * - _copyTransactionStmt
+ * - _copyCompositeTypeStmt
+ * - _copyCreateEnumStmt
+ * - _copyCreateRangeStmt
+ * - _copyAlterEnumStmt
+ * - _copyViewStmt
+ * - _copyLoadStmt
+ * - _copyCreateDomainStmt
+ * - _copyCreateOpClassStmt
+ * - _copyCreateOpClassItem
+ * - _copyCreateOpFamilyStmt
+ * - _copyAlterOpFamilyStmt
+ * - _copyCreatedbStmt
+ * - _copyAlterDatabaseStmt
+ * - _copyAlterDatabaseSetStmt
+ * - _copyDropdbStmt
+ * - _copyVacuumStmt
+ * - _copyExplainStmt
+ * - _copyCreateTableAsStmt
+ * - _copyRefreshMatViewStmt
+ * - _copyReplicaIdentityStmt
+ * - _copyAlterSystemStmt
+ * - _copyCreateSeqStmt
+ * - _copyAlterSeqStmt
+ * - _copyVariableSetStmt
+ * - _copyVariableShowStmt
+ * - _copyDiscardStmt
+ * - _copyCreateTableSpaceStmt
+ * - _copyDropTableSpaceStmt
+ * - _copyAlterTableSpaceOptionsStmt
+ * - _copyAlterTableMoveAllStmt
+ * - _copyCreateExtensionStmt
+ * - _copyAlterExtensionStmt
+ * - _copyAlterExtensionContentsStmt
+ * - _copyCreateFdwStmt
+ * - _copyAlterFdwStmt
+ * - _copyCreateForeignServerStmt
+ * - _copyAlterForeignServerStmt
+ * - _copyCreateUserMappingStmt
+ * - _copyAlterUserMappingStmt
+ * - _copyDropUserMappingStmt
+ * - _copyCreateForeignTableStmt
+ * - _copyImportForeignSchemaStmt
+ * - _copyCreateTransformStmt
+ * - _copyCreateTrigStmt
+ * - _copyCreateEventTrigStmt
+ * - _copyAlterEventTrigStmt
+ * - _copyCreatePLangStmt
+ * - _copyCreateRoleStmt
+ * - _copyAlterRoleStmt
+ * - _copyAlterRoleSetStmt
+ * - _copyDropRoleStmt
+ * - _copyLockStmt
+ * - _copyConstraintsSetStmt
+ * - _copyReindexStmt
+ * - _copyCreateSchemaStmt
+ * - _copyCreateConversionStmt
+ * - _copyCreateCastStmt
+ * - _copyPrepareStmt
+ * - _copyExecuteStmt
+ * - _copyDeallocateStmt
+ * - _copyDropOwnedStmt
+ * - _copyReassignOwnedStmt
+ * - _copyAlterTSDictionaryStmt
+ * - _copyAlterTSConfigurationStmt
+ * - _copyCreatePolicyStmt
+ * - _copyAlterPolicyStmt
+ * - _copyAExpr
+ * - _copyColumnRef
+ * - _copyParamRef
+ * - _copyAConst
+ * - _copyFuncCall
+ * - _copyAStar
+ * - _copyAIndices
+ * - _copyA_Indirection
+ * - _copyA_ArrayExpr
+ * - _copyResTarget
+ * - _copyMultiAssignRef
+ * - _copyTypeCast
+ * - _copyCollateClause
+ * - _copySortBy
+ * - _copyWindowDef
+ * - _copyRangeSubselect
+ * - _copyRangeFunction
+ * - _copyRangeTableSample
+ * - _copyTypeName
+ * - _copyIndexElem
+ * - _copyColumnDef
+ * - _copyConstraint
+ * - _copyDefElem
+ * - _copyLockingClause
+ * - _copyRangeTblEntry
+ * - _copyRangeTblFunction
+ * - _copyTableSampleClause
+ * - _copyWithCheckOption
+ * - _copySortGroupClause
+ * - _copyGroupingSet
+ * - _copyWindowClause
+ * - _copyRowMarkClause
+ * - _copyWithClause
+ * - _copyInferClause
+ * - _copyOnConflictClause
+ * - _copyCommonTableExpr
+ * - _copyFuncWithArgs
+ * - _copyAccessPriv
+ * - _copyXmlSerialize
+ * - _copyRoleSpec
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * copyfuncs.c
+ *	  Copy functions for Postgres tree nodes.
+ *
+ * NOTE: we currently support copying all node types found in parse and
+ * plan trees.  We do not support copying executor state trees; there
+ * is no need for that, and no point in maintaining all the code that
+ * would be needed.  We also do not support copying Path trees, mainly
+ * because the circular linkages between RelOptInfo and Path nodes can't
+ * be handled easily in a simple depth-first traversal.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ *	  src/backend/nodes/copyfuncs.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+
+#include "miscadmin.h"
+#include "nodes/plannodes.h"
+#include "nodes/relation.h"
+#include "utils/datum.h"
+
+
+/*
+ * Macros to simplify copying of different kinds of fields.  Use these
+ * wherever possible to reduce the chance for silly typos.  Note that these
+ * hard-wire the convention that the local variables in a Copy routine are
+ * named 'newnode' and 'from'.
+ */
+
+/* Copy a simple scalar field (int, float, bool, enum, etc) */
+#define COPY_SCALAR_FIELD(fldname) \
+	(newnode->fldname = from->fldname)
+
+/* Copy a field that is a pointer to some kind of Node or Node tree */
+#define COPY_NODE_FIELD(fldname) \
+	(newnode->fldname = copyObject(from->fldname))
+
+/* Copy a field that is a pointer to a Bitmapset */
+#define COPY_BITMAPSET_FIELD(fldname) \
+	(newnode->fldname = bms_copy(from->fldname))
+
+/* Copy a field that is a pointer to a C string, or perhaps NULL */
+#define COPY_STRING_FIELD(fldname) \
+	(newnode->fldname = from->fldname ? pstrdup(from->fldname) : (char *) NULL)
+
+/* Copy a field that is a pointer to a simple palloc'd object of size sz */
+#define COPY_POINTER_FIELD(fldname, sz) \
+	do { \
+		Size	_size = (sz); \
+		newnode->fldname = palloc(_size); \
+		memcpy(newnode->fldname, from->fldname, _size); \
+	} while (0)
+
+/* Copy a parse location field (for Copy, this is same as scalar case) */
+#define COPY_LOCATION_FIELD(fldname) \
+	(newnode->fldname = from->fldname)
+
+
+/* ****************************************************************
+ *					 plannodes.h copy functions
+ * ****************************************************************
+ */
+
+/*
+ * _copyPlannedStmt
+ */
+static PlannedStmt *
+_copyPlannedStmt(const PlannedStmt *from)
+{
+	PlannedStmt *newnode = makeNode(PlannedStmt);
+
+	COPY_SCALAR_FIELD(commandType);
+	COPY_SCALAR_FIELD(queryId);
+	COPY_SCALAR_FIELD(hasReturning);
+	COPY_SCALAR_FIELD(hasModifyingCTE);
+	COPY_SCALAR_FIELD(canSetTag);
+	COPY_SCALAR_FIELD(transientPlan);
+	COPY_NODE_FIELD(planTree);
+	COPY_NODE_FIELD(rtable);
+	COPY_NODE_FIELD(resultRelations);
+	COPY_NODE_FIELD(utilityStmt);
+	COPY_NODE_FIELD(subplans);
+	COPY_BITMAPSET_FIELD(rewindPlanIDs);
+	COPY_NODE_FIELD(rowMarks);
+	COPY_NODE_FIELD(relationOids);
+	COPY_NODE_FIELD(invalItems);
+	COPY_SCALAR_FIELD(nParamExec);
+	COPY_SCALAR_FIELD(hasRowSecurity);
+
+	return newnode;
+}
+
+/*
+ * CopyPlanFields
+ *
+ *		This function copies the fields of the Plan node.  It is used by
+ *		all the copy functions for classes which inherit from Plan.
+ */
+static void
+CopyPlanFields(const Plan *from, Plan *newnode)
+{
+	COPY_SCALAR_FIELD(startup_cost);
+	COPY_SCALAR_FIELD(total_cost);
+	COPY_SCALAR_FIELD(plan_rows);
+	COPY_SCALAR_FIELD(plan_width);
+	COPY_NODE_FIELD(targetlist);
+	COPY_NODE_FIELD(qual);
+	COPY_NODE_FIELD(lefttree);
+	COPY_NODE_FIELD(righttree);
+	COPY_NODE_FIELD(initPlan);
+	COPY_BITMAPSET_FIELD(extParam);
+	COPY_BITMAPSET_FIELD(allParam);
+}
+
+/*
+ * _copyPlan
+ */
+static Plan *
+_copyPlan(const Plan *from)
+{
+	Plan	   *newnode = makeNode(Plan);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyPlanFields(from, newnode);
+
+	return newnode;
+}
+
+
+/*
+ * _copyResult
+ */
+static Result *
+_copyResult(const Result *from)
+{
+	Result	   *newnode = makeNode(Result);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_NODE_FIELD(resconstantqual);
+
+	return newnode;
+}
+
+/*
+ * _copyModifyTable
+ */
+static ModifyTable *
+_copyModifyTable(const ModifyTable *from)
+{
+	ModifyTable *newnode = makeNode(ModifyTable);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_SCALAR_FIELD(operation);
+	COPY_SCALAR_FIELD(canSetTag);
+	COPY_SCALAR_FIELD(nominalRelation);
+	COPY_NODE_FIELD(resultRelations);
+	COPY_SCALAR_FIELD(resultRelIndex);
+	COPY_NODE_FIELD(plans);
+	COPY_NODE_FIELD(withCheckOptionLists);
+	COPY_NODE_FIELD(returningLists);
+	COPY_NODE_FIELD(fdwPrivLists);
+	COPY_NODE_FIELD(rowMarks);
+	COPY_SCALAR_FIELD(epqParam);
+	COPY_SCALAR_FIELD(onConflictAction);
+	COPY_NODE_FIELD(arbiterIndexes);
+	COPY_NODE_FIELD(onConflictSet);
+	COPY_NODE_FIELD(onConflictWhere);
+	COPY_SCALAR_FIELD(exclRelRTI);
+	COPY_NODE_FIELD(exclRelTlist);
+
+	return newnode;
+}
+
+/*
+ * _copyAppend
+ */
+static Append *
+_copyAppend(const Append *from)
+{
+	Append	   *newnode = makeNode(Append);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_NODE_FIELD(appendplans);
+
+	return newnode;
+}
+
+/*
+ * _copyMergeAppend
+ */
+static MergeAppend *
+_copyMergeAppend(const MergeAppend *from)
+{
+	MergeAppend *newnode = makeNode(MergeAppend);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_NODE_FIELD(mergeplans);
+	COPY_SCALAR_FIELD(numCols);
+	COPY_POINTER_FIELD(sortColIdx, from->numCols * sizeof(AttrNumber));
+	COPY_POINTER_FIELD(sortOperators, from->numCols * sizeof(Oid));
+	COPY_POINTER_FIELD(collations, from->numCols * sizeof(Oid));
+	COPY_POINTER_FIELD(nullsFirst, from->numCols * sizeof(bool));
+
+	return newnode;
+}
+
+/*
+ * _copyRecursiveUnion
+ */
+static RecursiveUnion *
+_copyRecursiveUnion(const RecursiveUnion *from)
+{
+	RecursiveUnion *newnode = makeNode(RecursiveUnion);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_SCALAR_FIELD(wtParam);
+	COPY_SCALAR_FIELD(numCols);
+	if (from->numCols > 0)
+	{
+		COPY_POINTER_FIELD(dupColIdx, from->numCols * sizeof(AttrNumber));
+		COPY_POINTER_FIELD(dupOperators, from->numCols * sizeof(Oid));
+	}
+	COPY_SCALAR_FIELD(numGroups);
+
+	return newnode;
+}
+
+/*
+ * _copyBitmapAnd
+ */
+static BitmapAnd *
+_copyBitmapAnd(const BitmapAnd *from)
+{
+	BitmapAnd  *newnode = makeNode(BitmapAnd);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_NODE_FIELD(bitmapplans);
+
+	return newnode;
+}
+
+/*
+ * _copyBitmapOr
+ */
+static BitmapOr *
+_copyBitmapOr(const BitmapOr *from)
+{
+	BitmapOr   *newnode = makeNode(BitmapOr);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_NODE_FIELD(bitmapplans);
+
+	return newnode;
+}
+
+
+/*
+ * CopyScanFields
+ *
+ *		This function copies the fields of the Scan node.  It is used by
+ *		all the copy functions for classes which inherit from Scan.
+ */
+static void
+CopyScanFields(const Scan *from, Scan *newnode)
+{
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	COPY_SCALAR_FIELD(scanrelid);
+}
+
+/*
+ * _copyScan
+ */
+static Scan *
+_copyScan(const Scan *from)
+{
+	Scan	   *newnode = makeNode(Scan);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyScanFields((const Scan *) from, (Scan *) newnode);
+
+	return newnode;
+}
+
+/*
+ * _copySeqScan
+ */
+static SeqScan *
+_copySeqScan(const SeqScan *from)
+{
+	SeqScan    *newnode = makeNode(SeqScan);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyScanFields((const Scan *) from, (Scan *) newnode);
+
+	return newnode;
+}
+
+/*
+ * _copySampleScan
+ */
+static SampleScan *
+_copySampleScan(const SampleScan *from)
+{
+	SampleScan *newnode = makeNode(SampleScan);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyScanFields((const Scan *) from, (Scan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_NODE_FIELD(tablesample);
+
+	return newnode;
+}
+
+/*
+ * _copyIndexScan
+ */
+static IndexScan *
+_copyIndexScan(const IndexScan *from)
+{
+	IndexScan  *newnode = makeNode(IndexScan);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyScanFields((const Scan *) from, (Scan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_SCALAR_FIELD(indexid);
+	COPY_NODE_FIELD(indexqual);
+	COPY_NODE_FIELD(indexqualorig);
+	COPY_NODE_FIELD(indexorderby);
+	COPY_NODE_FIELD(indexorderbyorig);
+	COPY_NODE_FIELD(indexorderbyops);
+	COPY_SCALAR_FIELD(indexorderdir);
+
+	return newnode;
+}
+
+/*
+ * _copyIndexOnlyScan
+ */
+static IndexOnlyScan *
+_copyIndexOnlyScan(const IndexOnlyScan *from)
+{
+	IndexOnlyScan *newnode = makeNode(IndexOnlyScan);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyScanFields((const Scan *) from, (Scan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_SCALAR_FIELD(indexid);
+	COPY_NODE_FIELD(indexqual);
+	COPY_NODE_FIELD(indexorderby);
+	COPY_NODE_FIELD(indextlist);
+	COPY_SCALAR_FIELD(indexorderdir);
+
+	return newnode;
+}
+
+/*
+ * _copyBitmapIndexScan
+ */
+static BitmapIndexScan *
+_copyBitmapIndexScan(const BitmapIndexScan *from)
+{
+	BitmapIndexScan *newnode = makeNode(BitmapIndexScan);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyScanFields((const Scan *) from, (Scan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_SCALAR_FIELD(indexid);
+	COPY_NODE_FIELD(indexqual);
+	COPY_NODE_FIELD(indexqualorig);
+
+	return newnode;
+}
+
+/*
+ * _copyBitmapHeapScan
+ */
+static BitmapHeapScan *
+_copyBitmapHeapScan(const BitmapHeapScan *from)
+{
+	BitmapHeapScan *newnode = makeNode(BitmapHeapScan);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyScanFields((const Scan *) from, (Scan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_NODE_FIELD(bitmapqualorig);
+
+	return newnode;
+}
+
+/*
+ * _copyTidScan
+ */
+static TidScan *
+_copyTidScan(const TidScan *from)
+{
+	TidScan    *newnode = makeNode(TidScan);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyScanFields((const Scan *) from, (Scan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_NODE_FIELD(tidquals);
+
+	return newnode;
+}
+
+/*
+ * _copySubqueryScan
+ */
+static SubqueryScan *
+_copySubqueryScan(const SubqueryScan *from)
+{
+	SubqueryScan *newnode = makeNode(SubqueryScan);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyScanFields((const Scan *) from, (Scan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_NODE_FIELD(subplan);
+
+	return newnode;
+}
+
+/*
+ * _copyFunctionScan
+ */
+static FunctionScan *
+_copyFunctionScan(const FunctionScan *from)
+{
+	FunctionScan *newnode = makeNode(FunctionScan);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyScanFields((const Scan *) from, (Scan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_NODE_FIELD(functions);
+	COPY_SCALAR_FIELD(funcordinality);
+
+	return newnode;
+}
+
+/*
+ * _copyValuesScan
+ */
+static ValuesScan *
+_copyValuesScan(const ValuesScan *from)
+{
+	ValuesScan *newnode = makeNode(ValuesScan);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyScanFields((const Scan *) from, (Scan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_NODE_FIELD(values_lists);
+
+	return newnode;
+}
+
+/*
+ * _copyCteScan
+ */
+static CteScan *
+_copyCteScan(const CteScan *from)
+{
+	CteScan    *newnode = makeNode(CteScan);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyScanFields((const Scan *) from, (Scan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_SCALAR_FIELD(ctePlanId);
+	COPY_SCALAR_FIELD(cteParam);
+
+	return newnode;
+}
+
+/*
+ * _copyWorkTableScan
+ */
+static WorkTableScan *
+_copyWorkTableScan(const WorkTableScan *from)
+{
+	WorkTableScan *newnode = makeNode(WorkTableScan);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyScanFields((const Scan *) from, (Scan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_SCALAR_FIELD(wtParam);
+
+	return newnode;
+}
+
+/*
+ * _copyForeignScan
+ */
+static ForeignScan *
+_copyForeignScan(const ForeignScan *from)
+{
+	ForeignScan *newnode = makeNode(ForeignScan);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyScanFields((const Scan *) from, (Scan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_SCALAR_FIELD(fs_server);
+	COPY_NODE_FIELD(fdw_exprs);
+	COPY_NODE_FIELD(fdw_private);
+	COPY_NODE_FIELD(fdw_scan_tlist);
+	COPY_NODE_FIELD(fdw_recheck_quals);
+	COPY_BITMAPSET_FIELD(fs_relids);
+	COPY_SCALAR_FIELD(fsSystemCol);
+
+	return newnode;
+}
+
+/*
+ * _copyCustomScan
+ */
+static CustomScan *
+_copyCustomScan(const CustomScan *from)
+{
+	CustomScan *newnode = makeNode(CustomScan);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyScanFields((const Scan *) from, (Scan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_SCALAR_FIELD(flags);
+	COPY_NODE_FIELD(custom_plans);
+	COPY_NODE_FIELD(custom_exprs);
+	COPY_NODE_FIELD(custom_private);
+	COPY_NODE_FIELD(custom_scan_tlist);
+	COPY_BITMAPSET_FIELD(custom_relids);
+
+	/*
+	 * NOTE: The method field of CustomScan is required to be a pointer to a
+	 * static table of callback functions.  So we don't copy the table itself,
+	 * just reference the original one.
+	 */
+	COPY_SCALAR_FIELD(methods);
+
+	return newnode;
+}
+
+/*
+ * CopyJoinFields
+ *
+ *		This function copies the fields of the Join node.  It is used by
+ *		all the copy functions for classes which inherit from Join.
+ */
+static void
+CopyJoinFields(const Join *from, Join *newnode)
+{
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	COPY_SCALAR_FIELD(jointype);
+	COPY_NODE_FIELD(joinqual);
+}
+
+
+/*
+ * _copyJoin
+ */
+static Join *
+_copyJoin(const Join *from)
+{
+	Join	   *newnode = makeNode(Join);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyJoinFields(from, newnode);
+
+	return newnode;
+}
+
+
+/*
+ * _copyNestLoop
+ */
+static NestLoop *
+_copyNestLoop(const NestLoop *from)
+{
+	NestLoop   *newnode = makeNode(NestLoop);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyJoinFields((const Join *) from, (Join *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_NODE_FIELD(nestParams);
+
+	return newnode;
+}
+
+
+/*
+ * _copyMergeJoin
+ */
+static MergeJoin *
+_copyMergeJoin(const MergeJoin *from)
+{
+	MergeJoin  *newnode = makeNode(MergeJoin);
+	int			numCols;
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyJoinFields((const Join *) from, (Join *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_NODE_FIELD(mergeclauses);
+	numCols = list_length(from->mergeclauses);
+	if (numCols > 0)
+	{
+		COPY_POINTER_FIELD(mergeFamilies, numCols * sizeof(Oid));
+		COPY_POINTER_FIELD(mergeCollations, numCols * sizeof(Oid));
+		COPY_POINTER_FIELD(mergeStrategies, numCols * sizeof(int));
+		COPY_POINTER_FIELD(mergeNullsFirst, numCols * sizeof(bool));
+	}
+
+	return newnode;
+}
+
+/*
+ * _copyHashJoin
+ */
+static HashJoin *
+_copyHashJoin(const HashJoin *from)
+{
+	HashJoin   *newnode = makeNode(HashJoin);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyJoinFields((const Join *) from, (Join *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_NODE_FIELD(hashclauses);
+
+	return newnode;
+}
+
+
+/*
+ * _copyMaterial
+ */
+static Material *
+_copyMaterial(const Material *from)
+{
+	Material   *newnode = makeNode(Material);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	return newnode;
+}
+
+
+/*
+ * _copySort
+ */
+static Sort *
+_copySort(const Sort *from)
+{
+	Sort	   *newnode = makeNode(Sort);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	COPY_SCALAR_FIELD(numCols);
+	COPY_POINTER_FIELD(sortColIdx, from->numCols * sizeof(AttrNumber));
+	COPY_POINTER_FIELD(sortOperators, from->numCols * sizeof(Oid));
+	COPY_POINTER_FIELD(collations, from->numCols * sizeof(Oid));
+	COPY_POINTER_FIELD(nullsFirst, from->numCols * sizeof(bool));
+
+	return newnode;
+}
+
+
+/*
+ * _copyGroup
+ */
+static Group *
+_copyGroup(const Group *from)
+{
+	Group	   *newnode = makeNode(Group);
+
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	COPY_SCALAR_FIELD(numCols);
+	COPY_POINTER_FIELD(grpColIdx, from->numCols * sizeof(AttrNumber));
+	COPY_POINTER_FIELD(grpOperators, from->numCols * sizeof(Oid));
+
+	return newnode;
+}
+
+/*
+ * _copyAgg
+ */
+static Agg *
+_copyAgg(const Agg *from)
+{
+	Agg		   *newnode = makeNode(Agg);
+
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	COPY_SCALAR_FIELD(aggstrategy);
+	COPY_SCALAR_FIELD(numCols);
+	if (from->numCols > 0)
+	{
+		COPY_POINTER_FIELD(grpColIdx, from->numCols * sizeof(AttrNumber));
+		COPY_POINTER_FIELD(grpOperators, from->numCols * sizeof(Oid));
+	}
+	COPY_SCALAR_FIELD(numGroups);
+	COPY_NODE_FIELD(groupingSets);
+	COPY_NODE_FIELD(chain);
+
+	return newnode;
+}
+
+/*
+ * _copyWindowAgg
+ */
+static WindowAgg *
+_copyWindowAgg(const WindowAgg *from)
+{
+	WindowAgg  *newnode = makeNode(WindowAgg);
+
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	COPY_SCALAR_FIELD(winref);
+	COPY_SCALAR_FIELD(partNumCols);
+	if (from->partNumCols > 0)
+	{
+		COPY_POINTER_FIELD(partColIdx, from->partNumCols * sizeof(AttrNumber));
+		COPY_POINTER_FIELD(partOperators, from->partNumCols * sizeof(Oid));
+	}
+	COPY_SCALAR_FIELD(ordNumCols);
+	if (from->ordNumCols > 0)
+	{
+		COPY_POINTER_FIELD(ordColIdx, from->ordNumCols * sizeof(AttrNumber));
+		COPY_POINTER_FIELD(ordOperators, from->ordNumCols * sizeof(Oid));
+	}
+	COPY_SCALAR_FIELD(frameOptions);
+	COPY_NODE_FIELD(startOffset);
+	COPY_NODE_FIELD(endOffset);
+
+	return newnode;
+}
+
+/*
+ * _copyUnique
+ */
+static Unique *
+_copyUnique(const Unique *from)
+{
+	Unique	   *newnode = makeNode(Unique);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_SCALAR_FIELD(numCols);
+	COPY_POINTER_FIELD(uniqColIdx, from->numCols * sizeof(AttrNumber));
+	COPY_POINTER_FIELD(uniqOperators, from->numCols * sizeof(Oid));
+
+	return newnode;
+}
+
+/*
+ * _copyHash
+ */
+static Hash *
+_copyHash(const Hash *from)
+{
+	Hash	   *newnode = makeNode(Hash);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_SCALAR_FIELD(skewTable);
+	COPY_SCALAR_FIELD(skewColumn);
+	COPY_SCALAR_FIELD(skewInherit);
+	COPY_SCALAR_FIELD(skewColType);
+	COPY_SCALAR_FIELD(skewColTypmod);
+
+	return newnode;
+}
+
+/*
+ * _copySetOp
+ */
+static SetOp *
+_copySetOp(const SetOp *from)
+{
+	SetOp	   *newnode = makeNode(SetOp);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_SCALAR_FIELD(cmd);
+	COPY_SCALAR_FIELD(strategy);
+	COPY_SCALAR_FIELD(numCols);
+	COPY_POINTER_FIELD(dupColIdx, from->numCols * sizeof(AttrNumber));
+	COPY_POINTER_FIELD(dupOperators, from->numCols * sizeof(Oid));
+	COPY_SCALAR_FIELD(flagColIdx);
+	COPY_SCALAR_FIELD(firstFlag);
+	COPY_SCALAR_FIELD(numGroups);
+
+	return newnode;
+}
+
+/*
+ * _copyLockRows
+ */
+static LockRows *
+_copyLockRows(const LockRows *from)
+{
+	LockRows   *newnode = makeNode(LockRows);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_NODE_FIELD(rowMarks);
+	COPY_SCALAR_FIELD(epqParam);
+
+	return newnode;
+}
+
+/*
+ * _copyLimit
+ */
+static Limit *
+_copyLimit(const Limit *from)
+{
+	Limit	   *newnode = makeNode(Limit);
+
+	/*
+	 * copy node superclass fields
+	 */
+	CopyPlanFields((const Plan *) from, (Plan *) newnode);
+
+	/*
+	 * copy remainder of node
+	 */
+	COPY_NODE_FIELD(limitOffset);
+	COPY_NODE_FIELD(limitCount);
+
+	return newnode;
+}
+
+/*
+ * _copyNestLoopParam
+ */
+static NestLoopParam *
+_copyNestLoopParam(const NestLoopParam *from)
+{
+	NestLoopParam *newnode = makeNode(NestLoopParam);
+
+	COPY_SCALAR_FIELD(paramno);
+	COPY_NODE_FIELD(paramval);
+
+	return newnode;
+}
+
+/*
+ * _copyPlanRowMark
+ */
+static PlanRowMark *
+_copyPlanRowMark(const PlanRowMark *from)
+{
+	PlanRowMark *newnode = makeNode(PlanRowMark);
+
+	COPY_SCALAR_FIELD(rti);
+	COPY_SCALAR_FIELD(prti);
+	COPY_SCALAR_FIELD(rowmarkId);
+	COPY_SCALAR_FIELD(markType);
+	COPY_SCALAR_FIELD(allMarkTypes);
+	COPY_SCALAR_FIELD(strength);
+	COPY_SCALAR_FIELD(waitPolicy);
+	COPY_SCALAR_FIELD(isParent);
+
+	return newnode;
+}
+
+/*
+ * _copyPlanInvalItem
+ */
+static PlanInvalItem *
+_copyPlanInvalItem(const PlanInvalItem *from)
+{
+	PlanInvalItem *newnode = makeNode(PlanInvalItem);
+
+	COPY_SCALAR_FIELD(cacheId);
+	COPY_SCALAR_FIELD(hashValue);
+
+	return newnode;
+}
+
+/* ****************************************************************
+ *					   primnodes.h copy functions
+ * ****************************************************************
+ */
+
+/*
+ * _copyAlias
+ */
+static Alias *
+_copyAlias(const Alias *from)
+{
+	Alias	   *newnode = makeNode(Alias);
+
+	COPY_STRING_FIELD(aliasname);
+	COPY_NODE_FIELD(colnames);
+
+	return newnode;
+}
+
+/*
+ * _copyRangeVar
+ */
+static RangeVar *
+_copyRangeVar(const RangeVar *from)
+{
+	RangeVar   *newnode = makeNode(RangeVar);
+
+	COPY_STRING_FIELD(catalogname);
+	COPY_STRING_FIELD(schemaname);
+	COPY_STRING_FIELD(relname);
+	COPY_SCALAR_FIELD(inhOpt);
+	COPY_SCALAR_FIELD(relpersistence);
+	COPY_NODE_FIELD(alias);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyIntoClause
+ */
+static IntoClause *
+_copyIntoClause(const IntoClause *from)
+{
+	IntoClause *newnode = makeNode(IntoClause);
+
+	COPY_NODE_FIELD(rel);
+	COPY_NODE_FIELD(colNames);
+	COPY_NODE_FIELD(options);
+	COPY_SCALAR_FIELD(onCommit);
+	COPY_STRING_FIELD(tableSpaceName);
+	COPY_NODE_FIELD(viewQuery);
+	COPY_SCALAR_FIELD(skipData);
+
+	return newnode;
+}
+
+/*
+ * We don't need a _copyExpr because Expr is an abstract supertype which
+ * should never actually get instantiated.  Also, since it has no common
+ * fields except NodeTag, there's no need for a helper routine to factor
+ * out copying the common fields...
+ */
+
+/*
+ * _copyVar
+ */
+static Var *
+_copyVar(const Var *from)
+{
+	Var		   *newnode = makeNode(Var);
+
+	COPY_SCALAR_FIELD(varno);
+	COPY_SCALAR_FIELD(varattno);
+	COPY_SCALAR_FIELD(vartype);
+	COPY_SCALAR_FIELD(vartypmod);
+	COPY_SCALAR_FIELD(varcollid);
+	COPY_SCALAR_FIELD(varlevelsup);
+	COPY_SCALAR_FIELD(varnoold);
+	COPY_SCALAR_FIELD(varoattno);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyConst
+ */
+static Const *
+_copyConst(const Const *from)
+{
+	Const	   *newnode = makeNode(Const);
+
+	COPY_SCALAR_FIELD(consttype);
+	COPY_SCALAR_FIELD(consttypmod);
+	COPY_SCALAR_FIELD(constcollid);
+	COPY_SCALAR_FIELD(constlen);
+
+	if (from->constbyval || from->constisnull)
+	{
+		/*
+		 * passed by value so just copy the datum. Also, don't try to copy
+		 * struct when value is null!
+		 */
+		newnode->constvalue = from->constvalue;
+	}
+	else
+	{
+		/*
+		 * passed by reference.  We need a palloc'd copy.
+		 */
+		newnode->constvalue = datumCopy(from->constvalue,
+										from->constbyval,
+										from->constlen);
+	}
+
+	COPY_SCALAR_FIELD(constisnull);
+	COPY_SCALAR_FIELD(constbyval);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyParam
+ */
+static Param *
+_copyParam(const Param *from)
+{
+	Param	   *newnode = makeNode(Param);
+
+	COPY_SCALAR_FIELD(paramkind);
+	COPY_SCALAR_FIELD(paramid);
+	COPY_SCALAR_FIELD(paramtype);
+	COPY_SCALAR_FIELD(paramtypmod);
+	COPY_SCALAR_FIELD(paramcollid);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyAggref
+ */
+static Aggref *
+_copyAggref(const Aggref *from)
+{
+	Aggref	   *newnode = makeNode(Aggref);
+
+	COPY_SCALAR_FIELD(aggfnoid);
+	COPY_SCALAR_FIELD(aggtype);
+	COPY_SCALAR_FIELD(aggcollid);
+	COPY_SCALAR_FIELD(inputcollid);
+	COPY_NODE_FIELD(aggdirectargs);
+	COPY_NODE_FIELD(args);
+	COPY_NODE_FIELD(aggorder);
+	COPY_NODE_FIELD(aggdistinct);
+	COPY_NODE_FIELD(aggfilter);
+	COPY_SCALAR_FIELD(aggstar);
+	COPY_SCALAR_FIELD(aggvariadic);
+	COPY_SCALAR_FIELD(aggkind);
+	COPY_SCALAR_FIELD(agglevelsup);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyGroupingFunc
+ */
+static GroupingFunc *
+_copyGroupingFunc(const GroupingFunc *from)
+{
+	GroupingFunc *newnode = makeNode(GroupingFunc);
+
+	COPY_NODE_FIELD(args);
+	COPY_NODE_FIELD(refs);
+	COPY_NODE_FIELD(cols);
+	COPY_SCALAR_FIELD(agglevelsup);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyWindowFunc
+ */
+static WindowFunc *
+_copyWindowFunc(const WindowFunc *from)
+{
+	WindowFunc *newnode = makeNode(WindowFunc);
+
+	COPY_SCALAR_FIELD(winfnoid);
+	COPY_SCALAR_FIELD(wintype);
+	COPY_SCALAR_FIELD(wincollid);
+	COPY_SCALAR_FIELD(inputcollid);
+	COPY_NODE_FIELD(args);
+	COPY_NODE_FIELD(aggfilter);
+	COPY_SCALAR_FIELD(winref);
+	COPY_SCALAR_FIELD(winstar);
+	COPY_SCALAR_FIELD(winagg);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyArrayRef
+ */
+static ArrayRef *
+_copyArrayRef(const ArrayRef *from)
+{
+	ArrayRef   *newnode = makeNode(ArrayRef);
+
+	COPY_SCALAR_FIELD(refarraytype);
+	COPY_SCALAR_FIELD(refelemtype);
+	COPY_SCALAR_FIELD(reftypmod);
+	COPY_SCALAR_FIELD(refcollid);
+	COPY_NODE_FIELD(refupperindexpr);
+	COPY_NODE_FIELD(reflowerindexpr);
+	COPY_NODE_FIELD(refexpr);
+	COPY_NODE_FIELD(refassgnexpr);
+
+	return newnode;
+}
+
+/*
+ * _copyFuncExpr
+ */
+static FuncExpr *
+_copyFuncExpr(const FuncExpr *from)
+{
+	FuncExpr   *newnode = makeNode(FuncExpr);
+
+	COPY_SCALAR_FIELD(funcid);
+	COPY_SCALAR_FIELD(funcresulttype);
+	COPY_SCALAR_FIELD(funcretset);
+	COPY_SCALAR_FIELD(funcvariadic);
+	COPY_SCALAR_FIELD(funcformat);
+	COPY_SCALAR_FIELD(funccollid);
+	COPY_SCALAR_FIELD(inputcollid);
+	COPY_NODE_FIELD(args);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyNamedArgExpr *
+ */
+static NamedArgExpr *
+_copyNamedArgExpr(const NamedArgExpr *from)
+{
+	NamedArgExpr *newnode = makeNode(NamedArgExpr);
+
+	COPY_NODE_FIELD(arg);
+	COPY_STRING_FIELD(name);
+	COPY_SCALAR_FIELD(argnumber);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyOpExpr
+ */
+static OpExpr *
+_copyOpExpr(const OpExpr *from)
+{
+	OpExpr	   *newnode = makeNode(OpExpr);
+
+	COPY_SCALAR_FIELD(opno);
+	COPY_SCALAR_FIELD(opfuncid);
+	COPY_SCALAR_FIELD(opresulttype);
+	COPY_SCALAR_FIELD(opretset);
+	COPY_SCALAR_FIELD(opcollid);
+	COPY_SCALAR_FIELD(inputcollid);
+	COPY_NODE_FIELD(args);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyDistinctExpr (same as OpExpr)
+ */
+static DistinctExpr *
+_copyDistinctExpr(const DistinctExpr *from)
+{
+	DistinctExpr *newnode = makeNode(DistinctExpr);
+
+	COPY_SCALAR_FIELD(opno);
+	COPY_SCALAR_FIELD(opfuncid);
+	COPY_SCALAR_FIELD(opresulttype);
+	COPY_SCALAR_FIELD(opretset);
+	COPY_SCALAR_FIELD(opcollid);
+	COPY_SCALAR_FIELD(inputcollid);
+	COPY_NODE_FIELD(args);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyNullIfExpr (same as OpExpr)
+ */
+static NullIfExpr *
+_copyNullIfExpr(const NullIfExpr *from)
+{
+	NullIfExpr *newnode = makeNode(NullIfExpr);
+
+	COPY_SCALAR_FIELD(opno);
+	COPY_SCALAR_FIELD(opfuncid);
+	COPY_SCALAR_FIELD(opresulttype);
+	COPY_SCALAR_FIELD(opretset);
+	COPY_SCALAR_FIELD(opcollid);
+	COPY_SCALAR_FIELD(inputcollid);
+	COPY_NODE_FIELD(args);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyScalarArrayOpExpr
+ */
+static ScalarArrayOpExpr *
+_copyScalarArrayOpExpr(const ScalarArrayOpExpr *from)
+{
+	ScalarArrayOpExpr *newnode = makeNode(ScalarArrayOpExpr);
+
+	COPY_SCALAR_FIELD(opno);
+	COPY_SCALAR_FIELD(opfuncid);
+	COPY_SCALAR_FIELD(useOr);
+	COPY_SCALAR_FIELD(inputcollid);
+	COPY_NODE_FIELD(args);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyBoolExpr
+ */
+static BoolExpr *
+_copyBoolExpr(const BoolExpr *from)
+{
+	BoolExpr   *newnode = makeNode(BoolExpr);
+
+	COPY_SCALAR_FIELD(boolop);
+	COPY_NODE_FIELD(args);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copySubLink
+ */
+static SubLink *
+_copySubLink(const SubLink *from)
+{
+	SubLink    *newnode = makeNode(SubLink);
+
+	COPY_SCALAR_FIELD(subLinkType);
+	COPY_SCALAR_FIELD(subLinkId);
+	COPY_NODE_FIELD(testexpr);
+	COPY_NODE_FIELD(operName);
+	COPY_NODE_FIELD(subselect);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copySubPlan
+ */
+static SubPlan *
+_copySubPlan(const SubPlan *from)
+{
+	SubPlan    *newnode = makeNode(SubPlan);
+
+	COPY_SCALAR_FIELD(subLinkType);
+	COPY_NODE_FIELD(testexpr);
+	COPY_NODE_FIELD(paramIds);
+	COPY_SCALAR_FIELD(plan_id);
+	COPY_STRING_FIELD(plan_name);
+	COPY_SCALAR_FIELD(firstColType);
+	COPY_SCALAR_FIELD(firstColTypmod);
+	COPY_SCALAR_FIELD(firstColCollation);
+	COPY_SCALAR_FIELD(useHashTable);
+	COPY_SCALAR_FIELD(unknownEqFalse);
+	COPY_NODE_FIELD(setParam);
+	COPY_NODE_FIELD(parParam);
+	COPY_NODE_FIELD(args);
+	COPY_SCALAR_FIELD(startup_cost);
+	COPY_SCALAR_FIELD(per_call_cost);
+
+	return newnode;
+}
+
+/*
+ * _copyAlternativeSubPlan
+ */
+static AlternativeSubPlan *
+_copyAlternativeSubPlan(const AlternativeSubPlan *from)
+{
+	AlternativeSubPlan *newnode = makeNode(AlternativeSubPlan);
+
+	COPY_NODE_FIELD(subplans);
+
+	return newnode;
+}
+
+/*
+ * _copyFieldSelect
+ */
+static FieldSelect *
+_copyFieldSelect(const FieldSelect *from)
+{
+	FieldSelect *newnode = makeNode(FieldSelect);
+
+	COPY_NODE_FIELD(arg);
+	COPY_SCALAR_FIELD(fieldnum);
+	COPY_SCALAR_FIELD(resulttype);
+	COPY_SCALAR_FIELD(resulttypmod);
+	COPY_SCALAR_FIELD(resultcollid);
+
+	return newnode;
+}
+
+/*
+ * _copyFieldStore
+ */
+static FieldStore *
+_copyFieldStore(const FieldStore *from)
+{
+	FieldStore *newnode = makeNode(FieldStore);
+
+	COPY_NODE_FIELD(arg);
+	COPY_NODE_FIELD(newvals);
+	COPY_NODE_FIELD(fieldnums);
+	COPY_SCALAR_FIELD(resulttype);
+
+	return newnode;
+}
+
+/*
+ * _copyRelabelType
+ */
+static RelabelType *
+_copyRelabelType(const RelabelType *from)
+{
+	RelabelType *newnode = makeNode(RelabelType);
+
+	COPY_NODE_FIELD(arg);
+	COPY_SCALAR_FIELD(resulttype);
+	COPY_SCALAR_FIELD(resulttypmod);
+	COPY_SCALAR_FIELD(resultcollid);
+	COPY_SCALAR_FIELD(relabelformat);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyCoerceViaIO
+ */
+static CoerceViaIO *
+_copyCoerceViaIO(const CoerceViaIO *from)
+{
+	CoerceViaIO *newnode = makeNode(CoerceViaIO);
+
+	COPY_NODE_FIELD(arg);
+	COPY_SCALAR_FIELD(resulttype);
+	COPY_SCALAR_FIELD(resultcollid);
+	COPY_SCALAR_FIELD(coerceformat);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyArrayCoerceExpr
+ */
+static ArrayCoerceExpr *
+_copyArrayCoerceExpr(const ArrayCoerceExpr *from)
+{
+	ArrayCoerceExpr *newnode = makeNode(ArrayCoerceExpr);
+
+	COPY_NODE_FIELD(arg);
+	COPY_SCALAR_FIELD(elemfuncid);
+	COPY_SCALAR_FIELD(resulttype);
+	COPY_SCALAR_FIELD(resulttypmod);
+	COPY_SCALAR_FIELD(resultcollid);
+	COPY_SCALAR_FIELD(isExplicit);
+	COPY_SCALAR_FIELD(coerceformat);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyConvertRowtypeExpr
+ */
+static ConvertRowtypeExpr *
+_copyConvertRowtypeExpr(const ConvertRowtypeExpr *from)
+{
+	ConvertRowtypeExpr *newnode = makeNode(ConvertRowtypeExpr);
+
+	COPY_NODE_FIELD(arg);
+	COPY_SCALAR_FIELD(resulttype);
+	COPY_SCALAR_FIELD(convertformat);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyCollateExpr
+ */
+static CollateExpr *
+_copyCollateExpr(const CollateExpr *from)
+{
+	CollateExpr *newnode = makeNode(CollateExpr);
+
+	COPY_NODE_FIELD(arg);
+	COPY_SCALAR_FIELD(collOid);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyCaseExpr
+ */
+static CaseExpr *
+_copyCaseExpr(const CaseExpr *from)
+{
+	CaseExpr   *newnode = makeNode(CaseExpr);
+
+	COPY_SCALAR_FIELD(casetype);
+	COPY_SCALAR_FIELD(casecollid);
+	COPY_NODE_FIELD(arg);
+	COPY_NODE_FIELD(args);
+	COPY_NODE_FIELD(defresult);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyCaseWhen
+ */
+static CaseWhen *
+_copyCaseWhen(const CaseWhen *from)
+{
+	CaseWhen   *newnode = makeNode(CaseWhen);
+
+	COPY_NODE_FIELD(expr);
+	COPY_NODE_FIELD(result);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyCaseTestExpr
+ */
+static CaseTestExpr *
+_copyCaseTestExpr(const CaseTestExpr *from)
+{
+	CaseTestExpr *newnode = makeNode(CaseTestExpr);
+
+	COPY_SCALAR_FIELD(typeId);
+	COPY_SCALAR_FIELD(typeMod);
+	COPY_SCALAR_FIELD(collation);
+
+	return newnode;
+}
+
+/*
+ * _copyArrayExpr
+ */
+static ArrayExpr *
+_copyArrayExpr(const ArrayExpr *from)
+{
+	ArrayExpr  *newnode = makeNode(ArrayExpr);
+
+	COPY_SCALAR_FIELD(array_typeid);
+	COPY_SCALAR_FIELD(array_collid);
+	COPY_SCALAR_FIELD(element_typeid);
+	COPY_NODE_FIELD(elements);
+	COPY_SCALAR_FIELD(multidims);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyRowExpr
+ */
+static RowExpr *
+_copyRowExpr(const RowExpr *from)
+{
+	RowExpr    *newnode = makeNode(RowExpr);
+
+	COPY_NODE_FIELD(args);
+	COPY_SCALAR_FIELD(row_typeid);
+	COPY_SCALAR_FIELD(row_format);
+	COPY_NODE_FIELD(colnames);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyRowCompareExpr
+ */
+static RowCompareExpr *
+_copyRowCompareExpr(const RowCompareExpr *from)
+{
+	RowCompareExpr *newnode = makeNode(RowCompareExpr);
+
+	COPY_SCALAR_FIELD(rctype);
+	COPY_NODE_FIELD(opnos);
+	COPY_NODE_FIELD(opfamilies);
+	COPY_NODE_FIELD(inputcollids);
+	COPY_NODE_FIELD(largs);
+	COPY_NODE_FIELD(rargs);
+
+	return newnode;
+}
+
+/*
+ * _copyCoalesceExpr
+ */
+static CoalesceExpr *
+_copyCoalesceExpr(const CoalesceExpr *from)
+{
+	CoalesceExpr *newnode = makeNode(CoalesceExpr);
+
+	COPY_SCALAR_FIELD(coalescetype);
+	COPY_SCALAR_FIELD(coalescecollid);
+	COPY_NODE_FIELD(args);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyMinMaxExpr
+ */
+static MinMaxExpr *
+_copyMinMaxExpr(const MinMaxExpr *from)
+{
+	MinMaxExpr *newnode = makeNode(MinMaxExpr);
+
+	COPY_SCALAR_FIELD(minmaxtype);
+	COPY_SCALAR_FIELD(minmaxcollid);
+	COPY_SCALAR_FIELD(inputcollid);
+	COPY_SCALAR_FIELD(op);
+	COPY_NODE_FIELD(args);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyXmlExpr
+ */
+static XmlExpr *
+_copyXmlExpr(const XmlExpr *from)
+{
+	XmlExpr    *newnode = makeNode(XmlExpr);
+
+	COPY_SCALAR_FIELD(op);
+	COPY_STRING_FIELD(name);
+	COPY_NODE_FIELD(named_args);
+	COPY_NODE_FIELD(arg_names);
+	COPY_NODE_FIELD(args);
+	COPY_SCALAR_FIELD(xmloption);
+	COPY_SCALAR_FIELD(type);
+	COPY_SCALAR_FIELD(typmod);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyNullTest
+ */
+static NullTest *
+_copyNullTest(const NullTest *from)
+{
+	NullTest   *newnode = makeNode(NullTest);
+
+	COPY_NODE_FIELD(arg);
+	COPY_SCALAR_FIELD(nulltesttype);
+	COPY_SCALAR_FIELD(argisrow);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyBooleanTest
+ */
+static BooleanTest *
+_copyBooleanTest(const BooleanTest *from)
+{
+	BooleanTest *newnode = makeNode(BooleanTest);
+
+	COPY_NODE_FIELD(arg);
+	COPY_SCALAR_FIELD(booltesttype);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyCoerceToDomain
+ */
+static CoerceToDomain *
+_copyCoerceToDomain(const CoerceToDomain *from)
+{
+	CoerceToDomain *newnode = makeNode(CoerceToDomain);
+
+	COPY_NODE_FIELD(arg);
+	COPY_SCALAR_FIELD(resulttype);
+	COPY_SCALAR_FIELD(resulttypmod);
+	COPY_SCALAR_FIELD(resultcollid);
+	COPY_SCALAR_FIELD(coercionformat);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyCoerceToDomainValue
+ */
+static CoerceToDomainValue *
+_copyCoerceToDomainValue(const CoerceToDomainValue *from)
+{
+	CoerceToDomainValue *newnode = makeNode(CoerceToDomainValue);
+
+	COPY_SCALAR_FIELD(typeId);
+	COPY_SCALAR_FIELD(typeMod);
+	COPY_SCALAR_FIELD(collation);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copySetToDefault
+ */
+static SetToDefault *
+_copySetToDefault(const SetToDefault *from)
+{
+	SetToDefault *newnode = makeNode(SetToDefault);
+
+	COPY_SCALAR_FIELD(typeId);
+	COPY_SCALAR_FIELD(typeMod);
+	COPY_SCALAR_FIELD(collation);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+/*
+ * _copyCurrentOfExpr
+ */
+static CurrentOfExpr *
+_copyCurrentOfExpr(const CurrentOfExpr *from)
+{
+	CurrentOfExpr *newnode = makeNode(CurrentOfExpr);
+
+	COPY_SCALAR_FIELD(cvarno);
+	COPY_STRING_FIELD(cursor_name);
+	COPY_SCALAR_FIELD(cursor_param);
+
+	return newnode;
+}
+
+/*
+ * _copyInferenceElem
+ */
+static InferenceElem *
+_copyInferenceElem(const InferenceElem *from)
+{
+	InferenceElem *newnode = makeNode(InferenceElem);
+
+	COPY_NODE_FIELD(expr);
+	COPY_SCALAR_FIELD(infercollid);
+	COPY_SCALAR_FIELD(inferopclass);
+
+	return newnode;
+}
+
+/*
+ * _copyTargetEntry
+ */
+static TargetEntry *
+_copyTargetEntry(const TargetEntry *from)
+{
+	TargetEntry *newnode = makeNode(TargetEntry);
+
+	COPY_NODE_FIELD(expr);
+	COPY_SCALAR_FIELD(resno);
+	COPY_STRING_FIELD(resname);
+	COPY_SCALAR_FIELD(ressortgroupref);
+	COPY_SCALAR_FIELD(resorigtbl);
+	COPY_SCALAR_FIELD(resorigcol);
+	COPY_SCALAR_FIELD(resjunk);
+
+	return newnode;
+}
+
+/*
+ * _copyRangeTblRef
+ */
+static RangeTblRef *
+_copyRangeTblRef(const RangeTblRef *from)
+{
+	RangeTblRef *newnode = makeNode(RangeTblRef);
+
+	COPY_SCALAR_FIELD(rtindex);
+
+	return newnode;
+}
+
+/*
+ * _copyJoinExpr
+ */
+static JoinExpr *
+_copyJoinExpr(const JoinExpr *from)
+{
+	JoinExpr   *newnode = makeNode(JoinExpr);
+
+	COPY_SCALAR_FIELD(jointype);
+	COPY_SCALAR_FIELD(isNatural);
+	COPY_NODE_FIELD(larg);
+	COPY_NODE_FIELD(rarg);
+	COPY_NODE_FIELD(usingClause);
+	COPY_NODE_FIELD(quals);
+	COPY_NODE_FIELD(alias);
+	COPY_SCALAR_FIELD(rtindex);
+
+	return newnode;
+}
+
+/*
+ * _copyFromExpr
+ */
+static FromExpr *
+_copyFromExpr(const FromExpr *from)
+{
+	FromExpr   *newnode = makeNode(FromExpr);
+
+	COPY_NODE_FIELD(fromlist);
+	COPY_NODE_FIELD(quals);
+
+	return newnode;
+}
+
+/*
+ * _copyOnConflictExpr
+ */
+static OnConflictExpr *
+_copyOnConflictExpr(const OnConflictExpr *from)
+{
+	OnConflictExpr *newnode = makeNode(OnConflictExpr);
+
+	COPY_SCALAR_FIELD(action);
+	COPY_NODE_FIELD(arbiterElems);
+	COPY_NODE_FIELD(arbiterWhere);
+	COPY_SCALAR_FIELD(constraint);
+	COPY_NODE_FIELD(onConflictSet);
+	COPY_NODE_FIELD(onConflictWhere);
+	COPY_SCALAR_FIELD(exclRelIndex);
+	COPY_NODE_FIELD(exclRelTlist);
+
+	return newnode;
+}
+
+/* ****************************************************************
+ *						relation.h copy functions
+ *
+ * We don't support copying RelOptInfo, IndexOptInfo, or Path nodes.
+ * There are some subsidiary structs that are useful to copy, though.
+ * ****************************************************************
+ */
+
+/*
+ * _copyPathKey
+ */
+static PathKey *
+_copyPathKey(const PathKey *from)
+{
+	PathKey    *newnode = makeNode(PathKey);
+
+	/* EquivalenceClasses are never moved, so just shallow-copy the pointer */
+	COPY_SCALAR_FIELD(pk_eclass);
+	COPY_SCALAR_FIELD(pk_opfamily);
+	COPY_SCALAR_FIELD(pk_strategy);
+	COPY_SCALAR_FIELD(pk_nulls_first);
+
+	return newnode;
+}
+
+/*
+ * _copyRestrictInfo
+ */
+static RestrictInfo *
+_copyRestrictInfo(const RestrictInfo *from)
+{
+	RestrictInfo *newnode = makeNode(RestrictInfo);
+
+	COPY_NODE_FIELD(clause);
+	COPY_SCALAR_FIELD(is_pushed_down);
+	COPY_SCALAR_FIELD(outerjoin_delayed);
+	COPY_SCALAR_FIELD(can_join);
+	COPY_SCALAR_FIELD(pseudoconstant);
+	COPY_BITMAPSET_FIELD(clause_relids);
+	COPY_BITMAPSET_FIELD(required_relids);
+	COPY_BITMAPSET_FIELD(outer_relids);
+	COPY_BITMAPSET_FIELD(nullable_relids);
+	COPY_BITMAPSET_FIELD(left_relids);
+	COPY_BITMAPSET_FIELD(right_relids);
+	COPY_NODE_FIELD(orclause);
+	/* EquivalenceClasses are never copied, so shallow-copy the pointers */
+	COPY_SCALAR_FIELD(parent_ec);
+	COPY_SCALAR_FIELD(eval_cost);
+	COPY_SCALAR_FIELD(norm_selec);
+	COPY_SCALAR_FIELD(outer_selec);
+	COPY_NODE_FIELD(mergeopfamilies);
+	/* EquivalenceClasses are never copied, so shallow-copy the pointers */
+	COPY_SCALAR_FIELD(left_ec);
+	COPY_SCALAR_FIELD(right_ec);
+	COPY_SCALAR_FIELD(left_em);
+	COPY_SCALAR_FIELD(right_em);
+	/* MergeScanSelCache isn't a Node, so hard to copy; just reset cache */
+	newnode->scansel_cache = NIL;
+	COPY_SCALAR_FIELD(outer_is_left);
+	COPY_SCALAR_FIELD(hashjoinoperator);
+	COPY_SCALAR_FIELD(left_bucketsize);
+	COPY_SCALAR_FIELD(right_bucketsize);
+
+	return newnode;
+}
+
+/*
+ * _copyPlaceHolderVar
+ */
+static PlaceHolderVar *
+_copyPlaceHolderVar(const PlaceHolderVar *from)
+{
+	PlaceHolderVar *newnode = makeNode(PlaceHolderVar);
+
+	COPY_NODE_FIELD(phexpr);
+	COPY_BITMAPSET_FIELD(phrels);
+	COPY_SCALAR_FIELD(phid);
+	COPY_SCALAR_FIELD(phlevelsup);
+
+	return newnode;
+}
+
+/*
+ * _copySpecialJoinInfo
+ */
+static SpecialJoinInfo *
+_copySpecialJoinInfo(const SpecialJoinInfo *from)
+{
+	SpecialJoinInfo *newnode = makeNode(SpecialJoinInfo);
+
+	COPY_BITMAPSET_FIELD(min_lefthand);
+	COPY_BITMAPSET_FIELD(min_righthand);
+	COPY_BITMAPSET_FIELD(syn_lefthand);
+	COPY_BITMAPSET_FIELD(syn_righthand);
+	COPY_SCALAR_FIELD(jointype);
+	COPY_SCALAR_FIELD(lhs_strict);
+	COPY_SCALAR_FIELD(delay_upper_joins);
+	COPY_SCALAR_FIELD(semi_can_btree);
+	COPY_SCALAR_FIELD(semi_can_hash);
+	COPY_NODE_FIELD(semi_operators);
+	COPY_NODE_FIELD(semi_rhs_exprs);
+
+	return newnode;
+}
+
+/*
+ * _copyAppendRelInfo
+ */
+static AppendRelInfo *
+_copyAppendRelInfo(const AppendRelInfo *from)
+{
+	AppendRelInfo *newnode = makeNode(AppendRelInfo);
+
+	COPY_SCALAR_FIELD(parent_relid);
+	COPY_SCALAR_FIELD(child_relid);
+	COPY_SCALAR_FIELD(parent_reltype);
+	COPY_SCALAR_FIELD(child_reltype);
+	COPY_NODE_FIELD(translated_vars);
+	COPY_SCALAR_FIELD(parent_reloid);
+
+	return newnode;
+}
+
+/*
+ * _copyPlaceHolderInfo
+ */
+static PlaceHolderInfo *
+_copyPlaceHolderInfo(const PlaceHolderInfo *from)
+{
+	PlaceHolderInfo *newnode = makeNode(PlaceHolderInfo);
+
+	COPY_SCALAR_FIELD(phid);
+	COPY_NODE_FIELD(ph_var);
+	COPY_BITMAPSET_FIELD(ph_eval_at);
+	COPY_BITMAPSET_FIELD(ph_lateral);
+	COPY_BITMAPSET_FIELD(ph_needed);
+	COPY_SCALAR_FIELD(ph_width);
+
+	return newnode;
+}
+
+/* ****************************************************************
+ *					parsenodes.h copy functions
+ * ****************************************************************
+ */
+
+static RangeTblEntry *
+_copyRangeTblEntry(const RangeTblEntry *from)
+{
+	RangeTblEntry *newnode = makeNode(RangeTblEntry);
+
+	COPY_SCALAR_FIELD(rtekind);
+	COPY_SCALAR_FIELD(relid);
+	COPY_SCALAR_FIELD(relkind);
+	COPY_NODE_FIELD(tablesample);
+	COPY_NODE_FIELD(subquery);
+	COPY_SCALAR_FIELD(security_barrier);
+	COPY_SCALAR_FIELD(jointype);
+	COPY_NODE_FIELD(joinaliasvars);
+	COPY_NODE_FIELD(functions);
+	COPY_SCALAR_FIELD(funcordinality);
+	COPY_NODE_FIELD(values_lists);
+	COPY_NODE_FIELD(values_collations);
+	COPY_STRING_FIELD(ctename);
+	COPY_SCALAR_FIELD(ctelevelsup);
+	COPY_SCALAR_FIELD(self_reference);
+	COPY_NODE_FIELD(ctecoltypes);
+	COPY_NODE_FIELD(ctecoltypmods);
+	COPY_NODE_FIELD(ctecolcollations);
+	COPY_NODE_FIELD(alias);
+	COPY_NODE_FIELD(eref);
+	COPY_SCALAR_FIELD(lateral);
+	COPY_SCALAR_FIELD(inh);
+	COPY_SCALAR_FIELD(inFromCl);
+	COPY_SCALAR_FIELD(requiredPerms);
+	COPY_SCALAR_FIELD(checkAsUser);
+	COPY_BITMAPSET_FIELD(selectedCols);
+	COPY_BITMAPSET_FIELD(insertedCols);
+	COPY_BITMAPSET_FIELD(updatedCols);
+	COPY_NODE_FIELD(securityQuals);
+
+	return newnode;
+}
+
+static RangeTblFunction *
+_copyRangeTblFunction(const RangeTblFunction *from)
+{
+	RangeTblFunction *newnode = makeNode(RangeTblFunction);
+
+	COPY_NODE_FIELD(funcexpr);
+	COPY_SCALAR_FIELD(funccolcount);
+	COPY_NODE_FIELD(funccolnames);
+	COPY_NODE_FIELD(funccoltypes);
+	COPY_NODE_FIELD(funccoltypmods);
+	COPY_NODE_FIELD(funccolcollations);
+	COPY_BITMAPSET_FIELD(funcparams);
+
+	return newnode;
+}
+
+static TableSampleClause *
+_copyTableSampleClause(const TableSampleClause *from)
+{
+	TableSampleClause *newnode = makeNode(TableSampleClause);
+
+	COPY_SCALAR_FIELD(tsmhandler);
+	COPY_NODE_FIELD(args);
+	COPY_NODE_FIELD(repeatable);
+
+	return newnode;
+}
+
+static WithCheckOption *
+_copyWithCheckOption(const WithCheckOption *from)
+{
+	WithCheckOption *newnode = makeNode(WithCheckOption);
+
+	COPY_SCALAR_FIELD(kind);
+	COPY_STRING_FIELD(relname);
+	COPY_STRING_FIELD(polname);
+	COPY_NODE_FIELD(qual);
+	COPY_SCALAR_FIELD(cascaded);
+
+	return newnode;
+}
+
+static SortGroupClause *
+_copySortGroupClause(const SortGroupClause *from)
+{
+	SortGroupClause *newnode = makeNode(SortGroupClause);
+
+	COPY_SCALAR_FIELD(tleSortGroupRef);
+	COPY_SCALAR_FIELD(eqop);
+	COPY_SCALAR_FIELD(sortop);
+	COPY_SCALAR_FIELD(nulls_first);
+	COPY_SCALAR_FIELD(hashable);
+
+	return newnode;
+}
+
+static GroupingSet *
+_copyGroupingSet(const GroupingSet *from)
+{
+	GroupingSet *newnode = makeNode(GroupingSet);
+
+	COPY_SCALAR_FIELD(kind);
+	COPY_NODE_FIELD(content);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static WindowClause *
+_copyWindowClause(const WindowClause *from)
+{
+	WindowClause *newnode = makeNode(WindowClause);
+
+	COPY_STRING_FIELD(name);
+	COPY_STRING_FIELD(refname);
+	COPY_NODE_FIELD(partitionClause);
+	COPY_NODE_FIELD(orderClause);
+	COPY_SCALAR_FIELD(frameOptions);
+	COPY_NODE_FIELD(startOffset);
+	COPY_NODE_FIELD(endOffset);
+	COPY_SCALAR_FIELD(winref);
+	COPY_SCALAR_FIELD(copiedOrder);
+
+	return newnode;
+}
+
+static RowMarkClause *
+_copyRowMarkClause(const RowMarkClause *from)
+{
+	RowMarkClause *newnode = makeNode(RowMarkClause);
+
+	COPY_SCALAR_FIELD(rti);
+	COPY_SCALAR_FIELD(strength);
+	COPY_SCALAR_FIELD(waitPolicy);
+	COPY_SCALAR_FIELD(pushedDown);
+
+	return newnode;
+}
+
+static WithClause *
+_copyWithClause(const WithClause *from)
+{
+	WithClause *newnode = makeNode(WithClause);
+
+	COPY_NODE_FIELD(ctes);
+	COPY_SCALAR_FIELD(recursive);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static InferClause *
+_copyInferClause(const InferClause *from)
+{
+	InferClause *newnode = makeNode(InferClause);
+
+	COPY_NODE_FIELD(indexElems);
+	COPY_NODE_FIELD(whereClause);
+	COPY_STRING_FIELD(conname);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static OnConflictClause *
+_copyOnConflictClause(const OnConflictClause *from)
+{
+	OnConflictClause *newnode = makeNode(OnConflictClause);
+
+	COPY_SCALAR_FIELD(action);
+	COPY_NODE_FIELD(infer);
+	COPY_NODE_FIELD(targetList);
+	COPY_NODE_FIELD(whereClause);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static CommonTableExpr *
+_copyCommonTableExpr(const CommonTableExpr *from)
+{
+	CommonTableExpr *newnode = makeNode(CommonTableExpr);
+
+	COPY_STRING_FIELD(ctename);
+	COPY_NODE_FIELD(aliascolnames);
+	COPY_NODE_FIELD(ctequery);
+	COPY_LOCATION_FIELD(location);
+	COPY_SCALAR_FIELD(cterecursive);
+	COPY_SCALAR_FIELD(cterefcount);
+	COPY_NODE_FIELD(ctecolnames);
+	COPY_NODE_FIELD(ctecoltypes);
+	COPY_NODE_FIELD(ctecoltypmods);
+	COPY_NODE_FIELD(ctecolcollations);
+
+	return newnode;
+}
+
+static A_Expr *
+_copyAExpr(const A_Expr *from)
+{
+	A_Expr	   *newnode = makeNode(A_Expr);
+
+	COPY_SCALAR_FIELD(kind);
+	COPY_NODE_FIELD(name);
+	COPY_NODE_FIELD(lexpr);
+	COPY_NODE_FIELD(rexpr);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static ColumnRef *
+_copyColumnRef(const ColumnRef *from)
+{
+	ColumnRef  *newnode = makeNode(ColumnRef);
+
+	COPY_NODE_FIELD(fields);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static ParamRef *
+_copyParamRef(const ParamRef *from)
+{
+	ParamRef   *newnode = makeNode(ParamRef);
+
+	COPY_SCALAR_FIELD(number);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static A_Const *
+_copyAConst(const A_Const *from)
+{
+	A_Const    *newnode = makeNode(A_Const);
+
+	/* This part must duplicate _copyValue */
+	COPY_SCALAR_FIELD(val.type);
+	switch (from->val.type)
+	{
+		case T_Integer:
+			COPY_SCALAR_FIELD(val.val.ival);
+			break;
+		case T_Float:
+		case T_String:
+		case T_BitString:
+			COPY_STRING_FIELD(val.val.str);
+			break;
+		case T_Null:
+			/* nothing to do */
+			break;
+		default:
+			elog(ERROR, "unrecognized node type: %d",
+				 (int) from->val.type);
+			break;
+	}
+
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static FuncCall *
+_copyFuncCall(const FuncCall *from)
+{
+	FuncCall   *newnode = makeNode(FuncCall);
+
+	COPY_NODE_FIELD(funcname);
+	COPY_NODE_FIELD(args);
+	COPY_NODE_FIELD(agg_order);
+	COPY_NODE_FIELD(agg_filter);
+	COPY_SCALAR_FIELD(agg_within_group);
+	COPY_SCALAR_FIELD(agg_star);
+	COPY_SCALAR_FIELD(agg_distinct);
+	COPY_SCALAR_FIELD(func_variadic);
+	COPY_NODE_FIELD(over);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static A_Star *
+_copyAStar(const A_Star *from)
+{
+	A_Star	   *newnode = makeNode(A_Star);
+
+	return newnode;
+}
+
+static A_Indices *
+_copyAIndices(const A_Indices *from)
+{
+	A_Indices  *newnode = makeNode(A_Indices);
+
+	COPY_NODE_FIELD(lidx);
+	COPY_NODE_FIELD(uidx);
+
+	return newnode;
+}
+
+static A_Indirection *
+_copyA_Indirection(const A_Indirection *from)
+{
+	A_Indirection *newnode = makeNode(A_Indirection);
+
+	COPY_NODE_FIELD(arg);
+	COPY_NODE_FIELD(indirection);
+
+	return newnode;
+}
+
+static A_ArrayExpr *
+_copyA_ArrayExpr(const A_ArrayExpr *from)
+{
+	A_ArrayExpr *newnode = makeNode(A_ArrayExpr);
+
+	COPY_NODE_FIELD(elements);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static ResTarget *
+_copyResTarget(const ResTarget *from)
+{
+	ResTarget  *newnode = makeNode(ResTarget);
+
+	COPY_STRING_FIELD(name);
+	COPY_NODE_FIELD(indirection);
+	COPY_NODE_FIELD(val);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static MultiAssignRef *
+_copyMultiAssignRef(const MultiAssignRef *from)
+{
+	MultiAssignRef *newnode = makeNode(MultiAssignRef);
+
+	COPY_NODE_FIELD(source);
+	COPY_SCALAR_FIELD(colno);
+	COPY_SCALAR_FIELD(ncolumns);
+
+	return newnode;
+}
+
+static TypeName *
+_copyTypeName(const TypeName *from)
+{
+	TypeName   *newnode = makeNode(TypeName);
+
+	COPY_NODE_FIELD(names);
+	COPY_SCALAR_FIELD(typeOid);
+	COPY_SCALAR_FIELD(setof);
+	COPY_SCALAR_FIELD(pct_type);
+	COPY_NODE_FIELD(typmods);
+	COPY_SCALAR_FIELD(typemod);
+	COPY_NODE_FIELD(arrayBounds);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static SortBy *
+_copySortBy(const SortBy *from)
+{
+	SortBy	   *newnode = makeNode(SortBy);
+
+	COPY_NODE_FIELD(node);
+	COPY_SCALAR_FIELD(sortby_dir);
+	COPY_SCALAR_FIELD(sortby_nulls);
+	COPY_NODE_FIELD(useOp);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static WindowDef *
+_copyWindowDef(const WindowDef *from)
+{
+	WindowDef  *newnode = makeNode(WindowDef);
+
+	COPY_STRING_FIELD(name);
+	COPY_STRING_FIELD(refname);
+	COPY_NODE_FIELD(partitionClause);
+	COPY_NODE_FIELD(orderClause);
+	COPY_SCALAR_FIELD(frameOptions);
+	COPY_NODE_FIELD(startOffset);
+	COPY_NODE_FIELD(endOffset);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static RangeSubselect *
+_copyRangeSubselect(const RangeSubselect *from)
+{
+	RangeSubselect *newnode = makeNode(RangeSubselect);
+
+	COPY_SCALAR_FIELD(lateral);
+	COPY_NODE_FIELD(subquery);
+	COPY_NODE_FIELD(alias);
+
+	return newnode;
+}
+
+static RangeFunction *
+_copyRangeFunction(const RangeFunction *from)
+{
+	RangeFunction *newnode = makeNode(RangeFunction);
+
+	COPY_SCALAR_FIELD(lateral);
+	COPY_SCALAR_FIELD(ordinality);
+	COPY_SCALAR_FIELD(is_rowsfrom);
+	COPY_NODE_FIELD(functions);
+	COPY_NODE_FIELD(alias);
+	COPY_NODE_FIELD(coldeflist);
+
+	return newnode;
+}
+
+static RangeTableSample *
+_copyRangeTableSample(const RangeTableSample *from)
+{
+	RangeTableSample *newnode = makeNode(RangeTableSample);
+
+	COPY_NODE_FIELD(relation);
+	COPY_NODE_FIELD(method);
+	COPY_NODE_FIELD(args);
+	COPY_NODE_FIELD(repeatable);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static TypeCast *
+_copyTypeCast(const TypeCast *from)
+{
+	TypeCast   *newnode = makeNode(TypeCast);
+
+	COPY_NODE_FIELD(arg);
+	COPY_NODE_FIELD(typeName);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static CollateClause *
+_copyCollateClause(const CollateClause *from)
+{
+	CollateClause *newnode = makeNode(CollateClause);
+
+	COPY_NODE_FIELD(arg);
+	COPY_NODE_FIELD(collname);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static IndexElem *
+_copyIndexElem(const IndexElem *from)
+{
+	IndexElem  *newnode = makeNode(IndexElem);
+
+	COPY_STRING_FIELD(name);
+	COPY_NODE_FIELD(expr);
+	COPY_STRING_FIELD(indexcolname);
+	COPY_NODE_FIELD(collation);
+	COPY_NODE_FIELD(opclass);
+	COPY_SCALAR_FIELD(ordering);
+	COPY_SCALAR_FIELD(nulls_ordering);
+
+	return newnode;
+}
+
+static ColumnDef *
+_copyColumnDef(const ColumnDef *from)
+{
+	ColumnDef  *newnode = makeNode(ColumnDef);
+
+	COPY_STRING_FIELD(colname);
+	COPY_NODE_FIELD(typeName);
+	COPY_SCALAR_FIELD(inhcount);
+	COPY_SCALAR_FIELD(is_local);
+	COPY_SCALAR_FIELD(is_not_null);
+	COPY_SCALAR_FIELD(is_from_type);
+	COPY_SCALAR_FIELD(storage);
+	COPY_NODE_FIELD(raw_default);
+	COPY_NODE_FIELD(cooked_default);
+	COPY_NODE_FIELD(collClause);
+	COPY_SCALAR_FIELD(collOid);
+	COPY_NODE_FIELD(constraints);
+	COPY_NODE_FIELD(fdwoptions);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static Constraint *
+_copyConstraint(const Constraint *from)
+{
+	Constraint *newnode = makeNode(Constraint);
+
+	COPY_SCALAR_FIELD(contype);
+	COPY_STRING_FIELD(conname);
+	COPY_SCALAR_FIELD(deferrable);
+	COPY_SCALAR_FIELD(initdeferred);
+	COPY_LOCATION_FIELD(location);
+	COPY_SCALAR_FIELD(is_no_inherit);
+	COPY_NODE_FIELD(raw_expr);
+	COPY_STRING_FIELD(cooked_expr);
+	COPY_NODE_FIELD(keys);
+	COPY_NODE_FIELD(exclusions);
+	COPY_NODE_FIELD(options);
+	COPY_STRING_FIELD(indexname);
+	COPY_STRING_FIELD(indexspace);
+	COPY_STRING_FIELD(access_method);
+	COPY_NODE_FIELD(where_clause);
+	COPY_NODE_FIELD(pktable);
+	COPY_NODE_FIELD(fk_attrs);
+	COPY_NODE_FIELD(pk_attrs);
+	COPY_SCALAR_FIELD(fk_matchtype);
+	COPY_SCALAR_FIELD(fk_upd_action);
+	COPY_SCALAR_FIELD(fk_del_action);
+	COPY_NODE_FIELD(old_conpfeqop);
+	COPY_SCALAR_FIELD(old_pktable_oid);
+	COPY_SCALAR_FIELD(skip_validation);
+	COPY_SCALAR_FIELD(initially_valid);
+
+	return newnode;
+}
+
+static DefElem *
+_copyDefElem(const DefElem *from)
+{
+	DefElem    *newnode = makeNode(DefElem);
+
+	COPY_STRING_FIELD(defnamespace);
+	COPY_STRING_FIELD(defname);
+	COPY_NODE_FIELD(arg);
+	COPY_SCALAR_FIELD(defaction);
+
+	return newnode;
+}
+
+static LockingClause *
+_copyLockingClause(const LockingClause *from)
+{
+	LockingClause *newnode = makeNode(LockingClause);
+
+	COPY_NODE_FIELD(lockedRels);
+	COPY_SCALAR_FIELD(strength);
+	COPY_SCALAR_FIELD(waitPolicy);
+
+	return newnode;
+}
+
+static XmlSerialize *
+_copyXmlSerialize(const XmlSerialize *from)
+{
+	XmlSerialize *newnode = makeNode(XmlSerialize);
+
+	COPY_SCALAR_FIELD(xmloption);
+	COPY_NODE_FIELD(expr);
+	COPY_NODE_FIELD(typeName);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static RoleSpec *
+_copyRoleSpec(const RoleSpec *from)
+{
+	RoleSpec   *newnode = makeNode(RoleSpec);
+
+	COPY_SCALAR_FIELD(roletype);
+	COPY_STRING_FIELD(rolename);
+	COPY_LOCATION_FIELD(location);
+
+	return newnode;
+}
+
+static Query *
+_copyQuery(const Query *from)
+{
+	Query	   *newnode = makeNode(Query);
+
+	COPY_SCALAR_FIELD(commandType);
+	COPY_SCALAR_FIELD(querySource);
+	COPY_SCALAR_FIELD(queryId);
+	COPY_SCALAR_FIELD(canSetTag);
+	COPY_NODE_FIELD(utilityStmt);
+	COPY_SCALAR_FIELD(resultRelation);
+	COPY_SCALAR_FIELD(hasAggs);
+	COPY_SCALAR_FIELD(hasWindowFuncs);
+	COPY_SCALAR_FIELD(hasSubLinks);
+	COPY_SCALAR_FIELD(hasDistinctOn);
+	COPY_SCALAR_FIELD(hasRecursive);
+	COPY_SCALAR_FIELD(hasModifyingCTE);
+	COPY_SCALAR_FIELD(hasForUpdate);
+	COPY_SCALAR_FIELD(hasRowSecurity);
+	COPY_NODE_FIELD(cteList);
+	COPY_NODE_FIELD(rtable);
+	COPY_NODE_FIELD(jointree);
+	COPY_NODE_FIELD(targetList);
+	COPY_NODE_FIELD(onConflict);
+	COPY_NODE_FIELD(returningList);
+	COPY_NODE_FIELD(groupClause);
+	COPY_NODE_FIELD(groupingSets);
+	COPY_NODE_FIELD(havingQual);
+	COPY_NODE_FIELD(windowClause);
+	COPY_NODE_FIELD(distinctClause);
+	COPY_NODE_FIELD(sortClause);
+	COPY_NODE_FIELD(limitOffset);
+	COPY_NODE_FIELD(limitCount);
+	COPY_NODE_FIELD(rowMarks);
+	COPY_NODE_FIELD(setOperations);
+	COPY_NODE_FIELD(constraintDeps);
+	COPY_NODE_FIELD(withCheckOptions);
+
+	return newnode;
+}
+
+static InsertStmt *
+_copyInsertStmt(const InsertStmt *from)
+{
+	InsertStmt *newnode = makeNode(InsertStmt);
+
+	COPY_NODE_FIELD(relation);
+	COPY_NODE_FIELD(cols);
+	COPY_NODE_FIELD(selectStmt);
+	COPY_NODE_FIELD(onConflictClause);
+	COPY_NODE_FIELD(returningList);
+	COPY_NODE_FIELD(withClause);
+
+	return newnode;
+}
+
+static DeleteStmt *
+_copyDeleteStmt(const DeleteStmt *from)
+{
+	DeleteStmt *newnode = makeNode(DeleteStmt);
+
+	COPY_NODE_FIELD(relation);
+	COPY_NODE_FIELD(usingClause);
+	COPY_NODE_FIELD(whereClause);
+	COPY_NODE_FIELD(returningList);
+	COPY_NODE_FIELD(withClause);
+
+	return newnode;
+}
+
+static UpdateStmt *
+_copyUpdateStmt(const UpdateStmt *from)
+{
+	UpdateStmt *newnode = makeNode(UpdateStmt);
+
+	COPY_NODE_FIELD(relation);
+	COPY_NODE_FIELD(targetList);
+	COPY_NODE_FIELD(whereClause);
+	COPY_NODE_FIELD(fromClause);
+	COPY_NODE_FIELD(returningList);
+	COPY_NODE_FIELD(withClause);
+
+	return newnode;
+}
+
+static SelectStmt *
+_copySelectStmt(const SelectStmt *from)
+{
+	SelectStmt *newnode = makeNode(SelectStmt);
+
+	COPY_NODE_FIELD(distinctClause);
+	COPY_NODE_FIELD(intoClause);
+	COPY_NODE_FIELD(targetList);
+	COPY_NODE_FIELD(fromClause);
+	COPY_NODE_FIELD(whereClause);
+	COPY_NODE_FIELD(groupClause);
+	COPY_NODE_FIELD(havingClause);
+	COPY_NODE_FIELD(windowClause);
+	COPY_NODE_FIELD(valuesLists);
+	COPY_NODE_FIELD(sortClause);
+	COPY_NODE_FIELD(limitOffset);
+	COPY_NODE_FIELD(limitCount);
+	COPY_NODE_FIELD(lockingClause);
+	COPY_NODE_FIELD(withClause);
+	COPY_SCALAR_FIELD(op);
+	COPY_SCALAR_FIELD(all);
+	COPY_NODE_FIELD(larg);
+	COPY_NODE_FIELD(rarg);
+
+	return newnode;
+}
+
+static SetOperationStmt *
+_copySetOperationStmt(const SetOperationStmt *from)
+{
+	SetOperationStmt *newnode = makeNode(SetOperationStmt);
+
+	COPY_SCALAR_FIELD(op);
+	COPY_SCALAR_FIELD(all);
+	COPY_NODE_FIELD(larg);
+	COPY_NODE_FIELD(rarg);
+	COPY_NODE_FIELD(colTypes);
+	COPY_NODE_FIELD(colTypmods);
+	COPY_NODE_FIELD(colCollations);
+	COPY_NODE_FIELD(groupClauses);
+
+	return newnode;
+}
+
+static AlterTableStmt *
+_copyAlterTableStmt(const AlterTableStmt *from)
+{
+	AlterTableStmt *newnode = makeNode(AlterTableStmt);
+
+	COPY_NODE_FIELD(relation);
+	COPY_NODE_FIELD(cmds);
+	COPY_SCALAR_FIELD(relkind);
+	COPY_SCALAR_FIELD(missing_ok);
+
+	return newnode;
+}
+
+static AlterTableCmd *
+_copyAlterTableCmd(const AlterTableCmd *from)
+{
+	AlterTableCmd *newnode = makeNode(AlterTableCmd);
+
+	COPY_SCALAR_FIELD(subtype);
+	COPY_STRING_FIELD(name);
+	COPY_NODE_FIELD(newowner);
+	COPY_NODE_FIELD(def);
+	COPY_SCALAR_FIELD(behavior);
+	COPY_SCALAR_FIELD(missing_ok);
+
+	return newnode;
+}
+
+static AlterDomainStmt *
+_copyAlterDomainStmt(const AlterDomainStmt *from)
+{
+	AlterDomainStmt *newnode = makeNode(AlterDomainStmt);
+
+	COPY_SCALAR_FIELD(subtype);
+	COPY_NODE_FIELD(typeName);
+	COPY_STRING_FIELD(name);
+	COPY_NODE_FIELD(def);
+	COPY_SCALAR_FIELD(behavior);
+	COPY_SCALAR_FIELD(missing_ok);
+
+	return newnode;
+}
+
+static GrantStmt *
+_copyGrantStmt(const GrantStmt *from)
+{
+	GrantStmt  *newnode = makeNode(GrantStmt);
+
+	COPY_SCALAR_FIELD(is_grant);
+	COPY_SCALAR_FIELD(targtype);
+	COPY_SCALAR_FIELD(objtype);
+	COPY_NODE_FIELD(objects);
+	COPY_NODE_FIELD(privileges);
+	COPY_NODE_FIELD(grantees);
+	COPY_SCALAR_FIELD(grant_option);
+	COPY_SCALAR_FIELD(behavior);
+
+	return newnode;
+}
+
+static FuncWithArgs *
+_copyFuncWithArgs(const FuncWithArgs *from)
+{
+	FuncWithArgs *newnode = makeNode(FuncWithArgs);
+
+	COPY_NODE_FIELD(funcname);
+	COPY_NODE_FIELD(funcargs);
+
+	return newnode;
+}
+
+static AccessPriv *
+_copyAccessPriv(const AccessPriv *from)
+{
+	AccessPriv *newnode = makeNode(AccessPriv);
+
+	COPY_STRING_FIELD(priv_name);
+	COPY_NODE_FIELD(cols);
+
+	return newnode;
+}
+
+static GrantRoleStmt *
+_copyGrantRoleStmt(const GrantRoleStmt *from)
+{
+	GrantRoleStmt *newnode = makeNode(GrantRoleStmt);
+
+	COPY_NODE_FIELD(granted_roles);
+	COPY_NODE_FIELD(grantee_roles);
+	COPY_SCALAR_FIELD(is_grant);
+	COPY_SCALAR_FIELD(admin_opt);
+	COPY_NODE_FIELD(grantor);
+	COPY_SCALAR_FIELD(behavior);
+
+	return newnode;
+}
+
+static AlterDefaultPrivilegesStmt *
+_copyAlterDefaultPrivilegesStmt(const AlterDefaultPrivilegesStmt *from)
+{
+	AlterDefaultPrivilegesStmt *newnode = makeNode(AlterDefaultPrivilegesStmt);
+
+	COPY_NODE_FIELD(options);
+	COPY_NODE_FIELD(action);
+
+	return newnode;
+}
+
+static DeclareCursorStmt *
+_copyDeclareCursorStmt(const DeclareCursorStmt *from)
+{
+	DeclareCursorStmt *newnode = makeNode(DeclareCursorStmt);
+
+	COPY_STRING_FIELD(portalname);
+	COPY_SCALAR_FIELD(options);
+	COPY_NODE_FIELD(query);
+
+	return newnode;
+}
+
+static ClosePortalStmt *
+_copyClosePortalStmt(const ClosePortalStmt *from)
+{
+	ClosePortalStmt *newnode = makeNode(ClosePortalStmt);
+
+	COPY_STRING_FIELD(portalname);
+
+	return newnode;
+}
+
+static ClusterStmt *
+_copyClusterStmt(const ClusterStmt *from)
+{
+	ClusterStmt *newnode = makeNode(ClusterStmt);
+
+	COPY_NODE_FIELD(relation);
+	COPY_STRING_FIELD(indexname);
+	COPY_SCALAR_FIELD(verbose);
+
+	return newnode;
+}
+
+static CopyStmt *
+_copyCopyStmt(const CopyStmt *from)
+{
+	CopyStmt   *newnode = makeNode(CopyStmt);
+
+	COPY_NODE_FIELD(relation);
+	COPY_NODE_FIELD(query);
+	COPY_NODE_FIELD(attlist);
+	COPY_SCALAR_FIELD(is_from);
+	COPY_SCALAR_FIELD(is_program);
+	COPY_STRING_FIELD(filename);
+	COPY_NODE_FIELD(options);
+
+	return newnode;
+}
+
+/*
+ * CopyCreateStmtFields
+ *
+ *		This function copies the fields of the CreateStmt node.  It is used by
+ *		copy functions for classes which inherit from CreateStmt.
+ */
+static void
+CopyCreateStmtFields(const CreateStmt *from, CreateStmt *newnode)
+{
+	COPY_NODE_FIELD(relation);
+	COPY_NODE_FIELD(tableElts);
+	COPY_NODE_FIELD(inhRelations);
+	COPY_NODE_FIELD(ofTypename);
+	COPY_NODE_FIELD(constraints);
+	COPY_NODE_FIELD(options);
+	COPY_SCALAR_FIELD(oncommit);
+	COPY_STRING_FIELD(tablespacename);
+	COPY_SCALAR_FIELD(if_not_exists);
+}
+
+static CreateStmt *
+_copyCreateStmt(const CreateStmt *from)
+{
+	CreateStmt *newnode = makeNode(CreateStmt);
+
+	CopyCreateStmtFields(from, newnode);
+
+	return newnode;
+}
+
+static TableLikeClause *
+_copyTableLikeClause(const TableLikeClause *from)
+{
+	TableLikeClause *newnode = makeNode(TableLikeClause);
+
+	COPY_NODE_FIELD(relation);
+	COPY_SCALAR_FIELD(options);
+
+	return newnode;
+}
+
+static DefineStmt *
+_copyDefineStmt(const DefineStmt *from)
+{
+	DefineStmt *newnode = makeNode(DefineStmt);
+
+	COPY_SCALAR_FIELD(kind);
+	COPY_SCALAR_FIELD(oldstyle);
+	COPY_NODE_FIELD(defnames);
+	COPY_NODE_FIELD(args);
+	COPY_NODE_FIELD(definition);
+
+	return newnode;
+}
+
+static DropStmt *
+_copyDropStmt(const DropStmt *from)
+{
+	DropStmt   *newnode = makeNode(DropStmt);
+
+	COPY_NODE_FIELD(objects);
+	COPY_NODE_FIELD(arguments);
+	COPY_SCALAR_FIELD(removeType);
+	COPY_SCALAR_FIELD(behavior);
+	COPY_SCALAR_FIELD(missing_ok);
+	COPY_SCALAR_FIELD(concurrent);
+
+	return newnode;
+}
+
+static TruncateStmt *
+_copyTruncateStmt(const TruncateStmt *from)
+{
+	TruncateStmt *newnode = makeNode(TruncateStmt);
+
+	COPY_NODE_FIELD(relations);
+	COPY_SCALAR_FIELD(restart_seqs);
+	COPY_SCALAR_FIELD(behavior);
+
+	return newnode;
+}
+
+static CommentStmt *
+_copyCommentStmt(const CommentStmt *from)
+{
+	CommentStmt *newnode = makeNode(CommentStmt);
+
+	COPY_SCALAR_FIELD(objtype);
+	COPY_NODE_FIELD(objname);
+	COPY_NODE_FIELD(objargs);
+	COPY_STRING_FIELD(comment);
+
+	return newnode;
+}
+
+static SecLabelStmt *
+_copySecLabelStmt(const SecLabelStmt *from)
+{
+	SecLabelStmt *newnode = makeNode(SecLabelStmt);
+
+	COPY_SCALAR_FIELD(objtype);
+	COPY_NODE_FIELD(objname);
+	COPY_NODE_FIELD(objargs);
+	COPY_STRING_FIELD(provider);
+	COPY_STRING_FIELD(label);
+
+	return newnode;
+}
+
+static FetchStmt *
+_copyFetchStmt(const FetchStmt *from)
+{
+	FetchStmt  *newnode = makeNode(FetchStmt);
+
+	COPY_SCALAR_FIELD(direction);
+	COPY_SCALAR_FIELD(howMany);
+	COPY_STRING_FIELD(portalname);
+	COPY_SCALAR_FIELD(ismove);
+
+	return newnode;
+}
+
+static IndexStmt *
+_copyIndexStmt(const IndexStmt *from)
+{
+	IndexStmt  *newnode = makeNode(IndexStmt);
+
+	COPY_STRING_FIELD(idxname);
+	COPY_NODE_FIELD(relation);
+	COPY_STRING_FIELD(accessMethod);
+	COPY_STRING_FIELD(tableSpace);
+	COPY_NODE_FIELD(indexParams);
+	COPY_NODE_FIELD(options);
+	COPY_NODE_FIELD(whereClause);
+	COPY_NODE_FIELD(excludeOpNames);
+	COPY_STRING_FIELD(idxcomment);
+	COPY_SCALAR_FIELD(indexOid);
+	COPY_SCALAR_FIELD(oldNode);
+	COPY_SCALAR_FIELD(unique);
+	COPY_SCALAR_FIELD(primary);
+	COPY_SCALAR_FIELD(isconstraint);
+	COPY_SCALAR_FIELD(deferrable);
+	COPY_SCALAR_FIELD(initdeferred);
+	COPY_SCALAR_FIELD(transformed);
+	COPY_SCALAR_FIELD(concurrent);
+	COPY_SCALAR_FIELD(if_not_exists);
+
+	return newnode;
+}
+
+static CreateFunctionStmt *
+_copyCreateFunctionStmt(const CreateFunctionStmt *from)
+{
+	CreateFunctionStmt *newnode = makeNode(CreateFunctionStmt);
+
+	COPY_SCALAR_FIELD(replace);
+	COPY_NODE_FIELD(funcname);
+	COPY_NODE_FIELD(parameters);
+	COPY_NODE_FIELD(returnType);
+	COPY_NODE_FIELD(options);
+	COPY_NODE_FIELD(withClause);
+
+	return newnode;
+}
+
+static FunctionParameter *
+_copyFunctionParameter(const FunctionParameter *from)
+{
+	FunctionParameter *newnode = makeNode(FunctionParameter);
+
+	COPY_STRING_FIELD(name);
+	COPY_NODE_FIELD(argType);
+	COPY_SCALAR_FIELD(mode);
+	COPY_NODE_FIELD(defexpr);
+
+	return newnode;
+}
+
+static AlterFunctionStmt *
+_copyAlterFunctionStmt(const AlterFunctionStmt *from)
+{
+	AlterFunctionStmt *newnode = makeNode(AlterFunctionStmt);
+
+	COPY_NODE_FIELD(func);
+	COPY_NODE_FIELD(actions);
+
+	return newnode;
+}
+
+static DoStmt *
+_copyDoStmt(const DoStmt *from)
+{
+	DoStmt	   *newnode = makeNode(DoStmt);
+
+	COPY_NODE_FIELD(args);
+
+	return newnode;
+}
+
+static RenameStmt *
+_copyRenameStmt(const RenameStmt *from)
+{
+	RenameStmt *newnode = makeNode(RenameStmt);
+
+	COPY_SCALAR_FIELD(renameType);
+	COPY_SCALAR_FIELD(relationType);
+	COPY_NODE_FIELD(relation);
+	COPY_NODE_FIELD(object);
+	COPY_NODE_FIELD(objarg);
+	COPY_STRING_FIELD(subname);
+	COPY_STRING_FIELD(newname);
+	COPY_SCALAR_FIELD(behavior);
+	COPY_SCALAR_FIELD(missing_ok);
+
+	return newnode;
+}
+
+static AlterObjectSchemaStmt *
+_copyAlterObjectSchemaStmt(const AlterObjectSchemaStmt *from)
+{
+	AlterObjectSchemaStmt *newnode = makeNode(AlterObjectSchemaStmt);
+
+	COPY_SCALAR_FIELD(objectType);
+	COPY_NODE_FIELD(relation);
+	COPY_NODE_FIELD(object);
+	COPY_NODE_FIELD(objarg);
+	COPY_STRING_FIELD(newschema);
+	COPY_SCALAR_FIELD(missing_ok);
+
+	return newnode;
+}
+
+static AlterOwnerStmt *
+_copyAlterOwnerStmt(const AlterOwnerStmt *from)
+{
+	AlterOwnerStmt *newnode = makeNode(AlterOwnerStmt);
+
+	COPY_SCALAR_FIELD(objectType);
+	COPY_NODE_FIELD(relation);
+	COPY_NODE_FIELD(object);
+	COPY_NODE_FIELD(objarg);
+	COPY_NODE_FIELD(newowner);
+
+	return newnode;
+}
+
+static RuleStmt *
+_copyRuleStmt(const RuleStmt *from)
+{
+	RuleStmt   *newnode = makeNode(RuleStmt);
+
+	COPY_NODE_FIELD(relation);
+	COPY_STRING_FIELD(rulename);
+	COPY_NODE_FIELD(whereClause);
+	COPY_SCALAR_FIELD(event);
+	COPY_SCALAR_FIELD(instead);
+	COPY_NODE_FIELD(actions);
+	COPY_SCALAR_FIELD(replace);
+
+	return newnode;
+}
+
+static NotifyStmt *
+_copyNotifyStmt(const NotifyStmt *from)
+{
+	NotifyStmt *newnode = makeNode(NotifyStmt);
+
+	COPY_STRING_FIELD(conditionname);
+	COPY_STRING_FIELD(payload);
+
+	return newnode;
+}
+
+static ListenStmt *
+_copyListenStmt(const ListenStmt *from)
+{
+	ListenStmt *newnode = makeNode(ListenStmt);
+
+	COPY_STRING_FIELD(conditionname);
+
+	return newnode;
+}
+
+static UnlistenStmt *
+_copyUnlistenStmt(const UnlistenStmt *from)
+{
+	UnlistenStmt *newnode = makeNode(UnlistenStmt);
+
+	COPY_STRING_FIELD(conditionname);
+
+	return newnode;
+}
+
+static TransactionStmt *
+_copyTransactionStmt(const TransactionStmt *from)
+{
+	TransactionStmt *newnode = makeNode(TransactionStmt);
+
+	COPY_SCALAR_FIELD(kind);
+	COPY_NODE_FIELD(options);
+	COPY_STRING_FIELD(gid);
+
+	return newnode;
+}
+
+static CompositeTypeStmt *
+_copyCompositeTypeStmt(const CompositeTypeStmt *from)
+{
+	CompositeTypeStmt *newnode = makeNode(CompositeTypeStmt);
+
+	COPY_NODE_FIELD(typevar);
+	COPY_NODE_FIELD(coldeflist);
+
+	return newnode;
+}
+
+static CreateEnumStmt *
+_copyCreateEnumStmt(const CreateEnumStmt *from)
+{
+	CreateEnumStmt *newnode = makeNode(CreateEnumStmt);
+
+	COPY_NODE_FIELD(typeName);
+	COPY_NODE_FIELD(vals);
+
+	return newnode;
+}
+
+static CreateRangeStmt *
+_copyCreateRangeStmt(const CreateRangeStmt *from)
+{
+	CreateRangeStmt *newnode = makeNode(CreateRangeStmt);
+
+	COPY_NODE_FIELD(typeName);
+	COPY_NODE_FIELD(params);
+
+	return newnode;
+}
+
+static AlterEnumStmt *
+_copyAlterEnumStmt(const AlterEnumStmt *from)
+{
+	AlterEnumStmt *newnode = makeNode(AlterEnumStmt);
+
+	COPY_NODE_FIELD(typeName);
+	COPY_STRING_FIELD(newVal);
+	COPY_STRING_FIELD(newValNeighbor);
+	COPY_SCALAR_FIELD(newValIsAfter);
+	COPY_SCALAR_FIELD(skipIfExists);
+
+	return newnode;
+}
+
+static ViewStmt *
+_copyViewStmt(const ViewStmt *from)
+{
+	ViewStmt   *newnode = makeNode(ViewStmt);
+
+	COPY_NODE_FIELD(view);
+	COPY_NODE_FIELD(aliases);
+	COPY_NODE_FIELD(query);
+	COPY_SCALAR_FIELD(replace);
+	COPY_NODE_FIELD(options);
+	COPY_SCALAR_FIELD(withCheckOption);
+
+	return newnode;
+}
+
+static LoadStmt *
+_copyLoadStmt(const LoadStmt *from)
+{
+	LoadStmt   *newnode = makeNode(LoadStmt);
+
+	COPY_STRING_FIELD(filename);
+
+	return newnode;
+}
+
+static CreateDomainStmt *
+_copyCreateDomainStmt(const CreateDomainStmt *from)
+{
+	CreateDomainStmt *newnode = makeNode(CreateDomainStmt);
+
+	COPY_NODE_FIELD(domainname);
+	COPY_NODE_FIELD(typeName);
+	COPY_NODE_FIELD(collClause);
+	COPY_NODE_FIELD(constraints);
+
+	return newnode;
+}
+
+static CreateOpClassStmt *
+_copyCreateOpClassStmt(const CreateOpClassStmt *from)
+{
+	CreateOpClassStmt *newnode = makeNode(CreateOpClassStmt);
+
+	COPY_NODE_FIELD(opclassname);
+	COPY_NODE_FIELD(opfamilyname);
+	COPY_STRING_FIELD(amname);
+	COPY_NODE_FIELD(datatype);
+	COPY_NODE_FIELD(items);
+	COPY_SCALAR_FIELD(isDefault);
+
+	return newnode;
+}
+
+static CreateOpClassItem *
+_copyCreateOpClassItem(const CreateOpClassItem *from)
+{
+	CreateOpClassItem *newnode = makeNode(CreateOpClassItem);
+
+	COPY_SCALAR_FIELD(itemtype);
+	COPY_NODE_FIELD(name);
+	COPY_NODE_FIELD(args);
+	COPY_SCALAR_FIELD(number);
+	COPY_NODE_FIELD(order_family);
+	COPY_NODE_FIELD(class_args);
+	COPY_NODE_FIELD(storedtype);
+
+	return newnode;
+}
+
+static CreateOpFamilyStmt *
+_copyCreateOpFamilyStmt(const CreateOpFamilyStmt *from)
+{
+	CreateOpFamilyStmt *newnode = makeNode(CreateOpFamilyStmt);
+
+	COPY_NODE_FIELD(opfamilyname);
+	COPY_STRING_FIELD(amname);
+
+	return newnode;
+}
+
+static AlterOpFamilyStmt *
+_copyAlterOpFamilyStmt(const AlterOpFamilyStmt *from)
+{
+	AlterOpFamilyStmt *newnode = makeNode(AlterOpFamilyStmt);
+
+	COPY_NODE_FIELD(opfamilyname);
+	COPY_STRING_FIELD(amname);
+	COPY_SCALAR_FIELD(isDrop);
+	COPY_NODE_FIELD(items);
+
+	return newnode;
+}
+
+static CreatedbStmt *
+_copyCreatedbStmt(const CreatedbStmt *from)
+{
+	CreatedbStmt *newnode = makeNode(CreatedbStmt);
+
+	COPY_STRING_FIELD(dbname);
+	COPY_NODE_FIELD(options);
+
+	return newnode;
+}
+
+static AlterDatabaseStmt *
+_copyAlterDatabaseStmt(const AlterDatabaseStmt *from)
+{
+	AlterDatabaseStmt *newnode = makeNode(AlterDatabaseStmt);
+
+	COPY_STRING_FIELD(dbname);
+	COPY_NODE_FIELD(options);
+
+	return newnode;
+}
+
+static AlterDatabaseSetStmt *
+_copyAlterDatabaseSetStmt(const AlterDatabaseSetStmt *from)
+{
+	AlterDatabaseSetStmt *newnode = makeNode(AlterDatabaseSetStmt);
+
+	COPY_STRING_FIELD(dbname);
+	COPY_NODE_FIELD(setstmt);
+
+	return newnode;
+}
+
+static DropdbStmt *
+_copyDropdbStmt(const DropdbStmt *from)
+{
+	DropdbStmt *newnode = makeNode(DropdbStmt);
+
+	COPY_STRING_FIELD(dbname);
+	COPY_SCALAR_FIELD(missing_ok);
+
+	return newnode;
+}
+
+static VacuumStmt *
+_copyVacuumStmt(const VacuumStmt *from)
+{
+	VacuumStmt *newnode = makeNode(VacuumStmt);
+
+	COPY_SCALAR_FIELD(options);
+	COPY_NODE_FIELD(relation);
+	COPY_NODE_FIELD(va_cols);
+
+	return newnode;
+}
+
+static ExplainStmt *
+_copyExplainStmt(const ExplainStmt *from)
+{
+	ExplainStmt *newnode = makeNode(ExplainStmt);
+
+	COPY_NODE_FIELD(query);
+	COPY_NODE_FIELD(options);
+
+	return newnode;
+}
+
+static CreateTableAsStmt *
+_copyCreateTableAsStmt(const CreateTableAsStmt *from)
+{
+	CreateTableAsStmt *newnode = makeNode(CreateTableAsStmt);
+
+	COPY_NODE_FIELD(query);
+	COPY_NODE_FIELD(into);
+	COPY_SCALAR_FIELD(relkind);
+	COPY_SCALAR_FIELD(is_select_into);
+	COPY_SCALAR_FIELD(if_not_exists);
+
+	return newnode;
+}
+
+static RefreshMatViewStmt *
+_copyRefreshMatViewStmt(const RefreshMatViewStmt *from)
+{
+	RefreshMatViewStmt *newnode = makeNode(RefreshMatViewStmt);
+
+	COPY_SCALAR_FIELD(concurrent);
+	COPY_SCALAR_FIELD(skipData);
+	COPY_NODE_FIELD(relation);
+
+	return newnode;
+}
+
+static ReplicaIdentityStmt *
+_copyReplicaIdentityStmt(const ReplicaIdentityStmt *from)
+{
+	ReplicaIdentityStmt *newnode = makeNode(ReplicaIdentityStmt);
+
+	COPY_SCALAR_FIELD(identity_type);
+	COPY_STRING_FIELD(name);
+
+	return newnode;
+}
+
+static AlterSystemStmt *
+_copyAlterSystemStmt(const AlterSystemStmt *from)
+{
+	AlterSystemStmt *newnode = makeNode(AlterSystemStmt);
+
+	COPY_NODE_FIELD(setstmt);
+
+	return newnode;
+}
+
+static CreateSeqStmt *
+_copyCreateSeqStmt(const CreateSeqStmt *from)
+{
+	CreateSeqStmt *newnode = makeNode(CreateSeqStmt);
+
+	COPY_NODE_FIELD(sequence);
+	COPY_NODE_FIELD(options);
+	COPY_SCALAR_FIELD(ownerId);
+	COPY_SCALAR_FIELD(if_not_exists);
+
+	return newnode;
+}
+
+static AlterSeqStmt *
+_copyAlterSeqStmt(const AlterSeqStmt *from)
+{
+	AlterSeqStmt *newnode = makeNode(AlterSeqStmt);
+
+	COPY_NODE_FIELD(sequence);
+	COPY_NODE_FIELD(options);
+	COPY_SCALAR_FIELD(missing_ok);
+
+	return newnode;
+}
+
+static VariableSetStmt *
+_copyVariableSetStmt(const VariableSetStmt *from)
+{
+	VariableSetStmt *newnode = makeNode(VariableSetStmt);
+
+	COPY_SCALAR_FIELD(kind);
+	COPY_STRING_FIELD(name);
+	COPY_NODE_FIELD(args);
+	COPY_SCALAR_FIELD(is_local);
+
+	return newnode;
+}
+
+static VariableShowStmt *
+_copyVariableShowStmt(const VariableShowStmt *from)
+{
+	VariableShowStmt *newnode = makeNode(VariableShowStmt);
+
+	COPY_STRING_FIELD(name);
+
+	return newnode;
+}
+
+static DiscardStmt *
+_copyDiscardStmt(const DiscardStmt *from)
+{
+	DiscardStmt *newnode = makeNode(DiscardStmt);
+
+	COPY_SCALAR_FIELD(target);
+
+	return newnode;
+}
+
+static CreateTableSpaceStmt *
+_copyCreateTableSpaceStmt(const CreateTableSpaceStmt *from)
+{
+	CreateTableSpaceStmt *newnode = makeNode(CreateTableSpaceStmt);
+
+	COPY_STRING_FIELD(tablespacename);
+	COPY_NODE_FIELD(owner);
+	COPY_STRING_FIELD(location);
+	COPY_NODE_FIELD(options);
+
+	return newnode;
+}
+
+static DropTableSpaceStmt *
+_copyDropTableSpaceStmt(const DropTableSpaceStmt *from)
+{
+	DropTableSpaceStmt *newnode = makeNode(DropTableSpaceStmt);
+
+	COPY_STRING_FIELD(tablespacename);
+	COPY_SCALAR_FIELD(missing_ok);
+
+	return newnode;
+}
+
+static AlterTableSpaceOptionsStmt *
+_copyAlterTableSpaceOptionsStmt(const AlterTableSpaceOptionsStmt *from)
+{
+	AlterTableSpaceOptionsStmt *newnode = makeNode(AlterTableSpaceOptionsStmt);
+
+	COPY_STRING_FIELD(tablespacename);
+	COPY_NODE_FIELD(options);
+	COPY_SCALAR_FIELD(isReset);
+
+	return newnode;
+}
+
+static AlterTableMoveAllStmt *
+_copyAlterTableMoveAllStmt(const AlterTableMoveAllStmt *from)
+{
+	AlterTableMoveAllStmt *newnode = makeNode(AlterTableMoveAllStmt);
+
+	COPY_STRING_FIELD(orig_tablespacename);
+	COPY_SCALAR_FIELD(objtype);
+	COPY_NODE_FIELD(roles);
+	COPY_STRING_FIELD(new_tablespacename);
+	COPY_SCALAR_FIELD(nowait);
+
+	return newnode;
+}
+
+static CreateExtensionStmt *
+_copyCreateExtensionStmt(const CreateExtensionStmt *from)
+{
+	CreateExtensionStmt *newnode = makeNode(CreateExtensionStmt);
+
+	COPY_STRING_FIELD(extname);
+	COPY_SCALAR_FIELD(if_not_exists);
+	COPY_NODE_FIELD(options);
+
+	return newnode;
+}
+
+static AlterExtensionStmt *
+_copyAlterExtensionStmt(const AlterExtensionStmt *from)
+{
+	AlterExtensionStmt *newnode = makeNode(AlterExtensionStmt);
+
+	COPY_STRING_FIELD(extname);
+	COPY_NODE_FIELD(options);
+
+	return newnode;
+}
+
+static AlterExtensionContentsStmt *
+_copyAlterExtensionContentsStmt(const AlterExtensionContentsStmt *from)
+{
+	AlterExtensionContentsStmt *newnode = makeNode(AlterExtensionContentsStmt);
+
+	COPY_STRING_FIELD(extname);
+	COPY_SCALAR_FIELD(action);
+	COPY_SCALAR_FIELD(objtype);
+	COPY_NODE_FIELD(objname);
+	COPY_NODE_FIELD(objargs);
+
+	return newnode;
+}
+
+static CreateFdwStmt *
+_copyCreateFdwStmt(const CreateFdwStmt *from)
+{
+	CreateFdwStmt *newnode = makeNode(CreateFdwStmt);
+
+	COPY_STRING_FIELD(fdwname);
+	COPY_NODE_FIELD(func_options);
+	COPY_NODE_FIELD(options);
+
+	return newnode;
+}
+
+static AlterFdwStmt *
+_copyAlterFdwStmt(const AlterFdwStmt *from)
+{
+	AlterFdwStmt *newnode = makeNode(AlterFdwStmt);
+
+	COPY_STRING_FIELD(fdwname);
+	COPY_NODE_FIELD(func_options);
+	COPY_NODE_FIELD(options);
+
+	return newnode;
+}
+
+static CreateForeignServerStmt *
+_copyCreateForeignServerStmt(const CreateForeignServerStmt *from)
+{
+	CreateForeignServerStmt *newnode = makeNode(CreateForeignServerStmt);
+
+	COPY_STRING_FIELD(servername);
+	COPY_STRING_FIELD(servertype);
+	COPY_STRING_FIELD(version);
+	COPY_STRING_FIELD(fdwname);
+	COPY_NODE_FIELD(options);
+
+	return newnode;
+}
+
+static AlterForeignServerStmt *
+_copyAlterForeignServerStmt(const AlterForeignServerStmt *from)
+{
+	AlterForeignServerStmt *newnode = makeNode(AlterForeignServerStmt);
+
+	COPY_STRING_FIELD(servername);
+	COPY_STRING_FIELD(version);
+	COPY_NODE_FIELD(options);
+	COPY_SCALAR_FIELD(has_version);
+
+	return newnode;
+}
+
+static CreateUserMappingStmt *
+_copyCreateUserMappingStmt(const CreateUserMappingStmt *from)
+{
+	CreateUserMappingStmt *newnode = makeNode(CreateUserMappingStmt);
+
+	COPY_NODE_FIELD(user);
+	COPY_STRING_FIELD(servername);
+	COPY_NODE_FIELD(options);
+
+	return newnode;
+}
+
+static AlterUserMappingStmt *
+_copyAlterUserMappingStmt(const AlterUserMappingStmt *from)
+{
+	AlterUserMappingStmt *newnode = makeNode(AlterUserMappingStmt);
+
+	COPY_NODE_FIELD(user);
+	COPY_STRING_FIELD(servername);
+	COPY_NODE_FIELD(options);
+
+	return newnode;
+}
+
+static DropUserMappingStmt *
+_copyDropUserMappingStmt(const DropUserMappingStmt *from)
+{
+	DropUserMappingStmt *newnode = makeNode(DropUserMappingStmt);
+
+	COPY_NODE_FIELD(user);
+	COPY_STRING_FIELD(servername);
+	COPY_SCALAR_FIELD(missing_ok);
+
+	return newnode;
+}
+
+static CreateForeignTableStmt *
+_copyCreateForeignTableStmt(const CreateForeignTableStmt *from)
+{
+	CreateForeignTableStmt *newnode = makeNode(CreateForeignTableStmt);
+
+	CopyCreateStmtFields((const CreateStmt *) from, (CreateStmt *) newnode);
+
+	COPY_STRING_FIELD(servername);
+	COPY_NODE_FIELD(options);
+
+	return newnode;
+}
+
+static ImportForeignSchemaStmt *
+_copyImportForeignSchemaStmt(const ImportForeignSchemaStmt *from)
+{
+	ImportForeignSchemaStmt *newnode = makeNode(ImportForeignSchemaStmt);
+
+	COPY_STRING_FIELD(server_name);
+	COPY_STRING_FIELD(remote_schema);
+	COPY_STRING_FIELD(local_schema);
+	COPY_SCALAR_FIELD(list_type);
+	COPY_NODE_FIELD(table_list);
+	COPY_NODE_FIELD(options);
+
+	return newnode;
+}
+
+static CreateTransformStmt *
+_copyCreateTransformStmt(const CreateTransformStmt *from)
+{
+	CreateTransformStmt *newnode = makeNode(CreateTransformStmt);
+
+	COPY_SCALAR_FIELD(replace);
+	COPY_NODE_FIELD(type_name);
+	COPY_STRING_FIELD(lang);
+	COPY_NODE_FIELD(fromsql);
+	COPY_NODE_FIELD(tosql);
+
+	return newnode;
+}
+
+static CreateTrigStmt *
+_copyCreateTrigStmt(const CreateTrigStmt *from)
+{
+	CreateTrigStmt *newnode = makeNode(CreateTrigStmt);
+
+	COPY_STRING_FIELD(trigname);
+	COPY_NODE_FIELD(relation);
+	COPY_NODE_FIELD(funcname);
+	COPY_NODE_FIELD(args);
+	COPY_SCALAR_FIELD(row);
+	COPY_SCALAR_FIELD(timing);
+	COPY_SCALAR_FIELD(events);
+	COPY_NODE_FIELD(columns);
+	COPY_NODE_FIELD(whenClause);
+	COPY_SCALAR_FIELD(isconstraint);
+	COPY_SCALAR_FIELD(deferrable);
+	COPY_SCALAR_FIELD(initdeferred);
+	COPY_NODE_FIELD(constrrel);
+
+	return newnode;
+}
+
+static CreateEventTrigStmt *
+_copyCreateEventTrigStmt(const CreateEventTrigStmt *from)
+{
+	CreateEventTrigStmt *newnode = makeNode(CreateEventTrigStmt);
+
+	COPY_STRING_FIELD(trigname);
+	COPY_STRING_FIELD(eventname);
+	COPY_NODE_FIELD(whenclause);
+	COPY_NODE_FIELD(funcname);
+
+	return newnode;
+}
+
+static AlterEventTrigStmt *
+_copyAlterEventTrigStmt(const AlterEventTrigStmt *from)
+{
+	AlterEventTrigStmt *newnode = makeNode(AlterEventTrigStmt);
+
+	COPY_STRING_FIELD(trigname);
+	COPY_SCALAR_FIELD(tgenabled);
+
+	return newnode;
+}
+
+static CreatePLangStmt *
+_copyCreatePLangStmt(const CreatePLangStmt *from)
+{
+	CreatePLangStmt *newnode = makeNode(CreatePLangStmt);
+
+	COPY_SCALAR_FIELD(replace);
+	COPY_STRING_FIELD(plname);
+	COPY_NODE_FIELD(plhandler);
+	COPY_NODE_FIELD(plinline);
+	COPY_NODE_FIELD(plvalidator);
+	COPY_SCALAR_FIELD(pltrusted);
+
+	return newnode;
+}
+
+static CreateRoleStmt *
+_copyCreateRoleStmt(const CreateRoleStmt *from)
+{
+	CreateRoleStmt *newnode = makeNode(CreateRoleStmt);
+
+	COPY_SCALAR_FIELD(stmt_type);
+	COPY_STRING_FIELD(role);
+	COPY_NODE_FIELD(options);
+
+	return newnode;
+}
+
+static AlterRoleStmt *
+_copyAlterRoleStmt(const AlterRoleStmt *from)
+{
+	AlterRoleStmt *newnode = makeNode(AlterRoleStmt);
+
+	COPY_NODE_FIELD(role);
+	COPY_NODE_FIELD(options);
+	COPY_SCALAR_FIELD(action);
+
+	return newnode;
+}
+
+static AlterRoleSetStmt *
+_copyAlterRoleSetStmt(const AlterRoleSetStmt *from)
+{
+	AlterRoleSetStmt *newnode = makeNode(AlterRoleSetStmt);
+
+	COPY_NODE_FIELD(role);
+	COPY_STRING_FIELD(database);
+	COPY_NODE_FIELD(setstmt);
+
+	return newnode;
+}
+
+static DropRoleStmt *
+_copyDropRoleStmt(const DropRoleStmt *from)
+{
+	DropRoleStmt *newnode = makeNode(DropRoleStmt);
+
+	COPY_NODE_FIELD(roles);
+	COPY_SCALAR_FIELD(missing_ok);
+
+	return newnode;
+}
+
+static LockStmt *
+_copyLockStmt(const LockStmt *from)
+{
+	LockStmt   *newnode = makeNode(LockStmt);
+
+	COPY_NODE_FIELD(relations);
+	COPY_SCALAR_FIELD(mode);
+	COPY_SCALAR_FIELD(nowait);
+
+	return newnode;
+}
+
+static ConstraintsSetStmt *
+_copyConstraintsSetStmt(const ConstraintsSetStmt *from)
+{
+	ConstraintsSetStmt *newnode = makeNode(ConstraintsSetStmt);
+
+	COPY_NODE_FIELD(constraints);
+	COPY_SCALAR_FIELD(deferred);
+
+	return newnode;
+}
+
+static ReindexStmt *
+_copyReindexStmt(const ReindexStmt *from)
+{
+	ReindexStmt *newnode = makeNode(ReindexStmt);
+
+	COPY_SCALAR_FIELD(kind);
+	COPY_NODE_FIELD(relation);
+	COPY_STRING_FIELD(name);
+	COPY_SCALAR_FIELD(options);
+
+	return newnode;
+}
+
+static CreateSchemaStmt *
+_copyCreateSchemaStmt(const CreateSchemaStmt *from)
+{
+	CreateSchemaStmt *newnode = makeNode(CreateSchemaStmt);
+
+	COPY_STRING_FIELD(schemaname);
+	COPY_NODE_FIELD(authrole);
+	COPY_NODE_FIELD(schemaElts);
+	COPY_SCALAR_FIELD(if_not_exists);
+
+	return newnode;
+}
+
+static CreateConversionStmt *
+_copyCreateConversionStmt(const CreateConversionStmt *from)
+{
+	CreateConversionStmt *newnode = makeNode(CreateConversionStmt);
+
+	COPY_NODE_FIELD(conversion_name);
+	COPY_STRING_FIELD(for_encoding_name);
+	COPY_STRING_FIELD(to_encoding_name);
+	COPY_NODE_FIELD(func_name);
+	COPY_SCALAR_FIELD(def);
+
+	return newnode;
+}
+
+static CreateCastStmt *
+_copyCreateCastStmt(const CreateCastStmt *from)
+{
+	CreateCastStmt *newnode = makeNode(CreateCastStmt);
+
+	COPY_NODE_FIELD(sourcetype);
+	COPY_NODE_FIELD(targettype);
+	COPY_NODE_FIELD(func);
+	COPY_SCALAR_FIELD(context);
+	COPY_SCALAR_FIELD(inout);
+
+	return newnode;
+}
+
+static PrepareStmt *
+_copyPrepareStmt(const PrepareStmt *from)
+{
+	PrepareStmt *newnode = makeNode(PrepareStmt);
+
+	COPY_STRING_FIELD(name);
+	COPY_NODE_FIELD(argtypes);
+	COPY_NODE_FIELD(query);
+
+	return newnode;
+}
+
+static ExecuteStmt *
+_copyExecuteStmt(const ExecuteStmt *from)
+{
+	ExecuteStmt *newnode = makeNode(ExecuteStmt);
+
+	COPY_STRING_FIELD(name);
+	COPY_NODE_FIELD(params);
+
+	return newnode;
+}
+
+static DeallocateStmt *
+_copyDeallocateStmt(const DeallocateStmt *from)
+{
+	DeallocateStmt *newnode = makeNode(DeallocateStmt);
+
+	COPY_STRING_FIELD(name);
+
+	return newnode;
+}
+
+static DropOwnedStmt *
+_copyDropOwnedStmt(const DropOwnedStmt *from)
+{
+	DropOwnedStmt *newnode = makeNode(DropOwnedStmt);
+
+	COPY_NODE_FIELD(roles);
+	COPY_SCALAR_FIELD(behavior);
+
+	return newnode;
+}
+
+static ReassignOwnedStmt *
+_copyReassignOwnedStmt(const ReassignOwnedStmt *from)
+{
+	ReassignOwnedStmt *newnode = makeNode(ReassignOwnedStmt);
+
+	COPY_NODE_FIELD(roles);
+	COPY_NODE_FIELD(newrole);
+
+	return newnode;
+}
+
+static AlterTSDictionaryStmt *
+_copyAlterTSDictionaryStmt(const AlterTSDictionaryStmt *from)
+{
+	AlterTSDictionaryStmt *newnode = makeNode(AlterTSDictionaryStmt);
+
+	COPY_NODE_FIELD(dictname);
+	COPY_NODE_FIELD(options);
+
+	return newnode;
+}
+
+static AlterTSConfigurationStmt *
+_copyAlterTSConfigurationStmt(const AlterTSConfigurationStmt *from)
+{
+	AlterTSConfigurationStmt *newnode = makeNode(AlterTSConfigurationStmt);
+
+	COPY_SCALAR_FIELD(kind);
+	COPY_NODE_FIELD(cfgname);
+	COPY_NODE_FIELD(tokentype);
+	COPY_NODE_FIELD(dicts);
+	COPY_SCALAR_FIELD(override);
+	COPY_SCALAR_FIELD(replace);
+	COPY_SCALAR_FIELD(missing_ok);
+
+	return newnode;
+}
+
+static CreatePolicyStmt *
+_copyCreatePolicyStmt(const CreatePolicyStmt *from)
+{
+	CreatePolicyStmt *newnode = makeNode(CreatePolicyStmt);
+
+	COPY_STRING_FIELD(policy_name);
+	COPY_NODE_FIELD(table);
+	COPY_STRING_FIELD(cmd_name);
+	COPY_NODE_FIELD(roles);
+	COPY_NODE_FIELD(qual);
+	COPY_NODE_FIELD(with_check);
+
+	return newnode;
+}
+
+static AlterPolicyStmt *
+_copyAlterPolicyStmt(const AlterPolicyStmt *from)
+{
+	AlterPolicyStmt *newnode = makeNode(AlterPolicyStmt);
+
+	COPY_STRING_FIELD(policy_name);
+	COPY_NODE_FIELD(table);
+	COPY_NODE_FIELD(roles);
+	COPY_NODE_FIELD(qual);
+	COPY_NODE_FIELD(with_check);
+
+	return newnode;
+}
+
+/* ****************************************************************
+ *					pg_list.h copy functions
+ * ****************************************************************
+ */
+
+/*
+ * Perform a deep copy of the specified list, using copyObject(). The
+ * list MUST be of type T_List; T_IntList and T_OidList nodes don't
+ * need deep copies, so they should be copied via list_copy()
+ */
+#define COPY_NODE_CELL(new, old)					\
+	(new) = (ListCell *) palloc(sizeof(ListCell));	\
+	lfirst(new) = copyObject(lfirst(old));
+
+static List *
+_copyList(const List *from)
+{
+	List	   *new;
+	ListCell   *curr_old;
+	ListCell   *prev_new;
+
+	Assert(list_length(from) >= 1);
+
+	new = makeNode(List);
+	new->length = from->length;
+
+	COPY_NODE_CELL(new->head, from->head);
+	prev_new = new->head;
+	curr_old = lnext(from->head);
+
+	while (curr_old)
+	{
+		COPY_NODE_CELL(prev_new->next, curr_old);
+		prev_new = prev_new->next;
+		curr_old = curr_old->next;
+	}
+	prev_new->next = NULL;
+	new->tail = prev_new;
+
+	return new;
+}
+
+/* ****************************************************************
+ *					value.h copy functions
+ * ****************************************************************
+ */
+static Value *
+_copyValue(const Value *from)
+{
+	Value	   *newnode = makeNode(Value);
+
+	/* See also _copyAConst when changing this code! */
+
+	COPY_SCALAR_FIELD(type);
+	switch (from->type)
+	{
+		case T_Integer:
+			COPY_SCALAR_FIELD(val.ival);
+			break;
+		case T_Float:
+		case T_String:
+		case T_BitString:
+			COPY_STRING_FIELD(val.str);
+			break;
+		case T_Null:
+			/* nothing to do */
+			break;
+		default:
+			elog(ERROR, "unrecognized node type: %d",
+				 (int) from->type);
+			break;
+	}
+	return newnode;
+}
+
+/*
+ * copyObject
+ *
+ * Create a copy of a Node tree or list.  This is a "deep" copy: all
+ * substructure is copied too, recursively.
+ */
+void *
+copyObject(const void *from)
+{
+	void	   *retval;
+
+	if (from == NULL)
+		return NULL;
+
+	/* Guard against stack overflow due to overly complex expressions */
+	check_stack_depth();
+
+	switch (nodeTag(from))
+	{
+			/*
+			 * PLAN NODES
+			 */
+		case T_PlannedStmt:
+			retval = _copyPlannedStmt(from);
+			break;
+		case T_Plan:
+			retval = _copyPlan(from);
+			break;
+		case T_Result:
+			retval = _copyResult(from);
+			break;
+		case T_ModifyTable:
+			retval = _copyModifyTable(from);
+			break;
+		case T_Append:
+			retval = _copyAppend(from);
+			break;
+		case T_MergeAppend:
+			retval = _copyMergeAppend(from);
+			break;
+		case T_RecursiveUnion:
+			retval = _copyRecursiveUnion(from);
+			break;
+		case T_BitmapAnd:
+			retval = _copyBitmapAnd(from);
+			break;
+		case T_BitmapOr:
+			retval = _copyBitmapOr(from);
+			break;
+		case T_Scan:
+			retval = _copyScan(from);
+			break;
+		case T_SeqScan:
+			retval = _copySeqScan(from);
+			break;
+		case T_SampleScan:
+			retval = _copySampleScan(from);
+			break;
+		case T_IndexScan:
+			retval = _copyIndexScan(from);
+			break;
+		case T_IndexOnlyScan:
+			retval = _copyIndexOnlyScan(from);
+			break;
+		case T_BitmapIndexScan:
+			retval = _copyBitmapIndexScan(from);
+			break;
+		case T_BitmapHeapScan:
+			retval = _copyBitmapHeapScan(from);
+			break;
+		case T_TidScan:
+			retval = _copyTidScan(from);
+			break;
+		case T_SubqueryScan:
+			retval = _copySubqueryScan(from);
+			break;
+		case T_FunctionScan:
+			retval = _copyFunctionScan(from);
+			break;
+		case T_ValuesScan:
+			retval = _copyValuesScan(from);
+			break;
+		case T_CteScan:
+			retval = _copyCteScan(from);
+			break;
+		case T_WorkTableScan:
+			retval = _copyWorkTableScan(from);
+			break;
+		case T_ForeignScan:
+			retval = _copyForeignScan(from);
+			break;
+		case T_CustomScan:
+			retval = _copyCustomScan(from);
+			break;
+		case T_Join:
+			retval = _copyJoin(from);
+			break;
+		case T_NestLoop:
+			retval = _copyNestLoop(from);
+			break;
+		case T_MergeJoin:
+			retval = _copyMergeJoin(from);
+			break;
+		case T_HashJoin:
+			retval = _copyHashJoin(from);
+			break;
+		case T_Material:
+			retval = _copyMaterial(from);
+			break;
+		case T_Sort:
+			retval = _copySort(from);
+			break;
+		case T_Group:
+			retval = _copyGroup(from);
+			break;
+		case T_Agg:
+			retval = _copyAgg(from);
+			break;
+		case T_WindowAgg:
+			retval = _copyWindowAgg(from);
+			break;
+		case T_Unique:
+			retval = _copyUnique(from);
+			break;
+		case T_Hash:
+			retval = _copyHash(from);
+			break;
+		case T_SetOp:
+			retval = _copySetOp(from);
+			break;
+		case T_LockRows:
+			retval = _copyLockRows(from);
+			break;
+		case T_Limit:
+			retval = _copyLimit(from);
+			break;
+		case T_NestLoopParam:
+			retval = _copyNestLoopParam(from);
+			break;
+		case T_PlanRowMark:
+			retval = _copyPlanRowMark(from);
+			break;
+		case T_PlanInvalItem:
+			retval = _copyPlanInvalItem(from);
+			break;
+
+			/*
+			 * PRIMITIVE NODES
+			 */
+		case T_Alias:
+			retval = _copyAlias(from);
+			break;
+		case T_RangeVar:
+			retval = _copyRangeVar(from);
+			break;
+		case T_IntoClause:
+			retval = _copyIntoClause(from);
+			break;
+		case T_Var:
+			retval = _copyVar(from);
+			break;
+		case T_Const:
+			retval = _copyConst(from);
+			break;
+		case T_Param:
+			retval = _copyParam(from);
+			break;
+		case T_Aggref:
+			retval = _copyAggref(from);
+			break;
+		case T_GroupingFunc:
+			retval = _copyGroupingFunc(from);
+			break;
+		case T_WindowFunc:
+			retval = _copyWindowFunc(from);
+			break;
+		case T_ArrayRef:
+			retval = _copyArrayRef(from);
+			break;
+		case T_FuncExpr:
+			retval = _copyFuncExpr(from);
+			break;
+		case T_NamedArgExpr:
+			retval = _copyNamedArgExpr(from);
+			break;
+		case T_OpExpr:
+			retval = _copyOpExpr(from);
+			break;
+		case T_DistinctExpr:
+			retval = _copyDistinctExpr(from);
+			break;
+		case T_NullIfExpr:
+			retval = _copyNullIfExpr(from);
+			break;
+		case T_ScalarArrayOpExpr:
+			retval = _copyScalarArrayOpExpr(from);
+			break;
+		case T_BoolExpr:
+			retval = _copyBoolExpr(from);
+			break;
+		case T_SubLink:
+			retval = _copySubLink(from);
+			break;
+		case T_SubPlan:
+			retval = _copySubPlan(from);
+			break;
+		case T_AlternativeSubPlan:
+			retval = _copyAlternativeSubPlan(from);
+			break;
+		case T_FieldSelect:
+			retval = _copyFieldSelect(from);
+			break;
+		case T_FieldStore:
+			retval = _copyFieldStore(from);
+			break;
+		case T_RelabelType:
+			retval = _copyRelabelType(from);
+			break;
+		case T_CoerceViaIO:
+			retval = _copyCoerceViaIO(from);
+			break;
+		case T_ArrayCoerceExpr:
+			retval = _copyArrayCoerceExpr(from);
+			break;
+		case T_ConvertRowtypeExpr:
+			retval = _copyConvertRowtypeExpr(from);
+			break;
+		case T_CollateExpr:
+			retval = _copyCollateExpr(from);
+			break;
+		case T_CaseExpr:
+			retval = _copyCaseExpr(from);
+			break;
+		case T_CaseWhen:
+			retval = _copyCaseWhen(from);
+			break;
+		case T_CaseTestExpr:
+			retval = _copyCaseTestExpr(from);
+			break;
+		case T_ArrayExpr:
+			retval = _copyArrayExpr(from);
+			break;
+		case T_RowExpr:
+			retval = _copyRowExpr(from);
+			break;
+		case T_RowCompareExpr:
+			retval = _copyRowCompareExpr(from);
+			break;
+		case T_CoalesceExpr:
+			retval = _copyCoalesceExpr(from);
+			break;
+		case T_MinMaxExpr:
+			retval = _copyMinMaxExpr(from);
+			break;
+		case T_XmlExpr:
+			retval = _copyXmlExpr(from);
+			break;
+		case T_NullTest:
+			retval = _copyNullTest(from);
+			break;
+		case T_BooleanTest:
+			retval = _copyBooleanTest(from);
+			break;
+		case T_CoerceToDomain:
+			retval = _copyCoerceToDomain(from);
+			break;
+		case T_CoerceToDomainValue:
+			retval = _copyCoerceToDomainValue(from);
+			break;
+		case T_SetToDefault:
+			retval = _copySetToDefault(from);
+			break;
+		case T_CurrentOfExpr:
+			retval = _copyCurrentOfExpr(from);
+			break;
+		case T_InferenceElem:
+			retval = _copyInferenceElem(from);
+			break;
+		case T_TargetEntry:
+			retval = _copyTargetEntry(from);
+			break;
+		case T_RangeTblRef:
+			retval = _copyRangeTblRef(from);
+			break;
+		case T_JoinExpr:
+			retval = _copyJoinExpr(from);
+			break;
+		case T_FromExpr:
+			retval = _copyFromExpr(from);
+			break;
+		case T_OnConflictExpr:
+			retval = _copyOnConflictExpr(from);
+			break;
+
+			/*
+			 * RELATION NODES
+			 */
+		case T_PathKey:
+			retval = _copyPathKey(from);
+			break;
+		case T_RestrictInfo:
+			retval = _copyRestrictInfo(from);
+			break;
+		case T_PlaceHolderVar:
+			retval = _copyPlaceHolderVar(from);
+			break;
+		case T_SpecialJoinInfo:
+			retval = _copySpecialJoinInfo(from);
+			break;
+		case T_AppendRelInfo:
+			retval = _copyAppendRelInfo(from);
+			break;
+		case T_PlaceHolderInfo:
+			retval = _copyPlaceHolderInfo(from);
+			break;
+
+			/*
+			 * VALUE NODES
+			 */
+		case T_Integer:
+		case T_Float:
+		case T_String:
+		case T_BitString:
+		case T_Null:
+			retval = _copyValue(from);
+			break;
+
+			/*
+			 * LIST NODES
+			 */
+		case T_List:
+			retval = _copyList(from);
+			break;
+
+			/*
+			 * Lists of integers and OIDs don't need to be deep-copied, so we
+			 * perform a shallow copy via list_copy()
+			 */
+		case T_IntList:
+		case T_OidList:
+			retval = list_copy(from);
+			break;
+
+			/*
+			 * PARSE NODES
+			 */
+		case T_Query:
+			retval = _copyQuery(from);
+			break;
+		case T_InsertStmt:
+			retval = _copyInsertStmt(from);
+			break;
+		case T_DeleteStmt:
+			retval = _copyDeleteStmt(from);
+			break;
+		case T_UpdateStmt:
+			retval = _copyUpdateStmt(from);
+			break;
+		case T_SelectStmt:
+			retval = _copySelectStmt(from);
+			break;
+		case T_SetOperationStmt:
+			retval = _copySetOperationStmt(from);
+			break;
+		case T_AlterTableStmt:
+			retval = _copyAlterTableStmt(from);
+			break;
+		case T_AlterTableCmd:
+			retval = _copyAlterTableCmd(from);
+			break;
+		case T_AlterDomainStmt:
+			retval = _copyAlterDomainStmt(from);
+			break;
+		case T_GrantStmt:
+			retval = _copyGrantStmt(from);
+			break;
+		case T_GrantRoleStmt:
+			retval = _copyGrantRoleStmt(from);
+			break;
+		case T_AlterDefaultPrivilegesStmt:
+			retval = _copyAlterDefaultPrivilegesStmt(from);
+			break;
+		case T_DeclareCursorStmt:
+			retval = _copyDeclareCursorStmt(from);
+			break;
+		case T_ClosePortalStmt:
+			retval = _copyClosePortalStmt(from);
+			break;
+		case T_ClusterStmt:
+			retval = _copyClusterStmt(from);
+			break;
+		case T_CopyStmt:
+			retval = _copyCopyStmt(from);
+			break;
+		case T_CreateStmt:
+			retval = _copyCreateStmt(from);
+			break;
+		case T_TableLikeClause:
+			retval = _copyTableLikeClause(from);
+			break;
+		case T_DefineStmt:
+			retval = _copyDefineStmt(from);
+			break;
+		case T_DropStmt:
+			retval = _copyDropStmt(from);
+			break;
+		case T_TruncateStmt:
+			retval = _copyTruncateStmt(from);
+			break;
+		case T_CommentStmt:
+			retval = _copyCommentStmt(from);
+			break;
+		case T_SecLabelStmt:
+			retval = _copySecLabelStmt(from);
+			break;
+		case T_FetchStmt:
+			retval = _copyFetchStmt(from);
+			break;
+		case T_IndexStmt:
+			retval = _copyIndexStmt(from);
+			break;
+		case T_CreateFunctionStmt:
+			retval = _copyCreateFunctionStmt(from);
+			break;
+		case T_FunctionParameter:
+			retval = _copyFunctionParameter(from);
+			break;
+		case T_AlterFunctionStmt:
+			retval = _copyAlterFunctionStmt(from);
+			break;
+		case T_DoStmt:
+			retval = _copyDoStmt(from);
+			break;
+		case T_RenameStmt:
+			retval = _copyRenameStmt(from);
+			break;
+		case T_AlterObjectSchemaStmt:
+			retval = _copyAlterObjectSchemaStmt(from);
+			break;
+		case T_AlterOwnerStmt:
+			retval = _copyAlterOwnerStmt(from);
+			break;
+		case T_RuleStmt:
+			retval = _copyRuleStmt(from);
+			break;
+		case T_NotifyStmt:
+			retval = _copyNotifyStmt(from);
+			break;
+		case T_ListenStmt:
+			retval = _copyListenStmt(from);
+			break;
+		case T_UnlistenStmt:
+			retval = _copyUnlistenStmt(from);
+			break;
+		case T_TransactionStmt:
+			retval = _copyTransactionStmt(from);
+			break;
+		case T_CompositeTypeStmt:
+			retval = _copyCompositeTypeStmt(from);
+			break;
+		case T_CreateEnumStmt:
+			retval = _copyCreateEnumStmt(from);
+			break;
+		case T_CreateRangeStmt:
+			retval = _copyCreateRangeStmt(from);
+			break;
+		case T_AlterEnumStmt:
+			retval = _copyAlterEnumStmt(from);
+			break;
+		case T_ViewStmt:
+			retval = _copyViewStmt(from);
+			break;
+		case T_LoadStmt:
+			retval = _copyLoadStmt(from);
+			break;
+		case T_CreateDomainStmt:
+			retval = _copyCreateDomainStmt(from);
+			break;
+		case T_CreateOpClassStmt:
+			retval = _copyCreateOpClassStmt(from);
+			break;
+		case T_CreateOpClassItem:
+			retval = _copyCreateOpClassItem(from);
+			break;
+		case T_CreateOpFamilyStmt:
+			retval = _copyCreateOpFamilyStmt(from);
+			break;
+		case T_AlterOpFamilyStmt:
+			retval = _copyAlterOpFamilyStmt(from);
+			break;
+		case T_CreatedbStmt:
+			retval = _copyCreatedbStmt(from);
+			break;
+		case T_AlterDatabaseStmt:
+			retval = _copyAlterDatabaseStmt(from);
+			break;
+		case T_AlterDatabaseSetStmt:
+			retval = _copyAlterDatabaseSetStmt(from);
+			break;
+		case T_DropdbStmt:
+			retval = _copyDropdbStmt(from);
+			break;
+		case T_VacuumStmt:
+			retval = _copyVacuumStmt(from);
+			break;
+		case T_ExplainStmt:
+			retval = _copyExplainStmt(from);
+			break;
+		case T_CreateTableAsStmt:
+			retval = _copyCreateTableAsStmt(from);
+			break;
+		case T_RefreshMatViewStmt:
+			retval = _copyRefreshMatViewStmt(from);
+			break;
+		case T_ReplicaIdentityStmt:
+			retval = _copyReplicaIdentityStmt(from);
+			break;
+		case T_AlterSystemStmt:
+			retval = _copyAlterSystemStmt(from);
+			break;
+		case T_CreateSeqStmt:
+			retval = _copyCreateSeqStmt(from);
+			break;
+		case T_AlterSeqStmt:
+			retval = _copyAlterSeqStmt(from);
+			break;
+		case T_VariableSetStmt:
+			retval = _copyVariableSetStmt(from);
+			break;
+		case T_VariableShowStmt:
+			retval = _copyVariableShowStmt(from);
+			break;
+		case T_DiscardStmt:
+			retval = _copyDiscardStmt(from);
+			break;
+		case T_CreateTableSpaceStmt:
+			retval = _copyCreateTableSpaceStmt(from);
+			break;
+		case T_DropTableSpaceStmt:
+			retval = _copyDropTableSpaceStmt(from);
+			break;
+		case T_AlterTableSpaceOptionsStmt:
+			retval = _copyAlterTableSpaceOptionsStmt(from);
+			break;
+		case T_AlterTableMoveAllStmt:
+			retval = _copyAlterTableMoveAllStmt(from);
+			break;
+		case T_CreateExtensionStmt:
+			retval = _copyCreateExtensionStmt(from);
+			break;
+		case T_AlterExtensionStmt:
+			retval = _copyAlterExtensionStmt(from);
+			break;
+		case T_AlterExtensionContentsStmt:
+			retval = _copyAlterExtensionContentsStmt(from);
+			break;
+		case T_CreateFdwStmt:
+			retval = _copyCreateFdwStmt(from);
+			break;
+		case T_AlterFdwStmt:
+			retval = _copyAlterFdwStmt(from);
+			break;
+		case T_CreateForeignServerStmt:
+			retval = _copyCreateForeignServerStmt(from);
+			break;
+		case T_AlterForeignServerStmt:
+			retval = _copyAlterForeignServerStmt(from);
+			break;
+		case T_CreateUserMappingStmt:
+			retval = _copyCreateUserMappingStmt(from);
+			break;
+		case T_AlterUserMappingStmt:
+			retval = _copyAlterUserMappingStmt(from);
+			break;
+		case T_DropUserMappingStmt:
+			retval = _copyDropUserMappingStmt(from);
+			break;
+		case T_CreateForeignTableStmt:
+			retval = _copyCreateForeignTableStmt(from);
+			break;
+		case T_ImportForeignSchemaStmt:
+			retval = _copyImportForeignSchemaStmt(from);
+			break;
+		case T_CreateTransformStmt:
+			retval = _copyCreateTransformStmt(from);
+			break;
+		case T_CreateTrigStmt:
+			retval = _copyCreateTrigStmt(from);
+			break;
+		case T_CreateEventTrigStmt:
+			retval = _copyCreateEventTrigStmt(from);
+			break;
+		case T_AlterEventTrigStmt:
+			retval = _copyAlterEventTrigStmt(from);
+			break;
+		case T_CreatePLangStmt:
+			retval = _copyCreatePLangStmt(from);
+			break;
+		case T_CreateRoleStmt:
+			retval = _copyCreateRoleStmt(from);
+			break;
+		case T_AlterRoleStmt:
+			retval = _copyAlterRoleStmt(from);
+			break;
+		case T_AlterRoleSetStmt:
+			retval = _copyAlterRoleSetStmt(from);
+			break;
+		case T_DropRoleStmt:
+			retval = _copyDropRoleStmt(from);
+			break;
+		case T_LockStmt:
+			retval = _copyLockStmt(from);
+			break;
+		case T_ConstraintsSetStmt:
+			retval = _copyConstraintsSetStmt(from);
+			break;
+		case T_ReindexStmt:
+			retval = _copyReindexStmt(from);
+			break;
+		case T_CheckPointStmt:
+			retval = (void *) makeNode(CheckPointStmt);
+			break;
+		case T_CreateSchemaStmt:
+			retval = _copyCreateSchemaStmt(from);
+			break;
+		case T_CreateConversionStmt:
+			retval = _copyCreateConversionStmt(from);
+			break;
+		case T_CreateCastStmt:
+			retval = _copyCreateCastStmt(from);
+			break;
+		case T_PrepareStmt:
+			retval = _copyPrepareStmt(from);
+			break;
+		case T_ExecuteStmt:
+			retval = _copyExecuteStmt(from);
+			break;
+		case T_DeallocateStmt:
+			retval = _copyDeallocateStmt(from);
+			break;
+		case T_DropOwnedStmt:
+			retval = _copyDropOwnedStmt(from);
+			break;
+		case T_ReassignOwnedStmt:
+			retval = _copyReassignOwnedStmt(from);
+			break;
+		case T_AlterTSDictionaryStmt:
+			retval = _copyAlterTSDictionaryStmt(from);
+			break;
+		case T_AlterTSConfigurationStmt:
+			retval = _copyAlterTSConfigurationStmt(from);
+			break;
+		case T_CreatePolicyStmt:
+			retval = _copyCreatePolicyStmt(from);
+			break;
+		case T_AlterPolicyStmt:
+			retval = _copyAlterPolicyStmt(from);
+			break;
+		case T_A_Expr:
+			retval = _copyAExpr(from);
+			break;
+		case T_ColumnRef:
+			retval = _copyColumnRef(from);
+			break;
+		case T_ParamRef:
+			retval = _copyParamRef(from);
+			break;
+		case T_A_Const:
+			retval = _copyAConst(from);
+			break;
+		case T_FuncCall:
+			retval = _copyFuncCall(from);
+			break;
+		case T_A_Star:
+			retval = _copyAStar(from);
+			break;
+		case T_A_Indices:
+			retval = _copyAIndices(from);
+			break;
+		case T_A_Indirection:
+			retval = _copyA_Indirection(from);
+			break;
+		case T_A_ArrayExpr:
+			retval = _copyA_ArrayExpr(from);
+			break;
+		case T_ResTarget:
+			retval = _copyResTarget(from);
+			break;
+		case T_MultiAssignRef:
+			retval = _copyMultiAssignRef(from);
+			break;
+		case T_TypeCast:
+			retval = _copyTypeCast(from);
+			break;
+		case T_CollateClause:
+			retval = _copyCollateClause(from);
+			break;
+		case T_SortBy:
+			retval = _copySortBy(from);
+			break;
+		case T_WindowDef:
+			retval = _copyWindowDef(from);
+			break;
+		case T_RangeSubselect:
+			retval = _copyRangeSubselect(from);
+			break;
+		case T_RangeFunction:
+			retval = _copyRangeFunction(from);
+			break;
+		case T_RangeTableSample:
+			retval = _copyRangeTableSample(from);
+			break;
+		case T_TypeName:
+			retval = _copyTypeName(from);
+			break;
+		case T_IndexElem:
+			retval = _copyIndexElem(from);
+			break;
+		case T_ColumnDef:
+			retval = _copyColumnDef(from);
+			break;
+		case T_Constraint:
+			retval = _copyConstraint(from);
+			break;
+		case T_DefElem:
+			retval = _copyDefElem(from);
+			break;
+		case T_LockingClause:
+			retval = _copyLockingClause(from);
+			break;
+		case T_RangeTblEntry:
+			retval = _copyRangeTblEntry(from);
+			break;
+		case T_RangeTblFunction:
+			retval = _copyRangeTblFunction(from);
+			break;
+		case T_TableSampleClause:
+			retval = _copyTableSampleClause(from);
+			break;
+		case T_WithCheckOption:
+			retval = _copyWithCheckOption(from);
+			break;
+		case T_SortGroupClause:
+			retval = _copySortGroupClause(from);
+			break;
+		case T_GroupingSet:
+			retval = _copyGroupingSet(from);
+			break;
+		case T_WindowClause:
+			retval = _copyWindowClause(from);
+			break;
+		case T_RowMarkClause:
+			retval = _copyRowMarkClause(from);
+			break;
+		case T_WithClause:
+			retval = _copyWithClause(from);
+			break;
+		case T_InferClause:
+			retval = _copyInferClause(from);
+			break;
+		case T_OnConflictClause:
+			retval = _copyOnConflictClause(from);
+			break;
+		case T_CommonTableExpr:
+			retval = _copyCommonTableExpr(from);
+			break;
+		case T_FuncWithArgs:
+			retval = _copyFuncWithArgs(from);
+			break;
+		case T_AccessPriv:
+			retval = _copyAccessPriv(from);
+			break;
+		case T_XmlSerialize:
+			retval = _copyXmlSerialize(from);
+			break;
+		case T_RoleSpec:
+			retval = _copyRoleSpec(from);
+			break;
+
+		default:
+			elog(ERROR, "unrecognized node type: %d", (int) nodeTag(from));
+			retval = 0;			/* keep compiler quiet */
+			break;
+	}
+
+	return retval;
+}
diff --git a/foreign/libpg_query/src/postgres/src_backend_nodes_equalfuncs.c b/foreign/libpg_query/src/postgres/src_backend_nodes_equalfuncs.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_nodes_equalfuncs.c
@@ -0,0 +1,3514 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - equal
+ * - _equalAlias
+ * - _equalRangeVar
+ * - _equalIntoClause
+ * - _equalVar
+ * - _equalConst
+ * - _equalParam
+ * - _equalAggref
+ * - _equalGroupingFunc
+ * - _equalWindowFunc
+ * - _equalArrayRef
+ * - _equalFuncExpr
+ * - _equalNamedArgExpr
+ * - _equalOpExpr
+ * - _equalDistinctExpr
+ * - _equalNullIfExpr
+ * - _equalScalarArrayOpExpr
+ * - _equalBoolExpr
+ * - _equalSubLink
+ * - _equalSubPlan
+ * - _equalAlternativeSubPlan
+ * - _equalFieldSelect
+ * - _equalFieldStore
+ * - _equalRelabelType
+ * - _equalCoerceViaIO
+ * - _equalArrayCoerceExpr
+ * - _equalConvertRowtypeExpr
+ * - _equalCollateExpr
+ * - _equalCaseExpr
+ * - _equalCaseWhen
+ * - _equalCaseTestExpr
+ * - _equalArrayExpr
+ * - _equalRowExpr
+ * - _equalRowCompareExpr
+ * - _equalCoalesceExpr
+ * - _equalMinMaxExpr
+ * - _equalXmlExpr
+ * - _equalNullTest
+ * - _equalBooleanTest
+ * - _equalCoerceToDomain
+ * - _equalCoerceToDomainValue
+ * - _equalSetToDefault
+ * - _equalCurrentOfExpr
+ * - _equalInferenceElem
+ * - _equalTargetEntry
+ * - _equalRangeTblRef
+ * - _equalFromExpr
+ * - _equalOnConflictExpr
+ * - _equalJoinExpr
+ * - _equalPathKey
+ * - _equalRestrictInfo
+ * - _equalPlaceHolderVar
+ * - _equalSpecialJoinInfo
+ * - _equalAppendRelInfo
+ * - _equalPlaceHolderInfo
+ * - _equalList
+ * - _equalValue
+ * - _equalQuery
+ * - _equalInsertStmt
+ * - _equalDeleteStmt
+ * - _equalUpdateStmt
+ * - _equalSelectStmt
+ * - _equalSetOperationStmt
+ * - _equalAlterTableStmt
+ * - _equalAlterTableCmd
+ * - _equalAlterDomainStmt
+ * - _equalGrantStmt
+ * - _equalGrantRoleStmt
+ * - _equalAlterDefaultPrivilegesStmt
+ * - _equalDeclareCursorStmt
+ * - _equalClosePortalStmt
+ * - _equalClusterStmt
+ * - _equalCopyStmt
+ * - _equalCreateStmt
+ * - _equalTableLikeClause
+ * - _equalDefineStmt
+ * - _equalDropStmt
+ * - _equalTruncateStmt
+ * - _equalCommentStmt
+ * - _equalSecLabelStmt
+ * - _equalFetchStmt
+ * - _equalIndexStmt
+ * - _equalCreateFunctionStmt
+ * - _equalFunctionParameter
+ * - _equalAlterFunctionStmt
+ * - _equalDoStmt
+ * - _equalRenameStmt
+ * - _equalAlterObjectSchemaStmt
+ * - _equalAlterOwnerStmt
+ * - _equalRuleStmt
+ * - _equalNotifyStmt
+ * - _equalListenStmt
+ * - _equalUnlistenStmt
+ * - _equalTransactionStmt
+ * - _equalCompositeTypeStmt
+ * - _equalCreateEnumStmt
+ * - _equalCreateRangeStmt
+ * - _equalAlterEnumStmt
+ * - _equalViewStmt
+ * - _equalLoadStmt
+ * - _equalCreateDomainStmt
+ * - _equalCreateOpClassStmt
+ * - _equalCreateOpClassItem
+ * - _equalCreateOpFamilyStmt
+ * - _equalAlterOpFamilyStmt
+ * - _equalCreatedbStmt
+ * - _equalAlterDatabaseStmt
+ * - _equalAlterDatabaseSetStmt
+ * - _equalDropdbStmt
+ * - _equalVacuumStmt
+ * - _equalExplainStmt
+ * - _equalCreateTableAsStmt
+ * - _equalRefreshMatViewStmt
+ * - _equalReplicaIdentityStmt
+ * - _equalAlterSystemStmt
+ * - _equalCreateSeqStmt
+ * - _equalAlterSeqStmt
+ * - _equalVariableSetStmt
+ * - _equalVariableShowStmt
+ * - _equalDiscardStmt
+ * - _equalCreateTableSpaceStmt
+ * - _equalDropTableSpaceStmt
+ * - _equalAlterTableSpaceOptionsStmt
+ * - _equalAlterTableMoveAllStmt
+ * - _equalCreateExtensionStmt
+ * - _equalAlterExtensionStmt
+ * - _equalAlterExtensionContentsStmt
+ * - _equalCreateFdwStmt
+ * - _equalAlterFdwStmt
+ * - _equalCreateForeignServerStmt
+ * - _equalAlterForeignServerStmt
+ * - _equalCreateUserMappingStmt
+ * - _equalAlterUserMappingStmt
+ * - _equalDropUserMappingStmt
+ * - _equalCreateForeignTableStmt
+ * - _equalImportForeignSchemaStmt
+ * - _equalCreateTransformStmt
+ * - _equalCreateTrigStmt
+ * - _equalCreateEventTrigStmt
+ * - _equalAlterEventTrigStmt
+ * - _equalCreatePLangStmt
+ * - _equalCreateRoleStmt
+ * - _equalAlterRoleStmt
+ * - _equalAlterRoleSetStmt
+ * - _equalDropRoleStmt
+ * - _equalLockStmt
+ * - _equalConstraintsSetStmt
+ * - _equalReindexStmt
+ * - _equalCreateSchemaStmt
+ * - _equalCreateConversionStmt
+ * - _equalCreateCastStmt
+ * - _equalPrepareStmt
+ * - _equalExecuteStmt
+ * - _equalDeallocateStmt
+ * - _equalDropOwnedStmt
+ * - _equalReassignOwnedStmt
+ * - _equalAlterTSDictionaryStmt
+ * - _equalAlterTSConfigurationStmt
+ * - _equalCreatePolicyStmt
+ * - _equalAlterPolicyStmt
+ * - _equalAExpr
+ * - _equalColumnRef
+ * - _equalParamRef
+ * - _equalAConst
+ * - _equalFuncCall
+ * - _equalAStar
+ * - _equalAIndices
+ * - _equalA_Indirection
+ * - _equalA_ArrayExpr
+ * - _equalResTarget
+ * - _equalMultiAssignRef
+ * - _equalTypeCast
+ * - _equalCollateClause
+ * - _equalSortBy
+ * - _equalWindowDef
+ * - _equalRangeSubselect
+ * - _equalRangeFunction
+ * - _equalRangeTableSample
+ * - _equalTypeName
+ * - _equalIndexElem
+ * - _equalColumnDef
+ * - _equalConstraint
+ * - _equalDefElem
+ * - _equalLockingClause
+ * - _equalRangeTblEntry
+ * - _equalRangeTblFunction
+ * - _equalTableSampleClause
+ * - _equalWithCheckOption
+ * - _equalSortGroupClause
+ * - _equalGroupingSet
+ * - _equalWindowClause
+ * - _equalRowMarkClause
+ * - _equalWithClause
+ * - _equalInferClause
+ * - _equalOnConflictClause
+ * - _equalCommonTableExpr
+ * - _equalFuncWithArgs
+ * - _equalAccessPriv
+ * - _equalXmlSerialize
+ * - _equalRoleSpec
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * equalfuncs.c
+ *	  Equality functions to compare node trees.
+ *
+ * NOTE: we currently support comparing all node types found in parse
+ * trees.  We do not support comparing executor state trees; there
+ * is no need for that, and no point in maintaining all the code that
+ * would be needed.  We also do not support comparing Path trees, mainly
+ * because the circular linkages between RelOptInfo and Path nodes can't
+ * be handled easily in a simple depth-first traversal.
+ *
+ * Currently, in fact, equal() doesn't know how to compare Plan trees
+ * either.  This might need to be fixed someday.
+ *
+ * NOTE: it is intentional that parse location fields (in nodes that have
+ * one) are not compared.  This is because we want, for example, a variable
+ * "x" to be considered equal() to another reference to "x" in the query.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ *	  src/backend/nodes/equalfuncs.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+
+#include "nodes/relation.h"
+#include "utils/datum.h"
+
+
+/*
+ * Macros to simplify comparison of different kinds of fields.  Use these
+ * wherever possible to reduce the chance for silly typos.  Note that these
+ * hard-wire the convention that the local variables in an Equal routine are
+ * named 'a' and 'b'.
+ */
+
+/* Compare a simple scalar field (int, float, bool, enum, etc) */
+#define COMPARE_SCALAR_FIELD(fldname) \
+	do { \
+		if (a->fldname != b->fldname) \
+			return false; \
+	} while (0)
+
+/* Compare a field that is a pointer to some kind of Node or Node tree */
+#define COMPARE_NODE_FIELD(fldname) \
+	do { \
+		if (!equal(a->fldname, b->fldname)) \
+			return false; \
+	} while (0)
+
+/* Compare a field that is a pointer to a Bitmapset */
+#define COMPARE_BITMAPSET_FIELD(fldname) \
+	do { \
+		if (!bms_equal(a->fldname, b->fldname)) \
+			return false; \
+	} while (0)
+
+/* Compare a field that is a pointer to a C string, or perhaps NULL */
+#define COMPARE_STRING_FIELD(fldname) \
+	do { \
+		if (!equalstr(a->fldname, b->fldname)) \
+			return false; \
+	} while (0)
+
+/* Macro for comparing string fields that might be NULL */
+#define equalstr(a, b)	\
+	(((a) != NULL && (b) != NULL) ? (strcmp(a, b) == 0) : (a) == (b))
+
+/* Compare a field that is a pointer to a simple palloc'd object of size sz */
+#define COMPARE_POINTER_FIELD(fldname, sz) \
+	do { \
+		if (memcmp(a->fldname, b->fldname, (sz)) != 0) \
+			return false; \
+	} while (0)
+
+/* Compare a parse location field (this is a no-op, per note above) */
+#define COMPARE_LOCATION_FIELD(fldname) \
+	((void) 0)
+
+/* Compare a CoercionForm field (also a no-op, per comment in primnodes.h) */
+#define COMPARE_COERCIONFORM_FIELD(fldname) \
+	((void) 0)
+
+
+/*
+ *	Stuff from primnodes.h
+ */
+
+static bool
+_equalAlias(const Alias *a, const Alias *b)
+{
+	COMPARE_STRING_FIELD(aliasname);
+	COMPARE_NODE_FIELD(colnames);
+
+	return true;
+}
+
+static bool
+_equalRangeVar(const RangeVar *a, const RangeVar *b)
+{
+	COMPARE_STRING_FIELD(catalogname);
+	COMPARE_STRING_FIELD(schemaname);
+	COMPARE_STRING_FIELD(relname);
+	COMPARE_SCALAR_FIELD(inhOpt);
+	COMPARE_SCALAR_FIELD(relpersistence);
+	COMPARE_NODE_FIELD(alias);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalIntoClause(const IntoClause *a, const IntoClause *b)
+{
+	COMPARE_NODE_FIELD(rel);
+	COMPARE_NODE_FIELD(colNames);
+	COMPARE_NODE_FIELD(options);
+	COMPARE_SCALAR_FIELD(onCommit);
+	COMPARE_STRING_FIELD(tableSpaceName);
+	COMPARE_NODE_FIELD(viewQuery);
+	COMPARE_SCALAR_FIELD(skipData);
+
+	return true;
+}
+
+/*
+ * We don't need an _equalExpr because Expr is an abstract supertype which
+ * should never actually get instantiated.  Also, since it has no common
+ * fields except NodeTag, there's no need for a helper routine to factor
+ * out comparing the common fields...
+ */
+
+static bool
+_equalVar(const Var *a, const Var *b)
+{
+	COMPARE_SCALAR_FIELD(varno);
+	COMPARE_SCALAR_FIELD(varattno);
+	COMPARE_SCALAR_FIELD(vartype);
+	COMPARE_SCALAR_FIELD(vartypmod);
+	COMPARE_SCALAR_FIELD(varcollid);
+	COMPARE_SCALAR_FIELD(varlevelsup);
+	COMPARE_SCALAR_FIELD(varnoold);
+	COMPARE_SCALAR_FIELD(varoattno);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalConst(const Const *a, const Const *b)
+{
+	COMPARE_SCALAR_FIELD(consttype);
+	COMPARE_SCALAR_FIELD(consttypmod);
+	COMPARE_SCALAR_FIELD(constcollid);
+	COMPARE_SCALAR_FIELD(constlen);
+	COMPARE_SCALAR_FIELD(constisnull);
+	COMPARE_SCALAR_FIELD(constbyval);
+	COMPARE_LOCATION_FIELD(location);
+
+	/*
+	 * We treat all NULL constants of the same type as equal. Someday this
+	 * might need to change?  But datumIsEqual doesn't work on nulls, so...
+	 */
+	if (a->constisnull)
+		return true;
+	return datumIsEqual(a->constvalue, b->constvalue,
+						a->constbyval, a->constlen);
+}
+
+static bool
+_equalParam(const Param *a, const Param *b)
+{
+	COMPARE_SCALAR_FIELD(paramkind);
+	COMPARE_SCALAR_FIELD(paramid);
+	COMPARE_SCALAR_FIELD(paramtype);
+	COMPARE_SCALAR_FIELD(paramtypmod);
+	COMPARE_SCALAR_FIELD(paramcollid);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalAggref(const Aggref *a, const Aggref *b)
+{
+	COMPARE_SCALAR_FIELD(aggfnoid);
+	COMPARE_SCALAR_FIELD(aggtype);
+	COMPARE_SCALAR_FIELD(aggcollid);
+	COMPARE_SCALAR_FIELD(inputcollid);
+	COMPARE_NODE_FIELD(aggdirectargs);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_NODE_FIELD(aggorder);
+	COMPARE_NODE_FIELD(aggdistinct);
+	COMPARE_NODE_FIELD(aggfilter);
+	COMPARE_SCALAR_FIELD(aggstar);
+	COMPARE_SCALAR_FIELD(aggvariadic);
+	COMPARE_SCALAR_FIELD(aggkind);
+	COMPARE_SCALAR_FIELD(agglevelsup);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalGroupingFunc(const GroupingFunc *a, const GroupingFunc *b)
+{
+	COMPARE_NODE_FIELD(args);
+
+	/*
+	 * We must not compare the refs or cols field
+	 */
+
+	COMPARE_SCALAR_FIELD(agglevelsup);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalWindowFunc(const WindowFunc *a, const WindowFunc *b)
+{
+	COMPARE_SCALAR_FIELD(winfnoid);
+	COMPARE_SCALAR_FIELD(wintype);
+	COMPARE_SCALAR_FIELD(wincollid);
+	COMPARE_SCALAR_FIELD(inputcollid);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_NODE_FIELD(aggfilter);
+	COMPARE_SCALAR_FIELD(winref);
+	COMPARE_SCALAR_FIELD(winstar);
+	COMPARE_SCALAR_FIELD(winagg);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalArrayRef(const ArrayRef *a, const ArrayRef *b)
+{
+	COMPARE_SCALAR_FIELD(refarraytype);
+	COMPARE_SCALAR_FIELD(refelemtype);
+	COMPARE_SCALAR_FIELD(reftypmod);
+	COMPARE_SCALAR_FIELD(refcollid);
+	COMPARE_NODE_FIELD(refupperindexpr);
+	COMPARE_NODE_FIELD(reflowerindexpr);
+	COMPARE_NODE_FIELD(refexpr);
+	COMPARE_NODE_FIELD(refassgnexpr);
+
+	return true;
+}
+
+static bool
+_equalFuncExpr(const FuncExpr *a, const FuncExpr *b)
+{
+	COMPARE_SCALAR_FIELD(funcid);
+	COMPARE_SCALAR_FIELD(funcresulttype);
+	COMPARE_SCALAR_FIELD(funcretset);
+	COMPARE_SCALAR_FIELD(funcvariadic);
+	COMPARE_COERCIONFORM_FIELD(funcformat);
+	COMPARE_SCALAR_FIELD(funccollid);
+	COMPARE_SCALAR_FIELD(inputcollid);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalNamedArgExpr(const NamedArgExpr *a, const NamedArgExpr *b)
+{
+	COMPARE_NODE_FIELD(arg);
+	COMPARE_STRING_FIELD(name);
+	COMPARE_SCALAR_FIELD(argnumber);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalOpExpr(const OpExpr *a, const OpExpr *b)
+{
+	COMPARE_SCALAR_FIELD(opno);
+
+	/*
+	 * Special-case opfuncid: it is allowable for it to differ if one node
+	 * contains zero and the other doesn't.  This just means that the one node
+	 * isn't as far along in the parse/plan pipeline and hasn't had the
+	 * opfuncid cache filled yet.
+	 */
+	if (a->opfuncid != b->opfuncid &&
+		a->opfuncid != 0 &&
+		b->opfuncid != 0)
+		return false;
+
+	COMPARE_SCALAR_FIELD(opresulttype);
+	COMPARE_SCALAR_FIELD(opretset);
+	COMPARE_SCALAR_FIELD(opcollid);
+	COMPARE_SCALAR_FIELD(inputcollid);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalDistinctExpr(const DistinctExpr *a, const DistinctExpr *b)
+{
+	COMPARE_SCALAR_FIELD(opno);
+
+	/*
+	 * Special-case opfuncid: it is allowable for it to differ if one node
+	 * contains zero and the other doesn't.  This just means that the one node
+	 * isn't as far along in the parse/plan pipeline and hasn't had the
+	 * opfuncid cache filled yet.
+	 */
+	if (a->opfuncid != b->opfuncid &&
+		a->opfuncid != 0 &&
+		b->opfuncid != 0)
+		return false;
+
+	COMPARE_SCALAR_FIELD(opresulttype);
+	COMPARE_SCALAR_FIELD(opretset);
+	COMPARE_SCALAR_FIELD(opcollid);
+	COMPARE_SCALAR_FIELD(inputcollid);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalNullIfExpr(const NullIfExpr *a, const NullIfExpr *b)
+{
+	COMPARE_SCALAR_FIELD(opno);
+
+	/*
+	 * Special-case opfuncid: it is allowable for it to differ if one node
+	 * contains zero and the other doesn't.  This just means that the one node
+	 * isn't as far along in the parse/plan pipeline and hasn't had the
+	 * opfuncid cache filled yet.
+	 */
+	if (a->opfuncid != b->opfuncid &&
+		a->opfuncid != 0 &&
+		b->opfuncid != 0)
+		return false;
+
+	COMPARE_SCALAR_FIELD(opresulttype);
+	COMPARE_SCALAR_FIELD(opretset);
+	COMPARE_SCALAR_FIELD(opcollid);
+	COMPARE_SCALAR_FIELD(inputcollid);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalScalarArrayOpExpr(const ScalarArrayOpExpr *a, const ScalarArrayOpExpr *b)
+{
+	COMPARE_SCALAR_FIELD(opno);
+
+	/*
+	 * Special-case opfuncid: it is allowable for it to differ if one node
+	 * contains zero and the other doesn't.  This just means that the one node
+	 * isn't as far along in the parse/plan pipeline and hasn't had the
+	 * opfuncid cache filled yet.
+	 */
+	if (a->opfuncid != b->opfuncid &&
+		a->opfuncid != 0 &&
+		b->opfuncid != 0)
+		return false;
+
+	COMPARE_SCALAR_FIELD(useOr);
+	COMPARE_SCALAR_FIELD(inputcollid);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalBoolExpr(const BoolExpr *a, const BoolExpr *b)
+{
+	COMPARE_SCALAR_FIELD(boolop);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalSubLink(const SubLink *a, const SubLink *b)
+{
+	COMPARE_SCALAR_FIELD(subLinkType);
+	COMPARE_SCALAR_FIELD(subLinkId);
+	COMPARE_NODE_FIELD(testexpr);
+	COMPARE_NODE_FIELD(operName);
+	COMPARE_NODE_FIELD(subselect);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalSubPlan(const SubPlan *a, const SubPlan *b)
+{
+	COMPARE_SCALAR_FIELD(subLinkType);
+	COMPARE_NODE_FIELD(testexpr);
+	COMPARE_NODE_FIELD(paramIds);
+	COMPARE_SCALAR_FIELD(plan_id);
+	COMPARE_STRING_FIELD(plan_name);
+	COMPARE_SCALAR_FIELD(firstColType);
+	COMPARE_SCALAR_FIELD(firstColTypmod);
+	COMPARE_SCALAR_FIELD(firstColCollation);
+	COMPARE_SCALAR_FIELD(useHashTable);
+	COMPARE_SCALAR_FIELD(unknownEqFalse);
+	COMPARE_NODE_FIELD(setParam);
+	COMPARE_NODE_FIELD(parParam);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_SCALAR_FIELD(startup_cost);
+	COMPARE_SCALAR_FIELD(per_call_cost);
+
+	return true;
+}
+
+static bool
+_equalAlternativeSubPlan(const AlternativeSubPlan *a, const AlternativeSubPlan *b)
+{
+	COMPARE_NODE_FIELD(subplans);
+
+	return true;
+}
+
+static bool
+_equalFieldSelect(const FieldSelect *a, const FieldSelect *b)
+{
+	COMPARE_NODE_FIELD(arg);
+	COMPARE_SCALAR_FIELD(fieldnum);
+	COMPARE_SCALAR_FIELD(resulttype);
+	COMPARE_SCALAR_FIELD(resulttypmod);
+	COMPARE_SCALAR_FIELD(resultcollid);
+
+	return true;
+}
+
+static bool
+_equalFieldStore(const FieldStore *a, const FieldStore *b)
+{
+	COMPARE_NODE_FIELD(arg);
+	COMPARE_NODE_FIELD(newvals);
+	COMPARE_NODE_FIELD(fieldnums);
+	COMPARE_SCALAR_FIELD(resulttype);
+
+	return true;
+}
+
+static bool
+_equalRelabelType(const RelabelType *a, const RelabelType *b)
+{
+	COMPARE_NODE_FIELD(arg);
+	COMPARE_SCALAR_FIELD(resulttype);
+	COMPARE_SCALAR_FIELD(resulttypmod);
+	COMPARE_SCALAR_FIELD(resultcollid);
+	COMPARE_COERCIONFORM_FIELD(relabelformat);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalCoerceViaIO(const CoerceViaIO *a, const CoerceViaIO *b)
+{
+	COMPARE_NODE_FIELD(arg);
+	COMPARE_SCALAR_FIELD(resulttype);
+	COMPARE_SCALAR_FIELD(resultcollid);
+	COMPARE_COERCIONFORM_FIELD(coerceformat);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalArrayCoerceExpr(const ArrayCoerceExpr *a, const ArrayCoerceExpr *b)
+{
+	COMPARE_NODE_FIELD(arg);
+	COMPARE_SCALAR_FIELD(elemfuncid);
+	COMPARE_SCALAR_FIELD(resulttype);
+	COMPARE_SCALAR_FIELD(resulttypmod);
+	COMPARE_SCALAR_FIELD(resultcollid);
+	COMPARE_SCALAR_FIELD(isExplicit);
+	COMPARE_COERCIONFORM_FIELD(coerceformat);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalConvertRowtypeExpr(const ConvertRowtypeExpr *a, const ConvertRowtypeExpr *b)
+{
+	COMPARE_NODE_FIELD(arg);
+	COMPARE_SCALAR_FIELD(resulttype);
+	COMPARE_COERCIONFORM_FIELD(convertformat);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalCollateExpr(const CollateExpr *a, const CollateExpr *b)
+{
+	COMPARE_NODE_FIELD(arg);
+	COMPARE_SCALAR_FIELD(collOid);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalCaseExpr(const CaseExpr *a, const CaseExpr *b)
+{
+	COMPARE_SCALAR_FIELD(casetype);
+	COMPARE_SCALAR_FIELD(casecollid);
+	COMPARE_NODE_FIELD(arg);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_NODE_FIELD(defresult);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalCaseWhen(const CaseWhen *a, const CaseWhen *b)
+{
+	COMPARE_NODE_FIELD(expr);
+	COMPARE_NODE_FIELD(result);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalCaseTestExpr(const CaseTestExpr *a, const CaseTestExpr *b)
+{
+	COMPARE_SCALAR_FIELD(typeId);
+	COMPARE_SCALAR_FIELD(typeMod);
+	COMPARE_SCALAR_FIELD(collation);
+
+	return true;
+}
+
+static bool
+_equalArrayExpr(const ArrayExpr *a, const ArrayExpr *b)
+{
+	COMPARE_SCALAR_FIELD(array_typeid);
+	COMPARE_SCALAR_FIELD(array_collid);
+	COMPARE_SCALAR_FIELD(element_typeid);
+	COMPARE_NODE_FIELD(elements);
+	COMPARE_SCALAR_FIELD(multidims);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalRowExpr(const RowExpr *a, const RowExpr *b)
+{
+	COMPARE_NODE_FIELD(args);
+	COMPARE_SCALAR_FIELD(row_typeid);
+	COMPARE_COERCIONFORM_FIELD(row_format);
+	COMPARE_NODE_FIELD(colnames);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalRowCompareExpr(const RowCompareExpr *a, const RowCompareExpr *b)
+{
+	COMPARE_SCALAR_FIELD(rctype);
+	COMPARE_NODE_FIELD(opnos);
+	COMPARE_NODE_FIELD(opfamilies);
+	COMPARE_NODE_FIELD(inputcollids);
+	COMPARE_NODE_FIELD(largs);
+	COMPARE_NODE_FIELD(rargs);
+
+	return true;
+}
+
+static bool
+_equalCoalesceExpr(const CoalesceExpr *a, const CoalesceExpr *b)
+{
+	COMPARE_SCALAR_FIELD(coalescetype);
+	COMPARE_SCALAR_FIELD(coalescecollid);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalMinMaxExpr(const MinMaxExpr *a, const MinMaxExpr *b)
+{
+	COMPARE_SCALAR_FIELD(minmaxtype);
+	COMPARE_SCALAR_FIELD(minmaxcollid);
+	COMPARE_SCALAR_FIELD(inputcollid);
+	COMPARE_SCALAR_FIELD(op);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalXmlExpr(const XmlExpr *a, const XmlExpr *b)
+{
+	COMPARE_SCALAR_FIELD(op);
+	COMPARE_STRING_FIELD(name);
+	COMPARE_NODE_FIELD(named_args);
+	COMPARE_NODE_FIELD(arg_names);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_SCALAR_FIELD(xmloption);
+	COMPARE_SCALAR_FIELD(type);
+	COMPARE_SCALAR_FIELD(typmod);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalNullTest(const NullTest *a, const NullTest *b)
+{
+	COMPARE_NODE_FIELD(arg);
+	COMPARE_SCALAR_FIELD(nulltesttype);
+	COMPARE_SCALAR_FIELD(argisrow);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalBooleanTest(const BooleanTest *a, const BooleanTest *b)
+{
+	COMPARE_NODE_FIELD(arg);
+	COMPARE_SCALAR_FIELD(booltesttype);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalCoerceToDomain(const CoerceToDomain *a, const CoerceToDomain *b)
+{
+	COMPARE_NODE_FIELD(arg);
+	COMPARE_SCALAR_FIELD(resulttype);
+	COMPARE_SCALAR_FIELD(resulttypmod);
+	COMPARE_SCALAR_FIELD(resultcollid);
+	COMPARE_COERCIONFORM_FIELD(coercionformat);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalCoerceToDomainValue(const CoerceToDomainValue *a, const CoerceToDomainValue *b)
+{
+	COMPARE_SCALAR_FIELD(typeId);
+	COMPARE_SCALAR_FIELD(typeMod);
+	COMPARE_SCALAR_FIELD(collation);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalSetToDefault(const SetToDefault *a, const SetToDefault *b)
+{
+	COMPARE_SCALAR_FIELD(typeId);
+	COMPARE_SCALAR_FIELD(typeMod);
+	COMPARE_SCALAR_FIELD(collation);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalCurrentOfExpr(const CurrentOfExpr *a, const CurrentOfExpr *b)
+{
+	COMPARE_SCALAR_FIELD(cvarno);
+	COMPARE_STRING_FIELD(cursor_name);
+	COMPARE_SCALAR_FIELD(cursor_param);
+
+	return true;
+}
+
+static bool
+_equalInferenceElem(const InferenceElem *a, const InferenceElem *b)
+{
+	COMPARE_NODE_FIELD(expr);
+	COMPARE_SCALAR_FIELD(infercollid);
+	COMPARE_SCALAR_FIELD(inferopclass);
+
+	return true;
+}
+
+static bool
+_equalTargetEntry(const TargetEntry *a, const TargetEntry *b)
+{
+	COMPARE_NODE_FIELD(expr);
+	COMPARE_SCALAR_FIELD(resno);
+	COMPARE_STRING_FIELD(resname);
+	COMPARE_SCALAR_FIELD(ressortgroupref);
+	COMPARE_SCALAR_FIELD(resorigtbl);
+	COMPARE_SCALAR_FIELD(resorigcol);
+	COMPARE_SCALAR_FIELD(resjunk);
+
+	return true;
+}
+
+static bool
+_equalRangeTblRef(const RangeTblRef *a, const RangeTblRef *b)
+{
+	COMPARE_SCALAR_FIELD(rtindex);
+
+	return true;
+}
+
+static bool
+_equalJoinExpr(const JoinExpr *a, const JoinExpr *b)
+{
+	COMPARE_SCALAR_FIELD(jointype);
+	COMPARE_SCALAR_FIELD(isNatural);
+	COMPARE_NODE_FIELD(larg);
+	COMPARE_NODE_FIELD(rarg);
+	COMPARE_NODE_FIELD(usingClause);
+	COMPARE_NODE_FIELD(quals);
+	COMPARE_NODE_FIELD(alias);
+	COMPARE_SCALAR_FIELD(rtindex);
+
+	return true;
+}
+
+static bool
+_equalFromExpr(const FromExpr *a, const FromExpr *b)
+{
+	COMPARE_NODE_FIELD(fromlist);
+	COMPARE_NODE_FIELD(quals);
+
+	return true;
+}
+
+static bool
+_equalOnConflictExpr(const OnConflictExpr *a, const OnConflictExpr *b)
+{
+	COMPARE_SCALAR_FIELD(action);
+	COMPARE_NODE_FIELD(arbiterElems);
+	COMPARE_NODE_FIELD(arbiterWhere);
+	COMPARE_SCALAR_FIELD(constraint);
+	COMPARE_NODE_FIELD(onConflictSet);
+	COMPARE_NODE_FIELD(onConflictWhere);
+	COMPARE_SCALAR_FIELD(exclRelIndex);
+	COMPARE_NODE_FIELD(exclRelTlist);
+
+	return true;
+}
+
+/*
+ * Stuff from relation.h
+ */
+
+static bool
+_equalPathKey(const PathKey *a, const PathKey *b)
+{
+	/* We assume pointer equality is sufficient to compare the eclasses */
+	COMPARE_SCALAR_FIELD(pk_eclass);
+	COMPARE_SCALAR_FIELD(pk_opfamily);
+	COMPARE_SCALAR_FIELD(pk_strategy);
+	COMPARE_SCALAR_FIELD(pk_nulls_first);
+
+	return true;
+}
+
+static bool
+_equalRestrictInfo(const RestrictInfo *a, const RestrictInfo *b)
+{
+	COMPARE_NODE_FIELD(clause);
+	COMPARE_SCALAR_FIELD(is_pushed_down);
+	COMPARE_SCALAR_FIELD(outerjoin_delayed);
+	COMPARE_BITMAPSET_FIELD(required_relids);
+	COMPARE_BITMAPSET_FIELD(outer_relids);
+	COMPARE_BITMAPSET_FIELD(nullable_relids);
+
+	/*
+	 * We ignore all the remaining fields, since they may not be set yet, and
+	 * should be derivable from the clause anyway.
+	 */
+
+	return true;
+}
+
+static bool
+_equalPlaceHolderVar(const PlaceHolderVar *a, const PlaceHolderVar *b)
+{
+	/*
+	 * We intentionally do not compare phexpr.  Two PlaceHolderVars with the
+	 * same ID and levelsup should be considered equal even if the contained
+	 * expressions have managed to mutate to different states.  This will
+	 * happen during final plan construction when there are nested PHVs, since
+	 * the inner PHV will get replaced by a Param in some copies of the outer
+	 * PHV.  Another way in which it can happen is that initplan sublinks
+	 * could get replaced by differently-numbered Params when sublink folding
+	 * is done.  (The end result of such a situation would be some
+	 * unreferenced initplans, which is annoying but not really a problem.) On
+	 * the same reasoning, there is no need to examine phrels.
+	 *
+	 * COMPARE_NODE_FIELD(phexpr);
+	 *
+	 * COMPARE_BITMAPSET_FIELD(phrels);
+	 */
+	COMPARE_SCALAR_FIELD(phid);
+	COMPARE_SCALAR_FIELD(phlevelsup);
+
+	return true;
+}
+
+static bool
+_equalSpecialJoinInfo(const SpecialJoinInfo *a, const SpecialJoinInfo *b)
+{
+	COMPARE_BITMAPSET_FIELD(min_lefthand);
+	COMPARE_BITMAPSET_FIELD(min_righthand);
+	COMPARE_BITMAPSET_FIELD(syn_lefthand);
+	COMPARE_BITMAPSET_FIELD(syn_righthand);
+	COMPARE_SCALAR_FIELD(jointype);
+	COMPARE_SCALAR_FIELD(lhs_strict);
+	COMPARE_SCALAR_FIELD(delay_upper_joins);
+	COMPARE_SCALAR_FIELD(semi_can_btree);
+	COMPARE_SCALAR_FIELD(semi_can_hash);
+	COMPARE_NODE_FIELD(semi_operators);
+	COMPARE_NODE_FIELD(semi_rhs_exprs);
+
+	return true;
+}
+
+static bool
+_equalAppendRelInfo(const AppendRelInfo *a, const AppendRelInfo *b)
+{
+	COMPARE_SCALAR_FIELD(parent_relid);
+	COMPARE_SCALAR_FIELD(child_relid);
+	COMPARE_SCALAR_FIELD(parent_reltype);
+	COMPARE_SCALAR_FIELD(child_reltype);
+	COMPARE_NODE_FIELD(translated_vars);
+	COMPARE_SCALAR_FIELD(parent_reloid);
+
+	return true;
+}
+
+static bool
+_equalPlaceHolderInfo(const PlaceHolderInfo *a, const PlaceHolderInfo *b)
+{
+	COMPARE_SCALAR_FIELD(phid);
+	COMPARE_NODE_FIELD(ph_var); /* should be redundant */
+	COMPARE_BITMAPSET_FIELD(ph_eval_at);
+	COMPARE_BITMAPSET_FIELD(ph_lateral);
+	COMPARE_BITMAPSET_FIELD(ph_needed);
+	COMPARE_SCALAR_FIELD(ph_width);
+
+	return true;
+}
+
+
+/*
+ * Stuff from parsenodes.h
+ */
+
+static bool
+_equalQuery(const Query *a, const Query *b)
+{
+	COMPARE_SCALAR_FIELD(commandType);
+	COMPARE_SCALAR_FIELD(querySource);
+	/* we intentionally ignore queryId, since it might not be set */
+	COMPARE_SCALAR_FIELD(canSetTag);
+	COMPARE_NODE_FIELD(utilityStmt);
+	COMPARE_SCALAR_FIELD(resultRelation);
+	COMPARE_SCALAR_FIELD(hasAggs);
+	COMPARE_SCALAR_FIELD(hasWindowFuncs);
+	COMPARE_SCALAR_FIELD(hasSubLinks);
+	COMPARE_SCALAR_FIELD(hasDistinctOn);
+	COMPARE_SCALAR_FIELD(hasRecursive);
+	COMPARE_SCALAR_FIELD(hasModifyingCTE);
+	COMPARE_SCALAR_FIELD(hasForUpdate);
+	COMPARE_SCALAR_FIELD(hasRowSecurity);
+	COMPARE_NODE_FIELD(cteList);
+	COMPARE_NODE_FIELD(rtable);
+	COMPARE_NODE_FIELD(jointree);
+	COMPARE_NODE_FIELD(targetList);
+	COMPARE_NODE_FIELD(onConflict);
+	COMPARE_NODE_FIELD(returningList);
+	COMPARE_NODE_FIELD(groupClause);
+	COMPARE_NODE_FIELD(groupingSets);
+	COMPARE_NODE_FIELD(havingQual);
+	COMPARE_NODE_FIELD(windowClause);
+	COMPARE_NODE_FIELD(distinctClause);
+	COMPARE_NODE_FIELD(sortClause);
+	COMPARE_NODE_FIELD(limitOffset);
+	COMPARE_NODE_FIELD(limitCount);
+	COMPARE_NODE_FIELD(rowMarks);
+	COMPARE_NODE_FIELD(setOperations);
+	COMPARE_NODE_FIELD(constraintDeps);
+	COMPARE_NODE_FIELD(withCheckOptions);
+
+	return true;
+}
+
+static bool
+_equalInsertStmt(const InsertStmt *a, const InsertStmt *b)
+{
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_NODE_FIELD(cols);
+	COMPARE_NODE_FIELD(selectStmt);
+	COMPARE_NODE_FIELD(onConflictClause);
+	COMPARE_NODE_FIELD(returningList);
+	COMPARE_NODE_FIELD(withClause);
+
+	return true;
+}
+
+static bool
+_equalDeleteStmt(const DeleteStmt *a, const DeleteStmt *b)
+{
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_NODE_FIELD(usingClause);
+	COMPARE_NODE_FIELD(whereClause);
+	COMPARE_NODE_FIELD(returningList);
+	COMPARE_NODE_FIELD(withClause);
+
+	return true;
+}
+
+static bool
+_equalUpdateStmt(const UpdateStmt *a, const UpdateStmt *b)
+{
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_NODE_FIELD(targetList);
+	COMPARE_NODE_FIELD(whereClause);
+	COMPARE_NODE_FIELD(fromClause);
+	COMPARE_NODE_FIELD(returningList);
+	COMPARE_NODE_FIELD(withClause);
+
+	return true;
+}
+
+static bool
+_equalSelectStmt(const SelectStmt *a, const SelectStmt *b)
+{
+	COMPARE_NODE_FIELD(distinctClause);
+	COMPARE_NODE_FIELD(intoClause);
+	COMPARE_NODE_FIELD(targetList);
+	COMPARE_NODE_FIELD(fromClause);
+	COMPARE_NODE_FIELD(whereClause);
+	COMPARE_NODE_FIELD(groupClause);
+	COMPARE_NODE_FIELD(havingClause);
+	COMPARE_NODE_FIELD(windowClause);
+	COMPARE_NODE_FIELD(valuesLists);
+	COMPARE_NODE_FIELD(sortClause);
+	COMPARE_NODE_FIELD(limitOffset);
+	COMPARE_NODE_FIELD(limitCount);
+	COMPARE_NODE_FIELD(lockingClause);
+	COMPARE_NODE_FIELD(withClause);
+	COMPARE_SCALAR_FIELD(op);
+	COMPARE_SCALAR_FIELD(all);
+	COMPARE_NODE_FIELD(larg);
+	COMPARE_NODE_FIELD(rarg);
+
+	return true;
+}
+
+static bool
+_equalSetOperationStmt(const SetOperationStmt *a, const SetOperationStmt *b)
+{
+	COMPARE_SCALAR_FIELD(op);
+	COMPARE_SCALAR_FIELD(all);
+	COMPARE_NODE_FIELD(larg);
+	COMPARE_NODE_FIELD(rarg);
+	COMPARE_NODE_FIELD(colTypes);
+	COMPARE_NODE_FIELD(colTypmods);
+	COMPARE_NODE_FIELD(colCollations);
+	COMPARE_NODE_FIELD(groupClauses);
+
+	return true;
+}
+
+static bool
+_equalAlterTableStmt(const AlterTableStmt *a, const AlterTableStmt *b)
+{
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_NODE_FIELD(cmds);
+	COMPARE_SCALAR_FIELD(relkind);
+	COMPARE_SCALAR_FIELD(missing_ok);
+
+	return true;
+}
+
+static bool
+_equalAlterTableCmd(const AlterTableCmd *a, const AlterTableCmd *b)
+{
+	COMPARE_SCALAR_FIELD(subtype);
+	COMPARE_STRING_FIELD(name);
+	COMPARE_NODE_FIELD(newowner);
+	COMPARE_NODE_FIELD(def);
+	COMPARE_SCALAR_FIELD(behavior);
+	COMPARE_SCALAR_FIELD(missing_ok);
+
+	return true;
+}
+
+static bool
+_equalAlterDomainStmt(const AlterDomainStmt *a, const AlterDomainStmt *b)
+{
+	COMPARE_SCALAR_FIELD(subtype);
+	COMPARE_NODE_FIELD(typeName);
+	COMPARE_STRING_FIELD(name);
+	COMPARE_NODE_FIELD(def);
+	COMPARE_SCALAR_FIELD(behavior);
+	COMPARE_SCALAR_FIELD(missing_ok);
+
+	return true;
+}
+
+static bool
+_equalGrantStmt(const GrantStmt *a, const GrantStmt *b)
+{
+	COMPARE_SCALAR_FIELD(is_grant);
+	COMPARE_SCALAR_FIELD(targtype);
+	COMPARE_SCALAR_FIELD(objtype);
+	COMPARE_NODE_FIELD(objects);
+	COMPARE_NODE_FIELD(privileges);
+	COMPARE_NODE_FIELD(grantees);
+	COMPARE_SCALAR_FIELD(grant_option);
+	COMPARE_SCALAR_FIELD(behavior);
+
+	return true;
+}
+
+static bool
+_equalFuncWithArgs(const FuncWithArgs *a, const FuncWithArgs *b)
+{
+	COMPARE_NODE_FIELD(funcname);
+	COMPARE_NODE_FIELD(funcargs);
+
+	return true;
+}
+
+static bool
+_equalAccessPriv(const AccessPriv *a, const AccessPriv *b)
+{
+	COMPARE_STRING_FIELD(priv_name);
+	COMPARE_NODE_FIELD(cols);
+
+	return true;
+}
+
+static bool
+_equalGrantRoleStmt(const GrantRoleStmt *a, const GrantRoleStmt *b)
+{
+	COMPARE_NODE_FIELD(granted_roles);
+	COMPARE_NODE_FIELD(grantee_roles);
+	COMPARE_SCALAR_FIELD(is_grant);
+	COMPARE_SCALAR_FIELD(admin_opt);
+	COMPARE_NODE_FIELD(grantor);
+	COMPARE_SCALAR_FIELD(behavior);
+
+	return true;
+}
+
+static bool
+_equalAlterDefaultPrivilegesStmt(const AlterDefaultPrivilegesStmt *a, const AlterDefaultPrivilegesStmt *b)
+{
+	COMPARE_NODE_FIELD(options);
+	COMPARE_NODE_FIELD(action);
+
+	return true;
+}
+
+static bool
+_equalDeclareCursorStmt(const DeclareCursorStmt *a, const DeclareCursorStmt *b)
+{
+	COMPARE_STRING_FIELD(portalname);
+	COMPARE_SCALAR_FIELD(options);
+	COMPARE_NODE_FIELD(query);
+
+	return true;
+}
+
+static bool
+_equalClosePortalStmt(const ClosePortalStmt *a, const ClosePortalStmt *b)
+{
+	COMPARE_STRING_FIELD(portalname);
+
+	return true;
+}
+
+static bool
+_equalClusterStmt(const ClusterStmt *a, const ClusterStmt *b)
+{
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_STRING_FIELD(indexname);
+	COMPARE_SCALAR_FIELD(verbose);
+
+	return true;
+}
+
+static bool
+_equalCopyStmt(const CopyStmt *a, const CopyStmt *b)
+{
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_NODE_FIELD(query);
+	COMPARE_NODE_FIELD(attlist);
+	COMPARE_SCALAR_FIELD(is_from);
+	COMPARE_SCALAR_FIELD(is_program);
+	COMPARE_STRING_FIELD(filename);
+	COMPARE_NODE_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalCreateStmt(const CreateStmt *a, const CreateStmt *b)
+{
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_NODE_FIELD(tableElts);
+	COMPARE_NODE_FIELD(inhRelations);
+	COMPARE_NODE_FIELD(ofTypename);
+	COMPARE_NODE_FIELD(constraints);
+	COMPARE_NODE_FIELD(options);
+	COMPARE_SCALAR_FIELD(oncommit);
+	COMPARE_STRING_FIELD(tablespacename);
+	COMPARE_SCALAR_FIELD(if_not_exists);
+
+	return true;
+}
+
+static bool
+_equalTableLikeClause(const TableLikeClause *a, const TableLikeClause *b)
+{
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_SCALAR_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalDefineStmt(const DefineStmt *a, const DefineStmt *b)
+{
+	COMPARE_SCALAR_FIELD(kind);
+	COMPARE_SCALAR_FIELD(oldstyle);
+	COMPARE_NODE_FIELD(defnames);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_NODE_FIELD(definition);
+
+	return true;
+}
+
+static bool
+_equalDropStmt(const DropStmt *a, const DropStmt *b)
+{
+	COMPARE_NODE_FIELD(objects);
+	COMPARE_NODE_FIELD(arguments);
+	COMPARE_SCALAR_FIELD(removeType);
+	COMPARE_SCALAR_FIELD(behavior);
+	COMPARE_SCALAR_FIELD(missing_ok);
+	COMPARE_SCALAR_FIELD(concurrent);
+
+	return true;
+}
+
+static bool
+_equalTruncateStmt(const TruncateStmt *a, const TruncateStmt *b)
+{
+	COMPARE_NODE_FIELD(relations);
+	COMPARE_SCALAR_FIELD(restart_seqs);
+	COMPARE_SCALAR_FIELD(behavior);
+
+	return true;
+}
+
+static bool
+_equalCommentStmt(const CommentStmt *a, const CommentStmt *b)
+{
+	COMPARE_SCALAR_FIELD(objtype);
+	COMPARE_NODE_FIELD(objname);
+	COMPARE_NODE_FIELD(objargs);
+	COMPARE_STRING_FIELD(comment);
+
+	return true;
+}
+
+static bool
+_equalSecLabelStmt(const SecLabelStmt *a, const SecLabelStmt *b)
+{
+	COMPARE_SCALAR_FIELD(objtype);
+	COMPARE_NODE_FIELD(objname);
+	COMPARE_NODE_FIELD(objargs);
+	COMPARE_STRING_FIELD(provider);
+	COMPARE_STRING_FIELD(label);
+
+	return true;
+}
+
+static bool
+_equalFetchStmt(const FetchStmt *a, const FetchStmt *b)
+{
+	COMPARE_SCALAR_FIELD(direction);
+	COMPARE_SCALAR_FIELD(howMany);
+	COMPARE_STRING_FIELD(portalname);
+	COMPARE_SCALAR_FIELD(ismove);
+
+	return true;
+}
+
+static bool
+_equalIndexStmt(const IndexStmt *a, const IndexStmt *b)
+{
+	COMPARE_STRING_FIELD(idxname);
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_STRING_FIELD(accessMethod);
+	COMPARE_STRING_FIELD(tableSpace);
+	COMPARE_NODE_FIELD(indexParams);
+	COMPARE_NODE_FIELD(options);
+	COMPARE_NODE_FIELD(whereClause);
+	COMPARE_NODE_FIELD(excludeOpNames);
+	COMPARE_STRING_FIELD(idxcomment);
+	COMPARE_SCALAR_FIELD(indexOid);
+	COMPARE_SCALAR_FIELD(oldNode);
+	COMPARE_SCALAR_FIELD(unique);
+	COMPARE_SCALAR_FIELD(primary);
+	COMPARE_SCALAR_FIELD(isconstraint);
+	COMPARE_SCALAR_FIELD(deferrable);
+	COMPARE_SCALAR_FIELD(initdeferred);
+	COMPARE_SCALAR_FIELD(transformed);
+	COMPARE_SCALAR_FIELD(concurrent);
+	COMPARE_SCALAR_FIELD(if_not_exists);
+
+	return true;
+}
+
+static bool
+_equalCreateFunctionStmt(const CreateFunctionStmt *a, const CreateFunctionStmt *b)
+{
+	COMPARE_SCALAR_FIELD(replace);
+	COMPARE_NODE_FIELD(funcname);
+	COMPARE_NODE_FIELD(parameters);
+	COMPARE_NODE_FIELD(returnType);
+	COMPARE_NODE_FIELD(options);
+	COMPARE_NODE_FIELD(withClause);
+
+	return true;
+}
+
+static bool
+_equalFunctionParameter(const FunctionParameter *a, const FunctionParameter *b)
+{
+	COMPARE_STRING_FIELD(name);
+	COMPARE_NODE_FIELD(argType);
+	COMPARE_SCALAR_FIELD(mode);
+	COMPARE_NODE_FIELD(defexpr);
+
+	return true;
+}
+
+static bool
+_equalAlterFunctionStmt(const AlterFunctionStmt *a, const AlterFunctionStmt *b)
+{
+	COMPARE_NODE_FIELD(func);
+	COMPARE_NODE_FIELD(actions);
+
+	return true;
+}
+
+static bool
+_equalDoStmt(const DoStmt *a, const DoStmt *b)
+{
+	COMPARE_NODE_FIELD(args);
+
+	return true;
+}
+
+static bool
+_equalRenameStmt(const RenameStmt *a, const RenameStmt *b)
+{
+	COMPARE_SCALAR_FIELD(renameType);
+	COMPARE_SCALAR_FIELD(relationType);
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_NODE_FIELD(object);
+	COMPARE_NODE_FIELD(objarg);
+	COMPARE_STRING_FIELD(subname);
+	COMPARE_STRING_FIELD(newname);
+	COMPARE_SCALAR_FIELD(behavior);
+	COMPARE_SCALAR_FIELD(missing_ok);
+
+	return true;
+}
+
+static bool
+_equalAlterObjectSchemaStmt(const AlterObjectSchemaStmt *a, const AlterObjectSchemaStmt *b)
+{
+	COMPARE_SCALAR_FIELD(objectType);
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_NODE_FIELD(object);
+	COMPARE_NODE_FIELD(objarg);
+	COMPARE_STRING_FIELD(newschema);
+	COMPARE_SCALAR_FIELD(missing_ok);
+
+	return true;
+}
+
+static bool
+_equalAlterOwnerStmt(const AlterOwnerStmt *a, const AlterOwnerStmt *b)
+{
+	COMPARE_SCALAR_FIELD(objectType);
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_NODE_FIELD(object);
+	COMPARE_NODE_FIELD(objarg);
+	COMPARE_NODE_FIELD(newowner);
+
+	return true;
+}
+
+static bool
+_equalRuleStmt(const RuleStmt *a, const RuleStmt *b)
+{
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_STRING_FIELD(rulename);
+	COMPARE_NODE_FIELD(whereClause);
+	COMPARE_SCALAR_FIELD(event);
+	COMPARE_SCALAR_FIELD(instead);
+	COMPARE_NODE_FIELD(actions);
+	COMPARE_SCALAR_FIELD(replace);
+
+	return true;
+}
+
+static bool
+_equalNotifyStmt(const NotifyStmt *a, const NotifyStmt *b)
+{
+	COMPARE_STRING_FIELD(conditionname);
+	COMPARE_STRING_FIELD(payload);
+
+	return true;
+}
+
+static bool
+_equalListenStmt(const ListenStmt *a, const ListenStmt *b)
+{
+	COMPARE_STRING_FIELD(conditionname);
+
+	return true;
+}
+
+static bool
+_equalUnlistenStmt(const UnlistenStmt *a, const UnlistenStmt *b)
+{
+	COMPARE_STRING_FIELD(conditionname);
+
+	return true;
+}
+
+static bool
+_equalTransactionStmt(const TransactionStmt *a, const TransactionStmt *b)
+{
+	COMPARE_SCALAR_FIELD(kind);
+	COMPARE_NODE_FIELD(options);
+	COMPARE_STRING_FIELD(gid);
+
+	return true;
+}
+
+static bool
+_equalCompositeTypeStmt(const CompositeTypeStmt *a, const CompositeTypeStmt *b)
+{
+	COMPARE_NODE_FIELD(typevar);
+	COMPARE_NODE_FIELD(coldeflist);
+
+	return true;
+}
+
+static bool
+_equalCreateEnumStmt(const CreateEnumStmt *a, const CreateEnumStmt *b)
+{
+	COMPARE_NODE_FIELD(typeName);
+	COMPARE_NODE_FIELD(vals);
+
+	return true;
+}
+
+static bool
+_equalCreateRangeStmt(const CreateRangeStmt *a, const CreateRangeStmt *b)
+{
+	COMPARE_NODE_FIELD(typeName);
+	COMPARE_NODE_FIELD(params);
+
+	return true;
+}
+
+static bool
+_equalAlterEnumStmt(const AlterEnumStmt *a, const AlterEnumStmt *b)
+{
+	COMPARE_NODE_FIELD(typeName);
+	COMPARE_STRING_FIELD(newVal);
+	COMPARE_STRING_FIELD(newValNeighbor);
+	COMPARE_SCALAR_FIELD(newValIsAfter);
+	COMPARE_SCALAR_FIELD(skipIfExists);
+
+	return true;
+}
+
+static bool
+_equalViewStmt(const ViewStmt *a, const ViewStmt *b)
+{
+	COMPARE_NODE_FIELD(view);
+	COMPARE_NODE_FIELD(aliases);
+	COMPARE_NODE_FIELD(query);
+	COMPARE_SCALAR_FIELD(replace);
+	COMPARE_NODE_FIELD(options);
+	COMPARE_SCALAR_FIELD(withCheckOption);
+
+	return true;
+}
+
+static bool
+_equalLoadStmt(const LoadStmt *a, const LoadStmt *b)
+{
+	COMPARE_STRING_FIELD(filename);
+
+	return true;
+}
+
+static bool
+_equalCreateDomainStmt(const CreateDomainStmt *a, const CreateDomainStmt *b)
+{
+	COMPARE_NODE_FIELD(domainname);
+	COMPARE_NODE_FIELD(typeName);
+	COMPARE_NODE_FIELD(collClause);
+	COMPARE_NODE_FIELD(constraints);
+
+	return true;
+}
+
+static bool
+_equalCreateOpClassStmt(const CreateOpClassStmt *a, const CreateOpClassStmt *b)
+{
+	COMPARE_NODE_FIELD(opclassname);
+	COMPARE_NODE_FIELD(opfamilyname);
+	COMPARE_STRING_FIELD(amname);
+	COMPARE_NODE_FIELD(datatype);
+	COMPARE_NODE_FIELD(items);
+	COMPARE_SCALAR_FIELD(isDefault);
+
+	return true;
+}
+
+static bool
+_equalCreateOpClassItem(const CreateOpClassItem *a, const CreateOpClassItem *b)
+{
+	COMPARE_SCALAR_FIELD(itemtype);
+	COMPARE_NODE_FIELD(name);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_SCALAR_FIELD(number);
+	COMPARE_NODE_FIELD(order_family);
+	COMPARE_NODE_FIELD(class_args);
+	COMPARE_NODE_FIELD(storedtype);
+
+	return true;
+}
+
+static bool
+_equalCreateOpFamilyStmt(const CreateOpFamilyStmt *a, const CreateOpFamilyStmt *b)
+{
+	COMPARE_NODE_FIELD(opfamilyname);
+	COMPARE_STRING_FIELD(amname);
+
+	return true;
+}
+
+static bool
+_equalAlterOpFamilyStmt(const AlterOpFamilyStmt *a, const AlterOpFamilyStmt *b)
+{
+	COMPARE_NODE_FIELD(opfamilyname);
+	COMPARE_STRING_FIELD(amname);
+	COMPARE_SCALAR_FIELD(isDrop);
+	COMPARE_NODE_FIELD(items);
+
+	return true;
+}
+
+static bool
+_equalCreatedbStmt(const CreatedbStmt *a, const CreatedbStmt *b)
+{
+	COMPARE_STRING_FIELD(dbname);
+	COMPARE_NODE_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalAlterDatabaseStmt(const AlterDatabaseStmt *a, const AlterDatabaseStmt *b)
+{
+	COMPARE_STRING_FIELD(dbname);
+	COMPARE_NODE_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalAlterDatabaseSetStmt(const AlterDatabaseSetStmt *a, const AlterDatabaseSetStmt *b)
+{
+	COMPARE_STRING_FIELD(dbname);
+	COMPARE_NODE_FIELD(setstmt);
+
+	return true;
+}
+
+static bool
+_equalDropdbStmt(const DropdbStmt *a, const DropdbStmt *b)
+{
+	COMPARE_STRING_FIELD(dbname);
+	COMPARE_SCALAR_FIELD(missing_ok);
+
+	return true;
+}
+
+static bool
+_equalVacuumStmt(const VacuumStmt *a, const VacuumStmt *b)
+{
+	COMPARE_SCALAR_FIELD(options);
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_NODE_FIELD(va_cols);
+
+	return true;
+}
+
+static bool
+_equalExplainStmt(const ExplainStmt *a, const ExplainStmt *b)
+{
+	COMPARE_NODE_FIELD(query);
+	COMPARE_NODE_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalCreateTableAsStmt(const CreateTableAsStmt *a, const CreateTableAsStmt *b)
+{
+	COMPARE_NODE_FIELD(query);
+	COMPARE_NODE_FIELD(into);
+	COMPARE_SCALAR_FIELD(relkind);
+	COMPARE_SCALAR_FIELD(is_select_into);
+	COMPARE_SCALAR_FIELD(if_not_exists);
+
+	return true;
+}
+
+static bool
+_equalRefreshMatViewStmt(const RefreshMatViewStmt *a, const RefreshMatViewStmt *b)
+{
+	COMPARE_SCALAR_FIELD(concurrent);
+	COMPARE_SCALAR_FIELD(skipData);
+	COMPARE_NODE_FIELD(relation);
+
+	return true;
+}
+
+static bool
+_equalReplicaIdentityStmt(const ReplicaIdentityStmt *a, const ReplicaIdentityStmt *b)
+{
+	COMPARE_SCALAR_FIELD(identity_type);
+	COMPARE_STRING_FIELD(name);
+
+	return true;
+}
+
+static bool
+_equalAlterSystemStmt(const AlterSystemStmt *a, const AlterSystemStmt *b)
+{
+	COMPARE_NODE_FIELD(setstmt);
+
+	return true;
+}
+
+
+static bool
+_equalCreateSeqStmt(const CreateSeqStmt *a, const CreateSeqStmt *b)
+{
+	COMPARE_NODE_FIELD(sequence);
+	COMPARE_NODE_FIELD(options);
+	COMPARE_SCALAR_FIELD(ownerId);
+	COMPARE_SCALAR_FIELD(if_not_exists);
+
+	return true;
+}
+
+static bool
+_equalAlterSeqStmt(const AlterSeqStmt *a, const AlterSeqStmt *b)
+{
+	COMPARE_NODE_FIELD(sequence);
+	COMPARE_NODE_FIELD(options);
+	COMPARE_SCALAR_FIELD(missing_ok);
+
+	return true;
+}
+
+static bool
+_equalVariableSetStmt(const VariableSetStmt *a, const VariableSetStmt *b)
+{
+	COMPARE_SCALAR_FIELD(kind);
+	COMPARE_STRING_FIELD(name);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_SCALAR_FIELD(is_local);
+
+	return true;
+}
+
+static bool
+_equalVariableShowStmt(const VariableShowStmt *a, const VariableShowStmt *b)
+{
+	COMPARE_STRING_FIELD(name);
+
+	return true;
+}
+
+static bool
+_equalDiscardStmt(const DiscardStmt *a, const DiscardStmt *b)
+{
+	COMPARE_SCALAR_FIELD(target);
+
+	return true;
+}
+
+static bool
+_equalCreateTableSpaceStmt(const CreateTableSpaceStmt *a, const CreateTableSpaceStmt *b)
+{
+	COMPARE_STRING_FIELD(tablespacename);
+	COMPARE_NODE_FIELD(owner);
+	COMPARE_STRING_FIELD(location);
+	COMPARE_NODE_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalDropTableSpaceStmt(const DropTableSpaceStmt *a, const DropTableSpaceStmt *b)
+{
+	COMPARE_STRING_FIELD(tablespacename);
+	COMPARE_SCALAR_FIELD(missing_ok);
+
+	return true;
+}
+
+static bool
+_equalAlterTableSpaceOptionsStmt(const AlterTableSpaceOptionsStmt *a,
+								 const AlterTableSpaceOptionsStmt *b)
+{
+	COMPARE_STRING_FIELD(tablespacename);
+	COMPARE_NODE_FIELD(options);
+	COMPARE_SCALAR_FIELD(isReset);
+
+	return true;
+}
+
+static bool
+_equalAlterTableMoveAllStmt(const AlterTableMoveAllStmt *a,
+							const AlterTableMoveAllStmt *b)
+{
+	COMPARE_STRING_FIELD(orig_tablespacename);
+	COMPARE_SCALAR_FIELD(objtype);
+	COMPARE_NODE_FIELD(roles);
+	COMPARE_STRING_FIELD(new_tablespacename);
+	COMPARE_SCALAR_FIELD(nowait);
+
+	return true;
+}
+
+static bool
+_equalCreateExtensionStmt(const CreateExtensionStmt *a, const CreateExtensionStmt *b)
+{
+	COMPARE_STRING_FIELD(extname);
+	COMPARE_SCALAR_FIELD(if_not_exists);
+	COMPARE_NODE_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalAlterExtensionStmt(const AlterExtensionStmt *a, const AlterExtensionStmt *b)
+{
+	COMPARE_STRING_FIELD(extname);
+	COMPARE_NODE_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalAlterExtensionContentsStmt(const AlterExtensionContentsStmt *a, const AlterExtensionContentsStmt *b)
+{
+	COMPARE_STRING_FIELD(extname);
+	COMPARE_SCALAR_FIELD(action);
+	COMPARE_SCALAR_FIELD(objtype);
+	COMPARE_NODE_FIELD(objname);
+	COMPARE_NODE_FIELD(objargs);
+
+	return true;
+}
+
+static bool
+_equalCreateFdwStmt(const CreateFdwStmt *a, const CreateFdwStmt *b)
+{
+	COMPARE_STRING_FIELD(fdwname);
+	COMPARE_NODE_FIELD(func_options);
+	COMPARE_NODE_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalAlterFdwStmt(const AlterFdwStmt *a, const AlterFdwStmt *b)
+{
+	COMPARE_STRING_FIELD(fdwname);
+	COMPARE_NODE_FIELD(func_options);
+	COMPARE_NODE_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalCreateForeignServerStmt(const CreateForeignServerStmt *a, const CreateForeignServerStmt *b)
+{
+	COMPARE_STRING_FIELD(servername);
+	COMPARE_STRING_FIELD(servertype);
+	COMPARE_STRING_FIELD(version);
+	COMPARE_STRING_FIELD(fdwname);
+	COMPARE_NODE_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalAlterForeignServerStmt(const AlterForeignServerStmt *a, const AlterForeignServerStmt *b)
+{
+	COMPARE_STRING_FIELD(servername);
+	COMPARE_STRING_FIELD(version);
+	COMPARE_NODE_FIELD(options);
+	COMPARE_SCALAR_FIELD(has_version);
+
+	return true;
+}
+
+static bool
+_equalCreateUserMappingStmt(const CreateUserMappingStmt *a, const CreateUserMappingStmt *b)
+{
+	COMPARE_NODE_FIELD(user);
+	COMPARE_STRING_FIELD(servername);
+	COMPARE_NODE_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalAlterUserMappingStmt(const AlterUserMappingStmt *a, const AlterUserMappingStmt *b)
+{
+	COMPARE_NODE_FIELD(user);
+	COMPARE_STRING_FIELD(servername);
+	COMPARE_NODE_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalDropUserMappingStmt(const DropUserMappingStmt *a, const DropUserMappingStmt *b)
+{
+	COMPARE_NODE_FIELD(user);
+	COMPARE_STRING_FIELD(servername);
+	COMPARE_SCALAR_FIELD(missing_ok);
+
+	return true;
+}
+
+static bool
+_equalCreateForeignTableStmt(const CreateForeignTableStmt *a, const CreateForeignTableStmt *b)
+{
+	if (!_equalCreateStmt(&a->base, &b->base))
+		return false;
+
+	COMPARE_STRING_FIELD(servername);
+	COMPARE_NODE_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalImportForeignSchemaStmt(const ImportForeignSchemaStmt *a, const ImportForeignSchemaStmt *b)
+{
+	COMPARE_STRING_FIELD(server_name);
+	COMPARE_STRING_FIELD(remote_schema);
+	COMPARE_STRING_FIELD(local_schema);
+	COMPARE_SCALAR_FIELD(list_type);
+	COMPARE_NODE_FIELD(table_list);
+	COMPARE_NODE_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalCreateTransformStmt(const CreateTransformStmt *a, const CreateTransformStmt *b)
+{
+	COMPARE_SCALAR_FIELD(replace);
+	COMPARE_NODE_FIELD(type_name);
+	COMPARE_STRING_FIELD(lang);
+	COMPARE_NODE_FIELD(fromsql);
+	COMPARE_NODE_FIELD(tosql);
+
+	return true;
+}
+
+static bool
+_equalCreateTrigStmt(const CreateTrigStmt *a, const CreateTrigStmt *b)
+{
+	COMPARE_STRING_FIELD(trigname);
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_NODE_FIELD(funcname);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_SCALAR_FIELD(row);
+	COMPARE_SCALAR_FIELD(timing);
+	COMPARE_SCALAR_FIELD(events);
+	COMPARE_NODE_FIELD(columns);
+	COMPARE_NODE_FIELD(whenClause);
+	COMPARE_SCALAR_FIELD(isconstraint);
+	COMPARE_SCALAR_FIELD(deferrable);
+	COMPARE_SCALAR_FIELD(initdeferred);
+	COMPARE_NODE_FIELD(constrrel);
+
+	return true;
+}
+
+static bool
+_equalCreateEventTrigStmt(const CreateEventTrigStmt *a, const CreateEventTrigStmt *b)
+{
+	COMPARE_STRING_FIELD(trigname);
+	COMPARE_STRING_FIELD(eventname);
+	COMPARE_NODE_FIELD(whenclause);
+	COMPARE_NODE_FIELD(funcname);
+
+	return true;
+}
+
+static bool
+_equalAlterEventTrigStmt(const AlterEventTrigStmt *a, const AlterEventTrigStmt *b)
+{
+	COMPARE_STRING_FIELD(trigname);
+	COMPARE_SCALAR_FIELD(tgenabled);
+
+	return true;
+}
+
+static bool
+_equalCreatePLangStmt(const CreatePLangStmt *a, const CreatePLangStmt *b)
+{
+	COMPARE_SCALAR_FIELD(replace);
+	COMPARE_STRING_FIELD(plname);
+	COMPARE_NODE_FIELD(plhandler);
+	COMPARE_NODE_FIELD(plinline);
+	COMPARE_NODE_FIELD(plvalidator);
+	COMPARE_SCALAR_FIELD(pltrusted);
+
+	return true;
+}
+
+static bool
+_equalCreateRoleStmt(const CreateRoleStmt *a, const CreateRoleStmt *b)
+{
+	COMPARE_SCALAR_FIELD(stmt_type);
+	COMPARE_STRING_FIELD(role);
+	COMPARE_NODE_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalAlterRoleStmt(const AlterRoleStmt *a, const AlterRoleStmt *b)
+{
+	COMPARE_NODE_FIELD(role);
+	COMPARE_NODE_FIELD(options);
+	COMPARE_SCALAR_FIELD(action);
+
+	return true;
+}
+
+static bool
+_equalAlterRoleSetStmt(const AlterRoleSetStmt *a, const AlterRoleSetStmt *b)
+{
+	COMPARE_NODE_FIELD(role);
+	COMPARE_STRING_FIELD(database);
+	COMPARE_NODE_FIELD(setstmt);
+
+	return true;
+}
+
+static bool
+_equalDropRoleStmt(const DropRoleStmt *a, const DropRoleStmt *b)
+{
+	COMPARE_NODE_FIELD(roles);
+	COMPARE_SCALAR_FIELD(missing_ok);
+
+	return true;
+}
+
+static bool
+_equalLockStmt(const LockStmt *a, const LockStmt *b)
+{
+	COMPARE_NODE_FIELD(relations);
+	COMPARE_SCALAR_FIELD(mode);
+	COMPARE_SCALAR_FIELD(nowait);
+
+	return true;
+}
+
+static bool
+_equalConstraintsSetStmt(const ConstraintsSetStmt *a, const ConstraintsSetStmt *b)
+{
+	COMPARE_NODE_FIELD(constraints);
+	COMPARE_SCALAR_FIELD(deferred);
+
+	return true;
+}
+
+static bool
+_equalReindexStmt(const ReindexStmt *a, const ReindexStmt *b)
+{
+	COMPARE_SCALAR_FIELD(kind);
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_STRING_FIELD(name);
+	COMPARE_SCALAR_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalCreateSchemaStmt(const CreateSchemaStmt *a, const CreateSchemaStmt *b)
+{
+	COMPARE_STRING_FIELD(schemaname);
+	COMPARE_NODE_FIELD(authrole);
+	COMPARE_NODE_FIELD(schemaElts);
+	COMPARE_SCALAR_FIELD(if_not_exists);
+
+	return true;
+}
+
+static bool
+_equalCreateConversionStmt(const CreateConversionStmt *a, const CreateConversionStmt *b)
+{
+	COMPARE_NODE_FIELD(conversion_name);
+	COMPARE_STRING_FIELD(for_encoding_name);
+	COMPARE_STRING_FIELD(to_encoding_name);
+	COMPARE_NODE_FIELD(func_name);
+	COMPARE_SCALAR_FIELD(def);
+
+	return true;
+}
+
+static bool
+_equalCreateCastStmt(const CreateCastStmt *a, const CreateCastStmt *b)
+{
+	COMPARE_NODE_FIELD(sourcetype);
+	COMPARE_NODE_FIELD(targettype);
+	COMPARE_NODE_FIELD(func);
+	COMPARE_SCALAR_FIELD(context);
+	COMPARE_SCALAR_FIELD(inout);
+
+	return true;
+}
+
+static bool
+_equalPrepareStmt(const PrepareStmt *a, const PrepareStmt *b)
+{
+	COMPARE_STRING_FIELD(name);
+	COMPARE_NODE_FIELD(argtypes);
+	COMPARE_NODE_FIELD(query);
+
+	return true;
+}
+
+static bool
+_equalExecuteStmt(const ExecuteStmt *a, const ExecuteStmt *b)
+{
+	COMPARE_STRING_FIELD(name);
+	COMPARE_NODE_FIELD(params);
+
+	return true;
+}
+
+static bool
+_equalDeallocateStmt(const DeallocateStmt *a, const DeallocateStmt *b)
+{
+	COMPARE_STRING_FIELD(name);
+
+	return true;
+}
+
+static bool
+_equalDropOwnedStmt(const DropOwnedStmt *a, const DropOwnedStmt *b)
+{
+	COMPARE_NODE_FIELD(roles);
+	COMPARE_SCALAR_FIELD(behavior);
+
+	return true;
+}
+
+static bool
+_equalReassignOwnedStmt(const ReassignOwnedStmt *a, const ReassignOwnedStmt *b)
+{
+	COMPARE_NODE_FIELD(roles);
+	COMPARE_NODE_FIELD(newrole);
+
+	return true;
+}
+
+static bool
+_equalAlterTSDictionaryStmt(const AlterTSDictionaryStmt *a, const AlterTSDictionaryStmt *b)
+{
+	COMPARE_NODE_FIELD(dictname);
+	COMPARE_NODE_FIELD(options);
+
+	return true;
+}
+
+static bool
+_equalAlterTSConfigurationStmt(const AlterTSConfigurationStmt *a,
+							   const AlterTSConfigurationStmt *b)
+{
+	COMPARE_SCALAR_FIELD(kind);
+	COMPARE_NODE_FIELD(cfgname);
+	COMPARE_NODE_FIELD(tokentype);
+	COMPARE_NODE_FIELD(dicts);
+	COMPARE_SCALAR_FIELD(override);
+	COMPARE_SCALAR_FIELD(replace);
+	COMPARE_SCALAR_FIELD(missing_ok);
+
+	return true;
+}
+
+static bool
+_equalCreatePolicyStmt(const CreatePolicyStmt *a, const CreatePolicyStmt *b)
+{
+	COMPARE_STRING_FIELD(policy_name);
+	COMPARE_NODE_FIELD(table);
+	COMPARE_STRING_FIELD(cmd_name);
+	COMPARE_NODE_FIELD(roles);
+	COMPARE_NODE_FIELD(qual);
+	COMPARE_NODE_FIELD(with_check);
+
+	return true;
+}
+
+static bool
+_equalAlterPolicyStmt(const AlterPolicyStmt *a, const AlterPolicyStmt *b)
+{
+	COMPARE_STRING_FIELD(policy_name);
+	COMPARE_NODE_FIELD(table);
+	COMPARE_NODE_FIELD(roles);
+	COMPARE_NODE_FIELD(qual);
+	COMPARE_NODE_FIELD(with_check);
+
+	return true;
+}
+
+static bool
+_equalAExpr(const A_Expr *a, const A_Expr *b)
+{
+	COMPARE_SCALAR_FIELD(kind);
+	COMPARE_NODE_FIELD(name);
+	COMPARE_NODE_FIELD(lexpr);
+	COMPARE_NODE_FIELD(rexpr);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalColumnRef(const ColumnRef *a, const ColumnRef *b)
+{
+	COMPARE_NODE_FIELD(fields);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalParamRef(const ParamRef *a, const ParamRef *b)
+{
+	COMPARE_SCALAR_FIELD(number);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalAConst(const A_Const *a, const A_Const *b)
+{
+	if (!equal(&a->val, &b->val))		/* hack for in-line Value field */
+		return false;
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalFuncCall(const FuncCall *a, const FuncCall *b)
+{
+	COMPARE_NODE_FIELD(funcname);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_NODE_FIELD(agg_order);
+	COMPARE_NODE_FIELD(agg_filter);
+	COMPARE_SCALAR_FIELD(agg_within_group);
+	COMPARE_SCALAR_FIELD(agg_star);
+	COMPARE_SCALAR_FIELD(agg_distinct);
+	COMPARE_SCALAR_FIELD(func_variadic);
+	COMPARE_NODE_FIELD(over);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalAStar(const A_Star *a, const A_Star *b)
+{
+	return true;
+}
+
+static bool
+_equalAIndices(const A_Indices *a, const A_Indices *b)
+{
+	COMPARE_NODE_FIELD(lidx);
+	COMPARE_NODE_FIELD(uidx);
+
+	return true;
+}
+
+static bool
+_equalA_Indirection(const A_Indirection *a, const A_Indirection *b)
+{
+	COMPARE_NODE_FIELD(arg);
+	COMPARE_NODE_FIELD(indirection);
+
+	return true;
+}
+
+static bool
+_equalA_ArrayExpr(const A_ArrayExpr *a, const A_ArrayExpr *b)
+{
+	COMPARE_NODE_FIELD(elements);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalResTarget(const ResTarget *a, const ResTarget *b)
+{
+	COMPARE_STRING_FIELD(name);
+	COMPARE_NODE_FIELD(indirection);
+	COMPARE_NODE_FIELD(val);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalMultiAssignRef(const MultiAssignRef *a, const MultiAssignRef *b)
+{
+	COMPARE_NODE_FIELD(source);
+	COMPARE_SCALAR_FIELD(colno);
+	COMPARE_SCALAR_FIELD(ncolumns);
+
+	return true;
+}
+
+static bool
+_equalTypeName(const TypeName *a, const TypeName *b)
+{
+	COMPARE_NODE_FIELD(names);
+	COMPARE_SCALAR_FIELD(typeOid);
+	COMPARE_SCALAR_FIELD(setof);
+	COMPARE_SCALAR_FIELD(pct_type);
+	COMPARE_NODE_FIELD(typmods);
+	COMPARE_SCALAR_FIELD(typemod);
+	COMPARE_NODE_FIELD(arrayBounds);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalTypeCast(const TypeCast *a, const TypeCast *b)
+{
+	COMPARE_NODE_FIELD(arg);
+	COMPARE_NODE_FIELD(typeName);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalCollateClause(const CollateClause *a, const CollateClause *b)
+{
+	COMPARE_NODE_FIELD(arg);
+	COMPARE_NODE_FIELD(collname);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalSortBy(const SortBy *a, const SortBy *b)
+{
+	COMPARE_NODE_FIELD(node);
+	COMPARE_SCALAR_FIELD(sortby_dir);
+	COMPARE_SCALAR_FIELD(sortby_nulls);
+	COMPARE_NODE_FIELD(useOp);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalWindowDef(const WindowDef *a, const WindowDef *b)
+{
+	COMPARE_STRING_FIELD(name);
+	COMPARE_STRING_FIELD(refname);
+	COMPARE_NODE_FIELD(partitionClause);
+	COMPARE_NODE_FIELD(orderClause);
+	COMPARE_SCALAR_FIELD(frameOptions);
+	COMPARE_NODE_FIELD(startOffset);
+	COMPARE_NODE_FIELD(endOffset);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalRangeSubselect(const RangeSubselect *a, const RangeSubselect *b)
+{
+	COMPARE_SCALAR_FIELD(lateral);
+	COMPARE_NODE_FIELD(subquery);
+	COMPARE_NODE_FIELD(alias);
+
+	return true;
+}
+
+static bool
+_equalRangeFunction(const RangeFunction *a, const RangeFunction *b)
+{
+	COMPARE_SCALAR_FIELD(lateral);
+	COMPARE_SCALAR_FIELD(ordinality);
+	COMPARE_SCALAR_FIELD(is_rowsfrom);
+	COMPARE_NODE_FIELD(functions);
+	COMPARE_NODE_FIELD(alias);
+	COMPARE_NODE_FIELD(coldeflist);
+
+	return true;
+}
+
+static bool
+_equalRangeTableSample(const RangeTableSample *a, const RangeTableSample *b)
+{
+	COMPARE_NODE_FIELD(relation);
+	COMPARE_NODE_FIELD(method);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_NODE_FIELD(repeatable);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalIndexElem(const IndexElem *a, const IndexElem *b)
+{
+	COMPARE_STRING_FIELD(name);
+	COMPARE_NODE_FIELD(expr);
+	COMPARE_STRING_FIELD(indexcolname);
+	COMPARE_NODE_FIELD(collation);
+	COMPARE_NODE_FIELD(opclass);
+	COMPARE_SCALAR_FIELD(ordering);
+	COMPARE_SCALAR_FIELD(nulls_ordering);
+
+	return true;
+}
+
+static bool
+_equalColumnDef(const ColumnDef *a, const ColumnDef *b)
+{
+	COMPARE_STRING_FIELD(colname);
+	COMPARE_NODE_FIELD(typeName);
+	COMPARE_SCALAR_FIELD(inhcount);
+	COMPARE_SCALAR_FIELD(is_local);
+	COMPARE_SCALAR_FIELD(is_not_null);
+	COMPARE_SCALAR_FIELD(is_from_type);
+	COMPARE_SCALAR_FIELD(storage);
+	COMPARE_NODE_FIELD(raw_default);
+	COMPARE_NODE_FIELD(cooked_default);
+	COMPARE_NODE_FIELD(collClause);
+	COMPARE_SCALAR_FIELD(collOid);
+	COMPARE_NODE_FIELD(constraints);
+	COMPARE_NODE_FIELD(fdwoptions);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalConstraint(const Constraint *a, const Constraint *b)
+{
+	COMPARE_SCALAR_FIELD(contype);
+	COMPARE_STRING_FIELD(conname);
+	COMPARE_SCALAR_FIELD(deferrable);
+	COMPARE_SCALAR_FIELD(initdeferred);
+	COMPARE_LOCATION_FIELD(location);
+	COMPARE_SCALAR_FIELD(is_no_inherit);
+	COMPARE_NODE_FIELD(raw_expr);
+	COMPARE_STRING_FIELD(cooked_expr);
+	COMPARE_NODE_FIELD(keys);
+	COMPARE_NODE_FIELD(exclusions);
+	COMPARE_NODE_FIELD(options);
+	COMPARE_STRING_FIELD(indexname);
+	COMPARE_STRING_FIELD(indexspace);
+	COMPARE_STRING_FIELD(access_method);
+	COMPARE_NODE_FIELD(where_clause);
+	COMPARE_NODE_FIELD(pktable);
+	COMPARE_NODE_FIELD(fk_attrs);
+	COMPARE_NODE_FIELD(pk_attrs);
+	COMPARE_SCALAR_FIELD(fk_matchtype);
+	COMPARE_SCALAR_FIELD(fk_upd_action);
+	COMPARE_SCALAR_FIELD(fk_del_action);
+	COMPARE_NODE_FIELD(old_conpfeqop);
+	COMPARE_SCALAR_FIELD(old_pktable_oid);
+	COMPARE_SCALAR_FIELD(skip_validation);
+	COMPARE_SCALAR_FIELD(initially_valid);
+
+	return true;
+}
+
+static bool
+_equalDefElem(const DefElem *a, const DefElem *b)
+{
+	COMPARE_STRING_FIELD(defnamespace);
+	COMPARE_STRING_FIELD(defname);
+	COMPARE_NODE_FIELD(arg);
+	COMPARE_SCALAR_FIELD(defaction);
+
+	return true;
+}
+
+static bool
+_equalLockingClause(const LockingClause *a, const LockingClause *b)
+{
+	COMPARE_NODE_FIELD(lockedRels);
+	COMPARE_SCALAR_FIELD(strength);
+	COMPARE_SCALAR_FIELD(waitPolicy);
+
+	return true;
+}
+
+static bool
+_equalRangeTblEntry(const RangeTblEntry *a, const RangeTblEntry *b)
+{
+	COMPARE_SCALAR_FIELD(rtekind);
+	COMPARE_SCALAR_FIELD(relid);
+	COMPARE_SCALAR_FIELD(relkind);
+	COMPARE_NODE_FIELD(tablesample);
+	COMPARE_NODE_FIELD(subquery);
+	COMPARE_SCALAR_FIELD(security_barrier);
+	COMPARE_SCALAR_FIELD(jointype);
+	COMPARE_NODE_FIELD(joinaliasvars);
+	COMPARE_NODE_FIELD(functions);
+	COMPARE_SCALAR_FIELD(funcordinality);
+	COMPARE_NODE_FIELD(values_lists);
+	COMPARE_NODE_FIELD(values_collations);
+	COMPARE_STRING_FIELD(ctename);
+	COMPARE_SCALAR_FIELD(ctelevelsup);
+	COMPARE_SCALAR_FIELD(self_reference);
+	COMPARE_NODE_FIELD(ctecoltypes);
+	COMPARE_NODE_FIELD(ctecoltypmods);
+	COMPARE_NODE_FIELD(ctecolcollations);
+	COMPARE_NODE_FIELD(alias);
+	COMPARE_NODE_FIELD(eref);
+	COMPARE_SCALAR_FIELD(lateral);
+	COMPARE_SCALAR_FIELD(inh);
+	COMPARE_SCALAR_FIELD(inFromCl);
+	COMPARE_SCALAR_FIELD(requiredPerms);
+	COMPARE_SCALAR_FIELD(checkAsUser);
+	COMPARE_BITMAPSET_FIELD(selectedCols);
+	COMPARE_BITMAPSET_FIELD(insertedCols);
+	COMPARE_BITMAPSET_FIELD(updatedCols);
+	COMPARE_NODE_FIELD(securityQuals);
+
+	return true;
+}
+
+static bool
+_equalRangeTblFunction(const RangeTblFunction *a, const RangeTblFunction *b)
+{
+	COMPARE_NODE_FIELD(funcexpr);
+	COMPARE_SCALAR_FIELD(funccolcount);
+	COMPARE_NODE_FIELD(funccolnames);
+	COMPARE_NODE_FIELD(funccoltypes);
+	COMPARE_NODE_FIELD(funccoltypmods);
+	COMPARE_NODE_FIELD(funccolcollations);
+	COMPARE_BITMAPSET_FIELD(funcparams);
+
+	return true;
+}
+
+static bool
+_equalTableSampleClause(const TableSampleClause *a, const TableSampleClause *b)
+{
+	COMPARE_SCALAR_FIELD(tsmhandler);
+	COMPARE_NODE_FIELD(args);
+	COMPARE_NODE_FIELD(repeatable);
+
+	return true;
+}
+
+static bool
+_equalWithCheckOption(const WithCheckOption *a, const WithCheckOption *b)
+{
+	COMPARE_SCALAR_FIELD(kind);
+	COMPARE_STRING_FIELD(relname);
+	COMPARE_STRING_FIELD(polname);
+	COMPARE_NODE_FIELD(qual);
+	COMPARE_SCALAR_FIELD(cascaded);
+
+	return true;
+}
+
+static bool
+_equalSortGroupClause(const SortGroupClause *a, const SortGroupClause *b)
+{
+	COMPARE_SCALAR_FIELD(tleSortGroupRef);
+	COMPARE_SCALAR_FIELD(eqop);
+	COMPARE_SCALAR_FIELD(sortop);
+	COMPARE_SCALAR_FIELD(nulls_first);
+	COMPARE_SCALAR_FIELD(hashable);
+
+	return true;
+}
+
+static bool
+_equalGroupingSet(const GroupingSet *a, const GroupingSet *b)
+{
+	COMPARE_SCALAR_FIELD(kind);
+	COMPARE_NODE_FIELD(content);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalWindowClause(const WindowClause *a, const WindowClause *b)
+{
+	COMPARE_STRING_FIELD(name);
+	COMPARE_STRING_FIELD(refname);
+	COMPARE_NODE_FIELD(partitionClause);
+	COMPARE_NODE_FIELD(orderClause);
+	COMPARE_SCALAR_FIELD(frameOptions);
+	COMPARE_NODE_FIELD(startOffset);
+	COMPARE_NODE_FIELD(endOffset);
+	COMPARE_SCALAR_FIELD(winref);
+	COMPARE_SCALAR_FIELD(copiedOrder);
+
+	return true;
+}
+
+static bool
+_equalRowMarkClause(const RowMarkClause *a, const RowMarkClause *b)
+{
+	COMPARE_SCALAR_FIELD(rti);
+	COMPARE_SCALAR_FIELD(strength);
+	COMPARE_SCALAR_FIELD(waitPolicy);
+	COMPARE_SCALAR_FIELD(pushedDown);
+
+	return true;
+}
+
+static bool
+_equalWithClause(const WithClause *a, const WithClause *b)
+{
+	COMPARE_NODE_FIELD(ctes);
+	COMPARE_SCALAR_FIELD(recursive);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalInferClause(const InferClause *a, const InferClause *b)
+{
+	COMPARE_NODE_FIELD(indexElems);
+	COMPARE_NODE_FIELD(whereClause);
+	COMPARE_STRING_FIELD(conname);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalOnConflictClause(const OnConflictClause *a, const OnConflictClause *b)
+{
+	COMPARE_SCALAR_FIELD(action);
+	COMPARE_NODE_FIELD(infer);
+	COMPARE_NODE_FIELD(targetList);
+	COMPARE_NODE_FIELD(whereClause);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalCommonTableExpr(const CommonTableExpr *a, const CommonTableExpr *b)
+{
+	COMPARE_STRING_FIELD(ctename);
+	COMPARE_NODE_FIELD(aliascolnames);
+	COMPARE_NODE_FIELD(ctequery);
+	COMPARE_LOCATION_FIELD(location);
+	COMPARE_SCALAR_FIELD(cterecursive);
+	COMPARE_SCALAR_FIELD(cterefcount);
+	COMPARE_NODE_FIELD(ctecolnames);
+	COMPARE_NODE_FIELD(ctecoltypes);
+	COMPARE_NODE_FIELD(ctecoltypmods);
+	COMPARE_NODE_FIELD(ctecolcollations);
+
+	return true;
+}
+
+static bool
+_equalXmlSerialize(const XmlSerialize *a, const XmlSerialize *b)
+{
+	COMPARE_SCALAR_FIELD(xmloption);
+	COMPARE_NODE_FIELD(expr);
+	COMPARE_NODE_FIELD(typeName);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+static bool
+_equalRoleSpec(const RoleSpec *a, const RoleSpec *b)
+{
+	COMPARE_SCALAR_FIELD(roletype);
+	COMPARE_STRING_FIELD(rolename);
+	COMPARE_LOCATION_FIELD(location);
+
+	return true;
+}
+
+/*
+ * Stuff from pg_list.h
+ */
+
+static bool
+_equalList(const List *a, const List *b)
+{
+	const ListCell *item_a;
+	const ListCell *item_b;
+
+	/*
+	 * Try to reject by simple scalar checks before grovelling through all the
+	 * list elements...
+	 */
+	COMPARE_SCALAR_FIELD(type);
+	COMPARE_SCALAR_FIELD(length);
+
+	/*
+	 * We place the switch outside the loop for the sake of efficiency; this
+	 * may not be worth doing...
+	 */
+	switch (a->type)
+	{
+		case T_List:
+			forboth(item_a, a, item_b, b)
+			{
+				if (!equal(lfirst(item_a), lfirst(item_b)))
+					return false;
+			}
+			break;
+		case T_IntList:
+			forboth(item_a, a, item_b, b)
+			{
+				if (lfirst_int(item_a) != lfirst_int(item_b))
+					return false;
+			}
+			break;
+		case T_OidList:
+			forboth(item_a, a, item_b, b)
+			{
+				if (lfirst_oid(item_a) != lfirst_oid(item_b))
+					return false;
+			}
+			break;
+		default:
+			elog(ERROR, "unrecognized list node type: %d",
+				 (int) a->type);
+			return false;		/* keep compiler quiet */
+	}
+
+	/*
+	 * If we got here, we should have run out of elements of both lists
+	 */
+	Assert(item_a == NULL);
+	Assert(item_b == NULL);
+
+	return true;
+}
+
+/*
+ * Stuff from value.h
+ */
+
+static bool
+_equalValue(const Value *a, const Value *b)
+{
+	COMPARE_SCALAR_FIELD(type);
+
+	switch (a->type)
+	{
+		case T_Integer:
+			COMPARE_SCALAR_FIELD(val.ival);
+			break;
+		case T_Float:
+		case T_String:
+		case T_BitString:
+			COMPARE_STRING_FIELD(val.str);
+			break;
+		case T_Null:
+			/* nothing to do */
+			break;
+		default:
+			elog(ERROR, "unrecognized node type: %d", (int) a->type);
+			break;
+	}
+
+	return true;
+}
+
+/*
+ * equal
+ *	  returns whether two nodes are equal
+ */
+bool
+equal(const void *a, const void *b)
+{
+	bool		retval;
+
+	if (a == b)
+		return true;
+
+	/*
+	 * note that a!=b, so only one of them can be NULL
+	 */
+	if (a == NULL || b == NULL)
+		return false;
+
+	/*
+	 * are they the same type of nodes?
+	 */
+	if (nodeTag(a) != nodeTag(b))
+		return false;
+
+	switch (nodeTag(a))
+	{
+			/*
+			 * PRIMITIVE NODES
+			 */
+		case T_Alias:
+			retval = _equalAlias(a, b);
+			break;
+		case T_RangeVar:
+			retval = _equalRangeVar(a, b);
+			break;
+		case T_IntoClause:
+			retval = _equalIntoClause(a, b);
+			break;
+		case T_Var:
+			retval = _equalVar(a, b);
+			break;
+		case T_Const:
+			retval = _equalConst(a, b);
+			break;
+		case T_Param:
+			retval = _equalParam(a, b);
+			break;
+		case T_Aggref:
+			retval = _equalAggref(a, b);
+			break;
+		case T_GroupingFunc:
+			retval = _equalGroupingFunc(a, b);
+			break;
+		case T_WindowFunc:
+			retval = _equalWindowFunc(a, b);
+			break;
+		case T_ArrayRef:
+			retval = _equalArrayRef(a, b);
+			break;
+		case T_FuncExpr:
+			retval = _equalFuncExpr(a, b);
+			break;
+		case T_NamedArgExpr:
+			retval = _equalNamedArgExpr(a, b);
+			break;
+		case T_OpExpr:
+			retval = _equalOpExpr(a, b);
+			break;
+		case T_DistinctExpr:
+			retval = _equalDistinctExpr(a, b);
+			break;
+		case T_NullIfExpr:
+			retval = _equalNullIfExpr(a, b);
+			break;
+		case T_ScalarArrayOpExpr:
+			retval = _equalScalarArrayOpExpr(a, b);
+			break;
+		case T_BoolExpr:
+			retval = _equalBoolExpr(a, b);
+			break;
+		case T_SubLink:
+			retval = _equalSubLink(a, b);
+			break;
+		case T_SubPlan:
+			retval = _equalSubPlan(a, b);
+			break;
+		case T_AlternativeSubPlan:
+			retval = _equalAlternativeSubPlan(a, b);
+			break;
+		case T_FieldSelect:
+			retval = _equalFieldSelect(a, b);
+			break;
+		case T_FieldStore:
+			retval = _equalFieldStore(a, b);
+			break;
+		case T_RelabelType:
+			retval = _equalRelabelType(a, b);
+			break;
+		case T_CoerceViaIO:
+			retval = _equalCoerceViaIO(a, b);
+			break;
+		case T_ArrayCoerceExpr:
+			retval = _equalArrayCoerceExpr(a, b);
+			break;
+		case T_ConvertRowtypeExpr:
+			retval = _equalConvertRowtypeExpr(a, b);
+			break;
+		case T_CollateExpr:
+			retval = _equalCollateExpr(a, b);
+			break;
+		case T_CaseExpr:
+			retval = _equalCaseExpr(a, b);
+			break;
+		case T_CaseWhen:
+			retval = _equalCaseWhen(a, b);
+			break;
+		case T_CaseTestExpr:
+			retval = _equalCaseTestExpr(a, b);
+			break;
+		case T_ArrayExpr:
+			retval = _equalArrayExpr(a, b);
+			break;
+		case T_RowExpr:
+			retval = _equalRowExpr(a, b);
+			break;
+		case T_RowCompareExpr:
+			retval = _equalRowCompareExpr(a, b);
+			break;
+		case T_CoalesceExpr:
+			retval = _equalCoalesceExpr(a, b);
+			break;
+		case T_MinMaxExpr:
+			retval = _equalMinMaxExpr(a, b);
+			break;
+		case T_XmlExpr:
+			retval = _equalXmlExpr(a, b);
+			break;
+		case T_NullTest:
+			retval = _equalNullTest(a, b);
+			break;
+		case T_BooleanTest:
+			retval = _equalBooleanTest(a, b);
+			break;
+		case T_CoerceToDomain:
+			retval = _equalCoerceToDomain(a, b);
+			break;
+		case T_CoerceToDomainValue:
+			retval = _equalCoerceToDomainValue(a, b);
+			break;
+		case T_SetToDefault:
+			retval = _equalSetToDefault(a, b);
+			break;
+		case T_CurrentOfExpr:
+			retval = _equalCurrentOfExpr(a, b);
+			break;
+		case T_InferenceElem:
+			retval = _equalInferenceElem(a, b);
+			break;
+		case T_TargetEntry:
+			retval = _equalTargetEntry(a, b);
+			break;
+		case T_RangeTblRef:
+			retval = _equalRangeTblRef(a, b);
+			break;
+		case T_FromExpr:
+			retval = _equalFromExpr(a, b);
+			break;
+		case T_OnConflictExpr:
+			retval = _equalOnConflictExpr(a, b);
+			break;
+		case T_JoinExpr:
+			retval = _equalJoinExpr(a, b);
+			break;
+
+			/*
+			 * RELATION NODES
+			 */
+		case T_PathKey:
+			retval = _equalPathKey(a, b);
+			break;
+		case T_RestrictInfo:
+			retval = _equalRestrictInfo(a, b);
+			break;
+		case T_PlaceHolderVar:
+			retval = _equalPlaceHolderVar(a, b);
+			break;
+		case T_SpecialJoinInfo:
+			retval = _equalSpecialJoinInfo(a, b);
+			break;
+		case T_AppendRelInfo:
+			retval = _equalAppendRelInfo(a, b);
+			break;
+		case T_PlaceHolderInfo:
+			retval = _equalPlaceHolderInfo(a, b);
+			break;
+
+		case T_List:
+		case T_IntList:
+		case T_OidList:
+			retval = _equalList(a, b);
+			break;
+
+		case T_Integer:
+		case T_Float:
+		case T_String:
+		case T_BitString:
+		case T_Null:
+			retval = _equalValue(a, b);
+			break;
+
+			/*
+			 * PARSE NODES
+			 */
+		case T_Query:
+			retval = _equalQuery(a, b);
+			break;
+		case T_InsertStmt:
+			retval = _equalInsertStmt(a, b);
+			break;
+		case T_DeleteStmt:
+			retval = _equalDeleteStmt(a, b);
+			break;
+		case T_UpdateStmt:
+			retval = _equalUpdateStmt(a, b);
+			break;
+		case T_SelectStmt:
+			retval = _equalSelectStmt(a, b);
+			break;
+		case T_SetOperationStmt:
+			retval = _equalSetOperationStmt(a, b);
+			break;
+		case T_AlterTableStmt:
+			retval = _equalAlterTableStmt(a, b);
+			break;
+		case T_AlterTableCmd:
+			retval = _equalAlterTableCmd(a, b);
+			break;
+		case T_AlterDomainStmt:
+			retval = _equalAlterDomainStmt(a, b);
+			break;
+		case T_GrantStmt:
+			retval = _equalGrantStmt(a, b);
+			break;
+		case T_GrantRoleStmt:
+			retval = _equalGrantRoleStmt(a, b);
+			break;
+		case T_AlterDefaultPrivilegesStmt:
+			retval = _equalAlterDefaultPrivilegesStmt(a, b);
+			break;
+		case T_DeclareCursorStmt:
+			retval = _equalDeclareCursorStmt(a, b);
+			break;
+		case T_ClosePortalStmt:
+			retval = _equalClosePortalStmt(a, b);
+			break;
+		case T_ClusterStmt:
+			retval = _equalClusterStmt(a, b);
+			break;
+		case T_CopyStmt:
+			retval = _equalCopyStmt(a, b);
+			break;
+		case T_CreateStmt:
+			retval = _equalCreateStmt(a, b);
+			break;
+		case T_TableLikeClause:
+			retval = _equalTableLikeClause(a, b);
+			break;
+		case T_DefineStmt:
+			retval = _equalDefineStmt(a, b);
+			break;
+		case T_DropStmt:
+			retval = _equalDropStmt(a, b);
+			break;
+		case T_TruncateStmt:
+			retval = _equalTruncateStmt(a, b);
+			break;
+		case T_CommentStmt:
+			retval = _equalCommentStmt(a, b);
+			break;
+		case T_SecLabelStmt:
+			retval = _equalSecLabelStmt(a, b);
+			break;
+		case T_FetchStmt:
+			retval = _equalFetchStmt(a, b);
+			break;
+		case T_IndexStmt:
+			retval = _equalIndexStmt(a, b);
+			break;
+		case T_CreateFunctionStmt:
+			retval = _equalCreateFunctionStmt(a, b);
+			break;
+		case T_FunctionParameter:
+			retval = _equalFunctionParameter(a, b);
+			break;
+		case T_AlterFunctionStmt:
+			retval = _equalAlterFunctionStmt(a, b);
+			break;
+		case T_DoStmt:
+			retval = _equalDoStmt(a, b);
+			break;
+		case T_RenameStmt:
+			retval = _equalRenameStmt(a, b);
+			break;
+		case T_AlterObjectSchemaStmt:
+			retval = _equalAlterObjectSchemaStmt(a, b);
+			break;
+		case T_AlterOwnerStmt:
+			retval = _equalAlterOwnerStmt(a, b);
+			break;
+		case T_RuleStmt:
+			retval = _equalRuleStmt(a, b);
+			break;
+		case T_NotifyStmt:
+			retval = _equalNotifyStmt(a, b);
+			break;
+		case T_ListenStmt:
+			retval = _equalListenStmt(a, b);
+			break;
+		case T_UnlistenStmt:
+			retval = _equalUnlistenStmt(a, b);
+			break;
+		case T_TransactionStmt:
+			retval = _equalTransactionStmt(a, b);
+			break;
+		case T_CompositeTypeStmt:
+			retval = _equalCompositeTypeStmt(a, b);
+			break;
+		case T_CreateEnumStmt:
+			retval = _equalCreateEnumStmt(a, b);
+			break;
+		case T_CreateRangeStmt:
+			retval = _equalCreateRangeStmt(a, b);
+			break;
+		case T_AlterEnumStmt:
+			retval = _equalAlterEnumStmt(a, b);
+			break;
+		case T_ViewStmt:
+			retval = _equalViewStmt(a, b);
+			break;
+		case T_LoadStmt:
+			retval = _equalLoadStmt(a, b);
+			break;
+		case T_CreateDomainStmt:
+			retval = _equalCreateDomainStmt(a, b);
+			break;
+		case T_CreateOpClassStmt:
+			retval = _equalCreateOpClassStmt(a, b);
+			break;
+		case T_CreateOpClassItem:
+			retval = _equalCreateOpClassItem(a, b);
+			break;
+		case T_CreateOpFamilyStmt:
+			retval = _equalCreateOpFamilyStmt(a, b);
+			break;
+		case T_AlterOpFamilyStmt:
+			retval = _equalAlterOpFamilyStmt(a, b);
+			break;
+		case T_CreatedbStmt:
+			retval = _equalCreatedbStmt(a, b);
+			break;
+		case T_AlterDatabaseStmt:
+			retval = _equalAlterDatabaseStmt(a, b);
+			break;
+		case T_AlterDatabaseSetStmt:
+			retval = _equalAlterDatabaseSetStmt(a, b);
+			break;
+		case T_DropdbStmt:
+			retval = _equalDropdbStmt(a, b);
+			break;
+		case T_VacuumStmt:
+			retval = _equalVacuumStmt(a, b);
+			break;
+		case T_ExplainStmt:
+			retval = _equalExplainStmt(a, b);
+			break;
+		case T_CreateTableAsStmt:
+			retval = _equalCreateTableAsStmt(a, b);
+			break;
+		case T_RefreshMatViewStmt:
+			retval = _equalRefreshMatViewStmt(a, b);
+			break;
+		case T_ReplicaIdentityStmt:
+			retval = _equalReplicaIdentityStmt(a, b);
+			break;
+		case T_AlterSystemStmt:
+			retval = _equalAlterSystemStmt(a, b);
+			break;
+		case T_CreateSeqStmt:
+			retval = _equalCreateSeqStmt(a, b);
+			break;
+		case T_AlterSeqStmt:
+			retval = _equalAlterSeqStmt(a, b);
+			break;
+		case T_VariableSetStmt:
+			retval = _equalVariableSetStmt(a, b);
+			break;
+		case T_VariableShowStmt:
+			retval = _equalVariableShowStmt(a, b);
+			break;
+		case T_DiscardStmt:
+			retval = _equalDiscardStmt(a, b);
+			break;
+		case T_CreateTableSpaceStmt:
+			retval = _equalCreateTableSpaceStmt(a, b);
+			break;
+		case T_DropTableSpaceStmt:
+			retval = _equalDropTableSpaceStmt(a, b);
+			break;
+		case T_AlterTableSpaceOptionsStmt:
+			retval = _equalAlterTableSpaceOptionsStmt(a, b);
+			break;
+		case T_AlterTableMoveAllStmt:
+			retval = _equalAlterTableMoveAllStmt(a, b);
+			break;
+		case T_CreateExtensionStmt:
+			retval = _equalCreateExtensionStmt(a, b);
+			break;
+		case T_AlterExtensionStmt:
+			retval = _equalAlterExtensionStmt(a, b);
+			break;
+		case T_AlterExtensionContentsStmt:
+			retval = _equalAlterExtensionContentsStmt(a, b);
+			break;
+		case T_CreateFdwStmt:
+			retval = _equalCreateFdwStmt(a, b);
+			break;
+		case T_AlterFdwStmt:
+			retval = _equalAlterFdwStmt(a, b);
+			break;
+		case T_CreateForeignServerStmt:
+			retval = _equalCreateForeignServerStmt(a, b);
+			break;
+		case T_AlterForeignServerStmt:
+			retval = _equalAlterForeignServerStmt(a, b);
+			break;
+		case T_CreateUserMappingStmt:
+			retval = _equalCreateUserMappingStmt(a, b);
+			break;
+		case T_AlterUserMappingStmt:
+			retval = _equalAlterUserMappingStmt(a, b);
+			break;
+		case T_DropUserMappingStmt:
+			retval = _equalDropUserMappingStmt(a, b);
+			break;
+		case T_CreateForeignTableStmt:
+			retval = _equalCreateForeignTableStmt(a, b);
+			break;
+		case T_ImportForeignSchemaStmt:
+			retval = _equalImportForeignSchemaStmt(a, b);
+			break;
+		case T_CreateTransformStmt:
+			retval = _equalCreateTransformStmt(a, b);
+			break;
+		case T_CreateTrigStmt:
+			retval = _equalCreateTrigStmt(a, b);
+			break;
+		case T_CreateEventTrigStmt:
+			retval = _equalCreateEventTrigStmt(a, b);
+			break;
+		case T_AlterEventTrigStmt:
+			retval = _equalAlterEventTrigStmt(a, b);
+			break;
+		case T_CreatePLangStmt:
+			retval = _equalCreatePLangStmt(a, b);
+			break;
+		case T_CreateRoleStmt:
+			retval = _equalCreateRoleStmt(a, b);
+			break;
+		case T_AlterRoleStmt:
+			retval = _equalAlterRoleStmt(a, b);
+			break;
+		case T_AlterRoleSetStmt:
+			retval = _equalAlterRoleSetStmt(a, b);
+			break;
+		case T_DropRoleStmt:
+			retval = _equalDropRoleStmt(a, b);
+			break;
+		case T_LockStmt:
+			retval = _equalLockStmt(a, b);
+			break;
+		case T_ConstraintsSetStmt:
+			retval = _equalConstraintsSetStmt(a, b);
+			break;
+		case T_ReindexStmt:
+			retval = _equalReindexStmt(a, b);
+			break;
+		case T_CheckPointStmt:
+			retval = true;
+			break;
+		case T_CreateSchemaStmt:
+			retval = _equalCreateSchemaStmt(a, b);
+			break;
+		case T_CreateConversionStmt:
+			retval = _equalCreateConversionStmt(a, b);
+			break;
+		case T_CreateCastStmt:
+			retval = _equalCreateCastStmt(a, b);
+			break;
+		case T_PrepareStmt:
+			retval = _equalPrepareStmt(a, b);
+			break;
+		case T_ExecuteStmt:
+			retval = _equalExecuteStmt(a, b);
+			break;
+		case T_DeallocateStmt:
+			retval = _equalDeallocateStmt(a, b);
+			break;
+		case T_DropOwnedStmt:
+			retval = _equalDropOwnedStmt(a, b);
+			break;
+		case T_ReassignOwnedStmt:
+			retval = _equalReassignOwnedStmt(a, b);
+			break;
+		case T_AlterTSDictionaryStmt:
+			retval = _equalAlterTSDictionaryStmt(a, b);
+			break;
+		case T_AlterTSConfigurationStmt:
+			retval = _equalAlterTSConfigurationStmt(a, b);
+			break;
+		case T_CreatePolicyStmt:
+			retval = _equalCreatePolicyStmt(a, b);
+			break;
+		case T_AlterPolicyStmt:
+			retval = _equalAlterPolicyStmt(a, b);
+			break;
+		case T_A_Expr:
+			retval = _equalAExpr(a, b);
+			break;
+		case T_ColumnRef:
+			retval = _equalColumnRef(a, b);
+			break;
+		case T_ParamRef:
+			retval = _equalParamRef(a, b);
+			break;
+		case T_A_Const:
+			retval = _equalAConst(a, b);
+			break;
+		case T_FuncCall:
+			retval = _equalFuncCall(a, b);
+			break;
+		case T_A_Star:
+			retval = _equalAStar(a, b);
+			break;
+		case T_A_Indices:
+			retval = _equalAIndices(a, b);
+			break;
+		case T_A_Indirection:
+			retval = _equalA_Indirection(a, b);
+			break;
+		case T_A_ArrayExpr:
+			retval = _equalA_ArrayExpr(a, b);
+			break;
+		case T_ResTarget:
+			retval = _equalResTarget(a, b);
+			break;
+		case T_MultiAssignRef:
+			retval = _equalMultiAssignRef(a, b);
+			break;
+		case T_TypeCast:
+			retval = _equalTypeCast(a, b);
+			break;
+		case T_CollateClause:
+			retval = _equalCollateClause(a, b);
+			break;
+		case T_SortBy:
+			retval = _equalSortBy(a, b);
+			break;
+		case T_WindowDef:
+			retval = _equalWindowDef(a, b);
+			break;
+		case T_RangeSubselect:
+			retval = _equalRangeSubselect(a, b);
+			break;
+		case T_RangeFunction:
+			retval = _equalRangeFunction(a, b);
+			break;
+		case T_RangeTableSample:
+			retval = _equalRangeTableSample(a, b);
+			break;
+		case T_TypeName:
+			retval = _equalTypeName(a, b);
+			break;
+		case T_IndexElem:
+			retval = _equalIndexElem(a, b);
+			break;
+		case T_ColumnDef:
+			retval = _equalColumnDef(a, b);
+			break;
+		case T_Constraint:
+			retval = _equalConstraint(a, b);
+			break;
+		case T_DefElem:
+			retval = _equalDefElem(a, b);
+			break;
+		case T_LockingClause:
+			retval = _equalLockingClause(a, b);
+			break;
+		case T_RangeTblEntry:
+			retval = _equalRangeTblEntry(a, b);
+			break;
+		case T_RangeTblFunction:
+			retval = _equalRangeTblFunction(a, b);
+			break;
+		case T_TableSampleClause:
+			retval = _equalTableSampleClause(a, b);
+			break;
+		case T_WithCheckOption:
+			retval = _equalWithCheckOption(a, b);
+			break;
+		case T_SortGroupClause:
+			retval = _equalSortGroupClause(a, b);
+			break;
+		case T_GroupingSet:
+			retval = _equalGroupingSet(a, b);
+			break;
+		case T_WindowClause:
+			retval = _equalWindowClause(a, b);
+			break;
+		case T_RowMarkClause:
+			retval = _equalRowMarkClause(a, b);
+			break;
+		case T_WithClause:
+			retval = _equalWithClause(a, b);
+			break;
+		case T_InferClause:
+			retval = _equalInferClause(a, b);
+			break;
+		case T_OnConflictClause:
+			retval = _equalOnConflictClause(a, b);
+			break;
+		case T_CommonTableExpr:
+			retval = _equalCommonTableExpr(a, b);
+			break;
+		case T_FuncWithArgs:
+			retval = _equalFuncWithArgs(a, b);
+			break;
+		case T_AccessPriv:
+			retval = _equalAccessPriv(a, b);
+			break;
+		case T_XmlSerialize:
+			retval = _equalXmlSerialize(a, b);
+			break;
+		case T_RoleSpec:
+			retval = _equalRoleSpec(a, b);
+			break;
+
+		default:
+			elog(ERROR, "unrecognized node type: %d",
+				 (int) nodeTag(a));
+			retval = false;		/* keep compiler quiet */
+			break;
+	}
+
+	return retval;
+}
diff --git a/foreign/libpg_query/src/postgres/src_backend_nodes_list.c b/foreign/libpg_query/src/postgres/src_backend_nodes_list.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_nodes_list.c
@@ -0,0 +1,738 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - lappend
+ * - new_list
+ * - new_tail_cell
+ * - lcons
+ * - new_head_cell
+ * - list_concat
+ * - list_nth
+ * - list_nth_cell
+ * - list_delete_cell
+ * - list_free
+ * - list_free_private
+ * - list_copy
+ * - list_copy_tail
+ * - list_truncate
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * list.c
+ *	  implementation for PostgreSQL generic linked list package
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/nodes/list.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+/* see pg_list.h */
+#define PG_LIST_INCLUDE_DEFINITIONS
+
+#include "nodes/pg_list.h"
+
+
+/*
+ * Routines to simplify writing assertions about the type of a list; a
+ * NIL list is considered to be an empty list of any type.
+ */
+#define IsPointerList(l)		((l) == NIL || IsA((l), List))
+#define IsIntegerList(l)		((l) == NIL || IsA((l), IntList))
+#define IsOidList(l)			((l) == NIL || IsA((l), OidList))
+
+#ifdef USE_ASSERT_CHECKING
+/*
+ * Check that the specified List is valid (so far as we can tell).
+ */
+static void
+check_list_invariants(const List *list)
+{
+	if (list == NIL)
+		return;
+
+	Assert(list->length > 0);
+	Assert(list->head != NULL);
+	Assert(list->tail != NULL);
+
+	Assert(list->type == T_List ||
+		   list->type == T_IntList ||
+		   list->type == T_OidList);
+
+	if (list->length == 1)
+		Assert(list->head == list->tail);
+	if (list->length == 2)
+		Assert(list->head->next == list->tail);
+	Assert(list->tail->next == NULL);
+}
+#else
+#define check_list_invariants(l)
+#endif   /* USE_ASSERT_CHECKING */
+
+/*
+ * Return a freshly allocated List. Since empty non-NIL lists are
+ * invalid, new_list() also allocates the head cell of the new list:
+ * the caller should be sure to fill in that cell's data.
+ */
+static List *
+new_list(NodeTag type)
+{
+	List	   *new_list;
+	ListCell   *new_head;
+
+	new_head = (ListCell *) palloc(sizeof(*new_head));
+	new_head->next = NULL;
+	/* new_head->data is left undefined! */
+
+	new_list = (List *) palloc(sizeof(*new_list));
+	new_list->type = type;
+	new_list->length = 1;
+	new_list->head = new_head;
+	new_list->tail = new_head;
+
+	return new_list;
+}
+
+/*
+ * Allocate a new cell and make it the head of the specified
+ * list. Assumes the list it is passed is non-NIL.
+ *
+ * The data in the new head cell is undefined; the caller should be
+ * sure to fill it in
+ */
+static void
+new_head_cell(List *list)
+{
+	ListCell   *new_head;
+
+	new_head = (ListCell *) palloc(sizeof(*new_head));
+	new_head->next = list->head;
+
+	list->head = new_head;
+	list->length++;
+}
+
+/*
+ * Allocate a new cell and make it the tail of the specified
+ * list. Assumes the list it is passed is non-NIL.
+ *
+ * The data in the new tail cell is undefined; the caller should be
+ * sure to fill it in
+ */
+static void
+new_tail_cell(List *list)
+{
+	ListCell   *new_tail;
+
+	new_tail = (ListCell *) palloc(sizeof(*new_tail));
+	new_tail->next = NULL;
+
+	list->tail->next = new_tail;
+	list->tail = new_tail;
+	list->length++;
+}
+
+/*
+ * Append a pointer to the list. A pointer to the modified list is
+ * returned. Note that this function may or may not destructively
+ * modify the list; callers should always use this function's return
+ * value, rather than continuing to use the pointer passed as the
+ * first argument.
+ */
+List *
+lappend(List *list, void *datum)
+{
+	Assert(IsPointerList(list));
+
+	if (list == NIL)
+		list = new_list(T_List);
+	else
+		new_tail_cell(list);
+
+	lfirst(list->tail) = datum;
+	check_list_invariants(list);
+	return list;
+}
+
+/*
+ * Append an integer to the specified list. See lappend()
+ */
+
+
+/*
+ * Append an OID to the specified list. See lappend()
+ */
+
+
+/*
+ * Add a new cell to the list, in the position after 'prev_cell'. The
+ * data in the cell is left undefined, and must be filled in by the
+ * caller. 'list' is assumed to be non-NIL, and 'prev_cell' is assumed
+ * to be non-NULL and a member of 'list'.
+ */
+
+
+/*
+ * Add a new cell to the specified list (which must be non-NIL);
+ * it will be placed after the list cell 'prev' (which must be
+ * non-NULL and a member of 'list'). The data placed in the new cell
+ * is 'datum'. The newly-constructed cell is returned.
+ */
+
+
+
+
+
+
+/*
+ * Prepend a new element to the list. A pointer to the modified list
+ * is returned. Note that this function may or may not destructively
+ * modify the list; callers should always use this function's return
+ * value, rather than continuing to use the pointer passed as the
+ * second argument.
+ *
+ * Caution: before Postgres 8.0, the original List was unmodified and
+ * could be considered to retain its separate identity.  This is no longer
+ * the case.
+ */
+List *
+lcons(void *datum, List *list)
+{
+	Assert(IsPointerList(list));
+
+	if (list == NIL)
+		list = new_list(T_List);
+	else
+		new_head_cell(list);
+
+	lfirst(list->head) = datum;
+	check_list_invariants(list);
+	return list;
+}
+
+/*
+ * Prepend an integer to the list. See lcons()
+ */
+
+
+/*
+ * Prepend an OID to the list. See lcons()
+ */
+
+
+/*
+ * Concatenate list2 to the end of list1, and return list1. list1 is
+ * destructively changed. Callers should be sure to use the return
+ * value as the new pointer to the concatenated list: the 'list1'
+ * input pointer may or may not be the same as the returned pointer.
+ *
+ * The nodes in list2 are merely appended to the end of list1 in-place
+ * (i.e. they aren't copied; the two lists will share some of the same
+ * storage). Therefore, invoking list_free() on list2 will also
+ * invalidate a portion of list1.
+ */
+List *
+list_concat(List *list1, List *list2)
+{
+	if (list1 == NIL)
+		return list2;
+	if (list2 == NIL)
+		return list1;
+	if (list1 == list2)
+		elog(ERROR, "cannot list_concat() a list to itself");
+
+	Assert(list1->type == list2->type);
+
+	list1->length += list2->length;
+	list1->tail->next = list2->head;
+	list1->tail = list2->tail;
+
+	check_list_invariants(list1);
+	return list1;
+}
+
+/*
+ * Truncate 'list' to contain no more than 'new_size' elements. This
+ * modifies the list in-place! Despite this, callers should use the
+ * pointer returned by this function to refer to the newly truncated
+ * list -- it may or may not be the same as the pointer that was
+ * passed.
+ *
+ * Note that any cells removed by list_truncate() are NOT pfree'd.
+ */
+List *
+list_truncate(List *list, int new_size)
+{
+	ListCell   *cell;
+	int			n;
+
+	if (new_size <= 0)
+		return NIL;				/* truncate to zero length */
+
+	/* If asked to effectively extend the list, do nothing */
+	if (new_size >= list_length(list))
+		return list;
+
+	n = 1;
+	foreach(cell, list)
+	{
+		if (n == new_size)
+		{
+			cell->next = NULL;
+			list->tail = cell;
+			list->length = new_size;
+			check_list_invariants(list);
+			return list;
+		}
+		n++;
+	}
+
+	/* keep the compiler quiet; never reached */
+	Assert(false);
+	return list;
+}
+
+/*
+ * Locate the n'th cell (counting from 0) of the list.  It is an assertion
+ * failure if there is no such cell.
+ */
+ListCell *
+list_nth_cell(const List *list, int n)
+{
+	ListCell   *match;
+
+	Assert(list != NIL);
+	Assert(n >= 0);
+	Assert(n < list->length);
+	check_list_invariants(list);
+
+	/* Does the caller actually mean to fetch the tail? */
+	if (n == list->length - 1)
+		return list->tail;
+
+	for (match = list->head; n-- > 0; match = match->next)
+		;
+
+	return match;
+}
+
+/*
+ * Return the data value contained in the n'th element of the
+ * specified list. (List elements begin at 0.)
+ */
+void *
+list_nth(const List *list, int n)
+{
+	Assert(IsPointerList(list));
+	return lfirst(list_nth_cell(list, n));
+}
+
+/*
+ * Return the integer value contained in the n'th element of the
+ * specified list.
+ */
+
+
+/*
+ * Return the OID value contained in the n'th element of the specified
+ * list.
+ */
+
+
+/*
+ * Return true iff 'datum' is a member of the list. Equality is
+ * determined via equal(), so callers should ensure that they pass a
+ * Node as 'datum'.
+ */
+
+
+/*
+ * Return true iff 'datum' is a member of the list. Equality is
+ * determined by using simple pointer comparison.
+ */
+
+
+/*
+ * Return true iff the integer 'datum' is a member of the list.
+ */
+
+
+/*
+ * Return true iff the OID 'datum' is a member of the list.
+ */
+
+
+/*
+ * Delete 'cell' from 'list'; 'prev' is the previous element to 'cell'
+ * in 'list', if any (i.e. prev == NULL iff list->head == cell)
+ *
+ * The cell is pfree'd, as is the List header if this was the last member.
+ */
+List *
+list_delete_cell(List *list, ListCell *cell, ListCell *prev)
+{
+	check_list_invariants(list);
+	Assert(prev != NULL ? lnext(prev) == cell : list_head(list) == cell);
+
+	/*
+	 * If we're about to delete the last node from the list, free the whole
+	 * list instead and return NIL, which is the only valid representation of
+	 * a zero-length list.
+	 */
+	if (list->length == 1)
+	{
+		list_free(list);
+		return NIL;
+	}
+
+	/*
+	 * Otherwise, adjust the necessary list links, deallocate the particular
+	 * node we have just removed, and return the list we were given.
+	 */
+	list->length--;
+
+	if (prev)
+		prev->next = cell->next;
+	else
+		list->head = cell->next;
+
+	if (list->tail == cell)
+		list->tail = prev;
+
+	pfree(cell);
+	return list;
+}
+
+/*
+ * Delete the first cell in list that matches datum, if any.
+ * Equality is determined via equal().
+ */
+
+
+/* As above, but use simple pointer equality */
+
+
+/* As above, but for integers */
+
+
+/* As above, but for OIDs */
+
+
+/*
+ * Delete the first element of the list.
+ *
+ * This is useful to replace the Lisp-y code "list = lnext(list);" in cases
+ * where the intent is to alter the list rather than just traverse it.
+ * Beware that the removed cell is freed, whereas the lnext() coding leaves
+ * the original list head intact if there's another pointer to it.
+ */
+
+
+/*
+ * Generate the union of two lists. This is calculated by copying
+ * list1 via list_copy(), then adding to it all the members of list2
+ * that aren't already in list1.
+ *
+ * Whether an element is already a member of the list is determined
+ * via equal().
+ *
+ * The returned list is newly-allocated, although the content of the
+ * cells is the same (i.e. any pointed-to objects are not copied).
+ *
+ * NB: this function will NOT remove any duplicates that are present
+ * in list1 (so it only performs a "union" if list1 is known unique to
+ * start with).  Also, if you are about to write "x = list_union(x, y)"
+ * you probably want to use list_concat_unique() instead to avoid wasting
+ * the list cells of the old x list.
+ *
+ * This function could probably be implemented a lot faster if it is a
+ * performance bottleneck.
+ */
+
+
+/*
+ * This variant of list_union() determines duplicates via simple
+ * pointer comparison.
+ */
+
+
+/*
+ * This variant of list_union() operates upon lists of integers.
+ */
+
+
+/*
+ * This variant of list_union() operates upon lists of OIDs.
+ */
+
+
+/*
+ * Return a list that contains all the cells that are in both list1 and
+ * list2.  The returned list is freshly allocated via palloc(), but the
+ * cells themselves point to the same objects as the cells of the
+ * input lists.
+ *
+ * Duplicate entries in list1 will not be suppressed, so it's only a true
+ * "intersection" if list1 is known unique beforehand.
+ *
+ * This variant works on lists of pointers, and determines list
+ * membership via equal().  Note that the list1 member will be pointed
+ * to in the result.
+ */
+
+
+/*
+ * As list_intersection but operates on lists of integers.
+ */
+
+
+/*
+ * Return a list that contains all the cells in list1 that are not in
+ * list2. The returned list is freshly allocated via palloc(), but the
+ * cells themselves point to the same objects as the cells of the
+ * input lists.
+ *
+ * This variant works on lists of pointers, and determines list
+ * membership via equal()
+ */
+
+
+/*
+ * This variant of list_difference() determines list membership via
+ * simple pointer equality.
+ */
+
+
+/*
+ * This variant of list_difference() operates upon lists of integers.
+ */
+
+
+/*
+ * This variant of list_difference() operates upon lists of OIDs.
+ */
+
+
+/*
+ * Append datum to list, but only if it isn't already in the list.
+ *
+ * Whether an element is already a member of the list is determined
+ * via equal().
+ */
+
+
+/*
+ * This variant of list_append_unique() determines list membership via
+ * simple pointer equality.
+ */
+
+
+/*
+ * This variant of list_append_unique() operates upon lists of integers.
+ */
+
+
+/*
+ * This variant of list_append_unique() operates upon lists of OIDs.
+ */
+
+
+/*
+ * Append to list1 each member of list2 that isn't already in list1.
+ *
+ * Whether an element is already a member of the list is determined
+ * via equal().
+ *
+ * This is almost the same functionality as list_union(), but list1 is
+ * modified in-place rather than being copied.  Note also that list2's cells
+ * are not inserted in list1, so the analogy to list_concat() isn't perfect.
+ */
+
+
+/*
+ * This variant of list_concat_unique() determines list membership via
+ * simple pointer equality.
+ */
+
+
+/*
+ * This variant of list_concat_unique() operates upon lists of integers.
+ */
+
+
+/*
+ * This variant of list_concat_unique() operates upon lists of OIDs.
+ */
+
+
+/*
+ * Free all storage in a list, and optionally the pointed-to elements
+ */
+static void
+list_free_private(List *list, bool deep)
+{
+	ListCell   *cell;
+
+	check_list_invariants(list);
+
+	cell = list_head(list);
+	while (cell != NULL)
+	{
+		ListCell   *tmp = cell;
+
+		cell = lnext(cell);
+		if (deep)
+			pfree(lfirst(tmp));
+		pfree(tmp);
+	}
+
+	if (list)
+		pfree(list);
+}
+
+/*
+ * Free all the cells of the list, as well as the list itself. Any
+ * objects that are pointed-to by the cells of the list are NOT
+ * free'd.
+ *
+ * On return, the argument to this function has been freed, so the
+ * caller would be wise to set it to NIL for safety's sake.
+ */
+void
+list_free(List *list)
+{
+	list_free_private(list, false);
+}
+
+/*
+ * Free all the cells of the list, the list itself, and all the
+ * objects pointed-to by the cells of the list (each element in the
+ * list must contain a pointer to a palloc()'d region of memory!)
+ *
+ * On return, the argument to this function has been freed, so the
+ * caller would be wise to set it to NIL for safety's sake.
+ */
+
+
+/*
+ * Return a shallow copy of the specified list.
+ */
+List *
+list_copy(const List *oldlist)
+{
+	List	   *newlist;
+	ListCell   *newlist_prev;
+	ListCell   *oldlist_cur;
+
+	if (oldlist == NIL)
+		return NIL;
+
+	newlist = new_list(oldlist->type);
+	newlist->length = oldlist->length;
+
+	/*
+	 * Copy over the data in the first cell; new_list() has already allocated
+	 * the head cell itself
+	 */
+	newlist->head->data = oldlist->head->data;
+
+	newlist_prev = newlist->head;
+	oldlist_cur = oldlist->head->next;
+	while (oldlist_cur)
+	{
+		ListCell   *newlist_cur;
+
+		newlist_cur = (ListCell *) palloc(sizeof(*newlist_cur));
+		newlist_cur->data = oldlist_cur->data;
+		newlist_prev->next = newlist_cur;
+
+		newlist_prev = newlist_cur;
+		oldlist_cur = oldlist_cur->next;
+	}
+
+	newlist_prev->next = NULL;
+	newlist->tail = newlist_prev;
+
+	check_list_invariants(newlist);
+	return newlist;
+}
+
+/*
+ * Return a shallow copy of the specified list, without the first N elements.
+ */
+List *
+list_copy_tail(const List *oldlist, int nskip)
+{
+	List	   *newlist;
+	ListCell   *newlist_prev;
+	ListCell   *oldlist_cur;
+
+	if (nskip < 0)
+		nskip = 0;				/* would it be better to elog? */
+
+	if (oldlist == NIL || nskip >= oldlist->length)
+		return NIL;
+
+	newlist = new_list(oldlist->type);
+	newlist->length = oldlist->length - nskip;
+
+	/*
+	 * Skip over the unwanted elements.
+	 */
+	oldlist_cur = oldlist->head;
+	while (nskip-- > 0)
+		oldlist_cur = oldlist_cur->next;
+
+	/*
+	 * Copy over the data in the first remaining cell; new_list() has already
+	 * allocated the head cell itself
+	 */
+	newlist->head->data = oldlist_cur->data;
+
+	newlist_prev = newlist->head;
+	oldlist_cur = oldlist_cur->next;
+	while (oldlist_cur)
+	{
+		ListCell   *newlist_cur;
+
+		newlist_cur = (ListCell *) palloc(sizeof(*newlist_cur));
+		newlist_cur->data = oldlist_cur->data;
+		newlist_prev->next = newlist_cur;
+
+		newlist_prev = newlist_cur;
+		oldlist_cur = oldlist_cur->next;
+	}
+
+	newlist_prev->next = NULL;
+	newlist->tail = newlist_prev;
+
+	check_list_invariants(newlist);
+	return newlist;
+}
+
+/*
+ * Temporary compatibility functions
+ *
+ * In order to avoid warnings for these function definitions, we need
+ * to include a prototype here as well as in pg_list.h. That's because
+ * we don't enable list API compatibility in list.c, so we
+ * don't see the prototypes for these functions.
+ */
+
+/*
+ * Given a list, return its length. This is merely defined for the
+ * sake of backward compatibility: we can't afford to define a macro
+ * called "length", so it must be a function. New code should use the
+ * list_length() macro in order to avoid the overhead of a function
+ * call.
+ */
+int			length(const List *list);
+
+
diff --git a/foreign/libpg_query/src/postgres/src_backend_nodes_makefuncs.c b/foreign/libpg_query/src/postgres/src_backend_nodes_makefuncs.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_nodes_makefuncs.c
@@ -0,0 +1,331 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - makeDefElemExtended
+ * - makeDefElem
+ * - makeTypeNameFromNameList
+ * - makeAlias
+ * - makeGroupingSet
+ * - makeTypeName
+ * - makeFuncCall
+ * - makeSimpleA_Expr
+ * - makeA_Expr
+ * - makeRangeVar
+ * - makeBoolExpr
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * makefuncs.c
+ *	  creator functions for primitive nodes. The functions here are for
+ *	  the most frequently created nodes.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/nodes/makefuncs.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include "catalog/pg_class.h"
+#include "catalog/pg_type.h"
+#include "fmgr.h"
+#include "nodes/makefuncs.h"
+#include "nodes/nodeFuncs.h"
+#include "utils/lsyscache.h"
+
+
+/*
+ * makeA_Expr -
+ *		makes an A_Expr node
+ */
+A_Expr *
+makeA_Expr(A_Expr_Kind kind, List *name,
+		   Node *lexpr, Node *rexpr, int location)
+{
+	A_Expr	   *a = makeNode(A_Expr);
+
+	a->kind = kind;
+	a->name = name;
+	a->lexpr = lexpr;
+	a->rexpr = rexpr;
+	a->location = location;
+	return a;
+}
+
+/*
+ * makeSimpleA_Expr -
+ *		As above, given a simple (unqualified) operator name
+ */
+A_Expr *
+makeSimpleA_Expr(A_Expr_Kind kind, char *name,
+				 Node *lexpr, Node *rexpr, int location)
+{
+	A_Expr	   *a = makeNode(A_Expr);
+
+	a->kind = kind;
+	a->name = list_make1(makeString((char *) name));
+	a->lexpr = lexpr;
+	a->rexpr = rexpr;
+	a->location = location;
+	return a;
+}
+
+/*
+ * makeVar -
+ *	  creates a Var node
+ */
+
+
+/*
+ * makeVarFromTargetEntry -
+ *		convenience function to create a same-level Var node from a
+ *		TargetEntry
+ */
+
+
+/*
+ * makeWholeRowVar -
+ *	  creates a Var node representing a whole row of the specified RTE
+ *
+ * A whole-row reference is a Var with varno set to the correct range
+ * table entry, and varattno == 0 to signal that it references the whole
+ * tuple.  (Use of zero here is unclean, since it could easily be confused
+ * with error cases, but it's not worth changing now.)  The vartype indicates
+ * a rowtype; either a named composite type, or RECORD.  This function
+ * encapsulates the logic for determining the correct rowtype OID to use.
+ *
+ * If allowScalar is true, then for the case where the RTE is a single function
+ * returning a non-composite result type, we produce a normal Var referencing
+ * the function's result directly, instead of the single-column composite
+ * value that the whole-row notation might otherwise suggest.
+ */
+
+
+/*
+ * makeTargetEntry -
+ *	  creates a TargetEntry node
+ */
+
+
+/*
+ * flatCopyTargetEntry -
+ *	  duplicate a TargetEntry, but don't copy substructure
+ *
+ * This is commonly used when we just want to modify the resno or substitute
+ * a new expression.
+ */
+
+
+/*
+ * makeFromExpr -
+ *	  creates a FromExpr node
+ */
+
+
+/*
+ * makeConst -
+ *	  creates a Const node
+ */
+
+
+/*
+ * makeNullConst -
+ *	  creates a Const node representing a NULL of the specified type/typmod
+ *
+ * This is a convenience routine that just saves a lookup of the type's
+ * storage properties.
+ */
+
+
+/*
+ * makeBoolConst -
+ *	  creates a Const node representing a boolean value (can be NULL too)
+ */
+
+
+/*
+ * makeBoolExpr -
+ *	  creates a BoolExpr node
+ */
+Expr *
+makeBoolExpr(BoolExprType boolop, List *args, int location)
+{
+	BoolExpr   *b = makeNode(BoolExpr);
+
+	b->boolop = boolop;
+	b->args = args;
+	b->location = location;
+
+	return (Expr *) b;
+}
+
+/*
+ * makeAlias -
+ *	  creates an Alias node
+ *
+ * NOTE: the given name is copied, but the colnames list (if any) isn't.
+ */
+Alias *
+makeAlias(const char *aliasname, List *colnames)
+{
+	Alias	   *a = makeNode(Alias);
+
+	a->aliasname = pstrdup(aliasname);
+	a->colnames = colnames;
+
+	return a;
+}
+
+/*
+ * makeRelabelType -
+ *	  creates a RelabelType node
+ */
+
+
+/*
+ * makeRangeVar -
+ *	  creates a RangeVar node (rather oversimplified case)
+ */
+RangeVar *
+makeRangeVar(char *schemaname, char *relname, int location)
+{
+	RangeVar   *r = makeNode(RangeVar);
+
+	r->catalogname = NULL;
+	r->schemaname = schemaname;
+	r->relname = relname;
+	r->inhOpt = INH_DEFAULT;
+	r->relpersistence = RELPERSISTENCE_PERMANENT;
+	r->alias = NULL;
+	r->location = location;
+
+	return r;
+}
+
+/*
+ * makeTypeName -
+ *	build a TypeName node for an unqualified name.
+ *
+ * typmod is defaulted, but can be changed later by caller.
+ */
+TypeName *
+makeTypeName(char *typnam)
+{
+	return makeTypeNameFromNameList(list_make1(makeString(typnam)));
+}
+
+/*
+ * makeTypeNameFromNameList -
+ *	build a TypeName node for a String list representing a qualified name.
+ *
+ * typmod is defaulted, but can be changed later by caller.
+ */
+TypeName *
+makeTypeNameFromNameList(List *names)
+{
+	TypeName   *n = makeNode(TypeName);
+
+	n->names = names;
+	n->typmods = NIL;
+	n->typemod = -1;
+	n->location = -1;
+	return n;
+}
+
+/*
+ * makeTypeNameFromOid -
+ *	build a TypeName node to represent a type already known by OID/typmod.
+ */
+
+
+/*
+ * makeFuncExpr -
+ *	build an expression tree representing a function call.
+ *
+ * The argument expressions must have been transformed already.
+ */
+
+
+/*
+ * makeDefElem -
+ *	build a DefElem node
+ *
+ * This is sufficient for the "typical" case with an unqualified option name
+ * and no special action.
+ */
+DefElem *
+makeDefElem(char *name, Node *arg)
+{
+	DefElem    *res = makeNode(DefElem);
+
+	res->defnamespace = NULL;
+	res->defname = name;
+	res->arg = arg;
+	res->defaction = DEFELEM_UNSPEC;
+	res->location = -1;
+
+	return res;
+}
+
+/*
+ * makeDefElemExtended -
+ *	build a DefElem node with all fields available to be specified
+ */
+DefElem *
+makeDefElemExtended(char *nameSpace, char *name, Node *arg,
+					DefElemAction defaction, int location)
+{
+	DefElem    *res = makeNode(DefElem);
+
+	res->defnamespace = nameSpace;
+	res->defname = name;
+	res->arg = arg;
+	res->defaction = defaction;
+	res->location = location;
+
+	return res;
+}
+
+/*
+ * makeFuncCall -
+ *
+ * Initialize a FuncCall struct with the information every caller must
+ * supply.  Any non-default parameters have to be inserted by the caller.
+ */
+FuncCall *
+makeFuncCall(List *name, List *args, int location)
+{
+	FuncCall   *n = makeNode(FuncCall);
+
+	n->funcname = name;
+	n->args = args;
+	n->agg_order = NIL;
+	n->agg_filter = NULL;
+	n->agg_within_group = false;
+	n->agg_star = false;
+	n->agg_distinct = false;
+	n->func_variadic = false;
+	n->over = NULL;
+	n->location = location;
+	return n;
+}
+
+/*
+ * makeGroupingSet
+ *
+ */
+GroupingSet *
+makeGroupingSet(GroupingSetKind kind, List *content, int location)
+{
+	GroupingSet *n = makeNode(GroupingSet);
+
+	n->kind = kind;
+	n->content = content;
+	n->location = location;
+	return n;
+}
diff --git a/foreign/libpg_query/src/postgres/src_backend_nodes_nodeFuncs.c b/foreign/libpg_query/src/postgres/src_backend_nodes_nodeFuncs.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_nodes_nodeFuncs.c
@@ -0,0 +1,1214 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - exprLocation
+ * - leftmostLoc
+ * - raw_expression_tree_walker
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * nodeFuncs.c
+ *		Various general-purpose manipulations of Node trees
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/nodes/nodeFuncs.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include "catalog/pg_collation.h"
+#include "catalog/pg_type.h"
+#include "miscadmin.h"
+#include "nodes/makefuncs.h"
+#include "nodes/nodeFuncs.h"
+#include "nodes/relation.h"
+#include "utils/builtins.h"
+#include "utils/lsyscache.h"
+
+
+static bool expression_returns_set_walker(Node *node, void *context);
+static int	leftmostLoc(int loc1, int loc2);
+
+
+/*
+ *	exprType -
+ *	  returns the Oid of the type of the expression's result.
+ */
+
+
+/*
+ *	exprTypmod -
+ *	  returns the type-specific modifier of the expression's result type,
+ *	  if it can be determined.  In many cases, it can't and we return -1.
+ */
+
+
+/*
+ * exprIsLengthCoercion
+ *		Detect whether an expression tree is an application of a datatype's
+ *		typmod-coercion function.  Optionally extract the result's typmod.
+ *
+ * If coercedTypmod is not NULL, the typmod is stored there if the expression
+ * is a length-coercion function, else -1 is stored there.
+ *
+ * Note that a combined type-and-length coercion will be treated as a
+ * length coercion by this routine.
+ */
+
+
+/*
+ * relabel_to_typmod
+ *		Add a RelabelType node that changes just the typmod of the expression.
+ *
+ * This is primarily intended to be used during planning.  Therefore, it
+ * strips any existing RelabelType nodes to maintain the planner's invariant
+ * that there are not adjacent RelabelTypes.
+ */
+
+
+/*
+ * strip_implicit_coercions: remove implicit coercions at top level of tree
+ *
+ * This doesn't modify or copy the input expression tree, just return a
+ * pointer to a suitable place within it.
+ *
+ * Note: there isn't any useful thing we can do with a RowExpr here, so
+ * just return it unchanged, even if it's marked as an implicit coercion.
+ */
+
+
+/*
+ * expression_returns_set
+ *	  Test whether an expression returns a set result.
+ *
+ * Because we use expression_tree_walker(), this can also be applied to
+ * whole targetlists; it'll produce TRUE if any one of the tlist items
+ * returns a set.
+ */
+
+
+
+
+
+/*
+ *	exprCollation -
+ *	  returns the Oid of the collation of the expression's result.
+ *
+ * Note: expression nodes that can invoke functions generally have an
+ * "inputcollid" field, which is what the function should use as collation.
+ * That is the resolved common collation of the node's inputs.  It is often
+ * but not always the same as the result collation; in particular, if the
+ * function produces a non-collatable result type from collatable inputs
+ * or vice versa, the two are different.
+ */
+
+
+/*
+ *	exprInputCollation -
+ *	  returns the Oid of the collation a function should use, if available.
+ *
+ * Result is InvalidOid if the node type doesn't store this information.
+ */
+
+
+/*
+ *	exprSetCollation -
+ *	  Assign collation information to an expression tree node.
+ *
+ * Note: since this is only used during parse analysis, we don't need to
+ * worry about subplans or PlaceHolderVars.
+ */
+#ifdef USE_ASSERT_CHECKING
+#endif   /* USE_ASSERT_CHECKING */
+
+/*
+ *	exprSetInputCollation -
+ *	  Assign input-collation information to an expression tree node.
+ *
+ * This is a no-op for node types that don't store their input collation.
+ * Note we omit RowCompareExpr, which needs special treatment since it
+ * contains multiple input collation OIDs.
+ */
+
+
+
+/*
+ *	exprLocation -
+ *	  returns the parse location of an expression tree, for error reports
+ *
+ * -1 is returned if the location can't be determined.
+ *
+ * For expressions larger than a single token, the intent here is to
+ * return the location of the expression's leftmost token, not necessarily
+ * the topmost Node's location field.  For example, an OpExpr's location
+ * field will point at the operator name, but if it is not a prefix operator
+ * then we should return the location of the left-hand operand instead.
+ * The reason is that we want to reference the entire expression not just
+ * that operator, and pointing to its start seems to be the most natural way.
+ *
+ * The location is not perfect --- for example, since the grammar doesn't
+ * explicitly represent parentheses in the parsetree, given something that
+ * had been written "(a + b) * c" we are going to point at "a" not "(".
+ * But it should be plenty good enough for error reporting purposes.
+ *
+ * You might think that this code is overly general, for instance why check
+ * the operands of a FuncExpr node, when the function name can be expected
+ * to be to the left of them?  There are a couple of reasons.  The grammar
+ * sometimes builds expressions that aren't quite what the user wrote;
+ * for instance x IS NOT BETWEEN ... becomes a NOT-expression whose keyword
+ * pointer is to the right of its leftmost argument.  Also, nodes that were
+ * inserted implicitly by parse analysis (such as FuncExprs for implicit
+ * coercions) will have location -1, and so we can have odd combinations of
+ * known and unknown locations in a tree.
+ */
+int
+exprLocation(const Node *expr)
+{
+	int			loc;
+
+	if (expr == NULL)
+		return -1;
+	switch (nodeTag(expr))
+	{
+		case T_RangeVar:
+			loc = ((const RangeVar *) expr)->location;
+			break;
+		case T_Var:
+			loc = ((const Var *) expr)->location;
+			break;
+		case T_Const:
+			loc = ((const Const *) expr)->location;
+			break;
+		case T_Param:
+			loc = ((const Param *) expr)->location;
+			break;
+		case T_Aggref:
+			/* function name should always be the first thing */
+			loc = ((const Aggref *) expr)->location;
+			break;
+		case T_GroupingFunc:
+			loc = ((const GroupingFunc *) expr)->location;
+			break;
+		case T_WindowFunc:
+			/* function name should always be the first thing */
+			loc = ((const WindowFunc *) expr)->location;
+			break;
+		case T_ArrayRef:
+			/* just use array argument's location */
+			loc = exprLocation((Node *) ((const ArrayRef *) expr)->refexpr);
+			break;
+		case T_FuncExpr:
+			{
+				const FuncExpr *fexpr = (const FuncExpr *) expr;
+
+				/* consider both function name and leftmost arg */
+				loc = leftmostLoc(fexpr->location,
+								  exprLocation((Node *) fexpr->args));
+			}
+			break;
+		case T_NamedArgExpr:
+			{
+				const NamedArgExpr *na = (const NamedArgExpr *) expr;
+
+				/* consider both argument name and value */
+				loc = leftmostLoc(na->location,
+								  exprLocation((Node *) na->arg));
+			}
+			break;
+		case T_OpExpr:
+		case T_DistinctExpr:	/* struct-equivalent to OpExpr */
+		case T_NullIfExpr:		/* struct-equivalent to OpExpr */
+			{
+				const OpExpr *opexpr = (const OpExpr *) expr;
+
+				/* consider both operator name and leftmost arg */
+				loc = leftmostLoc(opexpr->location,
+								  exprLocation((Node *) opexpr->args));
+			}
+			break;
+		case T_ScalarArrayOpExpr:
+			{
+				const ScalarArrayOpExpr *saopexpr = (const ScalarArrayOpExpr *) expr;
+
+				/* consider both operator name and leftmost arg */
+				loc = leftmostLoc(saopexpr->location,
+								  exprLocation((Node *) saopexpr->args));
+			}
+			break;
+		case T_BoolExpr:
+			{
+				const BoolExpr *bexpr = (const BoolExpr *) expr;
+
+				/*
+				 * Same as above, to handle either NOT or AND/OR.  We can't
+				 * special-case NOT because of the way that it's used for
+				 * things like IS NOT BETWEEN.
+				 */
+				loc = leftmostLoc(bexpr->location,
+								  exprLocation((Node *) bexpr->args));
+			}
+			break;
+		case T_SubLink:
+			{
+				const SubLink *sublink = (const SubLink *) expr;
+
+				/* check the testexpr, if any, and the operator/keyword */
+				loc = leftmostLoc(exprLocation(sublink->testexpr),
+								  sublink->location);
+			}
+			break;
+		case T_FieldSelect:
+			/* just use argument's location */
+			loc = exprLocation((Node *) ((const FieldSelect *) expr)->arg);
+			break;
+		case T_FieldStore:
+			/* just use argument's location */
+			loc = exprLocation((Node *) ((const FieldStore *) expr)->arg);
+			break;
+		case T_RelabelType:
+			{
+				const RelabelType *rexpr = (const RelabelType *) expr;
+
+				/* Much as above */
+				loc = leftmostLoc(rexpr->location,
+								  exprLocation((Node *) rexpr->arg));
+			}
+			break;
+		case T_CoerceViaIO:
+			{
+				const CoerceViaIO *cexpr = (const CoerceViaIO *) expr;
+
+				/* Much as above */
+				loc = leftmostLoc(cexpr->location,
+								  exprLocation((Node *) cexpr->arg));
+			}
+			break;
+		case T_ArrayCoerceExpr:
+			{
+				const ArrayCoerceExpr *cexpr = (const ArrayCoerceExpr *) expr;
+
+				/* Much as above */
+				loc = leftmostLoc(cexpr->location,
+								  exprLocation((Node *) cexpr->arg));
+			}
+			break;
+		case T_ConvertRowtypeExpr:
+			{
+				const ConvertRowtypeExpr *cexpr = (const ConvertRowtypeExpr *) expr;
+
+				/* Much as above */
+				loc = leftmostLoc(cexpr->location,
+								  exprLocation((Node *) cexpr->arg));
+			}
+			break;
+		case T_CollateExpr:
+			/* just use argument's location */
+			loc = exprLocation((Node *) ((const CollateExpr *) expr)->arg);
+			break;
+		case T_CaseExpr:
+			/* CASE keyword should always be the first thing */
+			loc = ((const CaseExpr *) expr)->location;
+			break;
+		case T_CaseWhen:
+			/* WHEN keyword should always be the first thing */
+			loc = ((const CaseWhen *) expr)->location;
+			break;
+		case T_ArrayExpr:
+			/* the location points at ARRAY or [, which must be leftmost */
+			loc = ((const ArrayExpr *) expr)->location;
+			break;
+		case T_RowExpr:
+			/* the location points at ROW or (, which must be leftmost */
+			loc = ((const RowExpr *) expr)->location;
+			break;
+		case T_RowCompareExpr:
+			/* just use leftmost argument's location */
+			loc = exprLocation((Node *) ((const RowCompareExpr *) expr)->largs);
+			break;
+		case T_CoalesceExpr:
+			/* COALESCE keyword should always be the first thing */
+			loc = ((const CoalesceExpr *) expr)->location;
+			break;
+		case T_MinMaxExpr:
+			/* GREATEST/LEAST keyword should always be the first thing */
+			loc = ((const MinMaxExpr *) expr)->location;
+			break;
+		case T_XmlExpr:
+			{
+				const XmlExpr *xexpr = (const XmlExpr *) expr;
+
+				/* consider both function name and leftmost arg */
+				loc = leftmostLoc(xexpr->location,
+								  exprLocation((Node *) xexpr->args));
+			}
+			break;
+		case T_NullTest:
+			{
+				const NullTest *nexpr = (const NullTest *) expr;
+
+				/* Much as above */
+				loc = leftmostLoc(nexpr->location,
+								  exprLocation((Node *) nexpr->arg));
+			}
+			break;
+		case T_BooleanTest:
+			{
+				const BooleanTest *bexpr = (const BooleanTest *) expr;
+
+				/* Much as above */
+				loc = leftmostLoc(bexpr->location,
+								  exprLocation((Node *) bexpr->arg));
+			}
+			break;
+		case T_CoerceToDomain:
+			{
+				const CoerceToDomain *cexpr = (const CoerceToDomain *) expr;
+
+				/* Much as above */
+				loc = leftmostLoc(cexpr->location,
+								  exprLocation((Node *) cexpr->arg));
+			}
+			break;
+		case T_CoerceToDomainValue:
+			loc = ((const CoerceToDomainValue *) expr)->location;
+			break;
+		case T_SetToDefault:
+			loc = ((const SetToDefault *) expr)->location;
+			break;
+		case T_TargetEntry:
+			/* just use argument's location */
+			loc = exprLocation((Node *) ((const TargetEntry *) expr)->expr);
+			break;
+		case T_IntoClause:
+			/* use the contained RangeVar's location --- close enough */
+			loc = exprLocation((Node *) ((const IntoClause *) expr)->rel);
+			break;
+		case T_List:
+			{
+				/* report location of first list member that has a location */
+				ListCell   *lc;
+
+				loc = -1;		/* just to suppress compiler warning */
+				foreach(lc, (const List *) expr)
+				{
+					loc = exprLocation((Node *) lfirst(lc));
+					if (loc >= 0)
+						break;
+				}
+			}
+			break;
+		case T_A_Expr:
+			{
+				const A_Expr *aexpr = (const A_Expr *) expr;
+
+				/* use leftmost of operator or left operand (if any) */
+				/* we assume right operand can't be to left of operator */
+				loc = leftmostLoc(aexpr->location,
+								  exprLocation(aexpr->lexpr));
+			}
+			break;
+		case T_ColumnRef:
+			loc = ((const ColumnRef *) expr)->location;
+			break;
+		case T_ParamRef:
+			loc = ((const ParamRef *) expr)->location;
+			break;
+		case T_A_Const:
+			loc = ((const A_Const *) expr)->location;
+			break;
+		case T_FuncCall:
+			{
+				const FuncCall *fc = (const FuncCall *) expr;
+
+				/* consider both function name and leftmost arg */
+				/* (we assume any ORDER BY nodes must be to right of name) */
+				loc = leftmostLoc(fc->location,
+								  exprLocation((Node *) fc->args));
+			}
+			break;
+		case T_A_ArrayExpr:
+			/* the location points at ARRAY or [, which must be leftmost */
+			loc = ((const A_ArrayExpr *) expr)->location;
+			break;
+		case T_ResTarget:
+			/* we need not examine the contained expression (if any) */
+			loc = ((const ResTarget *) expr)->location;
+			break;
+		case T_MultiAssignRef:
+			loc = exprLocation(((const MultiAssignRef *) expr)->source);
+			break;
+		case T_TypeCast:
+			{
+				const TypeCast *tc = (const TypeCast *) expr;
+
+				/*
+				 * This could represent CAST(), ::, or TypeName 'literal', so
+				 * any of the components might be leftmost.
+				 */
+				loc = exprLocation(tc->arg);
+				loc = leftmostLoc(loc, tc->typeName->location);
+				loc = leftmostLoc(loc, tc->location);
+			}
+			break;
+		case T_CollateClause:
+			/* just use argument's location */
+			loc = exprLocation(((const CollateClause *) expr)->arg);
+			break;
+		case T_SortBy:
+			/* just use argument's location (ignore operator, if any) */
+			loc = exprLocation(((const SortBy *) expr)->node);
+			break;
+		case T_WindowDef:
+			loc = ((const WindowDef *) expr)->location;
+			break;
+		case T_RangeTableSample:
+			loc = ((const RangeTableSample *) expr)->location;
+			break;
+		case T_TypeName:
+			loc = ((const TypeName *) expr)->location;
+			break;
+		case T_ColumnDef:
+			loc = ((const ColumnDef *) expr)->location;
+			break;
+		case T_Constraint:
+			loc = ((const Constraint *) expr)->location;
+			break;
+		case T_FunctionParameter:
+			/* just use typename's location */
+			loc = exprLocation((Node *) ((const FunctionParameter *) expr)->argType);
+			break;
+		case T_XmlSerialize:
+			/* XMLSERIALIZE keyword should always be the first thing */
+			loc = ((const XmlSerialize *) expr)->location;
+			break;
+		case T_GroupingSet:
+			loc = ((const GroupingSet *) expr)->location;
+			break;
+		case T_WithClause:
+			loc = ((const WithClause *) expr)->location;
+			break;
+		case T_InferClause:
+			loc = ((const InferClause *) expr)->location;
+			break;
+		case T_OnConflictClause:
+			loc = ((const OnConflictClause *) expr)->location;
+			break;
+		case T_CommonTableExpr:
+			loc = ((const CommonTableExpr *) expr)->location;
+			break;
+		case T_PlaceHolderVar:
+			/* just use argument's location */
+			loc = exprLocation((Node *) ((const PlaceHolderVar *) expr)->phexpr);
+			break;
+		case T_InferenceElem:
+			/* just use nested expr's location */
+			loc = exprLocation((Node *) ((const InferenceElem *) expr)->expr);
+			break;
+		default:
+			/* for any other node type it's just unknown... */
+			loc = -1;
+			break;
+	}
+	return loc;
+}
+
+/*
+ * leftmostLoc - support for exprLocation
+ *
+ * Take the minimum of two parse location values, but ignore unknowns
+ */
+static int
+leftmostLoc(int loc1, int loc2)
+{
+	if (loc1 < 0)
+		return loc2;
+	else if (loc2 < 0)
+		return loc1;
+	else
+		return Min(loc1, loc2);
+}
+
+
+/*
+ * Standard expression-tree walking support
+ *
+ * We used to have near-duplicate code in many different routines that
+ * understood how to recurse through an expression node tree.  That was
+ * a pain to maintain, and we frequently had bugs due to some particular
+ * routine neglecting to support a particular node type.  In most cases,
+ * these routines only actually care about certain node types, and don't
+ * care about other types except insofar as they have to recurse through
+ * non-primitive node types.  Therefore, we now provide generic tree-walking
+ * logic to consolidate the redundant "boilerplate" code.  There are
+ * two versions: expression_tree_walker() and expression_tree_mutator().
+ */
+
+/*
+ * expression_tree_walker() is designed to support routines that traverse
+ * a tree in a read-only fashion (although it will also work for routines
+ * that modify nodes in-place but never add/delete/replace nodes).
+ * A walker routine should look like this:
+ *
+ * bool my_walker (Node *node, my_struct *context)
+ * {
+ *		if (node == NULL)
+ *			return false;
+ *		// check for nodes that special work is required for, eg:
+ *		if (IsA(node, Var))
+ *		{
+ *			... do special actions for Var nodes
+ *		}
+ *		else if (IsA(node, ...))
+ *		{
+ *			... do special actions for other node types
+ *		}
+ *		// for any node type not specially processed, do:
+ *		return expression_tree_walker(node, my_walker, (void *) context);
+ * }
+ *
+ * The "context" argument points to a struct that holds whatever context
+ * information the walker routine needs --- it can be used to return data
+ * gathered by the walker, too.  This argument is not touched by
+ * expression_tree_walker, but it is passed down to recursive sub-invocations
+ * of my_walker.  The tree walk is started from a setup routine that
+ * fills in the appropriate context struct, calls my_walker with the top-level
+ * node of the tree, and then examines the results.
+ *
+ * The walker routine should return "false" to continue the tree walk, or
+ * "true" to abort the walk and immediately return "true" to the top-level
+ * caller.  This can be used to short-circuit the traversal if the walker
+ * has found what it came for.  "false" is returned to the top-level caller
+ * iff no invocation of the walker returned "true".
+ *
+ * The node types handled by expression_tree_walker include all those
+ * normally found in target lists and qualifier clauses during the planning
+ * stage.  In particular, it handles List nodes since a cnf-ified qual clause
+ * will have List structure at the top level, and it handles TargetEntry nodes
+ * so that a scan of a target list can be handled without additional code.
+ * Also, RangeTblRef, FromExpr, JoinExpr, and SetOperationStmt nodes are
+ * handled, so that query jointrees and setOperation trees can be processed
+ * without additional code.
+ *
+ * expression_tree_walker will handle SubLink nodes by recursing normally
+ * into the "testexpr" subtree (which is an expression belonging to the outer
+ * plan).  It will also call the walker on the sub-Query node; however, when
+ * expression_tree_walker itself is called on a Query node, it does nothing
+ * and returns "false".  The net effect is that unless the walker does
+ * something special at a Query node, sub-selects will not be visited during
+ * an expression tree walk. This is exactly the behavior wanted in many cases
+ * --- and for those walkers that do want to recurse into sub-selects, special
+ * behavior is typically needed anyway at the entry to a sub-select (such as
+ * incrementing a depth counter). A walker that wants to examine sub-selects
+ * should include code along the lines of:
+ *
+ *		if (IsA(node, Query))
+ *		{
+ *			adjust context for subquery;
+ *			result = query_tree_walker((Query *) node, my_walker, context,
+ *									   0); // adjust flags as needed
+ *			restore context if needed;
+ *			return result;
+ *		}
+ *
+ * query_tree_walker is a convenience routine (see below) that calls the
+ * walker on all the expression subtrees of the given Query node.
+ *
+ * expression_tree_walker will handle SubPlan nodes by recursing normally
+ * into the "testexpr" and the "args" list (which are expressions belonging to
+ * the outer plan).  It will not touch the completed subplan, however.  Since
+ * there is no link to the original Query, it is not possible to recurse into
+ * subselects of an already-planned expression tree.  This is OK for current
+ * uses, but may need to be revisited in future.
+ */
+
+
+
+/*
+ * query_tree_walker --- initiate a walk of a Query's expressions
+ *
+ * This routine exists just to reduce the number of places that need to know
+ * where all the expression subtrees of a Query are.  Note it can be used
+ * for starting a walk at top level of a Query regardless of whether the
+ * walker intends to descend into subqueries.  It is also useful for
+ * descending into subqueries within a walker.
+ *
+ * Some callers want to suppress visitation of certain items in the sub-Query,
+ * typically because they need to process them specially, or don't actually
+ * want to recurse into subqueries.  This is supported by the flags argument,
+ * which is the bitwise OR of flag values to suppress visitation of
+ * indicated items.  (More flag bits may be added as needed.)
+ */
+
+
+/*
+ * range_table_walker is just the part of query_tree_walker that scans
+ * a query's rangetable.  This is split out since it can be useful on
+ * its own.
+ */
+
+
+
+/*
+ * expression_tree_mutator() is designed to support routines that make a
+ * modified copy of an expression tree, with some nodes being added,
+ * removed, or replaced by new subtrees.  The original tree is (normally)
+ * not changed.  Each recursion level is responsible for returning a copy of
+ * (or appropriately modified substitute for) the subtree it is handed.
+ * A mutator routine should look like this:
+ *
+ * Node * my_mutator (Node *node, my_struct *context)
+ * {
+ *		if (node == NULL)
+ *			return NULL;
+ *		// check for nodes that special work is required for, eg:
+ *		if (IsA(node, Var))
+ *		{
+ *			... create and return modified copy of Var node
+ *		}
+ *		else if (IsA(node, ...))
+ *		{
+ *			... do special transformations of other node types
+ *		}
+ *		// for any node type not specially processed, do:
+ *		return expression_tree_mutator(node, my_mutator, (void *) context);
+ * }
+ *
+ * The "context" argument points to a struct that holds whatever context
+ * information the mutator routine needs --- it can be used to return extra
+ * data gathered by the mutator, too.  This argument is not touched by
+ * expression_tree_mutator, but it is passed down to recursive sub-invocations
+ * of my_mutator.  The tree walk is started from a setup routine that
+ * fills in the appropriate context struct, calls my_mutator with the
+ * top-level node of the tree, and does any required post-processing.
+ *
+ * Each level of recursion must return an appropriately modified Node.
+ * If expression_tree_mutator() is called, it will make an exact copy
+ * of the given Node, but invoke my_mutator() to copy the sub-node(s)
+ * of that Node.  In this way, my_mutator() has full control over the
+ * copying process but need not directly deal with expression trees
+ * that it has no interest in.
+ *
+ * Just as for expression_tree_walker, the node types handled by
+ * expression_tree_mutator include all those normally found in target lists
+ * and qualifier clauses during the planning stage.
+ *
+ * expression_tree_mutator will handle SubLink nodes by recursing normally
+ * into the "testexpr" subtree (which is an expression belonging to the outer
+ * plan).  It will also call the mutator on the sub-Query node; however, when
+ * expression_tree_mutator itself is called on a Query node, it does nothing
+ * and returns the unmodified Query node.  The net effect is that unless the
+ * mutator does something special at a Query node, sub-selects will not be
+ * visited or modified; the original sub-select will be linked to by the new
+ * SubLink node.  Mutators that want to descend into sub-selects will usually
+ * do so by recognizing Query nodes and calling query_tree_mutator (below).
+ *
+ * expression_tree_mutator will handle a SubPlan node by recursing into the
+ * "testexpr" and the "args" list (which belong to the outer plan), but it
+ * will simply copy the link to the inner plan, since that's typically what
+ * expression tree mutators want.  A mutator that wants to modify the subplan
+ * can force appropriate behavior by recognizing SubPlan expression nodes
+ * and doing the right thing.
+ */
+
+#define FLATCOPY(newnode, node, nodetype)  \
+	( (newnode) = (nodetype *) palloc(sizeof(nodetype)), \
+	  memcpy((newnode), (node), sizeof(nodetype)) )
+#define CHECKFLATCOPY(newnode, node, nodetype)	\
+	( AssertMacro(IsA((node), nodetype)), \
+	  (newnode) = (nodetype *) palloc(sizeof(nodetype)), \
+	  memcpy((newnode), (node), sizeof(nodetype)) )
+#define MUTATE(newfield, oldfield, fieldtype)  \
+		( (newfield) = (fieldtype) mutator((Node *) (oldfield), context) )
+
+
+/*
+ * query_tree_mutator --- initiate modification of a Query's expressions
+ *
+ * This routine exists just to reduce the number of places that need to know
+ * where all the expression subtrees of a Query are.  Note it can be used
+ * for starting a walk at top level of a Query regardless of whether the
+ * mutator intends to descend into subqueries.  It is also useful for
+ * descending into subqueries within a mutator.
+ *
+ * Some callers want to suppress mutating of certain items in the Query,
+ * typically because they need to process them specially, or don't actually
+ * want to recurse into subqueries.  This is supported by the flags argument,
+ * which is the bitwise OR of flag values to suppress mutating of
+ * indicated items.  (More flag bits may be added as needed.)
+ *
+ * Normally the Query node itself is copied, but some callers want it to be
+ * modified in-place; they must pass QTW_DONT_COPY_QUERY in flags.  All
+ * modified substructure is safely copied in any case.
+ */
+
+
+/*
+ * range_table_mutator is just the part of query_tree_mutator that processes
+ * a query's rangetable.  This is split out since it can be useful on
+ * its own.
+ */
+
+
+/*
+ * query_or_expression_tree_walker --- hybrid form
+ *
+ * This routine will invoke query_tree_walker if called on a Query node,
+ * else will invoke the walker directly.  This is a useful way of starting
+ * the recursion when the walker's normal change of state is not appropriate
+ * for the outermost Query node.
+ */
+
+
+/*
+ * query_or_expression_tree_mutator --- hybrid form
+ *
+ * This routine will invoke query_tree_mutator if called on a Query node,
+ * else will invoke the mutator directly.  This is a useful way of starting
+ * the recursion when the mutator's normal change of state is not appropriate
+ * for the outermost Query node.
+ */
+
+
+
+/*
+ * raw_expression_tree_walker --- walk raw parse trees
+ *
+ * This has exactly the same API as expression_tree_walker, but instead of
+ * walking post-analysis parse trees, it knows how to walk the node types
+ * found in raw grammar output.  (There is not currently any need for a
+ * combined walker, so we keep them separate in the name of efficiency.)
+ * Unlike expression_tree_walker, there is no special rule about query
+ * boundaries: we descend to everything that's possibly interesting.
+ *
+ * Currently, the node type coverage extends to SelectStmt and everything
+ * that could appear under it, but not other statement types.
+ */
+bool
+raw_expression_tree_walker(Node *node,
+						   bool (*walker) (),
+						   void *context)
+{
+	ListCell   *temp;
+
+	/*
+	 * The walker has already visited the current node, and so we need only
+	 * recurse into any sub-nodes it has.
+	 */
+	if (node == NULL)
+		return false;
+
+	/* Guard against stack overflow due to overly complex expressions */
+	check_stack_depth();
+
+	switch (nodeTag(node))
+	{
+		case T_SetToDefault:
+		case T_CurrentOfExpr:
+		case T_Integer:
+		case T_Float:
+		case T_String:
+		case T_BitString:
+		case T_Null:
+		case T_ParamRef:
+		case T_A_Const:
+		case T_A_Star:
+			/* primitive node types with no subnodes */
+			break;
+		case T_Alias:
+			/* we assume the colnames list isn't interesting */
+			break;
+		case T_RangeVar:
+			return walker(((RangeVar *) node)->alias, context);
+		case T_GroupingFunc:
+			return walker(((GroupingFunc *) node)->args, context);
+		case T_SubLink:
+			{
+				SubLink    *sublink = (SubLink *) node;
+
+				if (walker(sublink->testexpr, context))
+					return true;
+				/* we assume the operName is not interesting */
+				if (walker(sublink->subselect, context))
+					return true;
+			}
+			break;
+		case T_CaseExpr:
+			{
+				CaseExpr   *caseexpr = (CaseExpr *) node;
+
+				if (walker(caseexpr->arg, context))
+					return true;
+				/* we assume walker doesn't care about CaseWhens, either */
+				foreach(temp, caseexpr->args)
+				{
+					CaseWhen   *when = (CaseWhen *) lfirst(temp);
+
+					Assert(IsA(when, CaseWhen));
+					if (walker(when->expr, context))
+						return true;
+					if (walker(when->result, context))
+						return true;
+				}
+				if (walker(caseexpr->defresult, context))
+					return true;
+			}
+			break;
+		case T_RowExpr:
+			/* Assume colnames isn't interesting */
+			return walker(((RowExpr *) node)->args, context);
+		case T_CoalesceExpr:
+			return walker(((CoalesceExpr *) node)->args, context);
+		case T_MinMaxExpr:
+			return walker(((MinMaxExpr *) node)->args, context);
+		case T_XmlExpr:
+			{
+				XmlExpr    *xexpr = (XmlExpr *) node;
+
+				if (walker(xexpr->named_args, context))
+					return true;
+				/* we assume walker doesn't care about arg_names */
+				if (walker(xexpr->args, context))
+					return true;
+			}
+			break;
+		case T_NullTest:
+			return walker(((NullTest *) node)->arg, context);
+		case T_BooleanTest:
+			return walker(((BooleanTest *) node)->arg, context);
+		case T_JoinExpr:
+			{
+				JoinExpr   *join = (JoinExpr *) node;
+
+				if (walker(join->larg, context))
+					return true;
+				if (walker(join->rarg, context))
+					return true;
+				if (walker(join->quals, context))
+					return true;
+				if (walker(join->alias, context))
+					return true;
+				/* using list is deemed uninteresting */
+			}
+			break;
+		case T_IntoClause:
+			{
+				IntoClause *into = (IntoClause *) node;
+
+				if (walker(into->rel, context))
+					return true;
+				/* colNames, options are deemed uninteresting */
+				/* viewQuery should be null in raw parsetree, but check it */
+				if (walker(into->viewQuery, context))
+					return true;
+			}
+			break;
+		case T_List:
+			foreach(temp, (List *) node)
+			{
+				if (walker((Node *) lfirst(temp), context))
+					return true;
+			}
+			break;
+		case T_InsertStmt:
+			{
+				InsertStmt *stmt = (InsertStmt *) node;
+
+				if (walker(stmt->relation, context))
+					return true;
+				if (walker(stmt->cols, context))
+					return true;
+				if (walker(stmt->selectStmt, context))
+					return true;
+				if (walker(stmt->onConflictClause, context))
+					return true;
+				if (walker(stmt->returningList, context))
+					return true;
+				if (walker(stmt->withClause, context))
+					return true;
+			}
+			break;
+		case T_DeleteStmt:
+			{
+				DeleteStmt *stmt = (DeleteStmt *) node;
+
+				if (walker(stmt->relation, context))
+					return true;
+				if (walker(stmt->usingClause, context))
+					return true;
+				if (walker(stmt->whereClause, context))
+					return true;
+				if (walker(stmt->returningList, context))
+					return true;
+				if (walker(stmt->withClause, context))
+					return true;
+			}
+			break;
+		case T_UpdateStmt:
+			{
+				UpdateStmt *stmt = (UpdateStmt *) node;
+
+				if (walker(stmt->relation, context))
+					return true;
+				if (walker(stmt->targetList, context))
+					return true;
+				if (walker(stmt->whereClause, context))
+					return true;
+				if (walker(stmt->fromClause, context))
+					return true;
+				if (walker(stmt->returningList, context))
+					return true;
+				if (walker(stmt->withClause, context))
+					return true;
+			}
+			break;
+		case T_SelectStmt:
+			{
+				SelectStmt *stmt = (SelectStmt *) node;
+
+				if (walker(stmt->distinctClause, context))
+					return true;
+				if (walker(stmt->intoClause, context))
+					return true;
+				if (walker(stmt->targetList, context))
+					return true;
+				if (walker(stmt->fromClause, context))
+					return true;
+				if (walker(stmt->whereClause, context))
+					return true;
+				if (walker(stmt->groupClause, context))
+					return true;
+				if (walker(stmt->havingClause, context))
+					return true;
+				if (walker(stmt->windowClause, context))
+					return true;
+				if (walker(stmt->valuesLists, context))
+					return true;
+				if (walker(stmt->sortClause, context))
+					return true;
+				if (walker(stmt->limitOffset, context))
+					return true;
+				if (walker(stmt->limitCount, context))
+					return true;
+				if (walker(stmt->lockingClause, context))
+					return true;
+				if (walker(stmt->withClause, context))
+					return true;
+				if (walker(stmt->larg, context))
+					return true;
+				if (walker(stmt->rarg, context))
+					return true;
+			}
+			break;
+		case T_A_Expr:
+			{
+				A_Expr	   *expr = (A_Expr *) node;
+
+				if (walker(expr->lexpr, context))
+					return true;
+				if (walker(expr->rexpr, context))
+					return true;
+				/* operator name is deemed uninteresting */
+			}
+			break;
+		case T_BoolExpr:
+			{
+				BoolExpr   *expr = (BoolExpr *) node;
+
+				if (walker(expr->args, context))
+					return true;
+			}
+			break;
+		case T_ColumnRef:
+			/* we assume the fields contain nothing interesting */
+			break;
+		case T_FuncCall:
+			{
+				FuncCall   *fcall = (FuncCall *) node;
+
+				if (walker(fcall->args, context))
+					return true;
+				if (walker(fcall->agg_order, context))
+					return true;
+				if (walker(fcall->agg_filter, context))
+					return true;
+				if (walker(fcall->over, context))
+					return true;
+				/* function name is deemed uninteresting */
+			}
+			break;
+		case T_NamedArgExpr:
+			return walker(((NamedArgExpr *) node)->arg, context);
+		case T_A_Indices:
+			{
+				A_Indices  *indices = (A_Indices *) node;
+
+				if (walker(indices->lidx, context))
+					return true;
+				if (walker(indices->uidx, context))
+					return true;
+			}
+			break;
+		case T_A_Indirection:
+			{
+				A_Indirection *indir = (A_Indirection *) node;
+
+				if (walker(indir->arg, context))
+					return true;
+				if (walker(indir->indirection, context))
+					return true;
+			}
+			break;
+		case T_A_ArrayExpr:
+			return walker(((A_ArrayExpr *) node)->elements, context);
+		case T_ResTarget:
+			{
+				ResTarget  *rt = (ResTarget *) node;
+
+				if (walker(rt->indirection, context))
+					return true;
+				if (walker(rt->val, context))
+					return true;
+			}
+			break;
+		case T_MultiAssignRef:
+			return walker(((MultiAssignRef *) node)->source, context);
+		case T_TypeCast:
+			{
+				TypeCast   *tc = (TypeCast *) node;
+
+				if (walker(tc->arg, context))
+					return true;
+				if (walker(tc->typeName, context))
+					return true;
+			}
+			break;
+		case T_CollateClause:
+			return walker(((CollateClause *) node)->arg, context);
+		case T_SortBy:
+			return walker(((SortBy *) node)->node, context);
+		case T_WindowDef:
+			{
+				WindowDef  *wd = (WindowDef *) node;
+
+				if (walker(wd->partitionClause, context))
+					return true;
+				if (walker(wd->orderClause, context))
+					return true;
+				if (walker(wd->startOffset, context))
+					return true;
+				if (walker(wd->endOffset, context))
+					return true;
+			}
+			break;
+		case T_RangeSubselect:
+			{
+				RangeSubselect *rs = (RangeSubselect *) node;
+
+				if (walker(rs->subquery, context))
+					return true;
+				if (walker(rs->alias, context))
+					return true;
+			}
+			break;
+		case T_RangeFunction:
+			{
+				RangeFunction *rf = (RangeFunction *) node;
+
+				if (walker(rf->functions, context))
+					return true;
+				if (walker(rf->alias, context))
+					return true;
+				if (walker(rf->coldeflist, context))
+					return true;
+			}
+			break;
+		case T_RangeTableSample:
+			{
+				RangeTableSample *rts = (RangeTableSample *) node;
+
+				if (walker(rts->relation, context))
+					return true;
+				/* method name is deemed uninteresting */
+				if (walker(rts->args, context))
+					return true;
+				if (walker(rts->repeatable, context))
+					return true;
+			}
+			break;
+		case T_TypeName:
+			{
+				TypeName   *tn = (TypeName *) node;
+
+				if (walker(tn->typmods, context))
+					return true;
+				if (walker(tn->arrayBounds, context))
+					return true;
+				/* type name itself is deemed uninteresting */
+			}
+			break;
+		case T_ColumnDef:
+			{
+				ColumnDef  *coldef = (ColumnDef *) node;
+
+				if (walker(coldef->typeName, context))
+					return true;
+				if (walker(coldef->raw_default, context))
+					return true;
+				if (walker(coldef->collClause, context))
+					return true;
+				/* for now, constraints are ignored */
+			}
+			break;
+		case T_GroupingSet:
+			return walker(((GroupingSet *) node)->content, context);
+		case T_LockingClause:
+			return walker(((LockingClause *) node)->lockedRels, context);
+		case T_XmlSerialize:
+			{
+				XmlSerialize *xs = (XmlSerialize *) node;
+
+				if (walker(xs->expr, context))
+					return true;
+				if (walker(xs->typeName, context))
+					return true;
+			}
+			break;
+		case T_WithClause:
+			return walker(((WithClause *) node)->ctes, context);
+		case T_InferClause:
+			{
+				InferClause *stmt = (InferClause *) node;
+
+				if (walker(stmt->indexElems, context))
+					return true;
+				if (walker(stmt->whereClause, context))
+					return true;
+			}
+			break;
+		case T_OnConflictClause:
+			{
+				OnConflictClause *stmt = (OnConflictClause *) node;
+
+				if (walker(stmt->infer, context))
+					return true;
+				if (walker(stmt->targetList, context))
+					return true;
+				if (walker(stmt->whereClause, context))
+					return true;
+			}
+			break;
+		case T_CommonTableExpr:
+			return walker(((CommonTableExpr *) node)->ctequery, context);
+		default:
+			elog(ERROR, "unrecognized node type: %d",
+				 (int) nodeTag(node));
+			break;
+	}
+	return false;
+}
diff --git a/foreign/libpg_query/src/postgres/src_backend_nodes_value.c b/foreign/libpg_query/src/postgres/src_backend_nodes_value.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_nodes_value.c
@@ -0,0 +1,75 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - makeInteger
+ * - makeString
+ * - makeFloat
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * value.c
+ *	  implementation of Value nodes
+ *
+ *
+ * Copyright (c) 2003-2015, PostgreSQL Global Development Group
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/nodes/value.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include "nodes/parsenodes.h"
+
+/*
+ *	makeInteger
+ */
+Value *
+makeInteger(long i)
+{
+	Value	   *v = makeNode(Value);
+
+	v->type = T_Integer;
+	v->val.ival = i;
+	return v;
+}
+
+/*
+ *	makeFloat
+ *
+ * Caller is responsible for passing a palloc'd string.
+ */
+Value *
+makeFloat(char *numericStr)
+{
+	Value	   *v = makeNode(Value);
+
+	v->type = T_Float;
+	v->val.str = numericStr;
+	return v;
+}
+
+/*
+ *	makeString
+ *
+ * Caller is responsible for passing a palloc'd string.
+ */
+Value *
+makeString(char *str)
+{
+	Value	   *v = makeNode(Value);
+
+	v->type = T_String;
+	v->val.str = str;
+	return v;
+}
+
+/*
+ *	makeBitString
+ *
+ * Caller is responsible for passing a palloc'd string.
+ */
+
diff --git a/foreign/libpg_query/src/postgres/src_backend_parser_gram.c b/foreign/libpg_query/src/postgres/src_backend_parser_gram.c
new file mode 100644
# file too large to diff: foreign/libpg_query/src/postgres/src_backend_parser_gram.c
diff --git a/foreign/libpg_query/src/postgres/src_backend_parser_keywords.c b/foreign/libpg_query/src/postgres/src_backend_parser_keywords.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_parser_keywords.c
@@ -0,0 +1,34 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - ScanKeywords
+ * - NumScanKeywords
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * keywords.c
+ *	  lexical token lookup for key words in PostgreSQL
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/parser/keywords.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include "parser/gramparse.h"
+
+#define PG_KEYWORD(a,b,c) {a,b,c},
+
+
+const ScanKeyword ScanKeywords[] = {
+#include "parser/kwlist.h"
+};
+
+const int	NumScanKeywords = lengthof(ScanKeywords);
diff --git a/foreign/libpg_query/src/postgres/src_backend_parser_kwlookup.c b/foreign/libpg_query/src/postgres/src_backend_parser_kwlookup.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_parser_kwlookup.c
@@ -0,0 +1,95 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - ScanKeywordLookup
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * kwlookup.c
+ *	  lexical token lookup for key words in PostgreSQL
+ *
+ * NB - this file is also used by ECPG and several frontend programs in
+ * src/bin/ including pg_dump and psql
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/parser/kwlookup.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/* use c.h so this can be built as either frontend or backend */
+#include "c.h"
+
+#include <ctype.h>
+
+#include "parser/keywords.h"
+
+/*
+ * ScanKeywordLookup - see if a given word is a keyword
+ *
+ * Returns a pointer to the ScanKeyword table entry, or NULL if no match.
+ *
+ * The match is done case-insensitively.  Note that we deliberately use a
+ * dumbed-down case conversion that will only translate 'A'-'Z' into 'a'-'z',
+ * even if we are in a locale where tolower() would produce more or different
+ * translations.  This is to conform to the SQL99 spec, which says that
+ * keywords are to be matched in this way even though non-keyword identifiers
+ * receive a different case-normalization mapping.
+ */
+const ScanKeyword *
+ScanKeywordLookup(const char *text,
+				  const ScanKeyword *keywords,
+				  int num_keywords)
+{
+	int			len,
+				i;
+	char		word[NAMEDATALEN];
+	const ScanKeyword *low;
+	const ScanKeyword *high;
+
+	len = strlen(text);
+	/* We assume all keywords are shorter than NAMEDATALEN. */
+	if (len >= NAMEDATALEN)
+		return NULL;
+
+	/*
+	 * Apply an ASCII-only downcasing.  We must not use tolower() since it may
+	 * produce the wrong translation in some locales (eg, Turkish).
+	 */
+	for (i = 0; i < len; i++)
+	{
+		char		ch = text[i];
+
+		if (ch >= 'A' && ch <= 'Z')
+			ch += 'a' - 'A';
+		word[i] = ch;
+	}
+	word[len] = '\0';
+
+	/*
+	 * Now do a binary search using plain strcmp() comparison.
+	 */
+	low = keywords;
+	high = keywords + (num_keywords - 1);
+	while (low <= high)
+	{
+		const ScanKeyword *middle;
+		int			difference;
+
+		middle = low + (high - low) / 2;
+		difference = strcmp(middle->name, word);
+		if (difference == 0)
+			return middle;
+		else if (difference < 0)
+			low = middle + 1;
+		else
+			high = middle - 1;
+	}
+
+	return NULL;
+}
diff --git a/foreign/libpg_query/src/postgres/src_backend_parser_parse_expr.c b/foreign/libpg_query/src/postgres/src_backend_parser_parse_expr.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_parser_parse_expr.c
@@ -0,0 +1,300 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - operator_precedence_warning
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * parse_expr.c
+ *	  handle expressions in parser
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/parser/parse_expr.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+
+#include "catalog/pg_type.h"
+#include "commands/dbcommands.h"
+#include "miscadmin.h"
+#include "nodes/makefuncs.h"
+#include "nodes/nodeFuncs.h"
+#include "optimizer/tlist.h"
+#include "optimizer/var.h"
+#include "parser/analyze.h"
+#include "parser/parse_clause.h"
+#include "parser/parse_coerce.h"
+#include "parser/parse_collate.h"
+#include "parser/parse_expr.h"
+#include "parser/parse_func.h"
+#include "parser/parse_oper.h"
+#include "parser/parse_relation.h"
+#include "parser/parse_target.h"
+#include "parser/parse_type.h"
+#include "parser/parse_agg.h"
+#include "utils/builtins.h"
+#include "utils/lsyscache.h"
+#include "utils/xml.h"
+
+
+/* GUC parameters */
+__thread bool		operator_precedence_warning = false;
+
+
+
+/*
+ * Node-type groups for operator precedence warnings
+ * We use zero for everything not otherwise classified
+ */
+#define PREC_GROUP_POSTFIX_IS	1		/* postfix IS tests (NullTest, etc) */
+#define PREC_GROUP_INFIX_IS		2		/* infix IS (IS DISTINCT FROM, etc) */
+#define PREC_GROUP_LESS			3		/* < > */
+#define PREC_GROUP_EQUAL		4		/* = */
+#define PREC_GROUP_LESS_EQUAL	5		/* <= >= <> */
+#define PREC_GROUP_LIKE			6		/* LIKE ILIKE SIMILAR */
+#define PREC_GROUP_BETWEEN		7		/* BETWEEN */
+#define PREC_GROUP_IN			8		/* IN */
+#define PREC_GROUP_NOT_LIKE		9		/* NOT LIKE/ILIKE/SIMILAR */
+#define PREC_GROUP_NOT_BETWEEN	10		/* NOT BETWEEN */
+#define PREC_GROUP_NOT_IN		11		/* NOT IN */
+#define PREC_GROUP_POSTFIX_OP	12		/* generic postfix operators */
+#define PREC_GROUP_INFIX_OP		13		/* generic infix operators */
+#define PREC_GROUP_PREFIX_OP	14		/* generic prefix operators */
+
+/*
+ * Map precedence groupings to old precedence ordering
+ *
+ * Old precedence order:
+ * 1. NOT
+ * 2. =
+ * 3. < >
+ * 4. LIKE ILIKE SIMILAR
+ * 5. BETWEEN
+ * 6. IN
+ * 7. generic postfix Op
+ * 8. generic Op, including <= => <>
+ * 9. generic prefix Op
+ * 10. IS tests (NullTest, BooleanTest, etc)
+ *
+ * NOT BETWEEN etc map to BETWEEN etc when considered as being on the left,
+ * but to NOT when considered as being on the right, because of the buggy
+ * precedence handling of those productions in the old grammar.
+ */
+
+
+
+static Node *transformExprRecurse(ParseState *pstate, Node *expr);
+static Node *transformParamRef(ParseState *pstate, ParamRef *pref);
+static Node *transformAExprOp(ParseState *pstate, A_Expr *a);
+static Node *transformAExprOpAny(ParseState *pstate, A_Expr *a);
+static Node *transformAExprOpAll(ParseState *pstate, A_Expr *a);
+static Node *transformAExprDistinct(ParseState *pstate, A_Expr *a);
+static Node *transformAExprNullIf(ParseState *pstate, A_Expr *a);
+static Node *transformAExprOf(ParseState *pstate, A_Expr *a);
+static Node *transformAExprIn(ParseState *pstate, A_Expr *a);
+static Node *transformAExprBetween(ParseState *pstate, A_Expr *a);
+static Node *transformBoolExpr(ParseState *pstate, BoolExpr *a);
+static Node *transformFuncCall(ParseState *pstate, FuncCall *fn);
+static Node *transformMultiAssignRef(ParseState *pstate, MultiAssignRef *maref);
+static Node *transformCaseExpr(ParseState *pstate, CaseExpr *c);
+static Node *transformSubLink(ParseState *pstate, SubLink *sublink);
+static Node *transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
+				   Oid array_type, Oid element_type, int32 typmod);
+static Node *transformRowExpr(ParseState *pstate, RowExpr *r);
+static Node *transformCoalesceExpr(ParseState *pstate, CoalesceExpr *c);
+static Node *transformMinMaxExpr(ParseState *pstate, MinMaxExpr *m);
+static Node *transformXmlExpr(ParseState *pstate, XmlExpr *x);
+static Node *transformXmlSerialize(ParseState *pstate, XmlSerialize *xs);
+static Node *transformBooleanTest(ParseState *pstate, BooleanTest *b);
+static Node *transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr *cexpr);
+static Node *transformColumnRef(ParseState *pstate, ColumnRef *cref);
+static Node *transformWholeRowRef(ParseState *pstate, RangeTblEntry *rte,
+					 int location);
+static Node *transformIndirection(ParseState *pstate, Node *basenode,
+					 List *indirection);
+static Node *transformTypeCast(ParseState *pstate, TypeCast *tc);
+static Node *transformCollateClause(ParseState *pstate, CollateClause *c);
+static Node *make_row_comparison_op(ParseState *pstate, List *opname,
+					   List *largs, List *rargs, int location);
+static Node *make_row_distinct_op(ParseState *pstate, List *opname,
+					 RowExpr *lrow, RowExpr *rrow, int location);
+static Expr *make_distinct_op(ParseState *pstate, List *opname,
+				 Node *ltree, Node *rtree, int location);
+static int	operator_precedence_group(Node *node, const char **nodename);
+static void emit_precedence_warnings(ParseState *pstate,
+						 int opgroup, const char *opname,
+						 Node *lchild, Node *rchild,
+						 int location);
+
+
+/*
+ * transformExpr -
+ *	  Analyze and transform expressions. Type checking and type casting is
+ *	  done here.  This processing converts the raw grammar output into
+ *	  expression trees with fully determined semantics.
+ */
+
+
+
+
+/*
+ * helper routine for delivering "column does not exist" error message
+ *
+ * (Usually we don't have to work this hard, but the general case of field
+ * selection from an arbitrary node needs it.)
+ */
+
+
+
+
+/*
+ * Transform a ColumnRef.
+ *
+ * If you find yourself changing this code, see also ExpandColumnRefStar.
+ */
+
+
+
+
+/* Test whether an a_expr is a plain NULL constant or not */
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * Checking an expression for match to a list of type names. Will result
+ * in a boolean constant node.
+ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * transformArrayExpr
+ *
+ * If the caller specifies the target type, the resulting array will
+ * be of exactly that type.  Otherwise we try to infer a common type
+ * for the elements using select_common_type().
+ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * Construct a whole-row reference to represent the notation "relation.*".
+ */
+
+
+/*
+ * Handle an explicit CAST construct.
+ *
+ * Transform the argument, look up the type name, and apply any necessary
+ * coercion function(s).
+ */
+
+
+/*
+ * Handle an explicit COLLATE clause.
+ *
+ * Transform the argument, and look up the collation name.
+ */
+
+
+/*
+ * Transform a "row compare-op row" construct
+ *
+ * The inputs are lists of already-transformed expressions.
+ * As with coerce_type, pstate may be NULL if no special unknown-Param
+ * processing is wanted.
+ *
+ * The output may be a single OpExpr, an AND or OR combination of OpExprs,
+ * or a RowCompareExpr.  In all cases it is guaranteed to return boolean.
+ * The AND, OR, and RowCompareExpr cases further imply things about the
+ * behavior of the operators (ie, they behave as =, <>, or < <= > >=).
+ */
+
+
+/*
+ * Transform a "row IS DISTINCT FROM row" construct
+ *
+ * The input RowExprs are already transformed
+ */
+
+
+/*
+ * make the node for an IS DISTINCT FROM operator
+ */
+
+
+/*
+ * Identify node's group for operator precedence warnings
+ *
+ * For items in nonzero groups, also return a suitable node name into *nodename
+ *
+ * Note: group zero is used for nodes that are higher or lower precedence
+ * than everything that changed precedence; we need never issue warnings
+ * related to such nodes.
+ */
+
+
+/*
+ * helper routine for delivering 9.4-to-9.5 operator precedence warnings
+ *
+ * opgroup/opname/location represent some parent node
+ * lchild, rchild are its left and right children (either could be NULL)
+ *
+ * This should be called before transforming the child nodes, since if a
+ * precedence-driven parsing change has occurred in a query that used to work,
+ * it's quite possible that we'll get a semantic failure while analyzing the
+ * child expression.  We want to produce the warning before that happens.
+ * In any case, operator_precedence_group() expects untransformed input.
+ */
+
+
+/*
+ * Produce a string identifying an expression by kind.
+ *
+ * Note: when practical, use a simple SQL keyword for the result.  If that
+ * doesn't work well, check call sites to see whether custom error message
+ * strings are required.
+ */
+
diff --git a/foreign/libpg_query/src/postgres/src_backend_parser_parser.c b/foreign/libpg_query/src/postgres/src_backend_parser_parser.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_parser_parser.c
@@ -0,0 +1,203 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - raw_parser
+ * - base_yylex
+ * - raw_parser
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * parser.c
+ *		Main entry point/driver for PostgreSQL grammar
+ *
+ * Note that the grammar is not allowed to perform any table access
+ * (since we need to be able to do basic parsing even while inside an
+ * aborted transaction).  Therefore, the data structures returned by
+ * the grammar are "raw" parsetrees that still need to be analyzed by
+ * analyze.c and related files.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ *	  src/backend/parser/parser.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+
+#include "parser/gramparse.h"
+#include "parser/parser.h"
+
+
+/*
+ * raw_parser
+ *		Given a query in string form, do lexical and grammatical analysis.
+ *
+ * Returns a list of raw (un-analyzed) parse trees.
+ */
+List *
+raw_parser(const char *str)
+{
+	core_yyscan_t yyscanner;
+	base_yy_extra_type yyextra;
+	int			yyresult;
+
+	/* initialize the flex scanner */
+	yyscanner = scanner_init(str, &yyextra.core_yy_extra,
+							 ScanKeywords, NumScanKeywords);
+
+	/* base_yylex() only needs this much initialization */
+	yyextra.have_lookahead = false;
+
+	/* initialize the bison parser */
+	parser_init(&yyextra);
+
+	/* Parse! */
+	yyresult = base_yyparse(yyscanner);
+
+	/* Clean up (release memory) */
+	scanner_finish(yyscanner);
+
+	if (yyresult)				/* error */
+		return NIL;
+
+	return yyextra.parsetree;
+}
+
+
+/*
+ * Intermediate filter between parser and core lexer (core_yylex in scan.l).
+ *
+ * This filter is needed because in some cases the standard SQL grammar
+ * requires more than one token lookahead.  We reduce these cases to one-token
+ * lookahead by replacing tokens here, in order to keep the grammar LALR(1).
+ *
+ * Using a filter is simpler than trying to recognize multiword tokens
+ * directly in scan.l, because we'd have to allow for comments between the
+ * words.  Furthermore it's not clear how to do that without re-introducing
+ * scanner backtrack, which would cost more performance than this filter
+ * layer does.
+ *
+ * The filter also provides a convenient place to translate between
+ * the core_YYSTYPE and YYSTYPE representations (which are really the
+ * same thing anyway, but notationally they're different).
+ */
+int
+base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner)
+{
+	base_yy_extra_type *yyextra = pg_yyget_extra(yyscanner);
+	int			cur_token;
+	int			next_token;
+	int			cur_token_length;
+	YYLTYPE		cur_yylloc;
+
+	/* Get next token --- we might already have it */
+	if (yyextra->have_lookahead)
+	{
+		cur_token = yyextra->lookahead_token;
+		lvalp->core_yystype = yyextra->lookahead_yylval;
+		*llocp = yyextra->lookahead_yylloc;
+		*(yyextra->lookahead_end) = yyextra->lookahead_hold_char;
+		yyextra->have_lookahead = false;
+	}
+	else
+		cur_token = core_yylex(&(lvalp->core_yystype), llocp, yyscanner);
+
+	/*
+	 * If this token isn't one that requires lookahead, just return it.  If it
+	 * does, determine the token length.  (We could get that via strlen(), but
+	 * since we have such a small set of possibilities, hardwiring seems
+	 * feasible and more efficient.)
+	 */
+	switch (cur_token)
+	{
+		case NOT:
+			cur_token_length = 3;
+			break;
+		case NULLS_P:
+			cur_token_length = 5;
+			break;
+		case WITH:
+			cur_token_length = 4;
+			break;
+		default:
+			return cur_token;
+	}
+
+	/*
+	 * Identify end+1 of current token.  core_yylex() has temporarily stored a
+	 * '\0' here, and will undo that when we call it again.  We need to redo
+	 * it to fully revert the lookahead call for error reporting purposes.
+	 */
+	yyextra->lookahead_end = yyextra->core_yy_extra.scanbuf +
+		*llocp + cur_token_length;
+	Assert(*(yyextra->lookahead_end) == '\0');
+
+	/*
+	 * Save and restore *llocp around the call.  It might look like we could
+	 * avoid this by just passing &lookahead_yylloc to core_yylex(), but that
+	 * does not work because flex actually holds onto the last-passed pointer
+	 * internally, and will use that for error reporting.  We need any error
+	 * reports to point to the current token, not the next one.
+	 */
+	cur_yylloc = *llocp;
+
+	/* Get next token, saving outputs into lookahead variables */
+	next_token = core_yylex(&(yyextra->lookahead_yylval), llocp, yyscanner);
+	yyextra->lookahead_token = next_token;
+	yyextra->lookahead_yylloc = *llocp;
+
+	*llocp = cur_yylloc;
+
+	/* Now revert the un-truncation of the current token */
+	yyextra->lookahead_hold_char = *(yyextra->lookahead_end);
+	*(yyextra->lookahead_end) = '\0';
+
+	yyextra->have_lookahead = true;
+
+	/* Replace cur_token if needed, based on lookahead */
+	switch (cur_token)
+	{
+		case NOT:
+			/* Replace NOT by NOT_LA if it's followed by BETWEEN, IN, etc */
+			switch (next_token)
+			{
+				case BETWEEN:
+				case IN_P:
+				case LIKE:
+				case ILIKE:
+				case SIMILAR:
+					cur_token = NOT_LA;
+					break;
+			}
+			break;
+
+		case NULLS_P:
+			/* Replace NULLS_P by NULLS_LA if it's followed by FIRST or LAST */
+			switch (next_token)
+			{
+				case FIRST_P:
+				case LAST_P:
+					cur_token = NULLS_LA;
+					break;
+			}
+			break;
+
+		case WITH:
+			/* Replace WITH by WITH_LA if it's followed by TIME or ORDINALITY */
+			switch (next_token)
+			{
+				case TIME:
+				case ORDINALITY:
+					cur_token = WITH_LA;
+					break;
+			}
+			break;
+	}
+
+	return cur_token;
+}
diff --git a/foreign/libpg_query/src/postgres/src_backend_parser_scansup.c b/foreign/libpg_query/src/postgres/src_backend_parser_scansup.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_parser_scansup.c
@@ -0,0 +1,150 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - truncate_identifier
+ * - downcase_truncate_identifier
+ * - scanner_isspace
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * scansup.c
+ *	  support routines for the lex/flex scanner, used by both the normal
+ * backend as well as the bootstrap backend
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/parser/scansup.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include <ctype.h>
+
+#include "parser/scansup.h"
+#include "mb/pg_wchar.h"
+
+
+/* ----------------
+ *		scanstr
+ *
+ * if the string passed in has escaped codes, map the escape codes to actual
+ * chars
+ *
+ * the string returned is palloc'd and should eventually be pfree'd by the
+ * caller!
+ * ----------------
+ */
+
+
+
+
+/*
+ * downcase_truncate_identifier() --- do appropriate downcasing and
+ * truncation of an unquoted identifier.  Optionally warn of truncation.
+ *
+ * Returns a palloc'd string containing the adjusted identifier.
+ *
+ * Note: in some usages the passed string is not null-terminated.
+ *
+ * Note: the API of this function is designed to allow for downcasing
+ * transformations that increase the string length, but we don't yet
+ * support that.  If you want to implement it, you'll need to fix
+ * SplitIdentifierString() in utils/adt/varlena.c.
+ */
+char *
+downcase_truncate_identifier(const char *ident, int len, bool warn)
+{
+	char	   *result;
+	int			i;
+	bool		enc_is_single_byte;
+
+	result = palloc(len + 1);
+	enc_is_single_byte = pg_database_encoding_max_length() == 1;
+
+	/*
+	 * SQL99 specifies Unicode-aware case normalization, which we don't yet
+	 * have the infrastructure for.  Instead we use tolower() to provide a
+	 * locale-aware translation.  However, there are some locales where this
+	 * is not right either (eg, Turkish may do strange things with 'i' and
+	 * 'I').  Our current compromise is to use tolower() for characters with
+	 * the high bit set, as long as they aren't part of a multi-byte
+	 * character, and use an ASCII-only downcasing for 7-bit characters.
+	 */
+	for (i = 0; i < len; i++)
+	{
+		unsigned char ch = (unsigned char) ident[i];
+
+		if (ch >= 'A' && ch <= 'Z')
+			ch += 'a' - 'A';
+		else if (enc_is_single_byte && IS_HIGHBIT_SET(ch) && isupper(ch))
+			ch = tolower(ch);
+		result[i] = (char) ch;
+	}
+	result[i] = '\0';
+
+	if (i >= NAMEDATALEN)
+		truncate_identifier(result, i, warn);
+
+	return result;
+}
+
+/*
+ * truncate_identifier() --- truncate an identifier to NAMEDATALEN-1 bytes.
+ *
+ * The given string is modified in-place, if necessary.  A warning is
+ * issued if requested.
+ *
+ * We require the caller to pass in the string length since this saves a
+ * strlen() call in some common usages.
+ */
+void
+truncate_identifier(char *ident, int len, bool warn)
+{
+	if (len >= NAMEDATALEN)
+	{
+		len = pg_mbcliplen(ident, len, NAMEDATALEN - 1);
+		if (warn)
+		{
+			/*
+			 * We avoid using %.*s here because it can misbehave if the data
+			 * is not valid in what libc thinks is the prevailing encoding.
+			 */
+			char		buf[NAMEDATALEN];
+
+			memcpy(buf, ident, len);
+			buf[len] = '\0';
+			ereport(NOTICE,
+					(errcode(ERRCODE_NAME_TOO_LONG),
+					 errmsg("identifier \"%s\" will be truncated to \"%s\"",
+							ident, buf)));
+		}
+		ident[len] = '\0';
+	}
+}
+
+/*
+ * scanner_isspace() --- return TRUE if flex scanner considers char whitespace
+ *
+ * This should be used instead of the potentially locale-dependent isspace()
+ * function when it's important to match the lexer's behavior.
+ *
+ * In principle we might need similar functions for isalnum etc, but for the
+ * moment only isspace seems needed.
+ */
+bool
+scanner_isspace(char ch)
+{
+	/* This must match scan.l's list of {space} characters */
+	if (ch == ' ' ||
+		ch == '\t' ||
+		ch == '\n' ||
+		ch == '\r' ||
+		ch == '\f')
+		return true;
+	return false;
+}
diff --git a/foreign/libpg_query/src/postgres/src_backend_postmaster_postmaster.c b/foreign/libpg_query/src/postgres/src_backend_postmaster_postmaster.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_postmaster_postmaster.c
@@ -0,0 +1,2081 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - ClientAuthInProgress
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * postmaster.c
+ *	  This program acts as a clearing house for requests to the
+ *	  POSTGRES system.  Frontend programs send a startup message
+ *	  to the Postmaster and the postmaster uses the info in the
+ *	  message to setup a backend process.
+ *
+ *	  The postmaster also manages system-wide operations such as
+ *	  startup and shutdown. The postmaster itself doesn't do those
+ *	  operations, mind you --- it just forks off a subprocess to do them
+ *	  at the right times.  It also takes care of resetting the system
+ *	  if a backend crashes.
+ *
+ *	  The postmaster process creates the shared memory and semaphore
+ *	  pools during startup, but as a rule does not touch them itself.
+ *	  In particular, it is not a member of the PGPROC array of backends
+ *	  and so it cannot participate in lock-manager operations.  Keeping
+ *	  the postmaster away from shared memory operations makes it simpler
+ *	  and more reliable.  The postmaster is almost always able to recover
+ *	  from crashes of individual backends by resetting shared memory;
+ *	  if it did much with shared memory then it would be prone to crashing
+ *	  along with the backends.
+ *
+ *	  When a request message is received, we now fork() immediately.
+ *	  The child process performs authentication of the request, and
+ *	  then becomes a backend if successful.  This allows the auth code
+ *	  to be written in a simple single-threaded style (as opposed to the
+ *	  crufty "poor man's multitasking" code that used to be needed).
+ *	  More importantly, it ensures that blockages in non-multithreaded
+ *	  libraries like SSL or PAM cannot cause denial of service to other
+ *	  clients.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/postmaster/postmaster.c
+ *
+ * NOTES
+ *
+ * Initialization:
+ *		The Postmaster sets up shared memory data structures
+ *		for the backends.
+ *
+ * Synchronization:
+ *		The Postmaster shares memory with the backends but should avoid
+ *		touching shared memory, so as not to become stuck if a crashing
+ *		backend screws up locks or shared memory.  Likewise, the Postmaster
+ *		should never block on messages from frontend clients.
+ *
+ * Garbage Collection:
+ *		The Postmaster cleans up after backends if they have an emergency
+ *		exit and/or core dump.
+ *
+ * Error Reporting:
+ *		Use write_stderr() only for reporting "interactive" errors
+ *		(essentially, bogus arguments on the command line).  Once the
+ *		postmaster is launched, use ereport().
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+
+#include <unistd.h>
+#include <signal.h>
+#include <time.h>
+#include <sys/wait.h>
+#include <ctype.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <fcntl.h>
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <limits.h>
+
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+#ifdef USE_BONJOUR
+#include <dns_sd.h>
+#endif
+
+#ifdef HAVE_PTHREAD_IS_THREADED_NP
+#include <pthread.h>
+#endif
+
+#include "access/transam.h"
+#include "access/xlog.h"
+#include "bootstrap/bootstrap.h"
+#include "catalog/pg_control.h"
+#include "lib/ilist.h"
+#include "libpq/auth.h"
+#include "libpq/ip.h"
+#include "libpq/libpq.h"
+#include "libpq/pqsignal.h"
+#include "miscadmin.h"
+#include "pg_getopt.h"
+#include "pgstat.h"
+#include "postmaster/autovacuum.h"
+#include "postmaster/bgworker_internals.h"
+#include "postmaster/fork_process.h"
+#include "postmaster/pgarch.h"
+#include "postmaster/postmaster.h"
+#include "postmaster/syslogger.h"
+#include "replication/walsender.h"
+#include "storage/fd.h"
+#include "storage/ipc.h"
+#include "storage/pg_shmem.h"
+#include "storage/pmsignal.h"
+#include "storage/proc.h"
+#include "tcop/tcopprot.h"
+#include "utils/builtins.h"
+#include "utils/datetime.h"
+#include "utils/dynamic_loader.h"
+#include "utils/memutils.h"
+#include "utils/ps_status.h"
+#include "utils/timeout.h"
+
+#ifdef EXEC_BACKEND
+#include "storage/spin.h"
+#endif
+
+
+/*
+ * Possible types of a backend. Beyond being the possible bkend_type values in
+ * struct bkend, these are OR-able request flag bits for SignalSomeChildren()
+ * and CountChildren().
+ */
+#define BACKEND_TYPE_NORMAL		0x0001	/* normal backend */
+#define BACKEND_TYPE_AUTOVAC	0x0002	/* autovacuum worker process */
+#define BACKEND_TYPE_WALSND		0x0004	/* walsender process */
+#define BACKEND_TYPE_BGWORKER	0x0008	/* bgworker process */
+#define BACKEND_TYPE_ALL		0x000F	/* OR of all the above */
+
+#define BACKEND_TYPE_WORKER		(BACKEND_TYPE_AUTOVAC | BACKEND_TYPE_BGWORKER)
+
+/*
+ * List of active backends (or child processes anyway; we don't actually
+ * know whether a given child has become a backend or is still in the
+ * authorization phase).  This is used mainly to keep track of how many
+ * children we have and send them appropriate signals when necessary.
+ *
+ * "Special" children such as the startup, bgwriter and autovacuum launcher
+ * tasks are not in this list.  Autovacuum worker and walsender are in it.
+ * Also, "dead_end" children are in it: these are children launched just for
+ * the purpose of sending a friendly rejection message to a would-be client.
+ * We must track them because they are attached to shared memory, but we know
+ * they will never become live backends.  dead_end children are not assigned a
+ * PMChildSlot.
+ *
+ * Background workers are in this list, too.
+ */
+typedef struct bkend
+{
+	pid_t		pid;			/* process id of backend */
+	long		cancel_key;		/* cancel key for cancels for this backend */
+	int			child_slot;		/* PMChildSlot for this backend, if any */
+
+	/*
+	 * Flavor of backend or auxiliary process.  Note that BACKEND_TYPE_WALSND
+	 * backends initially announce themselves as BACKEND_TYPE_NORMAL, so if
+	 * bkend_type is normal, you should check for a recent transition.
+	 */
+	int			bkend_type;
+	bool		dead_end;		/* is it going to send an error and quit? */
+	bool		bgworker_notify;	/* gets bgworker start/stop notifications */
+	dlist_node	elem;			/* list link in BackendList */
+} Backend;
+
+
+
+#ifdef EXEC_BACKEND
+static Backend *ShmemBackendArray;
+#endif
+
+
+
+
+
+/* The socket number we are listening for connections on */
+
+
+/* The directory names for Unix socket(s) */
+
+
+/* The TCP listen address(es) */
+
+
+/*
+ * ReservedBackends is the number of backends reserved for superuser use.
+ * This number is taken out of the pool size given by MaxBackends so
+ * number of backend slots available to non-superusers is
+ * (MaxBackends - ReservedBackends).  Note what this really means is
+ * "if there are <= ReservedBackends connections available, only superusers
+ * can make new connections" --- pre-existing superuser connections don't
+ * count against the limit.
+ */
+
+
+/* The socket(s) we're listening to. */
+#define MAXLISTEN	64
+
+
+/*
+ * Set by the -o option
+ */
+
+
+/*
+ * These globals control the behavior of the postmaster in case some
+ * backend dumps core.  Normally, it kills all peers of the dead backend
+ * and reinitializes shared memory.  By specifying -s or -n, we can have
+ * the postmaster stop (rather than kill) peers and not reinitialize
+ * shared data structures.  (Reinit is currently dead code, though.)
+ */
+
+
+
+/* still more option variables */
+
+
+
+
+
+		/* for ps display and logging */
+
+
+
+
+
+
+
+/* PIDs of special child processes; 0 when not running */
+
+
+
+
+
+
+
+
+
+
+/* Startup process's status */
+typedef enum
+{
+	STARTUP_NOT_RUNNING,
+	STARTUP_RUNNING,
+	STARTUP_SIGNALED,			/* we sent it a SIGQUIT or SIGKILL */
+	STARTUP_CRASHED
+} StartupStatusEnum;
+
+
+
+/* Startup/shutdown state */
+#define			NoShutdown		0
+#define			SmartShutdown	1
+#define			FastShutdown	2
+#define			ImmediateShutdown	3
+
+
+
+ /* T if recovering from backend crash */
+
+/*
+ * We use a simple state machine to control startup, shutdown, and
+ * crash recovery (which is rather like shutdown followed by startup).
+ *
+ * After doing all the postmaster initialization work, we enter PM_STARTUP
+ * state and the startup process is launched. The startup process begins by
+ * reading the control file and other preliminary initialization steps.
+ * In a normal startup, or after crash recovery, the startup process exits
+ * with exit code 0 and we switch to PM_RUN state.  However, archive recovery
+ * is handled specially since it takes much longer and we would like to support
+ * hot standby during archive recovery.
+ *
+ * When the startup process is ready to start archive recovery, it signals the
+ * postmaster, and we switch to PM_RECOVERY state. The background writer and
+ * checkpointer are launched, while the startup process continues applying WAL.
+ * If Hot Standby is enabled, then, after reaching a consistent point in WAL
+ * redo, startup process signals us again, and we switch to PM_HOT_STANDBY
+ * state and begin accepting connections to perform read-only queries.  When
+ * archive recovery is finished, the startup process exits with exit code 0
+ * and we switch to PM_RUN state.
+ *
+ * Normal child backends can only be launched when we are in PM_RUN or
+ * PM_HOT_STANDBY state.  (We also allow launch of normal
+ * child backends in PM_WAIT_BACKUP state, but only for superusers.)
+ * In other states we handle connection requests by launching "dead_end"
+ * child processes, which will simply send the client an error message and
+ * quit.  (We track these in the BackendList so that we can know when they
+ * are all gone; this is important because they're still connected to shared
+ * memory, and would interfere with an attempt to destroy the shmem segment,
+ * possibly leading to SHMALL failure when we try to make a new one.)
+ * In PM_WAIT_DEAD_END state we are waiting for all the dead_end children
+ * to drain out of the system, and therefore stop accepting connection
+ * requests at all until the last existing child has quit (which hopefully
+ * will not be very long).
+ *
+ * Notice that this state variable does not distinguish *why* we entered
+ * states later than PM_RUN --- Shutdown and FatalError must be consulted
+ * to find that out.  FatalError is never true in PM_RECOVERY_* or PM_RUN
+ * states, nor in PM_SHUTDOWN states (because we don't enter those states
+ * when trying to recover from a crash).  It can be true in PM_STARTUP state,
+ * because we don't clear it until we've successfully started WAL redo.
+ */
+typedef enum
+{
+	PM_INIT,					/* postmaster starting */
+	PM_STARTUP,					/* waiting for startup subprocess */
+	PM_RECOVERY,				/* in archive recovery mode */
+	PM_HOT_STANDBY,				/* in hot standby mode */
+	PM_RUN,						/* normal "database is alive" state */
+	PM_WAIT_BACKUP,				/* waiting for online backup mode to end */
+	PM_WAIT_READONLY,			/* waiting for read only backends to exit */
+	PM_WAIT_BACKENDS,			/* waiting for live backends to exit */
+	PM_SHUTDOWN,				/* waiting for checkpointer to do shutdown
+								 * ckpt */
+	PM_SHUTDOWN_2,				/* waiting for archiver and walsenders to
+								 * finish */
+	PM_WAIT_DEAD_END,			/* waiting for dead_end children to exit */
+	PM_NO_CHILDREN				/* all important children have exited */
+} PMState;
+
+
+
+/* Start time of SIGKILL timeout during immediate shutdown or child crash */
+/* Zero means timeout is not running */
+
+/* Length of said timeout */
+#define SIGKILL_CHILDREN_AFTER_SECS		5
+
+		/* T if we've reached PM_RUN */
+
+__thread bool		ClientAuthInProgress = false;
+		/* T during new-client
+												 * authentication */
+
+	/* stderr redirected for syslogger? */
+
+/* received START_AUTOVAC_LAUNCHER signal */
+
+
+/* the launcher needs to be signalled to communicate some condition */
+
+
+/* set when there's a worker that needs to be started up */
+
+
+
+/*
+ * State for assigning random salts and cancel keys.
+ * Also, the global MyCancelKey passes the cancel key assigned to a given
+ * backend from the postmaster to that backend (via fork).
+ */
+
+
+
+#ifdef USE_BONJOUR
+static DNSServiceRef bonjour_sdref = NULL;
+#endif
+
+/*
+ * postmaster.c - function prototypes
+ */
+static void CloseServerPorts(int status, Datum arg);
+static void unlink_external_pid_file(int status, Datum arg);
+static void getInstallationPaths(const char *argv0);
+static void checkDataDir(void);
+static Port *ConnCreate(int serverFd);
+static void ConnFree(Port *port);
+static void reset_shared(int port);
+static void SIGHUP_handler(SIGNAL_ARGS);
+static void pmdie(SIGNAL_ARGS);
+static void reaper(SIGNAL_ARGS);
+static void sigusr1_handler(SIGNAL_ARGS);
+static void startup_die(SIGNAL_ARGS);
+static void dummy_handler(SIGNAL_ARGS);
+static void StartupPacketTimeoutHandler(void);
+static void CleanupBackend(int pid, int exitstatus);
+static bool CleanupBackgroundWorker(int pid, int exitstatus);
+static void HandleChildCrash(int pid, int exitstatus, const char *procname);
+static void LogChildExit(int lev, const char *procname,
+			 int pid, int exitstatus);
+static void PostmasterStateMachine(void);
+static void BackendInitialize(Port *port);
+static void BackendRun(Port *port) pg_attribute_noreturn();
+static void ExitPostmaster(int status) pg_attribute_noreturn();
+static int	ServerLoop(void);
+static int	BackendStartup(Port *port);
+static int	ProcessStartupPacket(Port *port, bool SSLdone);
+static void processCancelRequest(Port *port, void *pkt);
+static int	initMasks(fd_set *rmask);
+static void report_fork_failure_to_client(Port *port, int errnum);
+static CAC_state canAcceptConnections(void);
+static long PostmasterRandom(void);
+static void RandomSalt(char *md5Salt);
+static void signal_child(pid_t pid, int signal);
+static bool SignalSomeChildren(int signal, int targets);
+static void TerminateChildren(int signal);
+
+#define SignalChildren(sig)			   SignalSomeChildren(sig, BACKEND_TYPE_ALL)
+
+static int	CountChildren(int target);
+static void maybe_start_bgworker(void);
+static bool CreateOptsFile(int argc, char *argv[], char *fullprogname);
+static pid_t StartChildProcess(AuxProcType type);
+static void StartAutovacuumWorker(void);
+static void InitPostmasterDeathWatchHandle(void);
+
+/*
+ * Archiver is allowed to start up at the current postmaster state?
+ *
+ * If WAL archiving is enabled always, we are allowed to start archiver
+ * even during recovery.
+ */
+#define PgArchStartupAllowed()	\
+	((XLogArchivingActive() && pmState == PM_RUN) ||	\
+	 (XLogArchivingAlways() &&	\
+	  (pmState == PM_RECOVERY || pmState == PM_HOT_STANDBY)))
+
+#ifdef EXEC_BACKEND
+
+#ifdef WIN32
+#define WNOHANG 0				/* ignored, so any integer value will do */
+
+static pid_t waitpid(pid_t pid, int *exitstatus, int options);
+static void WINAPI pgwin32_deadchild_callback(PVOID lpParameter, BOOLEAN TimerOrWaitFired);
+
+static HANDLE win32ChildQueue;
+
+typedef struct
+{
+	HANDLE		waitHandle;
+	HANDLE		procHandle;
+	DWORD		procId;
+} win32_deadchild_waitinfo;
+#endif   /* WIN32 */
+
+static pid_t backend_forkexec(Port *port);
+static pid_t internal_forkexec(int argc, char *argv[], Port *port);
+
+/* Type for a socket that can be inherited to a client process */
+#ifdef WIN32
+typedef struct
+{
+	SOCKET		origsocket;		/* Original socket value, or PGINVALID_SOCKET
+								 * if not a socket */
+	WSAPROTOCOL_INFO wsainfo;
+} InheritableSocket;
+#else
+typedef int InheritableSocket;
+#endif
+
+/*
+ * Structure contains all variables passed to exec:ed backends
+ */
+typedef struct
+{
+	Port		port;
+	InheritableSocket portsocket;
+	char		DataDir[MAXPGPATH];
+	pgsocket	ListenSocket[MAXLISTEN];
+	long		MyCancelKey;
+	int			MyPMChildSlot;
+#ifndef WIN32
+	unsigned long UsedShmemSegID;
+#else
+	HANDLE		UsedShmemSegID;
+#endif
+	void	   *UsedShmemSegAddr;
+	slock_t    *ShmemLock;
+	VariableCache ShmemVariableCache;
+	Backend    *ShmemBackendArray;
+#ifndef HAVE_SPINLOCKS
+	PGSemaphore SpinlockSemaArray;
+#endif
+	LWLockPadded *MainLWLockArray;
+	slock_t    *ProcStructLock;
+	PROC_HDR   *ProcGlobal;
+	PGPROC	   *AuxiliaryProcs;
+	PGPROC	   *PreparedXactProcs;
+	PMSignalData *PMSignalState;
+	InheritableSocket pgStatSock;
+	pid_t		PostmasterPid;
+	TimestampTz PgStartTime;
+	TimestampTz PgReloadTime;
+	pg_time_t	first_syslogger_file_time;
+	bool		redirection_done;
+	bool		IsBinaryUpgrade;
+	int			max_safe_fds;
+	int			MaxBackends;
+#ifdef WIN32
+	HANDLE		PostmasterHandle;
+	HANDLE		initial_signal_pipe;
+	HANDLE		syslogPipe[2];
+#else
+	int			postmaster_alive_fds[2];
+	int			syslogPipe[2];
+#endif
+	char		my_exec_path[MAXPGPATH];
+	char		pkglib_path[MAXPGPATH];
+	char		ExtraOptions[MAXPGPATH];
+} BackendParameters;
+
+static void read_backend_variables(char *id, Port *port);
+static void restore_backend_variables(BackendParameters *param, Port *port);
+
+#ifndef WIN32
+static bool save_backend_variables(BackendParameters *param, Port *port);
+#else
+static bool save_backend_variables(BackendParameters *param, Port *port,
+					   HANDLE childProcess, pid_t childPid);
+#endif
+
+static void ShmemBackendArrayAdd(Backend *bn);
+static void ShmemBackendArrayRemove(Backend *bn);
+#endif   /* EXEC_BACKEND */
+
+#define StartupDataBase()		StartChildProcess(StartupProcess)
+#define StartBackgroundWriter() StartChildProcess(BgWriterProcess)
+#define StartCheckpointer()		StartChildProcess(CheckpointerProcess)
+#define StartWalWriter()		StartChildProcess(WalWriterProcess)
+#define StartWalReceiver()		StartChildProcess(WalReceiverProcess)
+
+/* Macros to check exit status of a child process */
+#define EXIT_STATUS_0(st)  ((st) == 0)
+#define EXIT_STATUS_1(st)  (WIFEXITED(st) && WEXITSTATUS(st) == 1)
+#define EXIT_STATUS_3(st)  (WIFEXITED(st) && WEXITSTATUS(st) == 3)
+
+#ifndef WIN32
+/*
+ * File descriptors for pipe used to monitor if postmaster is alive.
+ * First is POSTMASTER_FD_WATCH, second is POSTMASTER_FD_OWN.
+ */
+
+#else
+/* Process handle of postmaster used for the same purpose on Windows */
+HANDLE		PostmasterHandle;
+#endif
+
+/*
+ * Postmaster main entry point
+ */
+#ifdef SIGXFSZ
+#endif
+#ifdef HAVE_INT_OPTRESET
+#endif
+#ifdef USE_SSL
+#endif
+#ifdef USE_BONJOUR
+#endif
+#ifdef HAVE_UNIX_SOCKETS
+#endif
+#ifdef WIN32
+#endif
+#ifdef EXEC_BACKEND
+#endif
+#ifdef HAVE_PTHREAD_IS_THREADED_NP
+#endif
+
+
+/*
+ * on_proc_exit callback to close server's listen sockets
+ */
+
+
+/*
+ * on_proc_exit callback to delete external_pid_file
+ */
+
+
+
+/*
+ * Compute and check the directory paths to files that are part of the
+ * installation (as deduced from the postgres executable's own location)
+ */
+#ifdef EXEC_BACKEND
+#endif
+
+
+/*
+ * Validate the proposed data directory
+ */
+#if !defined(WIN32) && !defined(__CYGWIN__)
+#endif
+#if !defined(WIN32) && !defined(__CYGWIN__)
+#endif
+
+/*
+ * Determine how long should we let ServerLoop sleep.
+ *
+ * In normal conditions we wait at most one minute, to ensure that the other
+ * background tasks handled by ServerLoop get done even when no requests are
+ * arriving.  However, if there are background workers waiting to be started,
+ * we don't actually sleep so that they are quickly serviced.  Other exception
+ * cases are as shown in the code.
+ */
+
+
+/*
+ * Main idle loop of postmaster
+ *
+ * NB: Needs to be called with signals blocked
+ */
+#ifdef HAVE_PTHREAD_IS_THREADED_NP
+#endif
+
+/*
+ * Initialise the masks for select() for the ports we are listening on.
+ * Return the number of sockets to listen on.
+ */
+
+
+
+/*
+ * Read a client's startup packet and do something according to it.
+ *
+ * Returns STATUS_OK or STATUS_ERROR, or might call ereport(FATAL) and
+ * not return at all.
+ *
+ * (Note that ereport(FATAL) stuff is sent to the client, so only use it
+ * if that's what you want.  Return STATUS_ERROR if you don't want to
+ * send anything to the client, which would typically be appropriate
+ * if we detect a communications failure.)
+ */
+#ifdef USE_SSL
+#else
+#endif
+#ifdef USE_SSL
+#endif
+
+
+/*
+ * The client has sent a cancel request packet, not a normal
+ * start-a-new-connection packet.  Perform the necessary processing.
+ * Nothing is sent back to the client.
+ */
+#ifndef EXEC_BACKEND
+#else
+#endif
+#ifndef EXEC_BACKEND
+#else
+#endif
+
+/*
+ * canAcceptConnections --- check to see if database state allows connections.
+ */
+
+
+
+/*
+ * ConnCreate -- create a local connection data structure
+ *
+ * Returns NULL on failure, other than out-of-memory which is fatal.
+ */
+#ifndef EXEC_BACKEND
+#if defined(ENABLE_GSS) || defined(ENABLE_SSPI)
+#endif
+#endif
+
+
+/*
+ * ConnFree -- free a local connection data structure
+ */
+#ifdef USE_SSL
+#endif
+
+
+/*
+ * ClosePostmasterPorts -- close all the postmaster's open sockets
+ *
+ * This is called during child process startup to release file descriptors
+ * that are not needed by that child process.  The postmaster still has
+ * them open, of course.
+ *
+ * Note: we pass am_syslogger as a boolean because we don't want to set
+ * the global variable yet when this is called.
+ */
+#ifndef WIN32
+#endif
+#ifndef WIN32
+#else
+#endif
+#ifdef USE_BONJOUR
+#endif
+
+
+/*
+ * reset_shared -- reset shared memory and semaphores
+ */
+
+
+
+/*
+ * SIGHUP -- reread config files, and tell children to do same
+ */
+#ifdef EXEC_BACKEND
+#endif
+
+
+/*
+ * pmdie -- signal handler for processing various postmaster signals.
+ */
+
+
+/*
+ * Reaper -- signal handler to cleanup after a child process dies.
+ */
+
+
+/*
+ * Scan the bgworkers list and see if the given PID (which has just stopped
+ * or crashed) is in it.  Handle its shutdown if so, and return true.  If not a
+ * bgworker, return false.
+ *
+ * This is heavily based on CleanupBackend.  One important difference is that
+ * we don't know yet that the dying process is a bgworker, so we must be silent
+ * until we're sure it is.
+ */
+#ifdef WIN32
+#endif
+#ifdef EXEC_BACKEND
+#endif
+
+/*
+ * CleanupBackend -- cleanup after terminated backend.
+ *
+ * Remove all local state associated with backend.
+ *
+ * If you change this, see also CleanupBackgroundWorker.
+ */
+#ifdef WIN32
+#endif
+#ifdef EXEC_BACKEND
+#endif
+
+/*
+ * HandleChildCrash -- cleanup after failed backend, bgwriter, checkpointer,
+ * walwriter, autovacuum, or background worker.
+ *
+ * The objectives here are to clean up our local state about the child
+ * process, and to signal all other remaining children to quickdie.
+ */
+#ifdef EXEC_BACKEND
+#endif
+#ifdef EXEC_BACKEND
+#endif
+
+/*
+ * Log the death of a child process.
+ */
+#if defined(WIN32)
+#else
+#endif
+
+/*
+ * Advance the postmaster's state machine and take actions as appropriate
+ *
+ * This is common code for pmdie(), reaper() and sigusr1_handler(), which
+ * receive the signals that might mean we need to change state.
+ */
+
+
+
+/*
+ * Send a signal to a postmaster child process
+ *
+ * On systems that have setsid(), each child process sets itself up as a
+ * process group leader.  For signals that are generally interpreted in the
+ * appropriate fashion, we signal the entire process group not just the
+ * direct child process.  This allows us to, for example, SIGQUIT a blocked
+ * archive_recovery script, or SIGINT a script being run by a backend via
+ * system().
+ *
+ * There is a race condition for recently-forked children: they might not
+ * have executed setsid() yet.  So we signal the child directly as well as
+ * the group.  We assume such a child will handle the signal before trying
+ * to spawn any grandchild processes.  We also assume that signaling the
+ * child twice will not cause any problems.
+ */
+#ifdef HAVE_SETSID
+#endif
+
+/*
+ * Send a signal to the targeted children (but NOT special children;
+ * dead_end children are never signaled, either).
+ */
+
+
+/*
+ * Send a termination signal to children.  This considers all of our children
+ * processes, except syslogger and dead_end backends.
+ */
+
+
+/*
+ * BackendStartup -- start backend process
+ *
+ * returns: STATUS_ERROR if the fork failed, STATUS_OK otherwise.
+ *
+ * Note: if you change this code, also consider StartAutovacuumWorker.
+ */
+#ifdef EXEC_BACKEND
+#else							/* !EXEC_BACKEND */
+#endif   /* EXEC_BACKEND */
+#ifdef EXEC_BACKEND
+#endif
+
+/*
+ * Try to report backend fork() failure to client before we close the
+ * connection.  Since we do not care to risk blocking the postmaster on
+ * this connection, we set the connection to non-blocking and try only once.
+ *
+ * This is grungy special-purpose code; we cannot use backend libpq since
+ * it's not up and running.
+ */
+
+
+
+/*
+ * BackendInitialize -- initialize an interactive (postmaster-child)
+ *				backend process, and collect the client's startup packet.
+ *
+ * returns: nothing.  Will not return at all if there's any failure.
+ *
+ * Note: this code does not depend on having any access to shared memory.
+ * In the EXEC_BACKEND case, we are physically attached to shared memory
+ * but have not yet set up most of our local pointers to shmem structures.
+ */
+
+
+
+/*
+ * BackendRun -- set up the backend's argument list and invoke PostgresMain()
+ *
+ * returns:
+ *		Shouldn't return at all.
+ *		If PostgresMain() fails, return status.
+ */
+
+
+
+#ifdef EXEC_BACKEND
+
+/*
+ * postmaster_forkexec -- fork and exec a postmaster subprocess
+ *
+ * The caller must have set up the argv array already, except for argv[2]
+ * which will be filled with the name of the temp variable file.
+ *
+ * Returns the child process PID, or -1 on fork failure (a suitable error
+ * message has been logged on failure).
+ *
+ * All uses of this routine will dispatch to SubPostmasterMain in the
+ * child process.
+ */
+pid_t
+postmaster_forkexec(int argc, char *argv[])
+{
+	Port		port;
+
+	/* This entry point passes dummy values for the Port variables */
+	memset(&port, 0, sizeof(port));
+	return internal_forkexec(argc, argv, &port);
+}
+
+/*
+ * backend_forkexec -- fork/exec off a backend process
+ *
+ * Some operating systems (WIN32) don't have fork() so we have to simulate
+ * it by storing parameters that need to be passed to the child and
+ * then create a new child process.
+ *
+ * returns the pid of the fork/exec'd process, or -1 on failure
+ */
+static pid_t
+backend_forkexec(Port *port)
+{
+	char	   *av[4];
+	int			ac = 0;
+
+	av[ac++] = "postgres";
+	av[ac++] = "--forkbackend";
+	av[ac++] = NULL;			/* filled in by internal_forkexec */
+
+	av[ac] = NULL;
+	Assert(ac < lengthof(av));
+
+	return internal_forkexec(ac, av, port);
+}
+
+#ifndef WIN32
+
+/*
+ * internal_forkexec non-win32 implementation
+ *
+ * - writes out backend variables to the parameter file
+ * - fork():s, and then exec():s the child process
+ */
+static pid_t
+internal_forkexec(int argc, char *argv[], Port *port)
+{
+	static unsigned long tmpBackendFileNum = 0;
+	pid_t		pid;
+	char		tmpfilename[MAXPGPATH];
+	BackendParameters param;
+	FILE	   *fp;
+
+	if (!save_backend_variables(&param, port))
+		return -1;				/* log made by save_backend_variables */
+
+	/* Calculate name for temp file */
+	snprintf(tmpfilename, MAXPGPATH, "%s/%s.backend_var.%d.%lu",
+			 PG_TEMP_FILES_DIR, PG_TEMP_FILE_PREFIX,
+			 MyProcPid, ++tmpBackendFileNum);
+
+	/* Open file */
+	fp = AllocateFile(tmpfilename, PG_BINARY_W);
+	if (!fp)
+	{
+		/*
+		 * As in OpenTemporaryFileInTablespace, try to make the temp-file
+		 * directory
+		 */
+		mkdir(PG_TEMP_FILES_DIR, S_IRWXU);
+
+		fp = AllocateFile(tmpfilename, PG_BINARY_W);
+		if (!fp)
+		{
+			ereport(LOG,
+					(errcode_for_file_access(),
+					 errmsg("could not create file \"%s\": %m",
+							tmpfilename)));
+			return -1;
+		}
+	}
+
+	if (fwrite(&param, sizeof(param), 1, fp) != 1)
+	{
+		ereport(LOG,
+				(errcode_for_file_access(),
+				 errmsg("could not write to file \"%s\": %m", tmpfilename)));
+		FreeFile(fp);
+		return -1;
+	}
+
+	/* Release file */
+	if (FreeFile(fp))
+	{
+		ereport(LOG,
+				(errcode_for_file_access(),
+				 errmsg("could not write to file \"%s\": %m", tmpfilename)));
+		return -1;
+	}
+
+	/* Make sure caller set up argv properly */
+	Assert(argc >= 3);
+	Assert(argv[argc] == NULL);
+	Assert(strncmp(argv[1], "--fork", 6) == 0);
+	Assert(argv[2] == NULL);
+
+	/* Insert temp file name after --fork argument */
+	argv[2] = tmpfilename;
+
+	/* Fire off execv in child */
+	if ((pid = fork_process()) == 0)
+	{
+		if (execv(postgres_exec_path, argv) < 0)
+		{
+			ereport(LOG,
+					(errmsg("could not execute server process \"%s\": %m",
+							postgres_exec_path)));
+			/* We're already in the child process here, can't return */
+			exit(1);
+		}
+	}
+
+	return pid;					/* Parent returns pid, or -1 on fork failure */
+}
+#else							/* WIN32 */
+
+/*
+ * internal_forkexec win32 implementation
+ *
+ * - starts backend using CreateProcess(), in suspended state
+ * - writes out backend variables to the parameter file
+ *	- during this, duplicates handles and sockets required for
+ *	  inheritance into the new process
+ * - resumes execution of the new process once the backend parameter
+ *	 file is complete.
+ */
+static pid_t
+internal_forkexec(int argc, char *argv[], Port *port)
+{
+	STARTUPINFO si;
+	PROCESS_INFORMATION pi;
+	int			i;
+	int			j;
+	char		cmdLine[MAXPGPATH * 2];
+	HANDLE		paramHandle;
+	BackendParameters *param;
+	SECURITY_ATTRIBUTES sa;
+	char		paramHandleStr[32];
+	win32_deadchild_waitinfo *childinfo;
+
+	/* Make sure caller set up argv properly */
+	Assert(argc >= 3);
+	Assert(argv[argc] == NULL);
+	Assert(strncmp(argv[1], "--fork", 6) == 0);
+	Assert(argv[2] == NULL);
+
+	/* Set up shared memory for parameter passing */
+	ZeroMemory(&sa, sizeof(sa));
+	sa.nLength = sizeof(sa);
+	sa.bInheritHandle = TRUE;
+	paramHandle = CreateFileMapping(INVALID_HANDLE_VALUE,
+									&sa,
+									PAGE_READWRITE,
+									0,
+									sizeof(BackendParameters),
+									NULL);
+	if (paramHandle == INVALID_HANDLE_VALUE)
+	{
+		elog(LOG, "could not create backend parameter file mapping: error code %lu",
+			 GetLastError());
+		return -1;
+	}
+
+	param = MapViewOfFile(paramHandle, FILE_MAP_WRITE, 0, 0, sizeof(BackendParameters));
+	if (!param)
+	{
+		elog(LOG, "could not map backend parameter memory: error code %lu",
+			 GetLastError());
+		CloseHandle(paramHandle);
+		return -1;
+	}
+
+	/* Insert temp file name after --fork argument */
+#ifdef _WIN64
+	sprintf(paramHandleStr, "%llu", (LONG_PTR) paramHandle);
+#else
+	sprintf(paramHandleStr, "%lu", (DWORD) paramHandle);
+#endif
+	argv[2] = paramHandleStr;
+
+	/* Format the cmd line */
+	cmdLine[sizeof(cmdLine) - 1] = '\0';
+	cmdLine[sizeof(cmdLine) - 2] = '\0';
+	snprintf(cmdLine, sizeof(cmdLine) - 1, "\"%s\"", postgres_exec_path);
+	i = 0;
+	while (argv[++i] != NULL)
+	{
+		j = strlen(cmdLine);
+		snprintf(cmdLine + j, sizeof(cmdLine) - 1 - j, " \"%s\"", argv[i]);
+	}
+	if (cmdLine[sizeof(cmdLine) - 2] != '\0')
+	{
+		elog(LOG, "subprocess command line too long");
+		return -1;
+	}
+
+	memset(&pi, 0, sizeof(pi));
+	memset(&si, 0, sizeof(si));
+	si.cb = sizeof(si);
+
+	/*
+	 * Create the subprocess in a suspended state. This will be resumed later,
+	 * once we have written out the parameter file.
+	 */
+	if (!CreateProcess(NULL, cmdLine, NULL, NULL, TRUE, CREATE_SUSPENDED,
+					   NULL, NULL, &si, &pi))
+	{
+		elog(LOG, "CreateProcess call failed: %m (error code %lu)",
+			 GetLastError());
+		return -1;
+	}
+
+	if (!save_backend_variables(param, port, pi.hProcess, pi.dwProcessId))
+	{
+		/*
+		 * log made by save_backend_variables, but we have to clean up the
+		 * mess with the half-started process
+		 */
+		if (!TerminateProcess(pi.hProcess, 255))
+			ereport(LOG,
+					(errmsg_internal("could not terminate unstarted process: error code %lu",
+									 GetLastError())));
+		CloseHandle(pi.hProcess);
+		CloseHandle(pi.hThread);
+		return -1;				/* log made by save_backend_variables */
+	}
+
+	/* Drop the parameter shared memory that is now inherited to the backend */
+	if (!UnmapViewOfFile(param))
+		elog(LOG, "could not unmap view of backend parameter file: error code %lu",
+			 GetLastError());
+	if (!CloseHandle(paramHandle))
+		elog(LOG, "could not close handle to backend parameter file: error code %lu",
+			 GetLastError());
+
+	/*
+	 * Reserve the memory region used by our main shared memory segment before
+	 * we resume the child process.
+	 */
+	if (!pgwin32_ReserveSharedMemoryRegion(pi.hProcess))
+	{
+		/*
+		 * Failed to reserve the memory, so terminate the newly created
+		 * process and give up.
+		 */
+		if (!TerminateProcess(pi.hProcess, 255))
+			ereport(LOG,
+					(errmsg_internal("could not terminate process that failed to reserve memory: error code %lu",
+									 GetLastError())));
+		CloseHandle(pi.hProcess);
+		CloseHandle(pi.hThread);
+		return -1;				/* logging done made by
+								 * pgwin32_ReserveSharedMemoryRegion() */
+	}
+
+	/*
+	 * Now that the backend variables are written out, we start the child
+	 * thread so it can start initializing while we set up the rest of the
+	 * parent state.
+	 */
+	if (ResumeThread(pi.hThread) == -1)
+	{
+		if (!TerminateProcess(pi.hProcess, 255))
+		{
+			ereport(LOG,
+					(errmsg_internal("could not terminate unstartable process: error code %lu",
+									 GetLastError())));
+			CloseHandle(pi.hProcess);
+			CloseHandle(pi.hThread);
+			return -1;
+		}
+		CloseHandle(pi.hProcess);
+		CloseHandle(pi.hThread);
+		ereport(LOG,
+				(errmsg_internal("could not resume thread of unstarted process: error code %lu",
+								 GetLastError())));
+		return -1;
+	}
+
+	/*
+	 * Queue a waiter for to signal when this child dies. The wait will be
+	 * handled automatically by an operating system thread pool.
+	 *
+	 * Note: use malloc instead of palloc, since it needs to be thread-safe.
+	 * Struct will be free():d from the callback function that runs on a
+	 * different thread.
+	 */
+	childinfo = malloc(sizeof(win32_deadchild_waitinfo));
+	if (!childinfo)
+		ereport(FATAL,
+				(errcode(ERRCODE_OUT_OF_MEMORY),
+				 errmsg("out of memory")));
+
+	childinfo->procHandle = pi.hProcess;
+	childinfo->procId = pi.dwProcessId;
+
+	if (!RegisterWaitForSingleObject(&childinfo->waitHandle,
+									 pi.hProcess,
+									 pgwin32_deadchild_callback,
+									 childinfo,
+									 INFINITE,
+								WT_EXECUTEONLYONCE | WT_EXECUTEINWAITTHREAD))
+		ereport(FATAL,
+				(errmsg_internal("could not register process for wait: error code %lu",
+								 GetLastError())));
+
+	/* Don't close pi.hProcess here - the wait thread needs access to it */
+
+	CloseHandle(pi.hThread);
+
+	return pi.dwProcessId;
+}
+#endif   /* WIN32 */
+
+
+/*
+ * SubPostmasterMain -- Get the fork/exec'd process into a state equivalent
+ *			to what it would be if we'd simply forked on Unix, and then
+ *			dispatch to the appropriate place.
+ *
+ * The first two command line arguments are expected to be "--forkFOO"
+ * (where FOO indicates which postmaster child we are to become), and
+ * the name of a variables file that we can read to load data that would
+ * have been inherited by fork() on Unix.  Remaining arguments go to the
+ * subprocess FooMain() routine.
+ */
+void
+SubPostmasterMain(int argc, char *argv[])
+{
+	Port		port;
+
+	/* In EXEC_BACKEND case we will not have inherited these settings */
+	IsPostmasterEnvironment = true;
+	whereToSendOutput = DestNone;
+
+	/* Setup as postmaster child */
+	InitPostmasterChild();
+
+	/* Setup essential subsystems (to ensure elog() behaves sanely) */
+	InitializeGUCOptions();
+
+	/* Read in the variables file */
+	memset(&port, 0, sizeof(Port));
+	read_backend_variables(argv[2], &port);
+
+	/*
+	 * Set reference point for stack-depth checking
+	 */
+	set_stack_base();
+
+	/*
+	 * Set up memory area for GSS information. Mirrors the code in ConnCreate
+	 * for the non-exec case.
+	 */
+#if defined(ENABLE_GSS) || defined(ENABLE_SSPI)
+	port.gss = (pg_gssinfo *) calloc(1, sizeof(pg_gssinfo));
+	if (!port.gss)
+		ereport(FATAL,
+				(errcode(ERRCODE_OUT_OF_MEMORY),
+				 errmsg("out of memory")));
+#endif
+
+	/* Check we got appropriate args */
+	if (argc < 3)
+		elog(FATAL, "invalid subpostmaster invocation");
+
+	/*
+	 * If appropriate, physically re-attach to shared memory segment. We want
+	 * to do this before going any further to ensure that we can attach at the
+	 * same address the postmaster used.  On the other hand, if we choose not
+	 * to re-attach, we may have other cleanup to do.
+	 */
+	if (strcmp(argv[1], "--forkbackend") == 0 ||
+		strcmp(argv[1], "--forkavlauncher") == 0 ||
+		strcmp(argv[1], "--forkavworker") == 0 ||
+		strcmp(argv[1], "--forkboot") == 0 ||
+		strncmp(argv[1], "--forkbgworker=", 15) == 0)
+		PGSharedMemoryReAttach();
+	else
+		PGSharedMemoryNoReAttach();
+
+	/* autovacuum needs this set before calling InitProcess */
+	if (strcmp(argv[1], "--forkavlauncher") == 0)
+		AutovacuumLauncherIAm();
+	if (strcmp(argv[1], "--forkavworker") == 0)
+		AutovacuumWorkerIAm();
+
+	/*
+	 * Start our win32 signal implementation. This has to be done after we
+	 * read the backend variables, because we need to pick up the signal pipe
+	 * from the parent process.
+	 */
+#ifdef WIN32
+	pgwin32_signal_initialize();
+#endif
+
+	/* In EXEC_BACKEND case we will not have inherited these settings */
+	pqinitmask();
+	PG_SETMASK(&BlockSig);
+
+	/* Read in remaining GUC variables */
+	read_nondefault_variables();
+
+	/*
+	 * Reload any libraries that were preloaded by the postmaster.  Since we
+	 * exec'd this process, those libraries didn't come along with us; but we
+	 * should load them into all child processes to be consistent with the
+	 * non-EXEC_BACKEND behavior.
+	 */
+	process_shared_preload_libraries();
+
+	/* Run backend or appropriate child */
+	if (strcmp(argv[1], "--forkbackend") == 0)
+	{
+		Assert(argc == 3);		/* shouldn't be any more args */
+
+		/* Close the postmaster's sockets */
+		ClosePostmasterPorts(false);
+
+		/*
+		 * Need to reinitialize the SSL library in the backend, since the
+		 * context structures contain function pointers and cannot be passed
+		 * through the parameter file.
+		 *
+		 * XXX should we do this in all child processes?  For the moment it's
+		 * enough to do it in backend children.
+		 */
+#ifdef USE_SSL
+		if (EnableSSL)
+			secure_initialize();
+#endif
+
+		/*
+		 * Perform additional initialization and collect startup packet.
+		 *
+		 * We want to do this before InitProcess() for a couple of reasons: 1.
+		 * so that we aren't eating up a PGPROC slot while waiting on the
+		 * client. 2. so that if InitProcess() fails due to being out of
+		 * PGPROC slots, we have already initialized libpq and are able to
+		 * report the error to the client.
+		 */
+		BackendInitialize(&port);
+
+		/* Restore basic shared memory pointers */
+		InitShmemAccess(UsedShmemSegAddr);
+
+		/* Need a PGPROC to run CreateSharedMemoryAndSemaphores */
+		InitProcess();
+
+		/*
+		 * Attach process to shared data structures.  If testing EXEC_BACKEND
+		 * on Linux, you must run this as root before starting the postmaster:
+		 *
+		 * echo 0 >/proc/sys/kernel/randomize_va_space
+		 *
+		 * This prevents a randomized stack base address that causes child
+		 * shared memory to be at a different address than the parent, making
+		 * it impossible to attached to shared memory.  Return the value to
+		 * '1' when finished.
+		 */
+		CreateSharedMemoryAndSemaphores(false, 0);
+
+		/* And run the backend */
+		BackendRun(&port);		/* does not return */
+	}
+	if (strcmp(argv[1], "--forkboot") == 0)
+	{
+		/* Close the postmaster's sockets */
+		ClosePostmasterPorts(false);
+
+		/* Restore basic shared memory pointers */
+		InitShmemAccess(UsedShmemSegAddr);
+
+		/* Need a PGPROC to run CreateSharedMemoryAndSemaphores */
+		InitAuxiliaryProcess();
+
+		/* Attach process to shared data structures */
+		CreateSharedMemoryAndSemaphores(false, 0);
+
+		AuxiliaryProcessMain(argc - 2, argv + 2);		/* does not return */
+	}
+	if (strcmp(argv[1], "--forkavlauncher") == 0)
+	{
+		/* Close the postmaster's sockets */
+		ClosePostmasterPorts(false);
+
+		/* Restore basic shared memory pointers */
+		InitShmemAccess(UsedShmemSegAddr);
+
+		/* Need a PGPROC to run CreateSharedMemoryAndSemaphores */
+		InitProcess();
+
+		/* Attach process to shared data structures */
+		CreateSharedMemoryAndSemaphores(false, 0);
+
+		AutoVacLauncherMain(argc - 2, argv + 2);		/* does not return */
+	}
+	if (strcmp(argv[1], "--forkavworker") == 0)
+	{
+		/* Close the postmaster's sockets */
+		ClosePostmasterPorts(false);
+
+		/* Restore basic shared memory pointers */
+		InitShmemAccess(UsedShmemSegAddr);
+
+		/* Need a PGPROC to run CreateSharedMemoryAndSemaphores */
+		InitProcess();
+
+		/* Attach process to shared data structures */
+		CreateSharedMemoryAndSemaphores(false, 0);
+
+		AutoVacWorkerMain(argc - 2, argv + 2);	/* does not return */
+	}
+	if (strncmp(argv[1], "--forkbgworker=", 15) == 0)
+	{
+		int			shmem_slot;
+
+		/* do this as early as possible; in particular, before InitProcess() */
+		IsBackgroundWorker = true;
+
+		InitPostmasterChild();
+
+		/* Close the postmaster's sockets */
+		ClosePostmasterPorts(false);
+
+		/* Restore basic shared memory pointers */
+		InitShmemAccess(UsedShmemSegAddr);
+
+		/* Need a PGPROC to run CreateSharedMemoryAndSemaphores */
+		InitProcess();
+
+		/* Attach process to shared data structures */
+		CreateSharedMemoryAndSemaphores(false, 0);
+
+		shmem_slot = atoi(argv[1] + 15);
+		MyBgworkerEntry = BackgroundWorkerEntry(shmem_slot);
+		StartBackgroundWorker();
+	}
+	if (strcmp(argv[1], "--forkarch") == 0)
+	{
+		/* Close the postmaster's sockets */
+		ClosePostmasterPorts(false);
+
+		/* Do not want to attach to shared memory */
+
+		PgArchiverMain(argc, argv);		/* does not return */
+	}
+	if (strcmp(argv[1], "--forkcol") == 0)
+	{
+		/* Close the postmaster's sockets */
+		ClosePostmasterPorts(false);
+
+		/* Do not want to attach to shared memory */
+
+		PgstatCollectorMain(argc, argv);		/* does not return */
+	}
+	if (strcmp(argv[1], "--forklog") == 0)
+	{
+		/* Close the postmaster's sockets */
+		ClosePostmasterPorts(true);
+
+		/* Do not want to attach to shared memory */
+
+		SysLoggerMain(argc, argv);		/* does not return */
+	}
+
+	abort();					/* shouldn't get here */
+}
+#endif   /* EXEC_BACKEND */
+
+
+/*
+ * ExitPostmaster -- cleanup
+ *
+ * Do NOT call exit() directly --- always go through here!
+ */
+#ifdef HAVE_PTHREAD_IS_THREADED_NP
+#endif
+
+/*
+ * sigusr1_handler - handle signal conditions from child processes
+ */
+
+
+/*
+ * SIGTERM or SIGQUIT while processing startup packet.
+ * Clean up and exit(1).
+ *
+ * XXX: possible future improvement: try to send a message indicating
+ * why we are disconnecting.  Problem is to be sure we don't block while
+ * doing so, nor mess up SSL initialization.  In practice, if the client
+ * has wedged here, it probably couldn't do anything with the message anyway.
+ */
+
+
+/*
+ * Dummy signal handler
+ *
+ * We use this for signals that we don't actually use in the postmaster,
+ * but we do use in backends.  If we were to SIG_IGN such signals in the
+ * postmaster, then a newly started backend might drop a signal that arrives
+ * before it's able to reconfigure its signal processing.  (See notes in
+ * tcop/postgres.c.)
+ */
+
+
+/*
+ * Timeout while processing startup packet.
+ * As for startup_die(), we clean up and exit(1).
+ */
+
+
+
+/*
+ * RandomSalt
+ */
+
+
+/*
+ * PostmasterRandom
+ */
+
+
+/*
+ * Count up number of child processes of specified types (dead_end chidren
+ * are always excluded).
+ */
+
+
+
+/*
+ * StartChildProcess -- start an auxiliary process for the postmaster
+ *
+ * xlop determines what kind of child will be started.  All child types
+ * initially go to AuxiliaryProcessMain, which will handle common setup.
+ *
+ * Return value of StartChildProcess is subprocess' PID, or 0 if failed
+ * to start subprocess.
+ */
+#ifdef EXEC_BACKEND
+#endif
+#ifdef EXEC_BACKEND
+#else							/* !EXEC_BACKEND */
+#endif   /* EXEC_BACKEND */
+
+/*
+ * StartAutovacuumWorker
+ *		Start an autovac worker process.
+ *
+ * This function is here because it enters the resulting PID into the
+ * postmaster's private backends list.
+ *
+ * NB -- this code very roughly matches BackendStartup.
+ */
+#ifdef EXEC_BACKEND
+#endif
+
+/*
+ * Create the opts file
+ */
+#define OPTS_FILE	"postmaster.opts"
+
+
+/*
+ * MaxLivePostmasterChildren
+ *
+ * This reports the number of entries needed in per-child-process arrays
+ * (the PMChildFlags array, and if EXEC_BACKEND the ShmemBackendArray).
+ * These arrays include regular backends, autovac workers, walsenders
+ * and background workers, but not special children nor dead_end children.
+ * This allows the arrays to have a fixed maximum size, to wit the same
+ * too-many-children limit enforced by canAcceptConnections().  The exact value
+ * isn't too critical as long as it's more than MaxBackends.
+ */
+
+
+/*
+ * Connect background worker to a database.
+ */
+
+
+/*
+ * Connect background worker to a database using OIDs.
+ */
+
+
+/*
+ * Block/unblock signals in a background worker
+ */
+
+
+
+
+#ifdef EXEC_BACKEND
+static pid_t
+bgworker_forkexec(int shmem_slot)
+{
+	char	   *av[10];
+	int			ac = 0;
+	char		forkav[MAXPGPATH];
+
+	snprintf(forkav, MAXPGPATH, "--forkbgworker=%d", shmem_slot);
+
+	av[ac++] = "postgres";
+	av[ac++] = forkav;
+	av[ac++] = NULL;			/* filled in by postmaster_forkexec */
+	av[ac] = NULL;
+
+	Assert(ac < lengthof(av));
+
+	return postmaster_forkexec(ac, av);
+}
+#endif
+
+/*
+ * Start a new bgworker.
+ * Starting time conditions must have been checked already.
+ *
+ * This code is heavily based on autovacuum.c, q.v.
+ */
+#ifdef EXEC_BACKEND
+#else
+#endif
+#ifndef EXEC_BACKEND
+#endif
+
+/*
+ * Does the current postmaster state require starting a worker with the
+ * specified start_time?
+ */
+
+
+/*
+ * Allocate the Backend struct for a connected background worker, but don't
+ * add it to the list of backends just yet.
+ *
+ * Some info from the Backend is copied into the passed rw.
+ */
+
+
+/*
+ * If the time is right, start one background worker.
+ *
+ * As a side effect, the bgworker control variables are set or reset whenever
+ * there are more workers to start after this one, and whenever the overall
+ * system state requires it.
+ */
+#ifdef EXEC_BACKEND
+#endif
+
+/*
+ * When a backend asks to be notified about worker state changes, we
+ * set a flag in its backend entry.  The background worker machinery needs
+ * to know when such backends exit.
+ */
+
+
+#ifdef EXEC_BACKEND
+
+/*
+ * The following need to be available to the save/restore_backend_variables
+ * functions.  They are marked NON_EXEC_STATIC in their home modules.
+ */
+extern slock_t *ShmemLock;
+extern slock_t *ProcStructLock;
+extern PGPROC *AuxiliaryProcs;
+extern PMSignalData *PMSignalState;
+extern pgsocket pgStatSock;
+extern pg_time_t first_syslogger_file_time;
+
+#ifndef WIN32
+#define write_inheritable_socket(dest, src, childpid) ((*(dest) = (src)), true)
+#define read_inheritable_socket(dest, src) (*(dest) = *(src))
+#else
+static bool write_duplicated_handle(HANDLE *dest, HANDLE src, HANDLE child);
+static bool write_inheritable_socket(InheritableSocket *dest, SOCKET src,
+						 pid_t childPid);
+static void read_inheritable_socket(SOCKET *dest, InheritableSocket *src);
+#endif
+
+
+/* Save critical backend variables into the BackendParameters struct */
+#ifndef WIN32
+static bool
+save_backend_variables(BackendParameters *param, Port *port)
+#else
+static bool
+save_backend_variables(BackendParameters *param, Port *port,
+					   HANDLE childProcess, pid_t childPid)
+#endif
+{
+	memcpy(&param->port, port, sizeof(Port));
+	if (!write_inheritable_socket(&param->portsocket, port->sock, childPid))
+		return false;
+
+	strlcpy(param->DataDir, DataDir, MAXPGPATH);
+
+	memcpy(&param->ListenSocket, &ListenSocket, sizeof(ListenSocket));
+
+	param->MyCancelKey = MyCancelKey;
+	param->MyPMChildSlot = MyPMChildSlot;
+
+	param->UsedShmemSegID = UsedShmemSegID;
+	param->UsedShmemSegAddr = UsedShmemSegAddr;
+
+	param->ShmemLock = ShmemLock;
+	param->ShmemVariableCache = ShmemVariableCache;
+	param->ShmemBackendArray = ShmemBackendArray;
+
+#ifndef HAVE_SPINLOCKS
+	param->SpinlockSemaArray = SpinlockSemaArray;
+#endif
+	param->MainLWLockArray = MainLWLockArray;
+	param->ProcStructLock = ProcStructLock;
+	param->ProcGlobal = ProcGlobal;
+	param->AuxiliaryProcs = AuxiliaryProcs;
+	param->PreparedXactProcs = PreparedXactProcs;
+	param->PMSignalState = PMSignalState;
+	if (!write_inheritable_socket(&param->pgStatSock, pgStatSock, childPid))
+		return false;
+
+	param->PostmasterPid = PostmasterPid;
+	param->PgStartTime = PgStartTime;
+	param->PgReloadTime = PgReloadTime;
+	param->first_syslogger_file_time = first_syslogger_file_time;
+
+	param->redirection_done = redirection_done;
+	param->IsBinaryUpgrade = IsBinaryUpgrade;
+	param->max_safe_fds = max_safe_fds;
+
+	param->MaxBackends = MaxBackends;
+
+#ifdef WIN32
+	param->PostmasterHandle = PostmasterHandle;
+	if (!write_duplicated_handle(&param->initial_signal_pipe,
+								 pgwin32_create_signal_listener(childPid),
+								 childProcess))
+		return false;
+#else
+	memcpy(&param->postmaster_alive_fds, &postmaster_alive_fds,
+		   sizeof(postmaster_alive_fds));
+#endif
+
+	memcpy(&param->syslogPipe, &syslogPipe, sizeof(syslogPipe));
+
+	strlcpy(param->my_exec_path, my_exec_path, MAXPGPATH);
+
+	strlcpy(param->pkglib_path, pkglib_path, MAXPGPATH);
+
+	strlcpy(param->ExtraOptions, ExtraOptions, MAXPGPATH);
+
+	return true;
+}
+
+
+#ifdef WIN32
+/*
+ * Duplicate a handle for usage in a child process, and write the child
+ * process instance of the handle to the parameter file.
+ */
+static bool
+write_duplicated_handle(HANDLE *dest, HANDLE src, HANDLE childProcess)
+{
+	HANDLE		hChild = INVALID_HANDLE_VALUE;
+
+	if (!DuplicateHandle(GetCurrentProcess(),
+						 src,
+						 childProcess,
+						 &hChild,
+						 0,
+						 TRUE,
+						 DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS))
+	{
+		ereport(LOG,
+				(errmsg_internal("could not duplicate handle to be written to backend parameter file: error code %lu",
+								 GetLastError())));
+		return false;
+	}
+
+	*dest = hChild;
+	return true;
+}
+
+/*
+ * Duplicate a socket for usage in a child process, and write the resulting
+ * structure to the parameter file.
+ * This is required because a number of LSPs (Layered Service Providers) very
+ * common on Windows (antivirus, firewalls, download managers etc) break
+ * straight socket inheritance.
+ */
+static bool
+write_inheritable_socket(InheritableSocket *dest, SOCKET src, pid_t childpid)
+{
+	dest->origsocket = src;
+	if (src != 0 && src != PGINVALID_SOCKET)
+	{
+		/* Actual socket */
+		if (WSADuplicateSocket(src, childpid, &dest->wsainfo) != 0)
+		{
+			ereport(LOG,
+					(errmsg("could not duplicate socket %d for use in backend: error code %d",
+							(int) src, WSAGetLastError())));
+			return false;
+		}
+	}
+	return true;
+}
+
+/*
+ * Read a duplicate socket structure back, and get the socket descriptor.
+ */
+static void
+read_inheritable_socket(SOCKET *dest, InheritableSocket *src)
+{
+	SOCKET		s;
+
+	if (src->origsocket == PGINVALID_SOCKET || src->origsocket == 0)
+	{
+		/* Not a real socket! */
+		*dest = src->origsocket;
+	}
+	else
+	{
+		/* Actual socket, so create from structure */
+		s = WSASocket(FROM_PROTOCOL_INFO,
+					  FROM_PROTOCOL_INFO,
+					  FROM_PROTOCOL_INFO,
+					  &src->wsainfo,
+					  0,
+					  0);
+		if (s == INVALID_SOCKET)
+		{
+			write_stderr("could not create inherited socket: error code %d\n",
+						 WSAGetLastError());
+			exit(1);
+		}
+		*dest = s;
+
+		/*
+		 * To make sure we don't get two references to the same socket, close
+		 * the original one. (This would happen when inheritance actually
+		 * works..
+		 */
+		closesocket(src->origsocket);
+	}
+}
+#endif
+
+static void
+read_backend_variables(char *id, Port *port)
+{
+	BackendParameters param;
+
+#ifndef WIN32
+	/* Non-win32 implementation reads from file */
+	FILE	   *fp;
+
+	/* Open file */
+	fp = AllocateFile(id, PG_BINARY_R);
+	if (!fp)
+	{
+		write_stderr("could not open backend variables file \"%s\": %s\n",
+					 id, strerror(errno));
+		exit(1);
+	}
+
+	if (fread(&param, sizeof(param), 1, fp) != 1)
+	{
+		write_stderr("could not read from backend variables file \"%s\": %s\n",
+					 id, strerror(errno));
+		exit(1);
+	}
+
+	/* Release file */
+	FreeFile(fp);
+	if (unlink(id) != 0)
+	{
+		write_stderr("could not remove file \"%s\": %s\n",
+					 id, strerror(errno));
+		exit(1);
+	}
+#else
+	/* Win32 version uses mapped file */
+	HANDLE		paramHandle;
+	BackendParameters *paramp;
+
+#ifdef _WIN64
+	paramHandle = (HANDLE) _atoi64(id);
+#else
+	paramHandle = (HANDLE) atol(id);
+#endif
+	paramp = MapViewOfFile(paramHandle, FILE_MAP_READ, 0, 0, 0);
+	if (!paramp)
+	{
+		write_stderr("could not map view of backend variables: error code %lu\n",
+					 GetLastError());
+		exit(1);
+	}
+
+	memcpy(&param, paramp, sizeof(BackendParameters));
+
+	if (!UnmapViewOfFile(paramp))
+	{
+		write_stderr("could not unmap view of backend variables: error code %lu\n",
+					 GetLastError());
+		exit(1);
+	}
+
+	if (!CloseHandle(paramHandle))
+	{
+		write_stderr("could not close handle to backend parameter variables: error code %lu\n",
+					 GetLastError());
+		exit(1);
+	}
+#endif
+
+	restore_backend_variables(&param, port);
+}
+
+/* Restore critical backend variables from the BackendParameters struct */
+static void
+restore_backend_variables(BackendParameters *param, Port *port)
+{
+	memcpy(port, &param->port, sizeof(Port));
+	read_inheritable_socket(&port->sock, &param->portsocket);
+
+	SetDataDir(param->DataDir);
+
+	memcpy(&ListenSocket, &param->ListenSocket, sizeof(ListenSocket));
+
+	MyCancelKey = param->MyCancelKey;
+	MyPMChildSlot = param->MyPMChildSlot;
+
+	UsedShmemSegID = param->UsedShmemSegID;
+	UsedShmemSegAddr = param->UsedShmemSegAddr;
+
+	ShmemLock = param->ShmemLock;
+	ShmemVariableCache = param->ShmemVariableCache;
+	ShmemBackendArray = param->ShmemBackendArray;
+
+#ifndef HAVE_SPINLOCKS
+	SpinlockSemaArray = param->SpinlockSemaArray;
+#endif
+	MainLWLockArray = param->MainLWLockArray;
+	ProcStructLock = param->ProcStructLock;
+	ProcGlobal = param->ProcGlobal;
+	AuxiliaryProcs = param->AuxiliaryProcs;
+	PreparedXactProcs = param->PreparedXactProcs;
+	PMSignalState = param->PMSignalState;
+	read_inheritable_socket(&pgStatSock, &param->pgStatSock);
+
+	PostmasterPid = param->PostmasterPid;
+	PgStartTime = param->PgStartTime;
+	PgReloadTime = param->PgReloadTime;
+	first_syslogger_file_time = param->first_syslogger_file_time;
+
+	redirection_done = param->redirection_done;
+	IsBinaryUpgrade = param->IsBinaryUpgrade;
+	max_safe_fds = param->max_safe_fds;
+
+	MaxBackends = param->MaxBackends;
+
+#ifdef WIN32
+	PostmasterHandle = param->PostmasterHandle;
+	pgwin32_initial_signal_pipe = param->initial_signal_pipe;
+#else
+	memcpy(&postmaster_alive_fds, &param->postmaster_alive_fds,
+		   sizeof(postmaster_alive_fds));
+#endif
+
+	memcpy(&syslogPipe, &param->syslogPipe, sizeof(syslogPipe));
+
+	strlcpy(my_exec_path, param->my_exec_path, MAXPGPATH);
+
+	strlcpy(pkglib_path, param->pkglib_path, MAXPGPATH);
+
+	strlcpy(ExtraOptions, param->ExtraOptions, MAXPGPATH);
+}
+
+
+Size
+ShmemBackendArraySize(void)
+{
+	return mul_size(MaxLivePostmasterChildren(), sizeof(Backend));
+}
+
+void
+ShmemBackendArrayAllocation(void)
+{
+	Size		size = ShmemBackendArraySize();
+
+	ShmemBackendArray = (Backend *) ShmemAlloc(size);
+	/* Mark all slots as empty */
+	memset(ShmemBackendArray, 0, size);
+}
+
+static void
+ShmemBackendArrayAdd(Backend *bn)
+{
+	/* The array slot corresponding to my PMChildSlot should be free */
+	int			i = bn->child_slot - 1;
+
+	Assert(ShmemBackendArray[i].pid == 0);
+	ShmemBackendArray[i] = *bn;
+}
+
+static void
+ShmemBackendArrayRemove(Backend *bn)
+{
+	int			i = bn->child_slot - 1;
+
+	Assert(ShmemBackendArray[i].pid == bn->pid);
+	/* Mark the slot as empty */
+	ShmemBackendArray[i].pid = 0;
+}
+#endif   /* EXEC_BACKEND */
+
+
+#ifdef WIN32
+
+/*
+ * Subset implementation of waitpid() for Windows.  We assume pid is -1
+ * (that is, check all child processes) and options is WNOHANG (don't wait).
+ */
+static pid_t
+waitpid(pid_t pid, int *exitstatus, int options)
+{
+	DWORD		dwd;
+	ULONG_PTR	key;
+	OVERLAPPED *ovl;
+
+	/*
+	 * Check if there are any dead children. If there are, return the pid of
+	 * the first one that died.
+	 */
+	if (GetQueuedCompletionStatus(win32ChildQueue, &dwd, &key, &ovl, 0))
+	{
+		*exitstatus = (int) key;
+		return dwd;
+	}
+
+	return -1;
+}
+
+/*
+ * Note! Code below executes on a thread pool! All operations must
+ * be thread safe! Note that elog() and friends must *not* be used.
+ */
+static void WINAPI
+pgwin32_deadchild_callback(PVOID lpParameter, BOOLEAN TimerOrWaitFired)
+{
+	win32_deadchild_waitinfo *childinfo = (win32_deadchild_waitinfo *) lpParameter;
+	DWORD		exitcode;
+
+	if (TimerOrWaitFired)
+		return;					/* timeout. Should never happen, since we use
+								 * INFINITE as timeout value. */
+
+	/*
+	 * Remove handle from wait - required even though it's set to wait only
+	 * once
+	 */
+	UnregisterWaitEx(childinfo->waitHandle, NULL);
+
+	if (!GetExitCodeProcess(childinfo->procHandle, &exitcode))
+	{
+		/*
+		 * Should never happen. Inform user and set a fixed exitcode.
+		 */
+		write_stderr("could not read exit code for process\n");
+		exitcode = 255;
+	}
+
+	if (!PostQueuedCompletionStatus(win32ChildQueue, childinfo->procId, (ULONG_PTR) exitcode, NULL))
+		write_stderr("could not post child completion status\n");
+
+	/*
+	 * Handle is per-process, so we close it here instead of in the
+	 * originating thread
+	 */
+	CloseHandle(childinfo->procHandle);
+
+	/*
+	 * Free struct that was allocated before the call to
+	 * RegisterWaitForSingleObject()
+	 */
+	free(childinfo);
+
+	/* Queue SIGCHLD signal */
+	pg_queue_signal(SIGCHLD);
+}
+#endif   /* WIN32 */
+
+/*
+ * Initialize one and only handle for monitoring postmaster death.
+ *
+ * Called once in the postmaster, so that child processes can subsequently
+ * monitor if their parent is dead.
+ */
+#ifndef WIN32
+#else
+#endif   /* WIN32 */
diff --git a/foreign/libpg_query/src/postgres/src_backend_storage_ipc_ipc.c b/foreign/libpg_query/src/postgres/src_backend_storage_ipc_ipc.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_storage_ipc_ipc.c
@@ -0,0 +1,187 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - proc_exit_inprogress
+ * - proc_exit
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * ipc.c
+ *	  POSTGRES inter-process communication definitions.
+ *
+ * This file is misnamed, as it no longer has much of anything directly
+ * to do with IPC.  The functionality here is concerned with managing
+ * exit-time cleanup for either a postmaster or a backend.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/storage/ipc/ipc.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include <signal.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#include "miscadmin.h"
+#ifdef PROFILE_PID_DIR
+#include "postmaster/autovacuum.h"
+#endif
+#include "storage/dsm.h"
+#include "storage/ipc.h"
+#include "tcop/tcopprot.h"
+
+
+/*
+ * This flag is set during proc_exit() to change ereport()'s behavior,
+ * so that an ereport() from an on_proc_exit routine cannot get us out
+ * of the exit procedure.  We do NOT want to go back to the idle loop...
+ */
+__thread bool		proc_exit_inprogress = false;
+
+
+/*
+ * This flag tracks whether we've called atexit() in the current process
+ * (or in the parent postmaster).
+ */
+
+
+/* local functions */
+static void proc_exit_prepare(int code);
+
+
+/* ----------------------------------------------------------------
+ *						exit() handling stuff
+ *
+ * These functions are in generally the same spirit as atexit(),
+ * but provide some additional features we need --- in particular,
+ * we want to register callbacks to invoke when we are disconnecting
+ * from a broken shared-memory context but not exiting the postmaster.
+ *
+ * Callback functions can take zero, one, or two args: the first passed
+ * arg is the integer exitcode, the second is the Datum supplied when
+ * the callback was registered.
+ * ----------------------------------------------------------------
+ */
+
+#define MAX_ON_EXITS 20
+
+struct ONEXIT
+{
+	pg_on_exit_callback function;
+	Datum		arg;
+};
+
+
+
+
+
+
+
+
+
+
+/* ----------------------------------------------------------------
+ *		proc_exit
+ *
+ *		this function calls all the callbacks registered
+ *		for it (to free resources) and then calls exit.
+ *
+ *		This should be the only function to call exit().
+ *		-cim 2/6/90
+ *
+ *		Unfortunately, we can't really guarantee that add-on code
+ *		obeys the rule of not calling exit() directly.  So, while
+ *		this is the preferred way out of the system, we also register
+ *		an atexit callback that will make sure cleanup happens.
+ * ----------------------------------------------------------------
+ */
+void proc_exit(int code) { printf("Terminating process due to FATAL error\n"); exit(1); }
+
+
+/*
+ * Code shared between proc_exit and the atexit handler.  Note that in
+ * normal exit through proc_exit, this will actually be called twice ...
+ * but the second call will have nothing to do.
+ */
+
+
+/* ------------------
+ * Run all of the on_shmem_exit routines --- but don't actually exit.
+ * This is used by the postmaster to re-initialize shared memory and
+ * semaphores after a backend dies horribly.  As with proc_exit(), we
+ * remove each callback from the list before calling it, to avoid
+ * infinite loop in case of error.
+ * ------------------
+ */
+
+
+/* ----------------------------------------------------------------
+ *		atexit_callback
+ *
+ *		Backstop to ensure that direct calls of exit() don't mess us up.
+ *
+ * Somebody who was being really uncooperative could call _exit(),
+ * but for that case we have a "dead man switch" that will make the
+ * postmaster treat it as a crash --- see pmsignal.c.
+ * ----------------------------------------------------------------
+ */
+
+
+/* ----------------------------------------------------------------
+ *		on_proc_exit
+ *
+ *		this function adds a callback function to the list of
+ *		functions invoked by proc_exit().   -cim 2/6/90
+ * ----------------------------------------------------------------
+ */
+
+
+/* ----------------------------------------------------------------
+ *		before_shmem_exit
+ *
+ *		Register early callback to perform user-level cleanup,
+ *		e.g. transaction abort, before we begin shutting down
+ *		low-level subsystems.
+ * ----------------------------------------------------------------
+ */
+
+
+/* ----------------------------------------------------------------
+ *		on_shmem_exit
+ *
+ *		Register ordinary callback to perform low-level shutdown
+ *		(e.g. releasing our PGPROC); run after before_shmem_exit
+ *		callbacks and before on_proc_exit callbacks.
+ * ----------------------------------------------------------------
+ */
+
+
+/* ----------------------------------------------------------------
+ *		cancel_before_shmem_exit
+ *
+ *		this function removes a previously-registed before_shmem_exit
+ *		callback.  For simplicity, only the latest entry can be
+ *		removed.  (We could work harder but there is no need for
+ *		current uses.)
+ * ----------------------------------------------------------------
+ */
+
+
+/* ----------------------------------------------------------------
+ *		on_exit_reset
+ *
+ *		this function clears all on_proc_exit() and on_shmem_exit()
+ *		registered functions.  This is used just after forking a backend,
+ *		so that the backend doesn't believe it should call the postmaster's
+ *		on-exit routines when it exits...
+ * ----------------------------------------------------------------
+ */
+
diff --git a/foreign/libpg_query/src/postgres/src_backend_tcop_postgres.c b/foreign/libpg_query/src/postgres/src_backend_tcop_postgres.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_tcop_postgres.c
@@ -0,0 +1,753 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - whereToSendOutput
+ * - debug_query_string
+ * - ProcessInterrupts
+ * - check_stack_depth
+ * - stack_is_too_deep
+ * - stack_base_ptr
+ * - max_stack_depth_bytes
+ * - max_stack_depth
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * postgres.c
+ *	  POSTGRES C Backend Interface
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/tcop/postgres.c
+ *
+ * NOTES
+ *	  this is the "main" module of the postgres backend and
+ *	  hence the main module of the "traffic cop".
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+
+#include <fcntl.h>
+#include <limits.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/time.h>
+#include <sys/resource.h>
+#endif
+
+#ifndef HAVE_GETRUSAGE
+#include "rusagestub.h"
+#endif
+
+#include "access/parallel.h"
+#include "access/printtup.h"
+#include "access/xact.h"
+#include "catalog/pg_type.h"
+#include "commands/async.h"
+#include "commands/prepare.h"
+#include "libpq/libpq.h"
+#include "libpq/pqformat.h"
+#include "libpq/pqsignal.h"
+#include "miscadmin.h"
+#include "nodes/print.h"
+#include "optimizer/planner.h"
+#include "pgstat.h"
+#include "pg_trace.h"
+#include "parser/analyze.h"
+#include "parser/parser.h"
+#include "pg_getopt.h"
+#include "postmaster/autovacuum.h"
+#include "postmaster/postmaster.h"
+#include "replication/slot.h"
+#include "replication/walsender.h"
+#include "rewrite/rewriteHandler.h"
+#include "storage/bufmgr.h"
+#include "storage/ipc.h"
+#include "storage/proc.h"
+#include "storage/procsignal.h"
+#include "storage/sinval.h"
+#include "tcop/fastpath.h"
+#include "tcop/pquery.h"
+#include "tcop/tcopprot.h"
+#include "tcop/utility.h"
+#include "utils/lsyscache.h"
+#include "utils/memutils.h"
+#include "utils/ps_status.h"
+#include "utils/snapmgr.h"
+#include "utils/timeout.h"
+#include "utils/timestamp.h"
+#include "mb/pg_wchar.h"
+
+
+/* ----------------
+ *		global variables
+ * ----------------
+ */
+__thread const char *debug_query_string;
+ /* client-supplied query string */
+
+/* Note: whereToSendOutput is initialized for the bootstrap/standalone case */
+__thread CommandDest whereToSendOutput = DestDebug;
+
+
+/* flag for logging end of session */
+
+
+
+
+/* GUC variable for maximum stack depth (measured in kilobytes) */
+__thread int			max_stack_depth = 100;
+
+
+/* wait N seconds to allow attach from a debugger */
+
+
+
+
+/* ----------------
+ *		private variables
+ * ----------------
+ */
+
+/* max_stack_depth converted to bytes for speed of checking */
+static long max_stack_depth_bytes = 100 * 1024L;
+
+/*
+ * Stack base pointer -- initialized by PostmasterMain and inherited by
+ * subprocesses. This is not static because old versions of PL/Java modify
+ * it directly. Newer versions use set_stack_base(), but we want to stay
+ * binary-compatible for the time being.
+ */
+__thread char	   *stack_base_ptr = NULL;
+
+
+/*
+ * On IA64 we also have to remember the register stack base.
+ */
+#if defined(__ia64__) || defined(__ia64)
+char	   *register_stack_base_ptr = NULL;
+#endif
+
+/*
+ * Flag to mark SIGHUP. Whenever the main loop comes around it
+ * will reread the configuration file. (Better than doing the
+ * reading in the signal handler, ey?)
+ */
+
+
+/*
+ * Flag to keep track of whether we have started a transaction.
+ * For extended query protocol this has to be remembered across messages.
+ */
+
+
+/*
+ * Flag to indicate that we are doing the outer loop's read-from-client,
+ * as opposed to any random read from client that might happen within
+ * commands like COPY FROM STDIN.
+ */
+
+
+/*
+ * Flags to implement skip-till-Sync-after-error behavior for messages of
+ * the extended query protocol.
+ */
+
+
+
+/*
+ * If an unnamed prepared statement exists, it's stored here.
+ * We keep it separate from the hashtable kept by commands/prepare.c
+ * in order to reduce overhead for short-lived queries.
+ */
+
+
+/* assorted command-line switches */
+	/* -D switch */
+
+	/* -E switch */
+
+/*
+ * people who want to use EOF should #define DONTUSENEWLINE in
+ * tcop/tcopdebug.h
+ */
+#ifndef TCOP_DONTUSENEWLINE
+		/* Use newlines query delimiters (the default) */
+#else
+static int	UseNewLine = 0;		/* Use EOF as query delimiters */
+#endif   /* TCOP_DONTUSENEWLINE */
+
+/* whether or not, and why, we were canceled by conflict with recovery */
+
+
+
+
+/* ----------------------------------------------------------------
+ *		decls for routines only used in this file
+ * ----------------------------------------------------------------
+ */
+static int	InteractiveBackend(StringInfo inBuf);
+static int	interactive_getc(void);
+static int	SocketBackend(StringInfo inBuf);
+static int	ReadCommand(StringInfo inBuf);
+static void forbidden_in_wal_sender(char firstchar);
+static List *pg_rewrite_query(Query *query);
+static bool check_log_statement(List *stmt_list);
+static int	errdetail_execute(List *raw_parsetree_list);
+static int	errdetail_params(ParamListInfo params);
+static int	errdetail_abort(void);
+static int	errdetail_recovery_conflict(void);
+static void start_xact_command(void);
+static void finish_xact_command(void);
+static bool IsTransactionExitStmt(Node *parsetree);
+static bool IsTransactionExitStmtList(List *parseTrees);
+static bool IsTransactionStmtList(List *parseTrees);
+static void drop_unnamed_stmt(void);
+static void SigHupHandler(SIGNAL_ARGS);
+static void log_disconnections(int code, Datum arg);
+
+
+/* ----------------------------------------------------------------
+ *		routines to obtain user input
+ * ----------------------------------------------------------------
+ */
+
+/* ----------------
+ *	InteractiveBackend() is called for user interactive connections
+ *
+ *	the string entered by the user is placed in its parameter inBuf,
+ *	and we act like a Q message was received.
+ *
+ *	EOF is returned if end-of-file input is seen; time to shut down.
+ * ----------------
+ */
+
+
+
+/*
+ * interactive_getc -- collect one character from stdin
+ *
+ * Even though we are not reading from a "client" process, we still want to
+ * respond to signals, particularly SIGTERM/SIGQUIT.
+ */
+
+
+/* ----------------
+ *	SocketBackend()		Is called for frontend-backend connections
+ *
+ *	Returns the message type code, and loads message body data into inBuf.
+ *
+ *	EOF is returned if the connection is lost.
+ * ----------------
+ */
+
+
+/* ----------------
+ *		ReadCommand reads a command from either the frontend or
+ *		standard input, places it in inBuf, and returns the
+ *		message type code (first byte of the message).
+ *		EOF is returned if end of file.
+ * ----------------
+ */
+
+
+/*
+ * ProcessClientReadInterrupt() - Process interrupts specific to client reads
+ *
+ * This is called just after low-level reads. That might be after the read
+ * finished successfully, or it was interrupted via interrupt.
+ *
+ * Must preserve errno!
+ */
+
+
+/*
+ * ProcessClientWriteInterrupt() - Process interrupts specific to client writes
+ *
+ * This is called just after low-level writes. That might be after the read
+ * finished successfully, or it was interrupted via interrupt. 'blocked' tells
+ * us whether the
+ *
+ * Must preserve errno!
+ */
+
+
+/*
+ * Do raw parsing (only).
+ *
+ * A list of parsetrees is returned, since there might be multiple
+ * commands in the given string.
+ *
+ * NOTE: for interactive queries, it is important to keep this routine
+ * separate from the analysis & rewrite stages.  Analysis and rewriting
+ * cannot be done in an aborted transaction, since they require access to
+ * database tables.  So, we rely on the raw parser to determine whether
+ * we've seen a COMMIT or ABORT command; when we are in abort state, other
+ * commands are not processed any further than the raw parse stage.
+ */
+#ifdef COPY_PARSE_PLAN_TREES
+#endif
+
+/*
+ * Given a raw parsetree (gram.y output), and optionally information about
+ * types of parameter symbols ($n), perform parse analysis and rule rewriting.
+ *
+ * A list of Query nodes is returned, since either the analyzer or the
+ * rewriter might expand one query to several.
+ *
+ * NOTE: for reasons mentioned above, this must be separate from raw parsing.
+ */
+
+
+/*
+ * Do parse analysis and rewriting.  This is the same as pg_analyze_and_rewrite
+ * except that external-parameter resolution is determined by parser callback
+ * hooks instead of a fixed list of parameter datatypes.
+ */
+
+
+/*
+ * Perform rewriting of a query produced by parse analysis.
+ *
+ * Note: query must just have come from the parser, because we do not do
+ * AcquireRewriteLocks() on it.
+ */
+#ifdef COPY_PARSE_PLAN_TREES
+#endif
+
+
+/*
+ * Generate a plan for a single already-rewritten query.
+ * This is a thin wrapper around planner() and takes the same parameters.
+ */
+#ifdef COPY_PARSE_PLAN_TREES
+#ifdef NOT_USED
+#endif
+#endif
+
+/*
+ * Generate plans for a list of already-rewritten queries.
+ *
+ * Normal optimizable statements generate PlannedStmt entries in the result
+ * list.  Utility statements are simply represented by their statement nodes.
+ */
+
+
+
+/*
+ * exec_simple_query
+ *
+ * Execute a "simple Query" protocol message.
+ */
+
+
+/*
+ * exec_parse_message
+ *
+ * Execute a "Parse" protocol message.
+ */
+
+
+/*
+ * exec_bind_message
+ *
+ * Process a "Bind" message to create a portal from a prepared statement
+ */
+
+
+/*
+ * exec_execute_message
+ *
+ * Process an "Execute" message for a portal
+ */
+
+
+/*
+ * check_log_statement
+ *		Determine whether command should be logged because of log_statement
+ *
+ * stmt_list can be either raw grammar output or a list of planned
+ * statements
+ */
+
+
+/*
+ * check_log_duration
+ *		Determine whether current command's duration should be logged
+ *
+ * Returns:
+ *		0 if no logging is needed
+ *		1 if just the duration should be logged
+ *		2 if duration and query details should be logged
+ *
+ * If logging is needed, the duration in msec is formatted into msec_str[],
+ * which must be a 32-byte buffer.
+ *
+ * was_logged should be TRUE if caller already logged query details (this
+ * essentially prevents 2 from being returned).
+ */
+
+
+/*
+ * errdetail_execute
+ *
+ * Add an errdetail() line showing the query referenced by an EXECUTE, if any.
+ * The argument is the raw parsetree list.
+ */
+
+
+/*
+ * errdetail_params
+ *
+ * Add an errdetail() line showing bind-parameter data, if available.
+ */
+
+
+/*
+ * errdetail_abort
+ *
+ * Add an errdetail() line showing abort reason, if any.
+ */
+
+
+/*
+ * errdetail_recovery_conflict
+ *
+ * Add an errdetail() line showing conflict source.
+ */
+
+
+/*
+ * exec_describe_statement_message
+ *
+ * Process a "Describe" message for a prepared statement
+ */
+
+
+/*
+ * exec_describe_portal_message
+ *
+ * Process a "Describe" message for a portal
+ */
+
+
+
+/*
+ * Convenience routines for starting/committing a single command.
+ */
+
+
+#ifdef MEMORY_CONTEXT_CHECKING
+#endif
+#ifdef SHOW_MEMORY_STATS
+#endif
+
+
+/*
+ * Convenience routines for checking whether a statement is one of the
+ * ones that we allow in transaction-aborted state.
+ */
+
+/* Test a bare parsetree */
+
+
+/* Test a list that might contain Query nodes or bare parsetrees */
+
+
+/* Test a list that might contain Query nodes or bare parsetrees */
+
+
+/* Release any existing unnamed prepared statement */
+
+
+
+/* --------------------------------
+ *		signal handler routines used in PostgresMain()
+ * --------------------------------
+ */
+
+/*
+ * quickdie() occurs when signalled SIGQUIT by the postmaster.
+ *
+ * Some backend has bought the farm,
+ * so we need to stop what we're doing and exit.
+ */
+
+
+/*
+ * Shutdown signal from postmaster: abort transaction and exit
+ * at soonest convenient time
+ */
+
+
+/*
+ * Query-cancel signal from postmaster: abort current transaction
+ * at soonest convenient time
+ */
+
+
+/* signal handler for floating point exception */
+
+
+/* SIGHUP: set flag to re-read config file at next convenient time */
+
+
+/*
+ * RecoveryConflictInterrupt: out-of-line portion of recovery conflict
+ * handling following receipt of SIGUSR1. Designed to be similar to die()
+ * and StatementCancelHandler(). Called only by a normal user backend
+ * that begins a transaction during recovery.
+ */
+
+
+/*
+ * ProcessInterrupts: out-of-line portion of CHECK_FOR_INTERRUPTS() macro
+ *
+ * If an interrupt condition is pending, and it's safe to service it,
+ * then clear the flag and accept the interrupt.  Called only when
+ * InterruptPending is true.
+ */
+void ProcessInterrupts(void) {}
+
+
+
+/*
+ * IA64-specific code to fetch the AR.BSP register for stack depth checks.
+ *
+ * We currently support gcc, icc, and HP-UX inline assembly here.
+ */
+#if defined(__ia64__) || defined(__ia64)
+
+#if defined(__hpux) && !defined(__GNUC__) && !defined __INTEL_COMPILER
+#include <ia64/sys/inline.h>
+#define ia64_get_bsp() ((char *) (_Asm_mov_from_ar(_AREG_BSP, _NO_FENCE)))
+#else
+
+#ifdef __INTEL_COMPILER
+#include <asm/ia64regs.h>
+#endif
+
+static __inline__ char *
+ia64_get_bsp(void)
+{
+	char	   *ret;
+
+#ifndef __INTEL_COMPILER
+	/* the ;; is a "stop", seems to be required before fetching BSP */
+	__asm__		__volatile__(
+										 ";;\n"
+										 "	mov	%0=ar.bsp	\n"
+							 :			 "=r"(ret));
+#else
+	ret = (char *) __getReg(_IA64_REG_AR_BSP);
+#endif
+	return ret;
+}
+#endif
+#endif   /* IA64 */
+
+
+/*
+ * set_stack_base: set up reference point for stack depth checking
+ *
+ * Returns the old reference point, if any.
+ */
+#if defined(__ia64__) || defined(__ia64)
+#else
+#endif
+#if defined(__ia64__) || defined(__ia64)
+#endif
+
+/*
+ * restore_stack_base: restore reference point for stack depth checking
+ *
+ * This can be used after set_stack_base() to restore the old value. This
+ * is currently only used in PL/Java. When PL/Java calls a backend function
+ * from different thread, the thread's stack is at a different location than
+ * the main thread's stack, so it sets the base pointer before the call, and
+ * restores it afterwards.
+ */
+#if defined(__ia64__) || defined(__ia64)
+#else
+#endif
+
+/*
+ * check_stack_depth/stack_is_too_deep: check for excessively deep recursion
+ *
+ * This should be called someplace in any recursive routine that might possibly
+ * recurse deep enough to overflow the stack.  Most Unixen treat stack
+ * overflow as an unrecoverable SIGSEGV, so we want to error out ourselves
+ * before hitting the hardware limit.
+ *
+ * check_stack_depth() just throws an error summarily.  stack_is_too_deep()
+ * can be used by code that wants to handle the error condition itself.
+ */
+void
+check_stack_depth(void)
+{
+	if (stack_is_too_deep())
+	{
+		ereport(ERROR,
+				(errcode(ERRCODE_STATEMENT_TOO_COMPLEX),
+				 errmsg("stack depth limit exceeded"),
+				 errhint("Increase the configuration parameter \"max_stack_depth\" (currently %dkB), "
+			  "after ensuring the platform's stack depth limit is adequate.",
+						 max_stack_depth)));
+	}
+}
+
+bool
+stack_is_too_deep(void)
+{
+	char		stack_top_loc;
+	long		stack_depth;
+
+	/*
+	 * Compute distance from reference point to my local variables
+	 */
+	stack_depth = (long) (stack_base_ptr - &stack_top_loc);
+
+	/*
+	 * Take abs value, since stacks grow up on some machines, down on others
+	 */
+	if (stack_depth < 0)
+		stack_depth = -stack_depth;
+
+	/*
+	 * Trouble?
+	 *
+	 * The test on stack_base_ptr prevents us from erroring out if called
+	 * during process setup or in a non-backend process.  Logically it should
+	 * be done first, but putting it here avoids wasting cycles during normal
+	 * cases.
+	 */
+	if (stack_depth > max_stack_depth_bytes &&
+		stack_base_ptr != NULL)
+		return true;
+
+	/*
+	 * On IA64 there is a separate "register" stack that requires its own
+	 * independent check.  For this, we have to measure the change in the
+	 * "BSP" pointer from PostgresMain to here.  Logic is just as above,
+	 * except that we know IA64's register stack grows up.
+	 *
+	 * Note we assume that the same max_stack_depth applies to both stacks.
+	 */
+#if defined(__ia64__) || defined(__ia64)
+	stack_depth = (long) (ia64_get_bsp() - register_stack_base_ptr);
+
+	if (stack_depth > max_stack_depth_bytes &&
+		register_stack_base_ptr != NULL)
+		return true;
+#endif   /* IA64 */
+
+	return false;
+}
+
+/* GUC check hook for max_stack_depth */
+
+
+/* GUC assign hook for max_stack_depth */
+
+
+
+/*
+ * set_debug_options --- apply "-d N" command line option
+ *
+ * -d is not quite the same as setting log_min_messages because it enables
+ * other output options.
+ */
+
+
+
+
+
+
+
+
+
+/* ----------------------------------------------------------------
+ * process_postgres_switches
+ *	   Parse command line arguments for PostgresMain
+ *
+ * This is called twice, once for the "secure" options coming from the
+ * postmaster or command line, and once for the "insecure" options coming
+ * from the client's startup packet.  The latter have the same syntax but
+ * may be restricted in what they can do.
+ *
+ * argv[0] is ignored in either case (it's assumed to be the program name).
+ *
+ * ctx is PGC_POSTMASTER for secure options, PGC_BACKEND for insecure options
+ * coming from the client, or PGC_SU_BACKEND for insecure options coming from
+ * a superuser client.
+ *
+ * If a database name is present in the command line arguments, it's
+ * returned into *dbname (this is allowed only if *dbname is initially NULL).
+ * ----------------------------------------------------------------
+ */
+#ifdef HAVE_INT_OPTERR
+#endif
+#ifdef HAVE_INT_OPTRESET
+#endif
+
+
+/* ----------------------------------------------------------------
+ * PostgresMain
+ *	   postgres main loop -- all backends, interactive or otherwise start here
+ *
+ * argc/argv are the command line arguments to be used.  (When being forked
+ * by the postmaster, these are not the original argv array of the process.)
+ * dbname is the name of the database to connect to, or NULL if the database
+ * name should be extracted from the command line arguments or defaulted.
+ * username is the PostgreSQL user name to be used for the session.
+ * ----------------------------------------------------------------
+ */
+#ifdef EXEC_BACKEND
+#else
+#endif
+
+/*
+ * Throw an error if we're a WAL sender process.
+ *
+ * This is used to forbid anything else than simple query protocol messages
+ * in a WAL sender process.  'firstchar' specifies what kind of a forbidden
+ * message was received, and is used to construct the error message.
+ */
+
+
+
+/*
+ * Obtain platform stack depth limit (in bytes)
+ *
+ * Return -1 if unknown
+ */
+#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_STACK)
+#else							/* no getrlimit */
+#if defined(WIN32) || defined(__CYGWIN__)
+#else							/* not windows ... give up */
+#endif
+#endif
+
+
+
+
+
+
+
+#if defined(HAVE_GETRUSAGE)
+#endif   /* HAVE_GETRUSAGE */
+
+/*
+ * on_proc_exit handler to log end of session
+ */
+
diff --git a/foreign/libpg_query/src/postgres/src_backend_utils_adt_datum.c b/foreign/libpg_query/src/postgres/src_backend_utils_adt_datum.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_utils_adt_datum.c
@@ -0,0 +1,247 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - datumCopy
+ * - datumGetSize
+ * - datumIsEqual
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * datum.c
+ *	  POSTGRES Datum (abstract data type) manipulation routines.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/utils/adt/datum.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/*
+ * In the implementation of these routines we assume the following:
+ *
+ * A) if a type is "byVal" then all the information is stored in the
+ * Datum itself (i.e. no pointers involved!). In this case the
+ * length of the type is always greater than zero and not more than
+ * "sizeof(Datum)"
+ *
+ * B) if a type is not "byVal" and it has a fixed length (typlen > 0),
+ * then the "Datum" always contains a pointer to a stream of bytes.
+ * The number of significant bytes are always equal to the typlen.
+ *
+ * C) if a type is not "byVal" and has typlen == -1,
+ * then the "Datum" always points to a "struct varlena".
+ * This varlena structure has information about the actual length of this
+ * particular instance of the type and about its value.
+ *
+ * D) if a type is not "byVal" and has typlen == -2,
+ * then the "Datum" always points to a null-terminated C string.
+ *
+ * Note that we do not treat "toasted" datums specially; therefore what
+ * will be copied or compared is the compressed data or toast reference.
+ * An exception is made for datumCopy() of an expanded object, however,
+ * because most callers expect to get a simple contiguous (and pfree'able)
+ * result from datumCopy().  See also datumTransfer().
+ */
+
+#include "postgres.h"
+
+#include "utils/datum.h"
+#include "utils/expandeddatum.h"
+
+
+/*-------------------------------------------------------------------------
+ * datumGetSize
+ *
+ * Find the "real" size of a datum, given the datum value,
+ * whether it is a "by value", and the declared type length.
+ * (For TOAST pointer datums, this is the size of the pointer datum.)
+ *
+ * This is essentially an out-of-line version of the att_addlength_datum()
+ * macro in access/tupmacs.h.  We do a tad more error checking though.
+ *-------------------------------------------------------------------------
+ */
+Size
+datumGetSize(Datum value, bool typByVal, int typLen)
+{
+	Size		size;
+
+	if (typByVal)
+	{
+		/* Pass-by-value types are always fixed-length */
+		Assert(typLen > 0 && typLen <= sizeof(Datum));
+		size = (Size) typLen;
+	}
+	else
+	{
+		if (typLen > 0)
+		{
+			/* Fixed-length pass-by-ref type */
+			size = (Size) typLen;
+		}
+		else if (typLen == -1)
+		{
+			/* It is a varlena datatype */
+			struct varlena *s = (struct varlena *) DatumGetPointer(value);
+
+			if (!PointerIsValid(s))
+				ereport(ERROR,
+						(errcode(ERRCODE_DATA_EXCEPTION),
+						 errmsg("invalid Datum pointer")));
+
+			size = (Size) VARSIZE_ANY(s);
+		}
+		else if (typLen == -2)
+		{
+			/* It is a cstring datatype */
+			char	   *s = (char *) DatumGetPointer(value);
+
+			if (!PointerIsValid(s))
+				ereport(ERROR,
+						(errcode(ERRCODE_DATA_EXCEPTION),
+						 errmsg("invalid Datum pointer")));
+
+			size = (Size) (strlen(s) + 1);
+		}
+		else
+		{
+			elog(ERROR, "invalid typLen: %d", typLen);
+			size = 0;			/* keep compiler quiet */
+		}
+	}
+
+	return size;
+}
+
+/*-------------------------------------------------------------------------
+ * datumCopy
+ *
+ * Make a copy of a non-NULL datum.
+ *
+ * If the datatype is pass-by-reference, memory is obtained with palloc().
+ *
+ * If the value is a reference to an expanded object, we flatten into memory
+ * obtained with palloc().  We need to copy because one of the main uses of
+ * this function is to copy a datum out of a transient memory context that's
+ * about to be destroyed, and the expanded object is probably in a child
+ * context that will also go away.  Moreover, many callers assume that the
+ * result is a single pfree-able chunk.
+ *-------------------------------------------------------------------------
+ */
+Datum
+datumCopy(Datum value, bool typByVal, int typLen)
+{
+	Datum		res;
+
+	if (typByVal)
+		res = value;
+	else if (typLen == -1)
+	{
+		/* It is a varlena datatype */
+		struct varlena *vl = (struct varlena *) DatumGetPointer(value);
+
+		if (VARATT_IS_EXTERNAL_EXPANDED(vl))
+		{
+			/* Flatten into the caller's memory context */
+			ExpandedObjectHeader *eoh = DatumGetEOHP(value);
+			Size		resultsize;
+			char	   *resultptr;
+
+			resultsize = EOH_get_flat_size(eoh);
+			resultptr = (char *) palloc(resultsize);
+			EOH_flatten_into(eoh, (void *) resultptr, resultsize);
+			res = PointerGetDatum(resultptr);
+		}
+		else
+		{
+			/* Otherwise, just copy the varlena datum verbatim */
+			Size		realSize;
+			char	   *resultptr;
+
+			realSize = (Size) VARSIZE_ANY(vl);
+			resultptr = (char *) palloc(realSize);
+			memcpy(resultptr, vl, realSize);
+			res = PointerGetDatum(resultptr);
+		}
+	}
+	else
+	{
+		/* Pass by reference, but not varlena, so not toasted */
+		Size		realSize;
+		char	   *resultptr;
+
+		realSize = datumGetSize(value, typByVal, typLen);
+
+		resultptr = (char *) palloc(realSize);
+		memcpy(resultptr, DatumGetPointer(value), realSize);
+		res = PointerGetDatum(resultptr);
+	}
+	return res;
+}
+
+/*-------------------------------------------------------------------------
+ * datumTransfer
+ *
+ * Transfer a non-NULL datum into the current memory context.
+ *
+ * This is equivalent to datumCopy() except when the datum is a read-write
+ * pointer to an expanded object.  In that case we merely reparent the object
+ * into the current context, and return its standard R/W pointer (in case the
+ * given one is a transient pointer of shorter lifespan).
+ *-------------------------------------------------------------------------
+ */
+
+
+/*-------------------------------------------------------------------------
+ * datumIsEqual
+ *
+ * Return true if two datums are equal, false otherwise
+ *
+ * NOTE: XXX!
+ * We just compare the bytes of the two values, one by one.
+ * This routine will return false if there are 2 different
+ * representations of the same value (something along the lines
+ * of say the representation of zero in one's complement arithmetic).
+ * Also, it will probably not give the answer you want if either
+ * datum has been "toasted".
+ *-------------------------------------------------------------------------
+ */
+bool
+datumIsEqual(Datum value1, Datum value2, bool typByVal, int typLen)
+{
+	bool		res;
+
+	if (typByVal)
+	{
+		/*
+		 * just compare the two datums. NOTE: just comparing "len" bytes will
+		 * not do the work, because we do not know how these bytes are aligned
+		 * inside the "Datum".  We assume instead that any given datatype is
+		 * consistent about how it fills extraneous bits in the Datum.
+		 */
+		res = (value1 == value2);
+	}
+	else
+	{
+		Size		size1,
+					size2;
+		char	   *s1,
+				   *s2;
+
+		/*
+		 * Compare the bytes pointed by the pointers stored in the datums.
+		 */
+		size1 = datumGetSize(value1, typByVal, typLen);
+		size2 = datumGetSize(value2, typByVal, typLen);
+		if (size1 != size2)
+			return false;
+		s1 = (char *) DatumGetPointer(value1);
+		s2 = (char *) DatumGetPointer(value2);
+		res = (memcmp(s1, s2, size1) == 0);
+	}
+	return res;
+}
diff --git a/foreign/libpg_query/src/postgres/src_backend_utils_adt_expandeddatum.c b/foreign/libpg_query/src/postgres/src_backend_utils_adt_expandeddatum.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_utils_adt_expandeddatum.c
@@ -0,0 +1,100 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - DatumGetEOHP
+ * - EOH_get_flat_size
+ * - EOH_flatten_into
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * expandeddatum.c
+ *	  Support functions for "expanded" value representations.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/utils/adt/expandeddatum.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include "utils/expandeddatum.h"
+#include "utils/memutils.h"
+
+/*
+ * DatumGetEOHP
+ *
+ * Given a Datum that is an expanded-object reference, extract the pointer.
+ *
+ * This is a bit tedious since the pointer may not be properly aligned;
+ * compare VARATT_EXTERNAL_GET_POINTER().
+ */
+ExpandedObjectHeader *
+DatumGetEOHP(Datum d)
+{
+	varattrib_1b_e *datum = (varattrib_1b_e *) DatumGetPointer(d);
+	varatt_expanded ptr;
+
+	Assert(VARATT_IS_EXTERNAL_EXPANDED(datum));
+	memcpy(&ptr, VARDATA_EXTERNAL(datum), sizeof(ptr));
+	Assert(VARATT_IS_EXPANDED_HEADER(ptr.eohptr));
+	return ptr.eohptr;
+}
+
+/*
+ * EOH_init_header
+ *
+ * Initialize the common header of an expanded object.
+ *
+ * The main thing this encapsulates is initializing the TOAST pointers.
+ */
+
+
+/*
+ * EOH_get_flat_size
+ * EOH_flatten_into
+ *
+ * Convenience functions for invoking the "methods" of an expanded object.
+ */
+
+Size
+EOH_get_flat_size(ExpandedObjectHeader *eohptr)
+{
+	return (*eohptr->eoh_methods->get_flat_size) (eohptr);
+}
+
+void
+EOH_flatten_into(ExpandedObjectHeader *eohptr,
+				 void *result, Size allocated_size)
+{
+	(*eohptr->eoh_methods->flatten_into) (eohptr, result, allocated_size);
+}
+
+/*
+ * Does the Datum represent a writable expanded object?
+ */
+
+
+/*
+ * If the Datum represents a R/W expanded object, change it to R/O.
+ * Otherwise return the original Datum.
+ */
+
+
+/*
+ * Transfer ownership of an expanded object to a new parent memory context.
+ * The object must be referenced by a R/W pointer, and what we return is
+ * always its "standard" R/W pointer, which is certain to have the same
+ * lifespan as the object itself.  (The passed-in pointer might not, and
+ * in any case wouldn't provide a unique identifier if it's not that one.)
+ */
+
+
+/*
+ * Delete an expanded object (must be referenced by a R/W pointer).
+ */
+
diff --git a/foreign/libpg_query/src/postgres/src_backend_utils_adt_format_type.c b/foreign/libpg_query/src/postgres/src_backend_utils_adt_format_type.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_utils_adt_format_type.c
@@ -0,0 +1,119 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - format_type_be
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * format_type.c
+ *	  Display type names "nicely".
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ *	  src/backend/utils/adt/format_type.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+
+#include <ctype.h>
+
+#include "access/htup_details.h"
+#include "catalog/namespace.h"
+#include "catalog/pg_type.h"
+#include "utils/builtins.h"
+#include "utils/lsyscache.h"
+#include "utils/numeric.h"
+#include "utils/syscache.h"
+#include "mb/pg_wchar.h"
+
+#define MAX_INT32_LEN 11
+
+static char *format_type_internal(Oid type_oid, int32 typemod,
+					 bool typemod_given, bool allow_invalid,
+					 bool force_qualify);
+static char *printTypmod(const char *typname, int32 typmod, Oid typmodout);
+
+
+/*
+ * SQL function: format_type(type_oid, typemod)
+ *
+ * `type_oid' is from pg_type.oid, `typemod' is from
+ * pg_attribute.atttypmod. This function will get the type name and
+ * format it and the modifier to canonical SQL format, if the type is
+ * a standard type. Otherwise you just get pg_type.typname back,
+ * double quoted if it contains funny characters or matches a keyword.
+ *
+ * If typemod is NULL then we are formatting a type name in a context where
+ * no typemod is available, eg a function argument or result type.  This
+ * yields a slightly different result from specifying typemod = -1 in some
+ * cases.  Given typemod = -1 we feel compelled to produce an output that
+ * the parser will interpret as having typemod -1, so that pg_dump will
+ * produce CREATE TABLE commands that recreate the original state.  But
+ * given NULL typemod, we assume that the parser's interpretation of
+ * typemod doesn't matter, and so we are willing to output a slightly
+ * "prettier" representation of the same type.  For example, type = bpchar
+ * and typemod = NULL gets you "character", whereas typemod = -1 gets you
+ * "bpchar" --- the former will be interpreted as character(1) by the
+ * parser, which does not yield typemod -1.
+ *
+ * XXX encoding a meaning in typemod = NULL is ugly; it'd have been
+ * cleaner to make two functions of one and two arguments respectively.
+ * Not worth changing it now, however.
+ */
+
+
+/*
+ * This version is for use within the backend in error messages, etc.
+ * One difference is that it will fail for an invalid type.
+ *
+ * The result is always a palloc'd string.
+ */
+char * format_type_be(Oid type_oid) { return pstrdup("-"); }
+
+
+/*
+ * This version returns a name which is always qualified.
+ */
+
+
+/*
+ * This version allows a nondefault typemod to be specified.
+ */
+
+
+
+
+
+/*
+ * Add typmod decoration to the basic type name
+ */
+
+
+
+/*
+ * type_maximum_size --- determine maximum width of a variable-width column
+ *
+ * If the max width is indeterminate, return -1.  In particular, we return
+ * -1 for any type not known to this routine.  We assume the caller has
+ * already determined that the type is a variable-width type, so it's not
+ * necessary to look up the type's pg_type tuple here.
+ *
+ * This may appear unrelated to format_type(), but in fact the two routines
+ * share knowledge of the encoding of typmod for different types, so it's
+ * convenient to keep them together.  (XXX now that most of this knowledge
+ * has been pushed out of format_type into the typmodout functions, it's
+ * interesting to wonder if it's worth trying to factor this code too...)
+ */
+
+
+
+/*
+ * oidvectortypes			- converts a vector of type OIDs to "typname" list
+ */
+
diff --git a/foreign/libpg_query/src/postgres/src_backend_utils_adt_ruleutils.c b/foreign/libpg_query/src/postgres/src_backend_utils_adt_ruleutils.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_utils_adt_ruleutils.c
@@ -0,0 +1,1502 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - quote_identifier
+ * - quote_all_identifiers
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * ruleutils.c
+ *	  Functions to convert stored expressions/querytrees back to
+ *	  source text
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/utils/adt/ruleutils.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include <ctype.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include "access/htup_details.h"
+#include "access/sysattr.h"
+#include "catalog/dependency.h"
+#include "catalog/indexing.h"
+#include "catalog/pg_aggregate.h"
+#include "catalog/pg_authid.h"
+#include "catalog/pg_collation.h"
+#include "catalog/pg_constraint.h"
+#include "catalog/pg_depend.h"
+#include "catalog/pg_language.h"
+#include "catalog/pg_opclass.h"
+#include "catalog/pg_operator.h"
+#include "catalog/pg_proc.h"
+#include "catalog/pg_trigger.h"
+#include "catalog/pg_type.h"
+#include "commands/defrem.h"
+#include "commands/tablespace.h"
+#include "executor/spi.h"
+#include "funcapi.h"
+#include "mb/pg_wchar.h"
+#include "miscadmin.h"
+#include "nodes/makefuncs.h"
+#include "nodes/nodeFuncs.h"
+#include "optimizer/tlist.h"
+#include "parser/keywords.h"
+#include "parser/parse_node.h"
+#include "parser/parse_agg.h"
+#include "parser/parse_func.h"
+#include "parser/parse_oper.h"
+#include "parser/parser.h"
+#include "parser/parsetree.h"
+#include "rewrite/rewriteHandler.h"
+#include "rewrite/rewriteManip.h"
+#include "rewrite/rewriteSupport.h"
+#include "utils/array.h"
+#include "utils/builtins.h"
+#include "utils/fmgroids.h"
+#include "utils/hsearch.h"
+#include "utils/lsyscache.h"
+#include "utils/rel.h"
+#include "utils/ruleutils.h"
+#include "utils/snapmgr.h"
+#include "utils/syscache.h"
+#include "utils/tqual.h"
+#include "utils/typcache.h"
+#include "utils/xml.h"
+
+
+/* ----------
+ * Pretty formatting constants
+ * ----------
+ */
+
+/* Indent counts */
+#define PRETTYINDENT_STD		8
+#define PRETTYINDENT_JOIN		4
+#define PRETTYINDENT_VAR		4
+
+#define PRETTYINDENT_LIMIT		40		/* wrap limit */
+
+/* Pretty flags */
+#define PRETTYFLAG_PAREN		1
+#define PRETTYFLAG_INDENT		2
+
+/* Default line length for pretty-print wrapping: 0 means wrap always */
+#define WRAP_COLUMN_DEFAULT		0
+
+/* macro to test if pretty action needed */
+#define PRETTY_PAREN(context)	((context)->prettyFlags & PRETTYFLAG_PAREN)
+#define PRETTY_INDENT(context)	((context)->prettyFlags & PRETTYFLAG_INDENT)
+
+
+/* ----------
+ * Local data types
+ * ----------
+ */
+
+/* Context info needed for invoking a recursive querytree display routine */
+typedef struct
+{
+	StringInfo	buf;			/* output buffer to append to */
+	List	   *namespaces;		/* List of deparse_namespace nodes */
+	List	   *windowClause;	/* Current query level's WINDOW clause */
+	List	   *windowTList;	/* targetlist for resolving WINDOW clause */
+	int			prettyFlags;	/* enabling of pretty-print functions */
+	int			wrapColumn;		/* max line length, or -1 for no limit */
+	int			indentLevel;	/* current indent level for prettyprint */
+	bool		varprefix;		/* TRUE to print prefixes on Vars */
+	ParseExprKind special_exprkind;		/* set only for exprkinds needing
+										 * special handling */
+} deparse_context;
+
+/*
+ * Each level of query context around a subtree needs a level of Var namespace.
+ * A Var having varlevelsup=N refers to the N'th item (counting from 0) in
+ * the current context's namespaces list.
+ *
+ * The rangetable is the list of actual RTEs from the query tree, and the
+ * cte list is the list of actual CTEs.
+ *
+ * rtable_names holds the alias name to be used for each RTE (either a C
+ * string, or NULL for nameless RTEs such as unnamed joins).
+ * rtable_columns holds the column alias names to be used for each RTE.
+ *
+ * In some cases we need to make names of merged JOIN USING columns unique
+ * across the whole query, not only per-RTE.  If so, unique_using is TRUE
+ * and using_names is a list of C strings representing names already assigned
+ * to USING columns.
+ *
+ * When deparsing plan trees, there is always just a single item in the
+ * deparse_namespace list (since a plan tree never contains Vars with
+ * varlevelsup > 0).  We store the PlanState node that is the immediate
+ * parent of the expression to be deparsed, as well as a list of that
+ * PlanState's ancestors.  In addition, we store its outer and inner subplan
+ * state nodes, as well as their plan nodes' targetlists, and the index tlist
+ * if the current plan node might contain INDEX_VAR Vars.  (These fields could
+ * be derived on-the-fly from the current PlanState, but it seems notationally
+ * clearer to set them up as separate fields.)
+ */
+typedef struct
+{
+	List	   *rtable;			/* List of RangeTblEntry nodes */
+	List	   *rtable_names;	/* Parallel list of names for RTEs */
+	List	   *rtable_columns; /* Parallel list of deparse_columns structs */
+	List	   *ctes;			/* List of CommonTableExpr nodes */
+	/* Workspace for column alias assignment: */
+	bool		unique_using;	/* Are we making USING names globally unique */
+	List	   *using_names;	/* List of assigned names for USING columns */
+	/* Remaining fields are used only when deparsing a Plan tree: */
+	PlanState  *planstate;		/* immediate parent of current expression */
+	List	   *ancestors;		/* ancestors of planstate */
+	PlanState  *outer_planstate;	/* outer subplan state, or NULL if none */
+	PlanState  *inner_planstate;	/* inner subplan state, or NULL if none */
+	List	   *outer_tlist;	/* referent for OUTER_VAR Vars */
+	List	   *inner_tlist;	/* referent for INNER_VAR Vars */
+	List	   *index_tlist;	/* referent for INDEX_VAR Vars */
+} deparse_namespace;
+
+/*
+ * Per-relation data about column alias names.
+ *
+ * Selecting aliases is unreasonably complicated because of the need to dump
+ * rules/views whose underlying tables may have had columns added, deleted, or
+ * renamed since the query was parsed.  We must nonetheless print the rule/view
+ * in a form that can be reloaded and will produce the same results as before.
+ *
+ * For each RTE used in the query, we must assign column aliases that are
+ * unique within that RTE.  SQL does not require this of the original query,
+ * but due to factors such as *-expansion we need to be able to uniquely
+ * reference every column in a decompiled query.  As long as we qualify all
+ * column references, per-RTE uniqueness is sufficient for that.
+ *
+ * However, we can't ensure per-column name uniqueness for unnamed join RTEs,
+ * since they just inherit column names from their input RTEs, and we can't
+ * rename the columns at the join level.  Most of the time this isn't an issue
+ * because we don't need to reference the join's output columns as such; we
+ * can reference the input columns instead.  That approach can fail for merged
+ * JOIN USING columns, however, so when we have one of those in an unnamed
+ * join, we have to make that column's alias globally unique across the whole
+ * query to ensure it can be referenced unambiguously.
+ *
+ * Another problem is that a JOIN USING clause requires the columns to be
+ * merged to have the same aliases in both input RTEs, and that no other
+ * columns in those RTEs or their children conflict with the USING names.
+ * To handle that, we do USING-column alias assignment in a recursive
+ * traversal of the query's jointree.  When descending through a JOIN with
+ * USING, we preassign the USING column names to the child columns, overriding
+ * other rules for column alias assignment.  We also mark each RTE with a list
+ * of all USING column names selected for joins containing that RTE, so that
+ * when we assign other columns' aliases later, we can avoid conflicts.
+ *
+ * Another problem is that if a JOIN's input tables have had columns added or
+ * deleted since the query was parsed, we must generate a column alias list
+ * for the join that matches the current set of input columns --- otherwise, a
+ * change in the number of columns in the left input would throw off matching
+ * of aliases to columns of the right input.  Thus, positions in the printable
+ * column alias list are not necessarily one-for-one with varattnos of the
+ * JOIN, so we need a separate new_colnames[] array for printing purposes.
+ */
+typedef struct
+{
+	/*
+	 * colnames is an array containing column aliases to use for columns that
+	 * existed when the query was parsed.  Dropped columns have NULL entries.
+	 * This array can be directly indexed by varattno to get a Var's name.
+	 *
+	 * Non-NULL entries are guaranteed unique within the RTE, *except* when
+	 * this is for an unnamed JOIN RTE.  In that case we merely copy up names
+	 * from the two input RTEs.
+	 *
+	 * During the recursive descent in set_using_names(), forcible assignment
+	 * of a child RTE's column name is represented by pre-setting that element
+	 * of the child's colnames array.  So at that stage, NULL entries in this
+	 * array just mean that no name has been preassigned, not necessarily that
+	 * the column is dropped.
+	 */
+	int			num_cols;		/* length of colnames[] array */
+	char	  **colnames;		/* array of C strings and NULLs */
+
+	/*
+	 * new_colnames is an array containing column aliases to use for columns
+	 * that would exist if the query was re-parsed against the current
+	 * definitions of its base tables.  This is what to print as the column
+	 * alias list for the RTE.  This array does not include dropped columns,
+	 * but it will include columns added since original parsing.  Indexes in
+	 * it therefore have little to do with current varattno values.  As above,
+	 * entries are unique unless this is for an unnamed JOIN RTE.  (In such an
+	 * RTE, we never actually print this array, but we must compute it anyway
+	 * for possible use in computing column names of upper joins.) The
+	 * parallel array is_new_col marks which of these columns are new since
+	 * original parsing.  Entries with is_new_col false must match the
+	 * non-NULL colnames entries one-for-one.
+	 */
+	int			num_new_cols;	/* length of new_colnames[] array */
+	char	  **new_colnames;	/* array of C strings */
+	bool	   *is_new_col;		/* array of bool flags */
+
+	/* This flag tells whether we should actually print a column alias list */
+	bool		printaliases;
+
+	/* This list has all names used as USING names in joins above this RTE */
+	List	   *parentUsing;	/* names assigned to parent merged columns */
+
+	/*
+	 * If this struct is for a JOIN RTE, we fill these fields during the
+	 * set_using_names() pass to describe its relationship to its child RTEs.
+	 *
+	 * leftattnos and rightattnos are arrays with one entry per existing
+	 * output column of the join (hence, indexable by join varattno).  For a
+	 * simple reference to a column of the left child, leftattnos[i] is the
+	 * child RTE's attno and rightattnos[i] is zero; and conversely for a
+	 * column of the right child.  But for merged columns produced by JOIN
+	 * USING/NATURAL JOIN, both leftattnos[i] and rightattnos[i] are nonzero.
+	 * Also, if the column has been dropped, both are zero.
+	 *
+	 * If it's a JOIN USING, usingNames holds the alias names selected for the
+	 * merged columns (these might be different from the original USING list,
+	 * if we had to modify names to achieve uniqueness).
+	 */
+	int			leftrti;		/* rangetable index of left child */
+	int			rightrti;		/* rangetable index of right child */
+	int		   *leftattnos;		/* left-child varattnos of join cols, or 0 */
+	int		   *rightattnos;	/* right-child varattnos of join cols, or 0 */
+	List	   *usingNames;		/* names assigned to merged columns */
+} deparse_columns;
+
+/* This macro is analogous to rt_fetch(), but for deparse_columns structs */
+#define deparse_columns_fetch(rangetable_index, dpns) \
+	((deparse_columns *) list_nth((dpns)->rtable_columns, (rangetable_index)-1))
+
+/*
+ * Entry in set_rtable_names' hash table
+ */
+typedef struct
+{
+	char		name[NAMEDATALEN];		/* Hash key --- must be first */
+	int			counter;		/* Largest addition used so far for name */
+} NameHashEntry;
+
+
+/* ----------
+ * Global data
+ * ----------
+ */
+
+
+
+
+
+/* GUC parameters */
+__thread bool		quote_all_identifiers = false;
+
+
+
+/* ----------
+ * Local functions
+ *
+ * Most of these functions used to use fixed-size buffers to build their
+ * results.  Now, they take an (already initialized) StringInfo object
+ * as a parameter, and append their text output to its contents.
+ * ----------
+ */
+static char *deparse_expression_pretty(Node *expr, List *dpcontext,
+						  bool forceprefix, bool showimplicit,
+						  int prettyFlags, int startIndent);
+static char *pg_get_viewdef_worker(Oid viewoid,
+					  int prettyFlags, int wrapColumn);
+static char *pg_get_triggerdef_worker(Oid trigid, bool pretty);
+static void decompile_column_index_array(Datum column_index_array, Oid relId,
+							 StringInfo buf);
+static char *pg_get_ruledef_worker(Oid ruleoid, int prettyFlags);
+static char *pg_get_indexdef_worker(Oid indexrelid, int colno,
+					   const Oid *excludeOps,
+					   bool attrsOnly, bool showTblSpc,
+					   int prettyFlags);
+static char *pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
+							int prettyFlags);
+static text *pg_get_expr_worker(text *expr, Oid relid, const char *relname,
+				   int prettyFlags);
+static int print_function_arguments(StringInfo buf, HeapTuple proctup,
+						 bool print_table_args, bool print_defaults);
+static void print_function_rettype(StringInfo buf, HeapTuple proctup);
+static void print_function_trftypes(StringInfo buf, HeapTuple proctup);
+static void set_rtable_names(deparse_namespace *dpns, List *parent_namespaces,
+				 Bitmapset *rels_used);
+static void set_deparse_for_query(deparse_namespace *dpns, Query *query,
+					  List *parent_namespaces);
+static void set_simple_column_names(deparse_namespace *dpns);
+static bool has_dangerous_join_using(deparse_namespace *dpns, Node *jtnode);
+static void set_using_names(deparse_namespace *dpns, Node *jtnode,
+				List *parentUsing);
+static void set_relation_column_names(deparse_namespace *dpns,
+						  RangeTblEntry *rte,
+						  deparse_columns *colinfo);
+static void set_join_column_names(deparse_namespace *dpns, RangeTblEntry *rte,
+					  deparse_columns *colinfo);
+static bool colname_is_unique(char *colname, deparse_namespace *dpns,
+				  deparse_columns *colinfo);
+static char *make_colname_unique(char *colname, deparse_namespace *dpns,
+					deparse_columns *colinfo);
+static void expand_colnames_array_to(deparse_columns *colinfo, int n);
+static void identify_join_columns(JoinExpr *j, RangeTblEntry *jrte,
+					  deparse_columns *colinfo);
+static void flatten_join_using_qual(Node *qual,
+						List **leftvars, List **rightvars);
+static char *get_rtable_name(int rtindex, deparse_context *context);
+static void set_deparse_planstate(deparse_namespace *dpns, PlanState *ps);
+static void push_child_plan(deparse_namespace *dpns, PlanState *ps,
+				deparse_namespace *save_dpns);
+static void pop_child_plan(deparse_namespace *dpns,
+			   deparse_namespace *save_dpns);
+static void push_ancestor_plan(deparse_namespace *dpns, ListCell *ancestor_cell,
+				   deparse_namespace *save_dpns);
+static void pop_ancestor_plan(deparse_namespace *dpns,
+				  deparse_namespace *save_dpns);
+static void make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
+			 int prettyFlags);
+static void make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
+			 int prettyFlags, int wrapColumn);
+static void get_query_def(Query *query, StringInfo buf, List *parentnamespace,
+			  TupleDesc resultDesc,
+			  int prettyFlags, int wrapColumn, int startIndent);
+static void get_values_def(List *values_lists, deparse_context *context);
+static void get_with_clause(Query *query, deparse_context *context);
+static void get_select_query_def(Query *query, deparse_context *context,
+					 TupleDesc resultDesc);
+static void get_insert_query_def(Query *query, deparse_context *context);
+static void get_update_query_def(Query *query, deparse_context *context);
+static void get_update_query_targetlist_def(Query *query, List *targetList,
+								deparse_context *context,
+								RangeTblEntry *rte);
+static void get_delete_query_def(Query *query, deparse_context *context);
+static void get_utility_query_def(Query *query, deparse_context *context);
+static void get_basic_select_query(Query *query, deparse_context *context,
+					   TupleDesc resultDesc);
+static void get_target_list(List *targetList, deparse_context *context,
+				TupleDesc resultDesc);
+static void get_setop_query(Node *setOp, Query *query,
+				deparse_context *context,
+				TupleDesc resultDesc);
+static Node *get_rule_sortgroupclause(Index ref, List *tlist,
+						 bool force_colno,
+						 deparse_context *context);
+static void get_rule_groupingset(GroupingSet *gset, List *targetlist,
+					 bool omit_parens, deparse_context *context);
+static void get_rule_orderby(List *orderList, List *targetList,
+				 bool force_colno, deparse_context *context);
+static void get_rule_windowclause(Query *query, deparse_context *context);
+static void get_rule_windowspec(WindowClause *wc, List *targetList,
+					deparse_context *context);
+static char *get_variable(Var *var, int levelsup, bool istoplevel,
+			 deparse_context *context);
+static Node *find_param_referent(Param *param, deparse_context *context,
+					deparse_namespace **dpns_p, ListCell **ancestor_cell_p);
+static void get_parameter(Param *param, deparse_context *context);
+static const char *get_simple_binary_op_name(OpExpr *expr);
+static bool isSimpleNode(Node *node, Node *parentNode, int prettyFlags);
+static void appendContextKeyword(deparse_context *context, const char *str,
+					 int indentBefore, int indentAfter, int indentPlus);
+static void removeStringInfoSpaces(StringInfo str);
+static void get_rule_expr(Node *node, deparse_context *context,
+			  bool showimplicit);
+static void get_rule_expr_toplevel(Node *node, deparse_context *context,
+					   bool showimplicit);
+static void get_oper_expr(OpExpr *expr, deparse_context *context);
+static void get_func_expr(FuncExpr *expr, deparse_context *context,
+			  bool showimplicit);
+static void get_agg_expr(Aggref *aggref, deparse_context *context);
+static void get_windowfunc_expr(WindowFunc *wfunc, deparse_context *context);
+static void get_coercion_expr(Node *arg, deparse_context *context,
+				  Oid resulttype, int32 resulttypmod,
+				  Node *parentNode);
+static void get_const_expr(Const *constval, deparse_context *context,
+			   int showtype);
+static void get_const_collation(Const *constval, deparse_context *context);
+static void simple_quote_literal(StringInfo buf, const char *val);
+static void get_sublink_expr(SubLink *sublink, deparse_context *context);
+static void get_from_clause(Query *query, const char *prefix,
+				deparse_context *context);
+static void get_from_clause_item(Node *jtnode, Query *query,
+					 deparse_context *context);
+static void get_column_alias_list(deparse_columns *colinfo,
+					  deparse_context *context);
+static void get_from_clause_coldeflist(RangeTblFunction *rtfunc,
+						   deparse_columns *colinfo,
+						   deparse_context *context);
+static void get_tablesample_def(TableSampleClause *tablesample,
+					deparse_context *context);
+static void get_opclass_name(Oid opclass, Oid actual_datatype,
+				 StringInfo buf);
+static Node *processIndirection(Node *node, deparse_context *context,
+				   bool printit);
+static void printSubscripts(ArrayRef *aref, deparse_context *context);
+static char *get_relation_name(Oid relid);
+static char *generate_relation_name(Oid relid, List *namespaces);
+static char *generate_qualified_relation_name(Oid relid);
+static char *generate_function_name(Oid funcid, int nargs,
+					   List *argnames, Oid *argtypes,
+					   bool has_variadic, bool *use_variadic_p,
+					   ParseExprKind special_exprkind);
+static char *generate_operator_name(Oid operid, Oid arg1, Oid arg2);
+static text *string_to_text(char *str);
+static char *flatten_reloptions(Oid relid);
+
+#define only_marker(rte)  ((rte)->inh ? "" : "ONLY ")
+
+
+/* ----------
+ * get_ruledef			- Do it all and return a text
+ *				  that could be used as a statement
+ *				  to recreate the rule
+ * ----------
+ */
+
+
+
+
+
+
+
+
+
+/* ----------
+ * get_viewdef			- Mainly the same thing, but we
+ *				  only return the SELECT part of a view
+ * ----------
+ */
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * Common code for by-OID and by-name variants of pg_get_viewdef
+ */
+
+
+/* ----------
+ * get_triggerdef			- Get the definition of a trigger
+ * ----------
+ */
+
+
+
+
+
+
+/* ----------
+ * get_indexdef			- Get the definition of an index
+ *
+ * In the extended version, there is a colno argument as well as pretty bool.
+ *	if colno == 0, we want a complete index definition.
+ *	if colno > 0, we only want the Nth index key's variable or expression.
+ *
+ * Note that the SQL-function versions of this omit any info about the
+ * index tablespace; this is intentional because pg_dump wants it that way.
+ * However pg_get_indexdef_string() includes index tablespace if not default.
+ * ----------
+ */
+
+
+
+
+/* Internal version that returns a palloc'd C string; no pretty-printing */
+
+
+/* Internal version that just reports the column definitions */
+
+
+/*
+ * Internal workhorse to decompile an index definition.
+ *
+ * This is now used for exclusion constraints as well: if excludeOps is not
+ * NULL then it points to an array of exclusion operator OIDs.
+ */
+
+
+
+/*
+ * pg_get_constraintdef
+ *
+ * Returns the definition for the constraint, ie, everything that needs to
+ * appear after "ALTER TABLE ... ADD CONSTRAINT <constraintname>".
+ */
+
+
+
+
+/*
+ * Internal version that returns a full ALTER TABLE ... ADD CONSTRAINT command
+ */
+
+
+/*
+ * As of 9.4, we now use an MVCC snapshot for this.
+ */
+
+
+
+/*
+ * Convert an int16[] Datum into a comma-separated list of column names
+ * for the indicated relation; append the list to buf.
+ */
+
+
+
+/* ----------
+ * get_expr			- Decompile an expression tree
+ *
+ * Input: an expression tree in nodeToString form, and a relation OID
+ *
+ * Output: reverse-listed expression
+ *
+ * Currently, the expression can only refer to a single relation, namely
+ * the one specified by the second parameter.  This is sufficient for
+ * partial indexes, column default expressions, etc.  We also support
+ * Var-free expressions, for which the OID can be InvalidOid.
+ * ----------
+ */
+
+
+
+
+
+
+
+/* ----------
+ * get_userbyid			- Get a user name by roleid and
+ *				  fallback to 'unknown (OID=n)'
+ * ----------
+ */
+
+
+
+/*
+ * pg_get_serial_sequence
+ *		Get the name of the sequence used by a serial column,
+ *		formatted suitably for passing to setval, nextval or currval.
+ *		First parameter is not treated as double-quoted, second parameter
+ *		is --- see documentation for reason.
+ */
+
+
+
+/*
+ * pg_get_functiondef
+ *		Returns the complete "CREATE OR REPLACE FUNCTION ..." statement for
+ *		the specified function.
+ *
+ * Note: if you change the output format of this function, be careful not
+ * to break psql's rules (in \ef and \sf) for identifying the start of the
+ * function body.  To wit: the function body starts on a line that begins
+ * with "AS ", and no preceding line will look like that.
+ */
+
+
+/*
+ * pg_get_function_arguments
+ *		Get a nicely-formatted list of arguments for a function.
+ *		This is everything that would go between the parentheses in
+ *		CREATE FUNCTION.
+ */
+
+
+/*
+ * pg_get_function_identity_arguments
+ *		Get a formatted list of arguments for a function.
+ *		This is everything that would go between the parentheses in
+ *		ALTER FUNCTION, etc.  In particular, don't print defaults.
+ */
+
+
+/*
+ * pg_get_function_result
+ *		Get a nicely-formatted version of the result type of a function.
+ *		This is what would appear after RETURNS in CREATE FUNCTION.
+ */
+
+
+/*
+ * Guts of pg_get_function_result: append the function's return type
+ * to the specified buffer.
+ */
+
+
+/*
+ * Common code for pg_get_function_arguments and pg_get_function_result:
+ * append the desired subset of arguments to buf.  We print only TABLE
+ * arguments when print_table_args is true, and all the others when it's false.
+ * We print argument defaults only if print_defaults is true.
+ * Function return value is the number of arguments printed.
+ */
+
+
+
+
+/*
+ * Append used transformated types to specified buffer
+ */
+
+
+/*
+ * Get textual representation of a function argument's default value.  The
+ * second argument of this function is the argument number among all arguments
+ * (i.e. proallargtypes, *not* proargtypes), starting with 1, because that's
+ * how information_schema.sql uses it.
+ */
+
+
+
+/*
+ * deparse_expression			- General utility for deparsing expressions
+ *
+ * calls deparse_expression_pretty with all prettyPrinting disabled
+ */
+
+
+/* ----------
+ * deparse_expression_pretty	- General utility for deparsing expressions
+ *
+ * expr is the node tree to be deparsed.  It must be a transformed expression
+ * tree (ie, not the raw output of gram.y).
+ *
+ * dpcontext is a list of deparse_namespace nodes representing the context
+ * for interpreting Vars in the node tree.  It can be NIL if no Vars are
+ * expected.
+ *
+ * forceprefix is TRUE to force all Vars to be prefixed with their table names.
+ *
+ * showimplicit is TRUE to force all implicit casts to be shown explicitly.
+ *
+ * Tries to pretty up the output according to prettyFlags and startIndent.
+ *
+ * The result is a palloc'd string.
+ * ----------
+ */
+
+
+/* ----------
+ * deparse_context_for			- Build deparse context for a single relation
+ *
+ * Given the reference name (alias) and OID of a relation, build deparsing
+ * context for an expression referencing only that relation (as varno 1,
+ * varlevelsup 0).  This is sufficient for many uses of deparse_expression.
+ * ----------
+ */
+
+
+/*
+ * deparse_context_for_plan_rtable - Build deparse context for a plan's rtable
+ *
+ * When deparsing an expression in a Plan tree, we use the plan's rangetable
+ * to resolve names of simple Vars.  The initialization of column names for
+ * this is rather expensive if the rangetable is large, and it'll be the same
+ * for every expression in the Plan tree; so we do it just once and re-use
+ * the result of this function for each expression.  (Note that the result
+ * is not usable until set_deparse_context_planstate() is applied to it.)
+ *
+ * In addition to the plan's rangetable list, pass the per-RTE alias names
+ * assigned by a previous call to select_rtable_names_for_explain.
+ */
+
+
+/*
+ * set_deparse_context_planstate	- Specify Plan node containing expression
+ *
+ * When deparsing an expression in a Plan tree, we might have to resolve
+ * OUTER_VAR, INNER_VAR, or INDEX_VAR references.  To do this, the caller must
+ * provide the parent PlanState node.  Then OUTER_VAR and INNER_VAR references
+ * can be resolved by drilling down into the left and right child plans.
+ * Similarly, INDEX_VAR references can be resolved by reference to the
+ * indextlist given in a parent IndexOnlyScan node, or to the scan tlist in
+ * ForeignScan and CustomScan nodes.  (Note that we don't currently support
+ * deparsing of indexquals in regular IndexScan or BitmapIndexScan nodes;
+ * for those, we can only deparse the indexqualorig fields, which won't
+ * contain INDEX_VAR Vars.)
+ *
+ * Note: planstate really ought to be declared as "PlanState *", but we use
+ * "Node *" to avoid having to include execnodes.h in ruleutils.h.
+ *
+ * The ancestors list is a list of the PlanState's parent PlanStates, the
+ * most-closely-nested first.  This is needed to resolve PARAM_EXEC Params.
+ * Note we assume that all the PlanStates share the same rtable.
+ *
+ * Once this function has been called, deparse_expression() can be called on
+ * subsidiary expression(s) of the specified PlanState node.  To deparse
+ * expressions of a different Plan node in the same Plan tree, re-call this
+ * function to identify the new parent Plan node.
+ *
+ * The result is the same List passed in; this is a notational convenience.
+ */
+
+
+/*
+ * select_rtable_names_for_explain	- Select RTE aliases for EXPLAIN
+ *
+ * Determine the relation aliases we'll use during an EXPLAIN operation.
+ * This is just a frontend to set_rtable_names.  We have to expose the aliases
+ * to EXPLAIN because EXPLAIN needs to know the right alias names to print.
+ */
+
+
+/*
+ * set_rtable_names: select RTE aliases to be used in printing a query
+ *
+ * We fill in dpns->rtable_names with a list of names that is one-for-one with
+ * the already-filled dpns->rtable list.  Each RTE name is unique among those
+ * in the new namespace plus any ancestor namespaces listed in
+ * parent_namespaces.
+ *
+ * If rels_used isn't NULL, only RTE indexes listed in it are given aliases.
+ *
+ * Note that this function is only concerned with relation names, not column
+ * names.
+ */
+
+
+/*
+ * set_deparse_for_query: set up deparse_namespace for deparsing a Query tree
+ *
+ * For convenience, this is defined to initialize the deparse_namespace struct
+ * from scratch.
+ */
+
+
+/*
+ * set_simple_column_names: fill in column aliases for non-query situations
+ *
+ * This handles EXPLAIN and cases where we only have relation RTEs.  Without
+ * a join tree, we can't do anything smart about join RTEs, but we don't
+ * need to (note that EXPLAIN should never see join alias Vars anyway).
+ * If we do hit a join RTE we'll just process it like a non-table base RTE.
+ */
+
+
+/*
+ * has_dangerous_join_using: search jointree for unnamed JOIN USING
+ *
+ * Merged columns of a JOIN USING may act differently from either of the input
+ * columns, either because they are merged with COALESCE (in a FULL JOIN) or
+ * because an implicit coercion of the underlying input column is required.
+ * In such a case the column must be referenced as a column of the JOIN not as
+ * a column of either input.  And this is problematic if the join is unnamed
+ * (alias-less): we cannot qualify the column's name with an RTE name, since
+ * there is none.  (Forcibly assigning an alias to the join is not a solution,
+ * since that will prevent legal references to tables below the join.)
+ * To ensure that every column in the query is unambiguously referenceable,
+ * we must assign such merged columns names that are globally unique across
+ * the whole query, aliasing other columns out of the way as necessary.
+ *
+ * Because the ensuing re-aliasing is fairly damaging to the readability of
+ * the query, we don't do this unless we have to.  So, we must pre-scan
+ * the join tree to see if we have to, before starting set_using_names().
+ */
+
+
+/*
+ * set_using_names: select column aliases to be used for merged USING columns
+ *
+ * We do this during a recursive descent of the query jointree.
+ * dpns->unique_using must already be set to determine the global strategy.
+ *
+ * Column alias info is saved in the dpns->rtable_columns list, which is
+ * assumed to be filled with pre-zeroed deparse_columns structs.
+ *
+ * parentUsing is a list of all USING aliases assigned in parent joins of
+ * the current jointree node.  (The passed-in list must not be modified.)
+ */
+
+
+/*
+ * set_relation_column_names: select column aliases for a non-join RTE
+ *
+ * Column alias info is saved in *colinfo, which is assumed to be pre-zeroed.
+ * If any colnames entries are already filled in, those override local
+ * choices.
+ */
+
+
+/*
+ * set_join_column_names: select column aliases for a join RTE
+ *
+ * Column alias info is saved in *colinfo, which is assumed to be pre-zeroed.
+ * If any colnames entries are already filled in, those override local
+ * choices.  Also, names for USING columns were already chosen by
+ * set_using_names().  We further expect that column alias selection has been
+ * completed for both input RTEs.
+ */
+#ifdef USE_ASSERT_CHECKING
+#endif
+
+/*
+ * colname_is_unique: is colname distinct from already-chosen column names?
+ *
+ * dpns is query-wide info, colinfo is for the column's RTE
+ */
+
+
+/*
+ * make_colname_unique: modify colname if necessary to make it unique
+ *
+ * dpns is query-wide info, colinfo is for the column's RTE
+ */
+
+
+/*
+ * expand_colnames_array_to: make colinfo->colnames at least n items long
+ *
+ * Any added array entries are initialized to zero.
+ */
+
+
+/*
+ * identify_join_columns: figure out where columns of a join come from
+ *
+ * Fills the join-specific fields of the colinfo struct, except for
+ * usingNames which is filled later.
+ */
+
+
+/*
+ * flatten_join_using_qual: extract Vars being joined from a JOIN/USING qual
+ *
+ * We assume that transformJoinUsingClause won't have produced anything except
+ * AND nodes, equality operator nodes, and possibly implicit coercions, and
+ * that the AND node inputs match left-to-right with the original USING list.
+ *
+ * Caller must initialize the result lists to NIL.
+ */
+
+
+/*
+ * get_rtable_name: convenience function to get a previously assigned RTE alias
+ *
+ * The RTE must belong to the topmost namespace level in "context".
+ */
+
+
+/*
+ * set_deparse_planstate: set up deparse_namespace to parse subexpressions
+ * of a given PlanState node
+ *
+ * This sets the planstate, outer_planstate, inner_planstate, outer_tlist,
+ * inner_tlist, and index_tlist fields.  Caller is responsible for adjusting
+ * the ancestors list if necessary.  Note that the rtable and ctes fields do
+ * not need to change when shifting attention to different plan nodes in a
+ * single plan tree.
+ */
+
+
+/*
+ * push_child_plan: temporarily transfer deparsing attention to a child plan
+ *
+ * When expanding an OUTER_VAR or INNER_VAR reference, we must adjust the
+ * deparse context in case the referenced expression itself uses
+ * OUTER_VAR/INNER_VAR.  We modify the top stack entry in-place to avoid
+ * affecting levelsup issues (although in a Plan tree there really shouldn't
+ * be any).
+ *
+ * Caller must provide a local deparse_namespace variable to save the
+ * previous state for pop_child_plan.
+ */
+
+
+/*
+ * pop_child_plan: undo the effects of push_child_plan
+ */
+
+
+/*
+ * push_ancestor_plan: temporarily transfer deparsing attention to an
+ * ancestor plan
+ *
+ * When expanding a Param reference, we must adjust the deparse context
+ * to match the plan node that contains the expression being printed;
+ * otherwise we'd fail if that expression itself contains a Param or
+ * OUTER_VAR/INNER_VAR/INDEX_VAR variable.
+ *
+ * The target ancestor is conveniently identified by the ListCell holding it
+ * in dpns->ancestors.
+ *
+ * Caller must provide a local deparse_namespace variable to save the
+ * previous state for pop_ancestor_plan.
+ */
+
+
+/*
+ * pop_ancestor_plan: undo the effects of push_ancestor_plan
+ */
+
+
+
+/* ----------
+ * make_ruledef			- reconstruct the CREATE RULE command
+ *				  for a given pg_rewrite tuple
+ * ----------
+ */
+
+
+
+/* ----------
+ * make_viewdef			- reconstruct the SELECT part of a
+ *				  view rewrite rule
+ * ----------
+ */
+
+
+
+/* ----------
+ * get_query_def			- Parse back one query parsetree
+ *
+ * If resultDesc is not NULL, then it is the output tuple descriptor for
+ * the view represented by a SELECT query.
+ * ----------
+ */
+
+
+/* ----------
+ * get_values_def			- Parse back a VALUES list
+ * ----------
+ */
+
+
+/* ----------
+ * get_with_clause			- Parse back a WITH clause
+ * ----------
+ */
+
+
+/* ----------
+ * get_select_query_def			- Parse back a SELECT parsetree
+ * ----------
+ */
+
+
+/*
+ * Detect whether query looks like SELECT ... FROM VALUES();
+ * if so, return the VALUES RTE.  Otherwise return NULL.
+ */
+
+
+
+
+/* ----------
+ * get_target_list			- Parse back a SELECT target list
+ *
+ * This is also used for RETURNING lists in INSERT/UPDATE/DELETE.
+ * ----------
+ */
+
+
+
+
+/*
+ * Display a sort/group clause.
+ *
+ * Also returns the expression tree, so caller need not find it again.
+ */
+
+
+/*
+ * Display a GroupingSet
+ */
+
+
+/*
+ * Display an ORDER BY list.
+ */
+
+
+/*
+ * Display a WINDOW clause.
+ *
+ * Note that the windowClause list might contain only anonymous window
+ * specifications, in which case we should print nothing here.
+ */
+
+
+/*
+ * Display a window definition
+ */
+
+
+/* ----------
+ * get_insert_query_def			- Parse back an INSERT parsetree
+ * ----------
+ */
+
+
+
+/* ----------
+ * get_update_query_def			- Parse back an UPDATE parsetree
+ * ----------
+ */
+
+
+
+/* ----------
+ * get_update_query_targetlist_def			- Parse back an UPDATE targetlist
+ * ----------
+ */
+
+
+
+/* ----------
+ * get_delete_query_def			- Parse back a DELETE parsetree
+ * ----------
+ */
+
+
+
+/* ----------
+ * get_utility_query_def			- Parse back a UTILITY parsetree
+ * ----------
+ */
+
+
+
+/*
+ * Display a Var appropriately.
+ *
+ * In some cases (currently only when recursing into an unnamed join)
+ * the Var's varlevelsup has to be interpreted with respect to a context
+ * above the current one; levelsup indicates the offset.
+ *
+ * If istoplevel is TRUE, the Var is at the top level of a SELECT's
+ * targetlist, which means we need special treatment of whole-row Vars.
+ * Instead of the normal "tab.*", we'll print "tab.*::typename", which is a
+ * dirty hack to prevent "tab.*" from being expanded into multiple columns.
+ * (The parser will strip the useless coercion, so no inefficiency is added in
+ * dump and reload.)  We used to print just "tab" in such cases, but that is
+ * ambiguous and will yield the wrong result if "tab" is also a plain column
+ * name in the query.
+ *
+ * Returns the attname of the Var, or NULL if the Var has no attname (because
+ * it is a whole-row Var or a subplan output reference).
+ */
+
+
+
+/*
+ * Get the name of a field of an expression of composite type.  The
+ * expression is usually a Var, but we handle other cases too.
+ *
+ * levelsup is an extra offset to interpret the Var's varlevelsup correctly.
+ *
+ * This is fairly straightforward when the expression has a named composite
+ * type; we need only look up the type in the catalogs.  However, the type
+ * could also be RECORD.  Since no actual table or view column is allowed to
+ * have type RECORD, a Var of type RECORD must refer to a JOIN or FUNCTION RTE
+ * or to a subquery output.  We drill down to find the ultimate defining
+ * expression and attempt to infer the field name from it.  We ereport if we
+ * can't determine the name.
+ *
+ * Similarly, a PARAM of type RECORD has to refer to some expression of
+ * a determinable composite type.
+ */
+
+
+/*
+ * Try to find the referenced expression for a PARAM_EXEC Param that might
+ * reference a parameter supplied by an upper NestLoop or SubPlan plan node.
+ *
+ * If successful, return the expression and set *dpns_p and *ancestor_cell_p
+ * appropriately for calling push_ancestor_plan().  If no referent can be
+ * found, return NULL.
+ */
+
+
+/*
+ * Display a Param appropriately.
+ */
+
+
+/*
+ * get_simple_binary_op_name
+ *
+ * helper function for isSimpleNode
+ * will return single char binary operator name, or NULL if it's not
+ */
+
+
+
+/*
+ * isSimpleNode - check if given node is simple (doesn't need parenthesizing)
+ *
+ *	true   : simple in the context of parent node's type
+ *	false  : not simple
+ */
+
+
+
+/*
+ * appendContextKeyword - append a keyword to buffer
+ *
+ * If prettyPrint is enabled, perform a line break, and adjust indentation.
+ * Otherwise, just append the keyword.
+ */
+
+
+/*
+ * removeStringInfoSpaces - delete trailing spaces from a buffer.
+ *
+ * Possibly this should move to stringinfo.c at some point.
+ */
+
+
+
+/*
+ * get_rule_expr_paren	- deparse expr using get_rule_expr,
+ * embracing the string with parentheses if necessary for prettyPrint.
+ *
+ * Never embrace if prettyFlags=0, because it's done in the calling node.
+ *
+ * Any node that does *not* embrace its argument node by sql syntax (with
+ * parentheses, non-operator keywords like CASE/WHEN/ON, or comma etc) should
+ * use get_rule_expr_paren instead of get_rule_expr so parentheses can be
+ * added.
+ */
+
+
+
+/* ----------
+ * get_rule_expr			- Parse back an expression
+ *
+ * Note: showimplicit determines whether we display any implicit cast that
+ * is present at the top of the expression tree.  It is a passed argument,
+ * not a field of the context struct, because we change the value as we
+ * recurse down into the expression.  In general we suppress implicit casts
+ * when the result type is known with certainty (eg, the arguments of an
+ * OR must be boolean).  We display implicit casts for arguments of functions
+ * and operators, since this is needed to be certain that the same function
+ * or operator will be chosen when the expression is re-parsed.
+ * ----------
+ */
+
+
+/*
+ * get_rule_expr_toplevel		- Parse back a toplevel expression
+ *
+ * Same as get_rule_expr(), except that if the expr is just a Var, we pass
+ * istoplevel = true not false to get_variable().  This causes whole-row Vars
+ * to get printed with decoration that will prevent expansion of "*".
+ * We need to use this in contexts such as ROW() and VALUES(), where the
+ * parser would expand "foo.*" appearing at top level.  (In principle we'd
+ * use this in get_target_list() too, but that has additional worries about
+ * whether to print AS, so it needs to invoke get_variable() directly anyway.)
+ */
+
+
+
+/*
+ * get_oper_expr			- Parse back an OpExpr node
+ */
+
+
+/*
+ * get_func_expr			- Parse back a FuncExpr node
+ */
+
+
+/*
+ * get_agg_expr			- Parse back an Aggref node
+ */
+
+
+/*
+ * get_windowfunc_expr	- Parse back a WindowFunc node
+ */
+
+
+/* ----------
+ * get_coercion_expr
+ *
+ *	Make a string representation of a value coerced to a specific type
+ * ----------
+ */
+
+
+/* ----------
+ * get_const_expr
+ *
+ *	Make a string representation of a Const
+ *
+ * showtype can be -1 to never show "::typename" decoration, or +1 to always
+ * show it, or 0 to show it only if the constant wouldn't be assumed to be
+ * the right type by default.
+ *
+ * If the Const's collation isn't default for its type, show that too.
+ * We mustn't do this when showtype is -1 (since that means the caller will
+ * print "::typename", and we can't put a COLLATE clause in between).  It's
+ * caller's responsibility that collation isn't missed in such cases.
+ * ----------
+ */
+
+
+/*
+ * helper for get_const_expr: append COLLATE if needed
+ */
+
+
+/*
+ * simple_quote_literal - Format a string as a SQL literal, append to buf
+ */
+
+
+
+/* ----------
+ * get_sublink_expr			- Parse back a sublink
+ * ----------
+ */
+
+
+
+/* ----------
+ * get_from_clause			- Parse back a FROM clause
+ *
+ * "prefix" is the keyword that denotes the start of the list of FROM
+ * elements. It is FROM when used to parse back SELECT and UPDATE, but
+ * is USING when parsing back DELETE.
+ * ----------
+ */
+
+
+
+
+/*
+ * get_column_alias_list - print column alias list for an RTE
+ *
+ * Caller must already have printed the relation's alias name.
+ */
+
+
+/*
+ * get_from_clause_coldeflist - reproduce FROM clause coldeflist
+ *
+ * When printing a top-level coldeflist (which is syntactically also the
+ * relation's column alias list), use column names from colinfo.  But when
+ * printing a coldeflist embedded inside ROWS FROM(), we prefer to use the
+ * original coldeflist's names, which are available in rtfunc->funccolnames.
+ * Pass NULL for colinfo to select the latter behavior.
+ *
+ * The coldeflist is appended immediately (no space) to buf.  Caller is
+ * responsible for ensuring that an alias or AS is present before it.
+ */
+
+
+/*
+ * get_tablesample_def			- print a TableSampleClause
+ */
+
+
+/*
+ * get_opclass_name			- fetch name of an index operator class
+ *
+ * The opclass name is appended (after a space) to buf.
+ *
+ * Output is suppressed if the opclass is the default for the given
+ * actual_datatype.  (If you don't want this behavior, just pass
+ * InvalidOid for actual_datatype.)
+ */
+
+
+/*
+ * processIndirection - take care of array and subfield assignment
+ *
+ * We strip any top-level FieldStore or assignment ArrayRef nodes that
+ * appear in the input, and return the subexpression that's to be assigned.
+ * If printit is true, we also print out the appropriate decoration for the
+ * base column name (that the caller just printed).
+ */
+
+
+
+
+/*
+ * quote_identifier			- Quote an identifier only if needed
+ *
+ * When quotes are needed, we palloc the required space; slightly
+ * space-wasteful but well worth it for notational simplicity.
+ */
+const char *
+quote_identifier(const char *ident)
+{
+	/*
+	 * Can avoid quoting if ident starts with a lowercase letter or underscore
+	 * and contains only lowercase letters, digits, and underscores, *and* is
+	 * not any SQL keyword.  Otherwise, supply quotes.
+	 */
+	int			nquotes = 0;
+	bool		safe;
+	const char *ptr;
+	char	   *result;
+	char	   *optr;
+
+	/*
+	 * would like to use <ctype.h> macros here, but they might yield unwanted
+	 * locale-specific results...
+	 */
+	safe = ((ident[0] >= 'a' && ident[0] <= 'z') || ident[0] == '_');
+
+	for (ptr = ident; *ptr; ptr++)
+	{
+		char		ch = *ptr;
+
+		if ((ch >= 'a' && ch <= 'z') ||
+			(ch >= '0' && ch <= '9') ||
+			(ch == '_'))
+		{
+			/* okay */
+		}
+		else
+		{
+			safe = false;
+			if (ch == '"')
+				nquotes++;
+		}
+	}
+
+	if (quote_all_identifiers)
+		safe = false;
+
+	if (safe)
+	{
+		/*
+		 * Check for keyword.  We quote keywords except for unreserved ones.
+		 * (In some cases we could avoid quoting a col_name or type_func_name
+		 * keyword, but it seems much harder than it's worth to tell that.)
+		 *
+		 * Note: ScanKeywordLookup() does case-insensitive comparison, but
+		 * that's fine, since we already know we have all-lower-case.
+		 */
+		const ScanKeyword *keyword = ScanKeywordLookup(ident,
+													   ScanKeywords,
+													   NumScanKeywords);
+
+		if (keyword != NULL && keyword->category != UNRESERVED_KEYWORD)
+			safe = false;
+	}
+
+	if (safe)
+		return ident;			/* no change needed */
+
+	result = (char *) palloc(strlen(ident) + nquotes + 2 + 1);
+
+	optr = result;
+	*optr++ = '"';
+	for (ptr = ident; *ptr; ptr++)
+	{
+		char		ch = *ptr;
+
+		if (ch == '"')
+			*optr++ = '"';
+		*optr++ = ch;
+	}
+	*optr++ = '"';
+	*optr = '\0';
+
+	return result;
+}
+
+/*
+ * quote_qualified_identifier	- Quote a possibly-qualified identifier
+ *
+ * Return a name of the form qualifier.ident, or just ident if qualifier
+ * is NULL, quoting each component if necessary.  The result is palloc'd.
+ */
+
+
+/*
+ * get_relation_name
+ *		Get the unqualified name of a relation specified by OID
+ *
+ * This differs from the underlying get_rel_name() function in that it will
+ * throw error instead of silently returning NULL if the OID is bad.
+ */
+
+
+/*
+ * generate_relation_name
+ *		Compute the name to display for a relation specified by OID
+ *
+ * The result includes all necessary quoting and schema-prefixing.
+ *
+ * If namespaces isn't NIL, it must be a list of deparse_namespace nodes.
+ * We will forcibly qualify the relation name if it equals any CTE name
+ * visible in the namespace list.
+ */
+
+
+/*
+ * generate_qualified_relation_name
+ *		Compute the name to display for a relation specified by OID
+ *
+ * As above, but unconditionally schema-qualify the name.
+ */
+
+
+/*
+ * generate_function_name
+ *		Compute the name to display for a function specified by OID,
+ *		given that it is being called with the specified actual arg names and
+ *		types.  (Those matter because of ambiguous-function resolution rules.)
+ *
+ * If we're dealing with a potentially variadic function (in practice, this
+ * means a FuncExpr or Aggref, not some other way of calling a function), then
+ * has_variadic must specify whether variadic arguments have been merged,
+ * and *use_variadic_p will be set to indicate whether to print VARIADIC in
+ * the output.  For non-FuncExpr cases, has_variadic should be FALSE and
+ * use_variadic_p can be NULL.
+ *
+ * The result includes all necessary quoting and schema-prefixing.
+ */
+
+
+/*
+ * generate_operator_name
+ *		Compute the name to display for an operator specified by OID,
+ *		given that it is being called with the specified actual arg types.
+ *		(Arg types matter because of ambiguous-operator resolution rules.
+ *		Pass InvalidOid for unused arg of a unary operator.)
+ *
+ * The result includes all necessary quoting and schema-prefixing,
+ * plus the OPERATOR() decoration needed to use a qualified operator name
+ * in an expression.
+ */
+
+
+/*
+ * generate_collation_name
+ *		Compute the name to display for a collation specified by OID
+ *
+ * The result includes all necessary quoting and schema-prefixing.
+ */
+
+
+/*
+ * Given a C string, produce a TEXT datum.
+ *
+ * We assume that the input was palloc'd and may be freed.
+ */
+
+
+/*
+ * Generate a C string representing a relation's reloptions, or NULL if none.
+ */
+
diff --git a/foreign/libpg_query/src/postgres/src_backend_utils_error_assert.c b/foreign/libpg_query/src/postgres/src_backend_utils_error_assert.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_utils_error_assert.c
@@ -0,0 +1,61 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - ExceptionalCondition
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * assert.c
+ *	  Assert code.
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/utils/error/assert.c
+ *
+ * NOTE
+ *	  This should eventually work with elog()
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include <unistd.h>
+
+/*
+ * ExceptionalCondition - Handles the failure of an Assert()
+ */
+void
+ExceptionalCondition(const char *conditionName,
+					 const char *errorType,
+					 const char *fileName,
+					 int lineNumber)
+{
+	if (!PointerIsValid(conditionName)
+		|| !PointerIsValid(fileName)
+		|| !PointerIsValid(errorType))
+		write_stderr("TRAP: ExceptionalCondition: bad arguments\n");
+	else
+	{
+		write_stderr("TRAP: %s(\"%s\", File: \"%s\", Line: %d)\n",
+					 errorType, conditionName,
+					 fileName, lineNumber);
+	}
+
+	/* Usually this shouldn't be needed, but make sure the msg went out */
+	fflush(stderr);
+
+#ifdef SLEEP_ON_ASSERT
+
+	/*
+	 * It would be nice to use pg_usleep() here, but only does 2000 sec or 33
+	 * minutes, which seems too short.
+	 */
+	sleep(1000000);
+#endif
+
+	abort();
+}
diff --git a/foreign/libpg_query/src/postgres/src_backend_utils_error_elog.c b/foreign/libpg_query/src/postgres/src_backend_utils_error_elog.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_utils_error_elog.c
@@ -0,0 +1,2021 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - elog_start
+ * - write_stderr
+ * - err_gettext
+ * - errstart
+ * - PG_exception_stack
+ * - in_error_recursion_trouble
+ * - error_context_stack
+ * - is_log_level_output
+ * - recursion_depth
+ * - errfinish
+ * - pg_re_throw
+ * - EmitErrorReport
+ * - emit_log_hook
+ * - send_message_to_server_log
+ * - send_message_to_frontend
+ * - errmsg_internal
+ * - errcode
+ * - errmsg
+ * - errdetail
+ * - expand_fmt_string
+ * - useful_strerror
+ * - get_errno_symbol
+ * - errordata_stack_depth
+ * - errordata
+ * - elog_finish
+ * - errposition
+ * - errhint
+ * - internalerrposition
+ * - internalerrquery
+ * - geterrposition
+ * - getinternalerrposition
+ * - set_errcontext_domain
+ * - errcontext_msg
+ * - CopyErrorData
+ * - FlushErrorState
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * elog.c
+ *	  error logging and reporting
+ *
+ * Because of the extremely high rate at which log messages can be generated,
+ * we need to be mindful of the performance cost of obtaining any information
+ * that may be logged.  Also, it's important to keep in mind that this code may
+ * get called from within an aborted transaction, in which case operations
+ * such as syscache lookups are unsafe.
+ *
+ * Some notes about recursion and errors during error processing:
+ *
+ * We need to be robust about recursive-error scenarios --- for example,
+ * if we run out of memory, it's important to be able to report that fact.
+ * There are a number of considerations that go into this.
+ *
+ * First, distinguish between re-entrant use and actual recursion.  It
+ * is possible for an error or warning message to be emitted while the
+ * parameters for an error message are being computed.  In this case
+ * errstart has been called for the outer message, and some field values
+ * may have already been saved, but we are not actually recursing.  We handle
+ * this by providing a (small) stack of ErrorData records.  The inner message
+ * can be computed and sent without disturbing the state of the outer message.
+ * (If the inner message is actually an error, this isn't very interesting
+ * because control won't come back to the outer message generator ... but
+ * if the inner message is only debug or log data, this is critical.)
+ *
+ * Second, actual recursion will occur if an error is reported by one of
+ * the elog.c routines or something they call.  By far the most probable
+ * scenario of this sort is "out of memory"; and it's also the nastiest
+ * to handle because we'd likely also run out of memory while trying to
+ * report this error!  Our escape hatch for this case is to reset the
+ * ErrorContext to empty before trying to process the inner error.  Since
+ * ErrorContext is guaranteed to have at least 8K of space in it (see mcxt.c),
+ * we should be able to process an "out of memory" message successfully.
+ * Since we lose the prior error state due to the reset, we won't be able
+ * to return to processing the original error, but we wouldn't have anyway.
+ * (NOTE: the escape hatch is not used for recursive situations where the
+ * inner message is of less than ERROR severity; in that case we just
+ * try to process it and return normally.  Usually this will work, but if
+ * it ends up in infinite recursion, we will PANIC due to error stack
+ * overflow.)
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/utils/error/elog.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include <fcntl.h>
+#include <time.h>
+#include <unistd.h>
+#include <signal.h>
+#include <ctype.h>
+#ifdef HAVE_SYSLOG
+#include <syslog.h>
+#endif
+
+#include "access/transam.h"
+#include "access/xact.h"
+#include "libpq/libpq.h"
+#include "libpq/pqformat.h"
+#include "mb/pg_wchar.h"
+#include "miscadmin.h"
+#include "postmaster/postmaster.h"
+#include "postmaster/syslogger.h"
+#include "storage/ipc.h"
+#include "storage/proc.h"
+#include "tcop/tcopprot.h"
+#include "utils/guc.h"
+#include "utils/memutils.h"
+#include "utils/ps_status.h"
+
+
+#undef _
+#define _(x) err_gettext(x)
+
+static const char *err_gettext(const char *str) pg_attribute_format_arg(1);
+static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str);
+
+/* Global variables */
+__thread ErrorContextCallback *error_context_stack = NULL;
+
+
+__thread sigjmp_buf *PG_exception_stack = NULL;
+
+
+extern bool redirection_done;
+
+/*
+ * Hook for intercepting messages before they are sent to the server log.
+ * Note that the hook will not get called for messages that are suppressed
+ * by log_min_messages.  Also note that logging hooks implemented in preload
+ * libraries will miss any log messages that are generated before the
+ * library is loaded.
+ */
+__thread emit_log_hook_type emit_log_hook = NULL;
+
+
+/* GUC parameters */
+
+		/* format for extra log line info */
+
+
+
+#ifdef HAVE_SYSLOG
+
+/*
+ * Max string length to send to syslog().  Note that this doesn't count the
+ * sequence-number prefix we add, and of course it doesn't count the prefix
+ * added by syslog itself.  Solaris and sysklogd truncate the final message
+ * at 1024 bytes, so this value leaves 124 bytes for those prefixes.  (Most
+ * other syslog implementations seem to have limits of 2KB or so.)
+ */
+#ifndef PG_SYSLOG_LIMIT
+#define PG_SYSLOG_LIMIT 900
+#endif
+
+
+
+
+
+static void write_syslog(int level, const char *line);
+#endif
+
+static void write_console(const char *line, int len);
+
+#ifdef WIN32
+extern char *event_source;
+static void write_eventlog(int level, const char *line, int len);
+#endif
+
+/* We provide a small stack of ErrorData records for re-entrant cases */
+#define ERRORDATA_STACK_SIZE  5
+
+static ErrorData errordata[ERRORDATA_STACK_SIZE];
+
+static int	errordata_stack_depth = -1; /* index of topmost active frame */
+
+static int	recursion_depth = 0;	/* to detect actual recursion */
+
+/* buffers for formatted timestamps that might be used by both
+ * log_line_prefix and csv logs.
+ */
+
+#define FORMATTED_TS_LEN 128
+
+
+
+
+/* Macro for checking errordata_stack_depth is reasonable */
+#define CHECK_STACK_DEPTH() \
+	do { \
+		if (errordata_stack_depth < 0) \
+		{ \
+			errordata_stack_depth = -1; \
+			ereport(ERROR, (errmsg_internal("errstart was not called"))); \
+		} \
+	} while (0)
+
+
+static const char *process_log_prefix_padding(const char *p, int *padding);
+static void log_line_prefix(StringInfo buf, ErrorData *edata);
+static void send_message_to_server_log(ErrorData *edata);
+static void send_message_to_frontend(ErrorData *edata);
+static char *expand_fmt_string(const char *fmt, ErrorData *edata);
+static const char *useful_strerror(int errnum);
+static const char *get_errno_symbol(int errnum);
+static const char *error_severity(int elevel);
+static void append_with_tabs(StringInfo buf, const char *str);
+static bool is_log_level_output(int elevel, int log_min_level);
+static void write_pipe_chunks(char *data, int len, int dest);
+static void write_csvlog(ErrorData *edata);
+static void setup_formatted_log_time(void);
+static void setup_formatted_start_time(void);
+
+
+/*
+ * in_error_recursion_trouble --- are we at risk of infinite error recursion?
+ *
+ * This function exists to provide common control of various fallback steps
+ * that we take if we think we are facing infinite error recursion.  See the
+ * callers for details.
+ */
+bool
+in_error_recursion_trouble(void)
+{
+	/* Pull the plug if recurse more than once */
+	return (recursion_depth > 2);
+}
+
+/*
+ * One of those fallback steps is to stop trying to localize the error
+ * message, since there's a significant probability that that's exactly
+ * what's causing the recursion.
+ */
+static inline const char *
+err_gettext(const char *str)
+{
+#ifdef ENABLE_NLS
+	if (in_error_recursion_trouble())
+		return str;
+	else
+		return gettext(str);
+#else
+	return str;
+#endif
+}
+
+
+/*
+ * errstart --- begin an error-reporting cycle
+ *
+ * Create a stack entry and store the given parameters in it.  Subsequently,
+ * errmsg() and perhaps other routines will be called to further populate
+ * the stack entry.  Finally, errfinish() will be called to actually process
+ * the error report.
+ *
+ * Returns TRUE in normal case.  Returns FALSE to short-circuit the error
+ * report (if it's a warning or lower and not to be reported anywhere).
+ */
+bool
+errstart(int elevel, const char *filename, int lineno,
+		 const char *funcname, const char *domain)
+{
+	ErrorData  *edata;
+	bool		output_to_server;
+	bool		output_to_client = false;
+	int			i;
+
+	/*
+	 * Check some cases in which we want to promote an error into a more
+	 * severe error.  None of this logic applies for non-error messages.
+	 */
+	if (elevel >= ERROR)
+	{
+		/*
+		 * If we are inside a critical section, all errors become PANIC
+		 * errors.  See miscadmin.h.
+		 */
+		if (CritSectionCount > 0)
+			elevel = PANIC;
+
+		/*
+		 * Check reasons for treating ERROR as FATAL:
+		 *
+		 * 1. we have no handler to pass the error to (implies we are in the
+		 * postmaster or in backend startup).
+		 *
+		 * 2. ExitOnAnyError mode switch is set (initdb uses this).
+		 *
+		 * 3. the error occurred after proc_exit has begun to run.  (It's
+		 * proc_exit's responsibility to see that this doesn't turn into
+		 * infinite recursion!)
+		 */
+		if (elevel == ERROR)
+		{
+			if (PG_exception_stack == NULL ||
+				ExitOnAnyError ||
+				proc_exit_inprogress)
+				elevel = FATAL;
+		}
+
+		/*
+		 * If the error level is ERROR or more, errfinish is not going to
+		 * return to caller; therefore, if there is any stacked error already
+		 * in progress it will be lost.  This is more or less okay, except we
+		 * do not want to have a FATAL or PANIC error downgraded because the
+		 * reporting process was interrupted by a lower-grade error.  So check
+		 * the stack and make sure we panic if panic is warranted.
+		 */
+		for (i = 0; i <= errordata_stack_depth; i++)
+			elevel = Max(elevel, errordata[i].elevel);
+	}
+
+	/*
+	 * Now decide whether we need to process this report at all; if it's
+	 * warning or less and not enabled for logging, just return FALSE without
+	 * starting up any error logging machinery.
+	 */
+
+	/* Determine whether message is enabled for server log output */
+	output_to_server = is_log_level_output(elevel, log_min_messages);
+
+	/* Determine whether message is enabled for client output */
+	if (whereToSendOutput == DestRemote && elevel != COMMERROR)
+	{
+		/*
+		 * client_min_messages is honored only after we complete the
+		 * authentication handshake.  This is required both for security
+		 * reasons and because many clients can't handle NOTICE messages
+		 * during authentication.
+		 */
+		if (ClientAuthInProgress)
+			output_to_client = (elevel >= ERROR);
+		else
+			output_to_client = (elevel >= client_min_messages ||
+								elevel == INFO);
+	}
+
+	/* Skip processing effort if non-error message will not be output */
+	if (elevel < ERROR && !output_to_server && !output_to_client)
+		return false;
+
+	/*
+	 * We need to do some actual work.  Make sure that memory context
+	 * initialization has finished, else we can't do anything useful.
+	 */
+	if (ErrorContext == NULL)
+	{
+		/* Ooops, hard crash time; very little we can do safely here */
+		write_stderr("error occurred at %s:%d before error message processing is available\n",
+					 filename ? filename : "(unknown file)", lineno);
+		exit(2);
+	}
+
+	/*
+	 * Okay, crank up a stack entry to store the info in.
+	 */
+
+	if (recursion_depth++ > 0 && elevel >= ERROR)
+	{
+		/*
+		 * Ooops, error during error processing.  Clear ErrorContext as
+		 * discussed at top of file.  We will not return to the original
+		 * error's reporter or handler, so we don't need it.
+		 */
+		MemoryContextReset(ErrorContext);
+
+		/*
+		 * Infinite error recursion might be due to something broken in a
+		 * context traceback routine.  Abandon them too.  We also abandon
+		 * attempting to print the error statement (which, if long, could
+		 * itself be the source of the recursive failure).
+		 */
+		if (in_error_recursion_trouble())
+		{
+			error_context_stack = NULL;
+			debug_query_string = NULL;
+		}
+	}
+	if (++errordata_stack_depth >= ERRORDATA_STACK_SIZE)
+	{
+		/*
+		 * Wups, stack not big enough.  We treat this as a PANIC condition
+		 * because it suggests an infinite loop of errors during error
+		 * recovery.
+		 */
+		errordata_stack_depth = -1;		/* make room on stack */
+		ereport(PANIC, (errmsg_internal("ERRORDATA_STACK_SIZE exceeded")));
+	}
+
+	/* Initialize data for this error frame */
+	edata = &errordata[errordata_stack_depth];
+	MemSet(edata, 0, sizeof(ErrorData));
+	edata->elevel = elevel;
+	edata->output_to_server = output_to_server;
+	edata->output_to_client = output_to_client;
+	if (filename)
+	{
+		const char *slash;
+
+		/* keep only base name, useful especially for vpath builds */
+		slash = strrchr(filename, '/');
+		if (slash)
+			filename = slash + 1;
+	}
+	edata->filename = filename;
+	edata->lineno = lineno;
+	edata->funcname = funcname;
+	/* the default text domain is the backend's */
+	edata->domain = domain ? domain : PG_TEXTDOMAIN("postgres");
+	/* initialize context_domain the same way (see set_errcontext_domain()) */
+	edata->context_domain = edata->domain;
+	/* Select default errcode based on elevel */
+	if (elevel >= ERROR)
+		edata->sqlerrcode = ERRCODE_INTERNAL_ERROR;
+	else if (elevel == WARNING)
+		edata->sqlerrcode = ERRCODE_WARNING;
+	else
+		edata->sqlerrcode = ERRCODE_SUCCESSFUL_COMPLETION;
+	/* errno is saved here so that error parameter eval can't change it */
+	edata->saved_errno = errno;
+
+	/*
+	 * Any allocations for this error state level should go into ErrorContext
+	 */
+	edata->assoc_context = ErrorContext;
+
+	recursion_depth--;
+	return true;
+}
+
+/*
+ * errfinish --- end an error-reporting cycle
+ *
+ * Produce the appropriate error report(s) and pop the error stack.
+ *
+ * If elevel is ERROR or worse, control does not return to the caller.
+ * See elog.h for the error level definitions.
+ */
+void
+errfinish(int dummy,...)
+{
+	ErrorData  *edata = &errordata[errordata_stack_depth];
+	int			elevel;
+	MemoryContext oldcontext;
+	ErrorContextCallback *econtext;
+
+	recursion_depth++;
+	CHECK_STACK_DEPTH();
+	elevel = edata->elevel;
+
+	/*
+	 * Do processing in ErrorContext, which we hope has enough reserved space
+	 * to report an error.
+	 */
+	oldcontext = MemoryContextSwitchTo(ErrorContext);
+
+	/*
+	 * Call any context callback functions.  Errors occurring in callback
+	 * functions will be treated as recursive errors --- this ensures we will
+	 * avoid infinite recursion (see errstart).
+	 */
+	for (econtext = error_context_stack;
+		 econtext != NULL;
+		 econtext = econtext->previous)
+		(*econtext->callback) (econtext->arg);
+
+	/*
+	 * If ERROR (not more nor less) we pass it off to the current handler.
+	 * Printing it and popping the stack is the responsibility of the handler.
+	 */
+	if (elevel == ERROR)
+	{
+		/*
+		 * We do some minimal cleanup before longjmp'ing so that handlers can
+		 * execute in a reasonably sane state.
+		 *
+		 * Reset InterruptHoldoffCount in case we ereport'd from inside an
+		 * interrupt holdoff section.  (We assume here that no handler will
+		 * itself be inside a holdoff section.  If necessary, such a handler
+		 * could save and restore InterruptHoldoffCount for itself, but this
+		 * should make life easier for most.)
+		 */
+		InterruptHoldoffCount = 0;
+		QueryCancelHoldoffCount = 0;
+
+		CritSectionCount = 0;	/* should be unnecessary, but... */
+
+		/*
+		 * Note that we leave CurrentMemoryContext set to ErrorContext. The
+		 * handler should reset it to something else soon.
+		 */
+
+		recursion_depth--;
+		PG_RE_THROW();
+	}
+
+	/*
+	 * If we are doing FATAL or PANIC, abort any old-style COPY OUT in
+	 * progress, so that we can report the message before dying.  (Without
+	 * this, pq_putmessage will refuse to send the message at all, which is
+	 * what we want for NOTICE messages, but not for fatal exits.) This hack
+	 * is necessary because of poor design of old-style copy protocol.  Note
+	 * we must do this even if client is fool enough to have set
+	 * client_min_messages above FATAL, so don't look at output_to_client.
+	 */
+	if (elevel >= FATAL && whereToSendOutput == DestRemote)
+		pq_endcopyout(true);
+
+	/* Emit the message to the right places */
+	EmitErrorReport();
+
+	/* Now free up subsidiary data attached to stack entry, and release it */
+	if (edata->message)
+		pfree(edata->message);
+	if (edata->detail)
+		pfree(edata->detail);
+	if (edata->detail_log)
+		pfree(edata->detail_log);
+	if (edata->hint)
+		pfree(edata->hint);
+	if (edata->context)
+		pfree(edata->context);
+	if (edata->schema_name)
+		pfree(edata->schema_name);
+	if (edata->table_name)
+		pfree(edata->table_name);
+	if (edata->column_name)
+		pfree(edata->column_name);
+	if (edata->datatype_name)
+		pfree(edata->datatype_name);
+	if (edata->constraint_name)
+		pfree(edata->constraint_name);
+	if (edata->internalquery)
+		pfree(edata->internalquery);
+
+	errordata_stack_depth--;
+
+	/* Exit error-handling context */
+	MemoryContextSwitchTo(oldcontext);
+	recursion_depth--;
+
+	/*
+	 * Perform error recovery action as specified by elevel.
+	 */
+	if (elevel == FATAL)
+	{
+		/*
+		 * For a FATAL error, we let proc_exit clean up and exit.
+		 *
+		 * If we just reported a startup failure, the client will disconnect
+		 * on receiving it, so don't send any more to the client.
+		 */
+		if (PG_exception_stack == NULL && whereToSendOutput == DestRemote)
+			whereToSendOutput = DestNone;
+
+		/*
+		 * fflush here is just to improve the odds that we get to see the
+		 * error message, in case things are so hosed that proc_exit crashes.
+		 * Any other code you might be tempted to add here should probably be
+		 * in an on_proc_exit or on_shmem_exit callback instead.
+		 */
+		fflush(stdout);
+		fflush(stderr);
+
+		/*
+		 * Do normal process-exit cleanup, then return exit code 1 to indicate
+		 * FATAL termination.  The postmaster may or may not consider this
+		 * worthy of panic, depending on which subprocess returns it.
+		 */
+		proc_exit(1);
+	}
+
+	if (elevel >= PANIC)
+	{
+		/*
+		 * Serious crash time. Postmaster will observe SIGABRT process exit
+		 * status and kill the other backends too.
+		 *
+		 * XXX: what if we are *in* the postmaster?  abort() won't kill our
+		 * children...
+		 */
+		fflush(stdout);
+		fflush(stderr);
+		abort();
+	}
+
+	/*
+	 * Check for cancel/die interrupt first --- this is so that the user can
+	 * stop a query emitting tons of notice or warning messages, even if it's
+	 * in a loop that otherwise fails to check for interrupts.
+	 */
+	CHECK_FOR_INTERRUPTS();
+}
+
+
+/*
+ * errcode --- add SQLSTATE error code to the current error
+ *
+ * The code is expected to be represented as per MAKE_SQLSTATE().
+ */
+int
+errcode(int sqlerrcode)
+{
+	ErrorData  *edata = &errordata[errordata_stack_depth];
+
+	/* we don't bother incrementing recursion_depth */
+	CHECK_STACK_DEPTH();
+
+	edata->sqlerrcode = sqlerrcode;
+
+	return 0;					/* return value does not matter */
+}
+
+
+/*
+ * errcode_for_file_access --- add SQLSTATE error code to the current error
+ *
+ * The SQLSTATE code is chosen based on the saved errno value.  We assume
+ * that the failing operation was some type of disk file access.
+ *
+ * NOTE: the primary error message string should generally include %m
+ * when this is used.
+ */
+#ifdef EROFS
+#endif
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
+#endif
+
+/*
+ * errcode_for_socket_access --- add SQLSTATE error code to the current error
+ *
+ * The SQLSTATE code is chosen based on the saved errno value.  We assume
+ * that the failing operation was some type of socket access.
+ *
+ * NOTE: the primary error message string should generally include %m
+ * when this is used.
+ */
+#ifdef ECONNRESET
+#endif
+
+
+/*
+ * This macro handles expansion of a format string and associated parameters;
+ * it's common code for errmsg(), errdetail(), etc.  Must be called inside
+ * a routine that is declared like "const char *fmt, ..." and has an edata
+ * pointer set up.  The message is assigned to edata->targetfield, or
+ * appended to it if appendval is true.  The message is subject to translation
+ * if translateit is true.
+ *
+ * Note: we pstrdup the buffer rather than just transferring its storage
+ * to the edata field because the buffer might be considerably larger than
+ * really necessary.
+ */
+#define EVALUATE_MESSAGE(domain, targetfield, appendval, translateit)	\
+	{ \
+		char		   *fmtbuf; \
+		StringInfoData	buf; \
+		/* Internationalize the error format string */ \
+		if ((translateit) && !in_error_recursion_trouble()) \
+			fmt = dgettext((domain), fmt);				  \
+		/* Expand %m in format string */ \
+		fmtbuf = expand_fmt_string(fmt, edata); \
+		initStringInfo(&buf); \
+		if ((appendval) && edata->targetfield) { \
+			appendStringInfoString(&buf, edata->targetfield); \
+			appendStringInfoChar(&buf, '\n'); \
+		} \
+		/* Generate actual output --- have to use appendStringInfoVA */ \
+		for (;;) \
+		{ \
+			va_list		args; \
+			int			needed; \
+			va_start(args, fmt); \
+			needed = appendStringInfoVA(&buf, fmtbuf, args); \
+			va_end(args); \
+			if (needed == 0) \
+				break; \
+			enlargeStringInfo(&buf, needed); \
+		} \
+		/* Done with expanded fmt */ \
+		pfree(fmtbuf); \
+		/* Save the completed message into the stack item */ \
+		if (edata->targetfield) \
+			pfree(edata->targetfield); \
+		edata->targetfield = pstrdup(buf.data); \
+		pfree(buf.data); \
+	}
+
+/*
+ * Same as above, except for pluralized error messages.  The calling routine
+ * must be declared like "const char *fmt_singular, const char *fmt_plural,
+ * unsigned long n, ...".  Translation is assumed always wanted.
+ */
+#define EVALUATE_MESSAGE_PLURAL(domain, targetfield, appendval)  \
+	{ \
+		const char	   *fmt; \
+		char		   *fmtbuf; \
+		StringInfoData	buf; \
+		/* Internationalize the error format string */ \
+		if (!in_error_recursion_trouble()) \
+			fmt = dngettext((domain), fmt_singular, fmt_plural, n); \
+		else \
+			fmt = (n == 1 ? fmt_singular : fmt_plural); \
+		/* Expand %m in format string */ \
+		fmtbuf = expand_fmt_string(fmt, edata); \
+		initStringInfo(&buf); \
+		if ((appendval) && edata->targetfield) { \
+			appendStringInfoString(&buf, edata->targetfield); \
+			appendStringInfoChar(&buf, '\n'); \
+		} \
+		/* Generate actual output --- have to use appendStringInfoVA */ \
+		for (;;) \
+		{ \
+			va_list		args; \
+			int			needed; \
+			va_start(args, n); \
+			needed = appendStringInfoVA(&buf, fmtbuf, args); \
+			va_end(args); \
+			if (needed == 0) \
+				break; \
+			enlargeStringInfo(&buf, needed); \
+		} \
+		/* Done with expanded fmt */ \
+		pfree(fmtbuf); \
+		/* Save the completed message into the stack item */ \
+		if (edata->targetfield) \
+			pfree(edata->targetfield); \
+		edata->targetfield = pstrdup(buf.data); \
+		pfree(buf.data); \
+	}
+
+
+/*
+ * errmsg --- add a primary error message text to the current error
+ *
+ * In addition to the usual %-escapes recognized by printf, "%m" in
+ * fmt is replaced by the error message for the caller's value of errno.
+ *
+ * Note: no newline is needed at the end of the fmt string, since
+ * ereport will provide one for the output methods that need it.
+ */
+int
+errmsg(const char *fmt,...)
+{
+	ErrorData  *edata = &errordata[errordata_stack_depth];
+	MemoryContext oldcontext;
+
+	recursion_depth++;
+	CHECK_STACK_DEPTH();
+	oldcontext = MemoryContextSwitchTo(edata->assoc_context);
+
+	EVALUATE_MESSAGE(edata->domain, message, false, true);
+
+	MemoryContextSwitchTo(oldcontext);
+	recursion_depth--;
+	return 0;					/* return value does not matter */
+}
+
+
+/*
+ * errmsg_internal --- add a primary error message text to the current error
+ *
+ * This is exactly like errmsg() except that strings passed to errmsg_internal
+ * are not translated, and are customarily left out of the
+ * internationalization message dictionary.  This should be used for "can't
+ * happen" cases that are probably not worth spending translation effort on.
+ * We also use this for certain cases where we *must* not try to translate
+ * the message because the translation would fail and result in infinite
+ * error recursion.
+ */
+int
+errmsg_internal(const char *fmt,...)
+{
+	ErrorData  *edata = &errordata[errordata_stack_depth];
+	MemoryContext oldcontext;
+
+	recursion_depth++;
+	CHECK_STACK_DEPTH();
+	oldcontext = MemoryContextSwitchTo(edata->assoc_context);
+
+	EVALUATE_MESSAGE(edata->domain, message, false, false);
+
+	MemoryContextSwitchTo(oldcontext);
+	recursion_depth--;
+	return 0;					/* return value does not matter */
+}
+
+
+/*
+ * errmsg_plural --- add a primary error message text to the current error,
+ * with support for pluralization of the message text
+ */
+
+
+
+/*
+ * errdetail --- add a detail error message text to the current error
+ */
+int
+errdetail(const char *fmt,...)
+{
+	ErrorData  *edata = &errordata[errordata_stack_depth];
+	MemoryContext oldcontext;
+
+	recursion_depth++;
+	CHECK_STACK_DEPTH();
+	oldcontext = MemoryContextSwitchTo(edata->assoc_context);
+
+	EVALUATE_MESSAGE(edata->domain, detail, false, true);
+
+	MemoryContextSwitchTo(oldcontext);
+	recursion_depth--;
+	return 0;					/* return value does not matter */
+}
+
+
+/*
+ * errdetail_internal --- add a detail error message text to the current error
+ *
+ * This is exactly like errdetail() except that strings passed to
+ * errdetail_internal are not translated, and are customarily left out of the
+ * internationalization message dictionary.  This should be used for detail
+ * messages that seem not worth translating for one reason or another
+ * (typically, that they don't seem to be useful to average users).
+ */
+
+
+
+/*
+ * errdetail_log --- add a detail_log error message text to the current error
+ */
+
+
+/*
+ * errdetail_log_plural --- add a detail_log error message text to the current error
+ * with support for pluralization of the message text
+ */
+
+
+
+/*
+ * errdetail_plural --- add a detail error message text to the current error,
+ * with support for pluralization of the message text
+ */
+
+
+
+/*
+ * errhint --- add a hint error message text to the current error
+ */
+int
+errhint(const char *fmt,...)
+{
+	ErrorData  *edata = &errordata[errordata_stack_depth];
+	MemoryContext oldcontext;
+
+	recursion_depth++;
+	CHECK_STACK_DEPTH();
+	oldcontext = MemoryContextSwitchTo(edata->assoc_context);
+
+	EVALUATE_MESSAGE(edata->domain, hint, false, true);
+
+	MemoryContextSwitchTo(oldcontext);
+	recursion_depth--;
+	return 0;					/* return value does not matter */
+}
+
+
+/*
+ * errcontext_msg --- add a context error message text to the current error
+ *
+ * Unlike other cases, multiple calls are allowed to build up a stack of
+ * context information.  We assume earlier calls represent more-closely-nested
+ * states.
+ */
+int
+errcontext_msg(const char *fmt,...)
+{
+	ErrorData  *edata = &errordata[errordata_stack_depth];
+	MemoryContext oldcontext;
+
+	recursion_depth++;
+	CHECK_STACK_DEPTH();
+	oldcontext = MemoryContextSwitchTo(edata->assoc_context);
+
+	EVALUATE_MESSAGE(edata->context_domain, context, true, true);
+
+	MemoryContextSwitchTo(oldcontext);
+	recursion_depth--;
+	return 0;					/* return value does not matter */
+}
+
+/*
+ * set_errcontext_domain --- set message domain to be used by errcontext()
+ *
+ * errcontext_msg() can be called from a different module than the original
+ * ereport(), so we cannot use the message domain passed in errstart() to
+ * translate it.  Instead, each errcontext_msg() call should be preceded by
+ * a set_errcontext_domain() call to specify the domain.  This is usually
+ * done transparently by the errcontext() macro.
+ *
+ * Although errcontext is primarily meant for use at call sites distant from
+ * the original ereport call, there are a few places that invoke errcontext
+ * within ereport.  The expansion of errcontext as a comma expression calling
+ * set_errcontext_domain then errcontext_msg is problematic in this case,
+ * because the intended comma expression becomes two arguments to errfinish,
+ * which the compiler is at liberty to evaluate in either order.  But in
+ * such a case, the set_errcontext_domain calls must be selecting the same
+ * TEXTDOMAIN value that the errstart call did, so order does not matter
+ * so long as errstart initializes context_domain along with domain.
+ */
+int
+set_errcontext_domain(const char *domain)
+{
+	ErrorData  *edata = &errordata[errordata_stack_depth];
+
+	/* we don't bother incrementing recursion_depth */
+	CHECK_STACK_DEPTH();
+
+	/* the default text domain is the backend's */
+	edata->context_domain = domain ? domain : PG_TEXTDOMAIN("postgres");
+
+	return 0;					/* return value does not matter */
+}
+
+
+/*
+ * errhidestmt --- optionally suppress STATEMENT: field of log entry
+ *
+ * This should be called if the message text already includes the statement.
+ */
+
+
+/*
+ * errhidecontext --- optionally suppress CONTEXT: field of log entry
+ *
+ * This should only be used for verbose debugging messages where the repeated
+ * inclusion of CONTEXT: bloats the log volume too much.
+ */
+
+
+
+/*
+ * errfunction --- add reporting function name to the current error
+ *
+ * This is used when backwards compatibility demands that the function
+ * name appear in messages sent to old-protocol clients.  Note that the
+ * passed string is expected to be a non-freeable constant string.
+ */
+
+
+/*
+ * errposition --- add cursor position to the current error
+ */
+int
+errposition(int cursorpos)
+{
+	ErrorData  *edata = &errordata[errordata_stack_depth];
+
+	/* we don't bother incrementing recursion_depth */
+	CHECK_STACK_DEPTH();
+
+	edata->cursorpos = cursorpos;
+
+	return 0;					/* return value does not matter */
+}
+
+/*
+ * internalerrposition --- add internal cursor position to the current error
+ */
+int
+internalerrposition(int cursorpos)
+{
+	ErrorData  *edata = &errordata[errordata_stack_depth];
+
+	/* we don't bother incrementing recursion_depth */
+	CHECK_STACK_DEPTH();
+
+	edata->internalpos = cursorpos;
+
+	return 0;					/* return value does not matter */
+}
+
+/*
+ * internalerrquery --- add internal query text to the current error
+ *
+ * Can also pass NULL to drop the internal query text entry.  This case
+ * is intended for use in error callback subroutines that are editorializing
+ * on the layout of the error report.
+ */
+int
+internalerrquery(const char *query)
+{
+	ErrorData  *edata = &errordata[errordata_stack_depth];
+
+	/* we don't bother incrementing recursion_depth */
+	CHECK_STACK_DEPTH();
+
+	if (edata->internalquery)
+	{
+		pfree(edata->internalquery);
+		edata->internalquery = NULL;
+	}
+
+	if (query)
+		edata->internalquery = MemoryContextStrdup(edata->assoc_context, query);
+
+	return 0;					/* return value does not matter */
+}
+
+/*
+ * err_generic_string -- used to set individual ErrorData string fields
+ * identified by PG_DIAG_xxx codes.
+ *
+ * This intentionally only supports fields that don't use localized strings,
+ * so that there are no translation considerations.
+ *
+ * Most potential callers should not use this directly, but instead prefer
+ * higher-level abstractions, such as errtablecol() (see relcache.c).
+ */
+
+
+/*
+ * set_errdata_field --- set an ErrorData string field
+ */
+
+
+/*
+ * geterrcode --- return the currently set SQLSTATE error code
+ *
+ * This is only intended for use in error callback subroutines, since there
+ * is no other place outside elog.c where the concept is meaningful.
+ */
+
+
+/*
+ * geterrposition --- return the currently set error position (0 if none)
+ *
+ * This is only intended for use in error callback subroutines, since there
+ * is no other place outside elog.c where the concept is meaningful.
+ */
+int
+geterrposition(void)
+{
+	ErrorData  *edata = &errordata[errordata_stack_depth];
+
+	/* we don't bother incrementing recursion_depth */
+	CHECK_STACK_DEPTH();
+
+	return edata->cursorpos;
+}
+
+/*
+ * getinternalerrposition --- same for internal error position
+ *
+ * This is only intended for use in error callback subroutines, since there
+ * is no other place outside elog.c where the concept is meaningful.
+ */
+int
+getinternalerrposition(void)
+{
+	ErrorData  *edata = &errordata[errordata_stack_depth];
+
+	/* we don't bother incrementing recursion_depth */
+	CHECK_STACK_DEPTH();
+
+	return edata->internalpos;
+}
+
+
+/*
+ * elog_start --- startup for old-style API
+ *
+ * All that we do here is stash the hidden filename/lineno/funcname
+ * arguments into a stack entry, along with the current value of errno.
+ *
+ * We need this to be separate from elog_finish because there's no other
+ * C89-compliant way to deal with inserting extra arguments into the elog
+ * call.  (When using C99's __VA_ARGS__, we could possibly merge this with
+ * elog_finish, but there doesn't seem to be a good way to save errno before
+ * evaluating the format arguments if we do that.)
+ */
+void
+elog_start(const char *filename, int lineno, const char *funcname)
+{
+	ErrorData  *edata;
+
+	/* Make sure that memory context initialization has finished */
+	if (ErrorContext == NULL)
+	{
+		/* Ooops, hard crash time; very little we can do safely here */
+		write_stderr("error occurred at %s:%d before error message processing is available\n",
+					 filename ? filename : "(unknown file)", lineno);
+		exit(2);
+	}
+
+	if (++errordata_stack_depth >= ERRORDATA_STACK_SIZE)
+	{
+		/*
+		 * Wups, stack not big enough.  We treat this as a PANIC condition
+		 * because it suggests an infinite loop of errors during error
+		 * recovery.  Note that the message is intentionally not localized,
+		 * else failure to convert it to client encoding could cause further
+		 * recursion.
+		 */
+		errordata_stack_depth = -1;		/* make room on stack */
+		ereport(PANIC, (errmsg_internal("ERRORDATA_STACK_SIZE exceeded")));
+	}
+
+	edata = &errordata[errordata_stack_depth];
+	if (filename)
+	{
+		const char *slash;
+
+		/* keep only base name, useful especially for vpath builds */
+		slash = strrchr(filename, '/');
+		if (slash)
+			filename = slash + 1;
+	}
+	edata->filename = filename;
+	edata->lineno = lineno;
+	edata->funcname = funcname;
+	/* errno is saved now so that error parameter eval can't change it */
+	edata->saved_errno = errno;
+
+	/* Use ErrorContext for any allocations done at this level. */
+	edata->assoc_context = ErrorContext;
+}
+
+/*
+ * elog_finish --- finish up for old-style API
+ */
+void
+elog_finish(int elevel, const char *fmt,...)
+{
+	ErrorData  *edata = &errordata[errordata_stack_depth];
+	MemoryContext oldcontext;
+
+	CHECK_STACK_DEPTH();
+
+	/*
+	 * Do errstart() to see if we actually want to report the message.
+	 */
+	errordata_stack_depth--;
+	errno = edata->saved_errno;
+	if (!errstart(elevel, edata->filename, edata->lineno, edata->funcname, NULL))
+		return;					/* nothing to do */
+
+	/*
+	 * Format error message just like errmsg_internal().
+	 */
+	recursion_depth++;
+	oldcontext = MemoryContextSwitchTo(edata->assoc_context);
+
+	EVALUATE_MESSAGE(edata->domain, message, false, false);
+
+	MemoryContextSwitchTo(oldcontext);
+	recursion_depth--;
+
+	/*
+	 * And let errfinish() finish up.
+	 */
+	errfinish(0);
+}
+
+
+/*
+ * Functions to allow construction of error message strings separately from
+ * the ereport() call itself.
+ *
+ * The expected calling convention is
+ *
+ *	pre_format_elog_string(errno, domain), var = format_elog_string(format,...)
+ *
+ * which can be hidden behind a macro such as GUC_check_errdetail().  We
+ * assume that any functions called in the arguments of format_elog_string()
+ * cannot result in re-entrant use of these functions --- otherwise the wrong
+ * text domain might be used, or the wrong errno substituted for %m.  This is
+ * okay for the current usage with GUC check hooks, but might need further
+ * effort someday.
+ *
+ * The result of format_elog_string() is stored in ErrorContext, and will
+ * therefore survive until FlushErrorState() is called.
+ */
+
+
+
+
+
+
+
+
+/*
+ * Actual output of the top-of-stack error message
+ *
+ * In the ereport(ERROR) case this is called from PostgresMain (or not at all,
+ * if the error is caught by somebody).  For all other severity levels this
+ * is called by errfinish.
+ */
+void
+EmitErrorReport(void)
+{
+	ErrorData  *edata = &errordata[errordata_stack_depth];
+	MemoryContext oldcontext;
+
+	recursion_depth++;
+	CHECK_STACK_DEPTH();
+	oldcontext = MemoryContextSwitchTo(edata->assoc_context);
+
+	/*
+	 * Call hook before sending message to log.  The hook function is allowed
+	 * to turn off edata->output_to_server, so we must recheck that afterward.
+	 * Making any other change in the content of edata is not considered
+	 * supported.
+	 *
+	 * Note: the reason why the hook can only turn off output_to_server, and
+	 * not turn it on, is that it'd be unreliable: we will never get here at
+	 * all if errstart() deems the message uninteresting.  A hook that could
+	 * make decisions in that direction would have to hook into errstart(),
+	 * where it would have much less information available.  emit_log_hook is
+	 * intended for custom log filtering and custom log message transmission
+	 * mechanisms.
+	 */
+	if (edata->output_to_server && emit_log_hook)
+		(*emit_log_hook) (edata);
+
+	/* Send to server log, if enabled */
+	if (edata->output_to_server)
+		send_message_to_server_log(edata);
+
+	/* Send to client, if enabled */
+	if (edata->output_to_client)
+		send_message_to_frontend(edata);
+
+	MemoryContextSwitchTo(oldcontext);
+	recursion_depth--;
+}
+
+/*
+ * CopyErrorData --- obtain a copy of the topmost error stack entry
+ *
+ * This is only for use in error handler code.  The data is copied into the
+ * current memory context, so callers should always switch away from
+ * ErrorContext first; otherwise it will be lost when FlushErrorState is done.
+ */
+ErrorData *
+CopyErrorData(void)
+{
+	ErrorData  *edata = &errordata[errordata_stack_depth];
+	ErrorData  *newedata;
+
+	/*
+	 * we don't increment recursion_depth because out-of-memory here does not
+	 * indicate a problem within the error subsystem.
+	 */
+	CHECK_STACK_DEPTH();
+
+	Assert(CurrentMemoryContext != ErrorContext);
+
+	/* Copy the struct itself */
+	newedata = (ErrorData *) palloc(sizeof(ErrorData));
+	memcpy(newedata, edata, sizeof(ErrorData));
+
+	/* Make copies of separately-allocated fields */
+	if (newedata->message)
+		newedata->message = pstrdup(newedata->message);
+	if (newedata->detail)
+		newedata->detail = pstrdup(newedata->detail);
+	if (newedata->detail_log)
+		newedata->detail_log = pstrdup(newedata->detail_log);
+	if (newedata->hint)
+		newedata->hint = pstrdup(newedata->hint);
+	if (newedata->context)
+		newedata->context = pstrdup(newedata->context);
+	if (newedata->schema_name)
+		newedata->schema_name = pstrdup(newedata->schema_name);
+	if (newedata->table_name)
+		newedata->table_name = pstrdup(newedata->table_name);
+	if (newedata->column_name)
+		newedata->column_name = pstrdup(newedata->column_name);
+	if (newedata->datatype_name)
+		newedata->datatype_name = pstrdup(newedata->datatype_name);
+	if (newedata->constraint_name)
+		newedata->constraint_name = pstrdup(newedata->constraint_name);
+	if (newedata->internalquery)
+		newedata->internalquery = pstrdup(newedata->internalquery);
+
+	/* Use the calling context for string allocation */
+	newedata->assoc_context = CurrentMemoryContext;
+
+	return newedata;
+}
+
+/*
+ * FreeErrorData --- free the structure returned by CopyErrorData.
+ *
+ * Error handlers should use this in preference to assuming they know all
+ * the separately-allocated fields.
+ */
+
+
+/*
+ * FlushErrorState --- flush the error state after error recovery
+ *
+ * This should be called by an error handler after it's done processing
+ * the error; or as soon as it's done CopyErrorData, if it intends to
+ * do stuff that is likely to provoke another error.  You are not "out" of
+ * the error subsystem until you have done this.
+ */
+void
+FlushErrorState(void)
+{
+	/*
+	 * Reset stack to empty.  The only case where it would be more than one
+	 * deep is if we serviced an error that interrupted construction of
+	 * another message.  We assume control escaped out of that message
+	 * construction and won't ever go back.
+	 */
+	errordata_stack_depth = -1;
+	recursion_depth = 0;
+	/* Delete all data in ErrorContext */
+	MemoryContextResetAndDeleteChildren(ErrorContext);
+}
+
+/*
+ * ThrowErrorData --- report an error described by an ErrorData structure
+ *
+ * This is intended to be used to re-report errors originally thrown by
+ * background worker processes and then propagated (with or without
+ * modification) to the backend responsible for them.
+ */
+
+
+/*
+ * ReThrowError --- re-throw a previously copied error
+ *
+ * A handler can do CopyErrorData/FlushErrorState to get out of the error
+ * subsystem, then do some processing, and finally ReThrowError to re-throw
+ * the original error.  This is slower than just PG_RE_THROW() but should
+ * be used if the "some processing" is likely to incur another error.
+ */
+
+
+/*
+ * pg_re_throw --- out-of-line implementation of PG_RE_THROW() macro
+ */
+void
+pg_re_throw(void)
+{
+	/* If possible, throw the error to the next outer setjmp handler */
+	if (PG_exception_stack != NULL)
+		siglongjmp(*PG_exception_stack, 1);
+	else
+	{
+		/*
+		 * If we get here, elog(ERROR) was thrown inside a PG_TRY block, which
+		 * we have now exited only to discover that there is no outer setjmp
+		 * handler to pass the error to.  Had the error been thrown outside
+		 * the block to begin with, we'd have promoted the error to FATAL, so
+		 * the correct behavior is to make it FATAL now; that is, emit it and
+		 * then call proc_exit.
+		 */
+		ErrorData  *edata = &errordata[errordata_stack_depth];
+
+		Assert(errordata_stack_depth >= 0);
+		Assert(edata->elevel == ERROR);
+		edata->elevel = FATAL;
+
+		/*
+		 * At least in principle, the increase in severity could have changed
+		 * where-to-output decisions, so recalculate.  This should stay in
+		 * sync with errstart(), which see for comments.
+		 */
+		if (IsPostmasterEnvironment)
+			edata->output_to_server = is_log_level_output(FATAL,
+														  log_min_messages);
+		else
+			edata->output_to_server = (FATAL >= log_min_messages);
+		if (whereToSendOutput == DestRemote)
+		{
+			if (ClientAuthInProgress)
+				edata->output_to_client = true;
+			else
+				edata->output_to_client = (FATAL >= client_min_messages);
+		}
+
+		/*
+		 * We can use errfinish() for the rest, but we don't want it to call
+		 * any error context routines a second time.  Since we know we are
+		 * about to exit, it should be OK to just clear the context stack.
+		 */
+		error_context_stack = NULL;
+
+		errfinish(0);
+	}
+
+	/* Doesn't return ... */
+	ExceptionalCondition("pg_re_throw tried to return", "FailedAssertion",
+						 __FILE__, __LINE__);
+}
+
+
+/*
+ * GetErrorContextStack - Return the context stack, for display/diags
+ *
+ * Returns a pstrdup'd string in the caller's context which includes the PG
+ * error call stack.  It is the caller's responsibility to ensure this string
+ * is pfree'd (or its context cleaned up) when done.
+ *
+ * This information is collected by traversing the error contexts and calling
+ * each context's callback function, each of which is expected to call
+ * errcontext() to return a string which can be presented to the user.
+ */
+
+
+
+/*
+ * Initialization of error output file
+ */
+
+
+
+#ifdef HAVE_SYSLOG
+
+/*
+ * Set or update the parameters for syslog logging
+ */
+
+
+
+/*
+ * Write a message line to syslog
+ */
+
+#endif   /* HAVE_SYSLOG */
+
+#ifdef WIN32
+/*
+ * Get the PostgreSQL equivalent of the Windows ANSI code page.  "ANSI" system
+ * interfaces (e.g. CreateFileA()) expect string arguments in this encoding.
+ * Every process in a given system will find the same value at all times.
+ */
+static int
+GetACPEncoding(void)
+{
+	static int	encoding = -2;
+
+	if (encoding == -2)
+		encoding = pg_codepage_to_encoding(GetACP());
+
+	return encoding;
+}
+
+/*
+ * Write a message line to the windows event log
+ */
+static void
+write_eventlog(int level, const char *line, int len)
+{
+	WCHAR	   *utf16;
+	int			eventlevel = EVENTLOG_ERROR_TYPE;
+	static HANDLE evtHandle = INVALID_HANDLE_VALUE;
+
+	if (evtHandle == INVALID_HANDLE_VALUE)
+	{
+		evtHandle = RegisterEventSource(NULL,
+						 event_source ? event_source : DEFAULT_EVENT_SOURCE);
+		if (evtHandle == NULL)
+		{
+			evtHandle = INVALID_HANDLE_VALUE;
+			return;
+		}
+	}
+
+	switch (level)
+	{
+		case DEBUG5:
+		case DEBUG4:
+		case DEBUG3:
+		case DEBUG2:
+		case DEBUG1:
+		case LOG:
+		case COMMERROR:
+		case INFO:
+		case NOTICE:
+			eventlevel = EVENTLOG_INFORMATION_TYPE;
+			break;
+		case WARNING:
+			eventlevel = EVENTLOG_WARNING_TYPE;
+			break;
+		case ERROR:
+		case FATAL:
+		case PANIC:
+		default:
+			eventlevel = EVENTLOG_ERROR_TYPE;
+			break;
+	}
+
+	/*
+	 * If message character encoding matches the encoding expected by
+	 * ReportEventA(), call it to avoid the hazards of conversion.  Otherwise,
+	 * try to convert the message to UTF16 and write it with ReportEventW().
+	 * Fall back on ReportEventA() if conversion failed.
+	 *
+	 * Also verify that we are not on our way into error recursion trouble due
+	 * to error messages thrown deep inside pgwin32_message_to_UTF16().
+	 */
+	if (!in_error_recursion_trouble() &&
+		GetMessageEncoding() != GetACPEncoding())
+	{
+		utf16 = pgwin32_message_to_UTF16(line, len, NULL);
+		if (utf16)
+		{
+			ReportEventW(evtHandle,
+						 eventlevel,
+						 0,
+						 0,		/* All events are Id 0 */
+						 NULL,
+						 1,
+						 0,
+						 (LPCWSTR *) &utf16,
+						 NULL);
+			/* XXX Try ReportEventA() when ReportEventW() fails? */
+
+			pfree(utf16);
+			return;
+		}
+	}
+	ReportEventA(evtHandle,
+				 eventlevel,
+				 0,
+				 0,				/* All events are Id 0 */
+				 NULL,
+				 1,
+				 0,
+				 &line,
+				 NULL);
+}
+#endif   /* WIN32 */
+
+#ifdef WIN32
+#else
+#endif
+
+/*
+ * setup formatted_log_time, for consistent times between CSV and regular logs
+ */
+
+
+/*
+ * setup formatted_start_time
+ */
+
+
+/*
+ * process_log_prefix_padding --- helper function for processing the format
+ * string in log_line_prefix
+ *
+ * Note: This function returns NULL if it finds something which
+ * it deems invalid in the format string.
+ */
+
+
+/*
+ * Format tag info for log lines; append to the provided buffer.
+ */
+
+
+/*
+ * append a CSV'd version of a string to a StringInfo
+ * We use the PostgreSQL defaults for CSV, i.e. quote = escape = '"'
+ * If it's NULL, append nothing.
+ */
+
+
+/*
+ * Constructs the error message, depending on the Errordata it gets, in a CSV
+ * format which is described in doc/src/sgml/config.sgml.
+ */
+
+
+/*
+ * Unpack MAKE_SQLSTATE code. Note that this returns a pointer to a
+ * static buffer.
+ */
+
+
+
+/*
+ * Write error report to server's log
+ */
+static void send_message_to_server_log(ErrorData *edata) {}
+
+
+/*
+ * Send data to the syslogger using the chunked protocol
+ *
+ * Note: when there are multiple backends writing into the syslogger pipe,
+ * it's critical that each write go into the pipe indivisibly, and not
+ * get interleaved with data from other processes.  Fortunately, the POSIX
+ * spec requires that writes to pipes be atomic so long as they are not
+ * more than PIPE_BUF bytes long.  So we divide long messages into chunks
+ * that are no more than that length, and send one chunk per write() call.
+ * The collector process knows how to reassemble the chunks.
+ *
+ * Because of the atomic write requirement, there are only two possible
+ * results from write() here: -1 for failure, or the requested number of
+ * bytes.  There is not really anything we can do about a failure; retry would
+ * probably be an infinite loop, and we can't even report the error usefully.
+ * (There is noplace else we could send it!)  So we might as well just ignore
+ * the result from write().  However, on some platforms you get a compiler
+ * warning from ignoring write()'s result, so do a little dance with casting
+ * rc to void to shut up the compiler.
+ */
+
+
+
+/*
+ * Append a text string to the error report being built for the client.
+ *
+ * This is ordinarily identical to pq_sendstring(), but if we are in
+ * error recursion trouble we skip encoding conversion, because of the
+ * possibility that the problem is a failure in the encoding conversion
+ * subsystem itself.  Code elsewhere should ensure that the passed-in
+ * strings will be plain 7-bit ASCII, and thus not in need of conversion,
+ * in such cases.  (In particular, we disable localization of error messages
+ * to help ensure that's true.)
+ */
+
+
+/*
+ * Write error report to client
+ */
+static void send_message_to_frontend(ErrorData *edata) {}
+
+
+
+/*
+ * Support routines for formatting error messages.
+ */
+
+
+/*
+ * expand_fmt_string --- process special format codes in a format string
+ *
+ * We must replace %m with the appropriate strerror string, since vsnprintf
+ * won't know what to do with it.
+ *
+ * The result is a palloc'd string.
+ */
+static char *
+expand_fmt_string(const char *fmt, ErrorData *edata)
+{
+	StringInfoData buf;
+	const char *cp;
+
+	initStringInfo(&buf);
+
+	for (cp = fmt; *cp; cp++)
+	{
+		if (cp[0] == '%' && cp[1] != '\0')
+		{
+			cp++;
+			if (*cp == 'm')
+			{
+				/*
+				 * Replace %m by system error string.  If there are any %'s in
+				 * the string, we'd better double them so that vsnprintf won't
+				 * misinterpret.
+				 */
+				const char *cp2;
+
+				cp2 = useful_strerror(edata->saved_errno);
+				for (; *cp2; cp2++)
+				{
+					if (*cp2 == '%')
+						appendStringInfoCharMacro(&buf, '%');
+					appendStringInfoCharMacro(&buf, *cp2);
+				}
+			}
+			else
+			{
+				/* copy % and next char --- this avoids trouble with %%m */
+				appendStringInfoCharMacro(&buf, '%');
+				appendStringInfoCharMacro(&buf, *cp);
+			}
+		}
+		else
+			appendStringInfoCharMacro(&buf, *cp);
+	}
+
+	return buf.data;
+}
+
+
+/*
+ * A slightly cleaned-up version of strerror()
+ */
+static const char *
+useful_strerror(int errnum)
+{
+	/* this buffer is only used if strerror() and get_errno_symbol() fail */
+	static char errorstr_buf[48];
+	const char *str;
+
+#ifdef WIN32
+	/* Winsock error code range, per WinError.h */
+	if (errnum >= 10000 && errnum <= 11999)
+		return pgwin32_socket_strerror(errnum);
+#endif
+	str = strerror(errnum);
+
+	/*
+	 * Some strerror()s return an empty string for out-of-range errno.  This
+	 * is ANSI C spec compliant, but not exactly useful.  Also, we may get
+	 * back strings of question marks if libc cannot transcode the message to
+	 * the codeset specified by LC_CTYPE.  If we get nothing useful, first try
+	 * get_errno_symbol(), and if that fails, print the numeric errno.
+	 */
+	if (str == NULL || *str == '\0' || *str == '?')
+		str = get_errno_symbol(errnum);
+
+	if (str == NULL)
+	{
+		snprintf(errorstr_buf, sizeof(errorstr_buf),
+		/*------
+		  translator: This string will be truncated at 47
+		  characters expanded. */
+				 _("operating system error %d"), errnum);
+		str = errorstr_buf;
+	}
+
+	return str;
+}
+
+/*
+ * Returns a symbol (e.g. "ENOENT") for an errno code.
+ * Returns NULL if the code is unrecognized.
+ */
+static const char *
+get_errno_symbol(int errnum)
+{
+	switch (errnum)
+	{
+		case E2BIG:
+			return "E2BIG";
+		case EACCES:
+			return "EACCES";
+#ifdef EADDRINUSE
+		case EADDRINUSE:
+			return "EADDRINUSE";
+#endif
+#ifdef EADDRNOTAVAIL
+		case EADDRNOTAVAIL:
+			return "EADDRNOTAVAIL";
+#endif
+		case EAFNOSUPPORT:
+			return "EAFNOSUPPORT";
+#ifdef EAGAIN
+		case EAGAIN:
+			return "EAGAIN";
+#endif
+#ifdef EALREADY
+		case EALREADY:
+			return "EALREADY";
+#endif
+		case EBADF:
+			return "EBADF";
+#ifdef EBADMSG
+		case EBADMSG:
+			return "EBADMSG";
+#endif
+		case EBUSY:
+			return "EBUSY";
+		case ECHILD:
+			return "ECHILD";
+#ifdef ECONNABORTED
+		case ECONNABORTED:
+			return "ECONNABORTED";
+#endif
+		case ECONNREFUSED:
+			return "ECONNREFUSED";
+#ifdef ECONNRESET
+		case ECONNRESET:
+			return "ECONNRESET";
+#endif
+		case EDEADLK:
+			return "EDEADLK";
+		case EDOM:
+			return "EDOM";
+		case EEXIST:
+			return "EEXIST";
+		case EFAULT:
+			return "EFAULT";
+		case EFBIG:
+			return "EFBIG";
+#ifdef EHOSTUNREACH
+		case EHOSTUNREACH:
+			return "EHOSTUNREACH";
+#endif
+		case EIDRM:
+			return "EIDRM";
+		case EINPROGRESS:
+			return "EINPROGRESS";
+		case EINTR:
+			return "EINTR";
+		case EINVAL:
+			return "EINVAL";
+		case EIO:
+			return "EIO";
+#ifdef EISCONN
+		case EISCONN:
+			return "EISCONN";
+#endif
+		case EISDIR:
+			return "EISDIR";
+#ifdef ELOOP
+		case ELOOP:
+			return "ELOOP";
+#endif
+		case EMFILE:
+			return "EMFILE";
+		case EMLINK:
+			return "EMLINK";
+		case EMSGSIZE:
+			return "EMSGSIZE";
+		case ENAMETOOLONG:
+			return "ENAMETOOLONG";
+		case ENFILE:
+			return "ENFILE";
+		case ENOBUFS:
+			return "ENOBUFS";
+		case ENODEV:
+			return "ENODEV";
+		case ENOENT:
+			return "ENOENT";
+		case ENOEXEC:
+			return "ENOEXEC";
+		case ENOMEM:
+			return "ENOMEM";
+		case ENOSPC:
+			return "ENOSPC";
+		case ENOSYS:
+			return "ENOSYS";
+#ifdef ENOTCONN
+		case ENOTCONN:
+			return "ENOTCONN";
+#endif
+		case ENOTDIR:
+			return "ENOTDIR";
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
+		case ENOTEMPTY:
+			return "ENOTEMPTY";
+#endif
+#ifdef ENOTSOCK
+		case ENOTSOCK:
+			return "ENOTSOCK";
+#endif
+#ifdef ENOTSUP
+		case ENOTSUP:
+			return "ENOTSUP";
+#endif
+		case ENOTTY:
+			return "ENOTTY";
+		case ENXIO:
+			return "ENXIO";
+#if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || (EOPNOTSUPP != ENOTSUP))
+		case EOPNOTSUPP:
+			return "EOPNOTSUPP";
+#endif
+#ifdef EOVERFLOW
+		case EOVERFLOW:
+			return "EOVERFLOW";
+#endif
+		case EPERM:
+			return "EPERM";
+		case EPIPE:
+			return "EPIPE";
+		case EPROTONOSUPPORT:
+			return "EPROTONOSUPPORT";
+		case ERANGE:
+			return "ERANGE";
+#ifdef EROFS
+		case EROFS:
+			return "EROFS";
+#endif
+		case ESRCH:
+			return "ESRCH";
+#ifdef ETIMEDOUT
+		case ETIMEDOUT:
+			return "ETIMEDOUT";
+#endif
+#ifdef ETXTBSY
+		case ETXTBSY:
+			return "ETXTBSY";
+#endif
+#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
+		case EWOULDBLOCK:
+			return "EWOULDBLOCK";
+#endif
+		case EXDEV:
+			return "EXDEV";
+	}
+
+	return NULL;
+}
+
+
+/*
+ * error_severity --- get localized string representing elevel
+ */
+
+
+
+/*
+ *	append_with_tabs
+ *
+ *	Append the string to the StringInfo buffer, inserting a tab after any
+ *	newline.
+ */
+
+
+
+/*
+ * Write errors to stderr (or by equal means when stderr is
+ * not available). Used before ereport/elog can be used
+ * safely (memory context, GUC load etc)
+ */
+void
+write_stderr(const char *fmt,...)
+{
+	va_list		ap;
+
+#ifdef WIN32
+	char		errbuf[2048];	/* Arbitrary size? */
+#endif
+
+	fmt = _(fmt);
+
+	va_start(ap, fmt);
+#ifndef WIN32
+	/* On Unix, we just fprintf to stderr */
+	vfprintf(stderr, fmt, ap);
+	fflush(stderr);
+#else
+	vsnprintf(errbuf, sizeof(errbuf), fmt, ap);
+
+	/*
+	 * On Win32, we print to stderr if running on a console, or write to
+	 * eventlog if running as a service
+	 */
+	if (pgwin32_is_service())	/* Running as a service */
+	{
+		write_eventlog(ERROR, errbuf, strlen(errbuf));
+	}
+	else
+	{
+		/* Not running as service, write to stderr */
+		write_console(errbuf, strlen(errbuf));
+		fflush(stderr);
+	}
+#endif
+	va_end(ap);
+}
+
+
+/*
+ * is_log_level_output -- is elevel logically >= log_min_level?
+ *
+ * We use this for tests that should consider LOG to sort out-of-order,
+ * between ERROR and FATAL.  Generally this is the right thing for testing
+ * whether a message should go to the postmaster log, whereas a simple >=
+ * test is correct for testing whether the message should go to the client.
+ */
+static bool
+is_log_level_output(int elevel, int log_min_level)
+{
+	if (elevel == LOG || elevel == COMMERROR)
+	{
+		if (log_min_level == LOG || log_min_level <= ERROR)
+			return true;
+	}
+	else if (log_min_level == LOG)
+	{
+		/* elevel != LOG */
+		if (elevel >= FATAL)
+			return true;
+	}
+	/* Neither is LOG */
+	else if (elevel >= log_min_level)
+		return true;
+
+	return false;
+}
+
+/*
+ * Adjust the level of a recovery-related message per trace_recovery_messages.
+ *
+ * The argument is the default log level of the message, eg, DEBUG2.  (This
+ * should only be applied to DEBUGn log messages, otherwise it's a no-op.)
+ * If the level is >= trace_recovery_messages, we return LOG, causing the
+ * message to be logged unconditionally (for most settings of
+ * log_min_messages).  Otherwise, we return the argument unchanged.
+ * The message will then be shown based on the setting of log_min_messages.
+ *
+ * Intention is to keep this for at least the whole of the 9.0 production
+ * release, so we can more easily diagnose production problems in the field.
+ * It should go away eventually, though, because it's an ugly and
+ * hard-to-explain kluge.
+ */
+
diff --git a/foreign/libpg_query/src/postgres/src_backend_utils_init_globals.c b/foreign/libpg_query/src/postgres/src_backend_utils_init_globals.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_utils_init_globals.c
@@ -0,0 +1,151 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - CritSectionCount
+ * - ExitOnAnyError
+ * - InterruptHoldoffCount
+ * - QueryCancelHoldoffCount
+ * - IsPostmasterEnvironment
+ * - InterruptPending
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * globals.c
+ *	  global variable declarations
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/utils/init/globals.c
+ *
+ * NOTES
+ *	  Globals used all over the place should be declared here and not
+ *	  in other modules.
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include "libpq/libpq-be.h"
+#include "libpq/pqcomm.h"
+#include "miscadmin.h"
+#include "storage/backendid.h"
+
+
+
+
+__thread volatile bool InterruptPending = false;
+
+
+
+
+__thread volatile uint32 InterruptHoldoffCount = 0;
+
+__thread volatile uint32 QueryCancelHoldoffCount = 0;
+
+__thread volatile uint32 CritSectionCount = 0;
+
+
+
+
+
+
+
+
+/*
+ * MyLatch points to the latch that should be used for signal handling by the
+ * current process. It will either point to a process local latch if the
+ * current process does not have a PGPROC entry in that moment, or to
+ * PGPROC->procLatch if it has. Thus it can always be used in signal handlers,
+ * without checking for its existence.
+ */
+
+
+/*
+ * DataDir is the absolute path to the top level of the PGDATA directory tree.
+ * Except during early startup, this is also the server's working directory;
+ * most code therefore can simply use relative paths and not reference DataDir
+ * explicitly.
+ */
+
+
+	/* debugging output file */
+
+	/* full path to my executable */
+		/* full path to lib directory */
+
+#ifdef EXEC_BACKEND
+char		postgres_exec_path[MAXPGPATH];		/* full path to backend */
+
+/* note: currently this is not valid in backend processes */
+#endif
+
+
+
+
+
+
+
+/*
+ * DatabasePath is the path (relative to DataDir) of my database's
+ * primary directory, ie, its directory in the default tablespace.
+ */
+
+
+
+
+/*
+ * IsPostmasterEnvironment is true in a postmaster process and any postmaster
+ * child process; it is false in a standalone process (bootstrap or
+ * standalone backend).  IsUnderPostmaster is true in postmaster child
+ * processes.  Note that "child process" includes all children, not only
+ * regular backends.  These should be set correctly as early as possible
+ * in the execution of a process, so that error handling will do the right
+ * things if an error should occur during process initialization.
+ *
+ * These are initialized for the bootstrap/standalone case.
+ */
+__thread bool		IsPostmasterEnvironment = false;
+
+
+
+
+
+__thread bool		ExitOnAnyError = false;
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * Primary determinants of sizes of shared-memory structures.
+ *
+ * MaxBackends is computed by PostmasterMain after modules have had a chance to
+ * register background workers.
+ */
+
+
+
+
+
+		/* GUC parameters for vacuum */
+
+
+
+
+
+
+
+
+
+		/* working state for vacuum */
+
diff --git a/foreign/libpg_query/src/postgres/src_backend_utils_mb_encnames.c b/foreign/libpg_query/src/postgres/src_backend_utils_mb_encnames.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_utils_mb_encnames.c
@@ -0,0 +1,146 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - pg_enc2name_tbl
+ *--------------------------------------------------------------------
+ */
+
+/*
+ * Encoding names and routines for work with it. All
+ * in this file is shared between FE and BE.
+ *
+ * src/backend/utils/mb/encnames.c
+ */
+#ifdef FRONTEND
+#include "postgres_fe.h"
+#else
+#include "postgres.h"
+#include "utils/builtins.h"
+#endif
+
+#include <ctype.h>
+#include <unistd.h>
+
+#include "mb/pg_wchar.h"
+
+
+/* ----------
+ * All encoding names, sorted:		 *** A L P H A B E T I C ***
+ *
+ * All names must be without irrelevant chars, search routines use
+ * isalnum() chars only. It means ISO-8859-1, iso_8859-1 and Iso8859_1
+ * are always converted to 'iso88591'. All must be lower case.
+ *
+ * The table doesn't contain 'cs' aliases (like csISOLatin1). It's needed?
+ *
+ * Karel Zak, Aug 2001
+ * ----------
+ */
+typedef struct pg_encname
+{
+	const char *name;
+	pg_enc		encoding;
+} pg_encname;
+
+
+
+/* ----------
+ * These are "official" encoding names.
+ * XXX must be sorted by the same order as enum pg_enc (in mb/pg_wchar.h)
+ * ----------
+ */
+#ifndef WIN32
+#define DEF_ENC2NAME(name, codepage) { #name, PG_##name }
+#else
+#define DEF_ENC2NAME(name, codepage) { #name, PG_##name, codepage }
+#endif
+const pg_enc2name pg_enc2name_tbl[] =
+{
+	DEF_ENC2NAME(SQL_ASCII, 0),
+	DEF_ENC2NAME(EUC_JP, 20932),
+	DEF_ENC2NAME(EUC_CN, 20936),
+	DEF_ENC2NAME(EUC_KR, 51949),
+	DEF_ENC2NAME(EUC_TW, 0),
+	DEF_ENC2NAME(EUC_JIS_2004, 20932),
+	DEF_ENC2NAME(UTF8, 65001),
+	DEF_ENC2NAME(MULE_INTERNAL, 0),
+	DEF_ENC2NAME(LATIN1, 28591),
+	DEF_ENC2NAME(LATIN2, 28592),
+	DEF_ENC2NAME(LATIN3, 28593),
+	DEF_ENC2NAME(LATIN4, 28594),
+	DEF_ENC2NAME(LATIN5, 28599),
+	DEF_ENC2NAME(LATIN6, 0),
+	DEF_ENC2NAME(LATIN7, 0),
+	DEF_ENC2NAME(LATIN8, 0),
+	DEF_ENC2NAME(LATIN9, 28605),
+	DEF_ENC2NAME(LATIN10, 0),
+	DEF_ENC2NAME(WIN1256, 1256),
+	DEF_ENC2NAME(WIN1258, 1258),
+	DEF_ENC2NAME(WIN866, 866),
+	DEF_ENC2NAME(WIN874, 874),
+	DEF_ENC2NAME(KOI8R, 20866),
+	DEF_ENC2NAME(WIN1251, 1251),
+	DEF_ENC2NAME(WIN1252, 1252),
+	DEF_ENC2NAME(ISO_8859_5, 28595),
+	DEF_ENC2NAME(ISO_8859_6, 28596),
+	DEF_ENC2NAME(ISO_8859_7, 28597),
+	DEF_ENC2NAME(ISO_8859_8, 28598),
+	DEF_ENC2NAME(WIN1250, 1250),
+	DEF_ENC2NAME(WIN1253, 1253),
+	DEF_ENC2NAME(WIN1254, 1254),
+	DEF_ENC2NAME(WIN1255, 1255),
+	DEF_ENC2NAME(WIN1257, 1257),
+	DEF_ENC2NAME(KOI8U, 21866),
+	DEF_ENC2NAME(SJIS, 932),
+	DEF_ENC2NAME(BIG5, 950),
+	DEF_ENC2NAME(GBK, 936),
+	DEF_ENC2NAME(UHC, 949),
+	DEF_ENC2NAME(GB18030, 54936),
+	DEF_ENC2NAME(JOHAB, 0),
+	DEF_ENC2NAME(SHIFT_JIS_2004, 932)
+};
+
+/* ----------
+ * These are encoding names for gettext.
+ *
+ * This covers all encodings except MULE_INTERNAL, which is alien to gettext.
+ * ----------
+ */
+
+
+
+/* ----------
+ * Encoding checks, for error returns -1 else encoding id
+ * ----------
+ */
+
+
+
+
+
+
+/* ----------
+ * Remove irrelevant chars from encoding name
+ * ----------
+ */
+
+
+/* ----------
+ * Search encoding by encoding name
+ *
+ * Returns encoding ID, or -1 for error
+ * ----------
+ */
+#ifdef FRONTEND
+#else
+#endif
+
+#ifndef FRONTEND
+
+#endif
+
+
+
+#ifndef FRONTEND
+
+
+#endif
diff --git a/foreign/libpg_query/src/postgres/src_backend_utils_mb_mbutils.c b/foreign/libpg_query/src/postgres/src_backend_utils_mb_mbutils.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_utils_mb_mbutils.c
@@ -0,0 +1,542 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - GetDatabaseEncoding
+ * - DatabaseEncoding
+ * - pg_get_client_encoding
+ * - ClientEncoding
+ * - pg_mbcliplen
+ * - pg_encoding_mbcliplen
+ * - cliplen
+ * - pg_mblen
+ * - pg_mbstrlen_with_len
+ * - SetDatabaseEncoding
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * mbutils.c
+ *	  This file contains functions for encoding conversion.
+ *
+ * The string-conversion functions in this file share some API quirks.
+ * Note the following:
+ *
+ * The functions return a palloc'd, null-terminated string if conversion
+ * is required.  However, if no conversion is performed, the given source
+ * string pointer is returned as-is.
+ *
+ * Although the presence of a length argument means that callers can pass
+ * non-null-terminated strings, care is required because the same string
+ * will be passed back if no conversion occurs.  Such callers *must* check
+ * whether result == src and handle that case differently.
+ *
+ * If the source and destination encodings are the same, the source string
+ * is returned without any verification; it's assumed to be valid data.
+ * If that might not be the case, the caller is responsible for validating
+ * the string using a separate call to pg_verify_mbstr().  Whenever the
+ * source and destination encodings are different, the functions ensure that
+ * the result is validly encoded according to the destination encoding.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/utils/mb/mbutils.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include "access/xact.h"
+#include "catalog/namespace.h"
+#include "mb/pg_wchar.h"
+#include "utils/builtins.h"
+#include "utils/memutils.h"
+#include "utils/syscache.h"
+
+/*
+ * When converting strings between different encodings, we assume that space
+ * for converted result is 4-to-1 growth in the worst case. The rate for
+ * currently supported encoding pairs are within 3 (SJIS JIS X0201 half width
+ * kanna -> UTF8 is the worst case).  So "4" should be enough for the moment.
+ *
+ * Note that this is not the same as the maximum character width in any
+ * particular encoding.
+ */
+#define MAX_CONVERSION_GROWTH  4
+
+/*
+ * We maintain a simple linked list caching the fmgr lookup info for the
+ * currently selected conversion functions, as well as any that have been
+ * selected previously in the current session.  (We remember previous
+ * settings because we must be able to restore a previous setting during
+ * transaction rollback, without doing any fresh catalog accesses.)
+ *
+ * Since we'll never release this data, we just keep it in TopMemoryContext.
+ */
+typedef struct ConvProcInfo
+{
+	int			s_encoding;		/* server and client encoding IDs */
+	int			c_encoding;
+	FmgrInfo	to_server_info; /* lookup info for conversion procs */
+	FmgrInfo	to_client_info;
+} ConvProcInfo;
+
+	/* List of ConvProcInfo */
+
+/*
+ * These variables point to the currently active conversion functions,
+ * or are NULL when no conversion is needed.
+ */
+
+
+
+/*
+ * These variables track the currently-selected encodings.
+ */
+static const pg_enc2name *ClientEncoding = &pg_enc2name_tbl[PG_SQL_ASCII];
+static const pg_enc2name *DatabaseEncoding = &pg_enc2name_tbl[PG_SQL_ASCII];
+
+
+/*
+ * During backend startup we can't set client encoding because we (a)
+ * can't look up the conversion functions, and (b) may not know the database
+ * encoding yet either.  So SetClientEncoding() just accepts anything and
+ * remembers it for InitializeClientEncoding() to apply later.
+ */
+
+
+
+
+/* Internal functions */
+static char *perform_default_encoding_conversion(const char *src,
+									int len, bool is_client_to_server);
+static int	cliplen(const char *str, int len, int limit);
+
+
+/*
+ * Prepare for a future call to SetClientEncoding.  Success should mean
+ * that SetClientEncoding is guaranteed to succeed for this encoding request.
+ *
+ * (But note that success before backend_startup_complete does not guarantee
+ * success after ...)
+ *
+ * Returns 0 if okay, -1 if not (bad encoding or can't support conversion)
+ */
+
+
+/*
+ * Set the active client encoding and set up the conversion-function pointers.
+ * PrepareClientEncoding should have been called previously for this encoding.
+ *
+ * Returns 0 if okay, -1 if not (bad encoding or can't support conversion)
+ */
+
+
+/*
+ * Initialize client encoding conversions.
+ *		Called from InitPostgres() once during backend startup.
+ */
+
+
+/*
+ * returns the current client encoding
+ */
+int
+pg_get_client_encoding(void)
+{
+	return ClientEncoding->encoding;
+}
+
+/*
+ * returns the current client encoding name
+ */
+
+
+/*
+ * Convert src string to another encoding (general case).
+ *
+ * See the notes about string conversion functions at the top of this file.
+ */
+
+
+/*
+ * Convert string to encoding encoding_name. The source
+ * encoding is the DB encoding.
+ *
+ * BYTEA convert_to(TEXT string, NAME encoding_name) */
+
+
+/*
+ * Convert string from encoding encoding_name. The destination
+ * encoding is the DB encoding.
+ *
+ * TEXT convert_from(BYTEA string, NAME encoding_name) */
+
+
+/*
+ * Convert string between two arbitrary encodings.
+ *
+ * BYTEA convert(BYTEA string, NAME src_encoding_name, NAME dest_encoding_name)
+ */
+
+
+/*
+ * get the length of the string considered as text in the specified
+ * encoding. Raises an error if the data is not valid in that
+ * encoding.
+ *
+ * INT4 length (BYTEA string, NAME src_encoding_name)
+ */
+
+
+/*
+ * Get maximum multibyte character length in the specified encoding.
+ *
+ * Note encoding is specified numerically, not by name as above.
+ */
+
+
+/*
+ * Convert client encoding to server encoding.
+ *
+ * See the notes about string conversion functions at the top of this file.
+ */
+
+
+/*
+ * Convert any encoding to server encoding.
+ *
+ * See the notes about string conversion functions at the top of this file.
+ *
+ * Unlike the other string conversion functions, this will apply validation
+ * even if encoding == DatabaseEncoding->encoding.  This is because this is
+ * used to process data coming in from outside the database, and we never
+ * want to just assume validity.
+ */
+
+
+/*
+ * Convert server encoding to client encoding.
+ *
+ * See the notes about string conversion functions at the top of this file.
+ */
+
+
+/*
+ * Convert server encoding to any encoding.
+ *
+ * See the notes about string conversion functions at the top of this file.
+ */
+
+
+/*
+ *	Perform default encoding conversion using cached FmgrInfo. Since
+ *	this function does not access database at all, it is safe to call
+ *	outside transactions.  If the conversion has not been set up by
+ *	SetClientEncoding(), no conversion is performed.
+ */
+
+
+
+/* convert a multibyte string to a wchar */
+
+
+/* convert a multibyte string to a wchar with a limited length */
+
+
+/* same, with any encoding */
+
+
+/* convert a wchar string to a multibyte */
+
+
+/* convert a wchar string to a multibyte with a limited length */
+
+
+/* same, with any encoding */
+
+
+/* returns the byte length of a multibyte character */
+int
+pg_mblen(const char *mbstr)
+{
+	return ((*pg_wchar_table[DatabaseEncoding->encoding].mblen) ((const unsigned char *) mbstr));
+}
+
+/* returns the display length of a multibyte character */
+
+
+/* returns the length (counted in wchars) of a multibyte string */
+
+
+/* returns the length (counted in wchars) of a multibyte string
+ * (not necessarily NULL terminated)
+ */
+int
+pg_mbstrlen_with_len(const char *mbstr, int limit)
+{
+	int			len = 0;
+
+	/* optimization for single byte encoding */
+	if (pg_database_encoding_max_length() == 1)
+		return limit;
+
+	while (limit > 0 && *mbstr)
+	{
+		int			l = pg_mblen(mbstr);
+
+		limit -= l;
+		mbstr += l;
+		len++;
+	}
+	return len;
+}
+
+/*
+ * returns the byte length of a multibyte string
+ * (not necessarily NULL terminated)
+ * that is no longer than limit.
+ * this function does not break multibyte character boundary.
+ */
+int
+pg_mbcliplen(const char *mbstr, int len, int limit)
+{
+	return pg_encoding_mbcliplen(DatabaseEncoding->encoding, mbstr,
+								 len, limit);
+}
+
+/*
+ * pg_mbcliplen with specified encoding
+ */
+int
+pg_encoding_mbcliplen(int encoding, const char *mbstr,
+					  int len, int limit)
+{
+	mblen_converter mblen_fn;
+	int			clen = 0;
+	int			l;
+
+	/* optimization for single byte encoding */
+	if (pg_encoding_max_length(encoding) == 1)
+		return cliplen(mbstr, len, limit);
+
+	mblen_fn = pg_wchar_table[encoding].mblen;
+
+	while (len > 0 && *mbstr)
+	{
+		l = (*mblen_fn) ((const unsigned char *) mbstr);
+		if ((clen + l) > limit)
+			break;
+		clen += l;
+		if (clen == limit)
+			break;
+		len -= l;
+		mbstr += l;
+	}
+	return clen;
+}
+
+/*
+ * Similar to pg_mbcliplen except the limit parameter specifies the
+ * character length, not the byte length.
+ */
+
+
+/* mbcliplen for any single-byte encoding */
+static int
+cliplen(const char *str, int len, int limit)
+{
+	int			l = 0;
+
+	len = Min(len, limit);
+	while (l < len && str[l])
+		l++;
+	return l;
+}
+
+void
+SetDatabaseEncoding(int encoding)
+{
+	if (!PG_VALID_BE_ENCODING(encoding))
+		elog(ERROR, "invalid database encoding: %d", encoding);
+
+	DatabaseEncoding = &pg_enc2name_tbl[encoding];
+	Assert(DatabaseEncoding->encoding == encoding);
+}
+
+
+
+#ifdef ENABLE_NLS
+/*
+ * Make one bind_textdomain_codeset() call, translating a pg_enc to a gettext
+ * codeset.  Fails for MULE_INTERNAL, an encoding unknown to gettext; can also
+ * fail for gettext-internal causes like out-of-memory.
+ */
+static bool
+raw_pg_bind_textdomain_codeset(const char *domainname, int encoding)
+{
+	bool		elog_ok = (CurrentMemoryContext != NULL);
+	int			i;
+
+	for (i = 0; pg_enc2gettext_tbl[i].name != NULL; i++)
+	{
+		if (pg_enc2gettext_tbl[i].encoding == encoding)
+		{
+			if (bind_textdomain_codeset(domainname,
+										pg_enc2gettext_tbl[i].name) != NULL)
+				return true;
+
+			if (elog_ok)
+				elog(LOG, "bind_textdomain_codeset failed");
+			else
+				write_stderr("bind_textdomain_codeset failed");
+
+			break;
+		}
+	}
+
+	return false;
+}
+
+/*
+ * Bind a gettext message domain to the codeset corresponding to the database
+ * encoding.  For SQL_ASCII, instead bind to the codeset implied by LC_CTYPE.
+ * Return the MessageEncoding implied by the new settings.
+ *
+ * On most platforms, gettext defaults to the codeset implied by LC_CTYPE.
+ * When that matches the database encoding, we don't need to do anything.  In
+ * CREATE DATABASE, we enforce or trust that the locale's codeset matches the
+ * database encoding, except for the C locale.  (On Windows, we also permit a
+ * discrepancy under the UTF8 encoding.)  For the C locale, explicitly bind
+ * gettext to the right codeset.
+ *
+ * On Windows, gettext defaults to the Windows ANSI code page.  This is a
+ * convenient departure for software that passes the strings to Windows ANSI
+ * APIs, but we don't do that.  Compel gettext to use database encoding or,
+ * failing that, the LC_CTYPE encoding as it would on other platforms.
+ *
+ * This function is called before elog() and palloc() are usable.
+ */
+int
+pg_bind_textdomain_codeset(const char *domainname)
+{
+	bool		elog_ok = (CurrentMemoryContext != NULL);
+	int			encoding = GetDatabaseEncoding();
+	int			new_msgenc;
+
+#ifndef WIN32
+	const char *ctype = setlocale(LC_CTYPE, NULL);
+
+	if (pg_strcasecmp(ctype, "C") == 0 || pg_strcasecmp(ctype, "POSIX") == 0)
+#endif
+		if (encoding != PG_SQL_ASCII &&
+			raw_pg_bind_textdomain_codeset(domainname, encoding))
+			return encoding;
+
+	new_msgenc = pg_get_encoding_from_locale(NULL, elog_ok);
+	if (new_msgenc < 0)
+		new_msgenc = PG_SQL_ASCII;
+
+#ifdef WIN32
+	if (!raw_pg_bind_textdomain_codeset(domainname, new_msgenc))
+		/* On failure, the old message encoding remains valid. */
+		return GetMessageEncoding();
+#endif
+
+	return new_msgenc;
+}
+#endif
+
+/*
+ * The database encoding, also called the server encoding, represents the
+ * encoding of data stored in text-like data types.  Affected types include
+ * cstring, text, varchar, name, xml, and json.
+ */
+int
+GetDatabaseEncoding(void)
+{
+	return DatabaseEncoding->encoding;
+}
+
+
+
+
+
+
+
+/*
+ * gettext() returns messages in this encoding.  This often matches the
+ * database encoding, but it differs for SQL_ASCII databases, for processes
+ * not attached to a database, and under a database encoding lacking iconv
+ * support (MULE_INTERNAL).
+ */
+
+
+#ifdef WIN32
+/*
+ * Result is palloc'ed null-terminated utf16 string. The character length
+ * is also passed to utf16len if not null. Returns NULL iff failed.
+ */
+WCHAR *
+pgwin32_message_to_UTF16(const char *str, int len, int *utf16len)
+{
+	WCHAR	   *utf16;
+	int			dstlen;
+	UINT		codepage;
+
+	codepage = pg_enc2name_tbl[GetMessageEncoding()].codepage;
+
+	/*
+	 * Use MultiByteToWideChar directly if there is a corresponding codepage,
+	 * or double conversion through UTF8 if not.  Double conversion is needed,
+	 * for example, in an ENCODING=LATIN8, LC_CTYPE=C database.
+	 */
+	if (codepage != 0)
+	{
+		utf16 = (WCHAR *) palloc(sizeof(WCHAR) * (len + 1));
+		dstlen = MultiByteToWideChar(codepage, 0, str, len, utf16, len);
+		utf16[dstlen] = (WCHAR) 0;
+	}
+	else
+	{
+		char	   *utf8;
+
+		/*
+		 * XXX pg_do_encoding_conversion() requires a transaction.  In the
+		 * absence of one, hope for the input to be valid UTF8.
+		 */
+		if (IsTransactionState())
+		{
+			utf8 = (char *) pg_do_encoding_conversion((unsigned char *) str,
+													  len,
+													  GetMessageEncoding(),
+													  PG_UTF8);
+			if (utf8 != str)
+				len = strlen(utf8);
+		}
+		else
+			utf8 = (char *) str;
+
+		utf16 = (WCHAR *) palloc(sizeof(WCHAR) * (len + 1));
+		dstlen = MultiByteToWideChar(CP_UTF8, 0, utf8, len, utf16, len);
+		utf16[dstlen] = (WCHAR) 0;
+
+		if (utf8 != str)
+			pfree(utf8);
+	}
+
+	if (dstlen == 0 && len > 0)
+	{
+		pfree(utf16);
+		return NULL;			/* error */
+	}
+
+	if (utf16len)
+		*utf16len = dstlen;
+	return utf16;
+}
+
+#endif
diff --git a/foreign/libpg_query/src/postgres/src_backend_utils_mb_wchar.c b/foreign/libpg_query/src/postgres/src_backend_utils_mb_wchar.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_utils_mb_wchar.c
@@ -0,0 +1,1888 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - pg_verifymbstr
+ * - pg_verify_mbstr_len
+ * - pg_encoding_max_length
+ * - report_invalid_encoding
+ * - pg_encoding_mblen
+ * - pg_wchar_table
+ * - pg_utf_mblen
+ * - pg_mule_mblen
+ * - pg_ascii2wchar_with_len
+ * - pg_wchar2single_with_len
+ * - pg_ascii_mblen
+ * - pg_ascii_dsplen
+ * - pg_ascii_verifier
+ * - pg_eucjp2wchar_with_len
+ * - pg_euc2wchar_with_len
+ * - pg_wchar2euc_with_len
+ * - pg_eucjp_mblen
+ * - pg_euc_mblen
+ * - pg_eucjp_dsplen
+ * - pg_eucjp_verifier
+ * - pg_euccn2wchar_with_len
+ * - pg_euccn_mblen
+ * - pg_euccn_dsplen
+ * - pg_euckr_verifier
+ * - pg_euckr2wchar_with_len
+ * - pg_euckr_mblen
+ * - pg_euckr_dsplen
+ * - pg_euc_dsplen
+ * - pg_euctw2wchar_with_len
+ * - pg_euctw_mblen
+ * - pg_euctw_dsplen
+ * - pg_euctw_verifier
+ * - pg_utf2wchar_with_len
+ * - pg_wchar2utf_with_len
+ * - unicode_to_utf8
+ * - pg_utf_dsplen
+ * - utf8_to_unicode
+ * - ucs_wcwidth
+ * - mbbisearch
+ * - pg_utf8_verifier
+ * - pg_utf8_islegal
+ * - pg_mule2wchar_with_len
+ * - pg_wchar2mule_with_len
+ * - pg_mule_dsplen
+ * - pg_mule_verifier
+ * - pg_latin12wchar_with_len
+ * - pg_latin1_mblen
+ * - pg_latin1_dsplen
+ * - pg_latin1_verifier
+ * - pg_sjis_mblen
+ * - pg_sjis_dsplen
+ * - pg_sjis_verifier
+ * - pg_big5_mblen
+ * - pg_big5_dsplen
+ * - pg_big5_verifier
+ * - pg_gbk_mblen
+ * - pg_gbk_dsplen
+ * - pg_gbk_verifier
+ * - pg_uhc_mblen
+ * - pg_uhc_dsplen
+ * - pg_uhc_verifier
+ * - pg_gb18030_mblen
+ * - pg_gb18030_dsplen
+ * - pg_gb18030_verifier
+ * - pg_johab_mblen
+ * - pg_johab_dsplen
+ * - pg_johab_verifier
+ * - pg_database_encoding_max_length
+ *--------------------------------------------------------------------
+ */
+
+/*
+ * conversion functions between pg_wchar and multibyte streams.
+ * Tatsuo Ishii
+ * src/backend/utils/mb/wchar.c
+ *
+ */
+/* can be used in either frontend or backend */
+#ifdef FRONTEND
+#include "postgres_fe.h"
+#else
+#include "postgres.h"
+#endif
+
+#include "mb/pg_wchar.h"
+
+
+/*
+ * conversion to pg_wchar is done by "table driven."
+ * to add an encoding support, define mb2wchar_with_len(), mblen(), dsplen()
+ * for the particular encoding. Note that if the encoding is only
+ * supported in the client, you don't need to define
+ * mb2wchar_with_len() function (SJIS is the case).
+ *
+ * These functions generally assume that their input is validly formed.
+ * The "verifier" functions, further down in the file, have to be more
+ * paranoid.  We expect that mblen() does not need to examine more than
+ * the first byte of the character to discover the correct length.
+ *
+ * Note: for the display output of psql to work properly, the return values
+ * of the dsplen functions must conform to the Unicode standard. In particular
+ * the NUL character is zero width and control characters are generally
+ * width -1. It is recommended that non-ASCII encodings refer their ASCII
+ * subset to the ASCII routines to ensure consistency.
+ */
+
+/*
+ * SQL/ASCII
+ */
+static int
+pg_ascii2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
+{
+	int			cnt = 0;
+
+	while (len > 0 && *from)
+	{
+		*to++ = *from++;
+		len--;
+		cnt++;
+	}
+	*to = 0;
+	return cnt;
+}
+
+static int
+pg_ascii_mblen(const unsigned char *s)
+{
+	return 1;
+}
+
+static int
+pg_ascii_dsplen(const unsigned char *s)
+{
+	if (*s == '\0')
+		return 0;
+	if (*s < 0x20 || *s == 0x7f)
+		return -1;
+
+	return 1;
+}
+
+/*
+ * EUC
+ */
+static int
+pg_euc2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
+{
+	int			cnt = 0;
+
+	while (len > 0 && *from)
+	{
+		if (*from == SS2 && len >= 2)	/* JIS X 0201 (so called "1 byte
+										 * KANA") */
+		{
+			from++;
+			*to = (SS2 << 8) | *from++;
+			len -= 2;
+		}
+		else if (*from == SS3 && len >= 3)		/* JIS X 0212 KANJI */
+		{
+			from++;
+			*to = (SS3 << 16) | (*from++ << 8);
+			*to |= *from++;
+			len -= 3;
+		}
+		else if (IS_HIGHBIT_SET(*from) && len >= 2)		/* JIS X 0208 KANJI */
+		{
+			*to = *from++ << 8;
+			*to |= *from++;
+			len -= 2;
+		}
+		else	/* must be ASCII */
+		{
+			*to = *from++;
+			len--;
+		}
+		to++;
+		cnt++;
+	}
+	*to = 0;
+	return cnt;
+}
+
+static inline int
+pg_euc_mblen(const unsigned char *s)
+{
+	int			len;
+
+	if (*s == SS2)
+		len = 2;
+	else if (*s == SS3)
+		len = 3;
+	else if (IS_HIGHBIT_SET(*s))
+		len = 2;
+	else
+		len = 1;
+	return len;
+}
+
+static inline int
+pg_euc_dsplen(const unsigned char *s)
+{
+	int			len;
+
+	if (*s == SS2)
+		len = 2;
+	else if (*s == SS3)
+		len = 2;
+	else if (IS_HIGHBIT_SET(*s))
+		len = 2;
+	else
+		len = pg_ascii_dsplen(s);
+	return len;
+}
+
+/*
+ * EUC_JP
+ */
+static int
+pg_eucjp2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
+{
+	return pg_euc2wchar_with_len(from, to, len);
+}
+
+static int
+pg_eucjp_mblen(const unsigned char *s)
+{
+	return pg_euc_mblen(s);
+}
+
+static int
+pg_eucjp_dsplen(const unsigned char *s)
+{
+	int			len;
+
+	if (*s == SS2)
+		len = 1;
+	else if (*s == SS3)
+		len = 2;
+	else if (IS_HIGHBIT_SET(*s))
+		len = 2;
+	else
+		len = pg_ascii_dsplen(s);
+	return len;
+}
+
+/*
+ * EUC_KR
+ */
+static int
+pg_euckr2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
+{
+	return pg_euc2wchar_with_len(from, to, len);
+}
+
+static int
+pg_euckr_mblen(const unsigned char *s)
+{
+	return pg_euc_mblen(s);
+}
+
+static int
+pg_euckr_dsplen(const unsigned char *s)
+{
+	return pg_euc_dsplen(s);
+}
+
+/*
+ * EUC_CN
+ *
+ */
+static int
+pg_euccn2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
+{
+	int			cnt = 0;
+
+	while (len > 0 && *from)
+	{
+		if (*from == SS2 && len >= 3)	/* code set 2 (unused?) */
+		{
+			from++;
+			*to = (SS2 << 16) | (*from++ << 8);
+			*to |= *from++;
+			len -= 3;
+		}
+		else if (*from == SS3 && len >= 3)		/* code set 3 (unused ?) */
+		{
+			from++;
+			*to = (SS3 << 16) | (*from++ << 8);
+			*to |= *from++;
+			len -= 3;
+		}
+		else if (IS_HIGHBIT_SET(*from) && len >= 2)		/* code set 1 */
+		{
+			*to = *from++ << 8;
+			*to |= *from++;
+			len -= 2;
+		}
+		else
+		{
+			*to = *from++;
+			len--;
+		}
+		to++;
+		cnt++;
+	}
+	*to = 0;
+	return cnt;
+}
+
+static int
+pg_euccn_mblen(const unsigned char *s)
+{
+	int			len;
+
+	if (IS_HIGHBIT_SET(*s))
+		len = 2;
+	else
+		len = 1;
+	return len;
+}
+
+static int
+pg_euccn_dsplen(const unsigned char *s)
+{
+	int			len;
+
+	if (IS_HIGHBIT_SET(*s))
+		len = 2;
+	else
+		len = pg_ascii_dsplen(s);
+	return len;
+}
+
+/*
+ * EUC_TW
+ *
+ */
+static int
+pg_euctw2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
+{
+	int			cnt = 0;
+
+	while (len > 0 && *from)
+	{
+		if (*from == SS2 && len >= 4)	/* code set 2 */
+		{
+			from++;
+			*to = (((uint32) SS2) << 24) | (*from++ << 16);
+			*to |= *from++ << 8;
+			*to |= *from++;
+			len -= 4;
+		}
+		else if (*from == SS3 && len >= 3)		/* code set 3 (unused?) */
+		{
+			from++;
+			*to = (SS3 << 16) | (*from++ << 8);
+			*to |= *from++;
+			len -= 3;
+		}
+		else if (IS_HIGHBIT_SET(*from) && len >= 2)		/* code set 2 */
+		{
+			*to = *from++ << 8;
+			*to |= *from++;
+			len -= 2;
+		}
+		else
+		{
+			*to = *from++;
+			len--;
+		}
+		to++;
+		cnt++;
+	}
+	*to = 0;
+	return cnt;
+}
+
+static int
+pg_euctw_mblen(const unsigned char *s)
+{
+	int			len;
+
+	if (*s == SS2)
+		len = 4;
+	else if (*s == SS3)
+		len = 3;
+	else if (IS_HIGHBIT_SET(*s))
+		len = 2;
+	else
+		len = 1;
+	return len;
+}
+
+static int
+pg_euctw_dsplen(const unsigned char *s)
+{
+	int			len;
+
+	if (*s == SS2)
+		len = 2;
+	else if (*s == SS3)
+		len = 2;
+	else if (IS_HIGHBIT_SET(*s))
+		len = 2;
+	else
+		len = pg_ascii_dsplen(s);
+	return len;
+}
+
+/*
+ * Convert pg_wchar to EUC_* encoding.
+ * caller must allocate enough space for "to", including a trailing zero!
+ * len: length of from.
+ * "from" not necessarily null terminated.
+ */
+static int
+pg_wchar2euc_with_len(const pg_wchar *from, unsigned char *to, int len)
+{
+	int			cnt = 0;
+
+	while (len > 0 && *from)
+	{
+		unsigned char c;
+
+		if ((c = (*from >> 24)))
+		{
+			*to++ = c;
+			*to++ = (*from >> 16) & 0xff;
+			*to++ = (*from >> 8) & 0xff;
+			*to++ = *from & 0xff;
+			cnt += 4;
+		}
+		else if ((c = (*from >> 16)))
+		{
+			*to++ = c;
+			*to++ = (*from >> 8) & 0xff;
+			*to++ = *from & 0xff;
+			cnt += 3;
+		}
+		else if ((c = (*from >> 8)))
+		{
+			*to++ = c;
+			*to++ = *from & 0xff;
+			cnt += 2;
+		}
+		else
+		{
+			*to++ = *from;
+			cnt++;
+		}
+		from++;
+		len--;
+	}
+	*to = 0;
+	return cnt;
+}
+
+
+/*
+ * JOHAB
+ */
+static int
+pg_johab_mblen(const unsigned char *s)
+{
+	return pg_euc_mblen(s);
+}
+
+static int
+pg_johab_dsplen(const unsigned char *s)
+{
+	return pg_euc_dsplen(s);
+}
+
+/*
+ * convert UTF8 string to pg_wchar (UCS-4)
+ * caller must allocate enough space for "to", including a trailing zero!
+ * len: length of from.
+ * "from" not necessarily null terminated.
+ */
+static int
+pg_utf2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
+{
+	int			cnt = 0;
+	uint32		c1,
+				c2,
+				c3,
+				c4;
+
+	while (len > 0 && *from)
+	{
+		if ((*from & 0x80) == 0)
+		{
+			*to = *from++;
+			len--;
+		}
+		else if ((*from & 0xe0) == 0xc0)
+		{
+			if (len < 2)
+				break;			/* drop trailing incomplete char */
+			c1 = *from++ & 0x1f;
+			c2 = *from++ & 0x3f;
+			*to = (c1 << 6) | c2;
+			len -= 2;
+		}
+		else if ((*from & 0xf0) == 0xe0)
+		{
+			if (len < 3)
+				break;			/* drop trailing incomplete char */
+			c1 = *from++ & 0x0f;
+			c2 = *from++ & 0x3f;
+			c3 = *from++ & 0x3f;
+			*to = (c1 << 12) | (c2 << 6) | c3;
+			len -= 3;
+		}
+		else if ((*from & 0xf8) == 0xf0)
+		{
+			if (len < 4)
+				break;			/* drop trailing incomplete char */
+			c1 = *from++ & 0x07;
+			c2 = *from++ & 0x3f;
+			c3 = *from++ & 0x3f;
+			c4 = *from++ & 0x3f;
+			*to = (c1 << 18) | (c2 << 12) | (c3 << 6) | c4;
+			len -= 4;
+		}
+		else
+		{
+			/* treat a bogus char as length 1; not ours to raise error */
+			*to = *from++;
+			len--;
+		}
+		to++;
+		cnt++;
+	}
+	*to = 0;
+	return cnt;
+}
+
+
+/*
+ * Map a Unicode code point to UTF-8.  utf8string must have 4 bytes of
+ * space allocated.
+ */
+unsigned char *
+unicode_to_utf8(pg_wchar c, unsigned char *utf8string)
+{
+	if (c <= 0x7F)
+	{
+		utf8string[0] = c;
+	}
+	else if (c <= 0x7FF)
+	{
+		utf8string[0] = 0xC0 | ((c >> 6) & 0x1F);
+		utf8string[1] = 0x80 | (c & 0x3F);
+	}
+	else if (c <= 0xFFFF)
+	{
+		utf8string[0] = 0xE0 | ((c >> 12) & 0x0F);
+		utf8string[1] = 0x80 | ((c >> 6) & 0x3F);
+		utf8string[2] = 0x80 | (c & 0x3F);
+	}
+	else
+	{
+		utf8string[0] = 0xF0 | ((c >> 18) & 0x07);
+		utf8string[1] = 0x80 | ((c >> 12) & 0x3F);
+		utf8string[2] = 0x80 | ((c >> 6) & 0x3F);
+		utf8string[3] = 0x80 | (c & 0x3F);
+	}
+
+	return utf8string;
+}
+
+/*
+ * Trivial conversion from pg_wchar to UTF-8.
+ * caller should allocate enough space for "to"
+ * len: length of from.
+ * "from" not necessarily null terminated.
+ */
+static int
+pg_wchar2utf_with_len(const pg_wchar *from, unsigned char *to, int len)
+{
+	int			cnt = 0;
+
+	while (len > 0 && *from)
+	{
+		int			char_len;
+
+		unicode_to_utf8(*from, to);
+		char_len = pg_utf_mblen(to);
+		cnt += char_len;
+		to += char_len;
+		from++;
+		len--;
+	}
+	*to = 0;
+	return cnt;
+}
+
+/*
+ * Return the byte length of a UTF8 character pointed to by s
+ *
+ * Note: in the current implementation we do not support UTF8 sequences
+ * of more than 4 bytes; hence do NOT return a value larger than 4.
+ * We return "1" for any leading byte that is either flat-out illegal or
+ * indicates a length larger than we support.
+ *
+ * pg_utf2wchar_with_len(), utf8_to_unicode(), pg_utf8_islegal(), and perhaps
+ * other places would need to be fixed to change this.
+ */
+int
+pg_utf_mblen(const unsigned char *s)
+{
+	int			len;
+
+	if ((*s & 0x80) == 0)
+		len = 1;
+	else if ((*s & 0xe0) == 0xc0)
+		len = 2;
+	else if ((*s & 0xf0) == 0xe0)
+		len = 3;
+	else if ((*s & 0xf8) == 0xf0)
+		len = 4;
+#ifdef NOT_USED
+	else if ((*s & 0xfc) == 0xf8)
+		len = 5;
+	else if ((*s & 0xfe) == 0xfc)
+		len = 6;
+#endif
+	else
+		len = 1;
+	return len;
+}
+
+/*
+ * This is an implementation of wcwidth() and wcswidth() as defined in
+ * "The Single UNIX Specification, Version 2, The Open Group, 1997"
+ * <http://www.UNIX-systems.org/online.html>
+ *
+ * Markus Kuhn -- 2001-09-08 -- public domain
+ *
+ * customised for PostgreSQL
+ *
+ * original available at : http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
+ */
+
+struct mbinterval
+{
+	unsigned short first;
+	unsigned short last;
+};
+
+/* auxiliary function for binary search in interval table */
+static int
+mbbisearch(pg_wchar ucs, const struct mbinterval * table, int max)
+{
+	int			min = 0;
+	int			mid;
+
+	if (ucs < table[0].first || ucs > table[max].last)
+		return 0;
+	while (max >= min)
+	{
+		mid = (min + max) / 2;
+		if (ucs > table[mid].last)
+			min = mid + 1;
+		else if (ucs < table[mid].first)
+			max = mid - 1;
+		else
+			return 1;
+	}
+
+	return 0;
+}
+
+
+/* The following functions define the column width of an ISO 10646
+ * character as follows:
+ *
+ *	  - The null character (U+0000) has a column width of 0.
+ *
+ *	  - Other C0/C1 control characters and DEL will lead to a return
+ *		value of -1.
+ *
+ *	  - Non-spacing and enclosing combining characters (general
+ *		category code Mn or Me in the Unicode database) have a
+ *		column width of 0.
+ *
+ *	  - Other format characters (general category code Cf in the Unicode
+ *		database) and ZERO WIDTH SPACE (U+200B) have a column width of 0.
+ *
+ *	  - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF)
+ *		have a column width of 0.
+ *
+ *	  - Spacing characters in the East Asian Wide (W) or East Asian
+ *		FullWidth (F) category as defined in Unicode Technical
+ *		Report #11 have a column width of 2.
+ *
+ *	  - All remaining characters (including all printable
+ *		ISO 8859-1 and WGL4 characters, Unicode control characters,
+ *		etc.) have a column width of 1.
+ *
+ * This implementation assumes that wchar_t characters are encoded
+ * in ISO 10646.
+ */
+
+static int
+ucs_wcwidth(pg_wchar ucs)
+{
+	/* sorted list of non-overlapping intervals of non-spacing characters */
+	static const struct mbinterval combining[] = {
+		{0x0300, 0x034E}, {0x0360, 0x0362}, {0x0483, 0x0486},
+		{0x0488, 0x0489}, {0x0591, 0x05A1}, {0x05A3, 0x05B9},
+		{0x05BB, 0x05BD}, {0x05BF, 0x05BF}, {0x05C1, 0x05C2},
+		{0x05C4, 0x05C4}, {0x064B, 0x0655}, {0x0670, 0x0670},
+		{0x06D6, 0x06E4}, {0x06E7, 0x06E8}, {0x06EA, 0x06ED},
+		{0x070F, 0x070F}, {0x0711, 0x0711}, {0x0730, 0x074A},
+		{0x07A6, 0x07B0}, {0x0901, 0x0902}, {0x093C, 0x093C},
+		{0x0941, 0x0948}, {0x094D, 0x094D}, {0x0951, 0x0954},
+		{0x0962, 0x0963}, {0x0981, 0x0981}, {0x09BC, 0x09BC},
+		{0x09C1, 0x09C4}, {0x09CD, 0x09CD}, {0x09E2, 0x09E3},
+		{0x0A02, 0x0A02}, {0x0A3C, 0x0A3C}, {0x0A41, 0x0A42},
+		{0x0A47, 0x0A48}, {0x0A4B, 0x0A4D}, {0x0A70, 0x0A71},
+		{0x0A81, 0x0A82}, {0x0ABC, 0x0ABC}, {0x0AC1, 0x0AC5},
+		{0x0AC7, 0x0AC8}, {0x0ACD, 0x0ACD}, {0x0B01, 0x0B01},
+		{0x0B3C, 0x0B3C}, {0x0B3F, 0x0B3F}, {0x0B41, 0x0B43},
+		{0x0B4D, 0x0B4D}, {0x0B56, 0x0B56}, {0x0B82, 0x0B82},
+		{0x0BC0, 0x0BC0}, {0x0BCD, 0x0BCD}, {0x0C3E, 0x0C40},
+		{0x0C46, 0x0C48}, {0x0C4A, 0x0C4D}, {0x0C55, 0x0C56},
+		{0x0CBF, 0x0CBF}, {0x0CC6, 0x0CC6}, {0x0CCC, 0x0CCD},
+		{0x0D41, 0x0D43}, {0x0D4D, 0x0D4D}, {0x0DCA, 0x0DCA},
+		{0x0DD2, 0x0DD4}, {0x0DD6, 0x0DD6}, {0x0E31, 0x0E31},
+		{0x0E34, 0x0E3A}, {0x0E47, 0x0E4E}, {0x0EB1, 0x0EB1},
+		{0x0EB4, 0x0EB9}, {0x0EBB, 0x0EBC}, {0x0EC8, 0x0ECD},
+		{0x0F18, 0x0F19}, {0x0F35, 0x0F35}, {0x0F37, 0x0F37},
+		{0x0F39, 0x0F39}, {0x0F71, 0x0F7E}, {0x0F80, 0x0F84},
+		{0x0F86, 0x0F87}, {0x0F90, 0x0F97}, {0x0F99, 0x0FBC},
+		{0x0FC6, 0x0FC6}, {0x102D, 0x1030}, {0x1032, 0x1032},
+		{0x1036, 0x1037}, {0x1039, 0x1039}, {0x1058, 0x1059},
+		{0x1160, 0x11FF}, {0x17B7, 0x17BD}, {0x17C6, 0x17C6},
+		{0x17C9, 0x17D3}, {0x180B, 0x180E}, {0x18A9, 0x18A9},
+		{0x200B, 0x200F}, {0x202A, 0x202E}, {0x206A, 0x206F},
+		{0x20D0, 0x20E3}, {0x302A, 0x302F}, {0x3099, 0x309A},
+		{0xFB1E, 0xFB1E}, {0xFE20, 0xFE23}, {0xFEFF, 0xFEFF},
+		{0xFFF9, 0xFFFB}
+	};
+
+	/* test for 8-bit control characters */
+	if (ucs == 0)
+		return 0;
+
+	if (ucs < 0x20 || (ucs >= 0x7f && ucs < 0xa0) || ucs > 0x0010ffff)
+		return -1;
+
+	/* binary search in table of non-spacing characters */
+	if (mbbisearch(ucs, combining,
+				   sizeof(combining) / sizeof(struct mbinterval) - 1))
+		return 0;
+
+	/*
+	 * if we arrive here, ucs is not a combining or C0/C1 control character
+	 */
+
+	return 1 +
+		(ucs >= 0x1100 &&
+		 (ucs <= 0x115f ||		/* Hangul Jamo init. consonants */
+		  (ucs >= 0x2e80 && ucs <= 0xa4cf && (ucs & ~0x0011) != 0x300a &&
+		   ucs != 0x303f) ||	/* CJK ... Yi */
+		  (ucs >= 0xac00 && ucs <= 0xd7a3) ||	/* Hangul Syllables */
+		  (ucs >= 0xf900 && ucs <= 0xfaff) ||	/* CJK Compatibility
+												 * Ideographs */
+		  (ucs >= 0xfe30 && ucs <= 0xfe6f) ||	/* CJK Compatibility Forms */
+		  (ucs >= 0xff00 && ucs <= 0xff5f) ||	/* Fullwidth Forms */
+		  (ucs >= 0xffe0 && ucs <= 0xffe6) ||
+		  (ucs >= 0x20000 && ucs <= 0x2ffff)));
+}
+
+/*
+ * Convert a UTF-8 character to a Unicode code point.
+ * This is a one-character version of pg_utf2wchar_with_len.
+ *
+ * No error checks here, c must point to a long-enough string.
+ */
+pg_wchar
+utf8_to_unicode(const unsigned char *c)
+{
+	if ((*c & 0x80) == 0)
+		return (pg_wchar) c[0];
+	else if ((*c & 0xe0) == 0xc0)
+		return (pg_wchar) (((c[0] & 0x1f) << 6) |
+						   (c[1] & 0x3f));
+	else if ((*c & 0xf0) == 0xe0)
+		return (pg_wchar) (((c[0] & 0x0f) << 12) |
+						   ((c[1] & 0x3f) << 6) |
+						   (c[2] & 0x3f));
+	else if ((*c & 0xf8) == 0xf0)
+		return (pg_wchar) (((c[0] & 0x07) << 18) |
+						   ((c[1] & 0x3f) << 12) |
+						   ((c[2] & 0x3f) << 6) |
+						   (c[3] & 0x3f));
+	else
+		/* that is an invalid code on purpose */
+		return 0xffffffff;
+}
+
+static int
+pg_utf_dsplen(const unsigned char *s)
+{
+	return ucs_wcwidth(utf8_to_unicode(s));
+}
+
+/*
+ * convert mule internal code to pg_wchar
+ * caller should allocate enough space for "to"
+ * len: length of from.
+ * "from" not necessarily null terminated.
+ */
+static int
+pg_mule2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
+{
+	int			cnt = 0;
+
+	while (len > 0 && *from)
+	{
+		if (IS_LC1(*from) && len >= 2)
+		{
+			*to = *from++ << 16;
+			*to |= *from++;
+			len -= 2;
+		}
+		else if (IS_LCPRV1(*from) && len >= 3)
+		{
+			from++;
+			*to = *from++ << 16;
+			*to |= *from++;
+			len -= 3;
+		}
+		else if (IS_LC2(*from) && len >= 3)
+		{
+			*to = *from++ << 16;
+			*to |= *from++ << 8;
+			*to |= *from++;
+			len -= 3;
+		}
+		else if (IS_LCPRV2(*from) && len >= 4)
+		{
+			from++;
+			*to = *from++ << 16;
+			*to |= *from++ << 8;
+			*to |= *from++;
+			len -= 4;
+		}
+		else
+		{						/* assume ASCII */
+			*to = (unsigned char) *from++;
+			len--;
+		}
+		to++;
+		cnt++;
+	}
+	*to = 0;
+	return cnt;
+}
+
+/*
+ * convert pg_wchar to mule internal code
+ * caller should allocate enough space for "to"
+ * len: length of from.
+ * "from" not necessarily null terminated.
+ */
+static int
+pg_wchar2mule_with_len(const pg_wchar *from, unsigned char *to, int len)
+{
+	int			cnt = 0;
+
+	while (len > 0 && *from)
+	{
+		unsigned char lb;
+
+		lb = (*from >> 16) & 0xff;
+		if (IS_LC1(lb))
+		{
+			*to++ = lb;
+			*to++ = *from & 0xff;
+			cnt += 2;
+		}
+		else if (IS_LC2(lb))
+		{
+			*to++ = lb;
+			*to++ = (*from >> 8) & 0xff;
+			*to++ = *from & 0xff;
+			cnt += 3;
+		}
+		else if (IS_LCPRV1_A_RANGE(lb))
+		{
+			*to++ = LCPRV1_A;
+			*to++ = lb;
+			*to++ = *from & 0xff;
+			cnt += 3;
+		}
+		else if (IS_LCPRV1_B_RANGE(lb))
+		{
+			*to++ = LCPRV1_B;
+			*to++ = lb;
+			*to++ = *from & 0xff;
+			cnt += 3;
+		}
+		else if (IS_LCPRV2_A_RANGE(lb))
+		{
+			*to++ = LCPRV2_A;
+			*to++ = lb;
+			*to++ = (*from >> 8) & 0xff;
+			*to++ = *from & 0xff;
+			cnt += 4;
+		}
+		else if (IS_LCPRV2_B_RANGE(lb))
+		{
+			*to++ = LCPRV2_B;
+			*to++ = lb;
+			*to++ = (*from >> 8) & 0xff;
+			*to++ = *from & 0xff;
+			cnt += 4;
+		}
+		else
+		{
+			*to++ = *from & 0xff;
+			cnt += 1;
+		}
+		from++;
+		len--;
+	}
+	*to = 0;
+	return cnt;
+}
+
+int
+pg_mule_mblen(const unsigned char *s)
+{
+	int			len;
+
+	if (IS_LC1(*s))
+		len = 2;
+	else if (IS_LCPRV1(*s))
+		len = 3;
+	else if (IS_LC2(*s))
+		len = 3;
+	else if (IS_LCPRV2(*s))
+		len = 4;
+	else
+		len = 1;				/* assume ASCII */
+	return len;
+}
+
+static int
+pg_mule_dsplen(const unsigned char *s)
+{
+	int			len;
+
+	/*
+	 * Note: it's not really appropriate to assume that all multibyte charsets
+	 * are double-wide on screen.  But this seems an okay approximation for
+	 * the MULE charsets we currently support.
+	 */
+
+	if (IS_LC1(*s))
+		len = 1;
+	else if (IS_LCPRV1(*s))
+		len = 1;
+	else if (IS_LC2(*s))
+		len = 2;
+	else if (IS_LCPRV2(*s))
+		len = 2;
+	else
+		len = 1;				/* assume ASCII */
+
+	return len;
+}
+
+/*
+ * ISO8859-1
+ */
+static int
+pg_latin12wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
+{
+	int			cnt = 0;
+
+	while (len > 0 && *from)
+	{
+		*to++ = *from++;
+		len--;
+		cnt++;
+	}
+	*to = 0;
+	return cnt;
+}
+
+/*
+ * Trivial conversion from pg_wchar to single byte encoding. Just ignores
+ * high bits.
+ * caller should allocate enough space for "to"
+ * len: length of from.
+ * "from" not necessarily null terminated.
+ */
+static int
+pg_wchar2single_with_len(const pg_wchar *from, unsigned char *to, int len)
+{
+	int			cnt = 0;
+
+	while (len > 0 && *from)
+	{
+		*to++ = *from++;
+		len--;
+		cnt++;
+	}
+	*to = 0;
+	return cnt;
+}
+
+static int
+pg_latin1_mblen(const unsigned char *s)
+{
+	return 1;
+}
+
+static int
+pg_latin1_dsplen(const unsigned char *s)
+{
+	return pg_ascii_dsplen(s);
+}
+
+/*
+ * SJIS
+ */
+static int
+pg_sjis_mblen(const unsigned char *s)
+{
+	int			len;
+
+	if (*s >= 0xa1 && *s <= 0xdf)
+		len = 1;				/* 1 byte kana? */
+	else if (IS_HIGHBIT_SET(*s))
+		len = 2;				/* kanji? */
+	else
+		len = 1;				/* should be ASCII */
+	return len;
+}
+
+static int
+pg_sjis_dsplen(const unsigned char *s)
+{
+	int			len;
+
+	if (*s >= 0xa1 && *s <= 0xdf)
+		len = 1;				/* 1 byte kana? */
+	else if (IS_HIGHBIT_SET(*s))
+		len = 2;				/* kanji? */
+	else
+		len = pg_ascii_dsplen(s);		/* should be ASCII */
+	return len;
+}
+
+/*
+ * Big5
+ */
+static int
+pg_big5_mblen(const unsigned char *s)
+{
+	int			len;
+
+	if (IS_HIGHBIT_SET(*s))
+		len = 2;				/* kanji? */
+	else
+		len = 1;				/* should be ASCII */
+	return len;
+}
+
+static int
+pg_big5_dsplen(const unsigned char *s)
+{
+	int			len;
+
+	if (IS_HIGHBIT_SET(*s))
+		len = 2;				/* kanji? */
+	else
+		len = pg_ascii_dsplen(s);		/* should be ASCII */
+	return len;
+}
+
+/*
+ * GBK
+ */
+static int
+pg_gbk_mblen(const unsigned char *s)
+{
+	int			len;
+
+	if (IS_HIGHBIT_SET(*s))
+		len = 2;				/* kanji? */
+	else
+		len = 1;				/* should be ASCII */
+	return len;
+}
+
+static int
+pg_gbk_dsplen(const unsigned char *s)
+{
+	int			len;
+
+	if (IS_HIGHBIT_SET(*s))
+		len = 2;				/* kanji? */
+	else
+		len = pg_ascii_dsplen(s);		/* should be ASCII */
+	return len;
+}
+
+/*
+ * UHC
+ */
+static int
+pg_uhc_mblen(const unsigned char *s)
+{
+	int			len;
+
+	if (IS_HIGHBIT_SET(*s))
+		len = 2;				/* 2byte? */
+	else
+		len = 1;				/* should be ASCII */
+	return len;
+}
+
+static int
+pg_uhc_dsplen(const unsigned char *s)
+{
+	int			len;
+
+	if (IS_HIGHBIT_SET(*s))
+		len = 2;				/* 2byte? */
+	else
+		len = pg_ascii_dsplen(s);		/* should be ASCII */
+	return len;
+}
+
+/*
+ * GB18030
+ *	Added by Bill Huang <bhuang@redhat.com>,<bill_huanghb@ybb.ne.jp>
+ */
+static int
+pg_gb18030_mblen(const unsigned char *s)
+{
+	int			len;
+
+	if (!IS_HIGHBIT_SET(*s))
+		len = 1;				/* ASCII */
+	else if (*(s + 1) >= 0x30 && *(s + 1) <= 0x39)
+		len = 4;
+	else
+		len = 2;
+	return len;
+}
+
+static int
+pg_gb18030_dsplen(const unsigned char *s)
+{
+	int			len;
+
+	if (IS_HIGHBIT_SET(*s))
+		len = 2;
+	else
+		len = pg_ascii_dsplen(s);		/* ASCII */
+	return len;
+}
+
+/*
+ *-------------------------------------------------------------------
+ * multibyte sequence validators
+ *
+ * These functions accept "s", a pointer to the first byte of a string,
+ * and "len", the remaining length of the string.  If there is a validly
+ * encoded character beginning at *s, return its length in bytes; else
+ * return -1.
+ *
+ * The functions can assume that len > 0 and that *s != '\0', but they must
+ * test for and reject zeroes in any additional bytes of a multibyte character.
+ *
+ * Note that this definition allows the function for a single-byte
+ * encoding to be just "return 1".
+ *-------------------------------------------------------------------
+ */
+
+static int
+pg_ascii_verifier(const unsigned char *s, int len)
+{
+	return 1;
+}
+
+#define IS_EUC_RANGE_VALID(c)	((c) >= 0xa1 && (c) <= 0xfe)
+
+static int
+pg_eucjp_verifier(const unsigned char *s, int len)
+{
+	int			l;
+	unsigned char c1,
+				c2;
+
+	c1 = *s++;
+
+	switch (c1)
+	{
+		case SS2:				/* JIS X 0201 */
+			l = 2;
+			if (l > len)
+				return -1;
+			c2 = *s++;
+			if (c2 < 0xa1 || c2 > 0xdf)
+				return -1;
+			break;
+
+		case SS3:				/* JIS X 0212 */
+			l = 3;
+			if (l > len)
+				return -1;
+			c2 = *s++;
+			if (!IS_EUC_RANGE_VALID(c2))
+				return -1;
+			c2 = *s++;
+			if (!IS_EUC_RANGE_VALID(c2))
+				return -1;
+			break;
+
+		default:
+			if (IS_HIGHBIT_SET(c1))		/* JIS X 0208? */
+			{
+				l = 2;
+				if (l > len)
+					return -1;
+				if (!IS_EUC_RANGE_VALID(c1))
+					return -1;
+				c2 = *s++;
+				if (!IS_EUC_RANGE_VALID(c2))
+					return -1;
+			}
+			else
+				/* must be ASCII */
+			{
+				l = 1;
+			}
+			break;
+	}
+
+	return l;
+}
+
+static int
+pg_euckr_verifier(const unsigned char *s, int len)
+{
+	int			l;
+	unsigned char c1,
+				c2;
+
+	c1 = *s++;
+
+	if (IS_HIGHBIT_SET(c1))
+	{
+		l = 2;
+		if (l > len)
+			return -1;
+		if (!IS_EUC_RANGE_VALID(c1))
+			return -1;
+		c2 = *s++;
+		if (!IS_EUC_RANGE_VALID(c2))
+			return -1;
+	}
+	else
+		/* must be ASCII */
+	{
+		l = 1;
+	}
+
+	return l;
+}
+
+/* EUC-CN byte sequences are exactly same as EUC-KR */
+#define pg_euccn_verifier	pg_euckr_verifier
+
+static int
+pg_euctw_verifier(const unsigned char *s, int len)
+{
+	int			l;
+	unsigned char c1,
+				c2;
+
+	c1 = *s++;
+
+	switch (c1)
+	{
+		case SS2:				/* CNS 11643 Plane 1-7 */
+			l = 4;
+			if (l > len)
+				return -1;
+			c2 = *s++;
+			if (c2 < 0xa1 || c2 > 0xa7)
+				return -1;
+			c2 = *s++;
+			if (!IS_EUC_RANGE_VALID(c2))
+				return -1;
+			c2 = *s++;
+			if (!IS_EUC_RANGE_VALID(c2))
+				return -1;
+			break;
+
+		case SS3:				/* unused */
+			return -1;
+
+		default:
+			if (IS_HIGHBIT_SET(c1))		/* CNS 11643 Plane 1 */
+			{
+				l = 2;
+				if (l > len)
+					return -1;
+				/* no further range check on c1? */
+				c2 = *s++;
+				if (!IS_EUC_RANGE_VALID(c2))
+					return -1;
+			}
+			else
+				/* must be ASCII */
+			{
+				l = 1;
+			}
+			break;
+	}
+	return l;
+}
+
+static int
+pg_johab_verifier(const unsigned char *s, int len)
+{
+	int			l,
+				mbl;
+	unsigned char c;
+
+	l = mbl = pg_johab_mblen(s);
+
+	if (len < l)
+		return -1;
+
+	if (!IS_HIGHBIT_SET(*s))
+		return mbl;
+
+	while (--l > 0)
+	{
+		c = *++s;
+		if (!IS_EUC_RANGE_VALID(c))
+			return -1;
+	}
+	return mbl;
+}
+
+static int
+pg_mule_verifier(const unsigned char *s, int len)
+{
+	int			l,
+				mbl;
+	unsigned char c;
+
+	l = mbl = pg_mule_mblen(s);
+
+	if (len < l)
+		return -1;
+
+	while (--l > 0)
+	{
+		c = *++s;
+		if (!IS_HIGHBIT_SET(c))
+			return -1;
+	}
+	return mbl;
+}
+
+static int
+pg_latin1_verifier(const unsigned char *s, int len)
+{
+	return 1;
+}
+
+static int
+pg_sjis_verifier(const unsigned char *s, int len)
+{
+	int			l,
+				mbl;
+	unsigned char c1,
+				c2;
+
+	l = mbl = pg_sjis_mblen(s);
+
+	if (len < l)
+		return -1;
+
+	if (l == 1)					/* pg_sjis_mblen already verified it */
+		return mbl;
+
+	c1 = *s++;
+	c2 = *s;
+	if (!ISSJISHEAD(c1) || !ISSJISTAIL(c2))
+		return -1;
+	return mbl;
+}
+
+static int
+pg_big5_verifier(const unsigned char *s, int len)
+{
+	int			l,
+				mbl;
+
+	l = mbl = pg_big5_mblen(s);
+
+	if (len < l)
+		return -1;
+
+	while (--l > 0)
+	{
+		if (*++s == '\0')
+			return -1;
+	}
+
+	return mbl;
+}
+
+static int
+pg_gbk_verifier(const unsigned char *s, int len)
+{
+	int			l,
+				mbl;
+
+	l = mbl = pg_gbk_mblen(s);
+
+	if (len < l)
+		return -1;
+
+	while (--l > 0)
+	{
+		if (*++s == '\0')
+			return -1;
+	}
+
+	return mbl;
+}
+
+static int
+pg_uhc_verifier(const unsigned char *s, int len)
+{
+	int			l,
+				mbl;
+
+	l = mbl = pg_uhc_mblen(s);
+
+	if (len < l)
+		return -1;
+
+	while (--l > 0)
+	{
+		if (*++s == '\0')
+			return -1;
+	}
+
+	return mbl;
+}
+
+static int
+pg_gb18030_verifier(const unsigned char *s, int len)
+{
+	int			l;
+
+	if (!IS_HIGHBIT_SET(*s))
+		l = 1;					/* ASCII */
+	else if (len >= 4 && *(s + 1) >= 0x30 && *(s + 1) <= 0x39)
+	{
+		/* Should be 4-byte, validate remaining bytes */
+		if (*s >= 0x81 && *s <= 0xfe &&
+			*(s + 2) >= 0x81 && *(s + 2) <= 0xfe &&
+			*(s + 3) >= 0x30 && *(s + 3) <= 0x39)
+			l = 4;
+		else
+			l = -1;
+	}
+	else if (len >= 2 && *s >= 0x81 && *s <= 0xfe)
+	{
+		/* Should be 2-byte, validate */
+		if ((*(s + 1) >= 0x40 && *(s + 1) <= 0x7e) ||
+			(*(s + 1) >= 0x80 && *(s + 1) <= 0xfe))
+			l = 2;
+		else
+			l = -1;
+	}
+	else
+		l = -1;
+	return l;
+}
+
+static int
+pg_utf8_verifier(const unsigned char *s, int len)
+{
+	int			l = pg_utf_mblen(s);
+
+	if (len < l)
+		return -1;
+
+	if (!pg_utf8_islegal(s, l))
+		return -1;
+
+	return l;
+}
+
+/*
+ * Check for validity of a single UTF-8 encoded character
+ *
+ * This directly implements the rules in RFC3629.  The bizarre-looking
+ * restrictions on the second byte are meant to ensure that there isn't
+ * more than one encoding of a given Unicode character point; that is,
+ * you may not use a longer-than-necessary byte sequence with high order
+ * zero bits to represent a character that would fit in fewer bytes.
+ * To do otherwise is to create security hazards (eg, create an apparent
+ * non-ASCII character that decodes to plain ASCII).
+ *
+ * length is assumed to have been obtained by pg_utf_mblen(), and the
+ * caller must have checked that that many bytes are present in the buffer.
+ */
+bool
+pg_utf8_islegal(const unsigned char *source, int length)
+{
+	unsigned char a;
+
+	switch (length)
+	{
+		default:
+			/* reject lengths 5 and 6 for now */
+			return false;
+		case 4:
+			a = source[3];
+			if (a < 0x80 || a > 0xBF)
+				return false;
+			/* FALL THRU */
+		case 3:
+			a = source[2];
+			if (a < 0x80 || a > 0xBF)
+				return false;
+			/* FALL THRU */
+		case 2:
+			a = source[1];
+			switch (*source)
+			{
+				case 0xE0:
+					if (a < 0xA0 || a > 0xBF)
+						return false;
+					break;
+				case 0xED:
+					if (a < 0x80 || a > 0x9F)
+						return false;
+					break;
+				case 0xF0:
+					if (a < 0x90 || a > 0xBF)
+						return false;
+					break;
+				case 0xF4:
+					if (a < 0x80 || a > 0x8F)
+						return false;
+					break;
+				default:
+					if (a < 0x80 || a > 0xBF)
+						return false;
+					break;
+			}
+			/* FALL THRU */
+		case 1:
+			a = *source;
+			if (a >= 0x80 && a < 0xC2)
+				return false;
+			if (a > 0xF4)
+				return false;
+			break;
+	}
+	return true;
+}
+
+#ifndef FRONTEND
+
+/*
+ * Generic character incrementer function.
+ *
+ * Not knowing anything about the properties of the encoding in use, we just
+ * keep incrementing the last byte until we get a validly-encoded result,
+ * or we run out of values to try.  We don't bother to try incrementing
+ * higher-order bytes, so there's no growth in runtime for wider characters.
+ * (If we did try to do that, we'd need to consider the likelihood that 255
+ * is not a valid final byte in the encoding.)
+ */
+
+
+/*
+ * UTF-8 character incrementer function.
+ *
+ * For a one-byte character less than 0x7F, we just increment the byte.
+ *
+ * For a multibyte character, every byte but the first must fall between 0x80
+ * and 0xBF; and the first byte must be between 0xC0 and 0xF4.  We increment
+ * the last byte that's not already at its maximum value.  If we can't find a
+ * byte that's less than the maximum allowable value, we simply fail.  We also
+ * need some special-case logic to skip regions used for surrogate pair
+ * handling, as those should not occur in valid UTF-8.
+ *
+ * Note that we don't reset lower-order bytes back to their minimums, since
+ * we can't afford to make an exhaustive search (see make_greater_string).
+ */
+
+
+/*
+ * EUC-JP character incrementer function.
+ *
+ * If the sequence starts with SS2 (0x8e), it must be a two-byte sequence
+ * representing JIS X 0201 characters with the second byte ranging between
+ * 0xa1 and 0xdf.  We just increment the last byte if it's less than 0xdf,
+ * and otherwise rewrite the whole sequence to 0xa1 0xa1.
+ *
+ * If the sequence starts with SS3 (0x8f), it must be a three-byte sequence
+ * in which the last two bytes range between 0xa1 and 0xfe.  The last byte
+ * is incremented if possible, otherwise the second-to-last byte.
+ *
+ * If the sequence starts with a value other than the above and its MSB
+ * is set, it must be a two-byte sequence representing JIS X 0208 characters
+ * with both bytes ranging between 0xa1 and 0xfe.  The last byte is
+ * incremented if possible, otherwise the second-to-last byte.
+ *
+ * Otherwise, the sequence is a single-byte ASCII character. It is
+ * incremented up to 0x7f.
+ */
+
+#endif   /* !FRONTEND */
+
+
+/*
+ *-------------------------------------------------------------------
+ * encoding info table
+ * XXX must be sorted by the same order as enum pg_enc (in mb/pg_wchar.h)
+ *-------------------------------------------------------------------
+ */
+const pg_wchar_tbl pg_wchar_table[] = {
+	{pg_ascii2wchar_with_len, pg_wchar2single_with_len, pg_ascii_mblen, pg_ascii_dsplen, pg_ascii_verifier, 1}, /* PG_SQL_ASCII */
+	{pg_eucjp2wchar_with_len, pg_wchar2euc_with_len, pg_eucjp_mblen, pg_eucjp_dsplen, pg_eucjp_verifier, 3},	/* PG_EUC_JP */
+	{pg_euccn2wchar_with_len, pg_wchar2euc_with_len, pg_euccn_mblen, pg_euccn_dsplen, pg_euccn_verifier, 2},	/* PG_EUC_CN */
+	{pg_euckr2wchar_with_len, pg_wchar2euc_with_len, pg_euckr_mblen, pg_euckr_dsplen, pg_euckr_verifier, 3},	/* PG_EUC_KR */
+	{pg_euctw2wchar_with_len, pg_wchar2euc_with_len, pg_euctw_mblen, pg_euctw_dsplen, pg_euctw_verifier, 4},	/* PG_EUC_TW */
+	{pg_eucjp2wchar_with_len, pg_wchar2euc_with_len, pg_eucjp_mblen, pg_eucjp_dsplen, pg_eucjp_verifier, 3},	/* PG_EUC_JIS_2004 */
+	{pg_utf2wchar_with_len, pg_wchar2utf_with_len, pg_utf_mblen, pg_utf_dsplen, pg_utf8_verifier, 4},	/* PG_UTF8 */
+	{pg_mule2wchar_with_len, pg_wchar2mule_with_len, pg_mule_mblen, pg_mule_dsplen, pg_mule_verifier, 4},		/* PG_MULE_INTERNAL */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_LATIN1 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_LATIN2 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_LATIN3 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_LATIN4 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_LATIN5 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_LATIN6 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_LATIN7 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_LATIN8 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_LATIN9 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_LATIN10 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_WIN1256 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_WIN1258 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_WIN866 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_WIN874 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_KOI8R */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_WIN1251 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_WIN1252 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* ISO-8859-5 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* ISO-8859-6 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* ISO-8859-7 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* ISO-8859-8 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_WIN1250 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_WIN1253 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_WIN1254 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_WIN1255 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_WIN1257 */
+	{pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1},		/* PG_KOI8U */
+	{0, 0, pg_sjis_mblen, pg_sjis_dsplen, pg_sjis_verifier, 2}, /* PG_SJIS */
+	{0, 0, pg_big5_mblen, pg_big5_dsplen, pg_big5_verifier, 2}, /* PG_BIG5 */
+	{0, 0, pg_gbk_mblen, pg_gbk_dsplen, pg_gbk_verifier, 2},	/* PG_GBK */
+	{0, 0, pg_uhc_mblen, pg_uhc_dsplen, pg_uhc_verifier, 2},	/* PG_UHC */
+	{0, 0, pg_gb18030_mblen, pg_gb18030_dsplen, pg_gb18030_verifier, 4},		/* PG_GB18030 */
+	{0, 0, pg_johab_mblen, pg_johab_dsplen, pg_johab_verifier, 3},		/* PG_JOHAB */
+	{0, 0, pg_sjis_mblen, pg_sjis_dsplen, pg_sjis_verifier, 2}	/* PG_SHIFT_JIS_2004 */
+};
+
+/* returns the byte length of a word for mule internal code */
+
+
+/*
+ * Returns the byte length of a multibyte character.
+ */
+int
+pg_encoding_mblen(int encoding, const char *mbstr)
+{
+	return (PG_VALID_ENCODING(encoding) ?
+		((*pg_wchar_table[encoding].mblen) ((const unsigned char *) mbstr)) :
+	((*pg_wchar_table[PG_SQL_ASCII].mblen) ((const unsigned char *) mbstr)));
+}
+
+/*
+ * Returns the display length of a multibyte character.
+ */
+
+
+/*
+ * Verify the first multibyte character of the given string.
+ * Return its byte length if good, -1 if bad.  (See comments above for
+ * full details of the mbverify API.)
+ */
+
+
+/*
+ * fetch maximum length of a given encoding
+ */
+int
+pg_encoding_max_length(int encoding)
+{
+	Assert(PG_VALID_ENCODING(encoding));
+
+	return pg_wchar_table[encoding].maxmblen;
+}
+
+#ifndef FRONTEND
+
+/*
+ * fetch maximum length of the encoding for the current database
+ */
+int
+pg_database_encoding_max_length(void)
+{
+	return pg_wchar_table[GetDatabaseEncoding()].maxmblen;
+}
+
+/*
+ * get the character incrementer for the encoding for the current database
+ */
+
+
+/*
+ * Verify mbstr to make sure that it is validly encoded in the current
+ * database encoding.  Otherwise same as pg_verify_mbstr().
+ */
+bool
+pg_verifymbstr(const char *mbstr, int len, bool noError)
+{
+	return
+		pg_verify_mbstr_len(GetDatabaseEncoding(), mbstr, len, noError) >= 0;
+}
+
+/*
+ * Verify mbstr to make sure that it is validly encoded in the specified
+ * encoding.
+ */
+
+
+/*
+ * Verify mbstr to make sure that it is validly encoded in the specified
+ * encoding.
+ *
+ * mbstr is not necessarily zero terminated; length of mbstr is
+ * specified by len.
+ *
+ * If OK, return length of string in the encoding.
+ * If a problem is found, return -1 when noError is
+ * true; when noError is false, ereport() a descriptive message.
+ */
+int
+pg_verify_mbstr_len(int encoding, const char *mbstr, int len, bool noError)
+{
+	mbverifier	mbverify;
+	int			mb_len;
+
+	Assert(PG_VALID_ENCODING(encoding));
+
+	/*
+	 * In single-byte encodings, we need only reject nulls (\0).
+	 */
+	if (pg_encoding_max_length(encoding) <= 1)
+	{
+		const char *nullpos = memchr(mbstr, 0, len);
+
+		if (nullpos == NULL)
+			return len;
+		if (noError)
+			return -1;
+		report_invalid_encoding(encoding, nullpos, 1);
+	}
+
+	/* fetch function pointer just once */
+	mbverify = pg_wchar_table[encoding].mbverify;
+
+	mb_len = 0;
+
+	while (len > 0)
+	{
+		int			l;
+
+		/* fast path for ASCII-subset characters */
+		if (!IS_HIGHBIT_SET(*mbstr))
+		{
+			if (*mbstr != '\0')
+			{
+				mb_len++;
+				mbstr++;
+				len--;
+				continue;
+			}
+			if (noError)
+				return -1;
+			report_invalid_encoding(encoding, mbstr, len);
+		}
+
+		l = (*mbverify) ((const unsigned char *) mbstr, len);
+
+		if (l < 0)
+		{
+			if (noError)
+				return -1;
+			report_invalid_encoding(encoding, mbstr, len);
+		}
+
+		mbstr += l;
+		len -= l;
+		mb_len++;
+	}
+	return mb_len;
+}
+
+/*
+ * check_encoding_conversion_args: check arguments of a conversion function
+ *
+ * "expected" arguments can be either an encoding ID or -1 to indicate that
+ * the caller will check whether it accepts the ID.
+ *
+ * Note: the errors here are not really user-facing, so elog instead of
+ * ereport seems sufficient.  Also, we trust that the "expected" encoding
+ * arguments are valid encoding IDs, but we don't trust the actuals.
+ */
+
+
+/*
+ * report_invalid_encoding: complain about invalid multibyte character
+ *
+ * note: len is remaining length of string, not length of character;
+ * len must be greater than zero, as we always examine the first byte.
+ */
+void
+report_invalid_encoding(int encoding, const char *mbstr, int len)
+{
+	int			l = pg_encoding_mblen(encoding, mbstr);
+	char		buf[8 * 5 + 1];
+	char	   *p = buf;
+	int			j,
+				jlimit;
+
+	jlimit = Min(l, len);
+	jlimit = Min(jlimit, 8);	/* prevent buffer overrun */
+
+	for (j = 0; j < jlimit; j++)
+	{
+		p += sprintf(p, "0x%02x", (unsigned char) mbstr[j]);
+		if (j < jlimit - 1)
+			p += sprintf(p, " ");
+	}
+
+	ereport(ERROR,
+			(errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE),
+			 errmsg("invalid byte sequence for encoding \"%s\": %s",
+					pg_enc2name_tbl[encoding].name,
+					buf)));
+}
+
+/*
+ * report_untranslatable_char: complain about untranslatable character
+ *
+ * note: len is remaining length of string, not length of character;
+ * len must be greater than zero, as we always examine the first byte.
+ */
+
+
+#endif   /* !FRONTEND */
diff --git a/foreign/libpg_query/src/postgres/src_backend_utils_misc_guc.c b/foreign/libpg_query/src/postgres/src_backend_utils_misc_guc.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_utils_misc_guc.c
@@ -0,0 +1,1580 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - log_min_messages
+ * - client_min_messages
+ * - check_function_bodies
+ *--------------------------------------------------------------------
+ */
+
+/*--------------------------------------------------------------------
+ * guc.c
+ *
+ * Support for grand unified configuration scheme, including SET
+ * command, configuration file, and command line options.
+ * See src/backend/utils/misc/README for more information.
+ *
+ *
+ * Copyright (c) 2000-2015, PostgreSQL Global Development Group
+ * Written by Peter Eisentraut <peter_e@gmx.net>.
+ *
+ * IDENTIFICATION
+ *	  src/backend/utils/misc/guc.c
+ *
+ *--------------------------------------------------------------------
+ */
+#include "postgres.h"
+
+#include <ctype.h>
+#include <float.h>
+#include <math.h>
+#include <limits.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#ifdef HAVE_SYSLOG
+#include <syslog.h>
+#endif
+
+#include "access/commit_ts.h"
+#include "access/gin.h"
+#include "access/transam.h"
+#include "access/twophase.h"
+#include "access/xact.h"
+#include "catalog/namespace.h"
+#include "commands/async.h"
+#include "commands/prepare.h"
+#include "commands/vacuum.h"
+#include "commands/variable.h"
+#include "commands/trigger.h"
+#include "funcapi.h"
+#include "libpq/auth.h"
+#include "libpq/be-fsstubs.h"
+#include "libpq/libpq.h"
+#include "libpq/pqformat.h"
+#include "miscadmin.h"
+#include "optimizer/cost.h"
+#include "optimizer/geqo.h"
+#include "optimizer/paths.h"
+#include "optimizer/planmain.h"
+#include "parser/parse_expr.h"
+#include "parser/parse_type.h"
+#include "parser/parser.h"
+#include "parser/scansup.h"
+#include "pgstat.h"
+#include "postmaster/autovacuum.h"
+#include "postmaster/bgworker.h"
+#include "postmaster/bgwriter.h"
+#include "postmaster/postmaster.h"
+#include "postmaster/syslogger.h"
+#include "postmaster/walwriter.h"
+#include "replication/slot.h"
+#include "replication/syncrep.h"
+#include "replication/walreceiver.h"
+#include "replication/walsender.h"
+#include "storage/bufmgr.h"
+#include "storage/dsm_impl.h"
+#include "storage/standby.h"
+#include "storage/fd.h"
+#include "storage/pg_shmem.h"
+#include "storage/proc.h"
+#include "storage/predicate.h"
+#include "tcop/tcopprot.h"
+#include "tsearch/ts_cache.h"
+#include "utils/builtins.h"
+#include "utils/bytea.h"
+#include "utils/guc_tables.h"
+#include "utils/memutils.h"
+#include "utils/pg_locale.h"
+#include "utils/plancache.h"
+#include "utils/portal.h"
+#include "utils/ps_status.h"
+#include "utils/rls.h"
+#include "utils/snapmgr.h"
+#include "utils/tzparser.h"
+#include "utils/xml.h"
+
+#ifndef PG_KRB_SRVTAB
+#define PG_KRB_SRVTAB ""
+#endif
+
+#define CONFIG_FILENAME "postgresql.conf"
+#define HBA_FILENAME	"pg_hba.conf"
+#define IDENT_FILENAME	"pg_ident.conf"
+
+#ifdef EXEC_BACKEND
+#define CONFIG_EXEC_PARAMS "global/config_exec_params"
+#define CONFIG_EXEC_PARAMS_NEW "global/config_exec_params.new"
+#endif
+
+/*
+ * Precision with which REAL type guc values are to be printed for GUC
+ * serialization.
+ */
+#define REALTYPE_PRECISION 17
+
+/* XXX these should appear in other modules' header files */
+extern bool Log_disconnections;
+extern int	CommitDelay;
+extern int	CommitSiblings;
+extern char *default_tablespace;
+extern char *temp_tablespaces;
+extern bool ignore_checksum_failure;
+extern bool synchronize_seqscans;
+
+#ifdef TRACE_SYNCSCAN
+extern bool trace_syncscan;
+#endif
+#ifdef DEBUG_BOUNDED_SORT
+extern bool optimize_bounded_sort;
+#endif
+
+
+
+/* global variables for check hook support */
+
+
+
+
+static void do_serialize(char **destptr, Size *maxbytes, const char *fmt,...) pg_attribute_printf(3, 4);
+
+static void set_config_sourcefile(const char *name, char *sourcefile,
+					  int sourceline);
+static bool call_bool_check_hook(struct config_bool * conf, bool *newval,
+					 void **extra, GucSource source, int elevel);
+static bool call_int_check_hook(struct config_int * conf, int *newval,
+					void **extra, GucSource source, int elevel);
+static bool call_real_check_hook(struct config_real * conf, double *newval,
+					 void **extra, GucSource source, int elevel);
+static bool call_string_check_hook(struct config_string * conf, char **newval,
+					   void **extra, GucSource source, int elevel);
+static bool call_enum_check_hook(struct config_enum * conf, int *newval,
+					 void **extra, GucSource source, int elevel);
+
+static bool check_log_destination(char **newval, void **extra, GucSource source);
+static void assign_log_destination(const char *newval, void *extra);
+
+#ifdef HAVE_SYSLOG
+
+#else
+static int	syslog_facility = 0;
+#endif
+
+static void assign_syslog_facility(int newval, void *extra);
+static void assign_syslog_ident(const char *newval, void *extra);
+static void assign_session_replication_role(int newval, void *extra);
+static bool check_temp_buffers(int *newval, void **extra, GucSource source);
+static bool check_bonjour(bool *newval, void **extra, GucSource source);
+static bool check_ssl(bool *newval, void **extra, GucSource source);
+static bool check_stage_log_stats(bool *newval, void **extra, GucSource source);
+static bool check_log_stats(bool *newval, void **extra, GucSource source);
+static bool check_canonical_path(char **newval, void **extra, GucSource source);
+static bool check_timezone_abbreviations(char **newval, void **extra, GucSource source);
+static void assign_timezone_abbreviations(const char *newval, void *extra);
+static void pg_timezone_abbrev_initialize(void);
+static const char *show_archive_command(void);
+static void assign_tcp_keepalives_idle(int newval, void *extra);
+static void assign_tcp_keepalives_interval(int newval, void *extra);
+static void assign_tcp_keepalives_count(int newval, void *extra);
+static const char *show_tcp_keepalives_idle(void);
+static const char *show_tcp_keepalives_interval(void);
+static const char *show_tcp_keepalives_count(void);
+static bool check_maxconnections(int *newval, void **extra, GucSource source);
+static bool check_max_worker_processes(int *newval, void **extra, GucSource source);
+static bool check_autovacuum_max_workers(int *newval, void **extra, GucSource source);
+static bool check_autovacuum_work_mem(int *newval, void **extra, GucSource source);
+static bool check_effective_io_concurrency(int *newval, void **extra, GucSource source);
+static void assign_effective_io_concurrency(int newval, void *extra);
+static void assign_pgstat_temp_directory(const char *newval, void *extra);
+static bool check_application_name(char **newval, void **extra, GucSource source);
+static void assign_application_name(const char *newval, void *extra);
+static bool check_cluster_name(char **newval, void **extra, GucSource source);
+static const char *show_unix_socket_permissions(void);
+static const char *show_log_file_mode(void);
+
+/* Private functions in guc-file.l that need to be called from guc.c */
+static ConfigVariable *ProcessConfigFileInternal(GucContext context,
+						  bool applySettings, int elevel);
+
+
+/*
+ * Options for enum values defined in this module.
+ *
+ * NOTE! Option values may not contain double quotes!
+ */
+
+
+
+/*
+ * We have different sets for client and server message level options because
+ * they sort slightly different (see "log" level)
+ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#ifdef HAVE_SYSLOG
+#else
+#endif
+
+
+
+
+
+
+
+/*
+ * Although only "on", "off", and "safe_encoding" are documented, we
+ * accept all the likely variants of "on" and "off".
+ */
+
+
+/*
+ * Although only "on", "off", and "partition" are documented, we
+ * accept all the likely variants of "on" and "off".
+ */
+
+
+/*
+ * Although only "on", "off", "remote_write", and "local" are documented, we
+ * accept all the likely variants of "on" and "off".
+ */
+
+
+/*
+ * Although only "on", "off", "try" are documented, we accept all the likely
+ * variants of "on" and "off".
+ */
+
+
+/*
+ * Options for enum values stored in other modules
+ */
+extern const struct config_enum_entry wal_level_options[];
+extern const struct config_enum_entry archive_mode_options[];
+extern const struct config_enum_entry sync_method_options[];
+extern const struct config_enum_entry dynamic_shared_memory_options[];
+
+/*
+ * GUC option variables that are exported from this module
+ */
+
+
+
+
+
+
+
+
+
+		/* this is sort of all three
+												 * above together */
+
+
+
+
+__thread bool		check_function_bodies = true;
+
+
+
+
+
+
+
+__thread int			log_min_messages = WARNING;
+
+__thread int			client_min_messages = NOTICE;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * SSL renegotiation was been removed in PostgreSQL 9.5, but we tolerate it
+ * being set to zero (meaning never renegotiate) for backward compatibility.
+ * This avoids breaking compatibility with clients that have never supported
+ * renegotiation and therefore always try to zero it.
+ */
+
+
+/*
+ * This really belongs in pg_shmem.c, but is defined here so that it doesn't
+ * need to be duplicated in all the different implementations of pg_shmem.c.
+ */
+
+
+/*
+ * These variables are all dummies that don't do anything, except in some
+ * cases provide the value for SHOW to display.  The real state is elsewhere
+ * and is kept in sync by assign_hooks.
+ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/* should be static, but commands/variable.c needs to get at this */
+
+
+
+/*
+ * Displayable names for context types (enum GucContext)
+ *
+ * Note: these strings are deliberately not localized.
+ */
+
+
+/*
+ * Displayable names for source types (enum GucSource)
+ *
+ * Note: these strings are deliberately not localized.
+ */
+
+
+/*
+ * Displayable names for the groupings defined in enum config_group
+ */
+
+
+/*
+ * Displayable names for GUC variable types (enum config_type)
+ *
+ * Note: these strings are deliberately not localized.
+ */
+
+
+/*
+ * Unit conversion tables.
+ *
+ * There are two tables, one for memory units, and another for time units.
+ * For each supported conversion from one unit to another, we have an entry
+ * in the table.
+ *
+ * To keep things simple, and to avoid intermediate-value overflows,
+ * conversions are never chained.  There needs to be a direct conversion
+ * between all units (of the same type).
+ *
+ * The conversions from each base unit must be kept in order from greatest
+ * to smallest unit; convert_from_base_unit() relies on that.  (The order of
+ * the base units does not matter.)
+ */
+#define MAX_UNIT_LEN		3	/* length of longest recognized unit string */
+
+typedef struct
+{
+	char		unit[MAX_UNIT_LEN + 1]; /* unit, as a string, like "kB" or
+										 * "min" */
+	int			base_unit;		/* GUC_UNIT_XXX */
+	int			multiplier;		/* If positive, multiply the value with this
+								 * for unit -> base_unit conversion.  If
+								 * negative, divide (with the absolute value) */
+} unit_conversion;
+
+/* Ensure that the constants in the tables don't overflow or underflow */
+#if BLCKSZ < 1024 || BLCKSZ > (1024*1024)
+#error BLCKSZ must be between 1KB and 1MB
+#endif
+#if XLOG_BLCKSZ < 1024 || XLOG_BLCKSZ > (1024*1024)
+#error XLOG_BLCKSZ must be between 1KB and 1MB
+#endif
+#if XLOG_SEG_SIZE < (1024*1024) || XLOG_BLCKSZ > (1024*1024*1024)
+#error XLOG_SEG_SIZE must be between 1MB and 1GB
+#endif
+
+
+
+
+
+
+
+
+
+/*
+ * Contents of GUC tables
+ *
+ * See src/backend/utils/misc/README for design notes.
+ *
+ * TO ADD AN OPTION:
+ *
+ * 1. Declare a global variable of type bool, int, double, or char*
+ *	  and make use of it.
+ *
+ * 2. Decide at what times it's safe to set the option. See guc.h for
+ *	  details.
+ *
+ * 3. Decide on a name, a default value, upper and lower bounds (if
+ *	  applicable), etc.
+ *
+ * 4. Add a record below.
+ *
+ * 5. Add it to src/backend/utils/misc/postgresql.conf.sample, if
+ *	  appropriate.
+ *
+ * 6. Don't forget to document the option (at least in config.sgml).
+ *
+ * 7. If it's a new GUC_LIST option you must edit pg_dumpall.c to ensure
+ *	  it is not single quoted at dump time.
+ */
+
+
+/******** option records follow ********/
+
+#ifdef USE_ASSERT_CHECKING
+#else
+#endif
+#ifdef BTREE_BUILD_STATS
+#endif
+#ifdef LOCK_DEBUG
+#endif
+#ifdef TRACE_SORT
+#endif
+#ifdef TRACE_SYNCSCAN
+#endif
+#ifdef DEBUG_BOUNDED_SORT
+#endif
+#ifdef WAL_DEBUG
+#endif
+#ifdef HAVE_INT64_TIMESTAMP
+#else
+#endif
+
+
+#ifdef LOCK_DEBUG
+#endif
+#ifdef USE_PREFETCH
+#else
+#endif
+
+
+
+
+
+#ifdef HAVE_UNIX_SOCKETS
+#else
+#endif
+#ifdef USE_SSL
+#else
+#endif
+#ifdef USE_SSL
+#else
+#endif
+
+
+#ifdef HAVE_SYSLOG
+#else
+#endif
+
+/******** end of options list ********/
+
+
+/*
+ * To allow continued support of obsolete names for GUC variables, we apply
+ * the following mappings to any unrecognized name.  Note that an old name
+ * should be mapped to a new one only if the new variable has very similar
+ * semantics to the old.
+ */
+
+
+
+/*
+ * Actual lookup of variables is done through this single, sorted array.
+ */
+
+
+/* Current number of variables contained in the vector */
+
+
+/* Vector capacity */
+
+
+
+			/* TRUE if need to do commit/abort work */
+
+	/* TRUE to enable GUC_REPORT */
+
+	/* 1 when in main transaction */
+
+
+static int	guc_var_compare(const void *a, const void *b);
+static int	guc_name_compare(const char *namea, const char *nameb);
+static void InitializeGUCOptionsFromEnvironment(void);
+static void InitializeOneGUCOption(struct config_generic * gconf);
+static void push_old_value(struct config_generic * gconf, GucAction action);
+static void ReportGUCOption(struct config_generic * record);
+static void reapply_stacked_values(struct config_generic * variable,
+					   struct config_string * pHolder,
+					   GucStack *stack,
+					   const char *curvalue,
+					   GucContext curscontext, GucSource cursource);
+static void ShowGUCConfigOption(const char *name, DestReceiver *dest);
+static void ShowAllGUCConfig(DestReceiver *dest);
+static char *_ShowOption(struct config_generic * record, bool use_units);
+static bool validate_option_array_item(const char *name, const char *value,
+						   bool skipIfNoPermissions);
+static void write_auto_conf_file(int fd, const char *filename, ConfigVariable *head_p);
+static void replace_auto_config_value(ConfigVariable **head_p, ConfigVariable **tail_p,
+						  const char *name, const char *value);
+
+
+/*
+ * Some infrastructure for checking malloc/strdup/realloc calls
+ */
+
+
+
+
+
+
+
+/*
+ * Detect whether strval is referenced anywhere in a GUC string item
+ */
+
+
+/*
+ * Support for assigning to a field of a string GUC item.  Free the prior
+ * value if it's not referenced anywhere else in the item (including stacked
+ * states).
+ */
+
+
+/*
+ * Detect whether an "extra" struct is referenced anywhere in a GUC item
+ */
+
+
+/*
+ * Support for assigning to an "extra" field of a GUC item.  Free the prior
+ * value if it's not referenced anywhere else in the item (including stacked
+ * states).
+ */
+
+
+/*
+ * Support for copying a variable's active value into a stack entry.
+ * The "extra" field associated with the active value is copied, too.
+ *
+ * NB: be sure stringval and extra fields of a new stack entry are
+ * initialized to NULL before this is used, else we'll try to free() them.
+ */
+
+
+/*
+ * Support for discarding a no-longer-needed value in a stack entry.
+ * The "extra" field associated with the stack entry is cleared, too.
+ */
+
+
+
+/*
+ * Fetch the sorted array pointer (exported for help_config.c's use ONLY)
+ */
+
+
+
+/*
+ * Build the sorted array.  This is split out so that it could be
+ * re-executed after startup (eg, we could allow loadable modules to
+ * add vars, and then we'd need to re-sort).
+ */
+
+
+/*
+ * Add a new GUC variable to the list of known variables. The
+ * list is expanded if needed.
+ */
+
+
+/*
+ * Create and add a placeholder variable for a custom variable name.
+ */
+
+
+/*
+ * Look up option NAME.  If it exists, return a pointer to its record,
+ * else return NULL.  If create_placeholders is TRUE, we'll create a
+ * placeholder record for a valid-looking custom variable name.
+ */
+
+
+
+/*
+ * comparator for qsorting and bsearching guc_variables array
+ */
+
+
+/*
+ * the bare comparison function for GUC names
+ */
+
+
+
+/*
+ * Initialize GUC options during program startup.
+ *
+ * Note that we cannot read the config file yet, since we have not yet
+ * processed command-line switches.
+ */
+
+
+/*
+ * Assign any GUC values that can come from the server's environment.
+ *
+ * This is called from InitializeGUCOptions, and also from ProcessConfigFile
+ * to deal with the possibility that a setting has been removed from
+ * postgresql.conf and should now get a value from the environment.
+ * (The latter is a kludge that should probably go away someday; if so,
+ * fold this back into InitializeGUCOptions.)
+ */
+
+
+/*
+ * Initialize one GUC option variable to its compiled-in default.
+ *
+ * Note: the reason for calling check_hooks is not that we think the boot_val
+ * might fail, but that the hooks might wish to compute an "extra" struct.
+ */
+
+
+
+/*
+ * Select the configuration files and data directory to be used, and
+ * do the initial read of postgresql.conf.
+ *
+ * This is called after processing command-line switches.
+ *		userDoption is the -D switch value if any (NULL if unspecified).
+ *		progname is just for use in error messages.
+ *
+ * Returns true on success; on failure, prints a suitable error message
+ * to stderr and returns false.
+ */
+
+
+
+/*
+ * Reset all options to their saved default values (implements RESET ALL)
+ */
+
+
+
+/*
+ * push_old_value
+ *		Push previous state during transactional assignment to a GUC variable.
+ */
+
+
+
+/*
+ * Do GUC processing at main transaction start.
+ */
+
+
+/*
+ * Enter a new nesting level for GUC values.  This is called at subtransaction
+ * start, and when entering a function that has proconfig settings, and in
+ * some other places where we want to set GUC variables transiently.
+ * NOTE we must not risk error here, else subtransaction start will be unhappy.
+ */
+
+
+/*
+ * Do GUC processing at transaction or subtransaction commit or abort, or
+ * when exiting a function that has proconfig settings, or when undoing a
+ * transient assignment to some GUC variables.  (The name is thus a bit of
+ * a misnomer; perhaps it should be ExitGUCNestLevel or some such.)
+ * During abort, we discard all GUC settings that were applied at nesting
+ * levels >= nestLevel.  nestLevel == 1 corresponds to the main transaction.
+ */
+
+
+
+/*
+ * Start up automatic reporting of changes to variables marked GUC_REPORT.
+ * This is executed at completion of backend startup.
+ */
+
+
+/*
+ * ReportGUCOption: if appropriate, transmit option value to frontend
+ */
+
+
+/*
+ * Convert a value from one of the human-friendly units ("kB", "min" etc.)
+ * to the given base unit.  'value' and 'unit' are the input value and unit
+ * to convert from.  The converted value is stored in *base_value.
+ *
+ * Returns true on success, false if the input unit is not recognized.
+ */
+
+
+/*
+ * Convert a value in some base unit to a human-friendly unit.  The output
+ * unit is chosen so that it's the greatest unit that can represent the value
+ * without loss.  For example, if the base unit is GUC_UNIT_KB, 1024 is
+ * converted to 1 MB, but 1025 is represented as 1025 kB.
+ */
+
+
+
+/*
+ * Try to parse value as an integer.  The accepted formats are the
+ * usual decimal, octal, or hexadecimal formats, optionally followed by
+ * a unit name if "flags" indicates a unit is allowed.
+ *
+ * If the string parses okay, return true, else false.
+ * If okay and result is not NULL, return the value in *result.
+ * If not okay and hintmsg is not NULL, *hintmsg is set to a suitable
+ *	HINT message, or NULL if no hint provided.
+ */
+
+
+
+
+/*
+ * Try to parse value as a floating point number in the usual format.
+ * If the string parses okay, return true, else false.
+ * If okay and result is not NULL, return the value in *result.
+ */
+
+
+
+/*
+ * Lookup the name for an enum option with the selected value.
+ * Should only ever be called with known-valid values, so throws
+ * an elog(ERROR) if the enum option is not found.
+ *
+ * The returned string is a pointer to static data and not
+ * allocated for modification.
+ */
+
+
+
+/*
+ * Lookup the value for an enum option with the selected name
+ * (case-insensitive).
+ * If the enum option is found, sets the retval value and returns
+ * true. If it's not found, return FALSE and retval is set to 0.
+ */
+
+
+
+/*
+ * Return a list of all available options for an enum, excluding
+ * hidden ones, separated by the given separator.
+ * If prefix is non-NULL, it is added before the first enum value.
+ * If suffix is non-NULL, it is added to the end of the string.
+ */
+
+
+/*
+ * Parse and validate a proposed value for the specified configuration
+ * parameter.
+ *
+ * This does built-in checks (such as range limits for an integer parameter)
+ * and also calls any check hook the parameter may have.
+ *
+ * record: GUC variable's info record
+ * name: variable name (should match the record of course)
+ * value: proposed value, as a string
+ * source: identifies source of value (check hooks may need this)
+ * elevel: level to log any error reports at
+ * newval: on success, converted parameter value is returned here
+ * newextra: on success, receives any "extra" data returned by check hook
+ *	(caller must initialize *newextra to NULL)
+ *
+ * Returns true if OK, false if not (or throws error, if elevel >= ERROR)
+ */
+
+
+
+/*
+ * Sets option `name' to given value.
+ *
+ * The value should be a string, which will be parsed and converted to
+ * the appropriate data type.  The context and source parameters indicate
+ * in which context this function is being called, so that it can apply the
+ * access restrictions properly.
+ *
+ * If value is NULL, set the option to its default value (normally the
+ * reset_val, but if source == PGC_S_DEFAULT we instead use the boot_val).
+ *
+ * action indicates whether to set the value globally in the session, locally
+ * to the current top transaction, or just for the duration of a function call.
+ *
+ * If changeVal is false then don't really set the option but do all
+ * the checks to see if it would work.
+ *
+ * elevel should normally be passed as zero, allowing this function to make
+ * its standard choice of ereport level.  However some callers need to be
+ * able to override that choice; they should pass the ereport level to use.
+ *
+ * Return value:
+ *	+1: the value is valid and was successfully applied.
+ *	0:	the name or value is invalid (but see below).
+ *	-1: the value was not applied because of context, priority, or changeVal.
+ *
+ * If there is an error (non-existing option, invalid value) then an
+ * ereport(ERROR) is thrown *unless* this is called for a source for which
+ * we don't want an ERROR (currently, those are defaults, the config file,
+ * and per-database or per-user settings, as well as callers who specify
+ * a less-than-ERROR elevel).  In those cases we write a suitable error
+ * message via ereport() and return 0.
+ *
+ * See also SetConfigOption for an external interface.
+ */
+#define newval (newval_union.boolval)
+#undef newval
+#define newval (newval_union.intval)
+#undef newval
+#define newval (newval_union.realval)
+#undef newval
+#define newval (newval_union.stringval)
+#undef newval
+#define newval (newval_union.enumval)
+#undef newval
+
+
+/*
+ * Set the fields for source file and line number the setting came from.
+ */
+
+
+/*
+ * Set a config option to the given value.
+ *
+ * See also set_config_option; this is just the wrapper to be called from
+ * outside GUC.  (This function should be used when possible, because its API
+ * is more stable than set_config_option's.)
+ *
+ * Note: there is no support here for setting source file/line, as it
+ * is currently not needed.
+ */
+
+
+
+
+/*
+ * Fetch the current value of the option `name', as a string.
+ *
+ * If the option doesn't exist, return NULL if missing_ok is true (NOTE that
+ * this cannot be distinguished from a string variable with a NULL value!),
+ * otherwise throw an ereport and don't return.
+ *
+ * If restrict_superuser is true, we also enforce that only superusers can
+ * see GUC_SUPERUSER_ONLY variables.  This should only be passed as true
+ * in user-driven calls.
+ *
+ * The string is *not* allocated for modification and is really only
+ * valid until the next call to configuration related functions.
+ */
+
+
+/*
+ * Get the RESET value associated with the given option.
+ *
+ * Note: this is not re-entrant, due to use of static result buffer;
+ * not to mention that a string variable could have its reset_val changed.
+ * Beware of assuming the result value is good for very long.
+ */
+
+
+
+/*
+ * flatten_set_variable_args
+ *		Given a parsenode List as emitted by the grammar for SET,
+ *		convert to the flat string representation used by GUC.
+ *
+ * We need to be told the name of the variable the args are for, because
+ * the flattening rules vary (ugh).
+ *
+ * The result is NULL if args is NIL (ie, SET ... TO DEFAULT), otherwise
+ * a palloc'd string.
+ */
+
+
+/*
+ * Write updated configuration parameter values into a temporary file.
+ * This function traverses the list of parameters and quotes the string
+ * values before writing them.
+ */
+
+
+/*
+ * Update the given list of configuration parameters, adding, replacing
+ * or deleting the entry for item "name" (delete if "value" == NULL).
+ */
+
+
+
+/*
+ * Execute ALTER SYSTEM statement.
+ *
+ * Read the old PG_AUTOCONF_FILENAME file, merge in the new variable value,
+ * and write out an updated file.  If the command is ALTER SYSTEM RESET ALL,
+ * we can skip reading the old file and just write an empty file.
+ *
+ * An LWLock is used to serialize updates of the configuration file.
+ *
+ * In case of an error, we leave the original automatic
+ * configuration file (PG_AUTOCONF_FILENAME) intact.
+ */
+
+
+/*
+ * SET command
+ */
+
+
+/*
+ * Get the value to assign for a VariableSetStmt, or NULL if it's RESET.
+ * The result is palloc'd.
+ *
+ * This is exported for use by actions such as ALTER ROLE SET.
+ */
+
+
+/*
+ * SetPGVariable - SET command exported as an easily-C-callable function.
+ *
+ * This provides access to SET TO value, as well as SET TO DEFAULT (expressed
+ * by passing args == NIL), but not SET FROM CURRENT functionality.
+ */
+
+
+/*
+ * SET command wrapped as a SQL callable function.
+ */
+
+
+
+/*
+ * Common code for DefineCustomXXXVariable subroutines: allocate the
+ * new variable's config struct and fill in generic fields.
+ */
+
+
+/*
+ * Common code for DefineCustomXXXVariable subroutines: insert the new
+ * variable into the GUC variable array, replacing any placeholder.
+ */
+
+
+/*
+ * Recursive subroutine for define_custom_variable: reapply non-reset values
+ *
+ * We recurse so that the values are applied in the same order as originally.
+ * At each recursion level, apply the upper-level value (passed in) in the
+ * fashion implied by the stack entry.
+ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * SHOW command
+ */
+
+
+
+
+
+/*
+ * SHOW command
+ */
+
+
+/*
+ * SHOW ALL command
+ */
+
+
+/*
+ * Return GUC variable value by name; optionally return canonical
+ * form of name.  Return value is palloc'd.
+ */
+
+
+/*
+ * Return GUC variable value by variable number; optionally return canonical
+ * form of name.  Return value is palloc'd.
+ */
+
+
+/*
+ * Return the total number of GUC variables
+ */
+
+
+/*
+ * show_config_by_name - equiv to SHOW X command but implemented as
+ * a function.
+ */
+
+
+/*
+ * show_all_settings - equiv to SHOW ALL command but implemented as
+ * a Table Function.
+ */
+#define NUM_PG_SETTINGS_ATTS	17
+
+
+
+/*
+ * show_all_file_settings
+ *
+ * Returns a table of all parameter settings in all configuration files
+ * which includes the config file pathname, the line number, a sequence number
+ * indicating the order in which the settings were encountered, the parameter
+ * name and value, a bool showing if the value could be applied, and possibly
+ * an associated error message.  (For problems such as syntax errors, the
+ * parameter name/value might be NULL.)
+ *
+ * Note: no filtering is done here, instead we depend on the GRANT system
+ * to prevent unprivileged users from accessing this function or the view
+ * built on top of it.
+ */
+#define NUM_PG_FILE_SETTINGS_ATTS 7
+
+
+
+
+#ifdef EXEC_BACKEND
+
+/*
+ *	These routines dump out all non-default GUC options into a binary
+ *	file that is read by all exec'ed backends.  The format is:
+ *
+ *		variable name, string, null terminated
+ *		variable value, string, null terminated
+ *		variable sourcefile, string, null terminated (empty if none)
+ *		variable sourceline, integer
+ *		variable source, integer
+ *		variable scontext, integer
+ */
+static void
+write_one_nondefault_variable(FILE *fp, struct config_generic * gconf)
+{
+	if (gconf->source == PGC_S_DEFAULT)
+		return;
+
+	fprintf(fp, "%s", gconf->name);
+	fputc(0, fp);
+
+	switch (gconf->vartype)
+	{
+		case PGC_BOOL:
+			{
+				struct config_bool *conf = (struct config_bool *) gconf;
+
+				if (*conf->variable)
+					fprintf(fp, "true");
+				else
+					fprintf(fp, "false");
+			}
+			break;
+
+		case PGC_INT:
+			{
+				struct config_int *conf = (struct config_int *) gconf;
+
+				fprintf(fp, "%d", *conf->variable);
+			}
+			break;
+
+		case PGC_REAL:
+			{
+				struct config_real *conf = (struct config_real *) gconf;
+
+				fprintf(fp, "%.17g", *conf->variable);
+			}
+			break;
+
+		case PGC_STRING:
+			{
+				struct config_string *conf = (struct config_string *) gconf;
+
+				fprintf(fp, "%s", *conf->variable);
+			}
+			break;
+
+		case PGC_ENUM:
+			{
+				struct config_enum *conf = (struct config_enum *) gconf;
+
+				fprintf(fp, "%s",
+						config_enum_lookup_by_value(conf, *conf->variable));
+			}
+			break;
+	}
+
+	fputc(0, fp);
+
+	if (gconf->sourcefile)
+		fprintf(fp, "%s", gconf->sourcefile);
+	fputc(0, fp);
+
+	fwrite(&gconf->sourceline, 1, sizeof(gconf->sourceline), fp);
+	fwrite(&gconf->source, 1, sizeof(gconf->source), fp);
+	fwrite(&gconf->scontext, 1, sizeof(gconf->scontext), fp);
+}
+
+void
+write_nondefault_variables(GucContext context)
+{
+	int			elevel;
+	FILE	   *fp;
+	int			i;
+
+	Assert(context == PGC_POSTMASTER || context == PGC_SIGHUP);
+
+	elevel = (context == PGC_SIGHUP) ? LOG : ERROR;
+
+	/*
+	 * Open file
+	 */
+	fp = AllocateFile(CONFIG_EXEC_PARAMS_NEW, "w");
+	if (!fp)
+	{
+		ereport(elevel,
+				(errcode_for_file_access(),
+				 errmsg("could not write to file \"%s\": %m",
+						CONFIG_EXEC_PARAMS_NEW)));
+		return;
+	}
+
+	for (i = 0; i < num_guc_variables; i++)
+	{
+		write_one_nondefault_variable(fp, guc_variables[i]);
+	}
+
+	if (FreeFile(fp))
+	{
+		ereport(elevel,
+				(errcode_for_file_access(),
+				 errmsg("could not write to file \"%s\": %m",
+						CONFIG_EXEC_PARAMS_NEW)));
+		return;
+	}
+
+	/*
+	 * Put new file in place.  This could delay on Win32, but we don't hold
+	 * any exclusive locks.
+	 */
+	rename(CONFIG_EXEC_PARAMS_NEW, CONFIG_EXEC_PARAMS);
+}
+
+
+/*
+ *	Read string, including null byte from file
+ *
+ *	Return NULL on EOF and nothing read
+ */
+static char *
+read_string_with_null(FILE *fp)
+{
+	int			i = 0,
+				ch,
+				maxlen = 256;
+	char	   *str = NULL;
+
+	do
+	{
+		if ((ch = fgetc(fp)) == EOF)
+		{
+			if (i == 0)
+				return NULL;
+			else
+				elog(FATAL, "invalid format of exec config params file");
+		}
+		if (i == 0)
+			str = guc_malloc(FATAL, maxlen);
+		else if (i == maxlen)
+			str = guc_realloc(FATAL, str, maxlen *= 2);
+		str[i++] = ch;
+	} while (ch != 0);
+
+	return str;
+}
+
+
+/*
+ *	This routine loads a previous postmaster dump of its non-default
+ *	settings.
+ */
+void
+read_nondefault_variables(void)
+{
+	FILE	   *fp;
+	char	   *varname,
+			   *varvalue,
+			   *varsourcefile;
+	int			varsourceline;
+	GucSource	varsource;
+	GucContext	varscontext;
+
+	/*
+	 * Assert that PGC_BACKEND/PGC_SU_BACKEND case in set_config_option() will
+	 * do the right thing.
+	 */
+	Assert(IsInitProcessingMode());
+
+	/*
+	 * Open file
+	 */
+	fp = AllocateFile(CONFIG_EXEC_PARAMS, "r");
+	if (!fp)
+	{
+		/* File not found is fine */
+		if (errno != ENOENT)
+			ereport(FATAL,
+					(errcode_for_file_access(),
+					 errmsg("could not read from file \"%s\": %m",
+							CONFIG_EXEC_PARAMS)));
+		return;
+	}
+
+	for (;;)
+	{
+		struct config_generic *record;
+
+		if ((varname = read_string_with_null(fp)) == NULL)
+			break;
+
+		if ((record = find_option(varname, true, FATAL)) == NULL)
+			elog(FATAL, "failed to locate variable \"%s\" in exec config params file", varname);
+
+		if ((varvalue = read_string_with_null(fp)) == NULL)
+			elog(FATAL, "invalid format of exec config params file");
+		if ((varsourcefile = read_string_with_null(fp)) == NULL)
+			elog(FATAL, "invalid format of exec config params file");
+		if (fread(&varsourceline, 1, sizeof(varsourceline), fp) != sizeof(varsourceline))
+			elog(FATAL, "invalid format of exec config params file");
+		if (fread(&varsource, 1, sizeof(varsource), fp) != sizeof(varsource))
+			elog(FATAL, "invalid format of exec config params file");
+		if (fread(&varscontext, 1, sizeof(varscontext), fp) != sizeof(varscontext))
+			elog(FATAL, "invalid format of exec config params file");
+
+		(void) set_config_option(varname, varvalue,
+								 varscontext, varsource,
+								 GUC_ACTION_SET, true, 0, true);
+		if (varsourcefile[0])
+			set_config_sourcefile(varname, varsourcefile, varsourceline);
+
+		free(varname);
+		free(varvalue);
+		free(varsourcefile);
+	}
+
+	FreeFile(fp);
+}
+#endif   /* EXEC_BACKEND */
+
+/*
+ * can_skip_gucvar:
+ * When serializing, determine whether to skip this GUC.  When restoring, the
+ * negation of this test determines whether to restore the compiled-in default
+ * value before processing serialized values.
+ *
+ * A PGC_S_DEFAULT setting on the serialize side will typically match new
+ * postmaster children, but that can be false when got_SIGHUP == true and the
+ * pending configuration change modifies this setting.  Nonetheless, we omit
+ * PGC_S_DEFAULT settings from serialization and make up for that by restoring
+ * defaults before applying serialized values.
+ *
+ * PGC_POSTMASTER variables always have the same value in every child of a
+ * particular postmaster.  Most PGC_INTERNAL variables are compile-time
+ * constants; a few, like server_encoding and lc_ctype, are handled specially
+ * outside the serialize/restore procedure.  Therefore, SerializeGUCState()
+ * never sends these, and RestoreGUCState() never changes them.
+ */
+
+
+/*
+ * estimate_variable_size:
+ * Estimate max size for dumping the given GUC variable.
+ */
+
+
+/*
+ * EstimateGUCStateSpace:
+ * Returns the size needed to store the GUC state for the current process
+ */
+
+
+/*
+ * do_serialize:
+ * Copies the formatted string into the destination.  Moves ahead the
+ * destination pointer, and decrements the maxbytes by that many bytes. If
+ * maxbytes is not sufficient to copy the string, error out.
+ */
+
+
+/* Binary copy version of do_serialize() */
+
+
+/*
+ * serialize_variable:
+ * Dumps name, value and other information of a GUC variable into destptr.
+ */
+
+
+/*
+ * SerializeGUCState:
+ * Dumps the complete GUC state onto the memory location at start_address.
+ */
+
+
+/*
+ * read_gucstate:
+ * Actually it does not read anything, just returns the srcptr. But it does
+ * move the srcptr past the terminating zero byte, so that the caller is ready
+ * to read the next string.
+ */
+
+
+/* Binary read version of read_gucstate(). Copies into dest */
+
+
+/*
+ * RestoreGUCState:
+ * Reads the GUC state at the specified address and updates the GUCs with the
+ * values read from the GUC state.
+ */
+
+
+/*
+ * A little "long argument" simulation, although not quite GNU
+ * compliant. Takes a string of the form "some-option=some value" and
+ * returns name = "some_option" and value = "some value" in malloc'ed
+ * storage. Note that '-' is converted to '_' in the option name. If
+ * there is no '=' in the input string then value will be NULL.
+ */
+
+
+
+/*
+ * Handle options fetched from pg_db_role_setting.setconfig,
+ * pg_proc.proconfig, etc.  Caller must specify proper context/source/action.
+ *
+ * The array parameter must be an array of TEXT (it must not be NULL).
+ */
+
+
+
+/*
+ * Add an entry to an option array.  The array parameter may be NULL
+ * to indicate the current table entry is NULL.
+ */
+
+
+
+/*
+ * Delete an entry from an option array.  The array parameter may be NULL
+ * to indicate the current table entry is NULL.  Also, if the return value
+ * is NULL then a null should be stored.
+ */
+
+
+
+/*
+ * Given a GUC array, delete all settings from it that our permission
+ * level allows: if superuser, delete them all; if regular user, only
+ * those that are PGC_USERSET
+ */
+
+
+/*
+ * Validate a proposed option setting for GUCArrayAdd/Delete/Reset.
+ *
+ * name is the option name.  value is the proposed value for the Add case,
+ * or NULL for the Delete/Reset cases.  If skipIfNoPermissions is true, it's
+ * not an error to have no permissions to set the option.
+ *
+ * Returns TRUE if OK, FALSE if skipIfNoPermissions is true and user does not
+ * have permission to change this option (all other error cases result in an
+ * error being thrown).
+ */
+
+
+
+/*
+ * Called by check_hooks that want to override the normal
+ * ERRCODE_INVALID_PARAMETER_VALUE SQLSTATE for check hook failures.
+ *
+ * Note that GUC_check_errmsg() etc are just macros that result in a direct
+ * assignment to the associated variables.  That is ugly, but forced by the
+ * limitations of C's macro mechanisms.
+ */
+
+
+
+/*
+ * Convenience functions to manage calling a variable's check_hook.
+ * These mostly take care of the protocol for letting check hooks supply
+ * portions of the error report on failure.
+ */
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * check_hook, assign_hook and show_hook subroutines
+ */
+
+#ifdef HAVE_SYSLOG
+#endif
+#ifdef WIN32
+#endif
+
+
+
+#ifdef HAVE_SYSLOG
+#endif
+
+#ifdef HAVE_SYSLOG
+#endif
+
+
+
+
+
+
+#ifndef USE_BONJOUR
+#endif
+
+#ifndef USE_SSL
+#endif
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * pg_timezone_abbrev_initialize --- set default value if not done already
+ *
+ * This is called after initial loading of postgresql.conf.  If no
+ * timezone_abbreviations setting was found therein, select default.
+ * If a non-default value is already installed, nothing will happen.
+ *
+ * This can also be called from ProcessConfigFile to establish the default
+ * value after a postgresql.conf entry for it is removed.
+ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#ifdef USE_PREFETCH
+#else
+#endif   /* USE_PREFETCH */
+
+#ifdef USE_PREFETCH
+#endif   /* USE_PREFETCH */
+
+
+
+
+
+
+
+
+
+
+
+
+
+#include "guc-file.c"
diff --git a/foreign/libpg_query/src/postgres/src_backend_utils_mmgr_aset.c b/foreign/libpg_query/src/postgres/src_backend_utils_mmgr_aset.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_utils_mmgr_aset.c
@@ -0,0 +1,1387 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - AllocSetContextCreate
+ * - AllocSetMethods
+ * - AllocSetAlloc
+ * - AllocSetFreeIndex
+ * - LogTable256
+ * - AllocSetFree
+ * - AllocSetRealloc
+ * - AllocSetInit
+ * - AllocSetReset
+ * - AllocSetDelete
+ * - AllocSetGetChunkSpace
+ * - AllocSetIsEmpty
+ * - AllocSetStats
+ * - AllocSetContextCreate
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * aset.c
+ *	  Allocation set definitions.
+ *
+ * AllocSet is our standard implementation of the abstract MemoryContext
+ * type.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ *	  src/backend/utils/mmgr/aset.c
+ *
+ * NOTE:
+ *	This is a new (Feb. 05, 1999) implementation of the allocation set
+ *	routines. AllocSet...() does not use OrderedSet...() any more.
+ *	Instead it manages allocations in a block pool by itself, combining
+ *	many small allocations in a few bigger blocks. AllocSetFree() normally
+ *	doesn't free() memory really. It just add's the free'd area to some
+ *	list for later reuse by AllocSetAlloc(). All memory blocks are free()'d
+ *	at once on AllocSetReset(), which happens when the memory context gets
+ *	destroyed.
+ *				Jan Wieck
+ *
+ *	Performance improvement from Tom Lane, 8/99: for extremely large request
+ *	sizes, we do want to be able to give the memory back to free() as soon
+ *	as it is pfree()'d.  Otherwise we risk tying up a lot of memory in
+ *	freelist entries that might never be usable.  This is specially needed
+ *	when the caller is repeatedly repalloc()'ing a block bigger and bigger;
+ *	the previous instances of the block were guaranteed to be wasted until
+ *	AllocSetReset() under the old way.
+ *
+ *	Further improvement 12/00: as the code stood, request sizes in the
+ *	midrange between "small" and "large" were handled very inefficiently,
+ *	because any sufficiently large free chunk would be used to satisfy a
+ *	request, even if it was much larger than necessary.  This led to more
+ *	and more wasted space in allocated chunks over time.  To fix, get rid
+ *	of the midrange behavior: we now handle only "small" power-of-2-size
+ *	chunks as chunks.  Anything "large" is passed off to malloc().  Change
+ *	the number of freelists to change the small/large boundary.
+ *
+ *
+ *	About CLOBBER_FREED_MEMORY:
+ *
+ *	If this symbol is defined, all freed memory is overwritten with 0x7F's.
+ *	This is useful for catching places that reference already-freed memory.
+ *
+ *	About MEMORY_CONTEXT_CHECKING:
+ *
+ *	Since we usually round request sizes up to the next power of 2, there
+ *	is often some unused space immediately after a requested data area.
+ *	Thus, if someone makes the common error of writing past what they've
+ *	requested, the problem is likely to go unnoticed ... until the day when
+ *	there *isn't* any wasted space, perhaps because of different memory
+ *	alignment on a new platform, or some other effect.  To catch this sort
+ *	of problem, the MEMORY_CONTEXT_CHECKING option stores 0x7E just beyond
+ *	the requested space whenever the request is less than the actual chunk
+ *	size, and verifies that the byte is undamaged when the chunk is freed.
+ *
+ *
+ *	About USE_VALGRIND and Valgrind client requests:
+ *
+ *	Valgrind provides "client request" macros that exchange information with
+ *	the host Valgrind (if any).  Under !USE_VALGRIND, memdebug.h stubs out
+ *	currently-used macros.
+ *
+ *	When running under Valgrind, we want a NOACCESS memory region both before
+ *	and after the allocation.  The chunk header is tempting as the preceding
+ *	region, but mcxt.c expects to able to examine the standard chunk header
+ *	fields.  Therefore, we use, when available, the requested_size field and
+ *	any subsequent padding.  requested_size is made NOACCESS before returning
+ *	a chunk pointer to a caller.  However, to reduce client request traffic,
+ *	it is kept DEFINED in chunks on the free list.
+ *
+ *	The rounded-up capacity of the chunk usually acts as a post-allocation
+ *	NOACCESS region.  If the request consumes precisely the entire chunk,
+ *	there is no such region; another chunk header may immediately follow.  In
+ *	that case, Valgrind will not detect access beyond the end of the chunk.
+ *
+ *	See also the cooperating Valgrind client requests in mcxt.c.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+
+#include "utils/memdebug.h"
+#include "utils/memutils.h"
+
+/* Define this to detail debug alloc information */
+/* #define HAVE_ALLOCINFO */
+
+/*--------------------
+ * Chunk freelist k holds chunks of size 1 << (k + ALLOC_MINBITS),
+ * for k = 0 .. ALLOCSET_NUM_FREELISTS-1.
+ *
+ * Note that all chunks in the freelists have power-of-2 sizes.  This
+ * improves recyclability: we may waste some space, but the wasted space
+ * should stay pretty constant as requests are made and released.
+ *
+ * A request too large for the last freelist is handled by allocating a
+ * dedicated block from malloc().  The block still has a block header and
+ * chunk header, but when the chunk is freed we'll return the whole block
+ * to malloc(), not put it on our freelists.
+ *
+ * CAUTION: ALLOC_MINBITS must be large enough so that
+ * 1<<ALLOC_MINBITS is at least MAXALIGN,
+ * or we may fail to align the smallest chunks adequately.
+ * 8-byte alignment is enough on all currently known machines.
+ *
+ * With the current parameters, request sizes up to 8K are treated as chunks,
+ * larger requests go into dedicated blocks.  Change ALLOCSET_NUM_FREELISTS
+ * to adjust the boundary point; and adjust ALLOCSET_SEPARATE_THRESHOLD in
+ * memutils.h to agree.  (Note: in contexts with small maxBlockSize, we may
+ * set the allocChunkLimit to less than 8K, so as to avoid space wastage.)
+ *--------------------
+ */
+
+#define ALLOC_MINBITS		3	/* smallest chunk size is 8 bytes */
+#define ALLOCSET_NUM_FREELISTS	11
+#define ALLOC_CHUNK_LIMIT	(1 << (ALLOCSET_NUM_FREELISTS-1+ALLOC_MINBITS))
+/* Size of largest chunk that we use a fixed size for */
+#define ALLOC_CHUNK_FRACTION	4
+/* We allow chunks to be at most 1/4 of maxBlockSize (less overhead) */
+
+/*--------------------
+ * The first block allocated for an allocset has size initBlockSize.
+ * Each time we have to allocate another block, we double the block size
+ * (if possible, and without exceeding maxBlockSize), so as to reduce
+ * the bookkeeping load on malloc().
+ *
+ * Blocks allocated to hold oversize chunks do not follow this rule, however;
+ * they are just however big they need to be to hold that single chunk.
+ *--------------------
+ */
+
+#define ALLOC_BLOCKHDRSZ	MAXALIGN(sizeof(AllocBlockData))
+#define ALLOC_CHUNKHDRSZ	MAXALIGN(sizeof(AllocChunkData))
+
+/* Portion of ALLOC_CHUNKHDRSZ examined outside aset.c. */
+#define ALLOC_CHUNK_PUBLIC	\
+	(offsetof(AllocChunkData, size) + sizeof(Size))
+
+/* Portion of ALLOC_CHUNKHDRSZ excluding trailing padding. */
+#ifdef MEMORY_CONTEXT_CHECKING
+#define ALLOC_CHUNK_USED	\
+	(offsetof(AllocChunkData, requested_size) + sizeof(Size))
+#else
+#define ALLOC_CHUNK_USED	\
+	(offsetof(AllocChunkData, size) + sizeof(Size))
+#endif
+
+typedef struct AllocBlockData *AllocBlock;		/* forward reference */
+typedef struct AllocChunkData *AllocChunk;
+
+/*
+ * AllocPointer
+ *		Aligned pointer which may be a member of an allocation set.
+ */
+typedef void *AllocPointer;
+
+/*
+ * AllocSetContext is our standard implementation of MemoryContext.
+ *
+ * Note: header.isReset means there is nothing for AllocSetReset to do.
+ * This is different from the aset being physically empty (empty blocks list)
+ * because we may still have a keeper block.  It's also different from the set
+ * being logically empty, because we don't attempt to detect pfree'ing the
+ * last active chunk.
+ */
+typedef struct AllocSetContext
+{
+	MemoryContextData header;	/* Standard memory-context fields */
+	/* Info about storage allocated in this context: */
+	AllocBlock	blocks;			/* head of list of blocks in this set */
+	AllocChunk	freelist[ALLOCSET_NUM_FREELISTS];		/* free chunk lists */
+	/* Allocation parameters for this context: */
+	Size		initBlockSize;	/* initial block size */
+	Size		maxBlockSize;	/* maximum block size */
+	Size		nextBlockSize;	/* next block size to allocate */
+	Size		allocChunkLimit;	/* effective chunk size limit */
+	AllocBlock	keeper;			/* if not NULL, keep this block over resets */
+} AllocSetContext;
+
+typedef AllocSetContext *AllocSet;
+
+/*
+ * AllocBlock
+ *		An AllocBlock is the unit of memory that is obtained by aset.c
+ *		from malloc().  It contains one or more AllocChunks, which are
+ *		the units requested by palloc() and freed by pfree().  AllocChunks
+ *		cannot be returned to malloc() individually, instead they are put
+ *		on freelists by pfree() and re-used by the next palloc() that has
+ *		a matching request size.
+ *
+ *		AllocBlockData is the header data for a block --- the usable space
+ *		within the block begins at the next alignment boundary.
+ */
+typedef struct AllocBlockData
+{
+	AllocSet	aset;			/* aset that owns this block */
+	AllocBlock	next;			/* next block in aset's blocks list */
+	char	   *freeptr;		/* start of free space in this block */
+	char	   *endptr;			/* end of space in this block */
+}	AllocBlockData;
+
+/*
+ * AllocChunk
+ *		The prefix of each piece of memory in an AllocBlock
+ *
+ * NB: this MUST match StandardChunkHeader as defined by utils/memutils.h.
+ */
+typedef struct AllocChunkData
+{
+	/* aset is the owning aset if allocated, or the freelist link if free */
+	void	   *aset;
+	/* size is always the size of the usable space in the chunk */
+	Size		size;
+#ifdef MEMORY_CONTEXT_CHECKING
+	/* when debugging memory usage, also store actual requested size */
+	/* this is zero in a free chunk */
+	Size		requested_size;
+#endif
+}	AllocChunkData;
+
+/*
+ * AllocPointerIsValid
+ *		True iff pointer is valid allocation pointer.
+ */
+#define AllocPointerIsValid(pointer) PointerIsValid(pointer)
+
+/*
+ * AllocSetIsValid
+ *		True iff set is valid allocation set.
+ */
+#define AllocSetIsValid(set) PointerIsValid(set)
+
+#define AllocPointerGetChunk(ptr)	\
+					((AllocChunk)(((char *)(ptr)) - ALLOC_CHUNKHDRSZ))
+#define AllocChunkGetPointer(chk)	\
+					((AllocPointer)(((char *)(chk)) + ALLOC_CHUNKHDRSZ))
+
+/*
+ * These functions implement the MemoryContext API for AllocSet contexts.
+ */
+static void *AllocSetAlloc(MemoryContext context, Size size);
+static void AllocSetFree(MemoryContext context, void *pointer);
+static void *AllocSetRealloc(MemoryContext context, void *pointer, Size size);
+static void AllocSetInit(MemoryContext context);
+static void AllocSetReset(MemoryContext context);
+static void AllocSetDelete(MemoryContext context);
+static Size AllocSetGetChunkSpace(MemoryContext context, void *pointer);
+static bool AllocSetIsEmpty(MemoryContext context);
+static void AllocSetStats(MemoryContext context, int level);
+
+#ifdef MEMORY_CONTEXT_CHECKING
+static void AllocSetCheck(MemoryContext context);
+#endif
+
+/*
+ * This is the virtual function table for AllocSet contexts.
+ */
+static MemoryContextMethods AllocSetMethods = {
+	AllocSetAlloc,
+	AllocSetFree,
+	AllocSetRealloc,
+	AllocSetInit,
+	AllocSetReset,
+	AllocSetDelete,
+	AllocSetGetChunkSpace,
+	AllocSetIsEmpty,
+	AllocSetStats
+#ifdef MEMORY_CONTEXT_CHECKING
+	,AllocSetCheck
+#endif
+};
+
+/*
+ * Table for AllocSetFreeIndex
+ */
+#define LT16(n) n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n
+
+static const unsigned char LogTable256[256] =
+{
+	0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
+	LT16(5), LT16(6), LT16(6), LT16(7), LT16(7), LT16(7), LT16(7),
+	LT16(8), LT16(8), LT16(8), LT16(8), LT16(8), LT16(8), LT16(8), LT16(8)
+};
+
+/* ----------
+ * Debug macros
+ * ----------
+ */
+#ifdef HAVE_ALLOCINFO
+#define AllocFreeInfo(_cxt, _chunk) \
+			fprintf(stderr, "AllocFree: %s: %p, %d\n", \
+				(_cxt)->header.name, (_chunk), (_chunk)->size)
+#define AllocAllocInfo(_cxt, _chunk) \
+			fprintf(stderr, "AllocAlloc: %s: %p, %d\n", \
+				(_cxt)->header.name, (_chunk), (_chunk)->size)
+#else
+#define AllocFreeInfo(_cxt, _chunk)
+#define AllocAllocInfo(_cxt, _chunk)
+#endif
+
+/* ----------
+ * AllocSetFreeIndex -
+ *
+ *		Depending on the size of an allocation compute which freechunk
+ *		list of the alloc set it belongs to.  Caller must have verified
+ *		that size <= ALLOC_CHUNK_LIMIT.
+ * ----------
+ */
+static inline int
+AllocSetFreeIndex(Size size)
+{
+	int			idx;
+	unsigned int t,
+				tsize;
+
+	if (size > (1 << ALLOC_MINBITS))
+	{
+		tsize = (size - 1) >> ALLOC_MINBITS;
+
+		/*
+		 * At this point we need to obtain log2(tsize)+1, ie, the number of
+		 * not-all-zero bits at the right.  We used to do this with a
+		 * shift-and-count loop, but this function is enough of a hotspot to
+		 * justify micro-optimization effort.  The best approach seems to be
+		 * to use a lookup table.  Note that this code assumes that
+		 * ALLOCSET_NUM_FREELISTS <= 17, since we only cope with two bytes of
+		 * the tsize value.
+		 */
+		t = tsize >> 8;
+		idx = t ? LogTable256[t] + 8 : LogTable256[tsize];
+
+		Assert(idx < ALLOCSET_NUM_FREELISTS);
+	}
+	else
+		idx = 0;
+
+	return idx;
+}
+
+#ifdef CLOBBER_FREED_MEMORY
+
+/* Wipe freed memory for debugging purposes */
+static void
+wipe_mem(void *ptr, size_t size)
+{
+	VALGRIND_MAKE_MEM_UNDEFINED(ptr, size);
+	memset(ptr, 0x7F, size);
+	VALGRIND_MAKE_MEM_NOACCESS(ptr, size);
+}
+#endif
+
+#ifdef MEMORY_CONTEXT_CHECKING
+static void
+set_sentinel(void *base, Size offset)
+{
+	char	   *ptr = (char *) base + offset;
+
+	VALGRIND_MAKE_MEM_UNDEFINED(ptr, 1);
+	*ptr = 0x7E;
+	VALGRIND_MAKE_MEM_NOACCESS(ptr, 1);
+}
+
+static bool
+sentinel_ok(const void *base, Size offset)
+{
+	const char *ptr = (const char *) base + offset;
+	bool		ret;
+
+	VALGRIND_MAKE_MEM_DEFINED(ptr, 1);
+	ret = *ptr == 0x7E;
+	VALGRIND_MAKE_MEM_NOACCESS(ptr, 1);
+
+	return ret;
+}
+#endif
+
+#ifdef RANDOMIZE_ALLOCATED_MEMORY
+
+/*
+ * Fill a just-allocated piece of memory with "random" data.  It's not really
+ * very random, just a repeating sequence with a length that's prime.  What
+ * we mainly want out of it is to have a good probability that two palloc's
+ * of the same number of bytes start out containing different data.
+ *
+ * The region may be NOACCESS, so make it UNDEFINED first to avoid errors as
+ * we fill it.  Filling the region makes it DEFINED, so make it UNDEFINED
+ * again afterward.  Whether to finally make it UNDEFINED or NOACCESS is
+ * fairly arbitrary.  UNDEFINED is more convenient for AllocSetRealloc(), and
+ * other callers have no preference.
+ */
+static void
+randomize_mem(char *ptr, size_t size)
+{
+	static int	save_ctr = 1;
+	size_t		remaining = size;
+	int			ctr;
+
+	ctr = save_ctr;
+	VALGRIND_MAKE_MEM_UNDEFINED(ptr, size);
+	while (remaining-- > 0)
+	{
+		*ptr++ = ctr;
+		if (++ctr > 251)
+			ctr = 1;
+	}
+	VALGRIND_MAKE_MEM_UNDEFINED(ptr - size, size);
+	save_ctr = ctr;
+}
+#endif   /* RANDOMIZE_ALLOCATED_MEMORY */
+
+
+/*
+ * Public routines
+ */
+
+
+/*
+ * AllocSetContextCreate
+ *		Create a new AllocSet context.
+ *
+ * parent: parent context, or NULL if top-level context
+ * name: name of context (for debugging --- string will be copied)
+ * minContextSize: minimum context size
+ * initBlockSize: initial allocation block size
+ * maxBlockSize: maximum allocation block size
+ */
+MemoryContext
+AllocSetContextCreate(MemoryContext parent,
+					  const char *name,
+					  Size minContextSize,
+					  Size initBlockSize,
+					  Size maxBlockSize)
+{
+	AllocSet	set;
+
+	/* Do the type-independent part of context creation */
+	set = (AllocSet) MemoryContextCreate(T_AllocSetContext,
+										 sizeof(AllocSetContext),
+										 &AllocSetMethods,
+										 parent,
+										 name);
+
+	/*
+	 * Make sure alloc parameters are reasonable, and save them.
+	 *
+	 * We somewhat arbitrarily enforce a minimum 1K block size.
+	 */
+	initBlockSize = MAXALIGN(initBlockSize);
+	if (initBlockSize < 1024)
+		initBlockSize = 1024;
+	maxBlockSize = MAXALIGN(maxBlockSize);
+	if (maxBlockSize < initBlockSize)
+		maxBlockSize = initBlockSize;
+	Assert(AllocHugeSizeIsValid(maxBlockSize)); /* must be safe to double */
+	set->initBlockSize = initBlockSize;
+	set->maxBlockSize = maxBlockSize;
+	set->nextBlockSize = initBlockSize;
+
+	/*
+	 * Compute the allocation chunk size limit for this context.  It can't be
+	 * more than ALLOC_CHUNK_LIMIT because of the fixed number of freelists.
+	 * If maxBlockSize is small then requests exceeding the maxBlockSize, or
+	 * even a significant fraction of it, should be treated as large chunks
+	 * too.  For the typical case of maxBlockSize a power of 2, the chunk size
+	 * limit will be at most 1/8th maxBlockSize, so that given a stream of
+	 * requests that are all the maximum chunk size we will waste at most
+	 * 1/8th of the allocated space.
+	 *
+	 * We have to have allocChunkLimit a power of two, because the requested
+	 * and actually-allocated sizes of any chunk must be on the same side of
+	 * the limit, else we get confused about whether the chunk is "big".
+	 *
+	 * Also, allocChunkLimit must not exceed ALLOCSET_SEPARATE_THRESHOLD.
+	 */
+	StaticAssertStmt(ALLOC_CHUNK_LIMIT == ALLOCSET_SEPARATE_THRESHOLD,
+					 "ALLOC_CHUNK_LIMIT != ALLOCSET_SEPARATE_THRESHOLD");
+
+	set->allocChunkLimit = ALLOC_CHUNK_LIMIT;
+	while ((Size) (set->allocChunkLimit + ALLOC_CHUNKHDRSZ) >
+		   (Size) ((maxBlockSize - ALLOC_BLOCKHDRSZ) / ALLOC_CHUNK_FRACTION))
+		set->allocChunkLimit >>= 1;
+
+	/*
+	 * Grab always-allocated space, if requested
+	 */
+	if (minContextSize > ALLOC_BLOCKHDRSZ + ALLOC_CHUNKHDRSZ)
+	{
+		Size		blksize = MAXALIGN(minContextSize);
+		AllocBlock	block;
+
+		block = (AllocBlock) malloc(blksize);
+		if (block == NULL)
+		{
+			MemoryContextStats(TopMemoryContext);
+			ereport(ERROR,
+					(errcode(ERRCODE_OUT_OF_MEMORY),
+					 errmsg("out of memory"),
+					 errdetail("Failed while creating memory context \"%s\".",
+							   name)));
+		}
+		block->aset = set;
+		block->freeptr = ((char *) block) + ALLOC_BLOCKHDRSZ;
+		block->endptr = ((char *) block) + blksize;
+		block->next = set->blocks;
+		set->blocks = block;
+		/* Mark block as not to be released at reset time */
+		set->keeper = block;
+
+		/* Mark unallocated space NOACCESS; leave the block header alone. */
+		VALGRIND_MAKE_MEM_NOACCESS(block->freeptr,
+								   blksize - ALLOC_BLOCKHDRSZ);
+	}
+
+	return (MemoryContext) set;
+}
+
+/*
+ * AllocSetInit
+ *		Context-type-specific initialization routine.
+ *
+ * This is called by MemoryContextCreate() after setting up the
+ * generic MemoryContext fields and before linking the new context
+ * into the context tree.  We must do whatever is needed to make the
+ * new context minimally valid for deletion.  We must *not* risk
+ * failure --- thus, for example, allocating more memory is not cool.
+ * (AllocSetContextCreate can allocate memory when it gets control
+ * back, however.)
+ */
+static void
+AllocSetInit(MemoryContext context)
+{
+	/*
+	 * Since MemoryContextCreate already zeroed the context node, we don't
+	 * have to do anything here: it's already OK.
+	 */
+}
+
+/*
+ * AllocSetReset
+ *		Frees all memory which is allocated in the given set.
+ *
+ * Actually, this routine has some discretion about what to do.
+ * It should mark all allocated chunks freed, but it need not necessarily
+ * give back all the resources the set owns.  Our actual implementation is
+ * that we hang onto any "keeper" block specified for the set.  In this way,
+ * we don't thrash malloc() when a context is repeatedly reset after small
+ * allocations, which is typical behavior for per-tuple contexts.
+ */
+static void
+AllocSetReset(MemoryContext context)
+{
+	AllocSet	set = (AllocSet) context;
+	AllocBlock	block;
+
+	AssertArg(AllocSetIsValid(set));
+
+#ifdef MEMORY_CONTEXT_CHECKING
+	/* Check for corruption and leaks before freeing */
+	AllocSetCheck(context);
+#endif
+
+	/* Clear chunk freelists */
+	MemSetAligned(set->freelist, 0, sizeof(set->freelist));
+
+	block = set->blocks;
+
+	/* New blocks list is either empty or just the keeper block */
+	set->blocks = set->keeper;
+
+	while (block != NULL)
+	{
+		AllocBlock	next = block->next;
+
+		if (block == set->keeper)
+		{
+			/* Reset the block, but don't return it to malloc */
+			char	   *datastart = ((char *) block) + ALLOC_BLOCKHDRSZ;
+
+#ifdef CLOBBER_FREED_MEMORY
+			wipe_mem(datastart, block->freeptr - datastart);
+#else
+			/* wipe_mem() would have done this */
+			VALGRIND_MAKE_MEM_NOACCESS(datastart, block->freeptr - datastart);
+#endif
+			block->freeptr = datastart;
+			block->next = NULL;
+		}
+		else
+		{
+			/* Normal case, release the block */
+#ifdef CLOBBER_FREED_MEMORY
+			wipe_mem(block, block->freeptr - ((char *) block));
+#endif
+			free(block);
+		}
+		block = next;
+	}
+
+	/* Reset block size allocation sequence, too */
+	set->nextBlockSize = set->initBlockSize;
+}
+
+/*
+ * AllocSetDelete
+ *		Frees all memory which is allocated in the given set,
+ *		in preparation for deletion of the set.
+ *
+ * Unlike AllocSetReset, this *must* free all resources of the set.
+ * But note we are not responsible for deleting the context node itself.
+ */
+static void
+AllocSetDelete(MemoryContext context)
+{
+	AllocSet	set = (AllocSet) context;
+	AllocBlock	block = set->blocks;
+
+	AssertArg(AllocSetIsValid(set));
+
+#ifdef MEMORY_CONTEXT_CHECKING
+	/* Check for corruption and leaks before freeing */
+	AllocSetCheck(context);
+#endif
+
+	/* Make it look empty, just in case... */
+	MemSetAligned(set->freelist, 0, sizeof(set->freelist));
+	set->blocks = NULL;
+	set->keeper = NULL;
+
+	while (block != NULL)
+	{
+		AllocBlock	next = block->next;
+
+#ifdef CLOBBER_FREED_MEMORY
+		wipe_mem(block, block->freeptr - ((char *) block));
+#endif
+		free(block);
+		block = next;
+	}
+}
+
+/*
+ * AllocSetAlloc
+ *		Returns pointer to allocated memory of given size or NULL if
+ *		request could not be completed; memory is added to the set.
+ *
+ * No request may exceed:
+ *		MAXALIGN_DOWN(SIZE_MAX) - ALLOC_BLOCKHDRSZ - ALLOC_CHUNKHDRSZ
+ * All callers use a much-lower limit.
+ */
+static void *
+AllocSetAlloc(MemoryContext context, Size size)
+{
+	AllocSet	set = (AllocSet) context;
+	AllocBlock	block;
+	AllocChunk	chunk;
+	int			fidx;
+	Size		chunk_size;
+	Size		blksize;
+
+	AssertArg(AllocSetIsValid(set));
+
+	/*
+	 * If requested size exceeds maximum for chunks, allocate an entire block
+	 * for this request.
+	 */
+	if (size > set->allocChunkLimit)
+	{
+		chunk_size = MAXALIGN(size);
+		blksize = chunk_size + ALLOC_BLOCKHDRSZ + ALLOC_CHUNKHDRSZ;
+		block = (AllocBlock) malloc(blksize);
+		if (block == NULL)
+			return NULL;
+		block->aset = set;
+		block->freeptr = block->endptr = ((char *) block) + blksize;
+
+		chunk = (AllocChunk) (((char *) block) + ALLOC_BLOCKHDRSZ);
+		chunk->aset = set;
+		chunk->size = chunk_size;
+#ifdef MEMORY_CONTEXT_CHECKING
+		/* Valgrind: Will be made NOACCESS below. */
+		chunk->requested_size = size;
+		/* set mark to catch clobber of "unused" space */
+		if (size < chunk_size)
+			set_sentinel(AllocChunkGetPointer(chunk), size);
+#endif
+#ifdef RANDOMIZE_ALLOCATED_MEMORY
+		/* fill the allocated space with junk */
+		randomize_mem((char *) AllocChunkGetPointer(chunk), size);
+#endif
+
+		/*
+		 * Stick the new block underneath the active allocation block, so that
+		 * we don't lose the use of the space remaining therein.
+		 */
+		if (set->blocks != NULL)
+		{
+			block->next = set->blocks->next;
+			set->blocks->next = block;
+		}
+		else
+		{
+			block->next = NULL;
+			set->blocks = block;
+		}
+
+		AllocAllocInfo(set, chunk);
+
+		/*
+		 * Chunk header public fields remain DEFINED.  The requested
+		 * allocation itself can be NOACCESS or UNDEFINED; our caller will
+		 * soon make it UNDEFINED.  Make extra space at the end of the chunk,
+		 * if any, NOACCESS.
+		 */
+		VALGRIND_MAKE_MEM_NOACCESS((char *) chunk + ALLOC_CHUNK_PUBLIC,
+						 chunk_size + ALLOC_CHUNKHDRSZ - ALLOC_CHUNK_PUBLIC);
+
+		return AllocChunkGetPointer(chunk);
+	}
+
+	/*
+	 * Request is small enough to be treated as a chunk.  Look in the
+	 * corresponding free list to see if there is a free chunk we could reuse.
+	 * If one is found, remove it from the free list, make it again a member
+	 * of the alloc set and return its data address.
+	 */
+	fidx = AllocSetFreeIndex(size);
+	chunk = set->freelist[fidx];
+	if (chunk != NULL)
+	{
+		Assert(chunk->size >= size);
+
+		set->freelist[fidx] = (AllocChunk) chunk->aset;
+
+		chunk->aset = (void *) set;
+
+#ifdef MEMORY_CONTEXT_CHECKING
+		/* Valgrind: Free list requested_size should be DEFINED. */
+		chunk->requested_size = size;
+		VALGRIND_MAKE_MEM_NOACCESS(&chunk->requested_size,
+								   sizeof(chunk->requested_size));
+		/* set mark to catch clobber of "unused" space */
+		if (size < chunk->size)
+			set_sentinel(AllocChunkGetPointer(chunk), size);
+#endif
+#ifdef RANDOMIZE_ALLOCATED_MEMORY
+		/* fill the allocated space with junk */
+		randomize_mem((char *) AllocChunkGetPointer(chunk), size);
+#endif
+
+		AllocAllocInfo(set, chunk);
+		return AllocChunkGetPointer(chunk);
+	}
+
+	/*
+	 * Choose the actual chunk size to allocate.
+	 */
+	chunk_size = (1 << ALLOC_MINBITS) << fidx;
+	Assert(chunk_size >= size);
+
+	/*
+	 * If there is enough room in the active allocation block, we will put the
+	 * chunk into that block.  Else must start a new one.
+	 */
+	if ((block = set->blocks) != NULL)
+	{
+		Size		availspace = block->endptr - block->freeptr;
+
+		if (availspace < (chunk_size + ALLOC_CHUNKHDRSZ))
+		{
+			/*
+			 * The existing active (top) block does not have enough room for
+			 * the requested allocation, but it might still have a useful
+			 * amount of space in it.  Once we push it down in the block list,
+			 * we'll never try to allocate more space from it. So, before we
+			 * do that, carve up its free space into chunks that we can put on
+			 * the set's freelists.
+			 *
+			 * Because we can only get here when there's less than
+			 * ALLOC_CHUNK_LIMIT left in the block, this loop cannot iterate
+			 * more than ALLOCSET_NUM_FREELISTS-1 times.
+			 */
+			while (availspace >= ((1 << ALLOC_MINBITS) + ALLOC_CHUNKHDRSZ))
+			{
+				Size		availchunk = availspace - ALLOC_CHUNKHDRSZ;
+				int			a_fidx = AllocSetFreeIndex(availchunk);
+
+				/*
+				 * In most cases, we'll get back the index of the next larger
+				 * freelist than the one we need to put this chunk on.  The
+				 * exception is when availchunk is exactly a power of 2.
+				 */
+				if (availchunk != ((Size) 1 << (a_fidx + ALLOC_MINBITS)))
+				{
+					a_fidx--;
+					Assert(a_fidx >= 0);
+					availchunk = ((Size) 1 << (a_fidx + ALLOC_MINBITS));
+				}
+
+				chunk = (AllocChunk) (block->freeptr);
+
+				/* Prepare to initialize the chunk header. */
+				VALGRIND_MAKE_MEM_UNDEFINED(chunk, ALLOC_CHUNK_USED);
+
+				block->freeptr += (availchunk + ALLOC_CHUNKHDRSZ);
+				availspace -= (availchunk + ALLOC_CHUNKHDRSZ);
+
+				chunk->size = availchunk;
+#ifdef MEMORY_CONTEXT_CHECKING
+				chunk->requested_size = 0;		/* mark it free */
+#endif
+				chunk->aset = (void *) set->freelist[a_fidx];
+				set->freelist[a_fidx] = chunk;
+			}
+
+			/* Mark that we need to create a new block */
+			block = NULL;
+		}
+	}
+
+	/*
+	 * Time to create a new regular (multi-chunk) block?
+	 */
+	if (block == NULL)
+	{
+		Size		required_size;
+
+		/*
+		 * The first such block has size initBlockSize, and we double the
+		 * space in each succeeding block, but not more than maxBlockSize.
+		 */
+		blksize = set->nextBlockSize;
+		set->nextBlockSize <<= 1;
+		if (set->nextBlockSize > set->maxBlockSize)
+			set->nextBlockSize = set->maxBlockSize;
+
+		/*
+		 * If initBlockSize is less than ALLOC_CHUNK_LIMIT, we could need more
+		 * space... but try to keep it a power of 2.
+		 */
+		required_size = chunk_size + ALLOC_BLOCKHDRSZ + ALLOC_CHUNKHDRSZ;
+		while (blksize < required_size)
+			blksize <<= 1;
+
+		/* Try to allocate it */
+		block = (AllocBlock) malloc(blksize);
+
+		/*
+		 * We could be asking for pretty big blocks here, so cope if malloc
+		 * fails.  But give up if there's less than a meg or so available...
+		 */
+		while (block == NULL && blksize > 1024 * 1024)
+		{
+			blksize >>= 1;
+			if (blksize < required_size)
+				break;
+			block = (AllocBlock) malloc(blksize);
+		}
+
+		if (block == NULL)
+			return NULL;
+
+		block->aset = set;
+		block->freeptr = ((char *) block) + ALLOC_BLOCKHDRSZ;
+		block->endptr = ((char *) block) + blksize;
+
+		/*
+		 * If this is the first block of the set, make it the "keeper" block.
+		 * Formerly, a keeper block could only be created during context
+		 * creation, but allowing it to happen here lets us have fast reset
+		 * cycling even for contexts created with minContextSize = 0; that way
+		 * we don't have to force space to be allocated in contexts that might
+		 * never need any space.  Don't mark an oversize block as a keeper,
+		 * however.
+		 */
+		if (set->keeper == NULL && blksize == set->initBlockSize)
+			set->keeper = block;
+
+		/* Mark unallocated space NOACCESS. */
+		VALGRIND_MAKE_MEM_NOACCESS(block->freeptr,
+								   blksize - ALLOC_BLOCKHDRSZ);
+
+		block->next = set->blocks;
+		set->blocks = block;
+	}
+
+	/*
+	 * OK, do the allocation
+	 */
+	chunk = (AllocChunk) (block->freeptr);
+
+	/* Prepare to initialize the chunk header. */
+	VALGRIND_MAKE_MEM_UNDEFINED(chunk, ALLOC_CHUNK_USED);
+
+	block->freeptr += (chunk_size + ALLOC_CHUNKHDRSZ);
+	Assert(block->freeptr <= block->endptr);
+
+	chunk->aset = (void *) set;
+	chunk->size = chunk_size;
+#ifdef MEMORY_CONTEXT_CHECKING
+	chunk->requested_size = size;
+	VALGRIND_MAKE_MEM_NOACCESS(&chunk->requested_size,
+							   sizeof(chunk->requested_size));
+	/* set mark to catch clobber of "unused" space */
+	if (size < chunk->size)
+		set_sentinel(AllocChunkGetPointer(chunk), size);
+#endif
+#ifdef RANDOMIZE_ALLOCATED_MEMORY
+	/* fill the allocated space with junk */
+	randomize_mem((char *) AllocChunkGetPointer(chunk), size);
+#endif
+
+	AllocAllocInfo(set, chunk);
+	return AllocChunkGetPointer(chunk);
+}
+
+/*
+ * AllocSetFree
+ *		Frees allocated memory; memory is removed from the set.
+ */
+static void
+AllocSetFree(MemoryContext context, void *pointer)
+{
+	AllocSet	set = (AllocSet) context;
+	AllocChunk	chunk = AllocPointerGetChunk(pointer);
+
+	AllocFreeInfo(set, chunk);
+
+#ifdef MEMORY_CONTEXT_CHECKING
+	VALGRIND_MAKE_MEM_DEFINED(&chunk->requested_size,
+							  sizeof(chunk->requested_size));
+	/* Test for someone scribbling on unused space in chunk */
+	if (chunk->requested_size < chunk->size)
+		if (!sentinel_ok(pointer, chunk->requested_size))
+			elog(WARNING, "detected write past chunk end in %s %p",
+				 set->header.name, chunk);
+#endif
+
+	if (chunk->size > set->allocChunkLimit)
+	{
+		/*
+		 * Big chunks are certain to have been allocated as single-chunk
+		 * blocks.  Find the containing block and return it to malloc().
+		 */
+		AllocBlock	block = set->blocks;
+		AllocBlock	prevblock = NULL;
+
+		while (block != NULL)
+		{
+			if (chunk == (AllocChunk) (((char *) block) + ALLOC_BLOCKHDRSZ))
+				break;
+			prevblock = block;
+			block = block->next;
+		}
+		if (block == NULL)
+			elog(ERROR, "could not find block containing chunk %p", chunk);
+		/* let's just make sure chunk is the only one in the block */
+		Assert(block->freeptr == ((char *) block) +
+			   (chunk->size + ALLOC_BLOCKHDRSZ + ALLOC_CHUNKHDRSZ));
+
+		/* OK, remove block from aset's list and free it */
+		if (prevblock == NULL)
+			set->blocks = block->next;
+		else
+			prevblock->next = block->next;
+#ifdef CLOBBER_FREED_MEMORY
+		wipe_mem(block, block->freeptr - ((char *) block));
+#endif
+		free(block);
+	}
+	else
+	{
+		/* Normal case, put the chunk into appropriate freelist */
+		int			fidx = AllocSetFreeIndex(chunk->size);
+
+		chunk->aset = (void *) set->freelist[fidx];
+
+#ifdef CLOBBER_FREED_MEMORY
+		wipe_mem(pointer, chunk->size);
+#endif
+
+#ifdef MEMORY_CONTEXT_CHECKING
+		/* Reset requested_size to 0 in chunks that are on freelist */
+		chunk->requested_size = 0;
+#endif
+		set->freelist[fidx] = chunk;
+	}
+}
+
+/*
+ * AllocSetRealloc
+ *		Returns new pointer to allocated memory of given size or NULL if
+ *		request could not be completed; this memory is added to the set.
+ *		Memory associated with given pointer is copied into the new memory,
+ *		and the old memory is freed.
+ *
+ * Without MEMORY_CONTEXT_CHECKING, we don't know the old request size.  This
+ * makes our Valgrind client requests less-precise, hazarding false negatives.
+ * (In principle, we could use VALGRIND_GET_VBITS() to rediscover the old
+ * request size.)
+ */
+static void *
+AllocSetRealloc(MemoryContext context, void *pointer, Size size)
+{
+	AllocSet	set = (AllocSet) context;
+	AllocChunk	chunk = AllocPointerGetChunk(pointer);
+	Size		oldsize = chunk->size;
+
+#ifdef MEMORY_CONTEXT_CHECKING
+	VALGRIND_MAKE_MEM_DEFINED(&chunk->requested_size,
+							  sizeof(chunk->requested_size));
+	/* Test for someone scribbling on unused space in chunk */
+	if (chunk->requested_size < oldsize)
+		if (!sentinel_ok(pointer, chunk->requested_size))
+			elog(WARNING, "detected write past chunk end in %s %p",
+				 set->header.name, chunk);
+#endif
+
+	/*
+	 * Chunk sizes are aligned to power of 2 in AllocSetAlloc(). Maybe the
+	 * allocated area already is >= the new size.  (In particular, we always
+	 * fall out here if the requested size is a decrease.)
+	 */
+	if (oldsize >= size)
+	{
+#ifdef MEMORY_CONTEXT_CHECKING
+		Size		oldrequest = chunk->requested_size;
+
+#ifdef RANDOMIZE_ALLOCATED_MEMORY
+		/* We can only fill the extra space if we know the prior request */
+		if (size > oldrequest)
+			randomize_mem((char *) pointer + oldrequest,
+						  size - oldrequest);
+#endif
+
+		chunk->requested_size = size;
+		VALGRIND_MAKE_MEM_NOACCESS(&chunk->requested_size,
+								   sizeof(chunk->requested_size));
+
+		/*
+		 * If this is an increase, mark any newly-available part UNDEFINED.
+		 * Otherwise, mark the obsolete part NOACCESS.
+		 */
+		if (size > oldrequest)
+			VALGRIND_MAKE_MEM_UNDEFINED((char *) pointer + oldrequest,
+										size - oldrequest);
+		else
+			VALGRIND_MAKE_MEM_NOACCESS((char *) pointer + size,
+									   oldsize - size);
+
+		/* set mark to catch clobber of "unused" space */
+		if (size < oldsize)
+			set_sentinel(pointer, size);
+#else							/* !MEMORY_CONTEXT_CHECKING */
+
+		/*
+		 * We don't have the information to determine whether we're growing
+		 * the old request or shrinking it, so we conservatively mark the
+		 * entire new allocation DEFINED.
+		 */
+		VALGRIND_MAKE_MEM_NOACCESS(pointer, oldsize);
+		VALGRIND_MAKE_MEM_DEFINED(pointer, size);
+#endif
+
+		return pointer;
+	}
+
+	if (oldsize > set->allocChunkLimit)
+	{
+		/*
+		 * The chunk must have been allocated as a single-chunk block.  Find
+		 * the containing block and use realloc() to make it bigger with
+		 * minimum space wastage.
+		 */
+		AllocBlock	block = set->blocks;
+		AllocBlock	prevblock = NULL;
+		Size		chksize;
+		Size		blksize;
+
+		while (block != NULL)
+		{
+			if (chunk == (AllocChunk) (((char *) block) + ALLOC_BLOCKHDRSZ))
+				break;
+			prevblock = block;
+			block = block->next;
+		}
+		if (block == NULL)
+			elog(ERROR, "could not find block containing chunk %p", chunk);
+		/* let's just make sure chunk is the only one in the block */
+		Assert(block->freeptr == ((char *) block) +
+			   (chunk->size + ALLOC_BLOCKHDRSZ + ALLOC_CHUNKHDRSZ));
+
+		/* Do the realloc */
+		chksize = MAXALIGN(size);
+		blksize = chksize + ALLOC_BLOCKHDRSZ + ALLOC_CHUNKHDRSZ;
+		block = (AllocBlock) realloc(block, blksize);
+		if (block == NULL)
+			return NULL;
+		block->freeptr = block->endptr = ((char *) block) + blksize;
+
+		/* Update pointers since block has likely been moved */
+		chunk = (AllocChunk) (((char *) block) + ALLOC_BLOCKHDRSZ);
+		pointer = AllocChunkGetPointer(chunk);
+		if (prevblock == NULL)
+			set->blocks = block;
+		else
+			prevblock->next = block;
+		chunk->size = chksize;
+
+#ifdef MEMORY_CONTEXT_CHECKING
+#ifdef RANDOMIZE_ALLOCATED_MEMORY
+		/* We can only fill the extra space if we know the prior request */
+		randomize_mem((char *) pointer + chunk->requested_size,
+					  size - chunk->requested_size);
+#endif
+
+		/*
+		 * realloc() (or randomize_mem()) will have left the newly-allocated
+		 * part UNDEFINED, but we may need to adjust trailing bytes from the
+		 * old allocation.
+		 */
+		VALGRIND_MAKE_MEM_UNDEFINED((char *) pointer + chunk->requested_size,
+									oldsize - chunk->requested_size);
+
+		chunk->requested_size = size;
+		VALGRIND_MAKE_MEM_NOACCESS(&chunk->requested_size,
+								   sizeof(chunk->requested_size));
+
+		/* set mark to catch clobber of "unused" space */
+		if (size < chunk->size)
+			set_sentinel(AllocChunkGetPointer(chunk), size);
+#else							/* !MEMORY_CONTEXT_CHECKING */
+
+		/*
+		 * We don't know how much of the old chunk size was the actual
+		 * allocation; it could have been as small as one byte.  We have to be
+		 * conservative and just mark the entire old portion DEFINED.
+		 */
+		VALGRIND_MAKE_MEM_DEFINED(pointer, oldsize);
+#endif
+
+		/* Make any trailing alignment padding NOACCESS. */
+		VALGRIND_MAKE_MEM_NOACCESS((char *) pointer + size, chksize - size);
+		return AllocChunkGetPointer(chunk);
+	}
+	else
+	{
+		/*
+		 * Small-chunk case.  We just do this by brute force, ie, allocate a
+		 * new chunk and copy the data.  Since we know the existing data isn't
+		 * huge, this won't involve any great memcpy expense, so it's not
+		 * worth being smarter.  (At one time we tried to avoid memcpy when it
+		 * was possible to enlarge the chunk in-place, but that turns out to
+		 * misbehave unpleasantly for repeated cycles of
+		 * palloc/repalloc/pfree: the eventually freed chunks go into the
+		 * wrong freelist for the next initial palloc request, and so we leak
+		 * memory indefinitely.  See pgsql-hackers archives for 2007-08-11.)
+		 */
+		AllocPointer newPointer;
+
+		/* allocate new chunk */
+		newPointer = AllocSetAlloc((MemoryContext) set, size);
+
+		/* leave immediately if request was not completed */
+		if (newPointer == NULL)
+			return NULL;
+
+		/*
+		 * AllocSetAlloc() just made the region NOACCESS.  Change it to
+		 * UNDEFINED for the moment; memcpy() will then transfer definedness
+		 * from the old allocation to the new.  If we know the old allocation,
+		 * copy just that much.  Otherwise, make the entire old chunk defined
+		 * to avoid errors as we copy the currently-NOACCESS trailing bytes.
+		 */
+		VALGRIND_MAKE_MEM_UNDEFINED(newPointer, size);
+#ifdef MEMORY_CONTEXT_CHECKING
+		oldsize = chunk->requested_size;
+#else
+		VALGRIND_MAKE_MEM_DEFINED(pointer, oldsize);
+#endif
+
+		/* transfer existing data (certain to fit) */
+		memcpy(newPointer, pointer, oldsize);
+
+		/* free old chunk */
+		AllocSetFree((MemoryContext) set, pointer);
+
+		return newPointer;
+	}
+}
+
+/*
+ * AllocSetGetChunkSpace
+ *		Given a currently-allocated chunk, determine the total space
+ *		it occupies (including all memory-allocation overhead).
+ */
+static Size
+AllocSetGetChunkSpace(MemoryContext context, void *pointer)
+{
+	AllocChunk	chunk = AllocPointerGetChunk(pointer);
+
+	return chunk->size + ALLOC_CHUNKHDRSZ;
+}
+
+/*
+ * AllocSetIsEmpty
+ *		Is an allocset empty of any allocated space?
+ */
+static bool
+AllocSetIsEmpty(MemoryContext context)
+{
+	/*
+	 * For now, we say "empty" only if the context is new or just reset. We
+	 * could examine the freelists to determine if all space has been freed,
+	 * but it's not really worth the trouble for present uses of this
+	 * functionality.
+	 */
+	if (context->isReset)
+		return true;
+	return false;
+}
+
+/*
+ * AllocSetStats
+ *		Displays stats about memory consumption of an allocset.
+ */
+static void
+AllocSetStats(MemoryContext context, int level)
+{
+	AllocSet	set = (AllocSet) context;
+	Size		nblocks = 0;
+	Size		nchunks = 0;
+	Size		totalspace = 0;
+	Size		freespace = 0;
+	AllocBlock	block;
+	AllocChunk	chunk;
+	int			fidx;
+	int			i;
+
+	for (block = set->blocks; block != NULL; block = block->next)
+	{
+		nblocks++;
+		totalspace += block->endptr - ((char *) block);
+		freespace += block->endptr - block->freeptr;
+	}
+	for (fidx = 0; fidx < ALLOCSET_NUM_FREELISTS; fidx++)
+	{
+		for (chunk = set->freelist[fidx]; chunk != NULL;
+			 chunk = (AllocChunk) chunk->aset)
+		{
+			nchunks++;
+			freespace += chunk->size + ALLOC_CHUNKHDRSZ;
+		}
+	}
+
+	for (i = 0; i < level; i++)
+		fprintf(stderr, "  ");
+
+	fprintf(stderr,
+			"%s: %zu total in %zd blocks; %zu free (%zd chunks); %zu used\n",
+			set->header.name, totalspace, nblocks, freespace, nchunks,
+			totalspace - freespace);
+}
+
+
+#ifdef MEMORY_CONTEXT_CHECKING
+
+/*
+ * AllocSetCheck
+ *		Walk through chunks and check consistency of memory.
+ *
+ * NOTE: report errors as WARNING, *not* ERROR or FATAL.  Otherwise you'll
+ * find yourself in an infinite loop when trouble occurs, because this
+ * routine will be entered again when elog cleanup tries to release memory!
+ */
+static void
+AllocSetCheck(MemoryContext context)
+{
+	AllocSet	set = (AllocSet) context;
+	char	   *name = set->header.name;
+	AllocBlock	block;
+
+	for (block = set->blocks; block != NULL; block = block->next)
+	{
+		char	   *bpoz = ((char *) block) + ALLOC_BLOCKHDRSZ;
+		long		blk_used = block->freeptr - bpoz;
+		long		blk_data = 0;
+		long		nchunks = 0;
+
+		/*
+		 * Empty block - empty can be keeper-block only
+		 */
+		if (!blk_used)
+		{
+			if (set->keeper != block)
+				elog(WARNING, "problem in alloc set %s: empty block %p",
+					 name, block);
+		}
+
+		/*
+		 * Chunk walker
+		 */
+		while (bpoz < block->freeptr)
+		{
+			AllocChunk	chunk = (AllocChunk) bpoz;
+			Size		chsize,
+						dsize;
+
+			chsize = chunk->size;		/* aligned chunk size */
+			VALGRIND_MAKE_MEM_DEFINED(&chunk->requested_size,
+									  sizeof(chunk->requested_size));
+			dsize = chunk->requested_size;		/* real data */
+			if (dsize > 0)		/* not on a free list */
+				VALGRIND_MAKE_MEM_NOACCESS(&chunk->requested_size,
+										   sizeof(chunk->requested_size));
+
+			/*
+			 * Check chunk size
+			 */
+			if (dsize > chsize)
+				elog(WARNING, "problem in alloc set %s: req size > alloc size for chunk %p in block %p",
+					 name, chunk, block);
+			if (chsize < (1 << ALLOC_MINBITS))
+				elog(WARNING, "problem in alloc set %s: bad size %zu for chunk %p in block %p",
+					 name, chsize, chunk, block);
+
+			/* single-chunk block? */
+			if (chsize > set->allocChunkLimit &&
+				chsize + ALLOC_CHUNKHDRSZ != blk_used)
+				elog(WARNING, "problem in alloc set %s: bad single-chunk %p in block %p",
+					 name, chunk, block);
+
+			/*
+			 * If chunk is allocated, check for correct aset pointer. (If it's
+			 * free, the aset is the freelist pointer, which we can't check as
+			 * easily...)
+			 */
+			if (dsize > 0 && chunk->aset != (void *) set)
+				elog(WARNING, "problem in alloc set %s: bogus aset link in block %p, chunk %p",
+					 name, block, chunk);
+
+			/*
+			 * Check for overwrite of "unallocated" space in chunk
+			 */
+			if (dsize > 0 && dsize < chsize &&
+				!sentinel_ok(chunk, ALLOC_CHUNKHDRSZ + dsize))
+				elog(WARNING, "problem in alloc set %s: detected write past chunk end in block %p, chunk %p",
+					 name, block, chunk);
+
+			blk_data += chsize;
+			nchunks++;
+
+			bpoz += ALLOC_CHUNKHDRSZ + chsize;
+		}
+
+		if ((blk_data + (nchunks * ALLOC_CHUNKHDRSZ)) != blk_used)
+			elog(WARNING, "problem in alloc set %s: found inconsistent memory block %p",
+				 name, block);
+	}
+}
+
+#endif   /* MEMORY_CONTEXT_CHECKING */
diff --git a/foreign/libpg_query/src/postgres/src_backend_utils_mmgr_mcxt.c b/foreign/libpg_query/src/postgres/src_backend_utils_mmgr_mcxt.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_backend_utils_mmgr_mcxt.c
@@ -0,0 +1,886 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - ErrorContext
+ * - MemoryContextReset
+ * - MemoryContextDeleteChildren
+ * - MemoryContextDelete
+ * - MemoryContextSetParent
+ * - pfree
+ * - MemoryContextCallResetCallbacks
+ * - MemoryContextResetOnly
+ * - repalloc
+ * - MemoryContextStats
+ * - MemoryContextStatsInternal
+ * - TopMemoryContext
+ * - pstrdup
+ * - MemoryContextStrdup
+ * - MemoryContextAlloc
+ * - CurrentMemoryContext
+ * - palloc
+ * - MemoryContextAllocZeroAligned
+ * - MemoryContextAllocZero
+ * - palloc0
+ * - MemoryContextCreate
+ * - MemoryContextInit
+ * - MemoryContextAllowInCriticalSection
+ * - CurrentMemoryContext
+ * - MemoryContextDelete
+ * - palloc0
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * mcxt.c
+ *	  POSTGRES memory context management code.
+ *
+ * This module handles context management operations that are independent
+ * of the particular kind of context being operated on.  It calls
+ * context-type-specific operations via the function pointers in a
+ * context's MemoryContextMethods struct.
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/backend/utils/mmgr/mcxt.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/* see palloc.h.  Must be before postgres.h */
+#define MCXT_INCLUDE_DEFINITIONS
+
+#include "postgres.h"
+
+#include "miscadmin.h"
+#include "utils/memdebug.h"
+#include "utils/memutils.h"
+
+
+/*****************************************************************************
+ *	  GLOBAL MEMORY															 *
+ *****************************************************************************/
+
+/*
+ * CurrentMemoryContext
+ *		Default memory context for allocations.
+ */
+__thread MemoryContext CurrentMemoryContext = NULL;
+
+
+/*
+ * Standard top-level contexts. For a description of the purpose of each
+ * of these contexts, refer to src/backend/utils/mmgr/README
+ */
+__thread MemoryContext TopMemoryContext = NULL;
+
+__thread MemoryContext ErrorContext = NULL;
+
+
+
+
+
+
+
+/* This is a transient link to the active portal's memory context: */
+
+
+static void MemoryContextCallResetCallbacks(MemoryContext context);
+static void MemoryContextStatsInternal(MemoryContext context, int level);
+
+/*
+ * You should not do memory allocations within a critical section, because
+ * an out-of-memory error will be escalated to a PANIC. To enforce that
+ * rule, the allocation functions Assert that.
+ */
+#define AssertNotInCriticalSection(context) \
+	Assert(CritSectionCount == 0 || (context)->allowInCritSection)
+
+/*****************************************************************************
+ *	  EXPORTED ROUTINES														 *
+ *****************************************************************************/
+
+
+/*
+ * MemoryContextInit
+ *		Start up the memory-context subsystem.
+ *
+ * This must be called before creating contexts or allocating memory in
+ * contexts.  TopMemoryContext and ErrorContext are initialized here;
+ * other contexts must be created afterwards.
+ *
+ * In normal multi-backend operation, this is called once during
+ * postmaster startup, and not at all by individual backend startup
+ * (since the backends inherit an already-initialized context subsystem
+ * by virtue of being forked off the postmaster).  But in an EXEC_BACKEND
+ * build, each process must do this for itself.
+ *
+ * In a standalone backend this must be called during backend startup.
+ */
+void
+MemoryContextInit(void)
+{
+	AssertState(TopMemoryContext == NULL);
+
+	/*
+	 * Initialize TopMemoryContext as an AllocSetContext with slow growth rate
+	 * --- we don't really expect much to be allocated in it.
+	 *
+	 * (There is special-case code in MemoryContextCreate() for this call.)
+	 */
+	TopMemoryContext = AllocSetContextCreate((MemoryContext) NULL,
+											 "TopMemoryContext",
+											 0,
+											 8 * 1024,
+											 8 * 1024);
+
+	/*
+	 * Not having any other place to point CurrentMemoryContext, make it point
+	 * to TopMemoryContext.  Caller should change this soon!
+	 */
+	CurrentMemoryContext = TopMemoryContext;
+
+	/*
+	 * Initialize ErrorContext as an AllocSetContext with slow growth rate ---
+	 * we don't really expect much to be allocated in it. More to the point,
+	 * require it to contain at least 8K at all times. This is the only case
+	 * where retained memory in a context is *essential* --- we want to be
+	 * sure ErrorContext still has some memory even if we've run out
+	 * elsewhere! Also, allow allocations in ErrorContext within a critical
+	 * section. Otherwise a PANIC will cause an assertion failure in the error
+	 * reporting code, before printing out the real cause of the failure.
+	 *
+	 * This should be the last step in this function, as elog.c assumes memory
+	 * management works once ErrorContext is non-null.
+	 */
+	ErrorContext = AllocSetContextCreate(TopMemoryContext,
+										 "ErrorContext",
+										 8 * 1024,
+										 8 * 1024,
+										 8 * 1024);
+	MemoryContextAllowInCriticalSection(ErrorContext, true);
+}
+
+/*
+ * MemoryContextReset
+ *		Release all space allocated within a context and delete all its
+ *		descendant contexts (but not the named context itself).
+ */
+void
+MemoryContextReset(MemoryContext context)
+{
+	AssertArg(MemoryContextIsValid(context));
+
+	/* save a function call in common case where there are no children */
+	if (context->firstchild != NULL)
+		MemoryContextDeleteChildren(context);
+
+	/* save a function call if no pallocs since startup or last reset */
+	if (!context->isReset)
+		MemoryContextResetOnly(context);
+}
+
+/*
+ * MemoryContextResetOnly
+ *		Release all space allocated within a context.
+ *		Nothing is done to the context's descendant contexts.
+ */
+void
+MemoryContextResetOnly(MemoryContext context)
+{
+	AssertArg(MemoryContextIsValid(context));
+
+	/* Nothing to do if no pallocs since startup or last reset */
+	if (!context->isReset)
+	{
+		MemoryContextCallResetCallbacks(context);
+		(*context->methods->reset) (context);
+		context->isReset = true;
+		VALGRIND_DESTROY_MEMPOOL(context);
+		VALGRIND_CREATE_MEMPOOL(context, 0, false);
+	}
+}
+
+/*
+ * MemoryContextResetChildren
+ *		Release all space allocated within a context's descendants,
+ *		but don't delete the contexts themselves.  The named context
+ *		itself is not touched.
+ */
+
+
+/*
+ * MemoryContextDelete
+ *		Delete a context and its descendants, and release all space
+ *		allocated therein.
+ *
+ * The type-specific delete routine removes all subsidiary storage
+ * for the context, but we have to delete the context node itself,
+ * as well as recurse to get the children.  We must also delink the
+ * node from its parent, if it has one.
+ */
+void
+MemoryContextDelete(MemoryContext context)
+{
+	AssertArg(MemoryContextIsValid(context));
+	/* We had better not be deleting TopMemoryContext ... */
+	Assert(context != TopMemoryContext);
+	/* And not CurrentMemoryContext, either */
+	Assert(context != CurrentMemoryContext);
+
+	MemoryContextDeleteChildren(context);
+
+	/*
+	 * It's not entirely clear whether 'tis better to do this before or after
+	 * delinking the context; but an error in a callback will likely result in
+	 * leaking the whole context (if it's not a root context) if we do it
+	 * after, so let's do it before.
+	 */
+	MemoryContextCallResetCallbacks(context);
+
+	/*
+	 * We delink the context from its parent before deleting it, so that if
+	 * there's an error we won't have deleted/busted contexts still attached
+	 * to the context tree.  Better a leak than a crash.
+	 */
+	MemoryContextSetParent(context, NULL);
+
+	(*context->methods->delete_context) (context);
+	VALGRIND_DESTROY_MEMPOOL(context);
+	pfree(context);
+}
+
+/*
+ * MemoryContextDeleteChildren
+ *		Delete all the descendants of the named context and release all
+ *		space allocated therein.  The named context itself is not touched.
+ */
+void
+MemoryContextDeleteChildren(MemoryContext context)
+{
+	AssertArg(MemoryContextIsValid(context));
+
+	/*
+	 * MemoryContextDelete will delink the child from me, so just iterate as
+	 * long as there is a child.
+	 */
+	while (context->firstchild != NULL)
+		MemoryContextDelete(context->firstchild);
+}
+
+/*
+ * MemoryContextRegisterResetCallback
+ *		Register a function to be called before next context reset/delete.
+ *		Such callbacks will be called in reverse order of registration.
+ *
+ * The caller is responsible for allocating a MemoryContextCallback struct
+ * to hold the info about this callback request, and for filling in the
+ * "func" and "arg" fields in the struct to show what function to call with
+ * what argument.  Typically the callback struct should be allocated within
+ * the specified context, since that means it will automatically be freed
+ * when no longer needed.
+ *
+ * There is no API for deregistering a callback once registered.  If you
+ * want it to not do anything anymore, adjust the state pointed to by its
+ * "arg" to indicate that.
+ */
+
+
+/*
+ * MemoryContextCallResetCallbacks
+ *		Internal function to call all registered callbacks for context.
+ */
+static void
+MemoryContextCallResetCallbacks(MemoryContext context)
+{
+	MemoryContextCallback *cb;
+
+	/*
+	 * We pop each callback from the list before calling.  That way, if an
+	 * error occurs inside the callback, we won't try to call it a second time
+	 * in the likely event that we reset or delete the context later.
+	 */
+	while ((cb = context->reset_cbs) != NULL)
+	{
+		context->reset_cbs = cb->next;
+		(*cb->func) (cb->arg);
+	}
+}
+
+/*
+ * MemoryContextSetParent
+ *		Change a context to belong to a new parent (or no parent).
+ *
+ * We provide this as an API function because it is sometimes useful to
+ * change a context's lifespan after creation.  For example, a context
+ * might be created underneath a transient context, filled with data,
+ * and then reparented underneath CacheMemoryContext to make it long-lived.
+ * In this way no special effort is needed to get rid of the context in case
+ * a failure occurs before its contents are completely set up.
+ *
+ * Callers often assume that this function cannot fail, so don't put any
+ * elog(ERROR) calls in it.
+ *
+ * A possible caller error is to reparent a context under itself, creating
+ * a loop in the context graph.  We assert here that context != new_parent,
+ * but checking for multi-level loops seems more trouble than it's worth.
+ */
+void
+MemoryContextSetParent(MemoryContext context, MemoryContext new_parent)
+{
+	AssertArg(MemoryContextIsValid(context));
+	AssertArg(context != new_parent);
+
+	/* Fast path if it's got correct parent already */
+	if (new_parent == context->parent)
+		return;
+
+	/* Delink from existing parent, if any */
+	if (context->parent)
+	{
+		MemoryContext parent = context->parent;
+
+		if (context == parent->firstchild)
+			parent->firstchild = context->nextchild;
+		else
+		{
+			MemoryContext child;
+
+			for (child = parent->firstchild; child; child = child->nextchild)
+			{
+				if (context == child->nextchild)
+				{
+					child->nextchild = context->nextchild;
+					break;
+				}
+			}
+		}
+	}
+
+	/* And relink */
+	if (new_parent)
+	{
+		AssertArg(MemoryContextIsValid(new_parent));
+		context->parent = new_parent;
+		context->nextchild = new_parent->firstchild;
+		new_parent->firstchild = context;
+	}
+	else
+	{
+		context->parent = NULL;
+		context->nextchild = NULL;
+	}
+}
+
+/*
+ * MemoryContextAllowInCriticalSection
+ *		Allow/disallow allocations in this memory context within a critical
+ *		section.
+ *
+ * Normally, memory allocations are not allowed within a critical section,
+ * because a failure would lead to PANIC.  There are a few exceptions to
+ * that, like allocations related to debugging code that is not supposed to
+ * be enabled in production.  This function can be used to exempt specific
+ * memory contexts from the assertion in palloc().
+ */
+void
+MemoryContextAllowInCriticalSection(MemoryContext context, bool allow)
+{
+	AssertArg(MemoryContextIsValid(context));
+
+	context->allowInCritSection = allow;
+}
+
+/*
+ * GetMemoryChunkSpace
+ *		Given a currently-allocated chunk, determine the total space
+ *		it occupies (including all memory-allocation overhead).
+ *
+ * This is useful for measuring the total space occupied by a set of
+ * allocated chunks.
+ */
+
+
+/*
+ * GetMemoryChunkContext
+ *		Given a currently-allocated chunk, determine the context
+ *		it belongs to.
+ */
+
+
+/*
+ * MemoryContextGetParent
+ *		Get the parent context (if any) of the specified context
+ */
+
+
+/*
+ * MemoryContextIsEmpty
+ *		Is a memory context empty of any allocated space?
+ */
+
+
+/*
+ * MemoryContextStats
+ *		Print statistics about the named context and all its descendants.
+ *
+ * This is just a debugging utility, so it's not fancy.  The statistics
+ * are merely sent to stderr.
+ */
+void
+MemoryContextStats(MemoryContext context)
+{
+	MemoryContextStatsInternal(context, 0);
+}
+
+static void
+MemoryContextStatsInternal(MemoryContext context, int level)
+{
+	MemoryContext child;
+
+	AssertArg(MemoryContextIsValid(context));
+
+	(*context->methods->stats) (context, level);
+	for (child = context->firstchild; child != NULL; child = child->nextchild)
+		MemoryContextStatsInternal(child, level + 1);
+}
+
+/*
+ * MemoryContextCheck
+ *		Check all chunks in the named context.
+ *
+ * This is just a debugging utility, so it's not fancy.
+ */
+#ifdef MEMORY_CONTEXT_CHECKING
+void
+MemoryContextCheck(MemoryContext context)
+{
+	MemoryContext child;
+
+	AssertArg(MemoryContextIsValid(context));
+
+	(*context->methods->check) (context);
+	for (child = context->firstchild; child != NULL; child = child->nextchild)
+		MemoryContextCheck(child);
+}
+#endif
+
+/*
+ * MemoryContextContains
+ *		Detect whether an allocated chunk of memory belongs to a given
+ *		context or not.
+ *
+ * Caution: this test is reliable as long as 'pointer' does point to
+ * a chunk of memory allocated from *some* context.  If 'pointer' points
+ * at memory obtained in some other way, there is a small chance of a
+ * false-positive result, since the bits right before it might look like
+ * a valid chunk header by chance.
+ */
+
+
+/*--------------------
+ * MemoryContextCreate
+ *		Context-type-independent part of context creation.
+ *
+ * This is only intended to be called by context-type-specific
+ * context creation routines, not by the unwashed masses.
+ *
+ * The context creation procedure is a little bit tricky because
+ * we want to be sure that we don't leave the context tree invalid
+ * in case of failure (such as insufficient memory to allocate the
+ * context node itself).  The procedure goes like this:
+ *	1.  Context-type-specific routine first calls MemoryContextCreate(),
+ *		passing the appropriate tag/size/methods values (the methods
+ *		pointer will ordinarily point to statically allocated data).
+ *		The parent and name parameters usually come from the caller.
+ *	2.  MemoryContextCreate() attempts to allocate the context node,
+ *		plus space for the name.  If this fails we can ereport() with no
+ *		damage done.
+ *	3.  We fill in all of the type-independent MemoryContext fields.
+ *	4.  We call the type-specific init routine (using the methods pointer).
+ *		The init routine is required to make the node minimally valid
+ *		with zero chance of failure --- it can't allocate more memory,
+ *		for example.
+ *	5.  Now we have a minimally valid node that can behave correctly
+ *		when told to reset or delete itself.  We link the node to its
+ *		parent (if any), making the node part of the context tree.
+ *	6.  We return to the context-type-specific routine, which finishes
+ *		up type-specific initialization.  This routine can now do things
+ *		that might fail (like allocate more memory), so long as it's
+ *		sure the node is left in a state that delete will handle.
+ *
+ * This protocol doesn't prevent us from leaking memory if step 6 fails
+ * during creation of a top-level context, since there's no parent link
+ * in that case.  However, if you run out of memory while you're building
+ * a top-level context, you might as well go home anyway...
+ *
+ * Normally, the context node and the name are allocated from
+ * TopMemoryContext (NOT from the parent context, since the node must
+ * survive resets of its parent context!).  However, this routine is itself
+ * used to create TopMemoryContext!  If we see that TopMemoryContext is NULL,
+ * we assume we are creating TopMemoryContext and use malloc() to allocate
+ * the node.
+ *
+ * Note that the name field of a MemoryContext does not point to
+ * separately-allocated storage, so it should not be freed at context
+ * deletion.
+ *--------------------
+ */
+MemoryContext
+MemoryContextCreate(NodeTag tag, Size size,
+					MemoryContextMethods *methods,
+					MemoryContext parent,
+					const char *name)
+{
+	MemoryContext node;
+	Size		needed = size + strlen(name) + 1;
+
+	/* creating new memory contexts is not allowed in a critical section */
+	Assert(CritSectionCount == 0);
+
+	/* Get space for node and name */
+	if (TopMemoryContext != NULL)
+	{
+		/* Normal case: allocate the node in TopMemoryContext */
+		node = (MemoryContext) MemoryContextAlloc(TopMemoryContext,
+												  needed);
+	}
+	else
+	{
+		/* Special case for startup: use good ol' malloc */
+		node = (MemoryContext) malloc(needed);
+		Assert(node != NULL);
+	}
+
+	/* Initialize the node as best we can */
+	MemSet(node, 0, size);
+	node->type = tag;
+	node->methods = methods;
+	node->parent = NULL;		/* for the moment */
+	node->firstchild = NULL;
+	node->nextchild = NULL;
+	node->isReset = true;
+	node->name = ((char *) node) + size;
+	strcpy(node->name, name);
+
+	/* Type-specific routine finishes any other essential initialization */
+	(*node->methods->init) (node);
+
+	/* OK to link node to parent (if any) */
+	/* Could use MemoryContextSetParent here, but doesn't seem worthwhile */
+	if (parent)
+	{
+		node->parent = parent;
+		node->nextchild = parent->firstchild;
+		parent->firstchild = node;
+		/* inherit allowInCritSection flag from parent */
+		node->allowInCritSection = parent->allowInCritSection;
+	}
+
+	VALGRIND_CREATE_MEMPOOL(node, 0, false);
+
+	/* Return to type-specific creation routine to finish up */
+	return node;
+}
+
+/*
+ * MemoryContextAlloc
+ *		Allocate space within the specified context.
+ *
+ * This could be turned into a macro, but we'd have to import
+ * nodes/memnodes.h into postgres.h which seems a bad idea.
+ */
+void *
+MemoryContextAlloc(MemoryContext context, Size size)
+{
+	void	   *ret;
+
+	AssertArg(MemoryContextIsValid(context));
+	AssertNotInCriticalSection(context);
+
+	if (!AllocSizeIsValid(size))
+		elog(ERROR, "invalid memory alloc request size %zu", size);
+
+	context->isReset = false;
+
+	ret = (*context->methods->alloc) (context, size);
+	if (ret == NULL)
+	{
+		MemoryContextStats(TopMemoryContext);
+		ereport(ERROR,
+				(errcode(ERRCODE_OUT_OF_MEMORY),
+				 errmsg("out of memory"),
+				 errdetail("Failed on request of size %zu.", size)));
+	}
+
+	VALGRIND_MEMPOOL_ALLOC(context, ret, size);
+
+	return ret;
+}
+
+/*
+ * MemoryContextAllocZero
+ *		Like MemoryContextAlloc, but clears allocated memory
+ *
+ *	We could just call MemoryContextAlloc then clear the memory, but this
+ *	is a very common combination, so we provide the combined operation.
+ */
+void *
+MemoryContextAllocZero(MemoryContext context, Size size)
+{
+	void	   *ret;
+
+	AssertArg(MemoryContextIsValid(context));
+	AssertNotInCriticalSection(context);
+
+	if (!AllocSizeIsValid(size))
+		elog(ERROR, "invalid memory alloc request size %zu", size);
+
+	context->isReset = false;
+
+	ret = (*context->methods->alloc) (context, size);
+	if (ret == NULL)
+	{
+		MemoryContextStats(TopMemoryContext);
+		ereport(ERROR,
+				(errcode(ERRCODE_OUT_OF_MEMORY),
+				 errmsg("out of memory"),
+				 errdetail("Failed on request of size %zu.", size)));
+	}
+
+	VALGRIND_MEMPOOL_ALLOC(context, ret, size);
+
+	MemSetAligned(ret, 0, size);
+
+	return ret;
+}
+
+/*
+ * MemoryContextAllocZeroAligned
+ *		MemoryContextAllocZero where length is suitable for MemSetLoop
+ *
+ *	This might seem overly specialized, but it's not because newNode()
+ *	is so often called with compile-time-constant sizes.
+ */
+void *
+MemoryContextAllocZeroAligned(MemoryContext context, Size size)
+{
+	void	   *ret;
+
+	AssertArg(MemoryContextIsValid(context));
+	AssertNotInCriticalSection(context);
+
+	if (!AllocSizeIsValid(size))
+		elog(ERROR, "invalid memory alloc request size %zu", size);
+
+	context->isReset = false;
+
+	ret = (*context->methods->alloc) (context, size);
+	if (ret == NULL)
+	{
+		MemoryContextStats(TopMemoryContext);
+		ereport(ERROR,
+				(errcode(ERRCODE_OUT_OF_MEMORY),
+				 errmsg("out of memory"),
+				 errdetail("Failed on request of size %zu.", size)));
+	}
+
+	VALGRIND_MEMPOOL_ALLOC(context, ret, size);
+
+	MemSetLoop(ret, 0, size);
+
+	return ret;
+}
+
+/*
+ * MemoryContextAllocExtended
+ *		Allocate space within the specified context using the given flags.
+ */
+
+
+void *
+palloc(Size size)
+{
+	/* duplicates MemoryContextAlloc to avoid increased overhead */
+	void	   *ret;
+
+	AssertArg(MemoryContextIsValid(CurrentMemoryContext));
+	AssertNotInCriticalSection(CurrentMemoryContext);
+
+	if (!AllocSizeIsValid(size))
+		elog(ERROR, "invalid memory alloc request size %zu", size);
+
+	CurrentMemoryContext->isReset = false;
+
+	ret = (*CurrentMemoryContext->methods->alloc) (CurrentMemoryContext, size);
+	if (ret == NULL)
+	{
+		MemoryContextStats(TopMemoryContext);
+		ereport(ERROR,
+				(errcode(ERRCODE_OUT_OF_MEMORY),
+				 errmsg("out of memory"),
+				 errdetail("Failed on request of size %zu.", size)));
+	}
+
+	VALGRIND_MEMPOOL_ALLOC(CurrentMemoryContext, ret, size);
+
+	return ret;
+}
+
+void *
+palloc0(Size size)
+{
+	/* duplicates MemoryContextAllocZero to avoid increased overhead */
+	void	   *ret;
+
+	AssertArg(MemoryContextIsValid(CurrentMemoryContext));
+	AssertNotInCriticalSection(CurrentMemoryContext);
+
+	if (!AllocSizeIsValid(size))
+		elog(ERROR, "invalid memory alloc request size %zu", size);
+
+	CurrentMemoryContext->isReset = false;
+
+	ret = (*CurrentMemoryContext->methods->alloc) (CurrentMemoryContext, size);
+	if (ret == NULL)
+	{
+		MemoryContextStats(TopMemoryContext);
+		ereport(ERROR,
+				(errcode(ERRCODE_OUT_OF_MEMORY),
+				 errmsg("out of memory"),
+				 errdetail("Failed on request of size %zu.", size)));
+	}
+
+	VALGRIND_MEMPOOL_ALLOC(CurrentMemoryContext, ret, size);
+
+	MemSetAligned(ret, 0, size);
+
+	return ret;
+}
+
+
+
+/*
+ * pfree
+ *		Release an allocated chunk.
+ */
+void
+pfree(void *pointer)
+{
+	MemoryContext context;
+
+	/*
+	 * Try to detect bogus pointers handed to us, poorly though we can.
+	 * Presumably, a pointer that isn't MAXALIGNED isn't pointing at an
+	 * allocated chunk.
+	 */
+	Assert(pointer != NULL);
+	Assert(pointer == (void *) MAXALIGN(pointer));
+
+	/*
+	 * OK, it's probably safe to look at the chunk header.
+	 */
+	context = ((StandardChunkHeader *)
+			   ((char *) pointer - STANDARDCHUNKHEADERSIZE))->context;
+
+	AssertArg(MemoryContextIsValid(context));
+
+	(*context->methods->free_p) (context, pointer);
+	VALGRIND_MEMPOOL_FREE(context, pointer);
+}
+
+/*
+ * repalloc
+ *		Adjust the size of a previously allocated chunk.
+ */
+void *
+repalloc(void *pointer, Size size)
+{
+	MemoryContext context;
+	void	   *ret;
+
+	if (!AllocSizeIsValid(size))
+		elog(ERROR, "invalid memory alloc request size %zu", size);
+
+	/*
+	 * Try to detect bogus pointers handed to us, poorly though we can.
+	 * Presumably, a pointer that isn't MAXALIGNED isn't pointing at an
+	 * allocated chunk.
+	 */
+	Assert(pointer != NULL);
+	Assert(pointer == (void *) MAXALIGN(pointer));
+
+	/*
+	 * OK, it's probably safe to look at the chunk header.
+	 */
+	context = ((StandardChunkHeader *)
+			   ((char *) pointer - STANDARDCHUNKHEADERSIZE))->context;
+
+	AssertArg(MemoryContextIsValid(context));
+	AssertNotInCriticalSection(context);
+
+	/* isReset must be false already */
+	Assert(!context->isReset);
+
+	ret = (*context->methods->realloc) (context, pointer, size);
+	if (ret == NULL)
+	{
+		MemoryContextStats(TopMemoryContext);
+		ereport(ERROR,
+				(errcode(ERRCODE_OUT_OF_MEMORY),
+				 errmsg("out of memory"),
+				 errdetail("Failed on request of size %zu.", size)));
+	}
+
+	VALGRIND_MEMPOOL_CHANGE(context, pointer, ret, size);
+
+	return ret;
+}
+
+/*
+ * MemoryContextAllocHuge
+ *		Allocate (possibly-expansive) space within the specified context.
+ *
+ * See considerations in comment at MaxAllocHugeSize.
+ */
+
+
+/*
+ * repalloc_huge
+ *		Adjust the size of a previously allocated chunk, permitting a large
+ *		value.  The previous allocation need not have been "huge".
+ */
+
+
+/*
+ * MemoryContextStrdup
+ *		Like strdup(), but allocate from the specified context
+ */
+char *
+MemoryContextStrdup(MemoryContext context, const char *string)
+{
+	char	   *nstr;
+	Size		len = strlen(string) + 1;
+
+	nstr = (char *) MemoryContextAlloc(context, len);
+
+	memcpy(nstr, string, len);
+
+	return nstr;
+}
+
+char *
+pstrdup(const char *in)
+{
+	return MemoryContextStrdup(CurrentMemoryContext, in);
+}
+
+/*
+ * pnstrdup
+ *		Like pstrdup(), but append null byte to a
+ *		not-necessarily-null-terminated input string.
+ */
+
diff --git a/foreign/libpg_query/src/postgres/src_common_psprintf.c b/foreign/libpg_query/src/postgres/src_common_psprintf.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_common_psprintf.c
@@ -0,0 +1,197 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - pvsnprintf
+ * - psprintf
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * psprintf.c
+ *		sprintf into an allocated-on-demand buffer
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/common/psprintf.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef FRONTEND
+
+#include "postgres.h"
+
+#include "utils/memutils.h"
+
+#else
+
+#include "postgres_fe.h"
+
+/* It's possible we could use a different value for this in frontend code */
+#define MaxAllocSize	((Size) 0x3fffffff)		/* 1 gigabyte - 1 */
+
+#endif
+
+
+/*
+ * psprintf
+ *
+ * Format text data under the control of fmt (an sprintf-style format string)
+ * and return it in an allocated-on-demand buffer.  The buffer is allocated
+ * with palloc in the backend, or malloc in frontend builds.  Caller is
+ * responsible to free the buffer when no longer needed, if appropriate.
+ *
+ * Errors are not returned to the caller, but are reported via elog(ERROR)
+ * in the backend, or printf-to-stderr-and-exit() in frontend builds.
+ * One should therefore think twice about using this in libpq.
+ */
+char *
+psprintf(const char *fmt,...)
+{
+	size_t		len = 128;		/* initial assumption about buffer size */
+
+	for (;;)
+	{
+		char	   *result;
+		va_list		args;
+		size_t		newlen;
+
+		/*
+		 * Allocate result buffer.  Note that in frontend this maps to malloc
+		 * with exit-on-error.
+		 */
+		result = (char *) palloc(len);
+
+		/* Try to format the data. */
+		va_start(args, fmt);
+		newlen = pvsnprintf(result, len, fmt, args);
+		va_end(args);
+
+		if (newlen < len)
+			return result;		/* success */
+
+		/* Release buffer and loop around to try again with larger len. */
+		pfree(result);
+		len = newlen;
+	}
+}
+
+/*
+ * pvsnprintf
+ *
+ * Attempt to format text data under the control of fmt (an sprintf-style
+ * format string) and insert it into buf (which has length len, len > 0).
+ *
+ * If successful, return the number of bytes emitted, not counting the
+ * trailing zero byte.  This will always be strictly less than len.
+ *
+ * If there's not enough space in buf, return an estimate of the buffer size
+ * needed to succeed (this *must* be more than the given len, else callers
+ * might loop infinitely).
+ *
+ * Other error cases do not return, but exit via elog(ERROR) or exit().
+ * Hence, this shouldn't be used inside libpq.
+ *
+ * This function exists mainly to centralize our workarounds for
+ * non-C99-compliant vsnprintf implementations.  Generally, any call that
+ * pays any attention to the return value should go through here rather
+ * than calling snprintf or vsnprintf directly.
+ *
+ * Note that the semantics of the return value are not exactly C99's.
+ * First, we don't promise that the estimated buffer size is exactly right;
+ * callers must be prepared to loop multiple times to get the right size.
+ * Second, we return the recommended buffer size, not one less than that;
+ * this lets overflow concerns be handled here rather than in the callers.
+ */
+size_t
+pvsnprintf(char *buf, size_t len, const char *fmt, va_list args)
+{
+	int			nprinted;
+
+	Assert(len > 0);
+
+	errno = 0;
+
+	/*
+	 * Assert check here is to catch buggy vsnprintf that overruns the
+	 * specified buffer length.  Solaris 7 in 64-bit mode is an example of a
+	 * platform with such a bug.
+	 */
+#ifdef USE_ASSERT_CHECKING
+	buf[len - 1] = '\0';
+#endif
+
+	nprinted = vsnprintf(buf, len, fmt, args);
+
+	Assert(buf[len - 1] == '\0');
+
+	/*
+	 * If vsnprintf reports an error other than ENOMEM, fail.  The possible
+	 * causes of this are not user-facing errors, so elog should be enough.
+	 */
+	if (nprinted < 0 && errno != 0 && errno != ENOMEM)
+	{
+#ifndef FRONTEND
+		elog(ERROR, "vsnprintf failed: %m");
+#else
+		fprintf(stderr, "vsnprintf failed: %s\n", strerror(errno));
+		exit(EXIT_FAILURE);
+#endif
+	}
+
+	/*
+	 * Note: some versions of vsnprintf return the number of chars actually
+	 * stored, not the total space needed as C99 specifies.  And at least one
+	 * returns -1 on failure.  Be conservative about believing whether the
+	 * print worked.
+	 */
+	if (nprinted >= 0 && (size_t) nprinted < len - 1)
+	{
+		/* Success.  Note nprinted does not include trailing null. */
+		return (size_t) nprinted;
+	}
+
+	if (nprinted >= 0 && (size_t) nprinted > len)
+	{
+		/*
+		 * This appears to be a C99-compliant vsnprintf, so believe its
+		 * estimate of the required space.  (If it's wrong, the logic will
+		 * still work, but we may loop multiple times.)  Note that the space
+		 * needed should be only nprinted+1 bytes, but we'd better allocate
+		 * one more than that so that the test above will succeed next time.
+		 *
+		 * In the corner case where the required space just barely overflows,
+		 * fall through so that we'll error out below (possibly after
+		 * looping).
+		 */
+		if ((size_t) nprinted <= MaxAllocSize - 2)
+			return nprinted + 2;
+	}
+
+	/*
+	 * Buffer overrun, and we don't know how much space is needed.  Estimate
+	 * twice the previous buffer size, but not more than MaxAllocSize; if we
+	 * are already at MaxAllocSize, choke.  Note we use this palloc-oriented
+	 * overflow limit even when in frontend.
+	 */
+	if (len >= MaxAllocSize)
+	{
+#ifndef FRONTEND
+		ereport(ERROR,
+				(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
+				 errmsg("out of memory")));
+#else
+		fprintf(stderr, _("out of memory\n"));
+		exit(EXIT_FAILURE);
+#endif
+	}
+
+	if (len >= MaxAllocSize / 2)
+		return MaxAllocSize;
+
+	return len * 2;
+}
diff --git a/foreign/libpg_query/src/postgres/src_pl_plpgsql_src_pl_comp.c b/foreign/libpg_query/src/postgres/src_pl_plpgsql_src_pl_comp.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_pl_plpgsql_src_pl_comp.c
@@ -0,0 +1,1114 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - plpgsql_compile_inline
+ * - plpgsql_error_funcname
+ * - plpgsql_check_syntax
+ * - plpgsql_curr_compile
+ * - compile_tmp_cxt
+ * - plpgsql_DumpExecTree
+ * - plpgsql_nDatums
+ * - plpgsql_Datums
+ * - plpgsql_build_variable
+ * - plpgsql_adddatum
+ * - plpgsql_build_record
+ * - build_row_from_class
+ * - plpgsql_build_datatype
+ * - plpgsql_parse_tripword
+ * - plpgsql_parse_dblword
+ * - plpgsql_parse_word
+ * - plpgsql_add_initdatums
+ * - plpgsql_recognize_err_condition
+ * - exception_label_map
+ * - plpgsql_parse_err_condition
+ * - plpgsql_parse_wordtype
+ * - plpgsql_parse_wordrowtype
+ * - plpgsql_parse_cwordtype
+ * - plpgsql_parse_cwordrowtype
+ * - plpgsql_parse_result
+ * - plpgsql_compile_error_callback
+ * - datums_alloc
+ * - datums_last
+ * - add_dummy_return
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * pl_comp.c		- Compiler part of the PL/pgSQL
+ *			  procedural language
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/pl/plpgsql/src/pl_comp.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "plpgsql.h"
+
+#include <ctype.h>
+
+#include "access/htup_details.h"
+#include "catalog/namespace.h"
+#include "catalog/pg_proc.h"
+#include "catalog/pg_proc_fn.h"
+#include "catalog/pg_type.h"
+#include "funcapi.h"
+#include "nodes/makefuncs.h"
+#include "parser/parse_type.h"
+#include "utils/builtins.h"
+#include "utils/guc.h"
+#include "utils/lsyscache.h"
+#include "utils/memutils.h"
+#include "utils/rel.h"
+#include "utils/syscache.h"
+
+
+/* ----------
+ * Our own local and global variables
+ * ----------
+ */
+__thread PLpgSQL_stmt_block *plpgsql_parse_result;
+
+
+static int	datums_alloc;
+__thread int			plpgsql_nDatums;
+
+__thread PLpgSQL_datum **plpgsql_Datums;
+
+static int	datums_last = 0;
+
+__thread char	   *plpgsql_error_funcname;
+
+__thread bool		plpgsql_DumpExecTree = false;
+
+__thread bool		plpgsql_check_syntax = false;
+
+
+__thread PLpgSQL_function *plpgsql_curr_compile;
+
+
+/* A context appropriate for short-term allocs during compilation */
+__thread MemoryContext compile_tmp_cxt;
+
+
+/* ----------
+ * Hash table for compiled functions
+ * ----------
+ */
+
+
+typedef struct plpgsql_hashent
+{
+	PLpgSQL_func_hashkey key;
+	PLpgSQL_function *function;
+} plpgsql_HashEnt;
+
+#define FUNCS_PER_USER		128 /* initial table size */
+
+/* ----------
+ * Lookup table for EXCEPTION condition names
+ * ----------
+ */
+typedef struct
+{
+	const char *label;
+	int			sqlerrstate;
+} ExceptionLabelMap;
+
+static const ExceptionLabelMap exception_label_map[] = {
+#include "plerrcodes.h"			/* pgrminclude ignore */
+	{NULL, 0}
+};
+
+
+/* ----------
+ * static prototypes
+ * ----------
+ */
+static PLpgSQL_function *do_compile(FunctionCallInfo fcinfo,
+		   HeapTuple procTup,
+		   PLpgSQL_function *function,
+		   PLpgSQL_func_hashkey *hashkey,
+		   bool forValidator);
+static void plpgsql_compile_error_callback(void *arg);
+static void add_parameter_name(int itemtype, int itemno, const char *name);
+static void add_dummy_return(PLpgSQL_function *function);
+static Node *plpgsql_pre_column_ref(ParseState *pstate, ColumnRef *cref);
+static Node *plpgsql_post_column_ref(ParseState *pstate, ColumnRef *cref, Node *var);
+static Node *plpgsql_param_ref(ParseState *pstate, ParamRef *pref);
+static Node *resolve_column_ref(ParseState *pstate, PLpgSQL_expr *expr,
+				   ColumnRef *cref, bool error_if_no_field);
+static Node *make_datum_param(PLpgSQL_expr *expr, int dno, int location);
+static PLpgSQL_row *build_row_from_class(Oid classOid);
+static PLpgSQL_row *build_row_from_vars(PLpgSQL_variable **vars, int numvars);
+static PLpgSQL_type *build_datatype(HeapTuple typeTup, int32 typmod, Oid collation);
+static void compute_function_hashkey(FunctionCallInfo fcinfo,
+						 Form_pg_proc procStruct,
+						 PLpgSQL_func_hashkey *hashkey,
+						 bool forValidator);
+static void plpgsql_resolve_polymorphic_argtypes(int numargs,
+									 Oid *argtypes, char *argmodes,
+									 Node *call_expr, bool forValidator,
+									 const char *proname);
+static PLpgSQL_function *plpgsql_HashTableLookup(PLpgSQL_func_hashkey *func_key);
+static void plpgsql_HashTableInsert(PLpgSQL_function *function,
+						PLpgSQL_func_hashkey *func_key);
+static void plpgsql_HashTableDelete(PLpgSQL_function *function);
+static void delete_function(PLpgSQL_function *func);
+
+/* ----------
+ * plpgsql_compile		Make an execution tree for a PL/pgSQL function.
+ *
+ * If forValidator is true, we're only compiling for validation purposes,
+ * and so some checks are skipped.
+ *
+ * Note: it's important for this to fall through quickly if the function
+ * has already been compiled.
+ * ----------
+ */
+
+
+/*
+ * This is the slow part of plpgsql_compile().
+ *
+ * The passed-in "function" pointer is either NULL or an already-allocated
+ * function struct to overwrite.
+ *
+ * While compiling a function, the CurrentMemoryContext is the
+ * per-function memory context of the function we are compiling. That
+ * means a palloc() will allocate storage with the same lifetime as
+ * the function itself.
+ *
+ * Because palloc()'d storage will not be immediately freed, temporary
+ * allocations should either be performed in a short-lived memory
+ * context or explicitly pfree'd. Since not all backend functions are
+ * careful about pfree'ing their allocations, it is also wise to
+ * switch into a short-term context before calling into the
+ * backend. An appropriate context for performing short-term
+ * allocations is the compile_tmp_cxt.
+ *
+ * NB: this code is not re-entrant.  We assume that nothing we do here could
+ * result in the invocation of another plpgsql function.
+ */
+
+
+/* ----------
+ * plpgsql_compile_inline	Make an execution tree for an anonymous code block.
+ *
+ * Note: this is generally parallel to do_compile(); is it worth trying to
+ * merge the two?
+ *
+ * Note: we assume the block will be thrown away so there is no need to build
+ * persistent data structures.
+ * ----------
+ */
+PLpgSQL_function *
+plpgsql_compile_inline(char *proc_source)
+{
+	char	   *func_name = "inline_code_block";
+	PLpgSQL_function *function;
+	ErrorContextCallback plerrcontext;
+	PLpgSQL_variable *var;
+	int			parse_rc;
+	MemoryContext func_cxt;
+	int			i;
+
+	/*
+	 * Setup the scanner input and error info.  We assume that this function
+	 * cannot be invoked recursively, so there's no need to save and restore
+	 * the static variables used here.
+	 */
+	plpgsql_scanner_init(proc_source);
+
+	plpgsql_error_funcname = func_name;
+
+	/*
+	 * Setup error traceback support for ereport()
+	 */
+	plerrcontext.callback = plpgsql_compile_error_callback;
+	plerrcontext.arg = proc_source;
+	plerrcontext.previous = error_context_stack;
+	error_context_stack = &plerrcontext;
+
+	/* Do extra syntax checking if check_function_bodies is on */
+	plpgsql_check_syntax = check_function_bodies;
+
+	/* Function struct does not live past current statement */
+	function = (PLpgSQL_function *) palloc0(sizeof(PLpgSQL_function));
+
+	plpgsql_curr_compile = function;
+
+	/*
+	 * All the rest of the compile-time storage (e.g. parse tree) is kept in
+	 * its own memory context, so it can be reclaimed easily.
+	 */
+	func_cxt = AllocSetContextCreate(CurrentMemoryContext,
+									 "PL/pgSQL function context",
+									 ALLOCSET_DEFAULT_MINSIZE,
+									 ALLOCSET_DEFAULT_INITSIZE,
+									 ALLOCSET_DEFAULT_MAXSIZE);
+	compile_tmp_cxt = MemoryContextSwitchTo(func_cxt);
+
+	function->fn_signature = pstrdup(func_name);
+	function->fn_is_trigger = PLPGSQL_NOT_TRIGGER;
+	function->fn_input_collation = InvalidOid;
+	function->fn_cxt = func_cxt;
+	function->out_param_varno = -1;		/* set up for no OUT param */
+	function->resolve_option = plpgsql_variable_conflict;
+	function->print_strict_params = plpgsql_print_strict_params;
+
+	/*
+	 * don't do extra validation for inline code as we don't want to add spam
+	 * at runtime
+	 */
+	function->extra_warnings = 0;
+	function->extra_errors = 0;
+
+	plpgsql_ns_init();
+	plpgsql_ns_push(func_name);
+	plpgsql_DumpExecTree = false;
+
+	datums_alloc = 128;
+	plpgsql_nDatums = 0;
+	plpgsql_Datums = palloc(sizeof(PLpgSQL_datum *) * datums_alloc);
+	datums_last = 0;
+
+	/* Set up as though in a function returning VOID */
+	function->fn_rettype = VOIDOID;
+	function->fn_retset = false;
+	function->fn_retistuple = false;
+	/* a bit of hardwired knowledge about type VOID here */
+	function->fn_retbyval = true;
+	function->fn_rettyplen = sizeof(int32);
+
+	/*
+	 * Remember if function is STABLE/IMMUTABLE.  XXX would it be better to
+	 * set this TRUE inside a read-only transaction?  Not clear.
+	 */
+	function->fn_readonly = false;
+
+	/*
+	 * Create the magic FOUND variable.
+	 */
+	var = plpgsql_build_variable("found", 0,
+								 plpgsql_build_datatype(BOOLOID,
+														-1,
+														InvalidOid),
+								 true);
+	function->found_varno = var->dno;
+
+	/*
+	 * Now parse the function's text
+	 */
+	parse_rc = plpgsql_yyparse();
+	if (parse_rc != 0)
+		elog(ERROR, "plpgsql parser returned %d", parse_rc);
+	function->action = plpgsql_parse_result;
+
+	plpgsql_scanner_finish();
+
+	/*
+	 * If it returns VOID (always true at the moment), we allow control to
+	 * fall off the end without an explicit RETURN statement.
+	 */
+	if (function->fn_rettype == VOIDOID)
+		add_dummy_return(function);
+
+	/*
+	 * Complete the function's info
+	 */
+	function->fn_nargs = 0;
+	function->ndatums = plpgsql_nDatums;
+	function->datums = palloc(sizeof(PLpgSQL_datum *) * plpgsql_nDatums);
+	for (i = 0; i < plpgsql_nDatums; i++)
+		function->datums[i] = plpgsql_Datums[i];
+
+	/*
+	 * Pop the error context stack
+	 */
+	error_context_stack = plerrcontext.previous;
+	plpgsql_error_funcname = NULL;
+
+	plpgsql_check_syntax = false;
+
+	MemoryContextSwitchTo(compile_tmp_cxt);
+	compile_tmp_cxt = NULL;
+	return function;
+}
+
+
+/*
+ * error context callback to let us supply a call-stack traceback.
+ * If we are validating or executing an anonymous code block, the function
+ * source text is passed as an argument.
+ */
+static void
+plpgsql_compile_error_callback(void *arg)
+{
+	if (arg)
+	{
+		/*
+		 * Try to convert syntax error position to reference text of original
+		 * CREATE FUNCTION or DO command.
+		 */
+		if (function_parse_error_transpose((const char *) arg))
+			return;
+
+		/*
+		 * Done if a syntax error position was reported; otherwise we have to
+		 * fall back to a "near line N" report.
+		 */
+	}
+
+	if (plpgsql_error_funcname)
+		errcontext("compilation of PL/pgSQL function \"%s\" near line %d",
+				   plpgsql_error_funcname, plpgsql_latest_lineno());
+}
+
+
+/*
+ * Add a name for a function parameter to the function's namespace
+ */
+
+
+/*
+ * Add a dummy RETURN statement to the given function's body
+ */
+static void
+add_dummy_return(PLpgSQL_function *function)
+{
+	/*
+	 * If the outer block has an EXCEPTION clause, we need to make a new outer
+	 * block, since the added RETURN shouldn't act like it is inside the
+	 * EXCEPTION clause.
+	 */
+	if (function->action->exceptions != NULL)
+	{
+		PLpgSQL_stmt_block *new;
+
+		new = palloc0(sizeof(PLpgSQL_stmt_block));
+		new->cmd_type = PLPGSQL_STMT_BLOCK;
+		new->body = list_make1(function->action);
+
+		function->action = new;
+	}
+	if (function->action->body == NIL ||
+		((PLpgSQL_stmt *) llast(function->action->body))->cmd_type != PLPGSQL_STMT_RETURN)
+	{
+		PLpgSQL_stmt_return *new;
+
+		new = palloc0(sizeof(PLpgSQL_stmt_return));
+		new->cmd_type = PLPGSQL_STMT_RETURN;
+		new->expr = NULL;
+		new->retvarno = function->out_param_varno;
+
+		function->action->body = lappend(function->action->body, new);
+	}
+}
+
+
+/*
+ * plpgsql_parser_setup		set up parser hooks for dynamic parameters
+ *
+ * Note: this routine, and the hook functions it prepares for, are logically
+ * part of plpgsql parsing.  But they actually run during function execution,
+ * when we are ready to evaluate a SQL query or expression that has not
+ * previously been parsed and planned.
+ */
+
+
+/*
+ * plpgsql_pre_column_ref		parser callback before parsing a ColumnRef
+ */
+
+
+/*
+ * plpgsql_post_column_ref		parser callback after parsing a ColumnRef
+ */
+
+
+/*
+ * plpgsql_param_ref		parser callback for ParamRefs ($n symbols)
+ */
+
+
+/*
+ * resolve_column_ref		attempt to resolve a ColumnRef as a plpgsql var
+ *
+ * Returns the translated node structure, or NULL if name not found
+ *
+ * error_if_no_field tells whether to throw error or quietly return NULL if
+ * we are able to match a record/row name but don't find a field name match.
+ */
+
+
+/*
+ * Helper for columnref parsing: build a Param referencing a plpgsql datum,
+ * and make sure that that datum is listed in the expression's paramnos.
+ */
+
+
+
+/* ----------
+ * plpgsql_parse_word		The scanner calls this to postparse
+ *				any single word that is not a reserved keyword.
+ *
+ * word1 is the downcased/dequoted identifier; it must be palloc'd in the
+ * function's long-term memory context.
+ *
+ * yytxt is the original token text; we need this to check for quoting,
+ * so that later checks for unreserved keywords work properly.
+ *
+ * If recognized as a variable, fill in *wdatum and return TRUE;
+ * if not recognized, fill in *word and return FALSE.
+ * (Note: those two pointers actually point to members of the same union,
+ * but for notational reasons we pass them separately.)
+ * ----------
+ */
+bool
+plpgsql_parse_word(char *word1, const char *yytxt,
+				   PLwdatum *wdatum, PLword *word)
+{
+	PLpgSQL_nsitem *ns;
+
+	/*
+	 * We should do nothing in DECLARE sections.  In SQL expressions, there's
+	 * no need to do anything either --- lookup will happen when the
+	 * expression is compiled.
+	 */
+	if (plpgsql_IdentifierLookup == IDENTIFIER_LOOKUP_NORMAL)
+	{
+		/*
+		 * Do a lookup in the current namespace stack
+		 */
+		ns = plpgsql_ns_lookup(plpgsql_ns_top(), false,
+							   word1, NULL, NULL,
+							   NULL);
+
+		if (ns != NULL)
+		{
+			switch (ns->itemtype)
+			{
+				case PLPGSQL_NSTYPE_VAR:
+				case PLPGSQL_NSTYPE_ROW:
+				case PLPGSQL_NSTYPE_REC:
+					wdatum->datum = plpgsql_Datums[ns->itemno];
+					wdatum->ident = word1;
+					wdatum->quoted = (yytxt[0] == '"');
+					wdatum->idents = NIL;
+					return true;
+
+				default:
+					/* plpgsql_ns_lookup should never return anything else */
+					elog(ERROR, "unrecognized plpgsql itemtype: %d",
+						 ns->itemtype);
+			}
+		}
+	}
+
+	/*
+	 * Nothing found - up to now it's a word without any special meaning for
+	 * us.
+	 */
+	word->ident = word1;
+	word->quoted = (yytxt[0] == '"');
+	return false;
+}
+
+
+/* ----------
+ * plpgsql_parse_dblword		Same lookup for two words
+ *					separated by a dot.
+ * ----------
+ */
+bool
+plpgsql_parse_dblword(char *word1, char *word2,
+					  PLwdatum *wdatum, PLcword *cword)
+{
+	PLpgSQL_nsitem *ns;
+	List	   *idents;
+	int			nnames;
+
+	idents = list_make2(makeString(word1),
+						makeString(word2));
+
+	/*
+	 * We should do nothing in DECLARE sections.  In SQL expressions, we
+	 * really only need to make sure that RECFIELD datums are created when
+	 * needed.
+	 */
+	if (plpgsql_IdentifierLookup != IDENTIFIER_LOOKUP_DECLARE)
+	{
+		/*
+		 * Do a lookup in the current namespace stack
+		 */
+		ns = plpgsql_ns_lookup(plpgsql_ns_top(), false,
+							   word1, word2, NULL,
+							   &nnames);
+		if (ns != NULL)
+		{
+			switch (ns->itemtype)
+			{
+				case PLPGSQL_NSTYPE_VAR:
+					/* Block-qualified reference to scalar variable. */
+					wdatum->datum = plpgsql_Datums[ns->itemno];
+					wdatum->ident = NULL;
+					wdatum->quoted = false;		/* not used */
+					wdatum->idents = idents;
+					return true;
+
+				case PLPGSQL_NSTYPE_REC:
+					if (nnames == 1)
+					{
+						/*
+						 * First word is a record name, so second word could
+						 * be a field in this record.  We build a RECFIELD
+						 * datum whether it is or not --- any error will be
+						 * detected later.
+						 */
+						PLpgSQL_recfield *new;
+
+						new = palloc(sizeof(PLpgSQL_recfield));
+						new->dtype = PLPGSQL_DTYPE_RECFIELD;
+						new->fieldname = pstrdup(word2);
+						new->recparentno = ns->itemno;
+
+						plpgsql_adddatum((PLpgSQL_datum *) new);
+
+						wdatum->datum = (PLpgSQL_datum *) new;
+					}
+					else
+					{
+						/* Block-qualified reference to record variable. */
+						wdatum->datum = plpgsql_Datums[ns->itemno];
+					}
+					wdatum->ident = NULL;
+					wdatum->quoted = false;		/* not used */
+					wdatum->idents = idents;
+					return true;
+
+				case PLPGSQL_NSTYPE_ROW:
+					if (nnames == 1)
+					{
+						/*
+						 * First word is a row name, so second word could be a
+						 * field in this row.  Again, no error now if it
+						 * isn't.
+						 */
+						PLpgSQL_row *row;
+						int			i;
+
+						row = (PLpgSQL_row *) (plpgsql_Datums[ns->itemno]);
+						for (i = 0; i < row->nfields; i++)
+						{
+							if (row->fieldnames[i] &&
+								strcmp(row->fieldnames[i], word2) == 0)
+							{
+								wdatum->datum = plpgsql_Datums[row->varnos[i]];
+								wdatum->ident = NULL;
+								wdatum->quoted = false; /* not used */
+								wdatum->idents = idents;
+								return true;
+							}
+						}
+						/* fall through to return CWORD */
+					}
+					else
+					{
+						/* Block-qualified reference to row variable. */
+						wdatum->datum = plpgsql_Datums[ns->itemno];
+						wdatum->ident = NULL;
+						wdatum->quoted = false; /* not used */
+						wdatum->idents = idents;
+						return true;
+					}
+					break;
+
+				default:
+					break;
+			}
+		}
+	}
+
+	/* Nothing found */
+	cword->idents = idents;
+	return false;
+}
+
+
+/* ----------
+ * plpgsql_parse_tripword		Same lookup for three words
+ *					separated by dots.
+ * ----------
+ */
+bool
+plpgsql_parse_tripword(char *word1, char *word2, char *word3,
+					   PLwdatum *wdatum, PLcword *cword)
+{
+	PLpgSQL_nsitem *ns;
+	List	   *idents;
+	int			nnames;
+
+	idents = list_make3(makeString(word1),
+						makeString(word2),
+						makeString(word3));
+
+	/*
+	 * We should do nothing in DECLARE sections.  In SQL expressions, we
+	 * really only need to make sure that RECFIELD datums are created when
+	 * needed.
+	 */
+	if (plpgsql_IdentifierLookup != IDENTIFIER_LOOKUP_DECLARE)
+	{
+		/*
+		 * Do a lookup in the current namespace stack. Must find a qualified
+		 * reference, else ignore.
+		 */
+		ns = plpgsql_ns_lookup(plpgsql_ns_top(), false,
+							   word1, word2, word3,
+							   &nnames);
+		if (ns != NULL && nnames == 2)
+		{
+			switch (ns->itemtype)
+			{
+				case PLPGSQL_NSTYPE_REC:
+					{
+						/*
+						 * words 1/2 are a record name, so third word could be
+						 * a field in this record.
+						 */
+						PLpgSQL_recfield *new;
+
+						new = palloc(sizeof(PLpgSQL_recfield));
+						new->dtype = PLPGSQL_DTYPE_RECFIELD;
+						new->fieldname = pstrdup(word3);
+						new->recparentno = ns->itemno;
+
+						plpgsql_adddatum((PLpgSQL_datum *) new);
+
+						wdatum->datum = (PLpgSQL_datum *) new;
+						wdatum->ident = NULL;
+						wdatum->quoted = false; /* not used */
+						wdatum->idents = idents;
+						return true;
+					}
+
+				case PLPGSQL_NSTYPE_ROW:
+					{
+						/*
+						 * words 1/2 are a row name, so third word could be a
+						 * field in this row.
+						 */
+						PLpgSQL_row *row;
+						int			i;
+
+						row = (PLpgSQL_row *) (plpgsql_Datums[ns->itemno]);
+						for (i = 0; i < row->nfields; i++)
+						{
+							if (row->fieldnames[i] &&
+								strcmp(row->fieldnames[i], word3) == 0)
+							{
+								wdatum->datum = plpgsql_Datums[row->varnos[i]];
+								wdatum->ident = NULL;
+								wdatum->quoted = false; /* not used */
+								wdatum->idents = idents;
+								return true;
+							}
+						}
+						/* fall through to return CWORD */
+						break;
+					}
+
+				default:
+					break;
+			}
+		}
+	}
+
+	/* Nothing found */
+	cword->idents = idents;
+	return false;
+}
+
+
+/* ----------
+ * plpgsql_parse_wordtype	The scanner found word%TYPE. word can be
+ *				a variable name or a basetype.
+ *
+ * Returns datatype struct, or NULL if no match found for word.
+ * ----------
+ */
+PLpgSQL_type * plpgsql_parse_wordtype(char *ident) { return NULL; }
+
+
+
+/* ----------
+ * plpgsql_parse_cwordtype		Same lookup for compositeword%TYPE
+ * ----------
+ */
+PLpgSQL_type * plpgsql_parse_cwordtype(List *idents) { return NULL; }
+
+
+/* ----------
+ * plpgsql_parse_wordrowtype		Scanner found word%ROWTYPE.
+ *					So word must be a table name.
+ * ----------
+ */
+PLpgSQL_type * plpgsql_parse_wordrowtype(char *ident) { return NULL; }
+
+
+/* ----------
+ * plpgsql_parse_cwordrowtype		Scanner found compositeword%ROWTYPE.
+ *			So word must be a namespace qualified table name.
+ * ----------
+ */
+PLpgSQL_type * plpgsql_parse_cwordrowtype(List *idents) { return NULL; }
+
+
+/*
+ * plpgsql_build_variable - build a datum-array entry of a given
+ * datatype
+ *
+ * The returned struct may be a PLpgSQL_var, PLpgSQL_row, or
+ * PLpgSQL_rec depending on the given datatype, and is allocated via
+ * palloc.  The struct is automatically added to the current datum
+ * array, and optionally to the current namespace.
+ */
+PLpgSQL_variable *
+plpgsql_build_variable(const char *refname, int lineno, PLpgSQL_type *dtype,
+					   bool add2namespace)
+{
+	PLpgSQL_variable *result;
+
+	switch (dtype->ttype)
+	{
+		case PLPGSQL_TTYPE_SCALAR:
+			{
+				/* Ordinary scalar datatype */
+				PLpgSQL_var *var;
+
+				var = palloc0(sizeof(PLpgSQL_var));
+				var->dtype = PLPGSQL_DTYPE_VAR;
+				var->refname = pstrdup(refname);
+				var->lineno = lineno;
+				var->datatype = dtype;
+				/* other fields might be filled by caller */
+
+				/* preset to NULL */
+				var->value = 0;
+				var->isnull = true;
+				var->freeval = false;
+
+				plpgsql_adddatum((PLpgSQL_datum *) var);
+				if (add2namespace)
+					plpgsql_ns_additem(PLPGSQL_NSTYPE_VAR,
+									   var->dno,
+									   refname);
+				result = (PLpgSQL_variable *) var;
+				break;
+			}
+		case PLPGSQL_TTYPE_ROW:
+			{
+				/* Composite type -- build a row variable */
+				PLpgSQL_row *row;
+
+				row = build_row_from_class(dtype->typrelid);
+
+				row->dtype = PLPGSQL_DTYPE_ROW;
+				row->refname = pstrdup(refname);
+				row->lineno = lineno;
+
+				plpgsql_adddatum((PLpgSQL_datum *) row);
+				if (add2namespace)
+					plpgsql_ns_additem(PLPGSQL_NSTYPE_ROW,
+									   row->dno,
+									   refname);
+				result = (PLpgSQL_variable *) row;
+				break;
+			}
+		case PLPGSQL_TTYPE_REC:
+			{
+				/* "record" type -- build a record variable */
+				PLpgSQL_rec *rec;
+
+				rec = plpgsql_build_record(refname, lineno, add2namespace);
+				result = (PLpgSQL_variable *) rec;
+				break;
+			}
+		case PLPGSQL_TTYPE_PSEUDO:
+			ereport(ERROR,
+					(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+					 errmsg("variable \"%s\" has pseudo-type %s",
+							refname, format_type_be(dtype->typoid))));
+			result = NULL;		/* keep compiler quiet */
+			break;
+		default:
+			elog(ERROR, "unrecognized ttype: %d", dtype->ttype);
+			result = NULL;		/* keep compiler quiet */
+			break;
+	}
+
+	return result;
+}
+
+/*
+ * Build empty named record variable, and optionally add it to namespace
+ */
+PLpgSQL_rec *
+plpgsql_build_record(const char *refname, int lineno, bool add2namespace)
+{
+	PLpgSQL_rec *rec;
+
+	rec = palloc0(sizeof(PLpgSQL_rec));
+	rec->dtype = PLPGSQL_DTYPE_REC;
+	rec->refname = pstrdup(refname);
+	rec->lineno = lineno;
+	rec->tup = NULL;
+	rec->tupdesc = NULL;
+	rec->freetup = false;
+	plpgsql_adddatum((PLpgSQL_datum *) rec);
+	if (add2namespace)
+		plpgsql_ns_additem(PLPGSQL_NSTYPE_REC, rec->dno, rec->refname);
+
+	return rec;
+}
+
+/*
+ * Build a row-variable data structure given the pg_class OID.
+ */
+static PLpgSQL_row *build_row_from_class(Oid classOid) { return NULL; }
+
+
+/*
+ * Build a row-variable data structure given the component variables.
+ */
+
+
+/*
+ * plpgsql_build_datatype
+ *		Build PLpgSQL_type struct given type OID, typmod, and collation.
+ *
+ * If collation is not InvalidOid then it overrides the type's default
+ * collation.  But collation is ignored if the datatype is non-collatable.
+ */
+PLpgSQL_type * plpgsql_build_datatype(Oid typeOid, int32 typmod, Oid collation) { PLpgSQL_type *typ; typ = (PLpgSQL_type *) palloc0(sizeof(PLpgSQL_type)); typ->typname = pstrdup("UNKNOWN"); typ->ttype = PLPGSQL_TTYPE_SCALAR; return typ; }
+
+
+/*
+ * Utility subroutine to make a PLpgSQL_type struct given a pg_type entry
+ */
+
+
+/*
+ *	plpgsql_recognize_err_condition
+ *		Check condition name and translate it to SQLSTATE.
+ *
+ * Note: there are some cases where the same condition name has multiple
+ * entries in the table.  We arbitrarily return the first match.
+ */
+int
+plpgsql_recognize_err_condition(const char *condname, bool allow_sqlstate)
+{
+	int			i;
+
+	if (allow_sqlstate)
+	{
+		if (strlen(condname) == 5 &&
+			strspn(condname, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ") == 5)
+			return MAKE_SQLSTATE(condname[0],
+								 condname[1],
+								 condname[2],
+								 condname[3],
+								 condname[4]);
+	}
+
+	for (i = 0; exception_label_map[i].label != NULL; i++)
+	{
+		if (strcmp(condname, exception_label_map[i].label) == 0)
+			return exception_label_map[i].sqlerrstate;
+	}
+
+	ereport(ERROR,
+			(errcode(ERRCODE_UNDEFINED_OBJECT),
+			 errmsg("unrecognized exception condition \"%s\"",
+					condname)));
+	return 0;					/* keep compiler quiet */
+}
+
+/*
+ * plpgsql_parse_err_condition
+ *		Generate PLpgSQL_condition entry(s) for an exception condition name
+ *
+ * This has to be able to return a list because there are some duplicate
+ * names in the table of error code names.
+ */
+PLpgSQL_condition *
+plpgsql_parse_err_condition(char *condname)
+{
+	int			i;
+	PLpgSQL_condition *new;
+	PLpgSQL_condition *prev;
+
+	/*
+	 * XXX Eventually we will want to look for user-defined exception names
+	 * here.
+	 */
+
+	/*
+	 * OTHERS is represented as code 0 (which would map to '00000', but we
+	 * have no need to represent that as an exception condition).
+	 */
+	if (strcmp(condname, "others") == 0)
+	{
+		new = palloc(sizeof(PLpgSQL_condition));
+		new->sqlerrstate = 0;
+		new->condname = condname;
+		new->next = NULL;
+		return new;
+	}
+
+	prev = NULL;
+	for (i = 0; exception_label_map[i].label != NULL; i++)
+	{
+		if (strcmp(condname, exception_label_map[i].label) == 0)
+		{
+			new = palloc(sizeof(PLpgSQL_condition));
+			new->sqlerrstate = exception_label_map[i].sqlerrstate;
+			new->condname = condname;
+			new->next = prev;
+			prev = new;
+		}
+	}
+
+	if (!prev)
+		ereport(ERROR,
+				(errcode(ERRCODE_UNDEFINED_OBJECT),
+				 errmsg("unrecognized exception condition \"%s\"",
+						condname)));
+
+	return prev;
+}
+
+/* ----------
+ * plpgsql_adddatum			Add a variable, record or row
+ *					to the compiler's datum list.
+ * ----------
+ */
+void
+plpgsql_adddatum(PLpgSQL_datum *new)
+{
+	if (plpgsql_nDatums == datums_alloc)
+	{
+		datums_alloc *= 2;
+		plpgsql_Datums = repalloc(plpgsql_Datums, sizeof(PLpgSQL_datum *) * datums_alloc);
+	}
+
+	new->dno = plpgsql_nDatums;
+	plpgsql_Datums[plpgsql_nDatums++] = new;
+}
+
+
+/* ----------
+ * plpgsql_add_initdatums		Make an array of the datum numbers of
+ *					all the simple VAR datums created since the last call
+ *					to this function.
+ *
+ * If varnos is NULL, we just forget any datum entries created since the
+ * last call.
+ *
+ * This is used around a DECLARE section to create a list of the VARs
+ * that have to be initialized at block entry.  Note that VARs can also
+ * be created elsewhere than DECLARE, eg by a FOR-loop, but it is then
+ * the responsibility of special-purpose code to initialize them.
+ * ----------
+ */
+int
+plpgsql_add_initdatums(int **varnos)
+{
+	int			i;
+	int			n = 0;
+
+	for (i = datums_last; i < plpgsql_nDatums; i++)
+	{
+		switch (plpgsql_Datums[i]->dtype)
+		{
+			case PLPGSQL_DTYPE_VAR:
+				n++;
+				break;
+
+			default:
+				break;
+		}
+	}
+
+	if (varnos != NULL)
+	{
+		if (n > 0)
+		{
+			*varnos = (int *) palloc(sizeof(int) * n);
+
+			n = 0;
+			for (i = datums_last; i < plpgsql_nDatums; i++)
+			{
+				switch (plpgsql_Datums[i]->dtype)
+				{
+					case PLPGSQL_DTYPE_VAR:
+						(*varnos)[n++] = plpgsql_Datums[i]->dno;
+
+					default:
+						break;
+				}
+			}
+		}
+		else
+			*varnos = NULL;
+	}
+
+	datums_last = plpgsql_nDatums;
+	return n;
+}
+
+
+/*
+ * Compute the hashkey for a given function invocation
+ *
+ * The hashkey is returned into the caller-provided storage at *hashkey.
+ */
+
+
+/*
+ * This is the same as the standard resolve_polymorphic_argtypes() function,
+ * but with a special case for validation: assume that polymorphic arguments
+ * are integer, integer-array or integer-range.  Also, we go ahead and report
+ * the error if we can't resolve the types.
+ */
+
+
+/*
+ * delete_function - clean up as much as possible of a stale function cache
+ *
+ * We can't release the PLpgSQL_function struct itself, because of the
+ * possibility that there are fn_extra pointers to it.  We can release
+ * the subsidiary storage, but only if there are no active evaluations
+ * in progress.  Otherwise we'll just leak that storage.  Since the
+ * case would only occur if a pg_proc update is detected during a nested
+ * recursive call on the function, a leak seems acceptable.
+ *
+ * Note that this can be called more than once if there are multiple fn_extra
+ * pointers to the same function cache.  Hence be careful not to do things
+ * twice.
+ */
+
+
+/* exported so we can call it from plpgsql_init() */
+
+
+
+
+
+
+
diff --git a/foreign/libpg_query/src/postgres/src_pl_plpgsql_src_pl_funcs.c b/foreign/libpg_query/src/postgres/src_pl_plpgsql_src_pl_funcs.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_pl_plpgsql_src_pl_funcs.c
@@ -0,0 +1,798 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - plpgsql_ns_init
+ * - ns_top
+ * - plpgsql_ns_push
+ * - plpgsql_ns_additem
+ * - plpgsql_ns_pop
+ * - plpgsql_ns_lookup
+ * - plpgsql_ns_top
+ * - plpgsql_getdiag_kindname
+ * - plpgsql_ns_lookup_label
+ * - plpgsql_free_function_memory
+ * - free_expr
+ * - free_block
+ * - free_stmts
+ * - free_stmt
+ * - free_assign
+ * - free_if
+ * - free_case
+ * - free_loop
+ * - free_while
+ * - free_fori
+ * - free_fors
+ * - free_forc
+ * - free_foreach_a
+ * - free_exit
+ * - free_return
+ * - free_return_next
+ * - free_return_query
+ * - free_raise
+ * - free_assert
+ * - free_execsql
+ * - free_dynexecute
+ * - free_dynfors
+ * - free_getdiag
+ * - free_open
+ * - free_fetch
+ * - free_close
+ * - free_perform
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * pl_funcs.c		- Misc functions for the PL/pgSQL
+ *			  procedural language
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/pl/plpgsql/src/pl_funcs.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "plpgsql.h"
+
+#include "utils/memutils.h"
+
+
+/* ----------
+ * Local variables for namespace handling
+ *
+ * The namespace structure actually forms a tree, of which only one linear
+ * list or "chain" (from the youngest item to the root) is accessible from
+ * any one plpgsql statement.  During initial parsing of a function, ns_top
+ * points to the youngest item accessible from the block currently being
+ * parsed.  We store the entire tree, however, since at runtime we will need
+ * to access the chain that's relevant to any one statement.
+ *
+ * Block boundaries in the namespace chain are marked by PLPGSQL_NSTYPE_LABEL
+ * items.
+ * ----------
+ */
+static PLpgSQL_nsitem *ns_top = NULL;
+
+
+/* ----------
+ * plpgsql_ns_init			Initialize namespace processing for a new function
+ * ----------
+ */
+void
+plpgsql_ns_init(void)
+{
+	ns_top = NULL;
+}
+
+
+/* ----------
+ * plpgsql_ns_push			Create a new namespace level
+ * ----------
+ */
+void
+plpgsql_ns_push(const char *label)
+{
+	if (label == NULL)
+		label = "";
+	plpgsql_ns_additem(PLPGSQL_NSTYPE_LABEL, 0, label);
+}
+
+
+/* ----------
+ * plpgsql_ns_pop			Pop entries back to (and including) the last label
+ * ----------
+ */
+void
+plpgsql_ns_pop(void)
+{
+	Assert(ns_top != NULL);
+	while (ns_top->itemtype != PLPGSQL_NSTYPE_LABEL)
+		ns_top = ns_top->prev;
+	ns_top = ns_top->prev;
+}
+
+
+/* ----------
+ * plpgsql_ns_top			Fetch the current namespace chain end
+ * ----------
+ */
+PLpgSQL_nsitem *
+plpgsql_ns_top(void)
+{
+	return ns_top;
+}
+
+
+/* ----------
+ * plpgsql_ns_additem		Add an item to the current namespace chain
+ * ----------
+ */
+void
+plpgsql_ns_additem(int itemtype, int itemno, const char *name)
+{
+	PLpgSQL_nsitem *nse;
+
+	Assert(name != NULL);
+	/* first item added must be a label */
+	Assert(ns_top != NULL || itemtype == PLPGSQL_NSTYPE_LABEL);
+
+	nse = palloc(offsetof(PLpgSQL_nsitem, name) +strlen(name) + 1);
+	nse->itemtype = itemtype;
+	nse->itemno = itemno;
+	nse->prev = ns_top;
+	strcpy(nse->name, name);
+	ns_top = nse;
+}
+
+
+/* ----------
+ * plpgsql_ns_lookup		Lookup an identifier in the given namespace chain
+ *
+ * Note that this only searches for variables, not labels.
+ *
+ * If localmode is TRUE, only the topmost block level is searched.
+ *
+ * name1 must be non-NULL.  Pass NULL for name2 and/or name3 if parsing a name
+ * with fewer than three components.
+ *
+ * If names_used isn't NULL, *names_used receives the number of names
+ * matched: 0 if no match, 1 if name1 matched an unqualified variable name,
+ * 2 if name1 and name2 matched a block label + variable name.
+ *
+ * Note that name3 is never directly matched to anything.  However, if it
+ * isn't NULL, we will disregard qualified matches to scalar variables.
+ * Similarly, if name2 isn't NULL, we disregard unqualified matches to
+ * scalar variables.
+ * ----------
+ */
+PLpgSQL_nsitem *
+plpgsql_ns_lookup(PLpgSQL_nsitem *ns_cur, bool localmode,
+				  const char *name1, const char *name2, const char *name3,
+				  int *names_used)
+{
+	/* Outer loop iterates once per block level in the namespace chain */
+	while (ns_cur != NULL)
+	{
+		PLpgSQL_nsitem *nsitem;
+
+		/* Check this level for unqualified match to variable name */
+		for (nsitem = ns_cur;
+			 nsitem->itemtype != PLPGSQL_NSTYPE_LABEL;
+			 nsitem = nsitem->prev)
+		{
+			if (strcmp(nsitem->name, name1) == 0)
+			{
+				if (name2 == NULL ||
+					nsitem->itemtype != PLPGSQL_NSTYPE_VAR)
+				{
+					if (names_used)
+						*names_used = 1;
+					return nsitem;
+				}
+			}
+		}
+
+		/* Check this level for qualified match to variable name */
+		if (name2 != NULL &&
+			strcmp(nsitem->name, name1) == 0)
+		{
+			for (nsitem = ns_cur;
+				 nsitem->itemtype != PLPGSQL_NSTYPE_LABEL;
+				 nsitem = nsitem->prev)
+			{
+				if (strcmp(nsitem->name, name2) == 0)
+				{
+					if (name3 == NULL ||
+						nsitem->itemtype != PLPGSQL_NSTYPE_VAR)
+					{
+						if (names_used)
+							*names_used = 2;
+						return nsitem;
+					}
+				}
+			}
+		}
+
+		if (localmode)
+			break;				/* do not look into upper levels */
+
+		ns_cur = nsitem->prev;
+	}
+
+	/* This is just to suppress possibly-uninitialized-variable warnings */
+	if (names_used)
+		*names_used = 0;
+	return NULL;				/* No match found */
+}
+
+
+/* ----------
+ * plpgsql_ns_lookup_label		Lookup a label in the given namespace chain
+ * ----------
+ */
+PLpgSQL_nsitem *
+plpgsql_ns_lookup_label(PLpgSQL_nsitem *ns_cur, const char *name)
+{
+	while (ns_cur != NULL)
+	{
+		if (ns_cur->itemtype == PLPGSQL_NSTYPE_LABEL &&
+			strcmp(ns_cur->name, name) == 0)
+			return ns_cur;
+		ns_cur = ns_cur->prev;
+	}
+
+	return NULL;				/* label not found */
+}
+
+
+/*
+ * Statement type as a string, for use in error messages etc.
+ */
+
+
+/*
+ * GET DIAGNOSTICS item name as a string, for use in error messages etc.
+ */
+const char *
+plpgsql_getdiag_kindname(int kind)
+{
+	switch (kind)
+	{
+		case PLPGSQL_GETDIAG_ROW_COUNT:
+			return "ROW_COUNT";
+		case PLPGSQL_GETDIAG_RESULT_OID:
+			return "RESULT_OID";
+		case PLPGSQL_GETDIAG_CONTEXT:
+			return "PG_CONTEXT";
+		case PLPGSQL_GETDIAG_ERROR_CONTEXT:
+			return "PG_EXCEPTION_CONTEXT";
+		case PLPGSQL_GETDIAG_ERROR_DETAIL:
+			return "PG_EXCEPTION_DETAIL";
+		case PLPGSQL_GETDIAG_ERROR_HINT:
+			return "PG_EXCEPTION_HINT";
+		case PLPGSQL_GETDIAG_RETURNED_SQLSTATE:
+			return "RETURNED_SQLSTATE";
+		case PLPGSQL_GETDIAG_COLUMN_NAME:
+			return "COLUMN_NAME";
+		case PLPGSQL_GETDIAG_CONSTRAINT_NAME:
+			return "CONSTRAINT_NAME";
+		case PLPGSQL_GETDIAG_DATATYPE_NAME:
+			return "PG_DATATYPE_NAME";
+		case PLPGSQL_GETDIAG_MESSAGE_TEXT:
+			return "MESSAGE_TEXT";
+		case PLPGSQL_GETDIAG_TABLE_NAME:
+			return "TABLE_NAME";
+		case PLPGSQL_GETDIAG_SCHEMA_NAME:
+			return "SCHEMA_NAME";
+	}
+
+	return "unknown";
+}
+
+
+/**********************************************************************
+ * Release memory when a PL/pgSQL function is no longer needed
+ *
+ * The code for recursing through the function tree is really only
+ * needed to locate PLpgSQL_expr nodes, which may contain references
+ * to saved SPI Plans that must be freed.  The function tree itself,
+ * along with subsidiary data, is freed in one swoop by freeing the
+ * function's permanent memory context.
+ **********************************************************************/
+static void free_stmt(PLpgSQL_stmt *stmt);
+static void free_block(PLpgSQL_stmt_block *block);
+static void free_assign(PLpgSQL_stmt_assign *stmt);
+static void free_if(PLpgSQL_stmt_if *stmt);
+static void free_case(PLpgSQL_stmt_case *stmt);
+static void free_loop(PLpgSQL_stmt_loop *stmt);
+static void free_while(PLpgSQL_stmt_while *stmt);
+static void free_fori(PLpgSQL_stmt_fori *stmt);
+static void free_fors(PLpgSQL_stmt_fors *stmt);
+static void free_forc(PLpgSQL_stmt_forc *stmt);
+static void free_foreach_a(PLpgSQL_stmt_foreach_a *stmt);
+static void free_exit(PLpgSQL_stmt_exit *stmt);
+static void free_return(PLpgSQL_stmt_return *stmt);
+static void free_return_next(PLpgSQL_stmt_return_next *stmt);
+static void free_return_query(PLpgSQL_stmt_return_query *stmt);
+static void free_raise(PLpgSQL_stmt_raise *stmt);
+static void free_assert(PLpgSQL_stmt_assert *stmt);
+static void free_execsql(PLpgSQL_stmt_execsql *stmt);
+static void free_dynexecute(PLpgSQL_stmt_dynexecute *stmt);
+static void free_dynfors(PLpgSQL_stmt_dynfors *stmt);
+static void free_getdiag(PLpgSQL_stmt_getdiag *stmt);
+static void free_open(PLpgSQL_stmt_open *stmt);
+static void free_fetch(PLpgSQL_stmt_fetch *stmt);
+static void free_close(PLpgSQL_stmt_close *stmt);
+static void free_perform(PLpgSQL_stmt_perform *stmt);
+static void free_expr(PLpgSQL_expr *expr);
+
+
+static void
+free_stmt(PLpgSQL_stmt *stmt)
+{
+	switch ((enum PLpgSQL_stmt_types) stmt->cmd_type)
+	{
+		case PLPGSQL_STMT_BLOCK:
+			free_block((PLpgSQL_stmt_block *) stmt);
+			break;
+		case PLPGSQL_STMT_ASSIGN:
+			free_assign((PLpgSQL_stmt_assign *) stmt);
+			break;
+		case PLPGSQL_STMT_IF:
+			free_if((PLpgSQL_stmt_if *) stmt);
+			break;
+		case PLPGSQL_STMT_CASE:
+			free_case((PLpgSQL_stmt_case *) stmt);
+			break;
+		case PLPGSQL_STMT_LOOP:
+			free_loop((PLpgSQL_stmt_loop *) stmt);
+			break;
+		case PLPGSQL_STMT_WHILE:
+			free_while((PLpgSQL_stmt_while *) stmt);
+			break;
+		case PLPGSQL_STMT_FORI:
+			free_fori((PLpgSQL_stmt_fori *) stmt);
+			break;
+		case PLPGSQL_STMT_FORS:
+			free_fors((PLpgSQL_stmt_fors *) stmt);
+			break;
+		case PLPGSQL_STMT_FORC:
+			free_forc((PLpgSQL_stmt_forc *) stmt);
+			break;
+		case PLPGSQL_STMT_FOREACH_A:
+			free_foreach_a((PLpgSQL_stmt_foreach_a *) stmt);
+			break;
+		case PLPGSQL_STMT_EXIT:
+			free_exit((PLpgSQL_stmt_exit *) stmt);
+			break;
+		case PLPGSQL_STMT_RETURN:
+			free_return((PLpgSQL_stmt_return *) stmt);
+			break;
+		case PLPGSQL_STMT_RETURN_NEXT:
+			free_return_next((PLpgSQL_stmt_return_next *) stmt);
+			break;
+		case PLPGSQL_STMT_RETURN_QUERY:
+			free_return_query((PLpgSQL_stmt_return_query *) stmt);
+			break;
+		case PLPGSQL_STMT_RAISE:
+			free_raise((PLpgSQL_stmt_raise *) stmt);
+			break;
+		case PLPGSQL_STMT_ASSERT:
+			free_assert((PLpgSQL_stmt_assert *) stmt);
+			break;
+		case PLPGSQL_STMT_EXECSQL:
+			free_execsql((PLpgSQL_stmt_execsql *) stmt);
+			break;
+		case PLPGSQL_STMT_DYNEXECUTE:
+			free_dynexecute((PLpgSQL_stmt_dynexecute *) stmt);
+			break;
+		case PLPGSQL_STMT_DYNFORS:
+			free_dynfors((PLpgSQL_stmt_dynfors *) stmt);
+			break;
+		case PLPGSQL_STMT_GETDIAG:
+			free_getdiag((PLpgSQL_stmt_getdiag *) stmt);
+			break;
+		case PLPGSQL_STMT_OPEN:
+			free_open((PLpgSQL_stmt_open *) stmt);
+			break;
+		case PLPGSQL_STMT_FETCH:
+			free_fetch((PLpgSQL_stmt_fetch *) stmt);
+			break;
+		case PLPGSQL_STMT_CLOSE:
+			free_close((PLpgSQL_stmt_close *) stmt);
+			break;
+		case PLPGSQL_STMT_PERFORM:
+			free_perform((PLpgSQL_stmt_perform *) stmt);
+			break;
+		default:
+			elog(ERROR, "unrecognized cmd_type: %d", stmt->cmd_type);
+			break;
+	}
+}
+
+static void
+free_stmts(List *stmts)
+{
+	ListCell   *s;
+
+	foreach(s, stmts)
+	{
+		free_stmt((PLpgSQL_stmt *) lfirst(s));
+	}
+}
+
+static void
+free_block(PLpgSQL_stmt_block *block)
+{
+	free_stmts(block->body);
+	if (block->exceptions)
+	{
+		ListCell   *e;
+
+		foreach(e, block->exceptions->exc_list)
+		{
+			PLpgSQL_exception *exc = (PLpgSQL_exception *) lfirst(e);
+
+			free_stmts(exc->action);
+		}
+	}
+}
+
+static void
+free_assign(PLpgSQL_stmt_assign *stmt)
+{
+	free_expr(stmt->expr);
+}
+
+static void
+free_if(PLpgSQL_stmt_if *stmt)
+{
+	ListCell   *l;
+
+	free_expr(stmt->cond);
+	free_stmts(stmt->then_body);
+	foreach(l, stmt->elsif_list)
+	{
+		PLpgSQL_if_elsif *elif = (PLpgSQL_if_elsif *) lfirst(l);
+
+		free_expr(elif->cond);
+		free_stmts(elif->stmts);
+	}
+	free_stmts(stmt->else_body);
+}
+
+static void
+free_case(PLpgSQL_stmt_case *stmt)
+{
+	ListCell   *l;
+
+	free_expr(stmt->t_expr);
+	foreach(l, stmt->case_when_list)
+	{
+		PLpgSQL_case_when *cwt = (PLpgSQL_case_when *) lfirst(l);
+
+		free_expr(cwt->expr);
+		free_stmts(cwt->stmts);
+	}
+	free_stmts(stmt->else_stmts);
+}
+
+static void
+free_loop(PLpgSQL_stmt_loop *stmt)
+{
+	free_stmts(stmt->body);
+}
+
+static void
+free_while(PLpgSQL_stmt_while *stmt)
+{
+	free_expr(stmt->cond);
+	free_stmts(stmt->body);
+}
+
+static void
+free_fori(PLpgSQL_stmt_fori *stmt)
+{
+	free_expr(stmt->lower);
+	free_expr(stmt->upper);
+	free_expr(stmt->step);
+	free_stmts(stmt->body);
+}
+
+static void
+free_fors(PLpgSQL_stmt_fors *stmt)
+{
+	free_stmts(stmt->body);
+	free_expr(stmt->query);
+}
+
+static void
+free_forc(PLpgSQL_stmt_forc *stmt)
+{
+	free_stmts(stmt->body);
+	free_expr(stmt->argquery);
+}
+
+static void
+free_foreach_a(PLpgSQL_stmt_foreach_a *stmt)
+{
+	free_expr(stmt->expr);
+	free_stmts(stmt->body);
+}
+
+static void
+free_open(PLpgSQL_stmt_open *stmt)
+{
+	ListCell   *lc;
+
+	free_expr(stmt->argquery);
+	free_expr(stmt->query);
+	free_expr(stmt->dynquery);
+	foreach(lc, stmt->params)
+	{
+		free_expr((PLpgSQL_expr *) lfirst(lc));
+	}
+}
+
+static void
+free_fetch(PLpgSQL_stmt_fetch *stmt)
+{
+	free_expr(stmt->expr);
+}
+
+static void
+free_close(PLpgSQL_stmt_close *stmt)
+{
+}
+
+static void
+free_perform(PLpgSQL_stmt_perform *stmt)
+{
+	free_expr(stmt->expr);
+}
+
+static void
+free_exit(PLpgSQL_stmt_exit *stmt)
+{
+	free_expr(stmt->cond);
+}
+
+static void
+free_return(PLpgSQL_stmt_return *stmt)
+{
+	free_expr(stmt->expr);
+}
+
+static void
+free_return_next(PLpgSQL_stmt_return_next *stmt)
+{
+	free_expr(stmt->expr);
+}
+
+static void
+free_return_query(PLpgSQL_stmt_return_query *stmt)
+{
+	ListCell   *lc;
+
+	free_expr(stmt->query);
+	free_expr(stmt->dynquery);
+	foreach(lc, stmt->params)
+	{
+		free_expr((PLpgSQL_expr *) lfirst(lc));
+	}
+}
+
+static void
+free_raise(PLpgSQL_stmt_raise *stmt)
+{
+	ListCell   *lc;
+
+	foreach(lc, stmt->params)
+	{
+		free_expr((PLpgSQL_expr *) lfirst(lc));
+	}
+	foreach(lc, stmt->options)
+	{
+		PLpgSQL_raise_option *opt = (PLpgSQL_raise_option *) lfirst(lc);
+
+		free_expr(opt->expr);
+	}
+}
+
+static void
+free_assert(PLpgSQL_stmt_assert *stmt)
+{
+	free_expr(stmt->cond);
+	free_expr(stmt->message);
+}
+
+static void
+free_execsql(PLpgSQL_stmt_execsql *stmt)
+{
+	free_expr(stmt->sqlstmt);
+}
+
+static void
+free_dynexecute(PLpgSQL_stmt_dynexecute *stmt)
+{
+	ListCell   *lc;
+
+	free_expr(stmt->query);
+	foreach(lc, stmt->params)
+	{
+		free_expr((PLpgSQL_expr *) lfirst(lc));
+	}
+}
+
+static void
+free_dynfors(PLpgSQL_stmt_dynfors *stmt)
+{
+	ListCell   *lc;
+
+	free_stmts(stmt->body);
+	free_expr(stmt->query);
+	foreach(lc, stmt->params)
+	{
+		free_expr((PLpgSQL_expr *) lfirst(lc));
+	}
+}
+
+static void
+free_getdiag(PLpgSQL_stmt_getdiag *stmt)
+{
+}
+
+static void free_expr(PLpgSQL_expr *expr) {}
+
+
+void
+plpgsql_free_function_memory(PLpgSQL_function *func)
+{
+	int			i;
+
+	/* Better not call this on an in-use function */
+	Assert(func->use_count == 0);
+
+	/* Release plans associated with variable declarations */
+	for (i = 0; i < func->ndatums; i++)
+	{
+		PLpgSQL_datum *d = func->datums[i];
+
+		switch (d->dtype)
+		{
+			case PLPGSQL_DTYPE_VAR:
+				{
+					PLpgSQL_var *var = (PLpgSQL_var *) d;
+
+					free_expr(var->default_val);
+					free_expr(var->cursor_explicit_expr);
+				}
+				break;
+			case PLPGSQL_DTYPE_ROW:
+				break;
+			case PLPGSQL_DTYPE_REC:
+				break;
+			case PLPGSQL_DTYPE_RECFIELD:
+				break;
+			case PLPGSQL_DTYPE_ARRAYELEM:
+				free_expr(((PLpgSQL_arrayelem *) d)->subscript);
+				break;
+			default:
+				elog(ERROR, "unrecognized data type: %d", d->dtype);
+		}
+	}
+	func->ndatums = 0;
+
+	/* Release plans in statement tree */
+	if (func->action)
+		free_block(func->action);
+	func->action = NULL;
+
+	/*
+	 * And finally, release all memory except the PLpgSQL_function struct
+	 * itself (which has to be kept around because there may be multiple
+	 * fn_extra pointers to it).
+	 */
+	if (func->fn_cxt)
+		MemoryContextDelete(func->fn_cxt);
+	func->fn_cxt = NULL;
+}
+
+
+/**********************************************************************
+ * Debug functions for analyzing the compiled code
+ **********************************************************************/
+
+
+static void dump_ind(void);
+static void dump_stmt(PLpgSQL_stmt *stmt);
+static void dump_block(PLpgSQL_stmt_block *block);
+static void dump_assign(PLpgSQL_stmt_assign *stmt);
+static void dump_if(PLpgSQL_stmt_if *stmt);
+static void dump_case(PLpgSQL_stmt_case *stmt);
+static void dump_loop(PLpgSQL_stmt_loop *stmt);
+static void dump_while(PLpgSQL_stmt_while *stmt);
+static void dump_fori(PLpgSQL_stmt_fori *stmt);
+static void dump_fors(PLpgSQL_stmt_fors *stmt);
+static void dump_forc(PLpgSQL_stmt_forc *stmt);
+static void dump_foreach_a(PLpgSQL_stmt_foreach_a *stmt);
+static void dump_exit(PLpgSQL_stmt_exit *stmt);
+static void dump_return(PLpgSQL_stmt_return *stmt);
+static void dump_return_next(PLpgSQL_stmt_return_next *stmt);
+static void dump_return_query(PLpgSQL_stmt_return_query *stmt);
+static void dump_raise(PLpgSQL_stmt_raise *stmt);
+static void dump_assert(PLpgSQL_stmt_assert *stmt);
+static void dump_execsql(PLpgSQL_stmt_execsql *stmt);
+static void dump_dynexecute(PLpgSQL_stmt_dynexecute *stmt);
+static void dump_dynfors(PLpgSQL_stmt_dynfors *stmt);
+static void dump_getdiag(PLpgSQL_stmt_getdiag *stmt);
+static void dump_open(PLpgSQL_stmt_open *stmt);
+static void dump_fetch(PLpgSQL_stmt_fetch *stmt);
+static void dump_cursor_direction(PLpgSQL_stmt_fetch *stmt);
+static void dump_close(PLpgSQL_stmt_close *stmt);
+static void dump_perform(PLpgSQL_stmt_perform *stmt);
+static void dump_expr(PLpgSQL_expr *expr);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/foreign/libpg_query/src/postgres/src_pl_plpgsql_src_pl_gram.c b/foreign/libpg_query/src/postgres/src_pl_plpgsql_src_pl_gram.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_pl_plpgsql_src_pl_gram.c
@@ -0,0 +1,6151 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - plpgsql_yyparse
+ * - plpgsql_yynerrs
+ * - plpgsql_yychar
+ * - plpgsql_yylloc
+ * - plpgsql_yylval
+ * - yypact
+ * - yytranslate
+ * - yycheck
+ * - yytable
+ * - yydefact
+ * - yyr2
+ * - check_labels
+ * - read_sql_stmt
+ * - read_datatype
+ * - parse_datatype
+ * - read_sql_expression
+ * - tok_is_keyword
+ * - check_assignable
+ * - NameOfDatum
+ * - word_is_not_variable
+ * - cword_is_not_variable
+ * - make_case
+ * - read_sql_expression2
+ * - make_scalar_list1
+ * - read_cursor_args
+ * - read_sql_construct
+ * - check_sql_expr
+ * - plpgsql_sql_error_callback
+ * - read_into_scalar_list
+ * - current_token_is_not_variable
+ * - make_return_next_stmt
+ * - make_return_query_stmt
+ * - make_return_stmt
+ * - read_raise_options
+ * - check_raise_parameters
+ * - make_execsql_stmt
+ * - read_into_target
+ * - read_fetch_direction
+ * - complete_direction
+ * - yyr1
+ * - yypgoto
+ * - yydefgoto
+ * - yydestruct
+ * - yystos
+ *--------------------------------------------------------------------
+ */
+
+/* A Bison parser, made by GNU Bison 3.0.2.  */
+
+/* Bison implementation for Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+   simplifying the original so-called "semantic" parser.  */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+   infringing on user name space.  This should be done even for local
+   variables, as they might otherwise be expanded by user macros.
+   There are some unavoidable exceptions within include files to
+   define necessary library symbols; they are noted "INFRINGES ON
+   USER NAME SPACE" below.  */
+
+/* Identify Bison output.  */
+#define YYBISON 1
+
+/* Bison version.  */
+#define YYBISON_VERSION "3.0.2"
+
+/* Skeleton name.  */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers.  */
+#define YYPURE 0
+
+/* Push parsers.  */
+#define YYPUSH 0
+
+/* Pull parsers.  */
+#define YYPULL 1
+
+
+/* Substitute the variable and function names.  */
+#define yyparse         plpgsql_yyparse
+#define yylex           plpgsql_yylex
+#define yyerror         plpgsql_yyerror
+#define yydebug         plpgsql_yydebug
+#define yynerrs         plpgsql_yynerrs
+
+#define yylval          plpgsql_yylval
+#define yychar          plpgsql_yychar
+#define yylloc          plpgsql_yylloc
+
+/* Copy the first part of user declarations.  */
+#line 1 "pl_gram.y" /* yacc.c:339  */
+
+/*-------------------------------------------------------------------------
+ *
+ * pl_gram.y			- Parser for the PL/pgSQL procedural language
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/pl/plpgsql/src/pl_gram.y
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "plpgsql.h"
+
+#include "catalog/namespace.h"
+#include "catalog/pg_type.h"
+#include "parser/parser.h"
+#include "parser/parse_type.h"
+#include "parser/scanner.h"
+#include "parser/scansup.h"
+#include "utils/builtins.h"
+
+
+/* Location tracking support --- simpler than bison's default */
+#define YYLLOC_DEFAULT(Current, Rhs, N) \
+	do { \
+		if (N) \
+			(Current) = (Rhs)[1]; \
+		else \
+			(Current) = (Rhs)[0]; \
+	} while (0)
+
+/*
+ * Bison doesn't allocate anything that needs to live across parser calls,
+ * so we can easily have it use palloc instead of malloc.  This prevents
+ * memory leaks if we error out during parsing.  Note this only works with
+ * bison >= 2.0.  However, in bison 1.875 the default is to use alloca()
+ * if possible, so there's not really much problem anyhow, at least if
+ * you're building with gcc.
+ */
+#define YYMALLOC palloc
+#define YYFREE   pfree
+
+
+typedef struct
+{
+	int			location;
+	int			leaderlen;
+} sql_error_callback_arg;
+
+#define parser_errposition(pos)  plpgsql_scanner_errposition(pos)
+
+union YYSTYPE;					/* need forward reference for tok_is_keyword */
+
+static	bool			tok_is_keyword(int token, union YYSTYPE *lval,
+									   int kw_token, const char *kw_str);
+static	void			word_is_not_variable(PLword *word, int location);
+static	void			cword_is_not_variable(PLcword *cword, int location);
+static	void			current_token_is_not_variable(int tok);
+static	PLpgSQL_expr	*read_sql_construct(int until,
+											int until2,
+											int until3,
+											const char *expected,
+											const char *sqlstart,
+											bool isexpression,
+											bool valid_sql,
+											bool trim,
+											int *startloc,
+											int *endtoken);
+static	PLpgSQL_expr	*read_sql_expression(int until,
+											 const char *expected);
+static	PLpgSQL_expr	*read_sql_expression2(int until, int until2,
+											  const char *expected,
+											  int *endtoken);
+static	PLpgSQL_expr	*read_sql_stmt(const char *sqlstart);
+static	PLpgSQL_type	*read_datatype(int tok);
+static	PLpgSQL_stmt	*make_execsql_stmt(int firsttoken, int location);
+static	PLpgSQL_stmt_fetch *read_fetch_direction(void);
+static	void			 complete_direction(PLpgSQL_stmt_fetch *fetch,
+											bool *check_FROM);
+static	PLpgSQL_stmt	*make_return_stmt(int location);
+static	PLpgSQL_stmt	*make_return_next_stmt(int location);
+static	PLpgSQL_stmt	*make_return_query_stmt(int location);
+static  PLpgSQL_stmt	*make_case(int location, PLpgSQL_expr *t_expr,
+								   List *case_when_list, List *else_stmts);
+static	char			*NameOfDatum(PLwdatum *wdatum);
+static	void			 check_assignable(PLpgSQL_datum *datum, int location);
+static	void			 read_into_target(PLpgSQL_rec **rec, PLpgSQL_row **row,
+										  bool *strict);
+static	PLpgSQL_row		*read_into_scalar_list(char *initial_name,
+											   PLpgSQL_datum *initial_datum,
+											   int initial_location);
+static	PLpgSQL_row		*make_scalar_list1(char *initial_name,
+										   PLpgSQL_datum *initial_datum,
+										   int lineno, int location);
+static	void			 check_sql_expr(const char *stmt, int location,
+										int leaderlen);
+static	void			 plpgsql_sql_error_callback(void *arg);
+static	PLpgSQL_type	*parse_datatype(const char *string, int location);
+static	void			 check_labels(const char *start_label,
+									  const char *end_label,
+									  int end_location);
+static	PLpgSQL_expr	*read_cursor_args(PLpgSQL_var *cursor,
+										  int until, const char *expected);
+static	List			*read_raise_options(void);
+static	void			check_raise_parameters(PLpgSQL_stmt_raise *stmt);
+
+
+#line 187 "pl_gram.c" /* yacc.c:339  */
+
+# ifndef YY_NULLPTR
+#  if defined __cplusplus && 201103L <= __cplusplus
+#   define YY_NULLPTR nullptr
+#  else
+#   define YY_NULLPTR 0
+#  endif
+# endif
+
+/* Enabling verbose error messages.  */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* In a future release of Bison, this section will be replaced
+   by #include "pl_gram.h".  */
+#ifndef YY_PLPGSQL_YY_PL_GRAM_H_INCLUDED
+# define YY_PLPGSQL_YY_PL_GRAM_H_INCLUDED
+/* Debug traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int plpgsql_yydebug;
+#endif
+
+/* Token type.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+  enum yytokentype
+  {
+    IDENT = 258,
+    FCONST = 259,
+    SCONST = 260,
+    BCONST = 261,
+    XCONST = 262,
+    Op = 263,
+    ICONST = 264,
+    PARAM = 265,
+    TYPECAST = 266,
+    DOT_DOT = 267,
+    COLON_EQUALS = 268,
+    EQUALS_GREATER = 269,
+    LESS_EQUALS = 270,
+    GREATER_EQUALS = 271,
+    NOT_EQUALS = 272,
+    T_WORD = 273,
+    T_CWORD = 274,
+    T_DATUM = 275,
+    LESS_LESS = 276,
+    GREATER_GREATER = 277,
+    K_ABSOLUTE = 278,
+    K_ALIAS = 279,
+    K_ALL = 280,
+    K_ARRAY = 281,
+    K_ASSERT = 282,
+    K_BACKWARD = 283,
+    K_BEGIN = 284,
+    K_BY = 285,
+    K_CASE = 286,
+    K_CLOSE = 287,
+    K_COLLATE = 288,
+    K_COLUMN = 289,
+    K_COLUMN_NAME = 290,
+    K_CONSTANT = 291,
+    K_CONSTRAINT = 292,
+    K_CONSTRAINT_NAME = 293,
+    K_CONTINUE = 294,
+    K_CURRENT = 295,
+    K_CURSOR = 296,
+    K_DATATYPE = 297,
+    K_DEBUG = 298,
+    K_DECLARE = 299,
+    K_DEFAULT = 300,
+    K_DETAIL = 301,
+    K_DIAGNOSTICS = 302,
+    K_DUMP = 303,
+    K_ELSE = 304,
+    K_ELSIF = 305,
+    K_END = 306,
+    K_ERRCODE = 307,
+    K_ERROR = 308,
+    K_EXCEPTION = 309,
+    K_EXECUTE = 310,
+    K_EXIT = 311,
+    K_FETCH = 312,
+    K_FIRST = 313,
+    K_FOR = 314,
+    K_FOREACH = 315,
+    K_FORWARD = 316,
+    K_FROM = 317,
+    K_GET = 318,
+    K_HINT = 319,
+    K_IF = 320,
+    K_IN = 321,
+    K_INFO = 322,
+    K_INSERT = 323,
+    K_INTO = 324,
+    K_IS = 325,
+    K_LAST = 326,
+    K_LOG = 327,
+    K_LOOP = 328,
+    K_MESSAGE = 329,
+    K_MESSAGE_TEXT = 330,
+    K_MOVE = 331,
+    K_NEXT = 332,
+    K_NO = 333,
+    K_NOT = 334,
+    K_NOTICE = 335,
+    K_NULL = 336,
+    K_OPEN = 337,
+    K_OPTION = 338,
+    K_OR = 339,
+    K_PERFORM = 340,
+    K_PG_CONTEXT = 341,
+    K_PG_DATATYPE_NAME = 342,
+    K_PG_EXCEPTION_CONTEXT = 343,
+    K_PG_EXCEPTION_DETAIL = 344,
+    K_PG_EXCEPTION_HINT = 345,
+    K_PRINT_STRICT_PARAMS = 346,
+    K_PRIOR = 347,
+    K_QUERY = 348,
+    K_RAISE = 349,
+    K_RELATIVE = 350,
+    K_RESULT_OID = 351,
+    K_RETURN = 352,
+    K_RETURNED_SQLSTATE = 353,
+    K_REVERSE = 354,
+    K_ROW_COUNT = 355,
+    K_ROWTYPE = 356,
+    K_SCHEMA = 357,
+    K_SCHEMA_NAME = 358,
+    K_SCROLL = 359,
+    K_SLICE = 360,
+    K_SQLSTATE = 361,
+    K_STACKED = 362,
+    K_STRICT = 363,
+    K_TABLE = 364,
+    K_TABLE_NAME = 365,
+    K_THEN = 366,
+    K_TO = 367,
+    K_TYPE = 368,
+    K_USE_COLUMN = 369,
+    K_USE_VARIABLE = 370,
+    K_USING = 371,
+    K_VARIABLE_CONFLICT = 372,
+    K_WARNING = 373,
+    K_WHEN = 374,
+    K_WHILE = 375
+  };
+#endif
+
+/* Value type.  */
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE YYSTYPE;
+union YYSTYPE
+{
+#line 117 "pl_gram.y" /* yacc.c:355  */
+
+		core_YYSTYPE			core_yystype;
+		/* these fields must match core_YYSTYPE: */
+		int						ival;
+		char					*str;
+		const char				*keyword;
+
+		PLword					word;
+		PLcword					cword;
+		PLwdatum				wdatum;
+		bool					boolean;
+		Oid						oid;
+		struct
+		{
+			char *name;
+			int  lineno;
+		}						varname;
+		struct
+		{
+			char *name;
+			int  lineno;
+			PLpgSQL_datum   *scalar;
+			PLpgSQL_rec		*rec;
+			PLpgSQL_row		*row;
+		}						forvariable;
+		struct
+		{
+			char *label;
+			int  n_initvars;
+			int  *initvarnos;
+		}						declhdr;
+		struct
+		{
+			List *stmts;
+			char *end_label;
+			int   end_label_location;
+		}						loop_body;
+		List					*list;
+		PLpgSQL_type			*dtype;
+		PLpgSQL_datum			*datum;
+		PLpgSQL_var				*var;
+		PLpgSQL_expr			*expr;
+		PLpgSQL_stmt			*stmt;
+		PLpgSQL_condition		*condition;
+		PLpgSQL_exception		*exception;
+		PLpgSQL_exception_block	*exception_block;
+		PLpgSQL_nsitem			*nsitem;
+		PLpgSQL_diag_item		*diagitem;
+		PLpgSQL_stmt_fetch		*fetch;
+		PLpgSQL_case_when		*casewhen;
+
+#line 400 "pl_gram.c" /* yacc.c:355  */
+};
+# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* Location type.  */
+#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
+typedef struct YYLTYPE YYLTYPE;
+struct YYLTYPE
+{
+  int first_line;
+  int first_column;
+  int last_line;
+  int last_column;
+};
+# define YYLTYPE_IS_DECLARED 1
+# define YYLTYPE_IS_TRIVIAL 1
+#endif
+
+
+extern __thread  YYSTYPE plpgsql_yylval;
+extern __thread  YYLTYPE plpgsql_yylloc;
+int plpgsql_yyparse (void);
+
+#endif /* !YY_PLPGSQL_YY_PL_GRAM_H_INCLUDED  */
+
+/* Copy the second part of user declarations.  */
+
+#line 429 "pl_gram.c" /* yacc.c:358  */
+
+#ifdef short
+# undef short
+#endif
+
+#ifdef YYTYPE_UINT8
+typedef YYTYPE_UINT8 yytype_uint8;
+#else
+typedef unsigned char yytype_uint8;
+#endif
+
+#ifdef YYTYPE_INT8
+typedef YYTYPE_INT8 yytype_int8;
+#else
+typedef signed char yytype_int8;
+#endif
+
+#ifdef YYTYPE_UINT16
+typedef YYTYPE_UINT16 yytype_uint16;
+#else
+typedef unsigned short int yytype_uint16;
+#endif
+
+#ifdef YYTYPE_INT16
+typedef YYTYPE_INT16 yytype_int16;
+#else
+typedef short int yytype_int16;
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+#  define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+#  define YYSIZE_T size_t
+# elif ! defined YYSIZE_T
+#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYSIZE_T size_t
+# else
+#  define YYSIZE_T unsigned int
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+#  if ENABLE_NLS
+#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
+#  endif
+# endif
+# ifndef YY_
+#  define YY_(Msgid) Msgid
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__                                               \
+      && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
+     || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+#  define YY_ATTRIBUTE(Spec) /* empty */
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+# if defined _MSC_VER && 1200 <= _MSC_VER
+#  define _Noreturn __declspec (noreturn)
+# else
+#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E.  */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(E) ((void) (E))
+#else
+# define YYUSE(E) /* empty */
+#endif
+
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+    _Pragma ("GCC diagnostic push") \
+    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+    _Pragma ("GCC diagnostic pop")
+#else
+# define YY_INITIAL_VALUE(Value) Value
+#endif
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
+
+#if ! defined yyoverflow || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols.  */
+
+# ifdef YYSTACK_USE_ALLOCA
+#  if YYSTACK_USE_ALLOCA
+#   ifdef __GNUC__
+#    define YYSTACK_ALLOC __builtin_alloca
+#   elif defined __BUILTIN_VA_ARG_INCR
+#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+#   elif defined _AIX
+#    define YYSTACK_ALLOC __alloca
+#   elif defined _MSC_VER
+#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+#    define alloca _alloca
+#   else
+#    define YYSTACK_ALLOC alloca
+#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
+#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
+#     ifndef EXIT_SUCCESS
+#      define EXIT_SUCCESS 0
+#     endif
+#    endif
+#   endif
+#  endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+   /* Pacify GCC's 'empty if-body' warning.  */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+    /* The OS might guarantee only one guard page at the bottom of the stack,
+       and a page size can be as small as 4096 bytes.  So we cannot safely
+       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
+       to allow for a few compiler-allocated temporary stack slots.  */
+#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+#  endif
+# else
+#  define YYSTACK_ALLOC YYMALLOC
+#  define YYSTACK_FREE YYFREE
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+#  endif
+#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
+       && ! ((defined YYMALLOC || defined malloc) \
+             && (defined YYFREE || defined free)))
+#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#   ifndef EXIT_SUCCESS
+#    define EXIT_SUCCESS 0
+#   endif
+#  endif
+#  ifndef YYMALLOC
+#   define YYMALLOC malloc
+#   if ! defined malloc && ! defined EXIT_SUCCESS
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+#  ifndef YYFREE
+#   define YYFREE free
+#   if ! defined free && ! defined EXIT_SUCCESS
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+# endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+
+
+#if (! defined yyoverflow \
+     && (! defined __cplusplus \
+         || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
+             && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member.  */
+union yyalloc
+{
+  yytype_int16 yyss_alloc;
+  YYSTYPE yyvs_alloc;
+  YYLTYPE yyls_alloc;
+};
+
+/* The size of the maximum gap between one aligned stack and the next.  */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+   N elements.  */
+# define YYSTACK_BYTES(N) \
+     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+      + 2 * YYSTACK_GAP_MAXIMUM)
+
+# define YYCOPY_NEEDED 1
+
+/* Relocate STACK from its old location to the new one.  The
+   local variables YYSIZE and YYSTACKSIZE give the old and new number of
+   elements in the stack, and YYPTR gives the new location of the
+   stack.  Advance YYPTR to a properly aligned location for the next
+   stack.  */
+# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
+    do                                                                  \
+      {                                                                 \
+        YYSIZE_T yynewbytes;                                            \
+        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
+        Stack = &yyptr->Stack_alloc;                                    \
+        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+        yyptr += yynewbytes / sizeof (*yyptr);                          \
+      }                                                                 \
+    while (0)
+
+#endif
+
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from SRC to DST.  The source and destination do
+   not overlap.  */
+# ifndef YYCOPY
+#  if defined __GNUC__ && 1 < __GNUC__
+#   define YYCOPY(Dst, Src, Count) \
+      __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
+#  else
+#   define YYCOPY(Dst, Src, Count)              \
+      do                                        \
+        {                                       \
+          YYSIZE_T yyi;                         \
+          for (yyi = 0; yyi < (Count); yyi++)   \
+            (Dst)[yyi] = (Src)[yyi];            \
+        }                                       \
+      while (0)
+#  endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
+/* YYFINAL -- State number of the termination state.  */
+#define YYFINAL  3
+/* YYLAST -- Last index in YYTABLE.  */
+#define YYLAST   1139
+
+/* YYNTOKENS -- Number of terminals.  */
+#define YYNTOKENS  128
+/* YYNNTS -- Number of nonterminals.  */
+#define YYNNTS  84
+/* YYNRULES -- Number of rules.  */
+#define YYNRULES  234
+/* YYNSTATES -- Number of states.  */
+#define YYNSTATES  312
+
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+   by yylex, with out-of-bounds checking.  */
+#define YYUNDEFTOK  2
+#define YYMAXUTOK   375
+
+#define YYTRANSLATE(YYX)                                                \
+  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex, without out-of-bounds checking.  */
+static const yytype_uint8 yytranslate[] =
+{
+       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,   121,     2,     2,     2,     2,
+     123,   124,     2,     2,   125,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,   122,
+       2,   126,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,   127,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
+       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
+      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
+      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
+      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
+      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
+      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
+      65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
+      75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
+      85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
+      95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
+     105,   106,   107,   108,   109,   110,   111,   112,   113,   114,
+     115,   116,   117,   118,   119,   120
+};
+
+#if YYDEBUG
+  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
+static const yytype_uint16 yyrline[] =
+{
+       0,   347,   347,   353,   354,   357,   361,   370,   374,   378,
+     384,   388,   393,   394,   397,   419,   427,   434,   443,   455,
+     456,   459,   460,   464,   477,   532,   538,   537,   590,   593,
+     597,   604,   610,   613,   642,   646,   652,   660,   661,   663,
+     678,   693,   721,   749,   780,   781,   786,   797,   798,   803,
+     808,   815,   816,   820,   822,   828,   829,   837,   838,   842,
+     843,   853,   855,   857,   859,   861,   863,   865,   867,   869,
+     871,   873,   875,   877,   879,   881,   883,   885,   887,   889,
+     891,   893,   897,   910,   924,   987,   990,   994,  1000,  1004,
+    1010,  1023,  1070,  1082,  1087,  1095,  1100,  1117,  1134,  1137,
+    1151,  1154,  1160,  1167,  1181,  1185,  1191,  1203,  1206,  1221,
+    1238,  1256,  1290,  1552,  1584,  1599,  1606,  1649,  1652,  1658,
+    1673,  1677,  1683,  1709,  1853,  1876,  1894,  1898,  1908,  1920,
+    1984,  2061,  2093,  2106,  2111,  2124,  2131,  2147,  2152,  2160,
+    2162,  2161,  2201,  2205,  2211,  2224,  2233,  2239,  2276,  2280,
+    2284,  2288,  2292,  2296,  2304,  2307,  2315,  2317,  2324,  2328,
+    2332,  2341,  2342,  2343,  2344,  2345,  2346,  2347,  2348,  2349,
+    2350,  2351,  2352,  2353,  2354,  2355,  2356,  2357,  2358,  2359,
+    2360,  2361,  2362,  2363,  2364,  2365,  2366,  2367,  2368,  2369,
+    2370,  2371,  2372,  2373,  2374,  2375,  2376,  2377,  2378,  2379,
+    2380,  2381,  2382,  2383,  2384,  2385,  2386,  2387,  2388,  2389,
+    2390,  2391,  2392,  2393,  2394,  2395,  2396,  2397,  2398,  2399,
+    2400,  2401,  2402,  2403,  2404,  2405,  2406,  2407,  2408,  2409,
+    2410,  2411,  2412,  2413,  2414
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || 0
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
+static const char *const yytname[] =
+{
+  "$end", "error", "$undefined", "IDENT", "FCONST", "SCONST", "BCONST",
+  "XCONST", "Op", "ICONST", "PARAM", "TYPECAST", "DOT_DOT", "COLON_EQUALS",
+  "EQUALS_GREATER", "LESS_EQUALS", "GREATER_EQUALS", "NOT_EQUALS",
+  "T_WORD", "T_CWORD", "T_DATUM", "LESS_LESS", "GREATER_GREATER",
+  "K_ABSOLUTE", "K_ALIAS", "K_ALL", "K_ARRAY", "K_ASSERT", "K_BACKWARD",
+  "K_BEGIN", "K_BY", "K_CASE", "K_CLOSE", "K_COLLATE", "K_COLUMN",
+  "K_COLUMN_NAME", "K_CONSTANT", "K_CONSTRAINT", "K_CONSTRAINT_NAME",
+  "K_CONTINUE", "K_CURRENT", "K_CURSOR", "K_DATATYPE", "K_DEBUG",
+  "K_DECLARE", "K_DEFAULT", "K_DETAIL", "K_DIAGNOSTICS", "K_DUMP",
+  "K_ELSE", "K_ELSIF", "K_END", "K_ERRCODE", "K_ERROR", "K_EXCEPTION",
+  "K_EXECUTE", "K_EXIT", "K_FETCH", "K_FIRST", "K_FOR", "K_FOREACH",
+  "K_FORWARD", "K_FROM", "K_GET", "K_HINT", "K_IF", "K_IN", "K_INFO",
+  "K_INSERT", "K_INTO", "K_IS", "K_LAST", "K_LOG", "K_LOOP", "K_MESSAGE",
+  "K_MESSAGE_TEXT", "K_MOVE", "K_NEXT", "K_NO", "K_NOT", "K_NOTICE",
+  "K_NULL", "K_OPEN", "K_OPTION", "K_OR", "K_PERFORM", "K_PG_CONTEXT",
+  "K_PG_DATATYPE_NAME", "K_PG_EXCEPTION_CONTEXT", "K_PG_EXCEPTION_DETAIL",
+  "K_PG_EXCEPTION_HINT", "K_PRINT_STRICT_PARAMS", "K_PRIOR", "K_QUERY",
+  "K_RAISE", "K_RELATIVE", "K_RESULT_OID", "K_RETURN",
+  "K_RETURNED_SQLSTATE", "K_REVERSE", "K_ROW_COUNT", "K_ROWTYPE",
+  "K_SCHEMA", "K_SCHEMA_NAME", "K_SCROLL", "K_SLICE", "K_SQLSTATE",
+  "K_STACKED", "K_STRICT", "K_TABLE", "K_TABLE_NAME", "K_THEN", "K_TO",
+  "K_TYPE", "K_USE_COLUMN", "K_USE_VARIABLE", "K_USING",
+  "K_VARIABLE_CONFLICT", "K_WARNING", "K_WHEN", "K_WHILE", "'#'", "';'",
+  "'('", "')'", "','", "'='", "'['", "$accept", "pl_function",
+  "comp_options", "comp_option", "option_value", "opt_semi", "pl_block",
+  "decl_sect", "decl_start", "decl_stmts", "decl_stmt", "decl_statement",
+  "$@1", "opt_scrollable", "decl_cursor_query", "decl_cursor_args",
+  "decl_cursor_arglist", "decl_cursor_arg", "decl_is_for",
+  "decl_aliasitem", "decl_varname", "decl_const", "decl_datatype",
+  "decl_collate", "decl_notnull", "decl_defval", "decl_defkey",
+  "assign_operator", "proc_sect", "proc_stmt", "stmt_perform",
+  "stmt_assign", "stmt_getdiag", "getdiag_area_opt", "getdiag_list",
+  "getdiag_list_item", "getdiag_item", "getdiag_target", "assign_var",
+  "stmt_if", "stmt_elsifs", "stmt_else", "stmt_case",
+  "opt_expr_until_when", "case_when_list", "case_when", "opt_case_else",
+  "stmt_loop", "stmt_while", "stmt_for", "for_control", "for_variable",
+  "stmt_foreach_a", "foreach_slice", "stmt_exit", "exit_type",
+  "stmt_return", "stmt_raise", "stmt_assert", "loop_body", "stmt_execsql",
+  "stmt_dynexecute", "stmt_open", "stmt_fetch", "stmt_move",
+  "opt_fetch_direction", "stmt_close", "stmt_null", "cursor_variable",
+  "exception_sect", "@2", "proc_exceptions", "proc_exception",
+  "proc_conditions", "proc_condition", "expr_until_semi",
+  "expr_until_rightbracket", "expr_until_then", "expr_until_loop",
+  "opt_block_label", "opt_label", "opt_exitcond", "any_identifier",
+  "unreserved_keyword", YY_NULLPTR
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+   (internal) symbol number NUM (which must be that of a token).  */
+static const yytype_uint16 yytoknum[] =
+{
+       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
+     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
+     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
+     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
+     295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
+     305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
+     315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
+     325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
+     335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
+     345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
+     355,   356,   357,   358,   359,   360,   361,   362,   363,   364,
+     365,   366,   367,   368,   369,   370,   371,   372,   373,   374,
+     375,    35,    59,    40,    41,    44,    61,    91
+};
+# endif
+
+#define YYPACT_NINF -234
+
+#define yypact_value_is_default(Yystate) \
+  (!!((Yystate) == (-234)))
+
+#define YYTABLE_NINF -145
+
+#define yytable_value_is_error(Yytable_value) \
+  0
+
+  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+     STATE-NUM.  */
+static const yytype_int16 yypact[] =
+{
+    -234,    40,   -18,  -234,   283,   -55,  -234,   -80,    21,    10,
+    -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,
+    -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,
+    -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,
+    -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,
+    -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,
+    -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,
+    -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,
+    -234,  -234,  -234,  -234,  -234,  -234,    34,  -234,    17,   583,
+     -37,  -234,  -234,  -234,  -234,   182,  -234,  -234,  -234,  -234,
+    -234,  -234,  -234,  -234,   886,  -234,   283,  -234,   182,  -234,
+    -234,    -9,  -234,  -234,  -234,  -234,  -234,  -234,    15,  -234,
+    -234,  -234,  -234,  -234,   -26,  -234,  -234,  -234,   -52,    15,
+    -234,  -234,  -234,   -46,  -234,  -234,  -234,  -234,   -11,  -234,
+    -234,  -234,  -234,  -234,  -234,  -234,   283,  -234,  -234,  -234,
+    -234,  -234,  -234,  -234,  -234,  -234,  -234,    12,     0,    45,
+    -234,    26,  -234,   -24,  -234,    49,  -234,   -20,  -234,  -234,
+    -234,   -16,    -6,    15,  -234,  -234,    61,  -234,    15,  -234,
+    -234,  -234,  -234,  -234,  -234,  -234,  -234,   -71,  -234,   283,
+      78,    78,  -234,  -234,  -234,   384,  -234,  -234,    77,  -234,
+     -30,  -234,  -234,   283,    -6,  -234,    48,   103,   782,     5,
+    -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,
+      65,    27,   938,  -234,  -234,  -234,  -234,    11,  -234,    14,
+     485,    55,  -234,  -234,  -234,    84,   -59,  -234,  -234,  -234,
+    -234,  -234,  -234,  -234,   -61,  -234,    -7,    33,  -234,  -234,
+    -234,  -234,   130,    74,    72,  -234,  -234,   681,   -21,  -234,
+    -234,  -234,    66,    -8,   -10,   990,   115,   283,  -234,  -234,
+     103,  -234,  -234,  -234,    97,  -234,   124,   283,     1,  -234,
+    -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,
+      29,  -234,    73,  -234,  -234,  1042,  -234,    87,  -234,    31,
+    -234,   681,  -234,  -234,  -234,   834,    35,  -234,  -234,  -234,
+    -234,  -234
+};
+
+  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+     Performed when YYTABLE does not specify something else to do.  Zero
+     means the default is an error.  */
+static const yytype_uint8 yydefact[] =
+{
+       3,     0,   152,     1,     0,     0,     4,    12,     0,    15,
+     158,   160,   161,   162,   163,   164,   165,   166,   167,   168,
+     169,   170,   171,   172,   173,   174,   175,   176,   177,   178,
+     179,   180,   181,   182,   183,   184,   185,   186,   187,   188,
+     189,   190,   191,   192,   193,   194,   195,   196,   197,   198,
+     199,   200,   201,   202,   203,   204,   205,   206,   207,   208,
+     209,   210,   211,   212,   213,   214,   215,   216,   217,   218,
+     219,   220,   221,   222,   223,   224,   225,   226,   227,   228,
+     229,   230,   231,   232,   233,   234,     0,   159,     0,     0,
+       0,    13,     2,    59,    18,    16,   153,     5,    10,     6,
+      11,     7,     9,     8,   152,    42,     0,    22,    17,    20,
+      21,    44,    43,   127,   128,    95,   124,   103,     0,   121,
+     140,   129,   120,   133,    85,   150,   126,   133,     0,     0,
+     148,   123,   122,     0,    60,    75,    62,    76,     0,    63,
+      64,    65,    66,    67,    68,    69,   154,    70,    71,    72,
+      73,    74,    77,    78,    79,    80,    81,     0,    15,     0,
+      19,     0,    45,     0,    30,     0,    46,     0,   137,   138,
+     136,     0,     0,     0,    86,    87,     0,    59,     0,   135,
+     130,    82,    61,    58,    57,   149,   148,     0,   155,   154,
+       0,     0,    59,   151,    23,     0,    29,    26,    47,   150,
+     107,   105,   134,     0,   141,   143,     0,     0,   152,     0,
+      96,    83,   148,   156,   119,    14,   114,   115,   113,    59,
+       0,   117,   152,   109,    59,    39,    41,     0,    40,    32,
+       0,    51,    59,    59,   104,     0,     0,   146,   147,   142,
+     131,    93,    94,    92,     0,    89,     0,   100,   132,   157,
+     111,   112,     0,     0,     0,   110,    25,     0,     0,    48,
+      50,    49,     0,     0,   152,   152,     0,     0,    59,    84,
+       0,    91,    59,   150,     0,   118,     0,   154,     0,    34,
+      46,    38,    37,    31,    52,    56,    53,    24,    54,    55,
+       0,   145,   152,    88,    90,   152,    59,     0,   151,     0,
+      33,     0,    36,    27,   102,   152,     0,    59,   125,    35,
+      97,   116
+};
+
+  /* YYPGOTO[NTERM-NUM].  */
+static const yytype_int16 yypgoto[] =
+{
+    -234,  -234,  -234,  -234,  -234,  -234,   154,  -234,  -234,  -234,
+      51,  -234,  -234,  -234,  -234,  -234,  -234,  -141,  -234,  -234,
+    -233,  -234,  -119,  -234,  -234,  -234,  -234,  -220,   -89,  -234,
+    -234,  -234,  -234,  -234,  -234,  -108,  -234,  -234,  -234,  -234,
+    -234,  -234,  -234,  -234,  -234,   -36,  -234,  -234,  -234,  -234,
+    -234,   -28,  -234,  -234,  -234,  -234,  -234,  -234,  -234,  -206,
+    -234,  -234,  -234,  -234,  -234,    38,  -234,  -234,   -99,  -234,
+    -234,  -234,   -38,  -234,   -96,  -155,  -234,  -187,  -130,   170,
+    -166,  -234,    -4,   -88
+};
+
+  /* YYDEFGOTO[NTERM-NUM].  */
+static const yytype_int16 yydefgoto[] =
+{
+      -1,     1,     2,     6,    99,    92,   133,     8,    95,   108,
+     109,   110,   229,   165,   303,   258,   278,   279,   283,   227,
+     111,   166,   198,   231,   263,   287,   288,   186,   222,   134,
+     135,   136,   137,   176,   244,   245,   294,   246,   138,   139,
+     247,   274,   140,   167,   200,   201,   235,   141,   142,   143,
+     219,   220,   144,   253,   145,   146,   147,   148,   149,   223,
+     150,   151,   152,   153,   154,   173,   155,   156,   171,   157,
+     172,   204,   205,   236,   237,   181,   210,   177,   224,   158,
+     187,   214,   188,    87
+};
+
+  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
+     positive, shift that token.  If negative, reduce the rule whose
+     number is the opposite.  If YYTABLE_NINF, syntax error.  */
+static const yytype_int16 yytable[] =
+{
+      86,   100,   183,     4,   104,   183,   183,   112,   113,   114,
+     115,     4,   232,   250,   174,   161,   101,   116,   255,   233,
+     112,   117,   118,   215,   280,   267,   271,   162,    88,   119,
+     180,   211,   -28,   168,   169,   170,    89,   285,   281,  -106,
+       3,  -106,    91,   289,    94,   121,   122,   123,   212,   282,
+      93,   213,   268,   124,    94,   125,    96,   249,   126,   190,
+     191,   269,    90,   189,   270,    97,   127,   194,   280,   163,
+     179,   128,   129,   192,   206,   130,   182,   102,   103,   209,
+     196,   175,   272,   273,   131,   195,   296,   132,   208,   199,
+     197,   113,   114,   115,     4,   164,   216,   217,   218,   199,
+     116,   311,   159,     5,   117,   118,   202,   228,   207,  -106,
+     230,   299,   119,   203,   286,   184,   185,   240,   184,   184,
+     193,   241,   242,   243,  -144,   300,   301,   248,   121,   122,
+     123,   251,   252,   256,   262,   266,   124,   257,   125,   275,
+     276,   126,   261,   264,   265,   277,   290,   284,   297,   127,
+     298,   304,   306,   308,   128,   129,     7,   310,   130,   160,
+     309,   302,   293,   221,   234,   178,   239,   131,   307,   112,
+     132,   291,     9,     0,     0,     0,     0,     0,     0,   292,
+       0,     0,     0,   295,     0,     0,     0,     0,     0,     0,
+       0,     0,  -144,     0,     0,     0,     0,     0,     0,   238,
+     105,     0,     0,   106,     0,    12,    13,   305,    14,    15,
+      16,     0,     0,   112,    17,    18,    19,    20,    21,    22,
+      23,    24,    25,    26,    27,    28,   107,    29,    30,    31,
+      32,     0,    33,     0,    34,    35,    36,     0,    37,    38,
+      39,     0,     0,    40,     0,    41,    42,     0,     0,    43,
+      44,     0,    45,    46,    47,     0,    48,    49,    50,    51,
+      52,     0,    53,   238,    54,    55,     0,    56,    57,    58,
+      59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
+      69,    70,    71,    72,    73,    74,    75,    76,    77,    78,
+       0,    79,    80,     0,     0,    81,    82,    83,     0,    84,
+      85,    10,     0,    11,     0,     0,    12,    13,     0,    14,
+      15,    16,     0,     0,     0,    17,    18,    19,    20,    21,
+      22,    23,    24,    25,    26,    27,    28,     0,    29,    30,
+      31,    32,     0,    33,     0,    34,    35,    36,     0,    37,
+      38,    39,     0,     0,    40,     0,    41,    42,     0,     0,
+      43,    44,     0,    45,    46,    47,     0,    48,    49,    50,
+      51,    52,     0,    53,     0,    54,    55,     0,    56,    57,
+      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
+      68,    69,    70,    71,    72,    73,    74,    75,    76,    77,
+      78,     0,    79,    80,     0,     0,    81,    82,    83,     0,
+      84,    85,   225,   226,     0,     0,     0,    12,    13,     0,
+      14,    15,    16,     0,     0,     0,    17,    18,    19,    20,
+      21,    22,    23,    24,    25,    26,    27,    28,     0,    29,
+      30,    31,    32,     0,    33,     0,    34,    35,    36,     0,
+      37,    38,    39,     0,     0,    40,     0,    41,    42,     0,
+       0,    43,    44,     0,    45,    46,    47,     0,    48,    49,
+      50,    51,    52,     0,    53,     0,    54,    55,     0,    56,
+      57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
+      67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
+      77,    78,     0,    79,    80,     0,     0,    81,    82,    83,
+       0,    84,    85,   259,   260,     0,     0,     0,    12,    13,
+       0,    14,    15,    16,     0,     0,     0,    17,    18,    19,
+      20,    21,    22,    23,    24,    25,    26,    27,    28,     0,
+      29,    30,    31,    32,     0,    33,     0,    34,    35,    36,
+       0,    37,    38,    39,     0,     0,    40,     0,    41,    42,
+       0,     0,    43,    44,     0,    45,    46,    47,     0,    48,
+      49,    50,    51,    52,     0,    53,     0,    54,    55,     0,
+      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
+      66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
+      76,    77,    78,     0,    79,    80,     0,     0,    81,    82,
+      83,    98,    84,    85,     0,     0,    12,    13,     0,    14,
+      15,    16,     0,     0,     0,    17,    18,    19,    20,    21,
+      22,    23,    24,    25,    26,    27,    28,     0,    29,    30,
+      31,    32,     0,    33,     0,    34,    35,    36,     0,    37,
+      38,    39,     0,     0,    40,     0,    41,    42,     0,     0,
+      43,    44,     0,    45,    46,    47,     0,    48,    49,    50,
+      51,    52,     0,    53,     0,    54,    55,     0,    56,    57,
+      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
+      68,    69,    70,    71,    72,    73,    74,    75,    76,    77,
+      78,     0,    79,    80,     0,     0,    81,    82,    83,   105,
+      84,    85,     0,     0,    12,    13,     0,    14,    15,    16,
+       0,     0,     0,    17,    18,    19,    20,    21,    22,    23,
+      24,    25,    26,    27,    28,     0,    29,    30,    31,    32,
+       0,    33,     0,    34,    35,    36,     0,    37,    38,    39,
+       0,     0,    40,     0,    41,    42,     0,     0,    43,    44,
+       0,    45,    46,    47,     0,    48,    49,    50,    51,    52,
+       0,    53,     0,    54,    55,     0,    56,    57,    58,    59,
+      60,    61,    62,    63,    64,    65,    66,    67,    68,    69,
+      70,    71,    72,    73,    74,    75,    76,    77,    78,     0,
+      79,    80,     0,     0,    81,    82,    83,     0,    84,    85,
+     113,   114,   115,     4,     0,     0,     0,     0,     0,   116,
+       0,     0,     0,   117,   118,     0,     0,     0,     0,     0,
+       0,   119,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,   -98,   -98,   -98,     0,     0,     0,   121,   122,   123,
+       0,     0,     0,     0,     0,   124,     0,   125,     0,     0,
+     126,     0,   113,   114,   115,     4,     0,     0,   127,     0,
+       0,   116,     0,   128,   129,   117,   118,   130,     0,     0,
+       0,     0,     0,   119,     0,     0,   131,     0,     0,   132,
+       0,     0,     0,   -99,   -99,   -99,     0,     0,     0,   121,
+     122,   123,     0,     0,     0,     0,     0,   124,     0,   125,
+       0,     0,   126,     0,   113,   114,   115,     4,     0,     0,
+     127,     0,     0,   116,     0,   128,   129,   117,   118,   130,
+       0,     0,     0,     0,     0,   119,     0,     0,   131,     0,
+       0,   132,     0,     0,     0,     0,     0,  -139,     0,     0,
+     120,   121,   122,   123,     0,     0,     0,     0,     0,   124,
+       0,   125,     0,     0,   126,     0,   113,   114,   115,     4,
+       0,     0,   127,     0,     0,   116,     0,   128,   129,   117,
+     118,   130,     0,     0,     0,     0,     0,   119,     0,     0,
+     131,     0,     0,   132,     0,     0,     0,     0,     0,   254,
+       0,     0,     0,   121,   122,   123,     0,     0,     0,     0,
+       0,   124,     0,   125,     0,     0,   126,     0,   113,   114,
+     115,     4,     0,     0,   127,     0,     0,   116,     0,   128,
+     129,   117,   118,   130,     0,     0,     0,     0,     0,   119,
+       0,     0,   131,     0,     0,   132,     0,     0,     0,     0,
+       0,  -108,     0,     0,     0,   121,   122,   123,     0,     0,
+       0,     0,     0,   124,     0,   125,     0,     0,   126,     0,
+     113,   114,   115,     4,     0,     0,   127,     0,     0,   116,
+       0,   128,   129,   117,   118,   130,     0,     0,     0,     0,
+       0,   119,     0,     0,   131,     0,     0,   132,     0,     0,
+       0,     0,     0,  -101,     0,     0,     0,   121,   122,   123,
+       0,     0,     0,     0,     0,   124,     0,   125,     0,     0,
+     126,     0,     0,     0,     0,     0,     0,     0,   127,     0,
+       0,     0,     0,   128,   129,     0,     0,   130,     0,     0,
+       0,     0,     0,     0,     0,     0,   131,     0,     0,   132
+};
+
+static const yytype_int16 yycheck[] =
+{
+       4,    89,    13,    21,    93,    13,    13,    95,    18,    19,
+      20,    21,   199,   219,    40,    24,    53,    27,   224,    49,
+     108,    31,    32,   189,   257,    84,   246,    36,    83,    39,
+     129,   186,    41,    18,    19,    20,    91,    45,    59,    49,
+       0,    51,   122,   263,    44,    55,    56,    57,   119,    70,
+      29,   122,   111,    63,    44,    65,    22,   212,    68,    59,
+      60,   122,   117,    51,   125,    48,    76,    22,   301,    78,
+     122,    81,    82,    73,   173,    85,   122,   114,   115,   178,
+     104,   107,    49,    50,    94,    59,   273,    97,   177,   119,
+      41,    18,    19,    20,    21,   104,    18,    19,    20,   119,
+      27,   307,   106,   121,    31,    32,   122,   195,    47,   119,
+      33,   277,    39,   119,   122,   126,   127,    69,   126,   126,
+     120,    18,    19,    20,    51,   124,   125,   122,    55,    56,
+      57,    66,   105,   122,    79,    51,    63,   123,    65,     9,
+      66,    68,   230,   232,   233,    73,    31,    81,    51,    76,
+      26,   122,    65,   122,    81,    82,     2,   122,    85,   108,
+     301,   280,   270,   191,   200,   127,   204,    94,   298,   257,
+      97,   267,     2,    -1,    -1,    -1,    -1,    -1,    -1,   268,
+      -1,    -1,    -1,   272,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,   119,    -1,    -1,    -1,    -1,    -1,    -1,   203,
+      18,    -1,    -1,    21,    -1,    23,    24,   296,    26,    27,
+      28,    -1,    -1,   301,    32,    33,    34,    35,    36,    37,
+      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
+      48,    -1,    50,    -1,    52,    53,    54,    -1,    56,    57,
+      58,    -1,    -1,    61,    -1,    63,    64,    -1,    -1,    67,
+      68,    -1,    70,    71,    72,    -1,    74,    75,    76,    77,
+      78,    -1,    80,   267,    82,    83,    -1,    85,    86,    87,
+      88,    89,    90,    91,    92,    93,    94,    95,    96,    97,
+      98,    99,   100,   101,   102,   103,   104,   105,   106,   107,
+      -1,   109,   110,    -1,    -1,   113,   114,   115,    -1,   117,
+     118,    18,    -1,    20,    -1,    -1,    23,    24,    -1,    26,
+      27,    28,    -1,    -1,    -1,    32,    33,    34,    35,    36,
+      37,    38,    39,    40,    41,    42,    43,    -1,    45,    46,
+      47,    48,    -1,    50,    -1,    52,    53,    54,    -1,    56,
+      57,    58,    -1,    -1,    61,    -1,    63,    64,    -1,    -1,
+      67,    68,    -1,    70,    71,    72,    -1,    74,    75,    76,
+      77,    78,    -1,    80,    -1,    82,    83,    -1,    85,    86,
+      87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
+      97,    98,    99,   100,   101,   102,   103,   104,   105,   106,
+     107,    -1,   109,   110,    -1,    -1,   113,   114,   115,    -1,
+     117,   118,    18,    19,    -1,    -1,    -1,    23,    24,    -1,
+      26,    27,    28,    -1,    -1,    -1,    32,    33,    34,    35,
+      36,    37,    38,    39,    40,    41,    42,    43,    -1,    45,
+      46,    47,    48,    -1,    50,    -1,    52,    53,    54,    -1,
+      56,    57,    58,    -1,    -1,    61,    -1,    63,    64,    -1,
+      -1,    67,    68,    -1,    70,    71,    72,    -1,    74,    75,
+      76,    77,    78,    -1,    80,    -1,    82,    83,    -1,    85,
+      86,    87,    88,    89,    90,    91,    92,    93,    94,    95,
+      96,    97,    98,    99,   100,   101,   102,   103,   104,   105,
+     106,   107,    -1,   109,   110,    -1,    -1,   113,   114,   115,
+      -1,   117,   118,    18,    19,    -1,    -1,    -1,    23,    24,
+      -1,    26,    27,    28,    -1,    -1,    -1,    32,    33,    34,
+      35,    36,    37,    38,    39,    40,    41,    42,    43,    -1,
+      45,    46,    47,    48,    -1,    50,    -1,    52,    53,    54,
+      -1,    56,    57,    58,    -1,    -1,    61,    -1,    63,    64,
+      -1,    -1,    67,    68,    -1,    70,    71,    72,    -1,    74,
+      75,    76,    77,    78,    -1,    80,    -1,    82,    83,    -1,
+      85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
+      95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
+     105,   106,   107,    -1,   109,   110,    -1,    -1,   113,   114,
+     115,    18,   117,   118,    -1,    -1,    23,    24,    -1,    26,
+      27,    28,    -1,    -1,    -1,    32,    33,    34,    35,    36,
+      37,    38,    39,    40,    41,    42,    43,    -1,    45,    46,
+      47,    48,    -1,    50,    -1,    52,    53,    54,    -1,    56,
+      57,    58,    -1,    -1,    61,    -1,    63,    64,    -1,    -1,
+      67,    68,    -1,    70,    71,    72,    -1,    74,    75,    76,
+      77,    78,    -1,    80,    -1,    82,    83,    -1,    85,    86,
+      87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
+      97,    98,    99,   100,   101,   102,   103,   104,   105,   106,
+     107,    -1,   109,   110,    -1,    -1,   113,   114,   115,    18,
+     117,   118,    -1,    -1,    23,    24,    -1,    26,    27,    28,
+      -1,    -1,    -1,    32,    33,    34,    35,    36,    37,    38,
+      39,    40,    41,    42,    43,    -1,    45,    46,    47,    48,
+      -1,    50,    -1,    52,    53,    54,    -1,    56,    57,    58,
+      -1,    -1,    61,    -1,    63,    64,    -1,    -1,    67,    68,
+      -1,    70,    71,    72,    -1,    74,    75,    76,    77,    78,
+      -1,    80,    -1,    82,    83,    -1,    85,    86,    87,    88,
+      89,    90,    91,    92,    93,    94,    95,    96,    97,    98,
+      99,   100,   101,   102,   103,   104,   105,   106,   107,    -1,
+     109,   110,    -1,    -1,   113,   114,   115,    -1,   117,   118,
+      18,    19,    20,    21,    -1,    -1,    -1,    -1,    -1,    27,
+      -1,    -1,    -1,    31,    32,    -1,    -1,    -1,    -1,    -1,
+      -1,    39,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    49,    50,    51,    -1,    -1,    -1,    55,    56,    57,
+      -1,    -1,    -1,    -1,    -1,    63,    -1,    65,    -1,    -1,
+      68,    -1,    18,    19,    20,    21,    -1,    -1,    76,    -1,
+      -1,    27,    -1,    81,    82,    31,    32,    85,    -1,    -1,
+      -1,    -1,    -1,    39,    -1,    -1,    94,    -1,    -1,    97,
+      -1,    -1,    -1,    49,    50,    51,    -1,    -1,    -1,    55,
+      56,    57,    -1,    -1,    -1,    -1,    -1,    63,    -1,    65,
+      -1,    -1,    68,    -1,    18,    19,    20,    21,    -1,    -1,
+      76,    -1,    -1,    27,    -1,    81,    82,    31,    32,    85,
+      -1,    -1,    -1,    -1,    -1,    39,    -1,    -1,    94,    -1,
+      -1,    97,    -1,    -1,    -1,    -1,    -1,    51,    -1,    -1,
+      54,    55,    56,    57,    -1,    -1,    -1,    -1,    -1,    63,
+      -1,    65,    -1,    -1,    68,    -1,    18,    19,    20,    21,
+      -1,    -1,    76,    -1,    -1,    27,    -1,    81,    82,    31,
+      32,    85,    -1,    -1,    -1,    -1,    -1,    39,    -1,    -1,
+      94,    -1,    -1,    97,    -1,    -1,    -1,    -1,    -1,    51,
+      -1,    -1,    -1,    55,    56,    57,    -1,    -1,    -1,    -1,
+      -1,    63,    -1,    65,    -1,    -1,    68,    -1,    18,    19,
+      20,    21,    -1,    -1,    76,    -1,    -1,    27,    -1,    81,
+      82,    31,    32,    85,    -1,    -1,    -1,    -1,    -1,    39,
+      -1,    -1,    94,    -1,    -1,    97,    -1,    -1,    -1,    -1,
+      -1,    51,    -1,    -1,    -1,    55,    56,    57,    -1,    -1,
+      -1,    -1,    -1,    63,    -1,    65,    -1,    -1,    68,    -1,
+      18,    19,    20,    21,    -1,    -1,    76,    -1,    -1,    27,
+      -1,    81,    82,    31,    32,    85,    -1,    -1,    -1,    -1,
+      -1,    39,    -1,    -1,    94,    -1,    -1,    97,    -1,    -1,
+      -1,    -1,    -1,    51,    -1,    -1,    -1,    55,    56,    57,
+      -1,    -1,    -1,    -1,    -1,    63,    -1,    65,    -1,    -1,
+      68,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    76,    -1,
+      -1,    -1,    -1,    81,    82,    -1,    -1,    85,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    94,    -1,    -1,    97
+};
+
+  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+     symbol of state STATE-NUM.  */
+static const yytype_uint8 yystos[] =
+{
+       0,   129,   130,     0,    21,   121,   131,   134,   135,   207,
+      18,    20,    23,    24,    26,    27,    28,    32,    33,    34,
+      35,    36,    37,    38,    39,    40,    41,    42,    43,    45,
+      46,    47,    48,    50,    52,    53,    54,    56,    57,    58,
+      61,    63,    64,    67,    68,    70,    71,    72,    74,    75,
+      76,    77,    78,    80,    82,    83,    85,    86,    87,    88,
+      89,    90,    91,    92,    93,    94,    95,    96,    97,    98,
+      99,   100,   101,   102,   103,   104,   105,   106,   107,   109,
+     110,   113,   114,   115,   117,   118,   210,   211,    83,    91,
+     117,   122,   133,    29,    44,   136,    22,    48,    18,   132,
+     211,    53,   114,   115,   156,    18,    21,    44,   137,   138,
+     139,   148,   211,    18,    19,    20,    27,    31,    32,    39,
+      54,    55,    56,    57,    63,    65,    68,    76,    81,    82,
+      85,    94,    97,   134,   157,   158,   159,   160,   166,   167,
+     170,   175,   176,   177,   180,   182,   183,   184,   185,   186,
+     188,   189,   190,   191,   192,   194,   195,   197,   207,   210,
+     138,    24,    36,    78,   104,   141,   149,   171,    18,    19,
+      20,   196,   198,   193,    40,   107,   161,   205,   193,   122,
+     196,   203,   122,    13,   126,   127,   155,   208,   210,    51,
+      59,    60,    73,   120,    22,    59,   104,    41,   150,   119,
+     172,   173,   122,   119,   199,   200,   196,    47,   156,   196,
+     204,   203,   119,   122,   209,   208,    18,    19,    20,   178,
+     179,   179,   156,   187,   206,    18,    19,   147,   211,   140,
+      33,   151,   205,    49,   173,   174,   201,   202,   210,   200,
+      69,    18,    19,    20,   162,   163,   165,   168,   122,   203,
+     187,    66,   105,   181,    51,   187,   122,   123,   143,    18,
+      19,   211,    79,   152,   156,   156,    51,    84,   111,   122,
+     125,   155,    49,    50,   169,     9,    66,    73,   144,   145,
+     148,    59,    70,   146,    81,    45,   122,   153,   154,   155,
+      31,   202,   156,   163,   164,   156,   205,    51,    26,   208,
+     124,   125,   150,   142,   122,   156,    65,   206,   122,   145,
+     122,   187
+};
+
+  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const yytype_uint8 yyr1[] =
+{
+       0,   128,   129,   130,   130,   131,   131,   131,   131,   131,
+     132,   132,   133,   133,   134,   135,   135,   135,   136,   137,
+     137,   138,   138,   138,   139,   139,   140,   139,   141,   141,
+     141,   142,   143,   143,   144,   144,   145,   146,   146,   147,
+     147,   147,   148,   148,   149,   149,   150,   151,   151,   151,
+     151,   152,   152,   153,   153,   154,   154,   155,   155,   156,
+     156,   157,   157,   157,   157,   157,   157,   157,   157,   157,
+     157,   157,   157,   157,   157,   157,   157,   157,   157,   157,
+     157,   157,   158,   159,   160,   161,   161,   161,   162,   162,
+     163,   164,   165,   165,   165,   166,   166,   167,   168,   168,
+     169,   169,   170,   171,   172,   172,   173,   174,   174,   175,
+     176,   177,   178,   179,   179,   179,   180,   181,   181,   182,
+     183,   183,   184,   185,   186,   187,   188,   188,   188,   189,
+     190,   191,   192,   193,   194,   195,   196,   196,   196,   197,
+     198,   197,   199,   199,   200,   201,   201,   202,   203,   204,
+     205,   206,   207,   207,   208,   208,   209,   209,   210,   210,
+     210,   211,   211,   211,   211,   211,   211,   211,   211,   211,
+     211,   211,   211,   211,   211,   211,   211,   211,   211,   211,
+     211,   211,   211,   211,   211,   211,   211,   211,   211,   211,
+     211,   211,   211,   211,   211,   211,   211,   211,   211,   211,
+     211,   211,   211,   211,   211,   211,   211,   211,   211,   211,
+     211,   211,   211,   211,   211,   211,   211,   211,   211,   211,
+     211,   211,   211,   211,   211,   211,   211,   211,   211,   211,
+     211,   211,   211,   211,   211
+};
+
+  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
+static const yytype_uint8 yyr2[] =
+{
+       0,     2,     3,     0,     2,     3,     3,     3,     3,     3,
+       1,     1,     0,     1,     6,     1,     2,     3,     1,     2,
+       1,     1,     1,     3,     6,     5,     0,     7,     0,     2,
+       1,     0,     0,     3,     1,     3,     2,     1,     1,     1,
+       1,     1,     1,     1,     0,     1,     0,     0,     2,     2,
+       2,     0,     2,     1,     1,     1,     1,     1,     1,     0,
+       2,     2,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     2,     3,     5,     0,     1,     1,     3,     1,
+       3,     0,     1,     1,     1,     1,     3,     8,     0,     4,
+       0,     2,     7,     0,     2,     1,     3,     0,     2,     3,
+       4,     4,     2,     1,     1,     1,     8,     0,     2,     3,
+       1,     1,     1,     1,     1,     5,     1,     1,     1,     1,
+       2,     4,     4,     0,     3,     2,     1,     1,     1,     0,
+       0,     3,     2,     1,     4,     3,     1,     1,     0,     0,
+       0,     0,     0,     3,     0,     1,     1,     2,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1
+};
+
+
+#define yyerrok         (yyerrstatus = 0)
+#define yyclearin       (yychar = YYEMPTY)
+#define YYEMPTY         (-2)
+#define YYEOF           0
+
+#define YYACCEPT        goto yyacceptlab
+#define YYABORT         goto yyabortlab
+#define YYERROR         goto yyerrorlab
+
+
+#define YYRECOVERING()  (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value)                                  \
+do                                                              \
+  if (yychar == YYEMPTY)                                        \
+    {                                                           \
+      yychar = (Token);                                         \
+      yylval = (Value);                                         \
+      YYPOPSTACK (yylen);                                       \
+      yystate = *yyssp;                                         \
+      goto yybackup;                                            \
+    }                                                           \
+  else                                                          \
+    {                                                           \
+      yyerror (YY_("syntax error: cannot back up")); \
+      YYERROR;                                                  \
+    }                                                           \
+while (0)
+
+/* Error token number */
+#define YYTERROR        1
+#define YYERRCODE       256
+
+
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+   If N is 0, then set CURRENT to the empty location which ends
+   the previous symbol: RHS[0] (always defined).  */
+
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
+    do                                                                  \
+      if (N)                                                            \
+        {                                                               \
+          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
+          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
+          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
+          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
+        }                                                               \
+      else                                                              \
+        {                                                               \
+          (Current).first_line   = (Current).last_line   =              \
+            YYRHSLOC (Rhs, 0).last_line;                                \
+          (Current).first_column = (Current).last_column =              \
+            YYRHSLOC (Rhs, 0).last_column;                              \
+        }                                                               \
+    while (0)
+#endif
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+
+
+/* Enable debugging if requested.  */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args)                        \
+do {                                            \
+  if (yydebug)                                  \
+    YYFPRINTF Args;                             \
+} while (0)
+
+
+/* YY_LOCATION_PRINT -- Print the location on the stream.
+   This macro was not mandated originally: define only if we know
+   we won't break user code: when these are the locations we know.  */
+
+#ifndef YY_LOCATION_PRINT
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+
+/* Print *YYLOCP on YYO.  Private, do not rely on its existence. */
+
+YY_ATTRIBUTE_UNUSED
+static unsigned
+yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
+{
+  unsigned res = 0;
+  int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
+  if (0 <= yylocp->first_line)
+    {
+      res += YYFPRINTF (yyo, "%d", yylocp->first_line);
+      if (0 <= yylocp->first_column)
+        res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
+    }
+  if (0 <= yylocp->last_line)
+    {
+      if (yylocp->first_line < yylocp->last_line)
+        {
+          res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
+          if (0 <= end_col)
+            res += YYFPRINTF (yyo, ".%d", end_col);
+        }
+      else if (0 <= end_col && yylocp->first_column < end_col)
+        res += YYFPRINTF (yyo, "-%d", end_col);
+    }
+  return res;
+ }
+
+#  define YY_LOCATION_PRINT(File, Loc)          \
+  yy_location_print_ (File, &(Loc))
+
+# else
+#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# endif
+#endif
+
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
+do {                                                                      \
+  if (yydebug)                                                            \
+    {                                                                     \
+      YYFPRINTF (stderr, "%s ", Title);                                   \
+      yy_symbol_print (stderr,                                            \
+                  Type, Value, Location); \
+      YYFPRINTF (stderr, "\n");                                           \
+    }                                                                     \
+} while (0)
+
+
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT.  |
+`----------------------------------------*/
+
+static void
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
+{
+  FILE *yyo = yyoutput;
+  YYUSE (yyo);
+  YYUSE (yylocationp);
+  if (!yyvaluep)
+    return;
+# ifdef YYPRINT
+  if (yytype < YYNTOKENS)
+    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# endif
+  YYUSE (yytype);
+}
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT.  |
+`--------------------------------*/
+
+static void
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
+{
+  YYFPRINTF (yyoutput, "%s %s (",
+             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+
+  YY_LOCATION_PRINT (yyoutput, *yylocationp);
+  YYFPRINTF (yyoutput, ": ");
+  yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
+  YYFPRINTF (yyoutput, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included).                                                   |
+`------------------------------------------------------------------*/
+
+static void
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+{
+  YYFPRINTF (stderr, "Stack now");
+  for (; yybottom <= yytop; yybottom++)
+    {
+      int yybot = *yybottom;
+      YYFPRINTF (stderr, " %d", yybot);
+    }
+  YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top)                            \
+do {                                                            \
+  if (yydebug)                                                  \
+    yy_stack_print ((Bottom), (Top));                           \
+} while (0)
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced.  |
+`------------------------------------------------*/
+
+static void
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
+{
+  unsigned long int yylno = yyrline[yyrule];
+  int yynrhs = yyr2[yyrule];
+  int yyi;
+  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+             yyrule - 1, yylno);
+  /* The symbols being reduced.  */
+  for (yyi = 0; yyi < yynrhs; yyi++)
+    {
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
+      yy_symbol_print (stderr,
+                       yystos[yyssp[yyi + 1 - yynrhs]],
+                       &(yyvsp[(yyi + 1) - (yynrhs)])
+                       , &(yylsp[(yyi + 1) - (yynrhs)])                       );
+      YYFPRINTF (stderr, "\n");
+    }
+}
+
+# define YY_REDUCE_PRINT(Rule)          \
+do {                                    \
+  if (yydebug)                          \
+    yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
+} while (0)
+
+/* Nonzero means print parse trace.  It is left uninitialized so that
+   multiple parsers can coexist.  */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks.  */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+   if the built-in stack extension method is used).
+
+   Do not make this value too large; the results are undefined if
+   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+   evaluated with infinite-precision integer arithmetic.  */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+#  if defined __GLIBC__ && defined _STRING_H
+#   define yystrlen strlen
+#  else
+/* Return the length of YYSTR.  */
+static YYSIZE_T
+yystrlen (const char *yystr)
+{
+  YYSIZE_T yylen;
+  for (yylen = 0; yystr[yylen]; yylen++)
+    continue;
+  return yylen;
+}
+#  endif
+# endif
+
+# ifndef yystpcpy
+#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+#   define yystpcpy stpcpy
+#  else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+   YYDEST.  */
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+{
+  char *yyd = yydest;
+  const char *yys = yysrc;
+
+  while ((*yyd++ = *yys++) != '\0')
+    continue;
+
+  return yyd - 1;
+}
+#  endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+   quotes and backslashes, so that it's suitable for yyerror.  The
+   heuristic is that double-quoting is unnecessary unless the string
+   contains an apostrophe, a comma, or backslash (other than
+   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
+   null, do not copy; instead, return the length of what the result
+   would have been.  */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+  if (*yystr == '"')
+    {
+      YYSIZE_T yyn = 0;
+      char const *yyp = yystr;
+
+      for (;;)
+        switch (*++yyp)
+          {
+          case '\'':
+          case ',':
+            goto do_not_strip_quotes;
+
+          case '\\':
+            if (*++yyp != '\\')
+              goto do_not_strip_quotes;
+            /* Fall through.  */
+          default:
+            if (yyres)
+              yyres[yyn] = *yyp;
+            yyn++;
+            break;
+
+          case '"':
+            if (yyres)
+              yyres[yyn] = '\0';
+            return yyn;
+          }
+    do_not_strip_quotes: ;
+    }
+
+  if (! yyres)
+    return yystrlen (yystr);
+
+  return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+   about the unexpected token YYTOKEN for the state stack whose top is
+   YYSSP.
+
+   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
+   not large enough to hold the message.  In that case, also set
+   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
+   required number of bytes is too large to store.  */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+                yytype_int16 *yyssp, int yytoken)
+{
+  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+  YYSIZE_T yysize = yysize0;
+  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+  /* Internationalized format string. */
+  const char *yyformat = YY_NULLPTR;
+  /* Arguments of yyformat. */
+  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+  /* Number of reported tokens (one for the "unexpected", one per
+     "expected"). */
+  int yycount = 0;
+
+  /* There are many possibilities here to consider:
+     - If this state is a consistent state with a default action, then
+       the only way this function was invoked is if the default action
+       is an error action.  In that case, don't check for expected
+       tokens because there are none.
+     - The only way there can be no lookahead present (in yychar) is if
+       this state is a consistent state with a default action.  Thus,
+       detecting the absence of a lookahead is sufficient to determine
+       that there is no unexpected or expected token to report.  In that
+       case, just report a simple "syntax error".
+     - Don't assume there isn't a lookahead just because this state is a
+       consistent state with a default action.  There might have been a
+       previous inconsistent state, consistent state with a non-default
+       action, or user semantic action that manipulated yychar.
+     - Of course, the expected token list depends on states to have
+       correct lookahead information, and it depends on the parser not
+       to perform extra reductions after fetching a lookahead from the
+       scanner and before detecting a syntax error.  Thus, state merging
+       (from LALR or IELR) and default reductions corrupt the expected
+       token list.  However, the list is correct for canonical LR with
+       one exception: it will still contain any token that will not be
+       accepted due to an error action in a later state.
+  */
+  if (yytoken != YYEMPTY)
+    {
+      int yyn = yypact[*yyssp];
+      yyarg[yycount++] = yytname[yytoken];
+      if (!yypact_value_is_default (yyn))
+        {
+          /* Start YYX at -YYN if negative to avoid negative indexes in
+             YYCHECK.  In other words, skip the first -YYN actions for
+             this state because they are default actions.  */
+          int yyxbegin = yyn < 0 ? -yyn : 0;
+          /* Stay within bounds of both yycheck and yytname.  */
+          int yychecklim = YYLAST - yyn + 1;
+          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+          int yyx;
+
+          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+                && !yytable_value_is_error (yytable[yyx + yyn]))
+              {
+                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+                  {
+                    yycount = 1;
+                    yysize = yysize0;
+                    break;
+                  }
+                yyarg[yycount++] = yytname[yyx];
+                {
+                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+                  if (! (yysize <= yysize1
+                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+                    return 2;
+                  yysize = yysize1;
+                }
+              }
+        }
+    }
+
+  switch (yycount)
+    {
+# define YYCASE_(N, S)                      \
+      case N:                               \
+        yyformat = S;                       \
+      break
+      YYCASE_(0, YY_("syntax error"));
+      YYCASE_(1, YY_("syntax error, unexpected %s"));
+      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+    }
+
+  {
+    YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+      return 2;
+    yysize = yysize1;
+  }
+
+  if (*yymsg_alloc < yysize)
+    {
+      *yymsg_alloc = 2 * yysize;
+      if (! (yysize <= *yymsg_alloc
+             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+      return 1;
+    }
+
+  /* Avoid sprintf, as that infringes on the user's name space.
+     Don't have undefined behavior even if the translation
+     produced a string with the wrong number of "%s"s.  */
+  {
+    char *yyp = *yymsg;
+    int yyi = 0;
+    while ((*yyp = *yyformat) != '\0')
+      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+        {
+          yyp += yytnamerr (yyp, yyarg[yyi++]);
+          yyformat += 2;
+        }
+      else
+        {
+          yyp++;
+          yyformat++;
+        }
+  }
+  return 0;
+}
+#endif /* YYERROR_VERBOSE */
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol.  |
+`-----------------------------------------------*/
+
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
+{
+  YYUSE (yyvaluep);
+  YYUSE (yylocationp);
+  if (!yymsg)
+    yymsg = "Deleting";
+  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  YYUSE (yytype);
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+}
+
+
+
+
+/* The lookahead symbol.  */
+__thread int yychar;
+
+
+/* The semantic value of the lookahead symbol.  */
+__thread YYSTYPE yylval;
+
+/* Location data for the lookahead symbol.  */
+__thread YYLTYPE yylloc
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+  = { 1, 1, 1, 1 }
+# endif
+;
+/* Number of syntax errors so far.  */
+__thread int yynerrs;
+
+
+
+/*----------.
+| yyparse.  |
+`----------*/
+
+int
+yyparse (void)
+{
+    int yystate;
+    /* Number of tokens to shift before error messages enabled.  */
+    int yyerrstatus;
+
+    /* The stacks and their tools:
+       'yyss': related to states.
+       'yyvs': related to semantic values.
+       'yyls': related to locations.
+
+       Refer to the stacks through separate pointers, to allow yyoverflow
+       to reallocate them elsewhere.  */
+
+    /* The state stack.  */
+    yytype_int16 yyssa[YYINITDEPTH];
+    yytype_int16 *yyss;
+    yytype_int16 *yyssp;
+
+    /* The semantic value stack.  */
+    YYSTYPE yyvsa[YYINITDEPTH];
+    YYSTYPE *yyvs;
+    YYSTYPE *yyvsp;
+
+    /* The location stack.  */
+    YYLTYPE yylsa[YYINITDEPTH];
+    YYLTYPE *yyls;
+    YYLTYPE *yylsp;
+
+    /* The locations where the error started and ended.  */
+    YYLTYPE yyerror_range[3];
+
+    YYSIZE_T yystacksize;
+
+  int yyn;
+  int yyresult;
+  /* Lookahead token as an internal (translated) token number.  */
+  int yytoken = 0;
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE yyval;
+  YYLTYPE yyloc;
+
+#if YYERROR_VERBOSE
+  /* Buffer for error messages, and its allocated size.  */
+  char yymsgbuf[128];
+  char *yymsg = yymsgbuf;
+  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
+
+  /* The number of symbols on the RHS of the reduced rule.
+     Keep to zero when no symbol should be popped.  */
+  int yylen = 0;
+
+  yyssp = yyss = yyssa;
+  yyvsp = yyvs = yyvsa;
+  yylsp = yyls = yylsa;
+  yystacksize = YYINITDEPTH;
+
+  YYDPRINTF ((stderr, "Starting parse\n"));
+
+  yystate = 0;
+  yyerrstatus = 0;
+  yynerrs = 0;
+  yychar = YYEMPTY; /* Cause a token to be read.  */
+  yylsp[0] = yylloc;
+  goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate.  |
+`------------------------------------------------------------*/
+ yynewstate:
+  /* In all cases, when you get here, the value and location stacks
+     have just been pushed.  So pushing a state here evens the stacks.  */
+  yyssp++;
+
+ yysetstate:
+  *yyssp = yystate;
+
+  if (yyss + yystacksize - 1 <= yyssp)
+    {
+      /* Get the current used size of the three stacks, in elements.  */
+      YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+      {
+        /* Give user a chance to reallocate the stack.  Use copies of
+           these so that the &'s don't force the real ones into
+           memory.  */
+        YYSTYPE *yyvs1 = yyvs;
+        yytype_int16 *yyss1 = yyss;
+        YYLTYPE *yyls1 = yyls;
+
+        /* Each stack pointer address is followed by the size of the
+           data in use in that stack, in bytes.  This used to be a
+           conditional around just the two extra args, but that might
+           be undefined if yyoverflow is a macro.  */
+        yyoverflow (YY_("memory exhausted"),
+                    &yyss1, yysize * sizeof (*yyssp),
+                    &yyvs1, yysize * sizeof (*yyvsp),
+                    &yyls1, yysize * sizeof (*yylsp),
+                    &yystacksize);
+
+        yyls = yyls1;
+        yyss = yyss1;
+        yyvs = yyvs1;
+      }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+      goto yyexhaustedlab;
+# else
+      /* Extend the stack our own way.  */
+      if (YYMAXDEPTH <= yystacksize)
+        goto yyexhaustedlab;
+      yystacksize *= 2;
+      if (YYMAXDEPTH < yystacksize)
+        yystacksize = YYMAXDEPTH;
+
+      {
+        yytype_int16 *yyss1 = yyss;
+        union yyalloc *yyptr =
+          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+        if (! yyptr)
+          goto yyexhaustedlab;
+        YYSTACK_RELOCATE (yyss_alloc, yyss);
+        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+        YYSTACK_RELOCATE (yyls_alloc, yyls);
+#  undef YYSTACK_RELOCATE
+        if (yyss1 != yyssa)
+          YYSTACK_FREE (yyss1);
+      }
+# endif
+#endif /* no yyoverflow */
+
+      yyssp = yyss + yysize - 1;
+      yyvsp = yyvs + yysize - 1;
+      yylsp = yyls + yysize - 1;
+
+      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+                  (unsigned long int) yystacksize));
+
+      if (yyss + yystacksize - 1 <= yyssp)
+        YYABORT;
+    }
+
+  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+  if (yystate == YYFINAL)
+    YYACCEPT;
+
+  goto yybackup;
+
+/*-----------.
+| yybackup.  |
+`-----------*/
+yybackup:
+
+  /* Do appropriate processing given the current state.  Read a
+     lookahead token if we need one and don't already have one.  */
+
+  /* First try to decide what to do without reference to lookahead token.  */
+  yyn = yypact[yystate];
+  if (yypact_value_is_default (yyn))
+    goto yydefault;
+
+  /* Not known => get a lookahead token if don't already have one.  */
+
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
+  if (yychar == YYEMPTY)
+    {
+      YYDPRINTF ((stderr, "Reading a token: "));
+      yychar = yylex ();
+    }
+
+  if (yychar <= YYEOF)
+    {
+      yychar = yytoken = YYEOF;
+      YYDPRINTF ((stderr, "Now at end of input.\n"));
+    }
+  else
+    {
+      yytoken = YYTRANSLATE (yychar);
+      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+    }
+
+  /* If the proper action on seeing token YYTOKEN is to reduce or to
+     detect an error, take that action.  */
+  yyn += yytoken;
+  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+    goto yydefault;
+  yyn = yytable[yyn];
+  if (yyn <= 0)
+    {
+      if (yytable_value_is_error (yyn))
+        goto yyerrlab;
+      yyn = -yyn;
+      goto yyreduce;
+    }
+
+  /* Count tokens shifted since error; after three, turn off error
+     status.  */
+  if (yyerrstatus)
+    yyerrstatus--;
+
+  /* Shift the lookahead token.  */
+  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+  /* Discard the shifted token.  */
+  yychar = YYEMPTY;
+
+  yystate = yyn;
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+  *++yylsp = yylloc;
+  goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state.  |
+`-----------------------------------------------------------*/
+yydefault:
+  yyn = yydefact[yystate];
+  if (yyn == 0)
+    goto yyerrlab;
+  goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction.  |
+`-----------------------------*/
+yyreduce:
+  /* yyn is the number of a rule to reduce with.  */
+  yylen = yyr2[yyn];
+
+  /* If YYLEN is nonzero, implement the default value of the action:
+     '$$ = $1'.
+
+     Otherwise, the following line sets YYVAL to garbage.
+     This behavior is undocumented and Bison
+     users should not rely upon it.  Assigning to YYVAL
+     unconditionally makes the parser a bit smaller, and it avoids a
+     GCC warning that YYVAL may be used uninitialized.  */
+  yyval = yyvsp[1-yylen];
+
+  /* Default location.  */
+  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
+  YY_REDUCE_PRINT (yyn);
+  switch (yyn)
+    {
+        case 2:
+#line 348 "pl_gram.y" /* yacc.c:1646  */
+    {
+						plpgsql_parse_result = (PLpgSQL_stmt_block *) (yyvsp[-1].stmt);
+					}
+#line 2062 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 5:
+#line 358 "pl_gram.y" /* yacc.c:1646  */
+    {
+						plpgsql_DumpExecTree = true;
+					}
+#line 2070 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 6:
+#line 362 "pl_gram.y" /* yacc.c:1646  */
+    {
+						if (strcmp((yyvsp[0].str), "on") == 0)
+							plpgsql_curr_compile->print_strict_params = true;
+						else if (strcmp((yyvsp[0].str), "off") == 0)
+							plpgsql_curr_compile->print_strict_params = false;
+						else
+							elog(ERROR, "unrecognized print_strict_params option %s", (yyvsp[0].str));
+					}
+#line 2083 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 7:
+#line 371 "pl_gram.y" /* yacc.c:1646  */
+    {
+						plpgsql_curr_compile->resolve_option = PLPGSQL_RESOLVE_ERROR;
+					}
+#line 2091 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 8:
+#line 375 "pl_gram.y" /* yacc.c:1646  */
+    {
+						plpgsql_curr_compile->resolve_option = PLPGSQL_RESOLVE_VARIABLE;
+					}
+#line 2099 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 9:
+#line 379 "pl_gram.y" /* yacc.c:1646  */
+    {
+						plpgsql_curr_compile->resolve_option = PLPGSQL_RESOLVE_COLUMN;
+					}
+#line 2107 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 10:
+#line 385 "pl_gram.y" /* yacc.c:1646  */
+    {
+					(yyval.str) = (yyvsp[0].word).ident;
+				}
+#line 2115 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 11:
+#line 389 "pl_gram.y" /* yacc.c:1646  */
+    {
+					(yyval.str) = pstrdup((yyvsp[0].keyword));
+				}
+#line 2123 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 14:
+#line 398 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_stmt_block *new;
+
+						new = palloc0(sizeof(PLpgSQL_stmt_block));
+
+						new->cmd_type	= PLPGSQL_STMT_BLOCK;
+						new->lineno		= plpgsql_location_to_lineno((yylsp[-4]));
+						new->label		= (yyvsp[-5].declhdr).label;
+						new->n_initvars = (yyvsp[-5].declhdr).n_initvars;
+						new->initvarnos = (yyvsp[-5].declhdr).initvarnos;
+						new->body		= (yyvsp[-3].list);
+						new->exceptions	= (yyvsp[-2].exception_block);
+
+						check_labels((yyvsp[-5].declhdr).label, (yyvsp[0].str), (yylsp[0]));
+						plpgsql_ns_pop();
+
+						(yyval.stmt) = (PLpgSQL_stmt *)new;
+					}
+#line 2146 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 15:
+#line 420 "pl_gram.y" /* yacc.c:1646  */
+    {
+						/* done with decls, so resume identifier lookup */
+						plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_NORMAL;
+						(yyval.declhdr).label	  = (yyvsp[0].str);
+						(yyval.declhdr).n_initvars = 0;
+						(yyval.declhdr).initvarnos = NULL;
+					}
+#line 2158 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 16:
+#line 428 "pl_gram.y" /* yacc.c:1646  */
+    {
+						plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_NORMAL;
+						(yyval.declhdr).label	  = (yyvsp[-1].str);
+						(yyval.declhdr).n_initvars = 0;
+						(yyval.declhdr).initvarnos = NULL;
+					}
+#line 2169 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 17:
+#line 435 "pl_gram.y" /* yacc.c:1646  */
+    {
+						plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_NORMAL;
+						(yyval.declhdr).label	  = (yyvsp[-2].str);
+						/* Remember variables declared in decl_stmts */
+						(yyval.declhdr).n_initvars = plpgsql_add_initdatums(&((yyval.declhdr).initvarnos));
+					}
+#line 2180 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 18:
+#line 444 "pl_gram.y" /* yacc.c:1646  */
+    {
+						/* Forget any variables created before block */
+						plpgsql_add_initdatums(NULL);
+						/*
+						 * Disable scanner lookup of identifiers while
+						 * we process the decl_stmts
+						 */
+						plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_DECLARE;
+					}
+#line 2194 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 22:
+#line 461 "pl_gram.y" /* yacc.c:1646  */
+    {
+						/* We allow useless extra DECLAREs */
+					}
+#line 2202 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 23:
+#line 465 "pl_gram.y" /* yacc.c:1646  */
+    {
+						/*
+						 * Throw a helpful error if user tries to put block
+						 * label just before BEGIN, instead of before DECLARE.
+						 */
+						ereport(ERROR,
+								(errcode(ERRCODE_SYNTAX_ERROR),
+								 errmsg("block label must be placed before DECLARE, not after"),
+								 parser_errposition((yylsp[-2]))));
+					}
+#line 2217 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 24:
+#line 478 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_variable	*var;
+
+						/*
+						 * If a collation is supplied, insert it into the
+						 * datatype.  We assume decl_datatype always returns
+						 * a freshly built struct not shared with other
+						 * variables.
+						 */
+						if (OidIsValid((yyvsp[-2].oid)))
+						{
+							if (!OidIsValid((yyvsp[-3].dtype)->collation))
+								ereport(ERROR,
+										(errcode(ERRCODE_DATATYPE_MISMATCH),
+										 errmsg("collations are not supported by type %s",
+												format_type_be((yyvsp[-3].dtype)->typoid)),
+										 parser_errposition((yylsp[-2]))));
+							(yyvsp[-3].dtype)->collation = (yyvsp[-2].oid);
+						}
+
+						var = plpgsql_build_variable((yyvsp[-5].varname).name, (yyvsp[-5].varname).lineno,
+													 (yyvsp[-3].dtype), true);
+						if ((yyvsp[-4].boolean))
+						{
+							if (var->dtype == PLPGSQL_DTYPE_VAR)
+								((PLpgSQL_var *) var)->isconst = (yyvsp[-4].boolean);
+							else
+								ereport(ERROR,
+										(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+										 errmsg("row or record variable cannot be CONSTANT"),
+										 parser_errposition((yylsp[-4]))));
+						}
+						if ((yyvsp[-1].boolean))
+						{
+							if (var->dtype == PLPGSQL_DTYPE_VAR)
+								((PLpgSQL_var *) var)->notnull = (yyvsp[-1].boolean);
+							else
+								ereport(ERROR,
+										(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+										 errmsg("row or record variable cannot be NOT NULL"),
+										 parser_errposition((yylsp[-2]))));
+
+						}
+						if ((yyvsp[0].expr) != NULL)
+						{
+							if (var->dtype == PLPGSQL_DTYPE_VAR)
+								((PLpgSQL_var *) var)->default_val = (yyvsp[0].expr);
+							else
+								ereport(ERROR,
+										(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+										 errmsg("default value for row or record variable is not supported"),
+										 parser_errposition((yylsp[-1]))));
+						}
+					}
+#line 2276 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 25:
+#line 533 "pl_gram.y" /* yacc.c:1646  */
+    {
+						plpgsql_ns_additem((yyvsp[-1].nsitem)->itemtype,
+										   (yyvsp[-1].nsitem)->itemno, (yyvsp[-4].varname).name);
+					}
+#line 2285 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 26:
+#line 538 "pl_gram.y" /* yacc.c:1646  */
+    { plpgsql_ns_push((yyvsp[-2].varname).name); }
+#line 2291 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 27:
+#line 540 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_var *new;
+						PLpgSQL_expr *curname_def;
+						char		buf[1024];
+						char		*cp1;
+						char		*cp2;
+
+						/* pop local namespace for cursor args */
+						plpgsql_ns_pop();
+
+						new = (PLpgSQL_var *)
+							plpgsql_build_variable((yyvsp[-6].varname).name, (yyvsp[-6].varname).lineno,
+												   plpgsql_build_datatype(REFCURSOROID,
+																		  -1,
+																		  InvalidOid),
+												   true);
+
+						curname_def = palloc0(sizeof(PLpgSQL_expr));
+
+						curname_def->dtype = PLPGSQL_DTYPE_EXPR;
+						strcpy(buf, "SELECT ");
+						cp1 = new->refname;
+						cp2 = buf + strlen(buf);
+						/*
+						 * Don't trust standard_conforming_strings here;
+						 * it might change before we use the string.
+						 */
+						if (strchr(cp1, '\\') != NULL)
+							*cp2++ = ESCAPE_STRING_SYNTAX;
+						*cp2++ = '\'';
+						while (*cp1)
+						{
+							if (SQL_STR_DOUBLE(*cp1, true))
+								*cp2++ = *cp1;
+							*cp2++ = *cp1++;
+						}
+						strcpy(cp2, "'::pg_catalog.refcursor");
+						curname_def->query = pstrdup(buf);
+						new->default_val = curname_def;
+
+						new->cursor_explicit_expr = (yyvsp[0].expr);
+						if ((yyvsp[-2].datum) == NULL)
+							new->cursor_explicit_argrow = -1;
+						else
+							new->cursor_explicit_argrow = (yyvsp[-2].datum)->dno;
+						new->cursor_options = CURSOR_OPT_FAST_PLAN | (yyvsp[-5].ival);
+					}
+#line 2343 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 28:
+#line 590 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.ival) = 0;
+					}
+#line 2351 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 29:
+#line 594 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.ival) = CURSOR_OPT_NO_SCROLL;
+					}
+#line 2359 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 30:
+#line 598 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.ival) = CURSOR_OPT_SCROLL;
+					}
+#line 2367 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 31:
+#line 604 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.expr) = read_sql_stmt("");
+					}
+#line 2375 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 32:
+#line 610 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.datum) = NULL;
+					}
+#line 2383 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 33:
+#line 614 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_row *new;
+						int i;
+						ListCell *l;
+
+						new = palloc0(sizeof(PLpgSQL_row));
+						new->dtype = PLPGSQL_DTYPE_ROW;
+						new->lineno = plpgsql_location_to_lineno((yylsp[-2]));
+						new->rowtupdesc = NULL;
+						new->nfields = list_length((yyvsp[-1].list));
+						new->fieldnames = palloc(new->nfields * sizeof(char *));
+						new->varnos = palloc(new->nfields * sizeof(int));
+
+						i = 0;
+						foreach (l, (yyvsp[-1].list))
+						{
+							PLpgSQL_variable *arg = (PLpgSQL_variable *) lfirst(l);
+							new->fieldnames[i] = arg->refname;
+							new->varnos[i] = arg->dno;
+							i++;
+						}
+						list_free((yyvsp[-1].list));
+
+						plpgsql_adddatum((PLpgSQL_datum *) new);
+						(yyval.datum) = (PLpgSQL_datum *) new;
+					}
+#line 2414 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 34:
+#line 643 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.list) = list_make1((yyvsp[0].datum));
+					}
+#line 2422 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 35:
+#line 647 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.list) = lappend((yyvsp[-2].list), (yyvsp[0].datum));
+					}
+#line 2430 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 36:
+#line 653 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.datum) = (PLpgSQL_datum *)
+							plpgsql_build_variable((yyvsp[-1].varname).name, (yyvsp[-1].varname).lineno,
+												   (yyvsp[0].dtype), true);
+					}
+#line 2440 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 39:
+#line 664 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_nsitem *nsi;
+
+						nsi = plpgsql_ns_lookup(plpgsql_ns_top(), false,
+												(yyvsp[0].word).ident, NULL, NULL,
+												NULL);
+						if (nsi == NULL)
+							ereport(ERROR,
+									(errcode(ERRCODE_UNDEFINED_OBJECT),
+									 errmsg("variable \"%s\" does not exist",
+											(yyvsp[0].word).ident),
+									 parser_errposition((yylsp[0]))));
+						(yyval.nsitem) = nsi;
+					}
+#line 2459 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 40:
+#line 679 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_nsitem *nsi;
+
+						nsi = plpgsql_ns_lookup(plpgsql_ns_top(), false,
+												(yyvsp[0].keyword), NULL, NULL,
+												NULL);
+						if (nsi == NULL)
+							ereport(ERROR,
+									(errcode(ERRCODE_UNDEFINED_OBJECT),
+									 errmsg("variable \"%s\" does not exist",
+											(yyvsp[0].keyword)),
+									 parser_errposition((yylsp[0]))));
+						(yyval.nsitem) = nsi;
+					}
+#line 2478 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 41:
+#line 694 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_nsitem *nsi;
+
+						if (list_length((yyvsp[0].cword).idents) == 2)
+							nsi = plpgsql_ns_lookup(plpgsql_ns_top(), false,
+													strVal(linitial((yyvsp[0].cword).idents)),
+													strVal(lsecond((yyvsp[0].cword).idents)),
+													NULL,
+													NULL);
+						else if (list_length((yyvsp[0].cword).idents) == 3)
+							nsi = plpgsql_ns_lookup(plpgsql_ns_top(), false,
+													strVal(linitial((yyvsp[0].cword).idents)),
+													strVal(lsecond((yyvsp[0].cword).idents)),
+													strVal(lthird((yyvsp[0].cword).idents)),
+													NULL);
+						else
+							nsi = NULL;
+						if (nsi == NULL)
+							ereport(ERROR,
+									(errcode(ERRCODE_UNDEFINED_OBJECT),
+									 errmsg("variable \"%s\" does not exist",
+											NameListToString((yyvsp[0].cword).idents)),
+									 parser_errposition((yylsp[0]))));
+						(yyval.nsitem) = nsi;
+					}
+#line 2508 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 42:
+#line 722 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.varname).name = (yyvsp[0].word).ident;
+						(yyval.varname).lineno = plpgsql_location_to_lineno((yylsp[0]));
+						/*
+						 * Check to make sure name isn't already declared
+						 * in the current block.
+						 */
+						if (plpgsql_ns_lookup(plpgsql_ns_top(), true,
+											  (yyvsp[0].word).ident, NULL, NULL,
+											  NULL) != NULL)
+							yyerror("duplicate declaration");
+
+						if (plpgsql_curr_compile->extra_warnings & PLPGSQL_XCHECK_SHADOWVAR ||
+							plpgsql_curr_compile->extra_errors & PLPGSQL_XCHECK_SHADOWVAR)
+						{
+							PLpgSQL_nsitem *nsi;
+							nsi = plpgsql_ns_lookup(plpgsql_ns_top(), false,
+													(yyvsp[0].word).ident, NULL, NULL, NULL);
+							if (nsi != NULL)
+								ereport(plpgsql_curr_compile->extra_errors & PLPGSQL_XCHECK_SHADOWVAR ? ERROR : WARNING,
+										(errcode(ERRCODE_DUPLICATE_ALIAS),
+										 errmsg("variable \"%s\" shadows a previously defined variable",
+												(yyvsp[0].word).ident),
+										 parser_errposition((yylsp[0]))));
+						}
+
+					}
+#line 2540 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 43:
+#line 750 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.varname).name = pstrdup((yyvsp[0].keyword));
+						(yyval.varname).lineno = plpgsql_location_to_lineno((yylsp[0]));
+						/*
+						 * Check to make sure name isn't already declared
+						 * in the current block.
+						 */
+						if (plpgsql_ns_lookup(plpgsql_ns_top(), true,
+											  (yyvsp[0].keyword), NULL, NULL,
+											  NULL) != NULL)
+							yyerror("duplicate declaration");
+
+						if (plpgsql_curr_compile->extra_warnings & PLPGSQL_XCHECK_SHADOWVAR ||
+							plpgsql_curr_compile->extra_errors & PLPGSQL_XCHECK_SHADOWVAR)
+						{
+							PLpgSQL_nsitem *nsi;
+							nsi = plpgsql_ns_lookup(plpgsql_ns_top(), false,
+													(yyvsp[0].keyword), NULL, NULL, NULL);
+							if (nsi != NULL)
+								ereport(plpgsql_curr_compile->extra_errors & PLPGSQL_XCHECK_SHADOWVAR ? ERROR : WARNING,
+										(errcode(ERRCODE_DUPLICATE_ALIAS),
+										 errmsg("variable \"%s\" shadows a previously defined variable",
+												(yyvsp[0].keyword)),
+										 parser_errposition((yylsp[0]))));
+						}
+
+					}
+#line 2572 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 44:
+#line 780 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.boolean) = false; }
+#line 2578 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 45:
+#line 782 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.boolean) = true; }
+#line 2584 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 46:
+#line 786 "pl_gram.y" /* yacc.c:1646  */
+    {
+						/*
+						 * If there's a lookahead token, read_datatype
+						 * should consume it.
+						 */
+						(yyval.dtype) = read_datatype(yychar);
+						yyclearin;
+					}
+#line 2597 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 47:
+#line 797 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.oid) = InvalidOid; }
+#line 2603 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 48:
+#line 799 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.oid) = get_collation_oid(list_make1(makeString((yyvsp[0].word).ident)),
+											   false);
+					}
+#line 2612 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 49:
+#line 804 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.oid) = get_collation_oid(list_make1(makeString(pstrdup((yyvsp[0].keyword)))),
+											   false);
+					}
+#line 2621 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 50:
+#line 809 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.oid) = get_collation_oid((yyvsp[0].cword).idents, false);
+					}
+#line 2629 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 51:
+#line 815 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.boolean) = false; }
+#line 2635 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 52:
+#line 817 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.boolean) = true; }
+#line 2641 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 53:
+#line 821 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.expr) = NULL; }
+#line 2647 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 54:
+#line 823 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.expr) = read_sql_expression(';', ";");
+					}
+#line 2655 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 59:
+#line 842 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.list) = NIL; }
+#line 2661 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 60:
+#line 844 "pl_gram.y" /* yacc.c:1646  */
+    {
+						/* don't bother linking null statements into list */
+						if ((yyvsp[0].stmt) == NULL)
+							(yyval.list) = (yyvsp[-1].list);
+						else
+							(yyval.list) = lappend((yyvsp[-1].list), (yyvsp[0].stmt));
+					}
+#line 2673 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 61:
+#line 854 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[-1].stmt); }
+#line 2679 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 62:
+#line 856 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2685 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 63:
+#line 858 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2691 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 64:
+#line 860 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2697 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 65:
+#line 862 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2703 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 66:
+#line 864 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2709 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 67:
+#line 866 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2715 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 68:
+#line 868 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2721 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 69:
+#line 870 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2727 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 70:
+#line 872 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2733 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 71:
+#line 874 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2739 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 72:
+#line 876 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2745 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 73:
+#line 878 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2751 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 74:
+#line 880 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2757 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 75:
+#line 882 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2763 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 76:
+#line 884 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2769 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 77:
+#line 886 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2775 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 78:
+#line 888 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2781 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 79:
+#line 890 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2787 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 80:
+#line 892 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2793 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 81:
+#line 894 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2799 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 82:
+#line 898 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_stmt_perform *new;
+
+						new = palloc0(sizeof(PLpgSQL_stmt_perform));
+						new->cmd_type = PLPGSQL_STMT_PERFORM;
+						new->lineno   = plpgsql_location_to_lineno((yylsp[-1]));
+						new->expr  = (yyvsp[0].expr);
+
+						(yyval.stmt) = (PLpgSQL_stmt *)new;
+					}
+#line 2814 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 83:
+#line 911 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_stmt_assign *new;
+
+						new = palloc0(sizeof(PLpgSQL_stmt_assign));
+						new->cmd_type = PLPGSQL_STMT_ASSIGN;
+						new->lineno   = plpgsql_location_to_lineno((yylsp[-2]));
+						new->varno = (yyvsp[-2].ival);
+						new->expr  = (yyvsp[0].expr);
+
+						(yyval.stmt) = (PLpgSQL_stmt *)new;
+					}
+#line 2830 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 84:
+#line 925 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_stmt_getdiag	 *new;
+						ListCell		*lc;
+
+						new = palloc0(sizeof(PLpgSQL_stmt_getdiag));
+						new->cmd_type = PLPGSQL_STMT_GETDIAG;
+						new->lineno   = plpgsql_location_to_lineno((yylsp[-4]));
+						new->is_stacked = (yyvsp[-3].boolean);
+						new->diag_items = (yyvsp[-1].list);
+
+						/*
+						 * Check information items are valid for area option.
+						 */
+						foreach(lc, new->diag_items)
+						{
+							PLpgSQL_diag_item *ditem = (PLpgSQL_diag_item *) lfirst(lc);
+
+							switch (ditem->kind)
+							{
+								/* these fields are disallowed in stacked case */
+								case PLPGSQL_GETDIAG_ROW_COUNT:
+								case PLPGSQL_GETDIAG_RESULT_OID:
+									if (new->is_stacked)
+										ereport(ERROR,
+												(errcode(ERRCODE_SYNTAX_ERROR),
+												 errmsg("diagnostics item %s is not allowed in GET STACKED DIAGNOSTICS",
+														plpgsql_getdiag_kindname(ditem->kind)),
+												 parser_errposition((yylsp[-4]))));
+									break;
+								/* these fields are disallowed in current case */
+								case PLPGSQL_GETDIAG_ERROR_CONTEXT:
+								case PLPGSQL_GETDIAG_ERROR_DETAIL:
+								case PLPGSQL_GETDIAG_ERROR_HINT:
+								case PLPGSQL_GETDIAG_RETURNED_SQLSTATE:
+								case PLPGSQL_GETDIAG_COLUMN_NAME:
+								case PLPGSQL_GETDIAG_CONSTRAINT_NAME:
+								case PLPGSQL_GETDIAG_DATATYPE_NAME:
+								case PLPGSQL_GETDIAG_MESSAGE_TEXT:
+								case PLPGSQL_GETDIAG_TABLE_NAME:
+								case PLPGSQL_GETDIAG_SCHEMA_NAME:
+									if (!new->is_stacked)
+										ereport(ERROR,
+												(errcode(ERRCODE_SYNTAX_ERROR),
+												 errmsg("diagnostics item %s is not allowed in GET CURRENT DIAGNOSTICS",
+														plpgsql_getdiag_kindname(ditem->kind)),
+												 parser_errposition((yylsp[-4]))));
+									break;
+								/* these fields are allowed in either case */
+								case PLPGSQL_GETDIAG_CONTEXT:
+									break;
+								default:
+									elog(ERROR, "unrecognized diagnostic item kind: %d",
+										 ditem->kind);
+									break;
+							}
+						}
+
+						(yyval.stmt) = (PLpgSQL_stmt *)new;
+					}
+#line 2894 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 85:
+#line 987 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.boolean) = false;
+					}
+#line 2902 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 86:
+#line 991 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.boolean) = false;
+					}
+#line 2910 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 87:
+#line 995 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.boolean) = true;
+					}
+#line 2918 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 88:
+#line 1001 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.list) = lappend((yyvsp[-2].list), (yyvsp[0].diagitem));
+					}
+#line 2926 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 89:
+#line 1005 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.list) = list_make1((yyvsp[0].diagitem));
+					}
+#line 2934 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 90:
+#line 1011 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_diag_item *new;
+
+						new = palloc(sizeof(PLpgSQL_diag_item));
+						new->target = (yyvsp[-2].ival);
+						new->kind = (yyvsp[0].ival);
+
+						(yyval.diagitem) = new;
+					}
+#line 2948 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 91:
+#line 1023 "pl_gram.y" /* yacc.c:1646  */
+    {
+						int	tok = yylex();
+
+						if (tok_is_keyword(tok, &yylval,
+										   K_ROW_COUNT, "row_count"))
+							(yyval.ival) = PLPGSQL_GETDIAG_ROW_COUNT;
+						else if (tok_is_keyword(tok, &yylval,
+												K_RESULT_OID, "result_oid"))
+							(yyval.ival) = PLPGSQL_GETDIAG_RESULT_OID;
+						else if (tok_is_keyword(tok, &yylval,
+												K_PG_CONTEXT, "pg_context"))
+							(yyval.ival) = PLPGSQL_GETDIAG_CONTEXT;
+						else if (tok_is_keyword(tok, &yylval,
+												K_PG_EXCEPTION_DETAIL, "pg_exception_detail"))
+							(yyval.ival) = PLPGSQL_GETDIAG_ERROR_DETAIL;
+						else if (tok_is_keyword(tok, &yylval,
+												K_PG_EXCEPTION_HINT, "pg_exception_hint"))
+							(yyval.ival) = PLPGSQL_GETDIAG_ERROR_HINT;
+						else if (tok_is_keyword(tok, &yylval,
+												K_PG_EXCEPTION_CONTEXT, "pg_exception_context"))
+							(yyval.ival) = PLPGSQL_GETDIAG_ERROR_CONTEXT;
+						else if (tok_is_keyword(tok, &yylval,
+												K_COLUMN_NAME, "column_name"))
+							(yyval.ival) = PLPGSQL_GETDIAG_COLUMN_NAME;
+						else if (tok_is_keyword(tok, &yylval,
+												K_CONSTRAINT_NAME, "constraint_name"))
+							(yyval.ival) = PLPGSQL_GETDIAG_CONSTRAINT_NAME;
+						else if (tok_is_keyword(tok, &yylval,
+												K_PG_DATATYPE_NAME, "pg_datatype_name"))
+							(yyval.ival) = PLPGSQL_GETDIAG_DATATYPE_NAME;
+						else if (tok_is_keyword(tok, &yylval,
+												K_MESSAGE_TEXT, "message_text"))
+							(yyval.ival) = PLPGSQL_GETDIAG_MESSAGE_TEXT;
+						else if (tok_is_keyword(tok, &yylval,
+												K_TABLE_NAME, "table_name"))
+							(yyval.ival) = PLPGSQL_GETDIAG_TABLE_NAME;
+						else if (tok_is_keyword(tok, &yylval,
+												K_SCHEMA_NAME, "schema_name"))
+							(yyval.ival) = PLPGSQL_GETDIAG_SCHEMA_NAME;
+						else if (tok_is_keyword(tok, &yylval,
+												K_RETURNED_SQLSTATE, "returned_sqlstate"))
+							(yyval.ival) = PLPGSQL_GETDIAG_RETURNED_SQLSTATE;
+						else
+							yyerror("unrecognized GET DIAGNOSTICS item");
+					}
+#line 2998 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 92:
+#line 1071 "pl_gram.y" /* yacc.c:1646  */
+    {
+						check_assignable((yyvsp[0].wdatum).datum, (yylsp[0]));
+						if ((yyvsp[0].wdatum).datum->dtype == PLPGSQL_DTYPE_ROW ||
+							(yyvsp[0].wdatum).datum->dtype == PLPGSQL_DTYPE_REC)
+							ereport(ERROR,
+									(errcode(ERRCODE_SYNTAX_ERROR),
+									 errmsg("\"%s\" is not a scalar variable",
+											NameOfDatum(&((yyvsp[0].wdatum)))),
+									 parser_errposition((yylsp[0]))));
+						(yyval.ival) = (yyvsp[0].wdatum).datum->dno;
+					}
+#line 3014 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 93:
+#line 1083 "pl_gram.y" /* yacc.c:1646  */
+    {
+						/* just to give a better message than "syntax error" */
+						word_is_not_variable(&((yyvsp[0].word)), (yylsp[0]));
+					}
+#line 3023 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 94:
+#line 1088 "pl_gram.y" /* yacc.c:1646  */
+    {
+						/* just to give a better message than "syntax error" */
+						cword_is_not_variable(&((yyvsp[0].cword)), (yylsp[0]));
+					}
+#line 3032 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 95:
+#line 1096 "pl_gram.y" /* yacc.c:1646  */
+    {
+						check_assignable((yyvsp[0].wdatum).datum, (yylsp[0]));
+						(yyval.ival) = (yyvsp[0].wdatum).datum->dno;
+					}
+#line 3041 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 96:
+#line 1101 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_arrayelem	*new;
+
+						new = palloc0(sizeof(PLpgSQL_arrayelem));
+						new->dtype		= PLPGSQL_DTYPE_ARRAYELEM;
+						new->subscript	= (yyvsp[0].expr);
+						new->arrayparentno = (yyvsp[-2].ival);
+						/* initialize cached type data to "not valid" */
+						new->parenttypoid = InvalidOid;
+
+						plpgsql_adddatum((PLpgSQL_datum *) new);
+
+						(yyval.ival) = new->dno;
+					}
+#line 3060 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 97:
+#line 1118 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_stmt_if *new;
+
+						new = palloc0(sizeof(PLpgSQL_stmt_if));
+						new->cmd_type	= PLPGSQL_STMT_IF;
+						new->lineno		= plpgsql_location_to_lineno((yylsp[-7]));
+						new->cond		= (yyvsp[-6].expr);
+						new->then_body	= (yyvsp[-5].list);
+						new->elsif_list = (yyvsp[-4].list);
+						new->else_body  = (yyvsp[-3].list);
+
+						(yyval.stmt) = (PLpgSQL_stmt *)new;
+					}
+#line 3078 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 98:
+#line 1134 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.list) = NIL;
+					}
+#line 3086 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 99:
+#line 1138 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_if_elsif *new;
+
+						new = palloc0(sizeof(PLpgSQL_if_elsif));
+						new->lineno = plpgsql_location_to_lineno((yylsp[-2]));
+						new->cond   = (yyvsp[-1].expr);
+						new->stmts  = (yyvsp[0].list);
+
+						(yyval.list) = lappend((yyvsp[-3].list), new);
+					}
+#line 3101 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 100:
+#line 1151 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.list) = NIL;
+					}
+#line 3109 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 101:
+#line 1155 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.list) = (yyvsp[0].list);
+					}
+#line 3117 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 102:
+#line 1161 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.stmt) = make_case((yylsp[-6]), (yyvsp[-5].expr), (yyvsp[-4].list), (yyvsp[-3].list));
+					}
+#line 3125 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 103:
+#line 1167 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_expr *expr = NULL;
+						int	tok = yylex();
+
+						if (tok != K_WHEN)
+						{
+							plpgsql_push_back_token(tok);
+							expr = read_sql_expression(K_WHEN, "WHEN");
+						}
+						plpgsql_push_back_token(K_WHEN);
+						(yyval.expr) = expr;
+					}
+#line 3142 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 104:
+#line 1182 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.list) = lappend((yyvsp[-1].list), (yyvsp[0].casewhen));
+					}
+#line 3150 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 105:
+#line 1186 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.list) = list_make1((yyvsp[0].casewhen));
+					}
+#line 3158 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 106:
+#line 1192 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_case_when *new = palloc(sizeof(PLpgSQL_case_when));
+
+						new->lineno	= plpgsql_location_to_lineno((yylsp[-2]));
+						new->expr	= (yyvsp[-1].expr);
+						new->stmts	= (yyvsp[0].list);
+						(yyval.casewhen) = new;
+					}
+#line 3171 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 107:
+#line 1203 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.list) = NIL;
+					}
+#line 3179 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 108:
+#line 1207 "pl_gram.y" /* yacc.c:1646  */
+    {
+						/*
+						 * proc_sect could return an empty list, but we
+						 * must distinguish that from not having ELSE at all.
+						 * Simplest fix is to return a list with one NULL
+						 * pointer, which make_case() must take care of.
+						 */
+						if ((yyvsp[0].list) != NIL)
+							(yyval.list) = (yyvsp[0].list);
+						else
+							(yyval.list) = list_make1(NULL);
+					}
+#line 3196 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 109:
+#line 1222 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_stmt_loop *new;
+
+						new = palloc0(sizeof(PLpgSQL_stmt_loop));
+						new->cmd_type = PLPGSQL_STMT_LOOP;
+						new->lineno   = plpgsql_location_to_lineno((yylsp[-1]));
+						new->label	  = (yyvsp[-2].str);
+						new->body	  = (yyvsp[0].loop_body).stmts;
+
+						check_labels((yyvsp[-2].str), (yyvsp[0].loop_body).end_label, (yyvsp[0].loop_body).end_label_location);
+						plpgsql_ns_pop();
+
+						(yyval.stmt) = (PLpgSQL_stmt *)new;
+					}
+#line 3215 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 110:
+#line 1239 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_stmt_while *new;
+
+						new = palloc0(sizeof(PLpgSQL_stmt_while));
+						new->cmd_type = PLPGSQL_STMT_WHILE;
+						new->lineno   = plpgsql_location_to_lineno((yylsp[-2]));
+						new->label	  = (yyvsp[-3].str);
+						new->cond	  = (yyvsp[-1].expr);
+						new->body	  = (yyvsp[0].loop_body).stmts;
+
+						check_labels((yyvsp[-3].str), (yyvsp[0].loop_body).end_label, (yyvsp[0].loop_body).end_label_location);
+						plpgsql_ns_pop();
+
+						(yyval.stmt) = (PLpgSQL_stmt *)new;
+					}
+#line 3235 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 111:
+#line 1257 "pl_gram.y" /* yacc.c:1646  */
+    {
+						/* This runs after we've scanned the loop body */
+						if ((yyvsp[-1].stmt)->cmd_type == PLPGSQL_STMT_FORI)
+						{
+							PLpgSQL_stmt_fori		*new;
+
+							new = (PLpgSQL_stmt_fori *) (yyvsp[-1].stmt);
+							new->lineno   = plpgsql_location_to_lineno((yylsp[-2]));
+							new->label	  = (yyvsp[-3].str);
+							new->body	  = (yyvsp[0].loop_body).stmts;
+							(yyval.stmt) = (PLpgSQL_stmt *) new;
+						}
+						else
+						{
+							PLpgSQL_stmt_forq		*new;
+
+							Assert((yyvsp[-1].stmt)->cmd_type == PLPGSQL_STMT_FORS ||
+								   (yyvsp[-1].stmt)->cmd_type == PLPGSQL_STMT_FORC ||
+								   (yyvsp[-1].stmt)->cmd_type == PLPGSQL_STMT_DYNFORS);
+							/* forq is the common supertype of all three */
+							new = (PLpgSQL_stmt_forq *) (yyvsp[-1].stmt);
+							new->lineno   = plpgsql_location_to_lineno((yylsp[-2]));
+							new->label	  = (yyvsp[-3].str);
+							new->body	  = (yyvsp[0].loop_body).stmts;
+							(yyval.stmt) = (PLpgSQL_stmt *) new;
+						}
+
+						check_labels((yyvsp[-3].str), (yyvsp[0].loop_body).end_label, (yyvsp[0].loop_body).end_label_location);
+						/* close namespace started in opt_block_label */
+						plpgsql_ns_pop();
+					}
+#line 3271 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 112:
+#line 1291 "pl_gram.y" /* yacc.c:1646  */
+    {
+						int			tok = yylex();
+						int			tokloc = yylloc;
+
+						if (tok == K_EXECUTE)
+						{
+							/* EXECUTE means it's a dynamic FOR loop */
+							PLpgSQL_stmt_dynfors	*new;
+							PLpgSQL_expr			*expr;
+							int						term;
+
+							expr = read_sql_expression2(K_LOOP, K_USING,
+														"LOOP or USING",
+														&term);
+
+							new = palloc0(sizeof(PLpgSQL_stmt_dynfors));
+							new->cmd_type = PLPGSQL_STMT_DYNFORS;
+							if ((yyvsp[-1].forvariable).rec)
+							{
+								new->rec = (yyvsp[-1].forvariable).rec;
+								check_assignable((PLpgSQL_datum *) new->rec, (yylsp[-1]));
+							}
+							else if ((yyvsp[-1].forvariable).row)
+							{
+								new->row = (yyvsp[-1].forvariable).row;
+								check_assignable((PLpgSQL_datum *) new->row, (yylsp[-1]));
+							}
+							else if ((yyvsp[-1].forvariable).scalar)
+							{
+								/* convert single scalar to list */
+								new->row = make_scalar_list1((yyvsp[-1].forvariable).name, (yyvsp[-1].forvariable).scalar,
+															 (yyvsp[-1].forvariable).lineno, (yylsp[-1]));
+								/* no need for check_assignable */
+							}
+							else
+							{
+								ereport(ERROR,
+										(errcode(ERRCODE_DATATYPE_MISMATCH),
+										 errmsg("loop variable of loop over rows must be a record or row variable or list of scalar variables"),
+										 parser_errposition((yylsp[-1]))));
+							}
+							new->query = expr;
+
+							if (term == K_USING)
+							{
+								do
+								{
+									expr = read_sql_expression2(',', K_LOOP,
+																", or LOOP",
+																&term);
+									new->params = lappend(new->params, expr);
+								} while (term == ',');
+							}
+
+							(yyval.stmt) = (PLpgSQL_stmt *) new;
+						}
+						else if (tok == T_DATUM &&
+								 yylval.wdatum.datum->dtype == PLPGSQL_DTYPE_VAR &&
+								 ((PLpgSQL_var *) yylval.wdatum.datum)->datatype->typoid == REFCURSOROID)
+						{
+							/* It's FOR var IN cursor */
+							PLpgSQL_stmt_forc	*new;
+							PLpgSQL_var			*cursor = (PLpgSQL_var *) yylval.wdatum.datum;
+
+							new = (PLpgSQL_stmt_forc *) palloc0(sizeof(PLpgSQL_stmt_forc));
+							new->cmd_type = PLPGSQL_STMT_FORC;
+							new->curvar = cursor->dno;
+
+							/* Should have had a single variable name */
+							if ((yyvsp[-1].forvariable).scalar && (yyvsp[-1].forvariable).row)
+								ereport(ERROR,
+										(errcode(ERRCODE_SYNTAX_ERROR),
+										 errmsg("cursor FOR loop must have only one target variable"),
+										 parser_errposition((yylsp[-1]))));
+
+							/* can't use an unbound cursor this way */
+							if (cursor->cursor_explicit_expr == NULL)
+								ereport(ERROR,
+										(errcode(ERRCODE_SYNTAX_ERROR),
+										 errmsg("cursor FOR loop must use a bound cursor variable"),
+										 parser_errposition(tokloc)));
+
+							/* collect cursor's parameters if any */
+							new->argquery = read_cursor_args(cursor,
+															 K_LOOP,
+															 "LOOP");
+
+							/* create loop's private RECORD variable */
+							new->rec = plpgsql_build_record((yyvsp[-1].forvariable).name,
+															(yyvsp[-1].forvariable).lineno,
+															true);
+
+							(yyval.stmt) = (PLpgSQL_stmt *) new;
+						}
+						else
+						{
+							PLpgSQL_expr	*expr1;
+							int				expr1loc;
+							bool			reverse = false;
+
+							/*
+							 * We have to distinguish between two
+							 * alternatives: FOR var IN a .. b and FOR
+							 * var IN query. Unfortunately this is
+							 * tricky, since the query in the second
+							 * form needn't start with a SELECT
+							 * keyword.  We use the ugly hack of
+							 * looking for two periods after the first
+							 * token. We also check for the REVERSE
+							 * keyword, which means it must be an
+							 * integer loop.
+							 */
+							if (tok_is_keyword(tok, &yylval,
+											   K_REVERSE, "reverse"))
+								reverse = true;
+							else
+								plpgsql_push_back_token(tok);
+
+							/*
+							 * Read tokens until we see either a ".."
+							 * or a LOOP. The text we read may not
+							 * necessarily be a well-formed SQL
+							 * statement, so we need to invoke
+							 * read_sql_construct directly.
+							 */
+							expr1 = read_sql_construct(DOT_DOT,
+													   K_LOOP,
+													   0,
+													   "LOOP",
+													   "SELECT ",
+													   true,
+													   false,
+													   true,
+													   &expr1loc,
+													   &tok);
+
+							if (tok == DOT_DOT)
+							{
+								/* Saw "..", so it must be an integer loop */
+								PLpgSQL_expr		*expr2;
+								PLpgSQL_expr		*expr_by;
+								PLpgSQL_var			*fvar;
+								PLpgSQL_stmt_fori	*new;
+
+								/* Check first expression is well-formed */
+								check_sql_expr(expr1->query, expr1loc, 7);
+
+								/* Read and check the second one */
+								expr2 = read_sql_expression2(K_LOOP, K_BY,
+															 "LOOP",
+															 &tok);
+
+								/* Get the BY clause if any */
+								if (tok == K_BY)
+									expr_by = read_sql_expression(K_LOOP,
+																  "LOOP");
+								else
+									expr_by = NULL;
+
+								/* Should have had a single variable name */
+								if ((yyvsp[-1].forvariable).scalar && (yyvsp[-1].forvariable).row)
+									ereport(ERROR,
+											(errcode(ERRCODE_SYNTAX_ERROR),
+											 errmsg("integer FOR loop must have only one target variable"),
+											 parser_errposition((yylsp[-1]))));
+
+								/* create loop's private variable */
+								fvar = (PLpgSQL_var *)
+									plpgsql_build_variable((yyvsp[-1].forvariable).name,
+														   (yyvsp[-1].forvariable).lineno,
+														   plpgsql_build_datatype(INT4OID,
+																				  -1,
+																				  InvalidOid),
+														   true);
+
+								new = palloc0(sizeof(PLpgSQL_stmt_fori));
+								new->cmd_type = PLPGSQL_STMT_FORI;
+								new->var	  = fvar;
+								new->reverse  = reverse;
+								new->lower	  = expr1;
+								new->upper	  = expr2;
+								new->step	  = expr_by;
+
+								(yyval.stmt) = (PLpgSQL_stmt *) new;
+							}
+							else
+							{
+								/*
+								 * No "..", so it must be a query loop. We've
+								 * prefixed an extra SELECT to the query text,
+								 * so we need to remove that before performing
+								 * syntax checking.
+								 */
+								char				*tmp_query;
+								PLpgSQL_stmt_fors	*new;
+
+								if (reverse)
+									ereport(ERROR,
+											(errcode(ERRCODE_SYNTAX_ERROR),
+											 errmsg("cannot specify REVERSE in query FOR loop"),
+											 parser_errposition(tokloc)));
+
+								Assert(strncmp(expr1->query, "SELECT ", 7) == 0);
+								tmp_query = pstrdup(expr1->query + 7);
+								pfree(expr1->query);
+								expr1->query = tmp_query;
+
+								check_sql_expr(expr1->query, expr1loc, 0);
+
+								new = palloc0(sizeof(PLpgSQL_stmt_fors));
+								new->cmd_type = PLPGSQL_STMT_FORS;
+								if ((yyvsp[-1].forvariable).rec)
+								{
+									new->rec = (yyvsp[-1].forvariable).rec;
+									check_assignable((PLpgSQL_datum *) new->rec, (yylsp[-1]));
+								}
+								else if ((yyvsp[-1].forvariable).row)
+								{
+									new->row = (yyvsp[-1].forvariable).row;
+									check_assignable((PLpgSQL_datum *) new->row, (yylsp[-1]));
+								}
+								else if ((yyvsp[-1].forvariable).scalar)
+								{
+									/* convert single scalar to list */
+									new->row = make_scalar_list1((yyvsp[-1].forvariable).name, (yyvsp[-1].forvariable).scalar,
+																 (yyvsp[-1].forvariable).lineno, (yylsp[-1]));
+									/* no need for check_assignable */
+								}
+								else
+								{
+									ereport(ERROR,
+											(errcode(ERRCODE_SYNTAX_ERROR),
+											 errmsg("loop variable of loop over rows must be a record or row variable or list of scalar variables"),
+											 parser_errposition((yylsp[-1]))));
+								}
+
+								new->query = expr1;
+								(yyval.stmt) = (PLpgSQL_stmt *) new;
+							}
+						}
+					}
+#line 3517 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 113:
+#line 1553 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.forvariable).name = NameOfDatum(&((yyvsp[0].wdatum)));
+						(yyval.forvariable).lineno = plpgsql_location_to_lineno((yylsp[0]));
+						if ((yyvsp[0].wdatum).datum->dtype == PLPGSQL_DTYPE_ROW)
+						{
+							(yyval.forvariable).scalar = NULL;
+							(yyval.forvariable).rec = NULL;
+							(yyval.forvariable).row = (PLpgSQL_row *) (yyvsp[0].wdatum).datum;
+						}
+						else if ((yyvsp[0].wdatum).datum->dtype == PLPGSQL_DTYPE_REC)
+						{
+							(yyval.forvariable).scalar = NULL;
+							(yyval.forvariable).rec = (PLpgSQL_rec *) (yyvsp[0].wdatum).datum;
+							(yyval.forvariable).row = NULL;
+						}
+						else
+						{
+							int			tok;
+
+							(yyval.forvariable).scalar = (yyvsp[0].wdatum).datum;
+							(yyval.forvariable).rec = NULL;
+							(yyval.forvariable).row = NULL;
+							/* check for comma-separated list */
+							tok = yylex();
+							plpgsql_push_back_token(tok);
+							if (tok == ',')
+								(yyval.forvariable).row = read_into_scalar_list((yyval.forvariable).name,
+															   (yyval.forvariable).scalar,
+															   (yylsp[0]));
+						}
+					}
+#line 3553 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 114:
+#line 1585 "pl_gram.y" /* yacc.c:1646  */
+    {
+						int			tok;
+
+						(yyval.forvariable).name = (yyvsp[0].word).ident;
+						(yyval.forvariable).lineno = plpgsql_location_to_lineno((yylsp[0]));
+						(yyval.forvariable).scalar = NULL;
+						(yyval.forvariable).rec = NULL;
+						(yyval.forvariable).row = NULL;
+						/* check for comma-separated list */
+						tok = yylex();
+						plpgsql_push_back_token(tok);
+						if (tok == ',')
+							word_is_not_variable(&((yyvsp[0].word)), (yylsp[0]));
+					}
+#line 3572 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 115:
+#line 1600 "pl_gram.y" /* yacc.c:1646  */
+    {
+						/* just to give a better message than "syntax error" */
+						cword_is_not_variable(&((yyvsp[0].cword)), (yylsp[0]));
+					}
+#line 3581 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 116:
+#line 1607 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_stmt_foreach_a *new;
+
+						new = palloc0(sizeof(PLpgSQL_stmt_foreach_a));
+						new->cmd_type = PLPGSQL_STMT_FOREACH_A;
+						new->lineno = plpgsql_location_to_lineno((yylsp[-6]));
+						new->label = (yyvsp[-7].str);
+						new->slice = (yyvsp[-4].ival);
+						new->expr = (yyvsp[-1].expr);
+						new->body = (yyvsp[0].loop_body).stmts;
+
+						if ((yyvsp[-5].forvariable).rec)
+						{
+							new->varno = (yyvsp[-5].forvariable).rec->dno;
+							check_assignable((PLpgSQL_datum *) (yyvsp[-5].forvariable).rec, (yylsp[-5]));
+						}
+						else if ((yyvsp[-5].forvariable).row)
+						{
+							new->varno = (yyvsp[-5].forvariable).row->dno;
+							check_assignable((PLpgSQL_datum *) (yyvsp[-5].forvariable).row, (yylsp[-5]));
+						}
+						else if ((yyvsp[-5].forvariable).scalar)
+						{
+							new->varno = (yyvsp[-5].forvariable).scalar->dno;
+							check_assignable((yyvsp[-5].forvariable).scalar, (yylsp[-5]));
+						}
+						else
+						{
+							ereport(ERROR,
+									(errcode(ERRCODE_SYNTAX_ERROR),
+									 errmsg("loop variable of FOREACH must be a known variable or list of variables"),
+											 parser_errposition((yylsp[-5]))));
+						}
+
+						check_labels((yyvsp[-7].str), (yyvsp[0].loop_body).end_label, (yyvsp[0].loop_body).end_label_location);
+						plpgsql_ns_pop();
+
+						(yyval.stmt) = (PLpgSQL_stmt *) new;
+					}
+#line 3625 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 117:
+#line 1649 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.ival) = 0;
+					}
+#line 3633 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 118:
+#line 1653 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.ival) = (yyvsp[0].ival);
+					}
+#line 3641 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 119:
+#line 1659 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_stmt_exit *new;
+
+						new = palloc0(sizeof(PLpgSQL_stmt_exit));
+						new->cmd_type = PLPGSQL_STMT_EXIT;
+						new->is_exit  = (yyvsp[-2].boolean);
+						new->lineno	  = plpgsql_location_to_lineno((yylsp[-2]));
+						new->label	  = (yyvsp[-1].str);
+						new->cond	  = (yyvsp[0].expr);
+
+						(yyval.stmt) = (PLpgSQL_stmt *)new;
+					}
+#line 3658 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 120:
+#line 1674 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.boolean) = true;
+					}
+#line 3666 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 121:
+#line 1678 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.boolean) = false;
+					}
+#line 3674 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 122:
+#line 1684 "pl_gram.y" /* yacc.c:1646  */
+    {
+						int	tok;
+
+						tok = yylex();
+						if (tok == 0)
+							yyerror("unexpected end of function definition");
+
+						if (tok_is_keyword(tok, &yylval,
+										   K_NEXT, "next"))
+						{
+							(yyval.stmt) = make_return_next_stmt((yylsp[0]));
+						}
+						else if (tok_is_keyword(tok, &yylval,
+												K_QUERY, "query"))
+						{
+							(yyval.stmt) = make_return_query_stmt((yylsp[0]));
+						}
+						else
+						{
+							plpgsql_push_back_token(tok);
+							(yyval.stmt) = make_return_stmt((yylsp[0]));
+						}
+					}
+#line 3702 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 123:
+#line 1710 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_stmt_raise		*new;
+						int	tok;
+
+						new = palloc(sizeof(PLpgSQL_stmt_raise));
+
+						new->cmd_type	= PLPGSQL_STMT_RAISE;
+						new->lineno		= plpgsql_location_to_lineno((yylsp[0]));
+						new->elog_level = ERROR;	/* default */
+						new->condname	= NULL;
+						new->message	= NULL;
+						new->params		= NIL;
+						new->options	= NIL;
+
+						tok = yylex();
+						if (tok == 0)
+							yyerror("unexpected end of function definition");
+
+						/*
+						 * We could have just RAISE, meaning to re-throw
+						 * the current error.
+						 */
+						if (tok != ';')
+						{
+							/*
+							 * First is an optional elog severity level.
+							 */
+							if (tok_is_keyword(tok, &yylval,
+											   K_EXCEPTION, "exception"))
+							{
+								new->elog_level = ERROR;
+								tok = yylex();
+							}
+							else if (tok_is_keyword(tok, &yylval,
+													K_WARNING, "warning"))
+							{
+								new->elog_level = WARNING;
+								tok = yylex();
+							}
+							else if (tok_is_keyword(tok, &yylval,
+													K_NOTICE, "notice"))
+							{
+								new->elog_level = NOTICE;
+								tok = yylex();
+							}
+							else if (tok_is_keyword(tok, &yylval,
+													K_INFO, "info"))
+							{
+								new->elog_level = INFO;
+								tok = yylex();
+							}
+							else if (tok_is_keyword(tok, &yylval,
+													K_LOG, "log"))
+							{
+								new->elog_level = LOG;
+								tok = yylex();
+							}
+							else if (tok_is_keyword(tok, &yylval,
+													K_DEBUG, "debug"))
+							{
+								new->elog_level = DEBUG1;
+								tok = yylex();
+							}
+							if (tok == 0)
+								yyerror("unexpected end of function definition");
+
+							/*
+							 * Next we can have a condition name, or
+							 * equivalently SQLSTATE 'xxxxx', or a string
+							 * literal that is the old-style message format,
+							 * or USING to start the option list immediately.
+							 */
+							if (tok == SCONST)
+							{
+								/* old style message and parameters */
+								new->message = yylval.str;
+								/*
+								 * We expect either a semi-colon, which
+								 * indicates no parameters, or a comma that
+								 * begins the list of parameter expressions,
+								 * or USING to begin the options list.
+								 */
+								tok = yylex();
+								if (tok != ',' && tok != ';' && tok != K_USING)
+									yyerror("syntax error");
+
+								while (tok == ',')
+								{
+									PLpgSQL_expr *expr;
+
+									expr = read_sql_construct(',', ';', K_USING,
+															  ", or ; or USING",
+															  "SELECT ",
+															  true, true, true,
+															  NULL, &tok);
+									new->params = lappend(new->params, expr);
+								}
+							}
+							else if (tok != K_USING)
+							{
+								/* must be condition name or SQLSTATE */
+								if (tok_is_keyword(tok, &yylval,
+												   K_SQLSTATE, "sqlstate"))
+								{
+									/* next token should be a string literal */
+									char   *sqlstatestr;
+
+									if (yylex() != SCONST)
+										yyerror("syntax error");
+									sqlstatestr = yylval.str;
+
+									if (strlen(sqlstatestr) != 5)
+										yyerror("invalid SQLSTATE code");
+									if (strspn(sqlstatestr, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ") != 5)
+										yyerror("invalid SQLSTATE code");
+									new->condname = sqlstatestr;
+								}
+								else
+								{
+									if (tok == T_WORD)
+										new->condname = yylval.word.ident;
+									else if (plpgsql_token_is_unreserved_keyword(tok))
+										new->condname = pstrdup(yylval.keyword);
+									else
+										yyerror("syntax error");
+									plpgsql_recognize_err_condition(new->condname,
+																	false);
+								}
+								tok = yylex();
+								if (tok != ';' && tok != K_USING)
+									yyerror("syntax error");
+							}
+
+							if (tok == K_USING)
+								new->options = read_raise_options();
+						}
+
+						check_raise_parameters(new);
+
+						(yyval.stmt) = (PLpgSQL_stmt *)new;
+					}
+#line 3848 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 124:
+#line 1854 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_stmt_assert		*new;
+						int	tok;
+
+						new = palloc(sizeof(PLpgSQL_stmt_assert));
+
+						new->cmd_type	= PLPGSQL_STMT_ASSERT;
+						new->lineno		= plpgsql_location_to_lineno((yylsp[0]));
+
+						new->cond = read_sql_expression2(',', ';',
+														 ", or ;",
+														 &tok);
+
+						if (tok == ',')
+							new->message = read_sql_expression(';', ";");
+						else
+							new->message = NULL;
+
+						(yyval.stmt) = (PLpgSQL_stmt *) new;
+					}
+#line 3873 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 125:
+#line 1877 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.loop_body).stmts = (yyvsp[-4].list);
+						(yyval.loop_body).end_label = (yyvsp[-1].str);
+						(yyval.loop_body).end_label_location = (yylsp[-1]);
+					}
+#line 3883 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 126:
+#line 1895 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.stmt) = make_execsql_stmt(K_INSERT, (yylsp[0]));
+					}
+#line 3891 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 127:
+#line 1899 "pl_gram.y" /* yacc.c:1646  */
+    {
+						int			tok;
+
+						tok = yylex();
+						plpgsql_push_back_token(tok);
+						if (tok == '=' || tok == COLON_EQUALS || tok == '[')
+							word_is_not_variable(&((yyvsp[0].word)), (yylsp[0]));
+						(yyval.stmt) = make_execsql_stmt(T_WORD, (yylsp[0]));
+					}
+#line 3905 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 128:
+#line 1909 "pl_gram.y" /* yacc.c:1646  */
+    {
+						int			tok;
+
+						tok = yylex();
+						plpgsql_push_back_token(tok);
+						if (tok == '=' || tok == COLON_EQUALS || tok == '[')
+							cword_is_not_variable(&((yyvsp[0].cword)), (yylsp[0]));
+						(yyval.stmt) = make_execsql_stmt(T_CWORD, (yylsp[0]));
+					}
+#line 3919 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 129:
+#line 1921 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_stmt_dynexecute *new;
+						PLpgSQL_expr *expr;
+						int endtoken;
+
+						expr = read_sql_construct(K_INTO, K_USING, ';',
+												  "INTO or USING or ;",
+												  "SELECT ",
+												  true, true, true,
+												  NULL, &endtoken);
+
+						new = palloc(sizeof(PLpgSQL_stmt_dynexecute));
+						new->cmd_type = PLPGSQL_STMT_DYNEXECUTE;
+						new->lineno = plpgsql_location_to_lineno((yylsp[0]));
+						new->query = expr;
+						new->into = false;
+						new->strict = false;
+						new->rec = NULL;
+						new->row = NULL;
+						new->params = NIL;
+
+						/*
+						 * We loop to allow the INTO and USING clauses to
+						 * appear in either order, since people easily get
+						 * that wrong.  This coding also prevents "INTO foo"
+						 * from getting absorbed into a USING expression,
+						 * which is *really* confusing.
+						 */
+						for (;;)
+						{
+							if (endtoken == K_INTO)
+							{
+								if (new->into)			/* multiple INTO */
+									yyerror("syntax error");
+								new->into = true;
+								read_into_target(&new->rec, &new->row, &new->strict);
+								endtoken = yylex();
+							}
+							else if (endtoken == K_USING)
+							{
+								if (new->params)		/* multiple USING */
+									yyerror("syntax error");
+								do
+								{
+									expr = read_sql_construct(',', ';', K_INTO,
+															  ", or ; or INTO",
+															  "SELECT ",
+															  true, true, true,
+															  NULL, &endtoken);
+									new->params = lappend(new->params, expr);
+								} while (endtoken == ',');
+							}
+							else if (endtoken == ';')
+								break;
+							else
+								yyerror("syntax error");
+						}
+
+						(yyval.stmt) = (PLpgSQL_stmt *)new;
+					}
+#line 3984 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 130:
+#line 1985 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_stmt_open *new;
+						int				  tok;
+
+						new = palloc0(sizeof(PLpgSQL_stmt_open));
+						new->cmd_type = PLPGSQL_STMT_OPEN;
+						new->lineno = plpgsql_location_to_lineno((yylsp[-1]));
+						new->curvar = (yyvsp[0].var)->dno;
+						new->cursor_options = CURSOR_OPT_FAST_PLAN;
+
+						if ((yyvsp[0].var)->cursor_explicit_expr == NULL)
+						{
+							/* be nice if we could use opt_scrollable here */
+							tok = yylex();
+							if (tok_is_keyword(tok, &yylval,
+											   K_NO, "no"))
+							{
+								tok = yylex();
+								if (tok_is_keyword(tok, &yylval,
+												   K_SCROLL, "scroll"))
+								{
+									new->cursor_options |= CURSOR_OPT_NO_SCROLL;
+									tok = yylex();
+								}
+							}
+							else if (tok_is_keyword(tok, &yylval,
+													K_SCROLL, "scroll"))
+							{
+								new->cursor_options |= CURSOR_OPT_SCROLL;
+								tok = yylex();
+							}
+
+							if (tok != K_FOR)
+								yyerror("syntax error, expected \"FOR\"");
+
+							tok = yylex();
+							if (tok == K_EXECUTE)
+							{
+								int		endtoken;
+
+								new->dynquery =
+									read_sql_expression2(K_USING, ';',
+														 "USING or ;",
+														 &endtoken);
+
+								/* If we found "USING", collect argument(s) */
+								if (endtoken == K_USING)
+								{
+									PLpgSQL_expr *expr;
+
+									do
+									{
+										expr = read_sql_expression2(',', ';',
+																	", or ;",
+																	&endtoken);
+										new->params = lappend(new->params,
+															  expr);
+									} while (endtoken == ',');
+								}
+							}
+							else
+							{
+								plpgsql_push_back_token(tok);
+								new->query = read_sql_stmt("");
+							}
+						}
+						else
+						{
+							/* predefined cursor query, so read args */
+							new->argquery = read_cursor_args((yyvsp[0].var), ';', ";");
+						}
+
+						(yyval.stmt) = (PLpgSQL_stmt *)new;
+					}
+#line 4063 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 131:
+#line 2062 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_stmt_fetch *fetch = (yyvsp[-2].fetch);
+						PLpgSQL_rec	   *rec;
+						PLpgSQL_row	   *row;
+
+						/* We have already parsed everything through the INTO keyword */
+						read_into_target(&rec, &row, NULL);
+
+						if (yylex() != ';')
+							yyerror("syntax error");
+
+						/*
+						 * We don't allow multiple rows in PL/pgSQL's FETCH
+						 * statement, only in MOVE.
+						 */
+						if (fetch->returns_multiple_rows)
+							ereport(ERROR,
+									(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+									 errmsg("FETCH statement cannot return multiple rows"),
+									 parser_errposition((yylsp[-3]))));
+
+						fetch->lineno = plpgsql_location_to_lineno((yylsp[-3]));
+						fetch->rec		= rec;
+						fetch->row		= row;
+						fetch->curvar	= (yyvsp[-1].var)->dno;
+						fetch->is_move	= false;
+
+						(yyval.stmt) = (PLpgSQL_stmt *)fetch;
+					}
+#line 4097 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 132:
+#line 2094 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_stmt_fetch *fetch = (yyvsp[-2].fetch);
+
+						fetch->lineno = plpgsql_location_to_lineno((yylsp[-3]));
+						fetch->curvar	= (yyvsp[-1].var)->dno;
+						fetch->is_move	= true;
+
+						(yyval.stmt) = (PLpgSQL_stmt *)fetch;
+					}
+#line 4111 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 133:
+#line 2106 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.fetch) = read_fetch_direction();
+					}
+#line 4119 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 134:
+#line 2112 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_stmt_close *new;
+
+						new = palloc(sizeof(PLpgSQL_stmt_close));
+						new->cmd_type = PLPGSQL_STMT_CLOSE;
+						new->lineno = plpgsql_location_to_lineno((yylsp[-2]));
+						new->curvar = (yyvsp[-1].var)->dno;
+
+						(yyval.stmt) = (PLpgSQL_stmt *)new;
+					}
+#line 4134 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 135:
+#line 2125 "pl_gram.y" /* yacc.c:1646  */
+    {
+						/* We do not bother building a node for NULL */
+						(yyval.stmt) = NULL;
+					}
+#line 4143 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 136:
+#line 2132 "pl_gram.y" /* yacc.c:1646  */
+    {
+						if ((yyvsp[0].wdatum).datum->dtype != PLPGSQL_DTYPE_VAR)
+							ereport(ERROR,
+									(errcode(ERRCODE_DATATYPE_MISMATCH),
+									 errmsg("cursor variable must be a simple variable"),
+									 parser_errposition((yylsp[0]))));
+
+						if (((PLpgSQL_var *) (yyvsp[0].wdatum).datum)->datatype->typoid != REFCURSOROID)
+							ereport(ERROR,
+									(errcode(ERRCODE_DATATYPE_MISMATCH),
+									 errmsg("variable \"%s\" must be of type cursor or refcursor",
+											((PLpgSQL_var *) (yyvsp[0].wdatum).datum)->refname),
+									 parser_errposition((yylsp[0]))));
+						(yyval.var) = (PLpgSQL_var *) (yyvsp[0].wdatum).datum;
+					}
+#line 4163 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 137:
+#line 2148 "pl_gram.y" /* yacc.c:1646  */
+    {
+						/* just to give a better message than "syntax error" */
+						word_is_not_variable(&((yyvsp[0].word)), (yylsp[0]));
+					}
+#line 4172 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 138:
+#line 2153 "pl_gram.y" /* yacc.c:1646  */
+    {
+						/* just to give a better message than "syntax error" */
+						cword_is_not_variable(&((yyvsp[0].cword)), (yylsp[0]));
+					}
+#line 4181 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 139:
+#line 2160 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.exception_block) = NULL; }
+#line 4187 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 140:
+#line 2162 "pl_gram.y" /* yacc.c:1646  */
+    {
+						/*
+						 * We use a mid-rule action to add these
+						 * special variables to the namespace before
+						 * parsing the WHEN clauses themselves.  The
+						 * scope of the names extends to the end of the
+						 * current block.
+						 */
+						int			lineno = plpgsql_location_to_lineno((yylsp[0]));
+						PLpgSQL_exception_block *new = palloc(sizeof(PLpgSQL_exception_block));
+						PLpgSQL_variable *var;
+
+						var = plpgsql_build_variable("sqlstate", lineno,
+													 plpgsql_build_datatype(TEXTOID,
+																			-1,
+																			plpgsql_curr_compile->fn_input_collation),
+													 true);
+						((PLpgSQL_var *) var)->isconst = true;
+						new->sqlstate_varno = var->dno;
+
+						var = plpgsql_build_variable("sqlerrm", lineno,
+													 plpgsql_build_datatype(TEXTOID,
+																			-1,
+																			plpgsql_curr_compile->fn_input_collation),
+													 true);
+						((PLpgSQL_var *) var)->isconst = true;
+						new->sqlerrm_varno = var->dno;
+
+						(yyval.exception_block) = new;
+					}
+#line 4222 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 141:
+#line 2193 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_exception_block *new = (yyvsp[-1].exception_block);
+						new->exc_list = (yyvsp[0].list);
+
+						(yyval.exception_block) = new;
+					}
+#line 4233 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 142:
+#line 2202 "pl_gram.y" /* yacc.c:1646  */
+    {
+							(yyval.list) = lappend((yyvsp[-1].list), (yyvsp[0].exception));
+						}
+#line 4241 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 143:
+#line 2206 "pl_gram.y" /* yacc.c:1646  */
+    {
+							(yyval.list) = list_make1((yyvsp[0].exception));
+						}
+#line 4249 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 144:
+#line 2212 "pl_gram.y" /* yacc.c:1646  */
+    {
+						PLpgSQL_exception *new;
+
+						new = palloc0(sizeof(PLpgSQL_exception));
+						new->lineno = plpgsql_location_to_lineno((yylsp[-3]));
+						new->conditions = (yyvsp[-2].condition);
+						new->action = (yyvsp[0].list);
+
+						(yyval.exception) = new;
+					}
+#line 4264 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 145:
+#line 2225 "pl_gram.y" /* yacc.c:1646  */
+    {
+							PLpgSQL_condition	*old;
+
+							for (old = (yyvsp[-2].condition); old->next != NULL; old = old->next)
+								/* skip */ ;
+							old->next = (yyvsp[0].condition);
+							(yyval.condition) = (yyvsp[-2].condition);
+						}
+#line 4277 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 146:
+#line 2234 "pl_gram.y" /* yacc.c:1646  */
+    {
+							(yyval.condition) = (yyvsp[0].condition);
+						}
+#line 4285 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 147:
+#line 2240 "pl_gram.y" /* yacc.c:1646  */
+    {
+							if (strcmp((yyvsp[0].str), "sqlstate") != 0)
+							{
+								(yyval.condition) = plpgsql_parse_err_condition((yyvsp[0].str));
+							}
+							else
+							{
+								PLpgSQL_condition *new;
+								char   *sqlstatestr;
+
+								/* next token should be a string literal */
+								if (yylex() != SCONST)
+									yyerror("syntax error");
+								sqlstatestr = yylval.str;
+
+								if (strlen(sqlstatestr) != 5)
+									yyerror("invalid SQLSTATE code");
+								if (strspn(sqlstatestr, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ") != 5)
+									yyerror("invalid SQLSTATE code");
+
+								new = palloc(sizeof(PLpgSQL_condition));
+								new->sqlerrstate =
+									MAKE_SQLSTATE(sqlstatestr[0],
+												  sqlstatestr[1],
+												  sqlstatestr[2],
+												  sqlstatestr[3],
+												  sqlstatestr[4]);
+								new->condname = sqlstatestr;
+								new->next = NULL;
+
+								(yyval.condition) = new;
+							}
+						}
+#line 4323 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 148:
+#line 2276 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.expr) = read_sql_expression(';', ";"); }
+#line 4329 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 149:
+#line 2280 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.expr) = read_sql_expression(']', "]"); }
+#line 4335 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 150:
+#line 2284 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.expr) = read_sql_expression(K_THEN, "THEN"); }
+#line 4341 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 151:
+#line 2288 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.expr) = read_sql_expression(K_LOOP, "LOOP"); }
+#line 4347 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 152:
+#line 2292 "pl_gram.y" /* yacc.c:1646  */
+    {
+						plpgsql_ns_push(NULL);
+						(yyval.str) = NULL;
+					}
+#line 4356 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 153:
+#line 2297 "pl_gram.y" /* yacc.c:1646  */
+    {
+						plpgsql_ns_push((yyvsp[-1].str));
+						(yyval.str) = (yyvsp[-1].str);
+					}
+#line 4365 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 154:
+#line 2304 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.str) = NULL;
+					}
+#line 4373 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 155:
+#line 2308 "pl_gram.y" /* yacc.c:1646  */
+    {
+						if (plpgsql_ns_lookup_label(plpgsql_ns_top(), (yyvsp[0].str)) == NULL)
+							yyerror("label does not exist");
+						(yyval.str) = (yyvsp[0].str);
+					}
+#line 4383 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 156:
+#line 2316 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.expr) = NULL; }
+#line 4389 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 157:
+#line 2318 "pl_gram.y" /* yacc.c:1646  */
+    { (yyval.expr) = (yyvsp[0].expr); }
+#line 4395 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 158:
+#line 2325 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.str) = (yyvsp[0].word).ident;
+					}
+#line 4403 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 159:
+#line 2329 "pl_gram.y" /* yacc.c:1646  */
+    {
+						(yyval.str) = pstrdup((yyvsp[0].keyword));
+					}
+#line 4411 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+  case 160:
+#line 2333 "pl_gram.y" /* yacc.c:1646  */
+    {
+						if ((yyvsp[0].wdatum).ident == NULL) /* composite name not OK */
+							yyerror("syntax error");
+						(yyval.str) = (yyvsp[0].wdatum).ident;
+					}
+#line 4421 "pl_gram.c" /* yacc.c:1646  */
+    break;
+
+
+#line 4425 "pl_gram.c" /* yacc.c:1646  */
+      default: break;
+    }
+  /* User semantic actions sometimes alter yychar, and that requires
+     that yytoken be updated with the new translation.  We take the
+     approach of translating immediately before every use of yytoken.
+     One alternative is translating here after every semantic action,
+     but that translation would be missed if the semantic action invokes
+     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
+     incorrect destructor might then be invoked immediately.  In the
+     case of YYERROR or YYBACKUP, subsequent parser actions might lead
+     to an incorrect destructor call or verbose syntax error message
+     before the lookahead is translated.  */
+  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+  YYPOPSTACK (yylen);
+  yylen = 0;
+  YY_STACK_PRINT (yyss, yyssp);
+
+  *++yyvsp = yyval;
+  *++yylsp = yyloc;
+
+  /* Now 'shift' the result of the reduction.  Determine what state
+     that goes to, based on the state we popped back to and the rule
+     number reduced by.  */
+
+  yyn = yyr1[yyn];
+
+  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+    yystate = yytable[yystate];
+  else
+    yystate = yydefgoto[yyn - YYNTOKENS];
+
+  goto yynewstate;
+
+
+/*--------------------------------------.
+| yyerrlab -- here on detecting error.  |
+`--------------------------------------*/
+yyerrlab:
+  /* Make sure we have latest lookahead translation.  See comments at
+     user semantic actions for why this is necessary.  */
+  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
+  /* If not already recovering from an error, report this error.  */
+  if (!yyerrstatus)
+    {
+      ++yynerrs;
+#if ! YYERROR_VERBOSE
+      yyerror (YY_("syntax error"));
+#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+                                        yyssp, yytoken)
+      {
+        char const *yymsgp = YY_("syntax error");
+        int yysyntax_error_status;
+        yysyntax_error_status = YYSYNTAX_ERROR;
+        if (yysyntax_error_status == 0)
+          yymsgp = yymsg;
+        else if (yysyntax_error_status == 1)
+          {
+            if (yymsg != yymsgbuf)
+              YYSTACK_FREE (yymsg);
+            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+            if (!yymsg)
+              {
+                yymsg = yymsgbuf;
+                yymsg_alloc = sizeof yymsgbuf;
+                yysyntax_error_status = 2;
+              }
+            else
+              {
+                yysyntax_error_status = YYSYNTAX_ERROR;
+                yymsgp = yymsg;
+              }
+          }
+        yyerror (yymsgp);
+        if (yysyntax_error_status == 2)
+          goto yyexhaustedlab;
+      }
+# undef YYSYNTAX_ERROR
+#endif
+    }
+
+  yyerror_range[1] = yylloc;
+
+  if (yyerrstatus == 3)
+    {
+      /* If just tried and failed to reuse lookahead token after an
+         error, discard it.  */
+
+      if (yychar <= YYEOF)
+        {
+          /* Return failure if at end of input.  */
+          if (yychar == YYEOF)
+            YYABORT;
+        }
+      else
+        {
+          yydestruct ("Error: discarding",
+                      yytoken, &yylval, &yylloc);
+          yychar = YYEMPTY;
+        }
+    }
+
+  /* Else will try to reuse lookahead token after shifting the error
+     token.  */
+  goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR.  |
+`---------------------------------------------------*/
+yyerrorlab:
+
+  /* Pacify compilers like GCC when the user code never invokes
+     YYERROR and the label yyerrorlab therefore never appears in user
+     code.  */
+  if (/*CONSTCOND*/ 0)
+     goto yyerrorlab;
+
+  yyerror_range[1] = yylsp[1-yylen];
+  /* Do not reclaim the symbols of the rule whose action triggered
+     this YYERROR.  */
+  YYPOPSTACK (yylen);
+  yylen = 0;
+  YY_STACK_PRINT (yyss, yyssp);
+  yystate = *yyssp;
+  goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR.  |
+`-------------------------------------------------------------*/
+yyerrlab1:
+  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
+
+  for (;;)
+    {
+      yyn = yypact[yystate];
+      if (!yypact_value_is_default (yyn))
+        {
+          yyn += YYTERROR;
+          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+            {
+              yyn = yytable[yyn];
+              if (0 < yyn)
+                break;
+            }
+        }
+
+      /* Pop the current state because it cannot handle the error token.  */
+      if (yyssp == yyss)
+        YYABORT;
+
+      yyerror_range[1] = *yylsp;
+      yydestruct ("Error: popping",
+                  yystos[yystate], yyvsp, yylsp);
+      YYPOPSTACK (1);
+      yystate = *yyssp;
+      YY_STACK_PRINT (yyss, yyssp);
+    }
+
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+  yyerror_range[2] = yylloc;
+  /* Using YYLLOC is tempting, but would change the location of
+     the lookahead.  YYLOC is available though.  */
+  YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
+  *++yylsp = yyloc;
+
+  /* Shift the error token.  */
+  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+  yystate = yyn;
+  goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here.  |
+`-------------------------------------*/
+yyacceptlab:
+  yyresult = 0;
+  goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here.  |
+`-----------------------------------*/
+yyabortlab:
+  yyresult = 1;
+  goto yyreturn;
+
+#if !defined yyoverflow || YYERROR_VERBOSE
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here.  |
+`-------------------------------------------------*/
+yyexhaustedlab:
+  yyerror (YY_("memory exhausted"));
+  yyresult = 2;
+  /* Fall through.  */
+#endif
+
+yyreturn:
+  if (yychar != YYEMPTY)
+    {
+      /* Make sure we have latest lookahead translation.  See comments at
+         user semantic actions for why this is necessary.  */
+      yytoken = YYTRANSLATE (yychar);
+      yydestruct ("Cleanup: discarding lookahead",
+                  yytoken, &yylval, &yylloc);
+    }
+  /* Do not reclaim the symbols of the rule whose action triggered
+     this YYABORT or YYACCEPT.  */
+  YYPOPSTACK (yylen);
+  YY_STACK_PRINT (yyss, yyssp);
+  while (yyssp != yyss)
+    {
+      yydestruct ("Cleanup: popping",
+                  yystos[*yyssp], yyvsp, yylsp);
+      YYPOPSTACK (1);
+    }
+#ifndef yyoverflow
+  if (yyss != yyssa)
+    YYSTACK_FREE (yyss);
+#endif
+#if YYERROR_VERBOSE
+  if (yymsg != yymsgbuf)
+    YYSTACK_FREE (yymsg);
+#endif
+  return yyresult;
+}
+#line 2417 "pl_gram.y" /* yacc.c:1906  */
+
+
+/*
+ * Check whether a token represents an "unreserved keyword".
+ * We have various places where we want to recognize a keyword in preference
+ * to a variable name, but not reserve that keyword in other contexts.
+ * Hence, this kluge.
+ */
+static bool
+tok_is_keyword(int token, union YYSTYPE *lval,
+			   int kw_token, const char *kw_str)
+{
+	if (token == kw_token)
+	{
+		/* Normal case, was recognized by scanner (no conflicting variable) */
+		return true;
+	}
+	else if (token == T_DATUM)
+	{
+		/*
+		 * It's a variable, so recheck the string name.  Note we will not
+		 * match composite names (hence an unreserved word followed by "."
+		 * will not be recognized).
+		 */
+		if (!lval->wdatum.quoted && lval->wdatum.ident != NULL &&
+			strcmp(lval->wdatum.ident, kw_str) == 0)
+			return true;
+	}
+	return false;				/* not the keyword */
+}
+
+/*
+ * Convenience routine to complain when we expected T_DATUM and got T_WORD,
+ * ie, unrecognized variable.
+ */
+static void
+word_is_not_variable(PLword *word, int location)
+{
+	ereport(ERROR,
+			(errcode(ERRCODE_SYNTAX_ERROR),
+			 errmsg("\"%s\" is not a known variable",
+					word->ident),
+			 parser_errposition(location)));
+}
+
+/* Same, for a CWORD */
+static void
+cword_is_not_variable(PLcword *cword, int location)
+{
+	ereport(ERROR,
+			(errcode(ERRCODE_SYNTAX_ERROR),
+			 errmsg("\"%s\" is not a known variable",
+					NameListToString(cword->idents)),
+			 parser_errposition(location)));
+}
+
+/*
+ * Convenience routine to complain when we expected T_DATUM and got
+ * something else.  "tok" must be the current token, since we also
+ * look at yylval and yylloc.
+ */
+static void
+current_token_is_not_variable(int tok)
+{
+	if (tok == T_WORD)
+		word_is_not_variable(&(yylval.word), yylloc);
+	else if (tok == T_CWORD)
+		cword_is_not_variable(&(yylval.cword), yylloc);
+	else
+		yyerror("syntax error");
+}
+
+/* Convenience routine to read an expression with one possible terminator */
+static PLpgSQL_expr *
+read_sql_expression(int until, const char *expected)
+{
+	return read_sql_construct(until, 0, 0, expected,
+							  "SELECT ", true, true, true, NULL, NULL);
+}
+
+/* Convenience routine to read an expression with two possible terminators */
+static PLpgSQL_expr *
+read_sql_expression2(int until, int until2, const char *expected,
+					 int *endtoken)
+{
+	return read_sql_construct(until, until2, 0, expected,
+							  "SELECT ", true, true, true, NULL, endtoken);
+}
+
+/* Convenience routine to read a SQL statement that must end with ';' */
+static PLpgSQL_expr *
+read_sql_stmt(const char *sqlstart)
+{
+	return read_sql_construct(';', 0, 0, ";",
+							  sqlstart, false, true, true, NULL, NULL);
+}
+
+/*
+ * Read a SQL construct and build a PLpgSQL_expr for it.
+ *
+ * until:		token code for expected terminator
+ * until2:		token code for alternate terminator (pass 0 if none)
+ * until3:		token code for another alternate terminator (pass 0 if none)
+ * expected:	text to use in complaining that terminator was not found
+ * sqlstart:	text to prefix to the accumulated SQL text
+ * isexpression: whether to say we're reading an "expression" or a "statement"
+ * valid_sql:   whether to check the syntax of the expr (prefixed with sqlstart)
+ * trim:		trim trailing whitespace
+ * startloc:	if not NULL, location of first token is stored at *startloc
+ * endtoken:	if not NULL, ending token is stored at *endtoken
+ *				(this is only interesting if until2 or until3 isn't zero)
+ */
+static PLpgSQL_expr *
+read_sql_construct(int until,
+				   int until2,
+				   int until3,
+				   const char *expected,
+				   const char *sqlstart,
+				   bool isexpression,
+				   bool valid_sql,
+				   bool trim,
+				   int *startloc,
+				   int *endtoken)
+{
+	int					tok;
+	StringInfoData		ds;
+	IdentifierLookup	save_IdentifierLookup;
+	int					startlocation = -1;
+	int					parenlevel = 0;
+	PLpgSQL_expr		*expr;
+
+	initStringInfo(&ds);
+	appendStringInfoString(&ds, sqlstart);
+
+	/* special lookup mode for identifiers within the SQL text */
+	save_IdentifierLookup = plpgsql_IdentifierLookup;
+	plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_EXPR;
+
+	for (;;)
+	{
+		tok = yylex();
+		if (startlocation < 0)			/* remember loc of first token */
+			startlocation = yylloc;
+		if (tok == until && parenlevel == 0)
+			break;
+		if (tok == until2 && parenlevel == 0)
+			break;
+		if (tok == until3 && parenlevel == 0)
+			break;
+		if (tok == '(' || tok == '[')
+			parenlevel++;
+		else if (tok == ')' || tok == ']')
+		{
+			parenlevel--;
+			if (parenlevel < 0)
+				yyerror("mismatched parentheses");
+		}
+		/*
+		 * End of function definition is an error, and we don't expect to
+		 * hit a semicolon either (unless it's the until symbol, in which
+		 * case we should have fallen out above).
+		 */
+		if (tok == 0 || tok == ';')
+		{
+			if (parenlevel != 0)
+				yyerror("mismatched parentheses");
+			if (isexpression)
+				ereport(ERROR,
+						(errcode(ERRCODE_SYNTAX_ERROR),
+						 errmsg("missing \"%s\" at end of SQL expression",
+								expected),
+						 parser_errposition(yylloc)));
+			else
+				ereport(ERROR,
+						(errcode(ERRCODE_SYNTAX_ERROR),
+						 errmsg("missing \"%s\" at end of SQL statement",
+								expected),
+						 parser_errposition(yylloc)));
+		}
+	}
+
+	plpgsql_IdentifierLookup = save_IdentifierLookup;
+
+	if (startloc)
+		*startloc = startlocation;
+	if (endtoken)
+		*endtoken = tok;
+
+	/* give helpful complaint about empty input */
+	if (startlocation >= yylloc)
+	{
+		if (isexpression)
+			yyerror("missing expression");
+		else
+			yyerror("missing SQL statement");
+	}
+
+	plpgsql_append_source_text(&ds, startlocation, yylloc);
+
+	/* trim any trailing whitespace, for neatness */
+	if (trim)
+	{
+		while (ds.len > 0 && scanner_isspace(ds.data[ds.len - 1]))
+			ds.data[--ds.len] = '\0';
+	}
+
+	expr = palloc0(sizeof(PLpgSQL_expr));
+	expr->dtype			= PLPGSQL_DTYPE_EXPR;
+	expr->query			= pstrdup(ds.data);
+	expr->plan			= NULL;
+	expr->paramnos		= NULL;
+	expr->rwparam		= -1;
+	expr->ns			= plpgsql_ns_top();
+	pfree(ds.data);
+
+	if (valid_sql)
+		check_sql_expr(expr->query, startlocation, strlen(sqlstart));
+
+	return expr;
+}
+
+static PLpgSQL_type *
+read_datatype(int tok)
+{
+	StringInfoData		ds;
+	char			   *type_name;
+	int					startlocation;
+	PLpgSQL_type		*result;
+	int					parenlevel = 0;
+
+	/* Should only be called while parsing DECLARE sections */
+	Assert(plpgsql_IdentifierLookup == IDENTIFIER_LOOKUP_DECLARE);
+
+	/* Often there will be a lookahead token, but if not, get one */
+	if (tok == YYEMPTY)
+		tok = yylex();
+
+	startlocation = yylloc;
+
+	/*
+	 * If we have a simple or composite identifier, check for %TYPE
+	 * and %ROWTYPE constructs.
+	 */
+	if (tok == T_WORD)
+	{
+		char   *dtname = yylval.word.ident;
+
+		tok = yylex();
+		if (tok == '%')
+		{
+			tok = yylex();
+			if (tok_is_keyword(tok, &yylval,
+							   K_TYPE, "type"))
+			{
+				result = plpgsql_parse_wordtype(dtname);
+				if (result)
+					return result;
+			}
+			else if (tok_is_keyword(tok, &yylval,
+									K_ROWTYPE, "rowtype"))
+			{
+				result = plpgsql_parse_wordrowtype(dtname);
+				if (result)
+					return result;
+			}
+		}
+	}
+	else if (plpgsql_token_is_unreserved_keyword(tok))
+	{
+		char   *dtname = pstrdup(yylval.keyword);
+
+		tok = yylex();
+		if (tok == '%')
+		{
+			tok = yylex();
+			if (tok_is_keyword(tok, &yylval,
+							   K_TYPE, "type"))
+			{
+				result = plpgsql_parse_wordtype(dtname);
+				if (result)
+					return result;
+			}
+			else if (tok_is_keyword(tok, &yylval,
+									K_ROWTYPE, "rowtype"))
+			{
+				result = plpgsql_parse_wordrowtype(dtname);
+				if (result)
+					return result;
+			}
+		}
+	}
+	else if (tok == T_CWORD)
+	{
+		List   *dtnames = yylval.cword.idents;
+
+		tok = yylex();
+		if (tok == '%')
+		{
+			tok = yylex();
+			if (tok_is_keyword(tok, &yylval,
+							   K_TYPE, "type"))
+			{
+				result = plpgsql_parse_cwordtype(dtnames);
+				if (result)
+					return result;
+			}
+			else if (tok_is_keyword(tok, &yylval,
+									K_ROWTYPE, "rowtype"))
+			{
+				result = plpgsql_parse_cwordrowtype(dtnames);
+				if (result)
+					return result;
+			}
+		}
+	}
+
+	while (tok != ';')
+	{
+		if (tok == 0)
+		{
+			if (parenlevel != 0)
+				yyerror("mismatched parentheses");
+			else
+				yyerror("incomplete data type declaration");
+		}
+		/* Possible followers for datatype in a declaration */
+		if (tok == K_COLLATE || tok == K_NOT ||
+			tok == '=' || tok == COLON_EQUALS || tok == K_DEFAULT)
+			break;
+		/* Possible followers for datatype in a cursor_arg list */
+		if ((tok == ',' || tok == ')') && parenlevel == 0)
+			break;
+		if (tok == '(')
+			parenlevel++;
+		else if (tok == ')')
+			parenlevel--;
+
+		tok = yylex();
+	}
+
+	/* set up ds to contain complete typename text */
+	initStringInfo(&ds);
+	plpgsql_append_source_text(&ds, startlocation, yylloc);
+	type_name = ds.data;
+
+	if (type_name[0] == '\0')
+		yyerror("missing data type declaration");
+
+	result = parse_datatype(type_name, startlocation);
+
+	pfree(ds.data);
+
+	plpgsql_push_back_token(tok);
+
+	return result;
+}
+
+static PLpgSQL_stmt *
+make_execsql_stmt(int firsttoken, int location)
+{
+	StringInfoData		ds;
+	IdentifierLookup	save_IdentifierLookup;
+	PLpgSQL_stmt_execsql *execsql;
+	PLpgSQL_expr		*expr;
+	PLpgSQL_row			*row = NULL;
+	PLpgSQL_rec			*rec = NULL;
+	int					tok;
+	int					prev_tok;
+	bool				have_into = false;
+	bool				have_strict = false;
+	int					into_start_loc = -1;
+	int					into_end_loc = -1;
+
+	initStringInfo(&ds);
+
+	/* special lookup mode for identifiers within the SQL text */
+	save_IdentifierLookup = plpgsql_IdentifierLookup;
+	plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_EXPR;
+
+	/*
+	 * We have to special-case the sequence INSERT INTO, because we don't want
+	 * that to be taken as an INTO-variables clause.  Fortunately, this is the
+	 * only valid use of INTO in a pl/pgsql SQL command, and INTO is already a
+	 * fully reserved word in the main grammar.  We have to treat it that way
+	 * anywhere in the string, not only at the start; consider CREATE RULE
+	 * containing an INSERT statement.
+	 */
+	tok = firsttoken;
+	for (;;)
+	{
+		prev_tok = tok;
+		tok = yylex();
+		if (have_into && into_end_loc < 0)
+			into_end_loc = yylloc;		/* token after the INTO part */
+		if (tok == ';')
+			break;
+		if (tok == 0)
+			yyerror("unexpected end of function definition");
+
+		if (tok == K_INTO && prev_tok != K_INSERT)
+		{
+			if (have_into)
+				yyerror("INTO specified more than once");
+			have_into = true;
+			into_start_loc = yylloc;
+			plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_NORMAL;
+			read_into_target(&rec, &row, &have_strict);
+			plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_EXPR;
+		}
+	}
+
+	plpgsql_IdentifierLookup = save_IdentifierLookup;
+
+	if (have_into)
+	{
+		/*
+		 * Insert an appropriate number of spaces corresponding to the
+		 * INTO text, so that locations within the redacted SQL statement
+		 * still line up with those in the original source text.
+		 */
+		plpgsql_append_source_text(&ds, location, into_start_loc);
+		appendStringInfoSpaces(&ds, into_end_loc - into_start_loc);
+		plpgsql_append_source_text(&ds, into_end_loc, yylloc);
+	}
+	else
+		plpgsql_append_source_text(&ds, location, yylloc);
+
+	/* trim any trailing whitespace, for neatness */
+	while (ds.len > 0 && scanner_isspace(ds.data[ds.len - 1]))
+		ds.data[--ds.len] = '\0';
+
+	expr = palloc0(sizeof(PLpgSQL_expr));
+	expr->dtype			= PLPGSQL_DTYPE_EXPR;
+	expr->query			= pstrdup(ds.data);
+	expr->plan			= NULL;
+	expr->paramnos		= NULL;
+	expr->rwparam		= -1;
+	expr->ns			= plpgsql_ns_top();
+	pfree(ds.data);
+
+	check_sql_expr(expr->query, location, 0);
+
+	execsql = palloc(sizeof(PLpgSQL_stmt_execsql));
+	execsql->cmd_type = PLPGSQL_STMT_EXECSQL;
+	execsql->lineno  = plpgsql_location_to_lineno(location);
+	execsql->sqlstmt = expr;
+	execsql->into	 = have_into;
+	execsql->strict	 = have_strict;
+	execsql->rec	 = rec;
+	execsql->row	 = row;
+
+	return (PLpgSQL_stmt *) execsql;
+}
+
+
+/*
+ * Read FETCH or MOVE direction clause (everything through FROM/IN).
+ */
+static PLpgSQL_stmt_fetch *
+read_fetch_direction(void)
+{
+	PLpgSQL_stmt_fetch *fetch;
+	int			tok;
+	bool		check_FROM = true;
+
+	/*
+	 * We create the PLpgSQL_stmt_fetch struct here, but only fill in
+	 * the fields arising from the optional direction clause
+	 */
+	fetch = (PLpgSQL_stmt_fetch *) palloc0(sizeof(PLpgSQL_stmt_fetch));
+	fetch->cmd_type = PLPGSQL_STMT_FETCH;
+	/* set direction defaults: */
+	fetch->direction = FETCH_FORWARD;
+	fetch->how_many  = 1;
+	fetch->expr		 = NULL;
+	fetch->returns_multiple_rows = false;
+
+	tok = yylex();
+	if (tok == 0)
+		yyerror("unexpected end of function definition");
+
+	if (tok_is_keyword(tok, &yylval,
+					   K_NEXT, "next"))
+	{
+		/* use defaults */
+	}
+	else if (tok_is_keyword(tok, &yylval,
+							K_PRIOR, "prior"))
+	{
+		fetch->direction = FETCH_BACKWARD;
+	}
+	else if (tok_is_keyword(tok, &yylval,
+							K_FIRST, "first"))
+	{
+		fetch->direction = FETCH_ABSOLUTE;
+	}
+	else if (tok_is_keyword(tok, &yylval,
+							K_LAST, "last"))
+	{
+		fetch->direction = FETCH_ABSOLUTE;
+		fetch->how_many  = -1;
+	}
+	else if (tok_is_keyword(tok, &yylval,
+							K_ABSOLUTE, "absolute"))
+	{
+		fetch->direction = FETCH_ABSOLUTE;
+		fetch->expr = read_sql_expression2(K_FROM, K_IN,
+										   "FROM or IN",
+										   NULL);
+		check_FROM = false;
+	}
+	else if (tok_is_keyword(tok, &yylval,
+							K_RELATIVE, "relative"))
+	{
+		fetch->direction = FETCH_RELATIVE;
+		fetch->expr = read_sql_expression2(K_FROM, K_IN,
+										   "FROM or IN",
+										   NULL);
+		check_FROM = false;
+	}
+	else if (tok_is_keyword(tok, &yylval,
+							K_ALL, "all"))
+	{
+		fetch->how_many = FETCH_ALL;
+		fetch->returns_multiple_rows = true;
+	}
+	else if (tok_is_keyword(tok, &yylval,
+							K_FORWARD, "forward"))
+	{
+		complete_direction(fetch, &check_FROM);
+	}
+	else if (tok_is_keyword(tok, &yylval,
+							K_BACKWARD, "backward"))
+	{
+		fetch->direction = FETCH_BACKWARD;
+		complete_direction(fetch, &check_FROM);
+	}
+	else if (tok == K_FROM || tok == K_IN)
+	{
+		/* empty direction */
+		check_FROM = false;
+	}
+	else if (tok == T_DATUM)
+	{
+		/* Assume there's no direction clause and tok is a cursor name */
+		plpgsql_push_back_token(tok);
+		check_FROM = false;
+	}
+	else
+	{
+		/*
+		 * Assume it's a count expression with no preceding keyword.
+		 * Note: we allow this syntax because core SQL does, but we don't
+		 * document it because of the ambiguity with the omitted-direction
+		 * case.  For instance, "MOVE n IN c" will fail if n is a variable.
+		 * Perhaps this can be improved someday, but it's hardly worth a
+		 * lot of work.
+		 */
+		plpgsql_push_back_token(tok);
+		fetch->expr = read_sql_expression2(K_FROM, K_IN,
+										   "FROM or IN",
+										   NULL);
+		fetch->returns_multiple_rows = true;
+		check_FROM = false;
+	}
+
+	/* check FROM or IN keyword after direction's specification */
+	if (check_FROM)
+	{
+		tok = yylex();
+		if (tok != K_FROM && tok != K_IN)
+			yyerror("expected FROM or IN");
+	}
+
+	return fetch;
+}
+
+/*
+ * Process remainder of FETCH/MOVE direction after FORWARD or BACKWARD.
+ * Allows these cases:
+ *   FORWARD expr,  FORWARD ALL,  FORWARD
+ *   BACKWARD expr, BACKWARD ALL, BACKWARD
+ */
+static void
+complete_direction(PLpgSQL_stmt_fetch *fetch,  bool *check_FROM)
+{
+	int			tok;
+
+	tok = yylex();
+	if (tok == 0)
+		yyerror("unexpected end of function definition");
+
+	if (tok == K_FROM || tok == K_IN)
+	{
+		*check_FROM = false;
+		return;
+	}
+
+	if (tok == K_ALL)
+	{
+		fetch->how_many = FETCH_ALL;
+		fetch->returns_multiple_rows = true;
+		*check_FROM = true;
+		return;
+	}
+
+	plpgsql_push_back_token(tok);
+	fetch->expr = read_sql_expression2(K_FROM, K_IN,
+									   "FROM or IN",
+									   NULL);
+	fetch->returns_multiple_rows = true;
+	*check_FROM = false;
+}
+
+
+
+static PLpgSQL_stmt *
+make_return_stmt(int location)
+{
+	PLpgSQL_stmt_return *new;
+
+  Assert(plpgsql_curr_compile->fn_rettype == VOIDOID);
+
+	new = palloc0(sizeof(PLpgSQL_stmt_return));
+	new->cmd_type = PLPGSQL_STMT_RETURN;
+	new->lineno   = plpgsql_location_to_lineno(location);
+	new->expr	  = NULL;
+	new->retvarno = -1;
+
+  int tok = yylex();
+
+  if (tok != ';')
+	{
+		plpgsql_push_back_token(tok);
+		new->expr = read_sql_expression(';', ";");
+	}
+
+	return (PLpgSQL_stmt *) new;
+}
+
+
+
+
+static PLpgSQL_stmt *
+make_return_next_stmt(int location)
+{
+	PLpgSQL_stmt_return_next *new;
+
+	if (!plpgsql_curr_compile->fn_retset)
+		ereport(ERROR,
+				(errcode(ERRCODE_DATATYPE_MISMATCH),
+				 errmsg("cannot use RETURN NEXT in a non-SETOF function"),
+				 parser_errposition(location)));
+
+	new = palloc0(sizeof(PLpgSQL_stmt_return_next));
+	new->cmd_type	= PLPGSQL_STMT_RETURN_NEXT;
+	new->lineno		= plpgsql_location_to_lineno(location);
+	new->expr		= NULL;
+	new->retvarno	= -1;
+
+	if (plpgsql_curr_compile->out_param_varno >= 0)
+	{
+		if (yylex() != ';')
+			ereport(ERROR,
+					(errcode(ERRCODE_DATATYPE_MISMATCH),
+					 errmsg("RETURN NEXT cannot have a parameter in function with OUT parameters"),
+					 parser_errposition(yylloc)));
+		new->retvarno = plpgsql_curr_compile->out_param_varno;
+	}
+	else
+	{
+		/*
+		 * We want to special-case simple variable references for efficiency.
+		 * So peek ahead to see if that's what we have.
+		 */
+		int		tok = yylex();
+
+		if (tok == T_DATUM && plpgsql_peek() == ';' &&
+			(yylval.wdatum.datum->dtype == PLPGSQL_DTYPE_VAR ||
+			 yylval.wdatum.datum->dtype == PLPGSQL_DTYPE_ROW ||
+			 yylval.wdatum.datum->dtype == PLPGSQL_DTYPE_REC))
+		{
+			new->retvarno = yylval.wdatum.datum->dno;
+			/* eat the semicolon token that we only peeked at above */
+			tok = yylex();
+			Assert(tok == ';');
+		}
+		else
+		{
+			/*
+			 * Not (just) a variable name, so treat as expression.
+			 *
+			 * Note that a well-formed expression is _required_ here;
+			 * anything else is a compile-time error.
+			 */
+			plpgsql_push_back_token(tok);
+			new->expr = read_sql_expression(';', ";");
+		}
+	}
+
+	return (PLpgSQL_stmt *) new;
+}
+
+
+static PLpgSQL_stmt *
+make_return_query_stmt(int location)
+{
+	PLpgSQL_stmt_return_query *new;
+	int			tok;
+
+	if (!plpgsql_curr_compile->fn_retset)
+		ereport(ERROR,
+				(errcode(ERRCODE_DATATYPE_MISMATCH),
+				 errmsg("cannot use RETURN QUERY in a non-SETOF function"),
+				 parser_errposition(location)));
+
+	new = palloc0(sizeof(PLpgSQL_stmt_return_query));
+	new->cmd_type = PLPGSQL_STMT_RETURN_QUERY;
+	new->lineno = plpgsql_location_to_lineno(location);
+
+	/* check for RETURN QUERY EXECUTE */
+	if ((tok = yylex()) != K_EXECUTE)
+	{
+		/* ordinary static query */
+		plpgsql_push_back_token(tok);
+		new->query = read_sql_stmt("");
+	}
+	else
+	{
+		/* dynamic SQL */
+		int		term;
+
+		new->dynquery = read_sql_expression2(';', K_USING, "; or USING",
+											 &term);
+		if (term == K_USING)
+		{
+			do
+			{
+				PLpgSQL_expr *expr;
+
+				expr = read_sql_expression2(',', ';', ", or ;", &term);
+				new->params = lappend(new->params, expr);
+			} while (term == ',');
+		}
+	}
+
+	return (PLpgSQL_stmt *) new;
+}
+
+
+/* convenience routine to fetch the name of a T_DATUM */
+static char *
+NameOfDatum(PLwdatum *wdatum)
+{
+	if (wdatum->ident)
+		return wdatum->ident;
+	Assert(wdatum->idents != NIL);
+	return NameListToString(wdatum->idents);
+}
+
+static void
+check_assignable(PLpgSQL_datum *datum, int location)
+{
+	switch (datum->dtype)
+	{
+		case PLPGSQL_DTYPE_VAR:
+			if (((PLpgSQL_var *) datum)->isconst)
+				ereport(ERROR,
+						(errcode(ERRCODE_ERROR_IN_ASSIGNMENT),
+						 errmsg("\"%s\" is declared CONSTANT",
+								((PLpgSQL_var *) datum)->refname),
+						 parser_errposition(location)));
+			break;
+		case PLPGSQL_DTYPE_ROW:
+			/* always assignable? */
+			break;
+		case PLPGSQL_DTYPE_REC:
+			/* always assignable?  What about NEW/OLD? */
+			break;
+		case PLPGSQL_DTYPE_RECFIELD:
+			/* always assignable? */
+			break;
+		case PLPGSQL_DTYPE_ARRAYELEM:
+			/* always assignable? */
+			break;
+		default:
+			elog(ERROR, "unrecognized dtype: %d", datum->dtype);
+			break;
+	}
+}
+
+/*
+ * Read the argument of an INTO clause.  On entry, we have just read the
+ * INTO keyword.
+ */
+static void
+read_into_target(PLpgSQL_rec **rec, PLpgSQL_row **row, bool *strict)
+{
+	int			tok;
+
+	/* Set default results */
+	*rec = NULL;
+	*row = NULL;
+	if (strict)
+		*strict = false;
+
+	tok = yylex();
+	if (strict && tok == K_STRICT)
+	{
+		*strict = true;
+		tok = yylex();
+	}
+
+	/*
+	 * Currently, a row or record variable can be the single INTO target,
+	 * but not a member of a multi-target list.  So we throw error if there
+	 * is a comma after it, because that probably means the user tried to
+	 * write a multi-target list.  If this ever gets generalized, we should
+	 * probably refactor read_into_scalar_list so it handles all cases.
+	 */
+	switch (tok)
+	{
+		case T_DATUM:
+			if (yylval.wdatum.datum->dtype == PLPGSQL_DTYPE_ROW)
+			{
+				check_assignable(yylval.wdatum.datum, yylloc);
+				*row = (PLpgSQL_row *) yylval.wdatum.datum;
+
+				if ((tok = yylex()) == ',')
+					ereport(ERROR,
+							(errcode(ERRCODE_SYNTAX_ERROR),
+							 errmsg("record or row variable cannot be part of multiple-item INTO list"),
+							 parser_errposition(yylloc)));
+				plpgsql_push_back_token(tok);
+			}
+			else if (yylval.wdatum.datum->dtype == PLPGSQL_DTYPE_REC)
+			{
+				check_assignable(yylval.wdatum.datum, yylloc);
+				*rec = (PLpgSQL_rec *) yylval.wdatum.datum;
+
+				if ((tok = yylex()) == ',')
+					ereport(ERROR,
+							(errcode(ERRCODE_SYNTAX_ERROR),
+							 errmsg("record or row variable cannot be part of multiple-item INTO list"),
+							 parser_errposition(yylloc)));
+				plpgsql_push_back_token(tok);
+			}
+			else
+			{
+				*row = read_into_scalar_list(NameOfDatum(&(yylval.wdatum)),
+											 yylval.wdatum.datum, yylloc);
+			}
+			break;
+
+		default:
+			/* just to give a better message than "syntax error" */
+			current_token_is_not_variable(tok);
+	}
+}
+
+/*
+ * Given the first datum and name in the INTO list, continue to read
+ * comma-separated scalar variables until we run out. Then construct
+ * and return a fake "row" variable that represents the list of
+ * scalars.
+ */
+static PLpgSQL_row *
+read_into_scalar_list(char *initial_name,
+					  PLpgSQL_datum *initial_datum,
+					  int initial_location)
+{
+	int				 nfields;
+	char			*fieldnames[1024];
+	int				 varnos[1024];
+	PLpgSQL_row		*row;
+	int				 tok;
+
+	check_assignable(initial_datum, initial_location);
+	fieldnames[0] = initial_name;
+	varnos[0]	  = initial_datum->dno;
+	nfields		  = 1;
+
+	while ((tok = yylex()) == ',')
+	{
+		/* Check for array overflow */
+		if (nfields >= 1024)
+			ereport(ERROR,
+					(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
+					 errmsg("too many INTO variables specified"),
+					 parser_errposition(yylloc)));
+
+		tok = yylex();
+		switch (tok)
+		{
+			case T_DATUM:
+				check_assignable(yylval.wdatum.datum, yylloc);
+				if (yylval.wdatum.datum->dtype == PLPGSQL_DTYPE_ROW ||
+					yylval.wdatum.datum->dtype == PLPGSQL_DTYPE_REC)
+					ereport(ERROR,
+							(errcode(ERRCODE_SYNTAX_ERROR),
+							 errmsg("\"%s\" is not a scalar variable",
+									NameOfDatum(&(yylval.wdatum))),
+							 parser_errposition(yylloc)));
+				fieldnames[nfields] = NameOfDatum(&(yylval.wdatum));
+				varnos[nfields++]	= yylval.wdatum.datum->dno;
+				break;
+
+			default:
+				/* just to give a better message than "syntax error" */
+				current_token_is_not_variable(tok);
+		}
+	}
+
+	/*
+	 * We read an extra, non-comma token from yylex(), so push it
+	 * back onto the input stream
+	 */
+	plpgsql_push_back_token(tok);
+
+	row = palloc(sizeof(PLpgSQL_row));
+	row->dtype = PLPGSQL_DTYPE_ROW;
+	row->refname = pstrdup("*internal*");
+	row->lineno = plpgsql_location_to_lineno(initial_location);
+	row->rowtupdesc = NULL;
+	row->nfields = nfields;
+	row->fieldnames = palloc(sizeof(char *) * nfields);
+	row->varnos = palloc(sizeof(int) * nfields);
+	while (--nfields >= 0)
+	{
+		row->fieldnames[nfields] = fieldnames[nfields];
+		row->varnos[nfields] = varnos[nfields];
+	}
+
+	plpgsql_adddatum((PLpgSQL_datum *)row);
+
+	return row;
+}
+
+/*
+ * Convert a single scalar into a "row" list.  This is exactly
+ * like read_into_scalar_list except we never consume any input.
+ *
+ * Note: lineno could be computed from location, but since callers
+ * have it at hand already, we may as well pass it in.
+ */
+static PLpgSQL_row *
+make_scalar_list1(char *initial_name,
+				  PLpgSQL_datum *initial_datum,
+				  int lineno, int location)
+{
+	PLpgSQL_row		*row;
+
+	check_assignable(initial_datum, location);
+
+	row = palloc(sizeof(PLpgSQL_row));
+	row->dtype = PLPGSQL_DTYPE_ROW;
+	row->refname = pstrdup("*internal*");
+	row->lineno = lineno;
+	row->rowtupdesc = NULL;
+	row->nfields = 1;
+	row->fieldnames = palloc(sizeof(char *));
+	row->varnos = palloc(sizeof(int));
+	row->fieldnames[0] = initial_name;
+	row->varnos[0] = initial_datum->dno;
+
+	plpgsql_adddatum((PLpgSQL_datum *)row);
+
+	return row;
+}
+
+/*
+ * When the PL/pgSQL parser expects to see a SQL statement, it is very
+ * liberal in what it accepts; for example, we often assume an
+ * unrecognized keyword is the beginning of a SQL statement. This
+ * avoids the need to duplicate parts of the SQL grammar in the
+ * PL/pgSQL grammar, but it means we can accept wildly malformed
+ * input. To try and catch some of the more obviously invalid input,
+ * we run the strings we expect to be SQL statements through the main
+ * SQL parser.
+ *
+ * We only invoke the raw parser (not the analyzer); this doesn't do
+ * any database access and does not check any semantic rules, it just
+ * checks for basic syntactic correctness. We do this here, rather
+ * than after parsing has finished, because a malformed SQL statement
+ * may cause the PL/pgSQL parser to become confused about statement
+ * borders. So it is best to bail out as early as we can.
+ *
+ * It is assumed that "stmt" represents a copy of the function source text
+ * beginning at offset "location", with leader text of length "leaderlen"
+ * (typically "SELECT ") prefixed to the source text.  We use this assumption
+ * to transpose any error cursor position back to the function source text.
+ * If no error cursor is provided, we'll just point at "location".
+ */
+static void
+check_sql_expr(const char *stmt, int location, int leaderlen)
+{
+	sql_error_callback_arg cbarg;
+	ErrorContextCallback  syntax_errcontext;
+	MemoryContext oldCxt;
+
+	if (!plpgsql_check_syntax)
+		return;
+
+	cbarg.location = location;
+	cbarg.leaderlen = leaderlen;
+
+	syntax_errcontext.callback = plpgsql_sql_error_callback;
+	syntax_errcontext.arg = &cbarg;
+	syntax_errcontext.previous = error_context_stack;
+	error_context_stack = &syntax_errcontext;
+
+	oldCxt = MemoryContextSwitchTo(compile_tmp_cxt);
+	(void) raw_parser(stmt);
+	MemoryContextSwitchTo(oldCxt);
+
+	/* Restore former ereport callback */
+	error_context_stack = syntax_errcontext.previous;
+}
+
+static void
+plpgsql_sql_error_callback(void *arg)
+{
+	sql_error_callback_arg *cbarg = (sql_error_callback_arg *) arg;
+	int			errpos;
+
+	/*
+	 * First, set up internalerrposition to point to the start of the
+	 * statement text within the function text.  Note this converts
+	 * location (a byte offset) to a character number.
+	 */
+	parser_errposition(cbarg->location);
+
+	/*
+	 * If the core parser provided an error position, transpose it.
+	 * Note we are dealing with 1-based character numbers at this point.
+	 */
+	errpos = geterrposition();
+	if (errpos > cbarg->leaderlen)
+	{
+		int		myerrpos = getinternalerrposition();
+
+		if (myerrpos > 0)		/* safety check */
+			internalerrposition(myerrpos + errpos - cbarg->leaderlen - 1);
+	}
+
+	/* In any case, flush errposition --- we want internalerrpos only */
+	errposition(0);
+}
+
+/*
+ * Parse a SQL datatype name and produce a PLpgSQL_type structure.
+ *
+ * The heavy lifting is done elsewhere.  Here we are only concerned
+ * with setting up an errcontext link that will let us give an error
+ * cursor pointing into the plpgsql function source, if necessary.
+ * This is handled the same as in check_sql_expr(), and we likewise
+ * expect that the given string is a copy from the source text.
+ */
+static PLpgSQL_type * parse_datatype(const char *string, int location) { PLpgSQL_type *typ; typ = (PLpgSQL_type *) palloc0(sizeof(PLpgSQL_type)); typ->typname = pstrdup(string); typ->ttype = PLPGSQL_TTYPE_SCALAR; return typ; }
+
+
+/*
+ * Check block starting and ending labels match.
+ */
+static void
+check_labels(const char *start_label, const char *end_label, int end_location)
+{
+	if (end_label)
+	{
+		if (!start_label)
+			ereport(ERROR,
+					(errcode(ERRCODE_SYNTAX_ERROR),
+					 errmsg("end label \"%s\" specified for unlabelled block",
+							end_label),
+					 parser_errposition(end_location)));
+
+		if (strcmp(start_label, end_label) != 0)
+			ereport(ERROR,
+					(errcode(ERRCODE_SYNTAX_ERROR),
+					 errmsg("end label \"%s\" differs from block's label \"%s\"",
+							end_label, start_label),
+					 parser_errposition(end_location)));
+	}
+}
+
+/*
+ * Read the arguments (if any) for a cursor, followed by the until token
+ *
+ * If cursor has no args, just swallow the until token and return NULL.
+ * If it does have args, we expect to see "( arg [, arg ...] )" followed
+ * by the until token, where arg may be a plain expression, or a named
+ * parameter assignment of the form argname := expr. Consume all that and
+ * return a SELECT query that evaluates the expression(s) (without the outer
+ * parens).
+ */
+static PLpgSQL_expr *
+read_cursor_args(PLpgSQL_var *cursor, int until, const char *expected)
+{
+	PLpgSQL_expr *expr;
+	PLpgSQL_row *row;
+	int			tok;
+	int			argc;
+	char	  **argv;
+	StringInfoData ds;
+	char	   *sqlstart = "SELECT ";
+	bool		any_named = false;
+
+	tok = yylex();
+	if (cursor->cursor_explicit_argrow < 0)
+	{
+		/* No arguments expected */
+		if (tok == '(')
+			ereport(ERROR,
+					(errcode(ERRCODE_SYNTAX_ERROR),
+					 errmsg("cursor \"%s\" has no arguments",
+							cursor->refname),
+					 parser_errposition(yylloc)));
+
+		if (tok != until)
+			yyerror("syntax error");
+
+		return NULL;
+	}
+
+	/* Else better provide arguments */
+	if (tok != '(')
+		ereport(ERROR,
+				(errcode(ERRCODE_SYNTAX_ERROR),
+				 errmsg("cursor \"%s\" has arguments",
+						cursor->refname),
+				 parser_errposition(yylloc)));
+
+	/*
+	 * Read the arguments, one by one.
+	 */
+	row = (PLpgSQL_row *) plpgsql_Datums[cursor->cursor_explicit_argrow];
+	argv = (char **) palloc0(row->nfields * sizeof(char *));
+
+	for (argc = 0; argc < row->nfields; argc++)
+	{
+		PLpgSQL_expr *item;
+		int		endtoken;
+		int		argpos;
+		int		tok1,
+				tok2;
+		int		arglocation;
+
+		/* Check if it's a named parameter: "param := value" */
+		plpgsql_peek2(&tok1, &tok2, &arglocation, NULL);
+		if (tok1 == IDENT && tok2 == COLON_EQUALS)
+		{
+			char   *argname;
+			IdentifierLookup save_IdentifierLookup;
+
+			/* Read the argument name, ignoring any matching variable */
+			save_IdentifierLookup = plpgsql_IdentifierLookup;
+			plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_DECLARE;
+			yylex();
+			argname = yylval.str;
+			plpgsql_IdentifierLookup = save_IdentifierLookup;
+
+			/* Match argument name to cursor arguments */
+			for (argpos = 0; argpos < row->nfields; argpos++)
+			{
+				if (strcmp(row->fieldnames[argpos], argname) == 0)
+					break;
+			}
+			if (argpos == row->nfields)
+				ereport(ERROR,
+						(errcode(ERRCODE_SYNTAX_ERROR),
+						 errmsg("cursor \"%s\" has no argument named \"%s\"",
+								cursor->refname, argname),
+						 parser_errposition(yylloc)));
+
+			/*
+			 * Eat the ":=". We already peeked, so the error should never
+			 * happen.
+			 */
+			tok2 = yylex();
+			if (tok2 != COLON_EQUALS)
+				yyerror("syntax error");
+
+			any_named = true;
+		}
+		else
+			argpos = argc;
+
+		if (argv[argpos] != NULL)
+			ereport(ERROR,
+					(errcode(ERRCODE_SYNTAX_ERROR),
+					 errmsg("value for parameter \"%s\" of cursor \"%s\" specified more than once",
+							row->fieldnames[argpos], cursor->refname),
+					 parser_errposition(arglocation)));
+
+		/*
+		 * Read the value expression. To provide the user with meaningful
+		 * parse error positions, we check the syntax immediately, instead of
+		 * checking the final expression that may have the arguments
+		 * reordered. Trailing whitespace must not be trimmed, because
+		 * otherwise input of the form (param -- comment\n, param) would be
+		 * translated into a form where the second parameter is commented
+		 * out.
+		 */
+		item = read_sql_construct(',', ')', 0,
+								  ",\" or \")",
+								  sqlstart,
+								  true, true,
+								  false, /* do not trim */
+								  NULL, &endtoken);
+
+		argv[argpos] = item->query + strlen(sqlstart);
+
+		if (endtoken == ')' && !(argc == row->nfields - 1))
+			ereport(ERROR,
+					(errcode(ERRCODE_SYNTAX_ERROR),
+					 errmsg("not enough arguments for cursor \"%s\"",
+							cursor->refname),
+					 parser_errposition(yylloc)));
+
+		if (endtoken == ',' && (argc == row->nfields - 1))
+			ereport(ERROR,
+					(errcode(ERRCODE_SYNTAX_ERROR),
+					 errmsg("too many arguments for cursor \"%s\"",
+							cursor->refname),
+					 parser_errposition(yylloc)));
+	}
+
+	/* Make positional argument list */
+	initStringInfo(&ds);
+	appendStringInfoString(&ds, sqlstart);
+	for (argc = 0; argc < row->nfields; argc++)
+	{
+		Assert(argv[argc] != NULL);
+
+		/*
+		 * Because named notation allows permutated argument lists, include
+		 * the parameter name for meaningful runtime errors.
+		 */
+		appendStringInfoString(&ds, argv[argc]);
+		if (any_named)
+			appendStringInfo(&ds, " AS %s",
+							 quote_identifier(row->fieldnames[argc]));
+		if (argc < row->nfields - 1)
+			appendStringInfoString(&ds, ", ");
+	}
+	appendStringInfoChar(&ds, ';');
+
+	expr = palloc0(sizeof(PLpgSQL_expr));
+	expr->dtype			= PLPGSQL_DTYPE_EXPR;
+	expr->query			= pstrdup(ds.data);
+	expr->plan			= NULL;
+	expr->paramnos		= NULL;
+	expr->rwparam		= -1;
+	expr->ns            = plpgsql_ns_top();
+	pfree(ds.data);
+
+	/* Next we'd better find the until token */
+	tok = yylex();
+	if (tok != until)
+		yyerror("syntax error");
+
+	return expr;
+}
+
+/*
+ * Parse RAISE ... USING options
+ */
+static List *
+read_raise_options(void)
+{
+	List	   *result = NIL;
+
+	for (;;)
+	{
+		PLpgSQL_raise_option *opt;
+		int		tok;
+
+		if ((tok = yylex()) == 0)
+			yyerror("unexpected end of function definition");
+
+		opt = (PLpgSQL_raise_option *) palloc(sizeof(PLpgSQL_raise_option));
+
+		if (tok_is_keyword(tok, &yylval,
+						   K_ERRCODE, "errcode"))
+			opt->opt_type = PLPGSQL_RAISEOPTION_ERRCODE;
+		else if (tok_is_keyword(tok, &yylval,
+								K_MESSAGE, "message"))
+			opt->opt_type = PLPGSQL_RAISEOPTION_MESSAGE;
+		else if (tok_is_keyword(tok, &yylval,
+								K_DETAIL, "detail"))
+			opt->opt_type = PLPGSQL_RAISEOPTION_DETAIL;
+		else if (tok_is_keyword(tok, &yylval,
+								K_HINT, "hint"))
+			opt->opt_type = PLPGSQL_RAISEOPTION_HINT;
+		else if (tok_is_keyword(tok, &yylval,
+								K_COLUMN, "column"))
+			opt->opt_type = PLPGSQL_RAISEOPTION_COLUMN;
+		else if (tok_is_keyword(tok, &yylval,
+								K_CONSTRAINT, "constraint"))
+			opt->opt_type = PLPGSQL_RAISEOPTION_CONSTRAINT;
+		else if (tok_is_keyword(tok, &yylval,
+								K_DATATYPE, "datatype"))
+			opt->opt_type = PLPGSQL_RAISEOPTION_DATATYPE;
+		else if (tok_is_keyword(tok, &yylval,
+								K_TABLE, "table"))
+			opt->opt_type = PLPGSQL_RAISEOPTION_TABLE;
+		else if (tok_is_keyword(tok, &yylval,
+								K_SCHEMA, "schema"))
+			opt->opt_type = PLPGSQL_RAISEOPTION_SCHEMA;
+		else
+			yyerror("unrecognized RAISE statement option");
+
+		tok = yylex();
+		if (tok != '=' && tok != COLON_EQUALS)
+			yyerror("syntax error, expected \"=\"");
+
+		opt->expr = read_sql_expression2(',', ';', ", or ;", &tok);
+
+		result = lappend(result, opt);
+
+		if (tok == ';')
+			break;
+	}
+
+	return result;
+}
+
+/*
+ * Check that the number of parameter placeholders in the message matches the
+ * number of parameters passed to it, if a message was given.
+ */
+static void
+check_raise_parameters(PLpgSQL_stmt_raise *stmt)
+{
+	char	   *cp;
+	int			expected_nparams = 0;
+
+	if (stmt->message == NULL)
+		return;
+
+	for (cp = stmt->message; *cp; cp++)
+	{
+		if (cp[0] == '%')
+		{
+			/* ignore literal % characters */
+			if (cp[1] == '%')
+				cp++;
+			else
+				expected_nparams++;
+		}
+	}
+
+	if (expected_nparams < list_length(stmt->params))
+		ereport(ERROR,
+				(errcode(ERRCODE_SYNTAX_ERROR),
+				errmsg("too many parameters specified for RAISE")));
+	if (expected_nparams > list_length(stmt->params))
+		ereport(ERROR,
+				(errcode(ERRCODE_SYNTAX_ERROR),
+				errmsg("too few parameters specified for RAISE")));
+}
+
+/*
+ * Fix up CASE statement
+ */
+static PLpgSQL_stmt *
+make_case(int location, PLpgSQL_expr *t_expr,
+		  List *case_when_list, List *else_stmts)
+{
+	PLpgSQL_stmt_case	*new;
+
+	new = palloc(sizeof(PLpgSQL_stmt_case));
+	new->cmd_type = PLPGSQL_STMT_CASE;
+	new->lineno = plpgsql_location_to_lineno(location);
+	new->t_expr = t_expr;
+	new->t_varno = 0;
+	new->case_when_list = case_when_list;
+	new->have_else = (else_stmts != NIL);
+	/* Get rid of list-with-NULL hack */
+	if (list_length(else_stmts) == 1 && linitial(else_stmts) == NULL)
+		new->else_stmts = NIL;
+	else
+		new->else_stmts = else_stmts;
+
+	/*
+	 * When test expression is present, we create a var for it and then
+	 * convert all the WHEN expressions to "VAR IN (original_expression)".
+	 * This is a bit klugy, but okay since we haven't yet done more than
+	 * read the expressions as text.  (Note that previous parsing won't
+	 * have complained if the WHEN ... THEN expression contained multiple
+	 * comma-separated values.)
+	 */
+	if (t_expr)
+	{
+		char	varname[32];
+		PLpgSQL_var *t_var;
+		ListCell *l;
+
+		/* use a name unlikely to collide with any user names */
+		snprintf(varname, sizeof(varname), "__Case__Variable_%d__",
+				 plpgsql_nDatums);
+
+		/*
+		 * We don't yet know the result datatype of t_expr.  Build the
+		 * variable as if it were INT4; we'll fix this at runtime if needed.
+		 */
+		t_var = (PLpgSQL_var *)
+			plpgsql_build_variable(varname, new->lineno,
+								   plpgsql_build_datatype(INT4OID,
+														  -1,
+														  InvalidOid),
+								   true);
+		new->t_varno = t_var->dno;
+
+		foreach(l, case_when_list)
+		{
+			PLpgSQL_case_when *cwt = (PLpgSQL_case_when *) lfirst(l);
+			PLpgSQL_expr *expr = cwt->expr;
+			StringInfoData	ds;
+
+			/* copy expression query without SELECT keyword (expr->query + 7) */
+			Assert(strncmp(expr->query, "SELECT ", 7) == 0);
+
+			/* And do the string hacking */
+			initStringInfo(&ds);
+
+			appendStringInfo(&ds, "SELECT \"%s\" IN (%s)",
+							 varname, expr->query + 7);
+
+			pfree(expr->query);
+			expr->query = pstrdup(ds.data);
+			/* Adjust expr's namespace to include the case variable */
+			expr->ns = plpgsql_ns_top();
+
+			pfree(ds.data);
+		}
+	}
+
+	return (PLpgSQL_stmt *) new;
+}
diff --git a/foreign/libpg_query/src/postgres/src_pl_plpgsql_src_pl_handler.c b/foreign/libpg_query/src/postgres/src_pl_plpgsql_src_pl_handler.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_pl_plpgsql_src_pl_handler.c
@@ -0,0 +1,106 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - plpgsql_variable_conflict
+ * - plpgsql_print_strict_params
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * pl_handler.c		- Handler for the PL/pgSQL
+ *			  procedural language
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/pl/plpgsql/src/pl_handler.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "plpgsql.h"
+
+#include "access/htup_details.h"
+#include "catalog/pg_proc.h"
+#include "catalog/pg_type.h"
+#include "funcapi.h"
+#include "miscadmin.h"
+#include "utils/builtins.h"
+#include "utils/guc.h"
+#include "utils/lsyscache.h"
+#include "utils/syscache.h"
+
+
+static bool plpgsql_extra_checks_check_hook(char **newvalue, void **extra, GucSource source);
+static void plpgsql_extra_warnings_assign_hook(const char *newvalue, void *extra);
+static void plpgsql_extra_errors_assign_hook(const char *newvalue, void *extra);
+
+;
+
+/* Custom GUC variable */
+
+
+__thread int			plpgsql_variable_conflict = PLPGSQL_RESOLVE_ERROR;
+
+
+__thread bool		plpgsql_print_strict_params = false;
+
+
+
+
+
+
+
+
+
+/* Hook for plugins */
+
+
+
+
+
+
+
+
+
+
+/*
+ * _PG_init()			- library load-time initialization
+ *
+ * DO NOT make this static nor change its name!
+ */
+
+
+/* ----------
+ * plpgsql_call_handler
+ *
+ * The PostgreSQL function manager and trigger manager
+ * call this function for execution of PL/pgSQL procedures.
+ * ----------
+ */
+;
+
+
+
+/* ----------
+ * plpgsql_inline_handler
+ *
+ * Called by PostgreSQL to execute an anonymous code block
+ * ----------
+ */
+;
+
+
+
+/* ----------
+ * plpgsql_validator
+ *
+ * This function attempts to validate a PL/pgSQL function at
+ * CREATE FUNCTION time.
+ * ----------
+ */
+;
+
+
diff --git a/foreign/libpg_query/src/postgres/src_pl_plpgsql_src_pl_scanner.c b/foreign/libpg_query/src/postgres/src_pl_plpgsql_src_pl_scanner.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_pl_plpgsql_src_pl_scanner.c
@@ -0,0 +1,770 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - plpgsql_scanner_init
+ * - plpgsql_IdentifierLookup
+ * - yyscanner
+ * - core_yy
+ * - reserved_keywords
+ * - num_reserved_keywords
+ * - scanorig
+ * - plpgsql_yytoken
+ * - num_pushbacks
+ * - location_lineno_init
+ * - cur_line_start
+ * - cur_line_num
+ * - cur_line_end
+ * - plpgsql_yylex
+ * - internal_yylex
+ * - pushback_token
+ * - pushback_auxdata
+ * - push_back_token
+ * - unreserved_keywords
+ * - num_unreserved_keywords
+ * - plpgsql_yyleng
+ * - plpgsql_location_to_lineno
+ * - plpgsql_scanner_errposition
+ * - plpgsql_yyerror
+ * - plpgsql_push_back_token
+ * - plpgsql_token_is_unreserved_keyword
+ * - plpgsql_append_source_text
+ * - plpgsql_peek2
+ * - plpgsql_peek
+ * - plpgsql_scanner_finish
+ * - plpgsql_latest_lineno
+ *--------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ *
+ * pl_scanner.c
+ *	  lexical scanning for PL/pgSQL
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ *	  src/pl/plpgsql/src/pl_scanner.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "plpgsql.h"
+
+#include "mb/pg_wchar.h"
+#include "parser/scanner.h"
+
+#include "pl_gram.h"			/* must be after parser/scanner.h */
+
+#define PG_KEYWORD(a,b,c) {a,b,c},
+
+
+/* Klugy flag to tell scanner how to look up identifiers */
+__thread IdentifierLookup plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_NORMAL;
+
+
+/*
+ * A word about keywords:
+ *
+ * We keep reserved and unreserved keywords in separate arrays.  The
+ * reserved keywords are passed to the core scanner, so they will be
+ * recognized before (and instead of) any variable name.  Unreserved words
+ * are checked for separately, usually after determining that the identifier
+ * isn't a known variable name.  If plpgsql_IdentifierLookup is DECLARE then
+ * no variable names will be recognized, so the unreserved words always work.
+ * (Note in particular that this helps us avoid reserving keywords that are
+ * only needed in DECLARE sections.)
+ *
+ * In certain contexts it is desirable to prefer recognizing an unreserved
+ * keyword over recognizing a variable name.  In particular, at the start
+ * of a statement we should prefer unreserved keywords unless the statement
+ * looks like an assignment (i.e., first token is followed by ':=' or '[').
+ * This rule allows most statement-introducing keywords to be kept unreserved.
+ * (We still have to reserve initial keywords that might follow a block
+ * label, unfortunately, since the method used to determine if we are at
+ * start of statement doesn't recognize such cases.  We'd also have to
+ * reserve any keyword that could legitimately be followed by ':=' or '['.)
+ * Some additional cases are handled in pl_gram.y using tok_is_keyword().
+ *
+ * We try to avoid reserving more keywords than we have to; but there's
+ * little point in not reserving a word if it's reserved in the core grammar.
+ * Currently, the following words are reserved here but not in the core:
+ * BEGIN BY DECLARE EXECUTE FOREACH IF LOOP STRICT WHILE
+ */
+
+/*
+ * Lists of keyword (name, token-value, category) entries.
+ *
+ * !!WARNING!!: These lists must be sorted by ASCII name, because binary
+ *		 search is used to locate entries.
+ *
+ * Be careful not to put the same word in both lists.  Also be sure that
+ * pl_gram.y's unreserved_keyword production agrees with the second list.
+ */
+
+static const ScanKeyword reserved_keywords[] = {
+	PG_KEYWORD("all", K_ALL, RESERVED_KEYWORD)
+	PG_KEYWORD("begin", K_BEGIN, RESERVED_KEYWORD)
+	PG_KEYWORD("by", K_BY, RESERVED_KEYWORD)
+	PG_KEYWORD("case", K_CASE, RESERVED_KEYWORD)
+	PG_KEYWORD("declare", K_DECLARE, RESERVED_KEYWORD)
+	PG_KEYWORD("else", K_ELSE, RESERVED_KEYWORD)
+	PG_KEYWORD("end", K_END, RESERVED_KEYWORD)
+	PG_KEYWORD("execute", K_EXECUTE, RESERVED_KEYWORD)
+	PG_KEYWORD("for", K_FOR, RESERVED_KEYWORD)
+	PG_KEYWORD("foreach", K_FOREACH, RESERVED_KEYWORD)
+	PG_KEYWORD("from", K_FROM, RESERVED_KEYWORD)
+	PG_KEYWORD("if", K_IF, RESERVED_KEYWORD)
+	PG_KEYWORD("in", K_IN, RESERVED_KEYWORD)
+	PG_KEYWORD("into", K_INTO, RESERVED_KEYWORD)
+	PG_KEYWORD("loop", K_LOOP, RESERVED_KEYWORD)
+	PG_KEYWORD("not", K_NOT, RESERVED_KEYWORD)
+	PG_KEYWORD("null", K_NULL, RESERVED_KEYWORD)
+	PG_KEYWORD("or", K_OR, RESERVED_KEYWORD)
+	PG_KEYWORD("strict", K_STRICT, RESERVED_KEYWORD)
+	PG_KEYWORD("then", K_THEN, RESERVED_KEYWORD)
+	PG_KEYWORD("to", K_TO, RESERVED_KEYWORD)
+	PG_KEYWORD("using", K_USING, RESERVED_KEYWORD)
+	PG_KEYWORD("when", K_WHEN, RESERVED_KEYWORD)
+	PG_KEYWORD("while", K_WHILE, RESERVED_KEYWORD)
+};
+
+static const int num_reserved_keywords = lengthof(reserved_keywords);
+
+static const ScanKeyword unreserved_keywords[] = {
+	PG_KEYWORD("absolute", K_ABSOLUTE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("alias", K_ALIAS, UNRESERVED_KEYWORD)
+	PG_KEYWORD("array", K_ARRAY, UNRESERVED_KEYWORD)
+	PG_KEYWORD("assert", K_ASSERT, UNRESERVED_KEYWORD)
+	PG_KEYWORD("backward", K_BACKWARD, UNRESERVED_KEYWORD)
+	PG_KEYWORD("close", K_CLOSE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("collate", K_COLLATE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("column", K_COLUMN, UNRESERVED_KEYWORD)
+	PG_KEYWORD("column_name", K_COLUMN_NAME, UNRESERVED_KEYWORD)
+	PG_KEYWORD("constant", K_CONSTANT, UNRESERVED_KEYWORD)
+	PG_KEYWORD("constraint", K_CONSTRAINT, UNRESERVED_KEYWORD)
+	PG_KEYWORD("constraint_name", K_CONSTRAINT_NAME, UNRESERVED_KEYWORD)
+	PG_KEYWORD("continue", K_CONTINUE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("current", K_CURRENT, UNRESERVED_KEYWORD)
+	PG_KEYWORD("cursor", K_CURSOR, UNRESERVED_KEYWORD)
+	PG_KEYWORD("datatype", K_DATATYPE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("debug", K_DEBUG, UNRESERVED_KEYWORD)
+	PG_KEYWORD("default", K_DEFAULT, UNRESERVED_KEYWORD)
+	PG_KEYWORD("detail", K_DETAIL, UNRESERVED_KEYWORD)
+	PG_KEYWORD("diagnostics", K_DIAGNOSTICS, UNRESERVED_KEYWORD)
+	PG_KEYWORD("dump", K_DUMP, UNRESERVED_KEYWORD)
+	PG_KEYWORD("elseif", K_ELSIF, UNRESERVED_KEYWORD)
+	PG_KEYWORD("elsif", K_ELSIF, UNRESERVED_KEYWORD)
+	PG_KEYWORD("errcode", K_ERRCODE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("error", K_ERROR, UNRESERVED_KEYWORD)
+	PG_KEYWORD("exception", K_EXCEPTION, UNRESERVED_KEYWORD)
+	PG_KEYWORD("exit", K_EXIT, UNRESERVED_KEYWORD)
+	PG_KEYWORD("fetch", K_FETCH, UNRESERVED_KEYWORD)
+	PG_KEYWORD("first", K_FIRST, UNRESERVED_KEYWORD)
+	PG_KEYWORD("forward", K_FORWARD, UNRESERVED_KEYWORD)
+	PG_KEYWORD("get", K_GET, UNRESERVED_KEYWORD)
+	PG_KEYWORD("hint", K_HINT, UNRESERVED_KEYWORD)
+	PG_KEYWORD("info", K_INFO, UNRESERVED_KEYWORD)
+	PG_KEYWORD("insert", K_INSERT, UNRESERVED_KEYWORD)
+	PG_KEYWORD("is", K_IS, UNRESERVED_KEYWORD)
+	PG_KEYWORD("last", K_LAST, UNRESERVED_KEYWORD)
+	PG_KEYWORD("log", K_LOG, UNRESERVED_KEYWORD)
+	PG_KEYWORD("message", K_MESSAGE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("message_text", K_MESSAGE_TEXT, UNRESERVED_KEYWORD)
+	PG_KEYWORD("move", K_MOVE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("next", K_NEXT, UNRESERVED_KEYWORD)
+	PG_KEYWORD("no", K_NO, UNRESERVED_KEYWORD)
+	PG_KEYWORD("notice", K_NOTICE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("open", K_OPEN, UNRESERVED_KEYWORD)
+	PG_KEYWORD("option", K_OPTION, UNRESERVED_KEYWORD)
+	PG_KEYWORD("perform", K_PERFORM, UNRESERVED_KEYWORD)
+	PG_KEYWORD("pg_context", K_PG_CONTEXT, UNRESERVED_KEYWORD)
+	PG_KEYWORD("pg_datatype_name", K_PG_DATATYPE_NAME, UNRESERVED_KEYWORD)
+	PG_KEYWORD("pg_exception_context", K_PG_EXCEPTION_CONTEXT, UNRESERVED_KEYWORD)
+	PG_KEYWORD("pg_exception_detail", K_PG_EXCEPTION_DETAIL, UNRESERVED_KEYWORD)
+	PG_KEYWORD("pg_exception_hint", K_PG_EXCEPTION_HINT, UNRESERVED_KEYWORD)
+	PG_KEYWORD("print_strict_params", K_PRINT_STRICT_PARAMS, UNRESERVED_KEYWORD)
+	PG_KEYWORD("prior", K_PRIOR, UNRESERVED_KEYWORD)
+	PG_KEYWORD("query", K_QUERY, UNRESERVED_KEYWORD)
+	PG_KEYWORD("raise", K_RAISE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("relative", K_RELATIVE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("result_oid", K_RESULT_OID, UNRESERVED_KEYWORD)
+	PG_KEYWORD("return", K_RETURN, UNRESERVED_KEYWORD)
+	PG_KEYWORD("returned_sqlstate", K_RETURNED_SQLSTATE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("reverse", K_REVERSE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("row_count", K_ROW_COUNT, UNRESERVED_KEYWORD)
+	PG_KEYWORD("rowtype", K_ROWTYPE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("schema", K_SCHEMA, UNRESERVED_KEYWORD)
+	PG_KEYWORD("schema_name", K_SCHEMA_NAME, UNRESERVED_KEYWORD)
+	PG_KEYWORD("scroll", K_SCROLL, UNRESERVED_KEYWORD)
+	PG_KEYWORD("slice", K_SLICE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("sqlstate", K_SQLSTATE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("stacked", K_STACKED, UNRESERVED_KEYWORD)
+	PG_KEYWORD("table", K_TABLE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("table_name", K_TABLE_NAME, UNRESERVED_KEYWORD)
+	PG_KEYWORD("type", K_TYPE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("use_column", K_USE_COLUMN, UNRESERVED_KEYWORD)
+	PG_KEYWORD("use_variable", K_USE_VARIABLE, UNRESERVED_KEYWORD)
+	PG_KEYWORD("variable_conflict", K_VARIABLE_CONFLICT, UNRESERVED_KEYWORD)
+	PG_KEYWORD("warning", K_WARNING, UNRESERVED_KEYWORD)
+};
+
+static const int num_unreserved_keywords = lengthof(unreserved_keywords);
+
+/*
+ * This macro must recognize all tokens that can immediately precede a
+ * PL/pgSQL executable statement (that is, proc_sect or proc_stmt in the
+ * grammar).  Fortunately, there are not very many, so hard-coding in this
+ * fashion seems sufficient.
+ */
+#define AT_STMT_START(prev_token) \
+	((prev_token) == ';' || \
+	 (prev_token) == K_BEGIN || \
+	 (prev_token) == K_THEN || \
+	 (prev_token) == K_ELSE || \
+	 (prev_token) == K_LOOP)
+
+
+/* Auxiliary data about a token (other than the token type) */
+typedef struct
+{
+	YYSTYPE		lval;			/* semantic information */
+	YYLTYPE		lloc;			/* offset in scanbuf */
+	int			leng;			/* length in bytes */
+} TokenAuxData;
+
+/*
+ * Scanner working state.  At some point we might wish to fold all this
+ * into a YY_EXTRA struct.  For the moment, there is no need for plpgsql's
+ * lexer to be re-entrant, and the notational burden of passing a yyscanner
+ * pointer around is great enough to not want to do it without need.
+ */
+
+/* The stuff the core lexer needs */
+static core_yyscan_t yyscanner = NULL;
+static core_yy_extra_type core_yy;
+
+/* The original input string */
+static const char *scanorig;
+
+/* Current token's length (corresponds to plpgsql_yylval and plpgsql_yylloc) */
+static int	plpgsql_yyleng;
+
+/* Current token's code (corresponds to plpgsql_yylval and plpgsql_yylloc) */
+static int	plpgsql_yytoken;
+
+/* Token pushback stack */
+#define MAX_PUSHBACKS 4
+
+static int	num_pushbacks;
+static int	pushback_token[MAX_PUSHBACKS];
+static TokenAuxData pushback_auxdata[MAX_PUSHBACKS];
+
+/* State for plpgsql_location_to_lineno() */
+static const char *cur_line_start;
+static const char *cur_line_end;
+static int	cur_line_num;
+
+/* Internal functions */
+static int	internal_yylex(TokenAuxData *auxdata);
+static void push_back_token(int token, TokenAuxData *auxdata);
+static void location_lineno_init(void);
+
+
+/*
+ * This is the yylex routine called from the PL/pgSQL grammar.
+ * It is a wrapper around the core lexer, with the ability to recognize
+ * PL/pgSQL variables and return them as special T_DATUM tokens.  If a
+ * word or compound word does not match any variable name, or if matching
+ * is turned off by plpgsql_IdentifierLookup, it is returned as
+ * T_WORD or T_CWORD respectively, or as an unreserved keyword if it
+ * matches one of those.
+ */
+int
+plpgsql_yylex(void)
+{
+	int			tok1;
+	TokenAuxData aux1;
+	const ScanKeyword *kw;
+
+	tok1 = internal_yylex(&aux1);
+	if (tok1 == IDENT || tok1 == PARAM)
+	{
+		int			tok2;
+		TokenAuxData aux2;
+
+		tok2 = internal_yylex(&aux2);
+		if (tok2 == '.')
+		{
+			int			tok3;
+			TokenAuxData aux3;
+
+			tok3 = internal_yylex(&aux3);
+			if (tok3 == IDENT)
+			{
+				int			tok4;
+				TokenAuxData aux4;
+
+				tok4 = internal_yylex(&aux4);
+				if (tok4 == '.')
+				{
+					int			tok5;
+					TokenAuxData aux5;
+
+					tok5 = internal_yylex(&aux5);
+					if (tok5 == IDENT)
+					{
+						if (plpgsql_parse_tripword(aux1.lval.str,
+												   aux3.lval.str,
+												   aux5.lval.str,
+												   &aux1.lval.wdatum,
+												   &aux1.lval.cword))
+							tok1 = T_DATUM;
+						else
+							tok1 = T_CWORD;
+					}
+					else
+					{
+						/* not A.B.C, so just process A.B */
+						push_back_token(tok5, &aux5);
+						push_back_token(tok4, &aux4);
+						if (plpgsql_parse_dblword(aux1.lval.str,
+												  aux3.lval.str,
+												  &aux1.lval.wdatum,
+												  &aux1.lval.cword))
+							tok1 = T_DATUM;
+						else
+							tok1 = T_CWORD;
+					}
+				}
+				else
+				{
+					/* not A.B.C, so just process A.B */
+					push_back_token(tok4, &aux4);
+					if (plpgsql_parse_dblword(aux1.lval.str,
+											  aux3.lval.str,
+											  &aux1.lval.wdatum,
+											  &aux1.lval.cword))
+						tok1 = T_DATUM;
+					else
+						tok1 = T_CWORD;
+				}
+			}
+			else
+			{
+				/* not A.B, so just process A */
+				push_back_token(tok3, &aux3);
+				push_back_token(tok2, &aux2);
+				if (plpgsql_parse_word(aux1.lval.str,
+									   core_yy.scanbuf + aux1.lloc,
+									   &aux1.lval.wdatum,
+									   &aux1.lval.word))
+					tok1 = T_DATUM;
+				else if (!aux1.lval.word.quoted &&
+						 (kw = ScanKeywordLookup(aux1.lval.word.ident,
+												 unreserved_keywords,
+												 num_unreserved_keywords)))
+				{
+					aux1.lval.keyword = kw->name;
+					tok1 = kw->value;
+				}
+				else
+					tok1 = T_WORD;
+			}
+		}
+		else
+		{
+			/* not A.B, so just process A */
+			push_back_token(tok2, &aux2);
+
+			/*
+			 * If we are at start of statement, prefer unreserved keywords
+			 * over variable names, unless the next token is assignment or
+			 * '[', in which case prefer variable names.  (Note we need not
+			 * consider '.' as the next token; that case was handled above,
+			 * and we always prefer variable names in that case.)  If we are
+			 * not at start of statement, always prefer variable names over
+			 * unreserved keywords.
+			 */
+			if (AT_STMT_START(plpgsql_yytoken) &&
+				!(tok2 == '=' || tok2 == COLON_EQUALS || tok2 == '['))
+			{
+				/* try for unreserved keyword, then for variable name */
+				if (core_yy.scanbuf[aux1.lloc] != '"' &&
+					(kw = ScanKeywordLookup(aux1.lval.str,
+											unreserved_keywords,
+											num_unreserved_keywords)))
+				{
+					aux1.lval.keyword = kw->name;
+					tok1 = kw->value;
+				}
+				else if (plpgsql_parse_word(aux1.lval.str,
+											core_yy.scanbuf + aux1.lloc,
+											&aux1.lval.wdatum,
+											&aux1.lval.word))
+					tok1 = T_DATUM;
+				else
+					tok1 = T_WORD;
+			}
+			else
+			{
+				/* try for variable name, then for unreserved keyword */
+				if (plpgsql_parse_word(aux1.lval.str,
+									   core_yy.scanbuf + aux1.lloc,
+									   &aux1.lval.wdatum,
+									   &aux1.lval.word))
+					tok1 = T_DATUM;
+				else if (!aux1.lval.word.quoted &&
+						 (kw = ScanKeywordLookup(aux1.lval.word.ident,
+												 unreserved_keywords,
+												 num_unreserved_keywords)))
+				{
+					aux1.lval.keyword = kw->name;
+					tok1 = kw->value;
+				}
+				else
+					tok1 = T_WORD;
+			}
+		}
+	}
+	else
+	{
+		/*
+		 * Not a potential plpgsql variable name, just return the data.
+		 *
+		 * Note that we also come through here if the grammar pushed back a
+		 * T_DATUM, T_CWORD, T_WORD, or unreserved-keyword token returned by a
+		 * previous lookup cycle; thus, pushbacks do not incur extra lookup
+		 * work, since we'll never do the above code twice for the same token.
+		 * This property also makes it safe to rely on the old value of
+		 * plpgsql_yytoken in the is-this-start-of-statement test above.
+		 */
+	}
+
+	plpgsql_yylval = aux1.lval;
+	plpgsql_yylloc = aux1.lloc;
+	plpgsql_yyleng = aux1.leng;
+	plpgsql_yytoken = tok1;
+	return tok1;
+}
+
+/*
+ * Internal yylex function.  This wraps the core lexer and adds one feature:
+ * a token pushback stack.  We also make a couple of trivial single-token
+ * translations from what the core lexer does to what we want, in particular
+ * interfacing from the core_YYSTYPE to YYSTYPE union.
+ */
+static int
+internal_yylex(TokenAuxData *auxdata)
+{
+	int			token;
+	const char *yytext;
+
+	if (num_pushbacks > 0)
+	{
+		num_pushbacks--;
+		token = pushback_token[num_pushbacks];
+		*auxdata = pushback_auxdata[num_pushbacks];
+	}
+	else
+	{
+		token = core_yylex(&auxdata->lval.core_yystype,
+						   &auxdata->lloc,
+						   yyscanner);
+
+		/* remember the length of yytext before it gets changed */
+		yytext = core_yy.scanbuf + auxdata->lloc;
+		auxdata->leng = strlen(yytext);
+
+		/* Check for << >> and #, which the core considers operators */
+		if (token == Op)
+		{
+			if (strcmp(auxdata->lval.str, "<<") == 0)
+				token = LESS_LESS;
+			else if (strcmp(auxdata->lval.str, ">>") == 0)
+				token = GREATER_GREATER;
+			else if (strcmp(auxdata->lval.str, "#") == 0)
+				token = '#';
+		}
+
+		/* The core returns PARAM as ival, but we treat it like IDENT */
+		else if (token == PARAM)
+		{
+			auxdata->lval.str = pstrdup(yytext);
+		}
+	}
+
+	return token;
+}
+
+/*
+ * Push back a token to be re-read by next internal_yylex() call.
+ */
+static void
+push_back_token(int token, TokenAuxData *auxdata)
+{
+	if (num_pushbacks >= MAX_PUSHBACKS)
+		elog(ERROR, "too many tokens pushed back");
+	pushback_token[num_pushbacks] = token;
+	pushback_auxdata[num_pushbacks] = *auxdata;
+	num_pushbacks++;
+}
+
+/*
+ * Push back a single token to be re-read by next plpgsql_yylex() call.
+ *
+ * NOTE: this does not cause yylval or yylloc to "back up".  Also, it
+ * is not a good idea to push back a token code other than what you read.
+ */
+void
+plpgsql_push_back_token(int token)
+{
+	TokenAuxData auxdata;
+
+	auxdata.lval = plpgsql_yylval;
+	auxdata.lloc = plpgsql_yylloc;
+	auxdata.leng = plpgsql_yyleng;
+	push_back_token(token, &auxdata);
+}
+
+/*
+ * Tell whether a token is an unreserved keyword.
+ *
+ * (If it is, its lowercased form was returned as the token value, so we
+ * do not need to offer that data here.)
+ */
+bool
+plpgsql_token_is_unreserved_keyword(int token)
+{
+	int			i;
+
+	for (i = 0; i < num_unreserved_keywords; i++)
+	{
+		if (unreserved_keywords[i].value == token)
+			return true;
+	}
+	return false;
+}
+
+/*
+ * Append the function text starting at startlocation and extending to
+ * (not including) endlocation onto the existing contents of "buf".
+ */
+void
+plpgsql_append_source_text(StringInfo buf,
+						   int startlocation, int endlocation)
+{
+	Assert(startlocation <= endlocation);
+	appendBinaryStringInfo(buf, scanorig + startlocation,
+						   endlocation - startlocation);
+}
+
+/*
+ * Peek one token ahead in the input stream.  Only the token code is
+ * made available, not any of the auxiliary info such as location.
+ *
+ * NB: no variable or unreserved keyword lookup is performed here, they will
+ * be returned as IDENT. Reserved keywords are resolved as usual.
+ */
+int
+plpgsql_peek(void)
+{
+	int			tok1;
+	TokenAuxData aux1;
+
+	tok1 = internal_yylex(&aux1);
+	push_back_token(tok1, &aux1);
+	return tok1;
+}
+
+/*
+ * Peek two tokens ahead in the input stream. The first token and its
+ * location in the query are returned in *tok1_p and *tok1_loc, second token
+ * and its location in *tok2_p and *tok2_loc.
+ *
+ * NB: no variable or unreserved keyword lookup is performed here, they will
+ * be returned as IDENT. Reserved keywords are resolved as usual.
+ */
+void
+plpgsql_peek2(int *tok1_p, int *tok2_p, int *tok1_loc, int *tok2_loc)
+{
+	int			tok1,
+				tok2;
+	TokenAuxData aux1,
+				aux2;
+
+	tok1 = internal_yylex(&aux1);
+	tok2 = internal_yylex(&aux2);
+
+	*tok1_p = tok1;
+	if (tok1_loc)
+		*tok1_loc = aux1.lloc;
+	*tok2_p = tok2;
+	if (tok2_loc)
+		*tok2_loc = aux2.lloc;
+
+	push_back_token(tok2, &aux2);
+	push_back_token(tok1, &aux1);
+}
+
+/*
+ * plpgsql_scanner_errposition
+ *		Report an error cursor position, if possible.
+ *
+ * This is expected to be used within an ereport() call.  The return value
+ * is a dummy (always 0, in fact).
+ *
+ * Note that this can only be used for messages emitted during initial
+ * parsing of a plpgsql function, since it requires the scanorig string
+ * to still be available.
+ */
+int
+plpgsql_scanner_errposition(int location)
+{
+	int			pos;
+
+	if (location < 0 || scanorig == NULL)
+		return 0;				/* no-op if location is unknown */
+
+	/* Convert byte offset to character number */
+	pos = pg_mbstrlen_with_len(scanorig, location) + 1;
+	/* And pass it to the ereport mechanism */
+	(void) internalerrposition(pos);
+	/* Also pass the function body string */
+	return internalerrquery(scanorig);
+}
+
+/*
+ * plpgsql_yyerror
+ *		Report a lexer or grammar error.
+ *
+ * The message's cursor position refers to the current token (the one
+ * last returned by plpgsql_yylex()).
+ * This is OK for syntax error messages from the Bison parser, because Bison
+ * parsers report error as soon as the first unparsable token is reached.
+ * Beware of using yyerror for other purposes, as the cursor position might
+ * be misleading!
+ */
+void
+plpgsql_yyerror(const char *message)
+{
+	char	   *yytext = core_yy.scanbuf + plpgsql_yylloc;
+
+	if (*yytext == '\0')
+	{
+		ereport(ERROR,
+				(errcode(ERRCODE_SYNTAX_ERROR),
+		/* translator: %s is typically the translation of "syntax error" */
+				 errmsg("%s at end of input", _(message)),
+				 plpgsql_scanner_errposition(plpgsql_yylloc)));
+	}
+	else
+	{
+		/*
+		 * If we have done any lookahead then flex will have restored the
+		 * character after the end-of-token.  Zap it again so that we report
+		 * only the single token here.  This modifies scanbuf but we no longer
+		 * care about that.
+		 */
+		yytext[plpgsql_yyleng] = '\0';
+
+		ereport(ERROR,
+				(errcode(ERRCODE_SYNTAX_ERROR),
+		/* translator: first %s is typically the translation of "syntax error" */
+				 errmsg("%s at or near \"%s\"", _(message), yytext),
+				 plpgsql_scanner_errposition(plpgsql_yylloc)));
+	}
+}
+
+/*
+ * Given a location (a byte offset in the function source text),
+ * return a line number.
+ *
+ * We expect that this is typically called for a sequence of increasing
+ * location values, so optimize accordingly by tracking the endpoints
+ * of the "current" line.
+ */
+int
+plpgsql_location_to_lineno(int location)
+{
+	const char *loc;
+
+	if (location < 0 || scanorig == NULL)
+		return 0;				/* garbage in, garbage out */
+	loc = scanorig + location;
+
+	/* be correct, but not fast, if input location goes backwards */
+	if (loc < cur_line_start)
+		location_lineno_init();
+
+	while (cur_line_end != NULL && loc > cur_line_end)
+	{
+		cur_line_start = cur_line_end + 1;
+		cur_line_num++;
+		cur_line_end = strchr(cur_line_start, '\n');
+	}
+
+	return cur_line_num;
+}
+
+/* initialize or reset the state for plpgsql_location_to_lineno */
+static void
+location_lineno_init(void)
+{
+	cur_line_start = scanorig;
+	cur_line_num = 1;
+
+	cur_line_end = strchr(cur_line_start, '\n');
+}
+
+/* return the most recently computed lineno */
+int
+plpgsql_latest_lineno(void)
+{
+	return cur_line_num;
+}
+
+
+/*
+ * Called before any actual parsing is done
+ *
+ * Note: the passed "str" must remain valid until plpgsql_scanner_finish().
+ * Although it is not fed directly to flex, we need the original string
+ * to cite in error messages.
+ */
+void
+plpgsql_scanner_init(const char *str)
+{
+	/* Start up the core scanner */
+	yyscanner = scanner_init(str, &core_yy,
+							 reserved_keywords, num_reserved_keywords);
+
+	/*
+	 * scanorig points to the original string, which unlike the scanner's
+	 * scanbuf won't be modified on-the-fly by flex.  Notice that although
+	 * yytext points into scanbuf, we rely on being able to apply locations
+	 * (offsets from string start) to scanorig as well.
+	 */
+	scanorig = str;
+
+	/* Other setup */
+	plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_NORMAL;
+	plpgsql_yytoken = 0;
+
+	num_pushbacks = 0;
+
+	location_lineno_init();
+}
+
+/*
+ * Called after parsing is done to clean up after plpgsql_scanner_init()
+ */
+void
+plpgsql_scanner_finish(void)
+{
+	/* release storage */
+	scanner_finish(yyscanner);
+	/* avoid leaving any dangling pointers */
+	yyscanner = NULL;
+	scanorig = NULL;
+}
diff --git a/foreign/libpg_query/src/postgres/src_port_qsort.c b/foreign/libpg_query/src/postgres/src_port_qsort.c
new file mode 100644
--- /dev/null
+++ b/foreign/libpg_query/src/postgres/src_port_qsort.c
@@ -0,0 +1,240 @@
+/*--------------------------------------------------------------------
+ * Symbols referenced in this file:
+ * - pg_qsort
+ * - pg_qsort
+ * - swapfunc
+ * - med3
+ *--------------------------------------------------------------------
+ */
+
+/*
+ *	qsort.c: standard quicksort algorithm
+ *
+ *	Modifications from vanilla NetBSD source:
+ *	  Add do ... while() macro fix
+ *	  Remove __inline, _DIAGASSERTs, __P
+ *	  Remove ill-considered "swap_cnt" switch to insertion sort,
+ *	  in favor of a simple check for presorted input.
+ *	  Take care to recurse on the smaller partition, to bound stack usage.
+ *
+ *	CAUTION: if you change this file, see also qsort_arg.c, gen_qsort_tuple.pl
+ *
+ *	src/port/qsort.c
+ */
+
+/*	$NetBSD: qsort.c,v 1.13 2003/08/07 16:43:42 agc Exp $	*/
+
+/*-
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *	  notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *	  notice, this list of conditions and the following disclaimer in the
+ *	  documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *	  may be used to endorse or promote products derived from this software
+ *	  without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "c.h"
+
+
+static char *med3(char *a, char *b, char *c,
+	 int (*cmp) (const void *, const void *));
+static void swapfunc(char *, char *, size_t, int);
+
+/*
+ * Qsort routine based on J. L. Bentley and M. D. McIlroy,
+ * "Engineering a sort function",
+ * Software--Practice and Experience 23 (1993) 1249-1265.
+ *
+ * We have modified their original by adding a check for already-sorted input,
+ * which seems to be a win per discussions on pgsql-hackers around 2006-03-21.
+ *
+ * Also, we recurse on the smaller partition and iterate on the larger one,
+ * which ensures we cannot recurse more than log(N) levels (since the
+ * partition recursed to is surely no more than half of the input).  Bentley
+ * and McIlroy explicitly rejected doing this on the grounds that it's "not
+ * worth the effort", but we have seen crashes in the field due to stack
+ * overrun, so that judgment seems wrong.
+ */
+
+#define swapcode(TYPE, parmi, parmj, n) \
+do {		\
+	size_t i = (n) / sizeof (TYPE);			\
+	TYPE *pi = (TYPE *)(void *)(parmi);			\
+	TYPE *pj = (TYPE *)(void *)(parmj);			\
+	do {						\
+		TYPE	t = *pi;			\
+		*pi++ = *pj;				\
+		*pj++ = t;				\
+		} while (--i > 0);				\
+} while (0)
+
+#define SWAPINIT(a, es) swaptype = ((char *)(a) - (char *)0) % sizeof(long) || \
+	(es) % sizeof(long) ? 2 : (es) == sizeof(long)? 0 : 1;
+
+static void
+swapfunc(char *a, char *b, size_t n, int swaptype)
+{
+	if (swaptype <= 1)
+		swapcode(long, a, b, n);
+	else
+		swapcode(char, a, b, n);
+}
+
+#define swap(a, b)						\
+	if (swaptype == 0) {					\
+		long t = *(long *)(void *)(a);			\
+		*(long *)(void *)(a) = *(long *)(void *)(b);	\
+		*(long *)(void *)(b) = t;			\
+	} else							\
+		swapfunc(a, b, es, swaptype)
+
+#define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype)
+
+static char *
+med3(char *a, char *b, char *c, int (*cmp) (const void *, const void *))
+{
+	return cmp(a, b) < 0 ?
+		(cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a))
+		: (cmp(b, c) > 0 ? b : (cmp(a, c) < 0 ? a : c));
+}
+
+void
+pg_qsort(void *a, size_t n, size_t es, int (*cmp) (const void *, const void *))
+{
+	char	   *pa,
+			   *pb,
+			   *pc,
+			   *pd,
+			   *pl,
+			   *pm,
+			   *pn;
+	size_t		d1,
+				d2;
+	int			r,
+				swaptype,
+				presorted;
+
+loop:SWAPINIT(a, es);
+	if (n < 7)
+	{
+		for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es)
+			for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
+				 pl -= es)
+				swap(pl, pl - es);
+		return;
+	}
+	presorted = 1;
+	for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es)
+	{
+		if (cmp(pm - es, pm) > 0)
+		{
+			presorted = 0;
+			break;
+		}
+	}
+	if (presorted)
+		return;
+	pm = (char *) a + (n / 2) * es;
+	if (n > 7)
+	{
+		pl = (char *) a;
+		pn = (char *) a + (n - 1) * es;
+		if (n > 40)
+		{
+			size_t		d = (n / 8) * es;
+
+			pl = med3(pl, pl + d, pl + 2 * d, cmp);
+			pm = med3(pm - d, pm, pm + d, cmp);
+			pn = med3(pn - 2 * d, pn - d, pn, cmp);
+		}
+		pm = med3(pl, pm, pn, cmp);
+	}
+	swap(a, pm);
+	pa = pb = (char *) a + es;
+	pc = pd = (char *) a + (n - 1) * es;
+	for (;;)
+	{
+		while (pb <= pc && (r = cmp(pb, a)) <= 0)
+		{
+			if (r == 0)
+			{
+				swap(pa, pb);
+				pa += es;
+			}
+			pb += es;
+		}
+		while (pb <= pc && (r = cmp(pc, a)) >= 0)
+		{
+			if (r == 0)
+			{
+				swap(pc, pd);
+				pd -= es;
+			}
+			pc -= es;
+		}
+		if (pb > pc)
+			break;
+		swap(pb, pc);
+		pb += es;
+		pc -= es;
+	}
+	pn = (char *) a + n * es;
+	d1 = Min(pa - (char *) a, pb - pa);
+	vecswap(a, pb - d1, d1);
+	d1 = Min(pd - pc, pn - pd - es);
+	vecswap(pb, pn - d1, d1);
+	d1 = pb - pa;
+	d2 = pd - pc;
+	if (d1 <= d2)
+	{
+		/* Recurse on left partition, then iterate on right partition */
+		if (d1 > es)
+			pg_qsort(a, d1 / es, es, cmp);
+		if (d2 > es)
+		{
+			/* Iterate rather than recurse to save stack space */
+			/* pg_qsort(pn - d2, d2 / es, es, cmp); */
+			a = pn - d2;
+			n = d2 / es;
+			goto loop;
+		}
+	}
+	else
+	{
+		/* Recurse on right partition, then iterate on left partition */
+		if (d2 > es)
+			pg_qsort(pn - d2, d2 / es, es, cmp);
+		if (d1 > es)
+		{
+			/* Iterate rather than recurse to save stack space */
+			/* pg_qsort(a, d1 / es, es, cmp); */
+			n = d1 / es;
+			goto loop;
+		}
+	}
+}
+
+/*
+ * qsort comparator wrapper for strcmp.
+ */
+
diff --git a/library/PostgreSQL/Syntax.hs b/library/PostgreSQL/Syntax.hs
new file mode 100644
--- /dev/null
+++ b/library/PostgreSQL/Syntax.hs
@@ -0,0 +1,30 @@
+module PostgreSQL.Syntax
+where
+
+import PostgreSQL.Syntax.Prelude
+import qualified PostgreSQL.Syntax.Foreign as A
+import qualified PostgreSQL.Syntax.Pointers as B
+import qualified Data.ByteString.Unsafe as C
+import qualified Data.ByteString.Internal as D
+import qualified Data.Text.Encoding as E
+
+
+-- |
+-- Find an error in the SQL string.
+-- 
+-- The string is allowed to contain placeholders.
+validate :: ByteString -> Maybe Text 
+validate sql =
+  unsafeDupablePerformIO $ do
+    statusRef <- newIORef 1
+    messageBytes <- 
+      C.unsafeUseAsCString sql $ \sqlPtr -> D.createAndTrim 1000 $ \messagePtr -> do
+        status <- A.validate sqlPtr (castPtr messagePtr)
+        writeIORef statusRef status
+        case status of
+          0 -> return 0
+          1 -> fmap fromIntegral (D.c_strlen (castPtr messagePtr))
+    status <- readIORef statusRef
+    case status of
+      0 -> return Nothing
+      1 -> return (Just (E.decodeUtf8 messageBytes))
diff --git a/library/PostgreSQL/Syntax/Foreign.hs b/library/PostgreSQL/Syntax/Foreign.hs
new file mode 100644
--- /dev/null
+++ b/library/PostgreSQL/Syntax/Foreign.hs
@@ -0,0 +1,9 @@
+module PostgreSQL.Syntax.Foreign
+where
+
+
+import PostgreSQL.Syntax.Prelude
+
+
+foreign import ccall unsafe "validate"
+  validate :: Ptr CChar -> Ptr CChar -> IO CInt
diff --git a/library/PostgreSQL/Syntax/Pointers.hs b/library/PostgreSQL/Syntax/Pointers.hs
new file mode 100644
--- /dev/null
+++ b/library/PostgreSQL/Syntax/Pointers.hs
@@ -0,0 +1,22 @@
+module PostgreSQL.Syntax.Pointers
+where
+
+import PostgreSQL.Syntax.Prelude
+import qualified Data.ByteString.Short as B
+import qualified Data.ByteString.Short.Internal as A
+import qualified Data.ByteString.Unsafe as C
+import qualified Data.ByteString.Internal as D
+
+
+{-# INLINE withModifyingPtrOfBytes #-}
+withModifyingPtrOfBytes :: ByteString -> (Ptr Word8 -> IO a) -> IO a
+withModifyingPtrOfBytes bytes ptrAction =
+  C.unsafeUseAsCString bytes (ptrAction . (castPtr :: Ptr CChar -> Ptr Word8))
+
+{-# INLINE createBytesAndMap #-}
+createBytesAndMap :: Int -> (Ptr Word8 -> IO (ByteString -> a)) -> IO a
+createBytesAndMap l f =
+  do
+    fp <- D.mallocByteString l
+    postprocess <- withForeignPtr fp $ \p -> f p
+    return $! postprocess $! D.PS fp 0 l
diff --git a/library/PostgreSQL/Syntax/Prelude.hs b/library/PostgreSQL/Syntax/Prelude.hs
new file mode 100644
--- /dev/null
+++ b/library/PostgreSQL/Syntax/Prelude.hs
@@ -0,0 +1,26 @@
+module PostgreSQL.Syntax.Prelude
+( 
+  module Exports,
+)
+where
+
+
+-- base-prelude
+-------------------------
+import BasePrelude as Exports
+
+-- base
+-------------------------
+import Foreign.C as Exports
+import Foreign.Ptr as Exports
+import Foreign.ForeignPtr as Exports
+import Foreign.Marshal.Alloc as Exports
+import Foreign.Storable as Exports
+
+-- bytestring
+-------------------------
+import Data.ByteString as Exports (ByteString)
+
+-- text
+-------------------------
+import Data.Text as Exports (Text)
diff --git a/postgresql-syntax.cabal b/postgresql-syntax.cabal
new file mode 100644
--- /dev/null
+++ b/postgresql-syntax.cabal
@@ -0,0 +1,128 @@
+name:
+  postgresql-syntax
+version:
+  0.1
+category:
+  Database, PostgreSQL
+synopsis:
+  PostgreSQL SQL syntax utilities
+description:
+  Currently this library only provides an SQL syntax validator.
+  .
+  This library wraps the \"libpq_query\" C library,
+  which is an SQL parser based on the source code of the Postgres server.
+  IOW, it uses the same parser as Postgres itself
+  and hence supports all of its syntax.
+  .
+  So far this package has only been tested to work on the *nix systems (Mac OS including).
+homepage:
+  https://github.com/nikita-volkov/postgresql-syntax
+bug-reports:
+  https://github.com/nikita-volkov/postgresql-syntax/issues
+author:
+  Nikita Volkov <nikita.y.volkov@mail.ru>
+maintainer:
+  Nikita Volkov <nikita.y.volkov@mail.ru>
+copyright:
+  (c) 2017, Nikita Volkov
+license:
+  MIT
+license-file:
+  LICENSE
+build-type:
+  Custom
+extra-source-files:
+  foreign/ffi/*.c
+  foreign/libpg_query/LICENSE
+  foreign/libpg_query/Makefile
+  foreign/libpg_query/src/*.c
+  foreign/libpg_query/src/postgres/*.c
+  foreign/libpg_query/*.h
+  foreign/libpg_query/src/*.h
+  foreign/libpg_query/src/postgres/include/*.h
+  foreign/libpg_query/src/postgres/include/access/*.h
+  foreign/libpg_query/src/postgres/include/bootstrap/*.h
+  foreign/libpg_query/src/postgres/include/catalog/*.h
+  foreign/libpg_query/src/postgres/include/commands/*.h
+  foreign/libpg_query/src/postgres/include/common/*.h
+  foreign/libpg_query/src/postgres/include/datatype/*.h
+  foreign/libpg_query/src/postgres/include/executor/*.h
+  foreign/libpg_query/src/postgres/include/lib/*.h
+  foreign/libpg_query/src/postgres/include/libpq/*.h
+  foreign/libpg_query/src/postgres/include/mb/*.h
+  foreign/libpg_query/src/postgres/include/nodes/*.h
+  foreign/libpg_query/src/postgres/include/optimizer/*.h
+  foreign/libpg_query/src/postgres/include/parser/*.h
+  foreign/libpg_query/src/postgres/include/port/atomics/*.h
+  foreign/libpg_query/src/postgres/include/port/*.h
+  foreign/libpg_query/src/postgres/include/port/*.h
+  foreign/libpg_query/src/postgres/include/portability/*.h
+  foreign/libpg_query/src/postgres/include/postmaster/*.h
+  foreign/libpg_query/src/postgres/include/regex/*.h
+  foreign/libpg_query/src/postgres/include/replication/*.h
+  foreign/libpg_query/src/postgres/include/rewrite/*.h
+  foreign/libpg_query/src/postgres/include/storage/*.h
+  foreign/libpg_query/src/postgres/include/tcop/*.h
+  foreign/libpg_query/src/postgres/include/tsearch/*.h
+  foreign/libpg_query/src/postgres/include/utils/*.h
+cabal-version:
+  >=1.10
+
+source-repository head
+  type:
+    git
+  location:
+    git://github.com/nikita-volkov/postgresql-syntax.git
+
+library
+  hs-source-dirs:
+    library
+  exposed-modules:
+    PostgreSQL.Syntax
+  other-modules:
+    PostgreSQL.Syntax.Pointers
+    PostgreSQL.Syntax.Foreign
+    PostgreSQL.Syntax.Prelude
+  c-sources:
+    foreign/ffi/validation.c
+  include-dirs:
+    foreign/libpg_query
+  includes:
+    pg_query.h
+  extra-libraries:
+    pg_query
+  default-extensions:
+    Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples
+  default-language:
+    Haskell2010
+  build-depends:
+    -- 
+    text >= 1 && < 2,
+    bytestring >= 0.10.8 && < 0.11,
+    --
+    base-prelude < 2,
+    base < 5
+
+test-suite demo
+  type:
+    exitcode-stdio-1.0
+  hs-source-dirs:
+    demo
+  main-is:
+    Main.hs
+  ghc-options:
+    -O2
+    -threaded
+    "-with-rtsopts=-N"
+  ghc-prof-options:
+    -O2
+    -threaded
+    -fprof-auto
+    "-with-rtsopts=-N -p -s -h -i0.1"
+  default-extensions:
+    Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples
+  default-language:
+    Haskell2010
+  build-depends:
+    postgresql-syntax,
+    rerebase == 1.*
