From 855efb94214cc519805de89934d82bc5e0f92685 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 28 Nov 2023 18:29:18 +0300 Subject: Release version 14.1.0+2 Add psql package. Don't compile port/strlcpy.c on Linux if GNU libc is 2.38 or newer. Switch to using -pthread instead of -D_REENTRANT/-lpthread in buildfiles and bump build2 version requirement to 0.15.0. --- README-DEV | 63 +- TODO | 5 +- libpq/.gitignore | 1 + libpq/README-DEV | 23 +- libpq/build/export.build | 2 +- libpq/libpq/buildfile | 21 +- libpq/libpq/pg_config.h | 93 +- libpq/libpq/strlcpy.c | 6 + libpq/manifest | 8 +- packages.manifest | 2 + psql/.gitignore | 26 + psql/COPYRIGHT | 1 + psql/INSTALL | 7 + psql/README | 21 + psql/README-DEV | 68 + psql/build/.gitignore | 3 + psql/build/bootstrap.build | 10 + psql/build/export.build | 9 + psql/build/root.build | 22 + psql/buildfile | 9 + psql/manifest | 26 + psql/psql/.gitignore | 1 + psql/psql/buildfile | 208 + psql/psql/downstream/catalog/pg_am_d.h | 45 + psql/psql/downstream/catalog/pg_attribute_d.h | 60 + psql/psql/downstream/catalog/pg_cast_d.h | 62 + psql/psql/downstream/catalog/pg_class_d.h | 103 + psql/psql/downstream/catalog/pg_default_acl_d.h | 44 + psql/psql/downstream/catalog/pg_type_d.h | 321 ++ psql/psql/downstream/kwlist_d.h | 1088 ++++ psql/psql/downstream/libpq/.gitignore | 3 + psql/psql/downstream/libpq/version.h.in | 19 + psql/psql/downstream/pg_config.h | 1 + psql/psql/downstream/pg_config_os.h | 1 + psql/psql/downstream/pg_config_paths.h | 1 + psql/psql/downstream/psqlscan.c | 5054 +++++++++++++++++++ psql/psql/downstream/psqlscan.l | 1 + psql/psql/downstream/psqlscanslash.c | 3484 +++++++++++++ psql/psql/downstream/psqlscanslash.l | 1 + psql/psql/downstream/sql_help.c | 6060 +++++++++++++++++++++++ psql/psql/downstream/sql_help.h | 30 + psql/psql/downstream/strlcat.c | 6 + psql/psql/downstream/strlcpy.c | 6 + psql/psql/include/.gitattributes | 1 + psql/psql/include/c.h | 1 + psql/psql/include/catalog/genbki.h | 1 + psql/psql/include/catalog/pg_am.h | 1 + psql/psql/include/common | 1 + psql/psql/include/fe_utils/cancel.h | 1 + psql/psql/include/fe_utils/conditional.h | 1 + psql/psql/include/fe_utils/mbprint.h | 1 + psql/psql/include/fe_utils/print.h | 1 + psql/psql/include/fe_utils/psqlscan.h | 1 + psql/psql/include/fe_utils/psqlscan_int.h | 1 + psql/psql/include/fe_utils/string_utils.h | 1 + psql/psql/include/getopt_long.h | 1 + psql/psql/include/lib/sort_template.h | 1 + psql/psql/include/lib/stringinfo.h | 1 + psql/psql/include/libpq/pqcomm.h | 1 + psql/psql/include/mb/pg_wchar.h | 1 + psql/psql/include/parser/kwlist.h | 1 + psql/psql/include/pg_config_manual.h | 1 + psql/psql/include/pg_getopt.h | 1 + psql/psql/include/port.h | 1 + psql/psql/include/port/.gitattributes | 2 + psql/psql/include/port/darwin.h | 1 + psql/psql/include/port/freebsd.h | 1 + psql/psql/include/port/linux.h | 1 + psql/psql/include/port/win32 | 1 + psql/psql/include/port/win32.h | 1 + psql/psql/include/port/win32_msvc | 1 + psql/psql/include/portability/instr_time.h | 1 + psql/psql/include/postgres_fe.h | 1 + psql/psql/include/pqexpbuffer.h | 1 + psql/psql/src/.gitattributes | 1 + psql/psql/src/common/exec.c | 1 + psql/psql/src/common/fe_memutils.c | 1 + psql/psql/src/common/keywords.c | 1 + psql/psql/src/common/kwlookup.c | 1 + psql/psql/src/common/logging.c | 1 + psql/psql/src/common/pg_get_line.c | 1 + psql/psql/src/common/psprintf.c | 1 + psql/psql/src/common/sprompt.c | 1 + psql/psql/src/common/string.c | 1 + psql/psql/src/common/stringinfo.c | 1 + psql/psql/src/common/username.c | 1 + psql/psql/src/common/wait_error.c | 1 + psql/psql/src/fe_utils/cancel.c | 1 + psql/psql/src/fe_utils/conditional.c | 1 + psql/psql/src/fe_utils/mbprint.c | 1 + psql/psql/src/fe_utils/print.c | 1 + psql/psql/src/fe_utils/string_utils.c | 1 + psql/psql/src/port/getopt.c | 1 + psql/psql/src/port/getopt_long.c | 1 + psql/psql/src/port/open.c | 1 + psql/psql/src/port/path.c | 1 + psql/psql/src/port/pgsleep.c | 1 + psql/psql/src/port/pgstrcasecmp.c | 1 + psql/psql/src/port/pgstrsignal.c | 1 + psql/psql/src/port/qsort.c | 1 + psql/psql/src/port/snprintf.c | 1 + psql/psql/src/port/strerror.c | 1 + psql/psql/src/port/strlcat.c | 1 + psql/psql/src/port/strlcpy.c | 1 + psql/psql/src/port/system.c | 1 + psql/psql/src/port/thread.c | 1 + psql/psql/src/port/win32env.c | 1 + psql/psql/src/port/win32error.c | 1 + psql/psql/src/port/win32setlocale.c | 1 + psql/psql/src/port/win32stat.c | 1 + psql/psql/src/psql | 1 + psql/tests/.gitignore | 4 + psql/tests/build/.gitignore | 3 + psql/tests/build/bootstrap.build | 8 + psql/tests/build/root.build | 15 + psql/tests/buildfile | 4 + psql/tests/help.testscript | 12 + psql/tests/version.testscript | 8 + 118 files changed, 17083 insertions(+), 65 deletions(-) create mode 100644 libpq/libpq/strlcpy.c create mode 100644 psql/.gitignore create mode 120000 psql/COPYRIGHT create mode 100644 psql/INSTALL create mode 100644 psql/README create mode 100644 psql/README-DEV create mode 100644 psql/build/.gitignore create mode 100644 psql/build/bootstrap.build create mode 100644 psql/build/export.build create mode 100644 psql/build/root.build create mode 100644 psql/buildfile create mode 100644 psql/manifest create mode 100644 psql/psql/.gitignore create mode 100644 psql/psql/buildfile create mode 100644 psql/psql/downstream/catalog/pg_am_d.h create mode 100644 psql/psql/downstream/catalog/pg_attribute_d.h create mode 100644 psql/psql/downstream/catalog/pg_cast_d.h create mode 100644 psql/psql/downstream/catalog/pg_class_d.h create mode 100644 psql/psql/downstream/catalog/pg_default_acl_d.h create mode 100644 psql/psql/downstream/catalog/pg_type_d.h create mode 100644 psql/psql/downstream/kwlist_d.h create mode 100644 psql/psql/downstream/libpq/.gitignore create mode 100644 psql/psql/downstream/libpq/version.h.in create mode 120000 psql/psql/downstream/pg_config.h create mode 120000 psql/psql/downstream/pg_config_os.h create mode 120000 psql/psql/downstream/pg_config_paths.h create mode 100644 psql/psql/downstream/psqlscan.c create mode 120000 psql/psql/downstream/psqlscan.l create mode 100644 psql/psql/downstream/psqlscanslash.c create mode 120000 psql/psql/downstream/psqlscanslash.l create mode 100644 psql/psql/downstream/sql_help.c create mode 100644 psql/psql/downstream/sql_help.h create mode 100644 psql/psql/downstream/strlcat.c create mode 100644 psql/psql/downstream/strlcpy.c create mode 100644 psql/psql/include/.gitattributes create mode 120000 psql/psql/include/c.h create mode 120000 psql/psql/include/catalog/genbki.h create mode 120000 psql/psql/include/catalog/pg_am.h create mode 120000 psql/psql/include/common create mode 120000 psql/psql/include/fe_utils/cancel.h create mode 120000 psql/psql/include/fe_utils/conditional.h create mode 120000 psql/psql/include/fe_utils/mbprint.h create mode 120000 psql/psql/include/fe_utils/print.h create mode 120000 psql/psql/include/fe_utils/psqlscan.h create mode 120000 psql/psql/include/fe_utils/psqlscan_int.h create mode 120000 psql/psql/include/fe_utils/string_utils.h create mode 120000 psql/psql/include/getopt_long.h create mode 120000 psql/psql/include/lib/sort_template.h create mode 120000 psql/psql/include/lib/stringinfo.h create mode 120000 psql/psql/include/libpq/pqcomm.h create mode 120000 psql/psql/include/mb/pg_wchar.h create mode 120000 psql/psql/include/parser/kwlist.h create mode 120000 psql/psql/include/pg_config_manual.h create mode 120000 psql/psql/include/pg_getopt.h create mode 120000 psql/psql/include/port.h create mode 100644 psql/psql/include/port/.gitattributes create mode 120000 psql/psql/include/port/darwin.h create mode 120000 psql/psql/include/port/freebsd.h create mode 120000 psql/psql/include/port/linux.h create mode 120000 psql/psql/include/port/win32 create mode 120000 psql/psql/include/port/win32.h create mode 120000 psql/psql/include/port/win32_msvc create mode 120000 psql/psql/include/portability/instr_time.h create mode 120000 psql/psql/include/postgres_fe.h create mode 120000 psql/psql/include/pqexpbuffer.h create mode 100644 psql/psql/src/.gitattributes create mode 120000 psql/psql/src/common/exec.c create mode 120000 psql/psql/src/common/fe_memutils.c create mode 120000 psql/psql/src/common/keywords.c create mode 120000 psql/psql/src/common/kwlookup.c create mode 120000 psql/psql/src/common/logging.c create mode 120000 psql/psql/src/common/pg_get_line.c create mode 120000 psql/psql/src/common/psprintf.c create mode 120000 psql/psql/src/common/sprompt.c create mode 120000 psql/psql/src/common/string.c create mode 120000 psql/psql/src/common/stringinfo.c create mode 120000 psql/psql/src/common/username.c create mode 120000 psql/psql/src/common/wait_error.c create mode 120000 psql/psql/src/fe_utils/cancel.c create mode 120000 psql/psql/src/fe_utils/conditional.c create mode 120000 psql/psql/src/fe_utils/mbprint.c create mode 120000 psql/psql/src/fe_utils/print.c create mode 120000 psql/psql/src/fe_utils/string_utils.c create mode 120000 psql/psql/src/port/getopt.c create mode 120000 psql/psql/src/port/getopt_long.c create mode 120000 psql/psql/src/port/open.c create mode 120000 psql/psql/src/port/path.c create mode 120000 psql/psql/src/port/pgsleep.c create mode 120000 psql/psql/src/port/pgstrcasecmp.c create mode 120000 psql/psql/src/port/pgstrsignal.c create mode 120000 psql/psql/src/port/qsort.c create mode 120000 psql/psql/src/port/snprintf.c create mode 120000 psql/psql/src/port/strerror.c create mode 120000 psql/psql/src/port/strlcat.c create mode 120000 psql/psql/src/port/strlcpy.c create mode 120000 psql/psql/src/port/system.c create mode 120000 psql/psql/src/port/thread.c create mode 120000 psql/psql/src/port/win32env.c create mode 120000 psql/psql/src/port/win32error.c create mode 120000 psql/psql/src/port/win32setlocale.c create mode 120000 psql/psql/src/port/win32stat.c create mode 120000 psql/psql/src/psql create mode 100644 psql/tests/.gitignore create mode 100644 psql/tests/build/.gitignore create mode 100644 psql/tests/build/bootstrap.build create mode 100644 psql/tests/build/root.build create mode 100644 psql/tests/buildfile create mode 100644 psql/tests/help.testscript create mode 100644 psql/tests/version.testscript diff --git a/README-DEV b/README-DEV index 74a3411..bdfe58a 100644 --- a/README-DEV +++ b/README-DEV @@ -3,8 +3,8 @@ build2. In particular, this understanding will be useful when upgrading to a new upstream version. The upstream package contains the PostgreSQL server, libpq library, and client -utilities. Currently, we only package libpq (see libpq/README-DEV for -details). +utilities. Currently, we only package libpq and psql (see the respective +README-DEV files for details). We add the upstream package as a git submodule and symlink the required files and subdirectories into the build2 package subdirectories. Then, when required, @@ -25,24 +25,28 @@ upstream/ subdirectory. The upstream package can be configured to contain a specific feature set. We reproduce the union of features configured for the upstream source package in Debian and Fedora distributions. The configuration options defining these sets -are specified in the Debian's rules and Fedora's RPM .spec files. Note, that -at the time of this writing the latest packaged versions are different (14.0 -on Debian and 13.4 on Fedora). That's probably ok since 14.0 only introduces -the --with-lz4 configuration options comparing to 13.4. These files can be -obtained as follows: +are specified in the Debian's rules and Fedora's RPM .spec files. These files +can be obtained as follows: $ wget http://deb.debian.org/debian/pool/main/p/postgresql-14/postgresql-14_14.0-1.debian.tar.xz $ tar xf postgresql-14_14.0-1.debian.tar.xz -$ wget https://kojipkgs.fedoraproject.org//packages/libpq/13.4/2.fc36/src/libpq-13.4-2.fc36.src.rpm -$ rpm2cpio libpq-13.4-2.fc36.src.rpm | cpio -civ '*.spec' +$ wget https://kojipkgs.fedoraproject.org/packages/libpq/14.1/2.fc36/src/libpq-14.1-2.fc36.src.rpm +$ rpm2cpio libpq-14.1-2.fc36.src.rpm | cpio -civ '*.spec' -As a side note, on Debian and Fedora the source, library, and headers are -packaged as follows: +$ wget https://kojipkgs.fedoraproject.org/packages/postgresql/14.1/3.fc36/src/postgresql-14.1-3.fc36.src.rpm +$ rpm2cpio postgresql-14.1-3.fc36.src.rpm | cpio -civ '*.spec' - src libpq headers -Debian/Ubuntu: postgresql-14 libpq5 libpq-dev +Note that on Fedora libpq and psql are build from the separate source RPM +packages and so by using the different RPM specs. + +As a side note, on Debian and Fedora the source, library, headers, and program +are packaged as follows: + + src libpq headers psql +Debian/Ubuntu: postgresql-11 libpq5 libpq-dev postgresql-client-11 Fedora/RHEL: libpq libpq libpq-devel + postgresql postgresql Search for the Debian and Fedora packages at https://packages.debian.org/search and https://src.fedoraproject.org/. @@ -57,21 +61,29 @@ Debian: Fedora: - --with-ldap --with-openssl --with-gssapi --enable-nls --without-readline + libpq: --with-ldap --with-openssl --with-gssapi --enable-nls + --without-readline + + postgresql: --disable-rpath --with-tcl --with-ldap --with-openssl --with-pam + --with-gssapi --with-ossp-uuid --with-libxml --with-libxslt + --enable-nls --enable-dtrace --with-selinux --with-system-tzdata + --datadir --with-systemd --with-icu --with-llvm --with-python The union of these feature sets translates into the following options, after suppressing the defaults: --with-icu --with-tcl --with-perl --with-python --with-pam --with-openssl --with-libxml --with-libxslt --enable-nls --with-gssapi --with-ldap + --with-ossp-uuid --enable-dtrace --enable-dtrace --with-selinux + --with-system-tzdata --datadir --with-systemd --with-llvm -We, however, drop the external dependencies that are irrelevant for the -library or are not packaged for build2 and end up with the following options: +We, however, drop the external dependencies that are irrelevant for libpq and +psql or are not packaged for build2 and end up with the following options: - --with-openssl --without-readline + --with-ssl=openssl --without-readline --without-zlib See the configuration options description at the "Installation Procedure" page -(https://www.postgresql.org/docs/current/install-procedure.html). +(https://www.postgresql.org/docs/14/install-procedure.html). Normally, when packaging a project, we need to replace some auto-generated headers with our own implementations and deduce compilation/linking options. @@ -87,12 +99,14 @@ On POSIX and for MinGW GCC: $ mkdir build $ cd build -$ ../configure --with-openssl --without-readline >build.log 2>&1 +$ ../configure --with-ssl=openssl --without-readline --without-zlib >build.log 2>&1 $ cd src/interfaces/libpq $ make VERBOSE=1 >>../../../build.log 2>&1 +$ cd ../../bin/psql +$ make VERBOSE=1 >>../../../build.log 2>&1 See the "Installation from Source Code" page -(https://www.postgresql.org/docs/current/installation.html) for details. +(https://www.postgresql.org/docs/14/installation.html) for details. For MSVC: @@ -101,16 +115,15 @@ OpenSSL and zlib. > cd src\tools\msvc -Edit config_default.pl to enable OpenSSL and zlib: +Edit config_default.pl to enable OpenSSL: openssl => 'c:\OpenSSL', # --with-openssl= - zlib => 'C:\zlib64' # --with-zlib= > build libpq >>build.log 2>&1 +> build psql >>build.log 2>&1 -See the "Building with Visual C++ or the Microsoft Windows SDK" page -(https://www.postgresql.org/docs/current/install-windows-full.html) for -details. +See the "Installation from Source Code on Windows" page +(https://www.postgresql.org/docs/14/install-windows.html) for details. When the packaging is complete, build all the project packages in source tree and make sure that no PostgreSQL headers are included from the system, running diff --git a/TODO b/TODO index ed7bfd8..4d343a7 100644 --- a/TODO +++ b/TODO @@ -2,9 +2,8 @@ On the revision: On the release: - - Switch to using -pthread from -D_REENTRANT/-lpthread. - - Note that this requires bumping build2 version requirement to 0.15.0. + Note that here we record items that require bumping build2 version + requirement to the latest released version of the toolchain. Additional (permanent) notes: diff --git a/libpq/.gitignore b/libpq/.gitignore index 3dcc22f..d4a1da2 100644 --- a/libpq/.gitignore +++ b/libpq/.gitignore @@ -13,6 +13,7 @@ *.ifc *.so *.so.* +*.dylib *.dll *.a *.lib diff --git a/libpq/README-DEV b/libpq/README-DEV index 0a204c4..6ccf1cc 100644 --- a/libpq/README-DEV +++ b/libpq/README-DEV @@ -4,8 +4,8 @@ understanding will be useful when upgrading to a new upstream version. See The upstream package builds the common and ports static libraries and links them to the libpq library. These static libraries are generic enough to fit -all the binaries built by the package. We will build libpq selecting only the -required static libraries source files, relying on the linker diagnostics +all the binaries built by the package. We will build libpq by only selecting +the required static libraries source files, relying on the linker diagnostics (unresolved symbol errors, etc). Symlink the required upstream components and provide our own implementations @@ -19,26 +19,27 @@ directory prefixes. $ ln -s ../../upstream/src/interfaces/libpq libpq/pq -Note that while we could symlink the upstream's top source directories, this -would potentially bloat the distribution, uglify the buildfile, and complicate -pg_config.h change tracking on upgrade (see below). Thus, we selectively -symlink only the required files. +Note that symlinking all the upstream's top source directories is a bad idea +since this would potentially bloat the distribution, uglify the buildfile, and +complicate pg_config.h change tracking on upgrade (see below). Also note that +some of the source files are shared with the psql package and this sharing +doesn't align with such an approach. Thus, we selectively symlink only the +required files. $ mkdir -p libpq/include/libpq libpq/include/mb libpq/include/port $ ln -s ../../../upstream/src/include/{c,getaddrinfo,pg_config_manual,port,postgres_ext,postgres_fe}.h libpq/include +$ ln -s ../../../upstream/src/include/common libpq/include $ ln -s ../../../../upstream/src/include/libpq/{libpq-fs,pqcomm}.h libpq/include/libpq $ ln -s ../../../../upstream/src/include/mb/pg_wchar.h libpq/include/mb $ ln -s ../../../../upstream/src/include/port/{linux,freebsd,darwin,win32,win32_port,pg_bswap}.h libpq/include/port $ ln -s ../../../../upstream/src/include/port/{win32,win32_msvc} libpq/include/port $ mkdir libpq/common -$ ln -s ../../../upstream/src/common/{base64,cryptohash_openssl,encnames,hmac_openssl,ip,link-canary,md5,md5_common,saslprep,scram-common,string,unicode_norm,wchar}.c \ - libpq/common +$ ln -s ../../../upstream/src/common/{base64,cryptohash_openssl,encnames,hmac_openssl,ip,link-canary,md5,md5_common,saslprep,scram-common,string,unicode_norm,wchar}.c libpq/common $ ln -s ../../../upstream/src/common/md5_int.h libpq/common $ mkdir libpq/port -$ ln -s ../../../upstream/src/port/{chklocale,explicit_bzero,getaddrinfo,getpeereid,gettimeofday,inet_aton,inet_net_ntop,noblock,open,pg_strong_random,pgsleep,pgstrcasecmp,snprintf,strerror,strlcpy,system,thread,win32error,win32setlocale,win32stat}.c \ - libpq/port +$ ln -s ../../../upstream/src/port/{chklocale,explicit_bzero,getaddrinfo,getpeereid,gettimeofday,inet_aton,inet_net_ntop,noblock,open,pg_strong_random,pgsleep,pgstrcasecmp,snprintf,strerror,strlcpy,system,thread,win32error,win32setlocale,win32stat}.c libpq/port $ ln -s ../../../upstream/src/port/pthread-win32.h libpq/port $ ln -s ../../upstream/src/include/pg_config_ext.h.in libpq/pg_config_ext.h.in.orig @@ -58,7 +59,7 @@ macro sets: $ for m in `cat libpq/pg_config.h.in.orig | \ sed -n 's/^.*#\s*\(define\|undef\)\s\{1,\}\([_A-Z0-9]\{1,\}\)\(\s.*\)\{0,1\}$/\2/p' | \ sort -u`; do - if grep -q -e "\b$m\b" `find -L . -name '*.h' -a ! -name 'pg_config.h' -o -name '*.c'`; then + if grep -q -e "\b$m\b" `find -L . ../psql -name '*.h' -a ! -name 'pg_config.h' -o -name '*.c'`; then echo "$m" fi done >used-macros diff --git a/libpq/build/export.build b/libpq/build/export.build index bb54707..6c8c87c 100644 --- a/libpq/build/export.build +++ b/libpq/build/export.build @@ -6,4 +6,4 @@ $out_root/ include libpq/ } -export $out_root/libpq/lib{pq} +export $out_root/libpq/$import.target diff --git a/libpq/libpq/buildfile b/libpq/libpq/buildfile index 413583c..94fa06b 100644 --- a/libpq/libpq/buildfile +++ b/libpq/libpq/buildfile @@ -44,7 +44,13 @@ windows = ($tclass == 'windows') # lib{pq}: port/c{explicit_bzero}: include = (!$bsd) lib{pq}: port/c{gettimeofday}: include = ($tsys == 'win32-msvc') -lib{pq}: port/c{strlcpy}: include = (!$bsd && !$macos) + +# Note that we never compile port/strlcpy.c directly but rather conditionally +# include it from our strlcpy.c if HAVE_DECL_STRLCAT is 0 (see +# libpq/pg_config.h for the macro definition). +# +lib{pq}: port/c{strlcpy}: include = adhoc +lib{pq}: c{strlcpy}: include = (!$bsd && !$macos) lib{pq}: pq/{h c}{*win32* } \ port/{h c}{*win32* +getaddrinfo +inet_aton}: include = $windows @@ -84,14 +90,7 @@ h{version}: in{version} $src_root/manifest # c.poptions += -DFRONTEND -DUNSAFE_STAT_OK -DSO_MAJOR_VERSION=$abi_major -if! $windows - # Note that the upstream package uses the -pthread compiler/linker option. - # The option is unsupported by build2 so we pass -D_REENTRANT and -lpthread - # preprocessor/linker options instead. We also omit -D_THREAD_SAFE (synonym - # for -D_REENTRANT) and Solaris-specific -D_POSIX_PTHREAD_SEMANTICS. - # - c.poptions += -D_REENTRANT -else +if $windows # Note that the upstream package defines the WIN32 macro for VC only, # relying on the fact that MinGW GCC defines it by default. However, the # macro disappears from the default ones if to compile with -std=c9x (as we @@ -237,11 +236,11 @@ switch $tclass, $tsys c.loptions += "-Wl,--version-script=$out_base/libpqdll.map" - c.libs += -lpthread + c.libs += -pthread } default - c.libs += -lpthread + c.libs += -pthread } # Export options. diff --git a/libpq/libpq/pg_config.h b/libpq/libpq/pg_config.h index c834880..e0e61ad 100644 --- a/libpq/libpq/pg_config.h +++ b/libpq/libpq/pg_config.h @@ -15,14 +15,23 @@ #include /* offsetof() */ +#if defined(__linux__) +# include /* __GLIBC__, __GLIBC_MINOR__ */ +#endif + #include /* OPENSSL_VERSION_NUMBER */ +#define PACKAGE_NAME "PostgreSQL" +#define PACKAGE_URL "https://www.postgresql.org/" +#define PACKAGE_BUGREPORT "pgsql-bugs@lists.postgresql.org" + /* * Version. */ #undef PG_VERSION #undef PG_VERSION_NUM #undef PG_MAJORVERSION +#undef PG_VERSION_STR #include /* @@ -110,6 +119,22 @@ #define INT64_MODIFIER "ll" /* + * GNU libc added strlcpy() and strlcat() in version 2.38 (in anticipation + * of their addition to POSIX). + */ +#if defined(__FreeBSD__) || \ + defined(__APPLE__) || \ + (defined(__GLIBC__) && \ + defined(__GLIBC_MINOR__) && \ + (__GLIBC__ > 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ >= 38)) +# define HAVE_DECL_STRLCAT 1 +# define HAVE_DECL_STRLCPY 1 +#else +# define HAVE_DECL_STRLCAT 0 +# define HAVE_DECL_STRLCPY 0 +#endif + +/* * Specific for FreeBSD. */ #ifdef __FreeBSD__ @@ -142,8 +167,6 @@ * Specific for FreeBSD and Mac OS. */ #if defined(__FreeBSD__) || defined(__APPLE__) -# define HAVE_DECL_STRLCAT 1 -# define HAVE_DECL_STRLCPY 1 # define STRERROR_R_INT 1 # define HAVE_FLS 1 # define HAVE_GETPEEREID 1 @@ -154,9 +177,7 @@ # define HAVE_SYS_UCRED_H 1 # define HAVE_UNION_SEMUN 1 # define HAVE_MEMSET_S 1 -#else -# define HAVE_DECL_STRLCAT 0 -# define HAVE_DECL_STRLCPY 0 +# define HAVE_INT_OPTRESET 1 #endif /* @@ -190,6 +211,8 @@ # define HAVE_PWRITE 1 # define HAVE_LINK 1 # define HAVE_STRUCT_SOCKADDR_UN 1 +# define HAVE_READLINK 1 +# define HAVE_STRSIGNAL 1 /* * Specific for Windows. @@ -224,6 +247,12 @@ # define HAVE__BUILTIN_BSWAP64 1 # define HAVE__BUILTIN_OP_OVERFLOW 1 # define HAVE_SETENV 1 +# define HAVE_CLOCK_GETTIME 1 +# define HAVE_GETOPT 1 +# define HAVE_GETOPT_H 1 +# define HAVE_GETOPT_LONG 1 +# define HAVE_INT_OPTERR 1 +# define HAVE_STRUCT_OPTION 1 /* * _Static_assert() was introduced in C11. However, all the latest major @@ -288,11 +317,7 @@ #undef ENABLE_GSS #undef USE_LDAP -/* - * Is meaningless if NLS support is disabled (see above and libpq/buildfile for - * details). - */ -#undef LOCALEDIR +#undef HAVE_LIBREADLINE /* * Is meaningless if GSSAPI support is disabled (see above). It also seems that @@ -355,4 +380,52 @@ #undef HAVE___STRTOLL #undef HAVE___STRTOULL +/* + * None of the supported platforms provides append_history(). + */ +#undef HAVE_APPEND_HISTORY + +/* + * None of the supported OSes have or + * . + */ +#undef HAVE_EDITLINE_HISTORY_H +#undef HAVE_EDITLINE_READLINE_H + +/* + * None of the supported OSes have . + */ +#undef HAVE_HISTORY_H +#undef HAVE_HISTORY_TRUNCATE_FILE + +/* + * None of the supported OSes have , , or + * . + */ +#undef HAVE_READLINE_H +#undef HAVE_READLINE_HISTORY_H +#undef HAVE_READLINE_READLINE_H + +/* + * None of the supported platforms provides rl_completion_append_character and + * rl_completion_suppress_quote global variables and rl_completion_matches(). + */ +#undef HAVE_RL_COMPLETION_APPEND_CHARACTER +#undef HAVE_RL_COMPLETION_MATCHES +#undef HAVE_RL_COMPLETION_SUPPRESS_QUOTE + +/* + * None of the supported platforms provides rl_filename_quote_characters and + * rl_filename_quoting_function global variables and + * rl_filename_completion_function(). + */ +#undef HAVE_RL_FILENAME_COMPLETION_FUNCTION +#undef HAVE_RL_FILENAME_QUOTE_CHARACTERS +#undef HAVE_RL_FILENAME_QUOTING_FUNCTION + +/* + * None of the supported platforms provides rl_reset_screen_size(). + */ +#undef HAVE_RL_RESET_SCREEN_SIZE + #define pg_restrict __restrict diff --git a/libpq/libpq/strlcpy.c b/libpq/libpq/strlcpy.c new file mode 100644 index 0000000..2dd9f29 --- /dev/null +++ b/libpq/libpq/strlcpy.c @@ -0,0 +1,6 @@ +/* file : libpq/strlcpy.c -*- C -*- + * license : PostgreSQL License; see accompanying COPYRIGHT file + */ +#if !HAVE_DECL_STRLCPY +# include +#endif diff --git a/libpq/manifest b/libpq/manifest index da81144..a71dc42 100644 --- a/libpq/manifest +++ b/libpq/manifest @@ -3,7 +3,7 @@ name: libpq # Note: remember to update doc-url below! # -version: 14.1.0+1 +version: 14.1.0+2 upstream-version: 14.1 project: postgresql @@ -15,12 +15,12 @@ url: https://www.postgresql.org/ doc-url: https://www.postgresql.org/docs/14/libpq.html src-url: https://git.build2.org/cgit/packaging/postgresql/postgresql/tree/libpq/ package-url: https://git.build2.org/cgit/packaging/postgresql/ -email: pgsql-general@postgresql.org ; Mailing list. +email: pgsql-general@lists.postgresql.org ; Mailing list. package-email: packaging@build2.org ; Mailing list. build-warning-email: builds@build2.org builds: all builds: -wasm -depends: * build2 >= 0.13.0 -depends: * bpkg >= 0.13.0 +depends: * build2 >= 0.15.0 +depends: * bpkg >= 0.15.0 depends: libcrypto >= 1.1.1 depends: libssl >= 1.1.1 diff --git a/packages.manifest b/packages.manifest index f05ada7..a9df66e 100644 --- a/packages.manifest +++ b/packages.manifest @@ -1,2 +1,4 @@ : 1 location: libpq/ +: +location: psql/ diff --git a/psql/.gitignore b/psql/.gitignore new file mode 100644 index 0000000..d4a1da2 --- /dev/null +++ b/psql/.gitignore @@ -0,0 +1,26 @@ +# Compiler/linker output. +# +*.d +*.t +*.i +*.i.* +*.ii +*.ii.* +*.o +*.obj +*.gcm +*.pcm +*.ifc +*.so +*.so.* +*.dylib +*.dll +*.a +*.lib +*.exp +*.pdb +*.ilk +*.exe +*.exe.dlls/ +*.exe.manifest +*.pc diff --git a/psql/COPYRIGHT b/psql/COPYRIGHT new file mode 120000 index 0000000..945f098 --- /dev/null +++ b/psql/COPYRIGHT @@ -0,0 +1 @@ +../upstream/COPYRIGHT \ No newline at end of file diff --git a/psql/INSTALL b/psql/INSTALL new file mode 100644 index 0000000..17779bb --- /dev/null +++ b/psql/INSTALL @@ -0,0 +1,7 @@ +The aim of this package is to make reading the INSTALL file unnecessary. So +next time try running: + +$ bpkg build psql + +But if you don't want to use the package manager, then you can also build this +package manually using the standard build2 build system. diff --git a/psql/README b/psql/README new file mode 100644 index 0000000..a8c99b8 --- /dev/null +++ b/psql/README @@ -0,0 +1,21 @@ +PostgreSQL is an object-relational SQL database management system with psql +being its terminal-based front-end. It enables the user to type in queries +interactively, issue them to PostgreSQL, and see the query results. +Alternatively, input can be from a file or from command line arguments. For +more information see: + +https://www.postgresql.org/ + +This package contains the original psql program source code overlaid with the +build2-based build system and packaged for the build2 package manager (bpkg). + +See the INSTALL file for the prerequisites and installation instructions. + +Send questions, bug reports, or any other feedback about the program itself to +the PostgreSQL mailing lists. Send build system and packaging-related feedback +to the packaging@build2.org mailing list (see https://lists.build2.org for +posting guidelines, etc). + +The packaging of PostgreSQL for build2 is tracked in a Git repository at: + +https://git.build2.org/cgit/packaging/postgresql/ diff --git a/psql/README-DEV b/psql/README-DEV new file mode 100644 index 0000000..10f82ec --- /dev/null +++ b/psql/README-DEV @@ -0,0 +1,68 @@ +This document describes how psql was packaged for build2. In particular, this +understanding will be useful when upgrading to a new upstream version. See +../README-DEV for general notes on PostgreSQL packaging. + +The upstream package builds the common and ports static libraries and links +them to the psql program. These static libraries are generic enough to fit all +the binaries built by the package. We will build psql by only selecting the +required static libraries source files, relying on the linker diagnostics +(unresolved symbol errors, etc). + +Symlink the required upstream components: + +$ ln -s ../upstream/COPYRIGHT + +$ mkdir -p psql/src +$ ln -s ../../../upstream/src/bin/psql psql/src + +Note that symlinking all the upstream's top source directories is a bad idea +since this would potentially bloat the distribution and uglify the +buildfile. Also note that some of the source files are shared with the libpq +package and this sharing doesn't align with such an approach. Thus, we +selectively symlink only the required files and directories. + +$ mkdir -p psql/src/fe_utils psql/src/common psql/src/port +$ ln -s ../../../../upstream/src/fe_utils/{print,conditional,cancel,string_utils,mbprint}.c psql/src/fe_utils +$ ln -s ../../../../upstream/src/common/{fe_memutils,logging,username,psprintf,sprompt,string,wait_error,exec,pg_get_line,stringinfo,kwlookup,keywords}.c psql/src/common +$ ln -s ../../../../upstream/src/port/{strlcpy,strlcat,pgstrcasecmp,snprintf,strerror,path,pgsleep,qsort,pgstrsignal,thread,win32stat,win32env,win32setlocale,win32error,getopt_long,getopt,open,system}.c psql/src/port + +$ mkdir -p psql/include/catalog psql/include/fe_utils psql/include/lib psql/include/libpq psql/include/mb psql/include/parser psql/include/port psql/include/portability +$ ln -s ../../../../upstream/src/include/catalog/{pg_am,genbki}.h psql/include/catalog +$ ln -s ../../../../upstream/src/include/fe_utils/{conditional,print,psqlscan,string_utils,cancel,mbprint,psqlscan_int}.h psql/include/fe_utils +$ ln -s ../../../../upstream/src/include/lib/{stringinfo,sort_template}.h psql/include/lib +$ ln -s ../../../../upstream/src/include/libpq/pqcomm.h psql/include/libpq +$ ln -s ../../../../upstream/src/include/mb/pg_wchar.h psql/include/mb +$ ln -s ../../../../upstream/src/include/parser/kwlist.h psql/include/parser +$ ln -s ../../../../upstream/src/include/port/{win32,win32_msvc,{linux,freebsd,darwin,win32}.h} psql/include/port +$ ln -s ../../../../upstream/src/include/portability/instr_time.h psql/include/portability +$ ln -s ../../../upstream/src/include/{c,port,postgres_fe,getopt_long,pg_getopt,pg_config_manual}.h psql/include +$ ln -s ../../../libpq/libpq/{pg_config,pg_config_os,pg_config_paths}.h psql/include +$ ln -s ../../../upstream/src/interfaces/libpq/pqexpbuffer.h psql/include +$ ln -s ../../../upstream/src/include/common psql/include + +Note that some of the source files are generated by perl scripts executed by +make on POSIX and build.pl on Windows. At the moment it feels too hairy to +generate them automatically in our buildfile. These files are platform- +independent, so lets build the upstream's psql program on some of the +supported platforms and copy these files to our downstream/ subdirectory: + +$ mkdir -p psql/downstream/catalog +$ cp /src/include/catalog/{pg_type_d,pg_am_d,pg_attribute_d,pg_cast_d,pg_class_d,pg_default_acl_d}.h psql/downstream/catalog/ +$ cp /src/bin/psql/{sql_help.{h,c},psqlscanslash.c} psql/downstream/ +$ cp /src/fe_utils/psqlscan.c psql/downstream/ +$ cp /src/common/kwlist_d.h psql/downstream/ + +Edit psql/downstream/psqlscanslash.c by changing the + +#line ... ".../psqlscanslash.c" +#line ... ".../psqlscanslash.l" + +directives to + +#line ... "psqlscanslash.c" +#line ... "psqlscanslash.l" + +Also edit psql/downstream/psqlscan.c similar to the above. + +$ ln -s ../src/psql/psqlscanslash.l psql/downstream/ +$ ln -s ../../../upstream/src/fe_utils/psqlscan.l psql/downstream/ diff --git a/psql/build/.gitignore b/psql/build/.gitignore new file mode 100644 index 0000000..4a730a3 --- /dev/null +++ b/psql/build/.gitignore @@ -0,0 +1,3 @@ +config.build +root/ +bootstrap/ diff --git a/psql/build/bootstrap.build b/psql/build/bootstrap.build new file mode 100644 index 0000000..30adfa5 --- /dev/null +++ b/psql/build/bootstrap.build @@ -0,0 +1,10 @@ +# file : build/bootstrap.build +# license : PostgreSQL License; see accompanying COPYRIGHT file + +project = psql + +using version +using config +using dist +using test +using install diff --git a/psql/build/export.build b/psql/build/export.build new file mode 100644 index 0000000..f6bd2a2 --- /dev/null +++ b/psql/build/export.build @@ -0,0 +1,9 @@ +# file : build/export.build +# license : PostgreSQL License; see accompanying COPYRIGHT file + +$out_root/ +{ + include psql/ +} + +export $out_root/psql/$import.target diff --git a/psql/build/root.build b/psql/build/root.build new file mode 100644 index 0000000..845647c --- /dev/null +++ b/psql/build/root.build @@ -0,0 +1,22 @@ +# file : build/root.build +# license : PostgreSQL License; see accompanying COPYRIGHT file + +# We rely on this in macros/options deduction (see +# psql/{buildfile,include/pg_config.h} for details). +# +c.std = 99 + +using c + +h{*}: extension = h +c{*}: extension = c + +if ($c.target.system == 'win32-msvc') + c.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS + +if ($c.class == 'msvc') + c.coptions += /wd4251 /wd4275 /wd4800 + +# Specify the test target for cross-testing. +# +test.target = $c.target diff --git a/psql/buildfile b/psql/buildfile new file mode 100644 index 0000000..c1d9e0e --- /dev/null +++ b/psql/buildfile @@ -0,0 +1,9 @@ +# file : buildfile +# license : PostgreSQL License; see accompanying COPYRIGHT file + +./: {*/ -build/} doc{INSTALL README} legal{COPYRIGHT} manifest + +# Don't install tests or the INSTALL file. +# +tests/: install = false +doc{INSTALL}@./: install = false diff --git a/psql/manifest b/psql/manifest new file mode 100644 index 0000000..780425c --- /dev/null +++ b/psql/manifest @@ -0,0 +1,26 @@ +: 1 +name: psql + +# Note: remember to update doc-url below! +# +version: 14.1.0+2 +upstream-version: 14.1 + +project: postgresql +summary: PostgreSQL interactive terminal +license: PostgreSQL ; Permissive free software license. +topics: PostgreSQL, SQL, relational database +description-file: README +url: https://www.postgresql.org/ +doc-url: https://www.postgresql.org/docs/14/app-psql.html +src-url: https://git.build2.org/cgit/packaging/postgresql/postgresql/tree/psql/ +package-url: https://git.build2.org/cgit/packaging/postgresql/ +email: pgsql-general@lists.postgresql.org ; Mailing list. +package-email: packaging@build2.org ; Mailing list. +build-error-email: builds@build2.org +builds: all +builds: -wasm +depends: * build2 >= 0.15.0 +depends: * bpkg >= 0.15.0 +depends: libpq == $ +depends: libcrypto >= 1.1.1 diff --git a/psql/psql/.gitignore b/psql/psql/.gitignore new file mode 100644 index 0000000..043b260 --- /dev/null +++ b/psql/psql/.gitignore @@ -0,0 +1 @@ +/psql diff --git a/psql/psql/buildfile b/psql/psql/buildfile new file mode 100644 index 0000000..30fa4cf --- /dev/null +++ b/psql/psql/buildfile @@ -0,0 +1,208 @@ +# file : psql/buildfile +# license : PostgreSQL License; see accompanying COPYRIGHT file + +import libs = libpq%lib{pq} + +# Note that psql doesn't use openssl directly. We however import libcrypto so +# that the included by can be +# found. +# +import libs += libcrypto%lib{crypto} + +exe{psql}: src/{h c}{** -port/**} \ + src/port/{ c}{** -strl* -win32* -getopt* -open -system} \ + include/{h }{** } \ + downstream/{h c}{** -strl* -libpq/version} \ + downstream/{h }{ libpq/version} + +downstream/libpq/h{version}: downstream/libpq/in{version} $src_root/manifest +{ + C_TARGET = $c.target +} + +tclass = $c.target.class +tsys = $c.target.system + +bsd = ($tclass == 'bsd') +macos = ($tclass == 'macos') +windows = ($tclass == 'windows') + +# Note that we never compile src/port/{strlcpy,strlcat}.c directly but rather +# include them conditionally from our downstream/{strlcpy,strlcat}.c files if +# HAVE_DECL_{STRLCPY,STRLCAT} macros are 0 (see downstream/pg_config.h for the +# macro definitions). +# +exe{psql}: src/port/c{strl*}: include = adhoc +exe{psql}: downstream/c{strl*}: include = (!$bsd && !$macos) +exe{psql}: src/port/c{win32* open system}: include = $windows +exe{psql}: src/port/c{getopt*}: include = ($tsys == 'win32-msvc') + +exe{psql}: $libs + +# Build options. +# +c.poptions += -DFRONTEND + +# Note that the upstream package defines the WIN32 macro for VC only. We, +# however define it for MinGW GCC as well (see libpq's buildfile for the +# reasoning). +# +if $windows + c.poptions += -DWIN32 + +# Note that we need to add "-I$src_root" for the headers auto-generating +# machinery to work properly. +# +c.poptions =+ "-I$out_root" "-I$src_root" \ + "-I$out_base/downstream" "-I$src_base/downstream" \ + "-I$src_base/src/psql" "-I$src_base/include" "-I$src_base" + +switch $tclass, $tsys +{ + case 'linux' + c.poptions += -D_GNU_SOURCE + + case 'windows', 'mingw32' + { + c.poptions =+ "-I$src_base/include/port/win32" + } + case 'windows' + { + # Probably some of the *WIN* macro definitions are not really required, + # but let's keep all of them for good measure. + # + c.poptions += -D__WINDOWS__ -D__WIN32__ -D_MBCS \ + -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE + + c.poptions =+ "-I$src_base/include/port/win32_msvc" \ + "-I$src_base/include/port/win32" + } +} + +# Define path macros. +# +# The only paths used in psql are SYSCONFDIR and PGBINDIR (see +# set_pglocale_pgservice(), process_psqlrc(), and get_etc_path() for details). +# The remaining path macros still need to be defined for src/port/path.c so +# that we can compile it. +# +# As it is noted in libpq's buildfile, the whole idea feels utterly broken and +# so, similar to libpq, we just do bare minimum and wait and see. +# +if ($install.root != [null]) +{ + root = $install.resolve($install.root) + sysconfdir = ($windows || $root != /usr ? $root/etc : /etc) + + if! $regex.match("$sysconfdir", '.*(pgsql|postgresql).*') + sysconfdir = $sysconfdir/postgresql + + pgbindir = $install.resolve($install.bin) + + pgsharedir = $install.resolve($install.data) + includedir = $install.resolve($install.include) + pkgincludedir = $install.resolve($install.include)/postgresql + includedirserver = $install.resolve($install.include)/postgresql/server + libdir = $install.resolve($install.lib) + pkglibdir = $install.resolve($install.lib)/postgresql + localedir = $install.resolve($install.data)/locale + docdir = $install.resolve($install.doc) + htmldir = $install.resolve($install.doc) + mandir = $install.resolve($install.man) +} +else +{ + sysconfdir = ($windows ? $out_base : /usr/local/pgsql/etc) + pgbindir = $out_base + + pgsharedir = ($windows ? '' : /usr/local/share) + includedir = ($windows ? '' : /usr/local/include) + pkgincludedir = ($windows ? '' : /usr/local/include/postgresql) + includedirserver = ($windows ? '' : /usr/local/include/postgresql/server) + libdir = ($windows ? '' : /usr/local/lib) + pkglibdir = ($windows ? '' : /usr/local/lib/postgresql) + localedir = ($windows ? '' : /usr/local/share/locale) + docdir = ($windows ? '' : /usr/local/share/doc/postgresql) + htmldir = ($windows ? '' : /usr/local/share/doc/postgresql) + mandir = ($windows ? '' : /usr/local/share/man) +} + +# Escape backslashes and quotes in the directory paths prior to representing +# them as C string literals. +# +bnd = $regex.replace($pgbindir, '(\\|")', '\\\1') +shd = $regex.replace($pgsharedir, '(\\|")', '\\\1') +scd = $regex.replace($sysconfdir, '(\\|")', '\\\1') +ind = $regex.replace($includedir, '(\\|")', '\\\1') +pid = $regex.replace($pkgincludedir, '(\\|")', '\\\1') +isd = $regex.replace($includedirserver, '(\\|")', '\\\1') +lbd = $regex.replace($libdir, '(\\|")', '\\\1') +pld = $regex.replace($pkglibdir, '(\\|")', '\\\1') +lcd = $regex.replace($localedir, '(\\|")', '\\\1') +dcd = $regex.replace($docdir, '(\\|")', '\\\1') +htd = $regex.replace($htmldir, '(\\|")', '\\\1') +mnd = $regex.replace($mandir, '(\\|")', '\\\1') + +src/port/obj{path}: c.poptions += -DSYSCONFDIR="\"$scd\"" \ + -DPGBINDIR="\"$bnd\"" \ + -DPGSHAREDIR="\"$shd\"" \ + -DSYSCONFDIR="\"$scd\"" \ + -DINCLUDEDIR="\"$ind\"" \ + -DPKGINCLUDEDIR="\"$pid\"" \ + -DINCLUDEDIRSERVER="\"$isd\"" \ + -DLIBDIR="\"$lbd\"" \ + -DPKGLIBDIR="\"$pld\"" \ + -DLOCALEDIR="\"$lcd\"" \ + -DDOCDIR="\"$dcd\"" \ + -DHTMLDIR="\"$htd\"" \ + -DMANDIR="\"$mnd\"" + +# The _cdecl specifier used in src/port/win32env.c is not recognized by +# MinGW GCC. Let's replace it with the equivalent __cdecl. +# +if $windows + src/port/obj{win32env}: c.poptions += -D_cdecl=__cdecl + +switch $c.class +{ + case 'gcc' + { + # Omit -fexcess-precision=standard since -std=9x implies it. + # + c.coptions += -fno-strict-aliasing -fwrapv + + # Disable warnings that pop up with -Wall -Wextra. Upstream doesn't seem + # to care about these and it is not easy to disable specific warnings in a + # way that works across compilers/versions (some -Wno-* options are only + # recognized in newer versions). There are still some warnings left that + # appear for certain platforms/compilers. We pass them through but disable + # treating them as errors. + # + # @@ TMP: try to re-enable on next release. + # + c.coptions += -Wno-all -Wno-extra -Wno-error -Wno-deprecated-declarations + } + case 'msvc' + { + c.coptions += /GF + + # Disable warnings that pop up with /W3. + # + c.coptions += /wd4018 /wd4090 /wd4244 /wd4267 + } +} + +switch $tclass, $tsys +{ + case 'linux' | 'macos' + c.libs += -lm + + case 'bsd' + c.libs += -lexecinfo -lm -pthread + + case 'windows', 'mingw32' + c.libs += -lws2_32 + + case 'windows' + c.libs += ws2_32.lib advapi32.lib +} diff --git a/psql/psql/downstream/catalog/pg_am_d.h b/psql/psql/downstream/catalog/pg_am_d.h new file mode 100644 index 0000000..6dad066 --- /dev/null +++ b/psql/psql/downstream/catalog/pg_am_d.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * pg_am_d.h + * Macro definitions for pg_am + * + * Portions Copyright (c) 1996-2021, 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 src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AM_D_H +#define PG_AM_D_H + +#define AccessMethodRelationId 2601 + +#define Anum_pg_am_oid 1 +#define Anum_pg_am_amname 2 +#define Anum_pg_am_amhandler 3 +#define Anum_pg_am_amtype 4 + +#define Natts_pg_am 4 + + +/* + * Allowed values for amtype + */ +#define AMTYPE_INDEX 'i' /* index access method */ +#define AMTYPE_TABLE 't' /* table access method */ + +#define HEAP_TABLE_AM_OID 2 +#define BTREE_AM_OID 403 +#define HASH_AM_OID 405 +#define GIST_AM_OID 783 +#define GIN_AM_OID 2742 +#define SPGIST_AM_OID 4000 +#define BRIN_AM_OID 3580 + +#endif /* PG_AM_D_H */ diff --git a/psql/psql/downstream/catalog/pg_attribute_d.h b/psql/psql/downstream/catalog/pg_attribute_d.h new file mode 100644 index 0000000..3c5e2a2 --- /dev/null +++ b/psql/psql/downstream/catalog/pg_attribute_d.h @@ -0,0 +1,60 @@ +/*------------------------------------------------------------------------- + * + * pg_attribute_d.h + * Macro definitions for pg_attribute + * + * Portions Copyright (c) 1996-2021, 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 src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_ATTRIBUTE_D_H +#define PG_ATTRIBUTE_D_H + +#define AttributeRelationId 1249 +#define AttributeRelation_Rowtype_Id 75 + +#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_attalign 11 +#define Anum_pg_attribute_attstorage 12 +#define Anum_pg_attribute_attcompression 13 +#define Anum_pg_attribute_attnotnull 14 +#define Anum_pg_attribute_atthasdef 15 +#define Anum_pg_attribute_atthasmissing 16 +#define Anum_pg_attribute_attidentity 17 +#define Anum_pg_attribute_attgenerated 18 +#define Anum_pg_attribute_attisdropped 19 +#define Anum_pg_attribute_attislocal 20 +#define Anum_pg_attribute_attinhcount 21 +#define Anum_pg_attribute_attcollation 22 +#define Anum_pg_attribute_attacl 23 +#define Anum_pg_attribute_attoptions 24 +#define Anum_pg_attribute_attfdwoptions 25 +#define Anum_pg_attribute_attmissingval 26 + +#define Natts_pg_attribute 26 + + +#define ATTRIBUTE_IDENTITY_ALWAYS 'a' +#define ATTRIBUTE_IDENTITY_BY_DEFAULT 'd' + +#define ATTRIBUTE_GENERATED_STORED 's' + + +#endif /* PG_ATTRIBUTE_D_H */ diff --git a/psql/psql/downstream/catalog/pg_cast_d.h b/psql/psql/downstream/catalog/pg_cast_d.h new file mode 100644 index 0000000..5cc3f95 --- /dev/null +++ b/psql/psql/downstream/catalog/pg_cast_d.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * pg_cast_d.h + * Macro definitions for pg_cast + * + * Portions Copyright (c) 1996-2021, 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 src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CAST_D_H +#define PG_CAST_D_H + +#define CastRelationId 2605 + +#define Anum_pg_cast_oid 1 +#define Anum_pg_cast_castsource 2 +#define Anum_pg_cast_casttarget 3 +#define Anum_pg_cast_castfunc 4 +#define Anum_pg_cast_castcontext 5 +#define Anum_pg_cast_castmethod 6 + +#define Natts_pg_cast 6 + + +/* + * The allowable values for pg_cast.castcontext are specified by this enum. + * Since castcontext is stored as a "char", we use ASCII codes for human + * convenience in reading the table. Note that internally to the backend, + * these values are converted to the CoercionContext enum (see primnodes.h), + * which is defined to sort in a convenient order; the ASCII codes don't + * have to sort in any special order. + */ + +typedef enum CoercionCodes +{ + COERCION_CODE_IMPLICIT = 'i', /* coercion in context of expression */ + COERCION_CODE_ASSIGNMENT = 'a', /* coercion in context of assignment */ + COERCION_CODE_EXPLICIT = 'e' /* explicit cast operation */ +} CoercionCodes; + +/* + * The allowable values for pg_cast.castmethod are specified by this enum. + * Since castmethod is stored as a "char", we use ASCII codes for human + * convenience in reading the table. + */ +typedef enum CoercionMethod +{ + COERCION_METHOD_FUNCTION = 'f', /* use a function */ + COERCION_METHOD_BINARY = 'b', /* types are binary-compatible */ + COERCION_METHOD_INOUT = 'i' /* use input/output functions */ +} CoercionMethod; + + +#endif /* PG_CAST_D_H */ diff --git a/psql/psql/downstream/catalog/pg_class_d.h b/psql/psql/downstream/catalog/pg_class_d.h new file mode 100644 index 0000000..ee8dea6 --- /dev/null +++ b/psql/psql/downstream/catalog/pg_class_d.h @@ -0,0 +1,103 @@ +/*------------------------------------------------------------------------- + * + * pg_class_d.h + * Macro definitions for pg_class + * + * Portions Copyright (c) 1996-2021, 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 src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CLASS_D_H +#define PG_CLASS_D_H + +#define RelationRelationId 1259 +#define RelationRelation_Rowtype_Id 83 + +#define Anum_pg_class_oid 1 +#define Anum_pg_class_relname 2 +#define Anum_pg_class_relnamespace 3 +#define Anum_pg_class_reltype 4 +#define Anum_pg_class_reloftype 5 +#define Anum_pg_class_relowner 6 +#define Anum_pg_class_relam 7 +#define Anum_pg_class_relfilenode 8 +#define Anum_pg_class_reltablespace 9 +#define Anum_pg_class_relpages 10 +#define Anum_pg_class_reltuples 11 +#define Anum_pg_class_relallvisible 12 +#define Anum_pg_class_reltoastrelid 13 +#define Anum_pg_class_relhasindex 14 +#define Anum_pg_class_relisshared 15 +#define Anum_pg_class_relpersistence 16 +#define Anum_pg_class_relkind 17 +#define Anum_pg_class_relnatts 18 +#define Anum_pg_class_relchecks 19 +#define Anum_pg_class_relhasrules 20 +#define Anum_pg_class_relhastriggers 21 +#define Anum_pg_class_relhassubclass 22 +#define Anum_pg_class_relrowsecurity 23 +#define Anum_pg_class_relforcerowsecurity 24 +#define Anum_pg_class_relispopulated 25 +#define Anum_pg_class_relreplident 26 +#define Anum_pg_class_relispartition 27 +#define Anum_pg_class_relrewrite 28 +#define Anum_pg_class_relfrozenxid 29 +#define Anum_pg_class_relminmxid 30 +#define Anum_pg_class_relacl 31 +#define Anum_pg_class_reloptions 32 +#define Anum_pg_class_relpartbound 33 + +#define Natts_pg_class 33 + + +#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_MATVIEW 'm' /* materialized view */ +#define RELKIND_COMPOSITE_TYPE 'c' /* composite type */ +#define RELKIND_FOREIGN_TABLE 'f' /* foreign table */ +#define RELKIND_PARTITIONED_TABLE 'p' /* partitioned table */ +#define RELKIND_PARTITIONED_INDEX 'I' /* partitioned index */ + +#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 replica identity. + * Note this 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' + +/* + * Relation kinds that have physical storage. These relations normally have + * relfilenode set to non-zero, but it can also be zero if the relation is + * mapped. + */ +#define RELKIND_HAS_STORAGE(relkind) \ + ((relkind) == RELKIND_RELATION || \ + (relkind) == RELKIND_INDEX || \ + (relkind) == RELKIND_SEQUENCE || \ + (relkind) == RELKIND_TOASTVALUE || \ + (relkind) == RELKIND_MATVIEW) + + + +#endif /* PG_CLASS_D_H */ diff --git a/psql/psql/downstream/catalog/pg_default_acl_d.h b/psql/psql/downstream/catalog/pg_default_acl_d.h new file mode 100644 index 0000000..c317493 --- /dev/null +++ b/psql/psql/downstream/catalog/pg_default_acl_d.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * pg_default_acl_d.h + * Macro definitions for pg_default_acl + * + * Portions Copyright (c) 1996-2021, 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 src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DEFAULT_ACL_D_H +#define PG_DEFAULT_ACL_D_H + +#define DefaultAclRelationId 826 + +#define Anum_pg_default_acl_oid 1 +#define Anum_pg_default_acl_defaclrole 2 +#define Anum_pg_default_acl_defaclnamespace 3 +#define Anum_pg_default_acl_defaclobjtype 4 +#define Anum_pg_default_acl_defaclacl 5 + +#define Natts_pg_default_acl 5 + + +/* + * Types of objects for which the user is allowed to specify default + * permissions through pg_default_acl. These codes are used in the + * defaclobjtype column. + */ +#define DEFACLOBJ_RELATION 'r' /* table, view */ +#define DEFACLOBJ_SEQUENCE 'S' /* sequence */ +#define DEFACLOBJ_FUNCTION 'f' /* function */ +#define DEFACLOBJ_TYPE 'T' /* type */ +#define DEFACLOBJ_NAMESPACE 'n' /* namespace */ + + +#endif /* PG_DEFAULT_ACL_D_H */ diff --git a/psql/psql/downstream/catalog/pg_type_d.h b/psql/psql/downstream/catalog/pg_type_d.h new file mode 100644 index 0000000..fab23b5 --- /dev/null +++ b/psql/psql/downstream/catalog/pg_type_d.h @@ -0,0 +1,321 @@ +/*------------------------------------------------------------------------- + * + * pg_type_d.h + * Macro definitions for pg_type + * + * Portions Copyright (c) 1996-2021, 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 src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TYPE_D_H +#define PG_TYPE_D_H + +#define TypeRelationId 1247 +#define TypeRelation_Rowtype_Id 71 + +#define Anum_pg_type_oid 1 +#define Anum_pg_type_typname 2 +#define Anum_pg_type_typnamespace 3 +#define Anum_pg_type_typowner 4 +#define Anum_pg_type_typlen 5 +#define Anum_pg_type_typbyval 6 +#define Anum_pg_type_typtype 7 +#define Anum_pg_type_typcategory 8 +#define Anum_pg_type_typispreferred 9 +#define Anum_pg_type_typisdefined 10 +#define Anum_pg_type_typdelim 11 +#define Anum_pg_type_typrelid 12 +#define Anum_pg_type_typsubscript 13 +#define Anum_pg_type_typelem 14 +#define Anum_pg_type_typarray 15 +#define Anum_pg_type_typinput 16 +#define Anum_pg_type_typoutput 17 +#define Anum_pg_type_typreceive 18 +#define Anum_pg_type_typsend 19 +#define Anum_pg_type_typmodin 20 +#define Anum_pg_type_typmodout 21 +#define Anum_pg_type_typanalyze 22 +#define Anum_pg_type_typalign 23 +#define Anum_pg_type_typstorage 24 +#define Anum_pg_type_typnotnull 25 +#define Anum_pg_type_typbasetype 26 +#define Anum_pg_type_typtypmod 27 +#define Anum_pg_type_typndims 28 +#define Anum_pg_type_typcollation 29 +#define Anum_pg_type_typdefaultbin 30 +#define Anum_pg_type_typdefault 31 +#define Anum_pg_type_typacl 32 + +#define Natts_pg_type 32 + + +/* + * macros for values of poor-mans-enumerated-type columns + */ +#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_MULTIRANGE 'm' /* multirange 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' + +#define TYPALIGN_CHAR 'c' /* char alignment (i.e. unaligned) */ +#define TYPALIGN_SHORT 's' /* short alignment (typically 2 bytes) */ +#define TYPALIGN_INT 'i' /* int alignment (typically 4 bytes) */ +#define TYPALIGN_DOUBLE 'd' /* double alignment (often 8 bytes) */ + +#define TYPSTORAGE_PLAIN 'p' /* type not prepared for toasting */ +#define TYPSTORAGE_EXTERNAL 'e' /* toastable, don't try to compress */ +#define TYPSTORAGE_EXTENDED 'x' /* fully toastable */ +#define TYPSTORAGE_MAIN 'm' /* like 'x' but try to store inline */ + +/* Is a type OID a polymorphic pseudotype? (Beware of multiple evaluation) */ +#define IsPolymorphicType(typid) \ + (IsPolymorphicTypeFamily1(typid) || \ + IsPolymorphicTypeFamily2(typid)) + +/* Code not part of polymorphic type resolution should not use these macros: */ +#define IsPolymorphicTypeFamily1(typid) \ + ((typid) == ANYELEMENTOID || \ + (typid) == ANYARRAYOID || \ + (typid) == ANYNONARRAYOID || \ + (typid) == ANYENUMOID || \ + (typid) == ANYRANGEOID || \ + (typid) == ANYMULTIRANGEOID) + +#define IsPolymorphicTypeFamily2(typid) \ + ((typid) == ANYCOMPATIBLEOID || \ + (typid) == ANYCOMPATIBLEARRAYOID || \ + (typid) == ANYCOMPATIBLENONARRAYOID || \ + (typid) == ANYCOMPATIBLERANGEOID || \ + (typid) == ANYCOMPATIBLEMULTIRANGEOID) + +/* Is this a "true" array type? (Requires fmgroids.h) */ +#define IsTrueArrayType(typeForm) \ + (OidIsValid((typeForm)->typelem) && \ + (typeForm)->typsubscript == F_ARRAY_SUBSCRIPT_HANDLER) + +/* + * Backwards compatibility for ancient random spellings of pg_type OID macros. + * Don't use these names in new code. + */ +#define CASHOID MONEYOID +#define LSNOID PG_LSNOID + +#define BOOLOID 16 +#define BYTEAOID 17 +#define CHAROID 18 +#define NAMEOID 19 +#define INT8OID 20 +#define INT2OID 21 +#define INT2VECTOROID 22 +#define INT4OID 23 +#define REGPROCOID 24 +#define TEXTOID 25 +#define OIDOID 26 +#define TIDOID 27 +#define XIDOID 28 +#define CIDOID 29 +#define OIDVECTOROID 30 +#define JSONOID 114 +#define XMLOID 142 +#define PG_NODE_TREEOID 194 +#define PG_NDISTINCTOID 3361 +#define PG_DEPENDENCIESOID 3402 +#define PG_MCV_LISTOID 5017 +#define PG_DDL_COMMANDOID 32 +#define XID8OID 5069 +#define POINTOID 600 +#define LSEGOID 601 +#define PATHOID 602 +#define BOXOID 603 +#define POLYGONOID 604 +#define LINEOID 628 +#define FLOAT4OID 700 +#define FLOAT8OID 701 +#define UNKNOWNOID 705 +#define CIRCLEOID 718 +#define MONEYOID 790 +#define MACADDROID 829 +#define INETOID 869 +#define CIDROID 650 +#define MACADDR8OID 774 +#define ACLITEMOID 1033 +#define BPCHAROID 1042 +#define VARCHAROID 1043 +#define DATEOID 1082 +#define TIMEOID 1083 +#define TIMESTAMPOID 1114 +#define TIMESTAMPTZOID 1184 +#define INTERVALOID 1186 +#define TIMETZOID 1266 +#define BITOID 1560 +#define VARBITOID 1562 +#define NUMERICOID 1700 +#define REFCURSOROID 1790 +#define REGPROCEDUREOID 2202 +#define REGOPEROID 2203 +#define REGOPERATOROID 2204 +#define REGCLASSOID 2205 +#define REGCOLLATIONOID 4191 +#define REGTYPEOID 2206 +#define REGROLEOID 4096 +#define REGNAMESPACEOID 4089 +#define UUIDOID 2950 +#define PG_LSNOID 3220 +#define TSVECTOROID 3614 +#define GTSVECTOROID 3642 +#define TSQUERYOID 3615 +#define REGCONFIGOID 3734 +#define REGDICTIONARYOID 3769 +#define JSONBOID 3802 +#define JSONPATHOID 4072 +#define TXID_SNAPSHOTOID 2970 +#define PG_SNAPSHOTOID 5038 +#define INT4RANGEOID 3904 +#define NUMRANGEOID 3906 +#define TSRANGEOID 3908 +#define TSTZRANGEOID 3910 +#define DATERANGEOID 3912 +#define INT8RANGEOID 3926 +#define INT4MULTIRANGEOID 4451 +#define NUMMULTIRANGEOID 4532 +#define TSMULTIRANGEOID 4533 +#define TSTZMULTIRANGEOID 4534 +#define DATEMULTIRANGEOID 4535 +#define INT8MULTIRANGEOID 4536 +#define RECORDOID 2249 +#define RECORDARRAYOID 2287 +#define CSTRINGOID 2275 +#define ANYOID 2276 +#define ANYARRAYOID 2277 +#define VOIDOID 2278 +#define TRIGGEROID 2279 +#define EVENT_TRIGGEROID 3838 +#define LANGUAGE_HANDLEROID 2280 +#define INTERNALOID 2281 +#define ANYELEMENTOID 2283 +#define ANYNONARRAYOID 2776 +#define ANYENUMOID 3500 +#define FDW_HANDLEROID 3115 +#define INDEX_AM_HANDLEROID 325 +#define TSM_HANDLEROID 3310 +#define TABLE_AM_HANDLEROID 269 +#define ANYRANGEOID 3831 +#define ANYCOMPATIBLEOID 5077 +#define ANYCOMPATIBLEARRAYOID 5078 +#define ANYCOMPATIBLENONARRAYOID 5079 +#define ANYCOMPATIBLERANGEOID 5080 +#define ANYMULTIRANGEOID 4537 +#define ANYCOMPATIBLEMULTIRANGEOID 4538 +#define PG_BRIN_BLOOM_SUMMARYOID 4600 +#define PG_BRIN_MINMAX_MULTI_SUMMARYOID 4601 +#define BOOLARRAYOID 1000 +#define BYTEAARRAYOID 1001 +#define CHARARRAYOID 1002 +#define NAMEARRAYOID 1003 +#define INT8ARRAYOID 1016 +#define INT2ARRAYOID 1005 +#define INT2VECTORARRAYOID 1006 +#define INT4ARRAYOID 1007 +#define REGPROCARRAYOID 1008 +#define TEXTARRAYOID 1009 +#define OIDARRAYOID 1028 +#define TIDARRAYOID 1010 +#define XIDARRAYOID 1011 +#define CIDARRAYOID 1012 +#define OIDVECTORARRAYOID 1013 +#define PG_TYPEARRAYOID 210 +#define PG_ATTRIBUTEARRAYOID 270 +#define PG_PROCARRAYOID 272 +#define PG_CLASSARRAYOID 273 +#define JSONARRAYOID 199 +#define XMLARRAYOID 143 +#define XID8ARRAYOID 271 +#define POINTARRAYOID 1017 +#define LSEGARRAYOID 1018 +#define PATHARRAYOID 1019 +#define BOXARRAYOID 1020 +#define POLYGONARRAYOID 1027 +#define LINEARRAYOID 629 +#define FLOAT4ARRAYOID 1021 +#define FLOAT8ARRAYOID 1022 +#define CIRCLEARRAYOID 719 +#define MONEYARRAYOID 791 +#define MACADDRARRAYOID 1040 +#define INETARRAYOID 1041 +#define CIDRARRAYOID 651 +#define MACADDR8ARRAYOID 775 +#define ACLITEMARRAYOID 1034 +#define BPCHARARRAYOID 1014 +#define VARCHARARRAYOID 1015 +#define DATEARRAYOID 1182 +#define TIMEARRAYOID 1183 +#define TIMESTAMPARRAYOID 1115 +#define TIMESTAMPTZARRAYOID 1185 +#define INTERVALARRAYOID 1187 +#define TIMETZARRAYOID 1270 +#define BITARRAYOID 1561 +#define VARBITARRAYOID 1563 +#define NUMERICARRAYOID 1231 +#define REFCURSORARRAYOID 2201 +#define REGPROCEDUREARRAYOID 2207 +#define REGOPERARRAYOID 2208 +#define REGOPERATORARRAYOID 2209 +#define REGCLASSARRAYOID 2210 +#define REGCOLLATIONARRAYOID 4192 +#define REGTYPEARRAYOID 2211 +#define REGROLEARRAYOID 4097 +#define REGNAMESPACEARRAYOID 4090 +#define UUIDARRAYOID 2951 +#define PG_LSNARRAYOID 3221 +#define TSVECTORARRAYOID 3643 +#define GTSVECTORARRAYOID 3644 +#define TSQUERYARRAYOID 3645 +#define REGCONFIGARRAYOID 3735 +#define REGDICTIONARYARRAYOID 3770 +#define JSONBARRAYOID 3807 +#define JSONPATHARRAYOID 4073 +#define TXID_SNAPSHOTARRAYOID 2949 +#define PG_SNAPSHOTARRAYOID 5039 +#define INT4RANGEARRAYOID 3905 +#define NUMRANGEARRAYOID 3907 +#define TSRANGEARRAYOID 3909 +#define TSTZRANGEARRAYOID 3911 +#define DATERANGEARRAYOID 3913 +#define INT8RANGEARRAYOID 3927 +#define INT4MULTIRANGEARRAYOID 6150 +#define NUMMULTIRANGEARRAYOID 6151 +#define TSMULTIRANGEARRAYOID 6152 +#define TSTZMULTIRANGEARRAYOID 6153 +#define DATEMULTIRANGEARRAYOID 6155 +#define INT8MULTIRANGEARRAYOID 6157 +#define CSTRINGARRAYOID 1263 + +#endif /* PG_TYPE_D_H */ diff --git a/psql/psql/downstream/kwlist_d.h b/psql/psql/downstream/kwlist_d.h new file mode 100644 index 0000000..3190723 --- /dev/null +++ b/psql/psql/downstream/kwlist_d.h @@ -0,0 +1,1088 @@ +/*------------------------------------------------------------------------- + * + * kwlist_d.h + * List of keywords represented as a ScanKeywordList. + * + * Portions Copyright (c) 1996-2021, 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 src/tools/gen_keywordlist.pl + * + *------------------------------------------------------------------------- + */ + +#ifndef KWLIST_D_H +#define KWLIST_D_H + +#include "common/kwlookup.h" + +static const char ScanKeywords_kw_string[] = + "abort\0" + "absolute\0" + "access\0" + "action\0" + "add\0" + "admin\0" + "after\0" + "aggregate\0" + "all\0" + "also\0" + "alter\0" + "always\0" + "analyse\0" + "analyze\0" + "and\0" + "any\0" + "array\0" + "as\0" + "asc\0" + "asensitive\0" + "assertion\0" + "assignment\0" + "asymmetric\0" + "at\0" + "atomic\0" + "attach\0" + "attribute\0" + "authorization\0" + "backward\0" + "before\0" + "begin\0" + "between\0" + "bigint\0" + "binary\0" + "bit\0" + "boolean\0" + "both\0" + "breadth\0" + "by\0" + "cache\0" + "call\0" + "called\0" + "cascade\0" + "cascaded\0" + "case\0" + "cast\0" + "catalog\0" + "chain\0" + "char\0" + "character\0" + "characteristics\0" + "check\0" + "checkpoint\0" + "class\0" + "close\0" + "cluster\0" + "coalesce\0" + "collate\0" + "collation\0" + "column\0" + "columns\0" + "comment\0" + "comments\0" + "commit\0" + "committed\0" + "compression\0" + "concurrently\0" + "configuration\0" + "conflict\0" + "connection\0" + "constraint\0" + "constraints\0" + "content\0" + "continue\0" + "conversion\0" + "copy\0" + "cost\0" + "create\0" + "cross\0" + "csv\0" + "cube\0" + "current\0" + "current_catalog\0" + "current_date\0" + "current_role\0" + "current_schema\0" + "current_time\0" + "current_timestamp\0" + "current_user\0" + "cursor\0" + "cycle\0" + "data\0" + "database\0" + "day\0" + "deallocate\0" + "dec\0" + "decimal\0" + "declare\0" + "default\0" + "defaults\0" + "deferrable\0" + "deferred\0" + "definer\0" + "delete\0" + "delimiter\0" + "delimiters\0" + "depends\0" + "depth\0" + "desc\0" + "detach\0" + "dictionary\0" + "disable\0" + "discard\0" + "distinct\0" + "do\0" + "document\0" + "domain\0" + "double\0" + "drop\0" + "each\0" + "else\0" + "enable\0" + "encoding\0" + "encrypted\0" + "end\0" + "enum\0" + "escape\0" + "event\0" + "except\0" + "exclude\0" + "excluding\0" + "exclusive\0" + "execute\0" + "exists\0" + "explain\0" + "expression\0" + "extension\0" + "external\0" + "extract\0" + "false\0" + "family\0" + "fetch\0" + "filter\0" + "finalize\0" + "first\0" + "float\0" + "following\0" + "for\0" + "force\0" + "foreign\0" + "forward\0" + "freeze\0" + "from\0" + "full\0" + "function\0" + "functions\0" + "generated\0" + "global\0" + "grant\0" + "granted\0" + "greatest\0" + "group\0" + "grouping\0" + "groups\0" + "handler\0" + "having\0" + "header\0" + "hold\0" + "hour\0" + "identity\0" + "if\0" + "ilike\0" + "immediate\0" + "immutable\0" + "implicit\0" + "import\0" + "in\0" + "include\0" + "including\0" + "increment\0" + "index\0" + "indexes\0" + "inherit\0" + "inherits\0" + "initially\0" + "inline\0" + "inner\0" + "inout\0" + "input\0" + "insensitive\0" + "insert\0" + "instead\0" + "int\0" + "integer\0" + "intersect\0" + "interval\0" + "into\0" + "invoker\0" + "is\0" + "isnull\0" + "isolation\0" + "join\0" + "key\0" + "label\0" + "language\0" + "large\0" + "last\0" + "lateral\0" + "leading\0" + "leakproof\0" + "least\0" + "left\0" + "level\0" + "like\0" + "limit\0" + "listen\0" + "load\0" + "local\0" + "localtime\0" + "localtimestamp\0" + "location\0" + "lock\0" + "locked\0" + "logged\0" + "mapping\0" + "match\0" + "materialized\0" + "maxvalue\0" + "method\0" + "minute\0" + "minvalue\0" + "mode\0" + "month\0" + "move\0" + "name\0" + "names\0" + "national\0" + "natural\0" + "nchar\0" + "new\0" + "next\0" + "nfc\0" + "nfd\0" + "nfkc\0" + "nfkd\0" + "no\0" + "none\0" + "normalize\0" + "normalized\0" + "not\0" + "nothing\0" + "notify\0" + "notnull\0" + "nowait\0" + "null\0" + "nullif\0" + "nulls\0" + "numeric\0" + "object\0" + "of\0" + "off\0" + "offset\0" + "oids\0" + "old\0" + "on\0" + "only\0" + "operator\0" + "option\0" + "options\0" + "or\0" + "order\0" + "ordinality\0" + "others\0" + "out\0" + "outer\0" + "over\0" + "overlaps\0" + "overlay\0" + "overriding\0" + "owned\0" + "owner\0" + "parallel\0" + "parser\0" + "partial\0" + "partition\0" + "passing\0" + "password\0" + "placing\0" + "plans\0" + "policy\0" + "position\0" + "preceding\0" + "precision\0" + "prepare\0" + "prepared\0" + "preserve\0" + "primary\0" + "prior\0" + "privileges\0" + "procedural\0" + "procedure\0" + "procedures\0" + "program\0" + "publication\0" + "quote\0" + "range\0" + "read\0" + "real\0" + "reassign\0" + "recheck\0" + "recursive\0" + "ref\0" + "references\0" + "referencing\0" + "refresh\0" + "reindex\0" + "relative\0" + "release\0" + "rename\0" + "repeatable\0" + "replace\0" + "replica\0" + "reset\0" + "restart\0" + "restrict\0" + "return\0" + "returning\0" + "returns\0" + "revoke\0" + "right\0" + "role\0" + "rollback\0" + "rollup\0" + "routine\0" + "routines\0" + "row\0" + "rows\0" + "rule\0" + "savepoint\0" + "schema\0" + "schemas\0" + "scroll\0" + "search\0" + "second\0" + "security\0" + "select\0" + "sequence\0" + "sequences\0" + "serializable\0" + "server\0" + "session\0" + "session_user\0" + "set\0" + "setof\0" + "sets\0" + "share\0" + "show\0" + "similar\0" + "simple\0" + "skip\0" + "smallint\0" + "snapshot\0" + "some\0" + "sql\0" + "stable\0" + "standalone\0" + "start\0" + "statement\0" + "statistics\0" + "stdin\0" + "stdout\0" + "storage\0" + "stored\0" + "strict\0" + "strip\0" + "subscription\0" + "substring\0" + "support\0" + "symmetric\0" + "sysid\0" + "system\0" + "table\0" + "tables\0" + "tablesample\0" + "tablespace\0" + "temp\0" + "template\0" + "temporary\0" + "text\0" + "then\0" + "ties\0" + "time\0" + "timestamp\0" + "to\0" + "trailing\0" + "transaction\0" + "transform\0" + "treat\0" + "trigger\0" + "trim\0" + "true\0" + "truncate\0" + "trusted\0" + "type\0" + "types\0" + "uescape\0" + "unbounded\0" + "uncommitted\0" + "unencrypted\0" + "union\0" + "unique\0" + "unknown\0" + "unlisten\0" + "unlogged\0" + "until\0" + "update\0" + "user\0" + "using\0" + "vacuum\0" + "valid\0" + "validate\0" + "validator\0" + "value\0" + "values\0" + "varchar\0" + "variadic\0" + "varying\0" + "verbose\0" + "version\0" + "view\0" + "views\0" + "volatile\0" + "when\0" + "where\0" + "whitespace\0" + "window\0" + "with\0" + "within\0" + "without\0" + "work\0" + "wrapper\0" + "write\0" + "xml\0" + "xmlattributes\0" + "xmlconcat\0" + "xmlelement\0" + "xmlexists\0" + "xmlforest\0" + "xmlnamespaces\0" + "xmlparse\0" + "xmlpi\0" + "xmlroot\0" + "xmlserialize\0" + "xmltable\0" + "year\0" + "yes\0" + "zone"; + +static const uint16 ScanKeywords_kw_offsets[] = { + 0, + 6, + 15, + 22, + 29, + 33, + 39, + 45, + 55, + 59, + 64, + 70, + 77, + 85, + 93, + 97, + 101, + 107, + 110, + 114, + 125, + 135, + 146, + 157, + 160, + 167, + 174, + 184, + 198, + 207, + 214, + 220, + 228, + 235, + 242, + 246, + 254, + 259, + 267, + 270, + 276, + 281, + 288, + 296, + 305, + 310, + 315, + 323, + 329, + 334, + 344, + 360, + 366, + 377, + 383, + 389, + 397, + 406, + 414, + 424, + 431, + 439, + 447, + 456, + 463, + 473, + 485, + 498, + 512, + 521, + 532, + 543, + 555, + 563, + 572, + 583, + 588, + 593, + 600, + 606, + 610, + 615, + 623, + 639, + 652, + 665, + 680, + 693, + 711, + 724, + 731, + 737, + 742, + 751, + 755, + 766, + 770, + 778, + 786, + 794, + 803, + 814, + 823, + 831, + 838, + 848, + 859, + 867, + 873, + 878, + 885, + 896, + 904, + 912, + 921, + 924, + 933, + 940, + 947, + 952, + 957, + 962, + 969, + 978, + 988, + 992, + 997, + 1004, + 1010, + 1017, + 1025, + 1035, + 1045, + 1053, + 1060, + 1068, + 1079, + 1089, + 1098, + 1106, + 1112, + 1119, + 1125, + 1132, + 1141, + 1147, + 1153, + 1163, + 1167, + 1173, + 1181, + 1189, + 1196, + 1201, + 1206, + 1215, + 1225, + 1235, + 1242, + 1248, + 1256, + 1265, + 1271, + 1280, + 1287, + 1295, + 1302, + 1309, + 1314, + 1319, + 1328, + 1331, + 1337, + 1347, + 1357, + 1366, + 1373, + 1376, + 1384, + 1394, + 1404, + 1410, + 1418, + 1426, + 1435, + 1445, + 1452, + 1458, + 1464, + 1470, + 1482, + 1489, + 1497, + 1501, + 1509, + 1519, + 1528, + 1533, + 1541, + 1544, + 1551, + 1561, + 1566, + 1570, + 1576, + 1585, + 1591, + 1596, + 1604, + 1612, + 1622, + 1628, + 1633, + 1639, + 1644, + 1650, + 1657, + 1662, + 1668, + 1678, + 1693, + 1702, + 1707, + 1714, + 1721, + 1729, + 1735, + 1748, + 1757, + 1764, + 1771, + 1780, + 1785, + 1791, + 1796, + 1801, + 1807, + 1816, + 1824, + 1830, + 1834, + 1839, + 1843, + 1847, + 1852, + 1857, + 1860, + 1865, + 1875, + 1886, + 1890, + 1898, + 1905, + 1913, + 1920, + 1925, + 1932, + 1938, + 1946, + 1953, + 1956, + 1960, + 1967, + 1972, + 1976, + 1979, + 1984, + 1993, + 2000, + 2008, + 2011, + 2017, + 2028, + 2035, + 2039, + 2045, + 2050, + 2059, + 2067, + 2078, + 2084, + 2090, + 2099, + 2106, + 2114, + 2124, + 2132, + 2141, + 2149, + 2155, + 2162, + 2171, + 2181, + 2191, + 2199, + 2208, + 2217, + 2225, + 2231, + 2242, + 2253, + 2263, + 2274, + 2282, + 2294, + 2300, + 2306, + 2311, + 2316, + 2325, + 2333, + 2343, + 2347, + 2358, + 2370, + 2378, + 2386, + 2395, + 2403, + 2410, + 2421, + 2429, + 2437, + 2443, + 2451, + 2460, + 2467, + 2477, + 2485, + 2492, + 2498, + 2503, + 2512, + 2519, + 2527, + 2536, + 2540, + 2545, + 2550, + 2560, + 2567, + 2575, + 2582, + 2589, + 2596, + 2605, + 2612, + 2621, + 2631, + 2644, + 2651, + 2659, + 2672, + 2676, + 2682, + 2687, + 2693, + 2698, + 2706, + 2713, + 2718, + 2727, + 2736, + 2741, + 2745, + 2752, + 2763, + 2769, + 2779, + 2790, + 2796, + 2803, + 2811, + 2818, + 2825, + 2831, + 2844, + 2854, + 2862, + 2872, + 2878, + 2885, + 2891, + 2898, + 2910, + 2921, + 2926, + 2935, + 2945, + 2950, + 2955, + 2960, + 2965, + 2975, + 2978, + 2987, + 2999, + 3009, + 3015, + 3023, + 3028, + 3033, + 3042, + 3050, + 3055, + 3061, + 3069, + 3079, + 3091, + 3103, + 3109, + 3116, + 3124, + 3133, + 3142, + 3148, + 3155, + 3160, + 3166, + 3173, + 3179, + 3188, + 3198, + 3204, + 3211, + 3219, + 3228, + 3236, + 3244, + 3252, + 3257, + 3263, + 3272, + 3277, + 3283, + 3294, + 3301, + 3306, + 3313, + 3321, + 3326, + 3334, + 3340, + 3344, + 3358, + 3368, + 3379, + 3389, + 3399, + 3413, + 3422, + 3428, + 3436, + 3449, + 3458, + 3463, + 3467, +}; + +#define SCANKEYWORDS_NUM_KEYWORDS 457 + +static int +ScanKeywords_hash_func(const void *key, size_t keylen) +{ + static const int16 h[915] = { + 32767, 32767, 32767, 32767, 32767, -208, 338, 32767, + 378, 612, 289, 640, 0, 32767, 184, 32767, + 882, 32767, 362, -196, -25, 250, 32767, 179, + -65, 32767, -70, 32767, 244, 32767, -55, 32767, + -547, 0, 36, 0, 32767, 32767, 313, 32767, + 32767, 32767, -25, 32767, 100, 7, 32767, 32767, + 32767, 32767, 3, 32767, 32767, 0, 32767, 127, + 0, 279, 69, 243, -245, 132, 63, 0, + 72, 32767, 32767, 32767, 0, -311, 32767, -474, + -53, 119, 32767, 178, 32767, 32767, 32767, 352, + -169, 32767, 0, 32767, 32767, -234, 172, 234, + 89, 363, 32767, 32767, 74, 81, 827, 53, + 603, 0, 448, 32767, 183, 417, 550, -170, + 32767, -179, 32767, 32767, 433, -657, 271, 32767, + 32767, 32767, -149, 32767, 181, 32767, 32767, 32767, + 0, 0, 0, -193, -371, 32767, -45, 582, + 32767, 49, 30, 32767, 138, 32767, 36, 390, + -126, -24, 0, 996, 32767, 354, 296, -765, + -20, 598, -404, -577, 32767, 32767, 53, -52, + 189, 32767, 43, 482, 70, 32767, 0, 539, + 287, -249, -20, 32767, 0, 32767, 94, -387, + 32767, 32767, 32767, 427, 32767, 32767, -206, 32767, + 273, 101, 218, 32767, 2, 32767, 106, 32767, + 32767, 215, 32767, -427, 389, -159, -101, 809, + 41, 0, 0, 32767, 719, 32767, -215, 32767, + 651, 167, 32767, -380, 32767, 32767, 328, -26, + 32767, 32767, 32767, 114, 0, -290, -182, -192, + 32767, -809, -476, 833, 67, 247, 119, 32767, + 32767, 200, 32767, 394, -176, 98, 32767, 447, + 32767, 596, 438, 32767, -750, 32767, 0, 32767, + 0, 555, -109, 83, -34, 82, 32767, 32767, + 330, 32767, 0, -17, 0, 21, 545, 286, + 32767, 32767, 124, 32767, 0, 32767, 137, 0, + -354, 183, 351, 885, 0, 190, -319, 224, + -292, 0, 32767, 32767, 792, 32767, 37, 200, + 342, 671, 356, 0, -163, -511, 43, 32767, + 32767, 163, 0, 32767, 32767, 32767, -81, -100, + 50, 18, -525, 452, 32767, 32767, 32767, 543, + 332, 406, 32767, 32767, 197, 32767, 32767, 32767, + 32767, -236, 32767, 32767, 243, 244, 32767, 194, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + -122, 684, 217, 32767, 360, 32767, 1085, -155, + 0, 8, 350, 202, 635, 32767, 325, 398, + 336, 32767, 32767, 900, 32767, 417, 200, 32767, + -44, 32767, 0, 32767, 32767, -361, 32767, 204, + 0, 0, 32767, 32767, 32767, 32767, -172, 32767, + 178, 32767, 93, 0, 151, 37, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 98, 205, 32767, + 32767, 32767, -178, -781, 0, 70, 32767, 219, + 301, 291, 0, 32767, 327, -295, 32767, 32767, + 120, 291, 32767, -10, 32767, 32767, 32767, 317, + 32767, 32767, 453, 208, 32767, 174, 0, 32767, + 0, 0, 215, 32767, 370, 32767, 416, 0, + 32767, 32767, 32767, 130, 366, -80, 32767, 32767, + 80, 212, 0, 267, 32767, 32767, 32767, 52, + 32767, 356, 0, -43, 170, -40, 369, 32767, + 252, 432, 62, 32767, 32767, 32767, 282, 19, + 26, -244, 32767, 32767, 32767, 32767, 0, 0, + -185, -612, 271, -14, -182, -122, 32767, 32767, + -296, 0, 423, 32767, 32767, 32767, 32767, 26, + 0, 32767, 0, 262, 412, 118, -138, -385, + 32767, 134, 311, -338, 309, 105, 754, 32767, + 762, 32767, 32767, 0, 32767, 32767, -509, 0, + 525, 803, 32767, -372, 32767, 524, 32767, -695, + 32767, 32767, 0, 253, -202, 32767, 32767, 32767, + 489, 32767, 32767, 0, -157, 130, 456, 200, + 32767, 32767, 26, 32767, -563, 32767, 392, 0, + 379, 373, 89, 70, 32767, 32767, 167, 241, + 553, 32767, 0, -49, 32767, 0, 230, -12, + -102, 0, -123, 32767, 32767, 0, 32767, 20, + -664, -249, 32767, 32767, 352, 53, 32767, 32767, + 249, 0, -144, -772, 0, 32767, 32767, 32767, + 268, 0, 101, 0, 32767, 44, 32767, 0, + -765, 32767, 32767, 272, 32767, 32767, 680, 0, + 32767, 367, 9, 840, -353, 677, 32767, 32767, + 145, 32767, 423, 65, 0, 0, 324, 32767, + 32767, 426, 332, 0, 32767, 32767, 189, 32767, + -534, 32767, 32767, 40, 33, 0, 32767, 0, + 289, -238, 182, 25, 0, 32767, 0, 140, + 206, 32767, 32767, 32767, 32767, 176, -132, 229, + 127, -578, 204, 393, 32767, 265, 32767, 189, + 32767, 0, 855, 32767, 0, 206, -338, 224, + 32767, 235, 34, 330, 386, 419, 407, 32767, + -28, 32767, -91, 0, 32767, 0, 32767, 32767, + 67, 352, 326, 290, -78, 87, 54, 9, + 223, -637, 133, 388, 32767, -123, 123, 32767, + 436, 613, -260, 32767, 31, 32767, 32767, -126, + 32767, 556, 32767, 0, 94, -523, 232, -58, + 32767, -456, 32767, 172, 918, 32767, 415, 0, + 32767, 0, 167, 658, 32767, -158, 32767, -265, + -1, 32767, 32767, 0, 32767, 0, 32767, 27, + 32767, 867, 189, 0, 155, 0, 386, 32767, + 32767, 0, 0, 32767, 246, 567, 32767, 32767, + -214, 31, 239, -474, 32767, 0, 159, 107, + 32767, 0, 49, 32767, -82, -31, 330, 174, + 74, 32767, 32767, 109, 311, 32767, 32767, -478, + 151, 32767, 0, 323, 0, 32767, 32767, 248, + 32767, 32767, 32767, 0, 32767, 0, 452, 0, + 321, 0, 0, 0, -12, 103, 32767, 103, + 32767, -261, 0, 32767, 398, 96, 32767, 32767, + 32767, -290, 566, 0, 32767, 0, 32767, 408, + 32767, 32767, 32767, 685, 32767, 42, 32767, 0, + 136, 0, 32767, 32767, 32767, 306, 32767, -180, + 124, 32767, 361, 32767, 0, 0, 0, 203, + 138, 321, 32767, 260, 32767, 32767, 32767, 766, + 32767, 0, 0, 14, -232, 598, 32767, 32767, + 924, 0, 32767, 0, 32767, 295, 32767, 32767, + 32767, 32767, 32767, 32767, 57, 80, 0, 221, + 15, 288, -3, 136, 426, 0, 32767, 32767, + 413, 32767, 32767, -771, 217, 801, 32767, 365, + 46, 32767, 32767, 0, 52, 405, 32767, 119, + 0, 32767, 308, 32767, 0, 10, 0, 32767, + 188, 32767, 0, 32767, 207, 32767, 146, 32767, + 308, 50, 305, 0, 32767, 32767, 425, 293, + 402, 375, 32767 + }; + + const unsigned char *k = (const unsigned char *) key; + uint32 a = 0; + uint32 b = 5; + + while (keylen--) + { + unsigned char c = *k++ | 0x20; + + a = a * 257 + c; + b = b * 17 + c; + } + return h[a % 915] + h[b % 915]; +} + +const ScanKeywordList ScanKeywords = { + ScanKeywords_kw_string, + ScanKeywords_kw_offsets, + ScanKeywords_hash_func, + SCANKEYWORDS_NUM_KEYWORDS, + 17 +}; + +#endif /* KWLIST_D_H */ diff --git a/psql/psql/downstream/libpq/.gitignore b/psql/psql/downstream/libpq/.gitignore new file mode 100644 index 0000000..620b4c8 --- /dev/null +++ b/psql/psql/downstream/libpq/.gitignore @@ -0,0 +1,3 @@ +# Generated version.h. +# +version.h diff --git a/psql/psql/downstream/libpq/version.h.in b/psql/psql/downstream/libpq/version.h.in new file mode 100644 index 0000000..54031b1 --- /dev/null +++ b/psql/psql/downstream/libpq/version.h.in @@ -0,0 +1,19 @@ +/* file : psql/downstream/libpq/version.h.in -*- C -*- + * license : PostgreSQL License; see accompanying COPYRIGHT file + */ + +#ifndef PG_MAJORVERSION /* Note: using the version macro itself. */ + +#define PG_VERSION "$psql.version.major$.$psql.version.minor$" + +/* + * For example, 120001 for 12.1. + */ +#define PG_VERSION_NUM (10000 * $psql.version.major$ + $psql.version.minor$) + +#define PG_MAJORVERSION "$psql.version.major$" + + +#define PG_VERSION_STR PACKAGE_NAME " $psql.version.project$ on $C_TARGET$" + +#endif /* PG_MAJORVERSION */ diff --git a/psql/psql/downstream/pg_config.h b/psql/psql/downstream/pg_config.h new file mode 120000 index 0000000..dacb7b0 --- /dev/null +++ b/psql/psql/downstream/pg_config.h @@ -0,0 +1 @@ +../../../libpq/libpq/pg_config.h \ No newline at end of file diff --git a/psql/psql/downstream/pg_config_os.h b/psql/psql/downstream/pg_config_os.h new file mode 120000 index 0000000..693bea2 --- /dev/null +++ b/psql/psql/downstream/pg_config_os.h @@ -0,0 +1 @@ +../../../libpq/libpq/pg_config_os.h \ No newline at end of file diff --git a/psql/psql/downstream/pg_config_paths.h b/psql/psql/downstream/pg_config_paths.h new file mode 120000 index 0000000..feec8f9 --- /dev/null +++ b/psql/psql/downstream/pg_config_paths.h @@ -0,0 +1 @@ +../../../libpq/libpq/pg_config_paths.h \ No newline at end of file diff --git a/psql/psql/downstream/psqlscan.c b/psql/psql/downstream/psqlscan.c new file mode 100644 index 0000000..246537d --- /dev/null +++ b/psql/psql/downstream/psqlscan.c @@ -0,0 +1,5054 @@ +#line 1 "psqlscan.c" +/*------------------------------------------------------------------------- + * + * psqlscan.l + * lexical scanner for SQL commands + * + * This lexer used to be part of psql, and that heritage is reflected in + * the file name as well as function and typedef names, though it can now + * be used by other frontend programs as well. It's also possible to extend + * this lexer with a compatible add-on lexer to handle program-specific + * backslash commands. + * + * This code is mainly concerned with determining where the end of a SQL + * statement is: we are looking for semicolons that are not within quotes, + * comments, or parentheses. The most reliable way to handle this is to + * borrow the backend's flex lexer rules, lock, stock, and barrel. The rules + * below are (except for a few) the same as the backend's, but their actions + * are just ECHO whereas the backend's actions generally do other things. + * + * XXX The rules in this file must be kept in sync with the backend lexer!!! + * + * XXX Avoid creating backtracking cases --- see the backend lexer for info. + * + * See psqlscan_int.h for additional commentary. + * + * + * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/fe_utils/psqlscan.l + * + *------------------------------------------------------------------------- + */ +#include "postgres_fe.h" + +#include "common/logging.h" +#include "fe_utils/psqlscan.h" + +#include "libpq-fe.h" + +#line 42 "psqlscan.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 6 +#define YY_FLEX_SUBMINOR_VERSION 4 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +#ifdef yy_create_buffer +#define psql_yy_create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer psql_yy_create_buffer +#endif + +#ifdef yy_delete_buffer +#define psql_yy_delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer psql_yy_delete_buffer +#endif + +#ifdef yy_scan_buffer +#define psql_yy_scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer psql_yy_scan_buffer +#endif + +#ifdef yy_scan_string +#define psql_yy_scan_string_ALREADY_DEFINED +#else +#define yy_scan_string psql_yy_scan_string +#endif + +#ifdef yy_scan_bytes +#define psql_yy_scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes psql_yy_scan_bytes +#endif + +#ifdef yy_init_buffer +#define psql_yy_init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer psql_yy_init_buffer +#endif + +#ifdef yy_flush_buffer +#define psql_yy_flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer psql_yy_flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define psql_yy_load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state psql_yy_load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define psql_yy_switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer psql_yy_switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define psql_yypush_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state psql_yypush_buffer_state +#endif + +#ifdef yypop_buffer_state +#define psql_yypop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state psql_yypop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define psql_yyensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack psql_yyensure_buffer_stack +#endif + +#ifdef yylex +#define psql_yylex_ALREADY_DEFINED +#else +#define yylex psql_yylex +#endif + +#ifdef yyrestart +#define psql_yyrestart_ALREADY_DEFINED +#else +#define yyrestart psql_yyrestart +#endif + +#ifdef yylex_init +#define psql_yylex_init_ALREADY_DEFINED +#else +#define yylex_init psql_yylex_init +#endif + +#ifdef yylex_init_extra +#define psql_yylex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra psql_yylex_init_extra +#endif + +#ifdef yylex_destroy +#define psql_yylex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy psql_yylex_destroy +#endif + +#ifdef yyget_debug +#define psql_yyget_debug_ALREADY_DEFINED +#else +#define yyget_debug psql_yyget_debug +#endif + +#ifdef yyset_debug +#define psql_yyset_debug_ALREADY_DEFINED +#else +#define yyset_debug psql_yyset_debug +#endif + +#ifdef yyget_extra +#define psql_yyget_extra_ALREADY_DEFINED +#else +#define yyget_extra psql_yyget_extra +#endif + +#ifdef yyset_extra +#define psql_yyset_extra_ALREADY_DEFINED +#else +#define yyset_extra psql_yyset_extra +#endif + +#ifdef yyget_in +#define psql_yyget_in_ALREADY_DEFINED +#else +#define yyget_in psql_yyget_in +#endif + +#ifdef yyset_in +#define psql_yyset_in_ALREADY_DEFINED +#else +#define yyset_in psql_yyset_in +#endif + +#ifdef yyget_out +#define psql_yyget_out_ALREADY_DEFINED +#else +#define yyget_out psql_yyget_out +#endif + +#ifdef yyset_out +#define psql_yyset_out_ALREADY_DEFINED +#else +#define yyset_out psql_yyset_out +#endif + +#ifdef yyget_leng +#define psql_yyget_leng_ALREADY_DEFINED +#else +#define yyget_leng psql_yyget_leng +#endif + +#ifdef yyget_text +#define psql_yyget_text_ALREADY_DEFINED +#else +#define yyget_text psql_yyget_text +#endif + +#ifdef yyget_lineno +#define psql_yyget_lineno_ALREADY_DEFINED +#else +#define yyget_lineno psql_yyget_lineno +#endif + +#ifdef yyset_lineno +#define psql_yyset_lineno_ALREADY_DEFINED +#else +#define yyset_lineno psql_yyset_lineno +#endif + +#ifdef yyget_column +#define psql_yyget_column_ALREADY_DEFINED +#else +#define yyget_column psql_yyget_column +#endif + +#ifdef yyset_column +#define psql_yyset_column_ALREADY_DEFINED +#else +#define yyset_column psql_yyset_column +#endif + +#ifdef yywrap +#define psql_yywrap_ALREADY_DEFINED +#else +#define yywrap psql_yywrap +#endif + +#ifdef yyget_lval +#define psql_yyget_lval_ALREADY_DEFINED +#else +#define yyget_lval psql_yyget_lval +#endif + +#ifdef yyset_lval +#define psql_yyset_lval_ALREADY_DEFINED +#else +#define yyset_lval psql_yyset_lval +#endif + +#ifdef yyalloc +#define psql_yyalloc_ALREADY_DEFINED +#else +#define yyalloc psql_yyalloc +#endif + +#ifdef yyrealloc +#define psql_yyrealloc_ALREADY_DEFINED +#else +#define yyrealloc psql_yyrealloc +#endif + +#ifdef yyfree +#define psql_yyfree_ALREADY_DEFINED +#else +#define yyfree psql_yyfree +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . 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 +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; +#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; + +/* 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 + +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* begin standard C++ headers. */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. + */ +#define YY_SC_TO_UI(c) ((YY_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 yyrestart( yyin , yyscanner ) +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#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) + #define YY_LINENO_REWIND_TO(ptr) + +/* 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. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int 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 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 yyrestart ( FILE *input_file , yyscan_t yyscanner ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); +void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +void yypop_buffer_state ( yyscan_t yyscanner ); + +static void yyensure_buffer_stack ( yyscan_t yyscanner ); +static void yy_load_buffer_state ( yyscan_t yyscanner ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner) + +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); + +void *yyalloc ( yy_size_t , yyscan_t yyscanner ); +void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); +void yyfree ( void * , yyscan_t yyscanner ); + +#define yy_new_buffer yy_create_buffer +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + 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 ){\ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + 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 psql_yywrap(yyscanner) (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP +typedef flex_uint8_t YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static const flex_int16_t yy_nxt[][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, 0, 0, 0, 0 + }, + + { + 23, 24, 25, 26, 25, 27, 28, 29, 30, 31, + 29, 32, 33, 34, 31, 31, 35, 36, 37, 38, + 39, 39, 40, 41, 42, 43, 44, 29, 45, 46, + 47, 45, 48, 49, 50, 51, 49, 50, 24, 24 + }, + + { + 23, 24, 25, 26, 25, 27, 28, 29, 30, 31, + 29, 32, 33, 34, 31, 31, 35, 36, 37, 38, + + 39, 39, 40, 41, 42, 43, 44, 29, 45, 46, + 47, 45, 48, 49, 50, 51, 49, 50, 24, 24 + }, + + { + 23, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 53, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52 + }, + + { + 23, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 53, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52 + + }, + + { + 23, 54, 54, 54, 54, 55, 54, 55, 54, 55, + 55, 54, 54, 54, 56, 55, 54, 55, 54, 57, + 54, 54, 54, 54, 55, 55, 55, 55, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 54, 54 + }, + + { + 23, 54, 54, 54, 54, 55, 54, 55, 54, 55, + 55, 54, 54, 54, 56, 55, 54, 55, 54, 57, + 54, 54, 54, 54, 55, 55, 55, 55, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 54, 54 + }, + + { + 23, 58, 58, 58, 58, 58, 59, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58 + }, + + { + 23, 58, 58, 58, 58, 58, 59, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58 + }, + + { + 23, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 53, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60 + + }, + + { + 23, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 53, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60 + }, + + { + 23, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 62, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61 + }, + + { + 23, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 62, 61, 61, 61, 61, 61, 61, 61, 61, + + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61 + }, + + { + 23, 63, 64, 65, 66, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 67, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63 + }, + + { + 23, 63, 64, 65, 66, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 67, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63 + + }, + + { + 23, 68, 68, 69, 68, 68, 68, 68, 68, 68, + 68, 70, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 71, 68, 68, 68, 68 + }, + + { + 23, 68, 68, 69, 68, 68, 68, 68, 68, 68, + 68, 70, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 71, 68, 68, 68, 68 + }, + + { + 23, 72, 72, 73, 72, 72, 72, 72, 74, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72 + }, + + { + 23, 72, 72, 73, 72, 72, 72, 72, 74, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72 + }, + + { + 23, 58, 58, 58, 58, 58, 75, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58 + + }, + + { + 23, 58, 58, 58, 58, 58, 75, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58 + }, + + { + 23, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 62, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61 + }, + + { + 23, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 62, 61, 61, 61, 61, 61, 61, 61, 61, + + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61 + }, + + { + -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, + -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, + -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, + -23, -23, -23, -23, -23, -23, -23, -23, -23, -23 + }, + + { + 23, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24 + + }, + + { + 23, -25, 76, 76, 76, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25 + }, + + { + 23, -26, 76, 76, 76, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26 + }, + + { + 23, -27, -27, -27, -27, 77, -27, 77, -27, 77, + 77, -27, -27, -27, 77, 77, -27, 77, -27, 77, + + -27, -27, -27, -27, 77, 78, 77, 77, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27 + }, + + { + 23, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28 + }, + + { + 23, -29, -29, -29, -29, 77, -29, 77, -29, 77, + 77, -29, -29, -29, 77, 77, -29, 77, -29, 77, + -29, -29, -29, -29, 77, 77, 77, 77, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29 + + }, + + { + 23, -30, -30, -30, -30, -30, -30, -30, 79, -30, + -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, + 80, 80, -30, -30, -30, -30, -30, -30, 81, 81, + 81, 81, 81, 81, 81, -30, 81, 81, -30, -30 + }, + + { + 23, -31, -31, -31, -31, 77, -31, 77, -31, 77, + 77, -31, -31, -31, 77, 77, -31, 77, -31, 77, + -31, -31, -31, -31, 77, 77, 77, 77, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31 + }, + + { + 23, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32 + }, + + { + 23, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33 + }, + + { + 23, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34 + + }, + + { + 23, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35 + }, + + { + 23, -36, -36, -36, -36, 77, -36, 77, -36, 77, + 77, -36, -36, -36, 77, 77, -36, 82, -36, 77, + -36, -36, -36, -36, 77, 77, 77, 77, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36 + }, + + { + 23, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, 83, -37, + + 84, 84, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37 + }, + + { + 23, -38, -38, -38, -38, 77, -38, 77, -38, 77, + 77, -38, -38, -38, 85, 77, -38, 77, -38, 77, + -38, -38, -38, -38, 77, 77, 77, 77, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38 + }, + + { + 23, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, 86, -39, + 87, 87, -39, -39, -39, -39, -39, -39, -39, -39, + 88, -39, -39, -39, -39, -39, -39, -39, -39, -39 + + }, + + { + 23, -40, -40, -40, -40, -40, 89, -40, -40, -40, + -40, 90, -40, -40, -40, -40, -40, -40, -40, -40, + 91, 91, 92, -40, -40, 93, -40, -40, 91, 91, + 91, 91, 91, 91, 91, -40, 91, 91, 94, -40 + }, + + { + 23, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41 + }, + + { + 23, -42, -42, -42, -42, 77, -42, 77, -42, 77, + 77, -42, -42, -42, 77, 77, -42, 77, -42, 77, + + -42, -42, -42, -42, 77, 95, 96, 77, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42 + }, + + { + 23, -43, -43, -43, -43, 77, -43, 77, -43, 77, + 77, -43, -43, -43, 77, 77, -43, 77, -43, 77, + -43, -43, -43, -43, 77, 77, 97, 77, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43 + }, + + { + 23, -44, -44, -44, -44, 77, -44, 77, -44, 77, + 77, -44, -44, -44, 77, 77, -44, 77, -44, 77, + -44, -44, -44, -44, 77, 98, 77, 77, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44 + + }, + + { + 23, -45, -45, -45, -45, -45, -45, -45, 99, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + 99, 99, -45, -45, -45, -45, -45, -45, 99, 99, + 99, 99, 99, 99, 99, -45, 99, 99, -45, -45 + }, + + { + 23, -46, -46, -46, -46, -46, -46, -46, 99, -46, + -46, 100, -46, -46, -46, -46, -46, -46, -46, -46, + 99, 99, -46, -46, -46, -46, -46, -46, 99, 99, + 99, 99, 99, 99, 99, -46, 99, 99, -46, -46 + }, + + { + 23, -47, -47, -47, -47, -47, -47, -47, 99, -47, + -47, 101, -47, -47, -47, -47, -47, -47, -47, -47, + + 99, 99, -47, -47, -47, -47, -47, -47, 99, 99, + 99, 99, 99, 99, 99, -47, 99, 99, -47, -47 + }, + + { + 23, -48, -48, -48, -48, -48, -48, -48, 99, -48, + -48, 102, -48, -48, -48, -48, -48, -48, -48, -48, + 99, 99, -48, -48, -48, -48, -48, -48, 99, 99, + 99, 99, 99, 99, 99, -48, 99, 99, -48, -48 + }, + + { + 23, -49, -49, -49, -49, -49, -49, -49, 99, -49, + 103, -49, -49, -49, -49, -49, -49, -49, -49, -49, + 99, 99, -49, -49, -49, -49, -49, -49, 99, 99, + 99, 99, 99, 99, 99, -49, 99, 99, -49, -49 + + }, + + { + 23, -50, -50, -50, -50, -50, -50, -50, 99, -50, + -50, 104, -50, -50, -50, -50, -50, -50, -50, -50, + 99, 99, -50, -50, -50, -50, -50, -50, 99, 99, + 99, 99, 99, 99, 99, -50, 99, 99, -50, -50 + }, + + { + 23, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, 105, 105, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51 + }, + + { + 23, 106, 106, 106, 106, 106, 106, 106, 106, 106, + 106, -52, 106, 106, 106, 106, 106, 106, 106, 106, + + 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, 106, 106, 106, 106 + }, + + { + 23, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53 + }, + + { + 23, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, -54, 107, 107, 107, 107, -54, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107 + + }, + + { + 23, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, -55, 107, 107, 107, 107, -55, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107 + }, + + { + 23, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, 108, -56, -56, -56, -56, 109, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56 + }, + + { + 23, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, 110, -57, -57, -57, -57, -57, + + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57 + }, + + { + 23, 111, 111, 111, 111, 111, -58, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111 + }, + + { + 23, -59, -59, -59, -59, -59, 112, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59 + + }, + + { + 23, 113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, -60, 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, 113, 113 + }, + + { + 23, 114, 114, 114, 114, 114, 114, 114, 114, 114, + 114, -61, 114, 114, 114, 114, 114, 114, 114, 114, + 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, + 114, 114, 114, 114, 114, 114, 114, 114, 114, 114 + }, + + { + 23, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, 115, -62, -62, -62, -62, -62, -62, -62, -62, + + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62 + }, + + { + 23, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63 + }, + + { + 23, -64, 116, 117, 117, -64, -64, -64, -64, -64, + -64, -64, -64, -64, -64, -64, -64, 118, -64, -64, + -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, + -64, -64, -64, -64, -64, -64, -64, -64, -64, -64 + + }, + + { + 23, -65, 119, 119, 119, -65, -65, -65, -65, -65, + -65, 120, -65, -65, -65, -65, -65, 121, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65 + }, + + { + 23, -66, 119, 119, 119, -66, -66, -66, -66, -66, + -66, 120, -66, -66, -66, -66, -66, 121, -66, -66, + -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, + -66, -66, -66, -66, -66, -66, -66, -66, -66, -66 + }, + + { + 23, -67, -67, -67, -67, -67, -67, -67, -67, -67, + -67, -67, -67, -67, -67, -67, -67, 122, -67, -67, + + -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, + -67, -67, -67, -67, -67, -67, -67, -67, -67, -67 + }, + + { + 23, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, -68, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 123, -68, 123, 123, 123, 123 + }, + + { + 23, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, -69, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 123, -69, 123, 123, 123, 123 + + }, + + { + 23, -70, -70, -70, -70, -70, -70, -70, -70, -70, + -70, 115, -70, -70, -70, -70, -70, -70, -70, -70, + -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, + -70, -70, -70, -70, -70, -70, -70, -70, -70, -70 + }, + + { + 23, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 126, 124, 124, 127, 128, 124, 124 + }, + + { + 23, 129, 129, 129, 129, 129, 129, 129, -72, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129 + }, + + { + 23, 129, 129, 129, 129, 129, 129, 129, -73, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129 + }, + + { + 23, -74, -74, -74, -74, -74, -74, -74, 130, -74, + -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, + -74, -74, -74, -74, -74, -74, -74, -74, 131, 131, + 131, 131, 131, 131, 131, -74, 131, 131, -74, -74 + + }, + + { + 23, -75, -75, -75, -75, -75, 112, -75, -75, -75, + -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, + -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, + -75, -75, -75, -75, -75, -75, -75, -75, -75, -75 + }, + + { + 23, -76, 76, 76, 76, -76, -76, -76, -76, -76, + -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, + -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, + -76, -76, -76, -76, -76, -76, -76, -76, -76, -76 + }, + + { + 23, -77, -77, -77, -77, 77, -77, 77, -77, 77, + 77, -77, -77, -77, 77, 77, -77, 77, -77, 77, + + -77, -77, -77, -77, 77, 77, 77, 77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77 + }, + + { + 23, -78, -78, -78, -78, 77, -78, 77, -78, 77, + 77, -78, -78, -78, 77, 77, -78, 77, -78, 77, + -78, -78, -78, -78, 77, 77, 77, 77, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78 + }, + + { + 23, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79 + + }, + + { + 23, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + 80, 80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80 + }, + + { + 23, -81, -81, -81, -81, -81, -81, -81, 79, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + 132, 132, -81, -81, -81, -81, -81, -81, 132, 132, + 132, 132, 132, 132, 132, -81, 132, 132, -81, -81 + }, + + { + 23, 133, 133, -82, -82, 134, 133, 134, 133, 134, + 134, 133, 133, 133, 134, 134, 133, 134, 133, 134, + + 133, 133, 133, 133, 134, 134, 134, 134, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133 + }, + + { + 23, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83 + }, + + { + 23, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + 84, 84, -84, -84, -84, -84, -84, -84, -84, -84, + 88, -84, -84, -84, -84, -84, -84, -84, -84, -84 + + }, + + { + 23, -85, -85, -85, -85, 135, -85, 135, -85, 135, + 135, -85, -85, -85, 135, 135, -85, 135, -85, 135, + -85, -85, -85, -85, 135, 135, 135, 135, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85 + }, + + { + 23, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, 136, -86, + 137, 137, -86, -86, -86, -86, -86, -86, -86, -86, + 88, -86, -86, -86, -86, -86, -86, -86, -86, -86 + }, + + { + 23, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, 86, -87, + + 87, 87, -87, -87, -87, -87, -87, -87, -87, -87, + 88, -87, -87, -87, -87, -87, -87, -87, -87, -87 + }, + + { + 23, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, 138, -88, 138, -88, -88, + 139, 139, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88 + }, + + { + 23, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + 140, 140, -89, -89, -89, -89, -89, -89, 140, 140, + 140, 140, 140, 140, 140, -89, 140, 140, -89, -89 + + }, + + { + 23, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + 141, 141, -90, -90, -90, -90, -90, -90, 141, 141, + 141, 141, 141, 141, 141, -90, 141, 141, -90, -90 + }, + + { + 23, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + 91, 91, -91, -91, -91, -91, -91, -91, 91, 91, + 91, 91, 91, 91, 91, -91, 91, 91, -91, -91 + }, + + { + 23, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92 + }, + + { + 23, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93 + }, + + { + 23, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, 142, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94 + + }, + + { + 23, -95, -95, -95, -95, 77, -95, 77, -95, 77, + 77, -95, -95, -95, 77, 77, -95, 77, -95, 77, + -95, -95, -95, -95, 77, 77, 77, 77, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95 + }, + + { + 23, -96, -96, -96, -96, 77, -96, 77, -96, 77, + 77, -96, -96, -96, 77, 77, -96, 77, -96, 77, + -96, -96, -96, -96, 77, 77, 77, 77, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96 + }, + + { + 23, -97, -97, -97, -97, 77, -97, 77, -97, 77, + 77, -97, -97, -97, 77, 77, -97, 77, -97, 77, + + -97, -97, -97, -97, 77, 77, 77, 77, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97 + }, + + { + 23, -98, -98, -98, -98, 77, -98, 77, -98, 77, + 77, -98, -98, -98, 77, 77, -98, 77, -98, 77, + -98, -98, -98, -98, 77, 77, 77, 77, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98 + }, + + { + 23, -99, -99, -99, -99, -99, -99, -99, 99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + 99, 99, -99, -99, -99, -99, -99, -99, 99, 99, + 99, 99, 99, 99, 99, -99, 99, 99, -99, -99 + + }, + + { + 23, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 + }, + + { + 23, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101 + }, + + { + 23, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102 + }, + + { + 23, -103, -103, -103, -103, -103, 143, -103, -103, -103, + -103, 144, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103 + }, + + { + 23, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104 + + }, + + { + 23, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105 + }, + + { + 23, 106, 106, 106, 106, 106, 106, 106, 106, 106, + 106, -106, 106, 106, 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, 106, 106, 106, 106 + }, + + { + 23, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, -107, 107, 107, 107, 107, -107, + + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107 + }, + + { + 23, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, 108, -108, -108, -108, -108, 109, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108 + }, + + { + 23, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109 + + }, + + { + 23, -110, -110, -110, -110, 145, -110, 145, -110, 145, + 145, -110, -110, -110, 145, 145, -110, 145, -110, 145, + -110, -110, -110, -110, 145, 145, 145, 145, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110 + }, + + { + 23, 111, 111, 111, 111, 111, -111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111 + }, + + { + 23, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112 + }, + + { + 23, 113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, -113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, 113, 113 + }, + + { + 23, 114, 114, 114, 114, 114, 114, 114, 114, 114, + 114, -114, 114, 114, 114, 114, 114, 114, 114, 114, + 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, + 114, 114, 114, 114, 114, 114, 114, 114, 114, 114 + + }, + + { + 23, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115 + }, + + { + 23, -116, 116, 117, 117, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, 118, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116 + }, + + { + 23, -117, 119, 119, 119, -117, -117, -117, -117, -117, + -117, 120, -117, -117, -117, -117, -117, 121, -117, -117, + + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117 + }, + + { + 23, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, 122, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118 + }, + + { + 23, -119, 119, 119, 119, -119, -119, -119, -119, -119, + -119, 120, -119, -119, -119, -119, -119, 121, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119 + + }, + + { + 23, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120 + }, + + { + 23, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, 146, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121 + }, + + { + 23, 147, 148, 117, 117, 147, 147, 147, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 149, 147, 147, + + 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 147, 147, 147 + }, + + { + 23, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, -123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 123, -123, 123, 123, 123, 123 + }, + + { + 23, -124, -124, -124, -124, -124, -124, -124, -124, -124, + -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, + -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, + -124, -124, -124, -124, -124, -124, -124, -124, -124, -124 + + }, + + { + 23, -125, -125, -125, -125, -125, -125, -125, -125, -125, + -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, + 150, -125, -125, -125, -125, -125, -125, -125, -125, -125, + -125, -125, -125, -125, -125, -125, -125, -125, -125, -125 + }, + + { + 23, -126, -126, -126, -126, -126, -126, -126, -126, -126, + -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, + 151, 151, -126, -126, -126, -126, -126, -126, 151, 151, + 151, -126, -126, -126, -126, -126, -126, -126, -126, -126 + }, + + { + 23, -127, -127, -127, -127, -127, -127, -127, -127, -127, + -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, + + 152, 152, -127, -127, -127, -127, -127, -127, 152, 152, + 152, -127, -127, -127, -127, -127, -127, -127, -127, -127 + }, + + { + 23, -128, -128, -128, -128, -128, -128, -128, -128, -128, + -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, + 153, 153, -128, -128, -128, -128, -128, -128, 153, 153, + 153, -128, -128, -128, -128, -128, -128, -128, -128, -128 + }, + + { + 23, 129, 129, 129, 129, 129, 129, 129, -129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129 + + }, + + { + 23, -130, -130, -130, -130, -130, -130, -130, -130, -130, + -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, + -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, + -130, -130, -130, -130, -130, -130, -130, -130, -130, -130 + }, + + { + 23, -131, -131, -131, -131, -131, -131, -131, 130, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + 154, 154, -131, -131, -131, -131, -131, -131, 154, 154, + 154, 154, 154, 154, 154, -131, 154, 154, -131, -131 + }, + + { + 23, -132, -132, -132, -132, -132, -132, -132, 79, -132, + -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, + + 132, 132, -132, -132, -132, -132, -132, -132, 132, 132, + 132, 132, 132, 132, 132, -132, 132, 132, -132, -132 + }, + + { + 23, 133, 133, -133, -133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133 + }, + + { + 23, 133, 133, -134, -134, 134, 133, 134, 133, 134, + 134, 133, 133, 133, 134, 134, 133, 134, 133, 134, + 133, 133, 133, 133, 134, 134, 134, 134, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133 + + }, + + { + 23, -135, -135, -135, -135, 135, -135, 135, -135, 135, + 135, -135, -135, -135, 135, 135, -135, 135, -135, 135, + -135, -135, -135, -135, 135, 135, 135, 135, -135, -135, + -135, -135, -135, -135, -135, -135, -135, -135, -135, -135 + }, + + { + 23, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136 + }, + + { + 23, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + + 137, 137, -137, -137, -137, -137, -137, -137, -137, -137, + 88, -137, -137, -137, -137, -137, -137, -137, -137, -137 + }, + + { + 23, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + 139, 139, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138 + }, + + { + 23, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + 139, 139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139 + + }, + + { + 23, -140, -140, -140, -140, -140, 155, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + 140, 140, -140, -140, -140, -140, -140, -140, 140, 140, + 140, 140, 140, 140, 140, -140, 140, 140, -140, -140 + }, + + { + 23, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, 156, -141, -141, -141, -141, -141, -141, -141, -141, + 141, 141, -141, -141, -141, -141, -141, -141, 141, 141, + 141, 141, 141, 141, 141, -141, 141, 141, -141, -141 + }, + + { + 23, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + + 157, 157, -142, -142, -142, -142, -142, -142, 157, 157, + 157, 157, 157, 157, 157, -142, 157, 157, -142, -142 + }, + + { + 23, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143 + }, + + { + 23, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144 + + }, + + { + 23, -145, -145, -145, -145, 145, -145, 145, -145, 145, + 145, -145, -145, -145, 145, 145, -145, 145, -145, 145, + -145, -145, -145, -145, 145, 145, 145, 145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145 + }, + + { + 23, 158, 159, 160, 160, 158, 158, 158, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 161, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 158, 158, 158 + }, + + { + 23, 147, 148, 117, 117, 147, 147, 147, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 149, 147, 147, + + 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 147, 147, 147 + }, + + { + 23, 147, 148, 117, 117, 147, 147, 147, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 149, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 147, 147, 147 + }, + + { + 23, 147, 148, 117, 117, 147, 147, 147, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 162, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 147, 147, 147 + + }, + + { + 23, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + 163, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150 + }, + + { + 23, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + 164, 164, -151, -151, -151, -151, -151, -151, 164, 164, + 164, -151, -151, -151, -151, -151, -151, -151, -151, -151 + }, + + { + 23, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + + 165, 165, -152, -152, -152, -152, -152, -152, 165, 165, + 165, -152, -152, -152, -152, -152, -152, -152, -152, -152 + }, + + { + 23, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + 166, 166, -153, -153, -153, -153, -153, -153, 166, 166, + 166, -153, -153, -153, -153, -153, -153, -153, -153, -153 + }, + + { + 23, -154, -154, -154, -154, -154, -154, -154, 130, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + 154, 154, -154, -154, -154, -154, -154, -154, 154, 154, + 154, 154, 154, 154, 154, -154, 154, 154, -154, -154 + + }, + + { + 23, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155 + }, + + { + 23, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156 + }, + + { + 23, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + + 157, 157, -157, -157, -157, -157, -157, -157, 157, 157, + 157, 157, 157, 157, 157, -157, 157, 157, -157, 167 + }, + + { + 23, 158, 159, 160, 160, 158, 158, 158, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 161, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 158, 158, 158 + }, + + { + 23, 158, 159, 160, 160, 158, 158, 158, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 161, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 158, 158, 158 + + }, + + { + 23, -160, 119, 119, 119, -160, -160, -160, -160, -160, + -160, 120, -160, -160, -160, -160, -160, 121, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160 + }, + + { + 23, 158, 159, 160, 160, 158, 158, 158, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 168, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 158, 158, 158 + }, + + { + 23, 147, 148, 117, 117, 147, 147, 147, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 162, 147, 147, + + 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 147, 147, 147 + }, + + { + 23, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163 + }, + + { + 23, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + 169, 169, -164, -164, -164, -164, -164, -164, 169, 169, + 169, -164, -164, -164, -164, -164, -164, -164, -164, -164 + + }, + + { + 23, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + 170, 170, -165, -165, -165, -165, -165, -165, 170, 170, + 170, -165, -165, -165, -165, -165, -165, -165, -165, -165 + }, + + { + 23, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166 + }, + + { + 23, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167 + }, + + { + 23, 158, 159, 160, 160, 158, 158, 158, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 168, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 158, 158, 158 + }, + + { + 23, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + 171, 171, -169, -169, -169, -169, -169, -169, 171, 171, + 171, -169, -169, -169, -169, -169, -169, -169, -169, -169 + + }, + + { + 23, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + 172, 172, -170, -170, -170, -170, -170, -170, 172, 172, + 172, -170, -170, -170, -170, -170, -170, -170, -170, -170 + }, + + { + 23, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + 173, 173, -171, -171, -171, -171, -171, -171, 173, 173, + 173, -171, -171, -171, -171, -171, -171, -171, -171, -171 + }, + + { + 23, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172 + }, + + { + 23, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + 174, 174, -173, -173, -173, -173, -173, -173, 174, 174, + 174, -173, -173, -173, -173, -173, -173, -173, -173, -173 + }, + + { + 23, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + 175, 175, -174, -174, -174, -174, -174, -174, 175, 175, + 175, -174, -174, -174, -174, -174, -174, -174, -174, -174 + + }, + + { + 23, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + 172, 172, -175, -175, -175, -175, -175, -175, 172, 172, + 172, -175, -175, -175, -175, -175, -175, -175, -175, -175 + }, + + } ; + +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 yynoreturn yy_fatal_error ( const 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 = (int) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; +#define YY_NUM_RULES 74 +#define YY_END_OF_BUFFER 75 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static const flex_int16_t yy_accept[176] = + { 0, + 0, 0, 10, 10, 0, 0, 0, 0, 9, 9, + 0, 0, 18, 18, 0, 0, 0, 0, 0, 0, + 0, 0, 75, 73, 1, 1, 64, 35, 64, 73, + 63, 13, 50, 51, 63, 63, 63, 63, 66, 63, + 52, 63, 63, 63, 72, 72, 72, 72, 72, 72, + 54, 10, 16, 5, 5, 6, 6, 40, 37, 9, + 21, 16, 19, 18, 18, 18, 18, 22, 22, 16, + 28, 32, 32, 34, 38, 1, 64, 49, 29, 65, + 30, 1, 43, 67, 2, 67, 66, 70, 60, 59, + 55, 42, 44, 62, 46, 48, 45, 47, 72, 8, + + 14, 12, 41, 11, 53, 10, 5, 7, 4, 3, + 40, 39, 9, 21, 20, 18, 18, 18, 18, 17, + 18, 18, 22, 25, 26, 24, 24, 25, 32, 31, + 33, 30, 1, 1, 2, 68, 67, 71, 69, 60, + 59, 61, 36, 15, 3, 18, 18, 18, 18, 26, + 24, 24, 27, 33, 57, 56, 61, 18, 18, 18, + 18, 18, 26, 24, 24, 27, 58, 18, 24, 24, + 24, 23, 24, 24, 24 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 2, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 20, 20, + 20, 20, 20, 20, 20, 21, 21, 22, 23, 24, + 25, 26, 27, 7, 28, 29, 28, 28, 30, 28, + 31, 31, 31, 31, 31, 31, 31, 32, 31, 31, + 31, 31, 31, 31, 33, 31, 31, 34, 31, 31, + 16, 35, 16, 9, 31, 7, 28, 29, 28, 28, + + 30, 28, 31, 31, 31, 31, 31, 31, 31, 32, + 31, 31, 31, 31, 31, 31, 36, 31, 31, 37, + 31, 31, 38, 7, 39, 7, 1, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31 + } ; + +/* 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 "psqlscan.l" + +#line 44 "psqlscan.l" + +/* LCOV_EXCL_START */ + +#include "fe_utils/psqlscan_int.h" + +/* + * We must have a typedef YYSTYPE for yylex's first argument, but this lexer + * doesn't presently make use of that argument, so just declare it as int. + */ +typedef int YYSTYPE; + +/* + * Set the type of yyextra; we use it as a pointer back to the containing + * PsqlScanState. + */ +#define YY_EXTRA_TYPE PsqlScanState + + +/* Return values from yylex() */ +#define LEXRES_EOL 0 /* end of input */ +#define LEXRES_SEMI 1 /* command-terminating semicolon found */ +#define LEXRES_BACKSLASH 2 /* backslash command start */ + + +#define ECHO psqlscan_emit(cur_state, yytext, yyleng) + +/* + * 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 psql_yyget_column(yyscan_t yyscanner); +extern void psql_yyset_column(int column_no, yyscan_t yyscanner); + +#line 2018 "psqlscan.c" +#define YY_NO_INPUT 1 +/* + * All of the following definitions and rules should exactly match + * src/backend/parser/scan.l so far as the flex patterns are concerned. + * The rule bodies are just ECHO as opposed to what the backend does, + * however. (But be sure to duplicate code that affects the lexing process, + * such as BEGIN() and yyless().) Also, psqlscan uses a single <> rule + * whereas scan.l has a separate one for each exclusive state. + */ +/* + * 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: + * bit string literal + * extended C-style comments + * delimited identifiers (double-quoted identifiers) + * hexadecimal numeric string + * standard quoted strings + * quote stop (detect continued strings) + * extended quoted strings (support backslash escape sequences) + * $foo$ quoted strings + * quoted identifier with Unicode escapes + * quoted string with Unicode escapes + * + * Note: we intentionally don't mimic the backend's state; we have + * no need to distinguish it from state, and no good way to get out + * of it in error cases. The backend just throws yyerror() in those + * cases, but that's not an option here. + */ + +/* + * 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. + */ +/* + * 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... + */ +/* If we see {quote} then {quotecontinue}, the quoted string continues */ +/* + * {quotecontinuefail} is needed to avoid lexer backup when we fail to match + * {quotecontinue}. It might seem that this could just be {whitespace}*, + * but if there's a dash after {whitespace_with_newline}, it must be consumed + * to see if there's another dash --- which would start a {comment} and thus + * allow continuation of the {quotecontinue} token. + */ +/* 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 */ +/* 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. + */ +/* Quoted identifier with Unicode escapes */ +/* Quoted string 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 */ +/* + * These operator-like tokens (unlike the above ones) also match the {operator} + * rule, which means that they might be overridden by a longer match if they + * are followed by a comment start or a + or - character. Accordingly, if you + * add to this list, you must also add corresponding code to the {operator} + * block to return the correct token in such cases. (This is not needed in + * psqlscan.l since the token value is ignored there.) + */ +/* + * "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. + */ +/* psql-specific: characters allowed in variable names */ +/* + * 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 2176 "psqlscan.c" + +#define INITIAL 0 +#define xb 1 +#define xc 2 +#define xd 3 +#define xh 4 +#define xq 5 +#define xqs 6 +#define xe 7 +#define xdolq 8 +#define xui 9 +#define xus 10 + +#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 +#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; + int yy_n_chars; + int 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; + + }; /* 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 + +int yylex_init (yyscan_t* scanner); + +int 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 yylex_destroy ( yyscan_t yyscanner ); + +int yyget_debug ( yyscan_t yyscanner ); + +void yyset_debug ( int debug_flag , yyscan_t yyscanner ); + +YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); + +void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); + +FILE *yyget_in ( yyscan_t yyscanner ); + +void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); + +FILE *yyget_out ( yyscan_t yyscanner ); + +void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); + + int yyget_leng ( yyscan_t yyscanner ); + +char *yyget_text ( yyscan_t yyscanner ); + +int yyget_lineno ( yyscan_t yyscanner ); + +void yyset_lineno ( int _line_number , yyscan_t yyscanner ); + +int yyget_column ( yyscan_t yyscanner ); + +void yyset_column ( int _column_no , yyscan_t yyscanner ); + +YYSTYPE * yyget_lval ( yyscan_t yyscanner ); + +void yyset_lval ( YYSTYPE * yylval_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 yywrap ( yyscan_t yyscanner ); +#else +extern int yywrap ( yyscan_t yyscanner ); +#endif +#endif + +#ifndef YY_NO_UNPUT + +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const 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 +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#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 do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) +#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 = '*'; \ + int 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 = (int) fread(buf, 1, (yy_size_t) 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 yylex \ + (YYSTYPE * yylval_param , yyscan_t yyscanner); + +#define YY_DECL int yylex \ + (YYSTYPE * yylval_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 /*LINTED*/break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yylval = yylval_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 ) { + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); + } + + yy_load_buffer_state( yyscanner ); + } + + { +#line 358 "psqlscan.l" + + + +#line 362 "psqlscan.l" + /* Declare some local variables inside yylex(), for convenience */ + PsqlScanState cur_state = yyextra; + PQExpBuffer output_buf = cur_state->output_buf; + + /* + * Force flex into the state indicated by start_state. This has a + * couple of purposes: it lets some of the functions below set a new + * starting state without ugly direct access to flex variables, and it + * allows us to transition from one flex lexer to another so that we + * can lex different parts of the source string using separate lexers. + */ + BEGIN(cur_state->start_state); + + +#line 2477 "psqlscan.c" + + while ( /*CONSTCOND*/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 = yyg->yy_start; +yy_match: + while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 ) + ++yy_cp; + + yy_current_state = -yy_current_state; + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + 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 376 "psqlscan.l" +{ + /* + * Note that the whitespace rule includes both true + * whitespace and single-line ("--" style) comments. + * We suppress whitespace at the start of the query + * buffer. We also suppress all single-line comments, + * which is pretty dubious but is the historical + * behavior. + */ + if (!(output_buf->len == 0 || yytext[0] == '-')) + ECHO; + } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 389 "psqlscan.l" +{ + cur_state->xcdepth = 0; + BEGIN(xc); + /* Put back any characters past slash-star; see above */ + yyless(2); + ECHO; + } + YY_BREAK + +case 3: +YY_RULE_SETUP +#line 398 "psqlscan.l" +{ + cur_state->xcdepth++; + /* Put back any characters past slash-star; see above */ + yyless(2); + ECHO; + } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 405 "psqlscan.l" +{ + if (cur_state->xcdepth <= 0) + BEGIN(INITIAL); + else + cur_state->xcdepth--; + ECHO; + } + YY_BREAK +case 5: +/* rule 5 can match eol */ +YY_RULE_SETUP +#line 413 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 417 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 421 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +/* */ +case 8: +YY_RULE_SETUP +#line 426 "psqlscan.l" +{ + BEGIN(xb); + ECHO; + } + YY_BREAK +case 9: +/* rule 9 can match eol */ +#line 431 "psqlscan.l" +case 10: +/* rule 10 can match eol */ +YY_RULE_SETUP +#line 431 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 435 "psqlscan.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. + */ + BEGIN(xh); + ECHO; + } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 446 "psqlscan.l" +{ + yyless(1); /* eat only 'n' this time */ + ECHO; + } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 451 "psqlscan.l" +{ + if (cur_state->std_strings) + BEGIN(xq); + else + BEGIN(xe); + ECHO; + } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 458 "psqlscan.l" +{ + BEGIN(xe); + ECHO; + } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 462 "psqlscan.l" +{ + BEGIN(xus); + ECHO; + } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 467 "psqlscan.l" +{ + /* + * When we are scanning a quoted string and see an end + * quote, we must look ahead for a possible continuation. + * If we don't see one, we know the end quote was in fact + * the end of the string. To reduce the lexer table size, + * we use a single "xqs" state to do the lookahead for all + * types of strings. + */ + cur_state->state_before_str_stop = YYSTATE; + BEGIN(xqs); + ECHO; + } + YY_BREAK +case 17: +/* rule 17 can match eol */ +YY_RULE_SETUP +#line 480 "psqlscan.l" +{ + /* + * Found a quote continuation, so return to the in-quote + * state and continue scanning the literal. Nothing is + * added to the literal's contents. + */ + BEGIN(cur_state->state_before_str_stop); + ECHO; + } + YY_BREAK +case 18: +/* rule 18 can match eol */ +#line 490 "psqlscan.l" +case 19: +/* rule 19 can match eol */ +YY_RULE_SETUP +#line 490 "psqlscan.l" +{ + /* + * Failed to see a quote continuation. Throw back + * everything after the end quote, and handle the string + * according to the state we were in previously. + */ + yyless(0); + BEGIN(INITIAL); + /* There's nothing to echo ... */ + } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 501 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 21: +/* rule 21 can match eol */ +YY_RULE_SETUP +#line 504 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 22: +/* rule 22 can match eol */ +YY_RULE_SETUP +#line 507 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 510 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 513 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 25: +/* rule 25 can match eol */ +YY_RULE_SETUP +#line 516 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 519 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 522 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 525 "psqlscan.l" +{ + /* This is only needed for \ just before EOF */ + ECHO; + } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 530 "psqlscan.l" +{ + cur_state->dolqstart = pg_strdup(yytext); + BEGIN(xdolq); + ECHO; + } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 535 "psqlscan.l" +{ + /* throw back all but the initial "$" */ + yyless(1); + ECHO; + } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 540 "psqlscan.l" +{ + if (strcmp(yytext, cur_state->dolqstart) == 0) + { + free(cur_state->dolqstart); + cur_state->dolqstart = NULL; + BEGIN(INITIAL); + } + 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$ + */ + yyless(yyleng - 1); + } + ECHO; + } + YY_BREAK +case 32: +/* rule 32 can match eol */ +YY_RULE_SETUP +#line 558 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 561 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 34: +YY_RULE_SETUP +#line 564 "psqlscan.l" +{ + /* This is only needed for $ inside the quoted text */ + ECHO; + } + YY_BREAK +case 35: +YY_RULE_SETUP +#line 569 "psqlscan.l" +{ + BEGIN(xd); + ECHO; + } + YY_BREAK +case 36: +YY_RULE_SETUP +#line 573 "psqlscan.l" +{ + BEGIN(xui); + ECHO; + } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 577 "psqlscan.l" +{ + BEGIN(INITIAL); + ECHO; + } + YY_BREAK +case 38: +YY_RULE_SETUP +#line 581 "psqlscan.l" +{ + BEGIN(INITIAL); + ECHO; + } + YY_BREAK +case 39: +YY_RULE_SETUP +#line 585 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 40: +/* rule 40 can match eol */ +YY_RULE_SETUP +#line 588 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 41: +YY_RULE_SETUP +#line 592 "psqlscan.l" +{ + /* throw back all but the initial u/U */ + yyless(1); + ECHO; + } + YY_BREAK +case 42: +YY_RULE_SETUP +#line 598 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 43: +YY_RULE_SETUP +#line 602 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 44: +YY_RULE_SETUP +#line 606 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 45: +YY_RULE_SETUP +#line 610 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 46: +YY_RULE_SETUP +#line 614 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 47: +YY_RULE_SETUP +#line 618 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 48: +YY_RULE_SETUP +#line 622 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 49: +YY_RULE_SETUP +#line 626 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +/* + * These rules are specific to psql --- they implement parenthesis + * counting and detection of command-ending semicolon. These must + * appear before the {self} rule so that they take precedence over it. + */ +case 50: +YY_RULE_SETUP +#line 636 "psqlscan.l" +{ + cur_state->paren_depth++; + ECHO; + } + YY_BREAK +case 51: +YY_RULE_SETUP +#line 641 "psqlscan.l" +{ + if (cur_state->paren_depth > 0) + cur_state->paren_depth--; + ECHO; + } + YY_BREAK +case 52: +YY_RULE_SETUP +#line 647 "psqlscan.l" +{ + ECHO; + if (cur_state->paren_depth == 0 && cur_state->begin_depth == 0) + { + /* Terminate lexing temporarily */ + cur_state->start_state = YY_START; + cur_state->identifier_count = 0; + return LEXRES_SEMI; + } + } + YY_BREAK +/* + * psql-specific rules to handle backslash commands and variable + * substitution. We want these before {self}, also. + */ +case 53: +YY_RULE_SETUP +#line 663 "psqlscan.l" +{ + /* Force a semi-colon or colon into the query buffer */ + psqlscan_emit(cur_state, yytext + 1, 1); + if (yytext[1] == ';') + cur_state->identifier_count = 0; + } + YY_BREAK +case 54: +YY_RULE_SETUP +#line 670 "psqlscan.l" +{ + /* Terminate lexing temporarily */ + cur_state->start_state = YY_START; + return LEXRES_BACKSLASH; + } + YY_BREAK +case 55: +YY_RULE_SETUP +#line 676 "psqlscan.l" +{ + /* Possible psql variable substitution */ + char *varname; + char *value; + + varname = psqlscan_extract_substring(cur_state, + yytext + 1, + yyleng - 1); + if (cur_state->callbacks->get_variable) + value = cur_state->callbacks->get_variable(varname, + PQUOTE_PLAIN, + cur_state->cb_passthrough); + else + value = NULL; + + if (value) + { + /* It is a variable, check for recursion */ + if (psqlscan_var_is_current_source(cur_state, varname)) + { + /* Recursive expansion --- don't go there */ + pg_log_warning("skipping recursive expansion of variable \"%s\"", + varname); + /* Instead copy the string as is */ + ECHO; + } + else + { + /* OK, perform substitution */ + psqlscan_push_new_buffer(cur_state, value, varname); + /* yy_scan_string already made buffer active */ + } + free(value); + } + else + { + /* + * if the variable doesn't exist we'll copy the string + * as is + */ + ECHO; + } + + free(varname); + } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 722 "psqlscan.l" +{ + psqlscan_escape_variable(cur_state, yytext, yyleng, + PQUOTE_SQL_LITERAL); + } + YY_BREAK +case 57: +YY_RULE_SETUP +#line 727 "psqlscan.l" +{ + psqlscan_escape_variable(cur_state, yytext, yyleng, + PQUOTE_SQL_IDENT); + } + YY_BREAK +case 58: +YY_RULE_SETUP +#line 732 "psqlscan.l" +{ + psqlscan_test_variable(cur_state, yytext, yyleng); + } + YY_BREAK +/* + * These rules just avoid the need for scanner backup if one of the + * three rules above fails to match completely. + */ +case 59: +YY_RULE_SETUP +#line 741 "psqlscan.l" +{ + /* Throw back everything but the colon */ + yyless(1); + ECHO; + } + YY_BREAK +case 60: +YY_RULE_SETUP +#line 747 "psqlscan.l" +{ + /* Throw back everything but the colon */ + yyless(1); + ECHO; + } + YY_BREAK +case 61: +YY_RULE_SETUP +#line 753 "psqlscan.l" +{ + /* Throw back everything but the colon */ + yyless(1); + ECHO; + } + YY_BREAK +case 62: +YY_RULE_SETUP +#line 758 "psqlscan.l" +{ + /* Throw back everything but the colon */ + yyless(1); + ECHO; + } + YY_BREAK +/* + * Back to backend-compatible rules. + */ +case 63: +YY_RULE_SETUP +#line 768 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 64: +YY_RULE_SETUP +#line 772 "psqlscan.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. + */ + if (nchars > 1 && + (yytext[nchars - 1] == '+' || + yytext[nchars - 1] == '-')) + { + int ic; + + for (ic = nchars - 2; ic >= 0; ic--) + { + char c = yytext[ic]; + if (c == '~' || c == '!' || c == '@' || + c == '#' || c == '^' || c == '&' || + c == '|' || c == '`' || c == '?' || + c == '%') + break; + } + if (ic < 0) + { + /* + * didn't find a qualifying character, so remove + * all trailing [+-] + */ + do { + nchars--; + } while (nchars > 1 && + (yytext[nchars - 1] == '+' || + yytext[nchars - 1] == '-')); + } + } + + if (nchars < yyleng) + { + /* Strip the unwanted chars from the token */ + yyless(nchars); + } + ECHO; + } + YY_BREAK +case 65: +YY_RULE_SETUP +#line 839 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 66: +YY_RULE_SETUP +#line 843 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 67: +YY_RULE_SETUP +#line 846 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 68: +YY_RULE_SETUP +#line 849 "psqlscan.l" +{ + /* throw back the .., and treat as integer */ + yyless(yyleng - 2); + ECHO; + } + YY_BREAK +case 69: +YY_RULE_SETUP +#line 854 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case 70: +YY_RULE_SETUP +#line 857 "psqlscan.l" +{ + /* + * throw back the [Ee], and figure out whether what + * remains is an {integer} or {decimal}. + * (in psql, we don't actually care...) + */ + yyless(yyleng - 1); + ECHO; + } + YY_BREAK +case 71: +YY_RULE_SETUP +#line 866 "psqlscan.l" +{ + /* throw back the [Ee][+-], and proceed as above */ + yyless(yyleng - 2); + ECHO; + } + YY_BREAK +case 72: +YY_RULE_SETUP +#line 873 "psqlscan.l" +{ + /* + * We need to track if we are inside a BEGIN .. END block + * in a function definition, so that semicolons contained + * therein don't terminate the whole statement. Short of + * writing a full parser here, the following heuristic + * should work. First, we track whether the beginning of + * the statement matches CREATE [OR REPLACE] + * {FUNCTION|PROCEDURE} + */ + + if (cur_state->identifier_count == 0) + memset(cur_state->identifiers, 0, sizeof(cur_state->identifiers)); + + if (pg_strcasecmp(yytext, "create") == 0 || + pg_strcasecmp(yytext, "function") == 0 || + pg_strcasecmp(yytext, "procedure") == 0 || + pg_strcasecmp(yytext, "or") == 0 || + pg_strcasecmp(yytext, "replace") == 0) + { + if (cur_state->identifier_count < sizeof(cur_state->identifiers)) + cur_state->identifiers[cur_state->identifier_count] = pg_tolower((unsigned char) yytext[0]); + } + + cur_state->identifier_count++; + + if (cur_state->identifiers[0] == 'c' && + (cur_state->identifiers[1] == 'f' || cur_state->identifiers[1] == 'p' || + (cur_state->identifiers[1] == 'o' && cur_state->identifiers[2] == 'r' && + (cur_state->identifiers[3] == 'f' || cur_state->identifiers[3] == 'p'))) && + cur_state->paren_depth == 0) + { + if (pg_strcasecmp(yytext, "begin") == 0) + cur_state->begin_depth++; + else if (pg_strcasecmp(yytext, "case") == 0) + { + /* + * CASE also ends with END. We only need to track + * this if we are already inside a BEGIN. + */ + if (cur_state->begin_depth >= 1) + cur_state->begin_depth++; + } + else if (pg_strcasecmp(yytext, "end") == 0) + { + if (cur_state->begin_depth > 0) + cur_state->begin_depth--; + } + } + + ECHO; + } + YY_BREAK +case 73: +YY_RULE_SETUP +#line 926 "psqlscan.l" +{ + ECHO; + } + YY_BREAK +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(xb): +case YY_STATE_EOF(xc): +case YY_STATE_EOF(xd): +case YY_STATE_EOF(xh): +case YY_STATE_EOF(xq): +case YY_STATE_EOF(xqs): +case YY_STATE_EOF(xe): +case YY_STATE_EOF(xdolq): +case YY_STATE_EOF(xui): +case YY_STATE_EOF(xus): +#line 930 "psqlscan.l" +{ + if (cur_state->buffer_stack == NULL) + { + cur_state->start_state = YY_START; + return LEXRES_EOL; /* end of input reached */ + } + + /* + * We were expanding a variable, so pop the inclusion + * stack and keep lexing + */ + psqlscan_pop_buffer_stack(cur_state); + psqlscan_select_top_buffer(cur_state); + } + YY_BREAK +case 74: +YY_RULE_SETUP +#line 945 "psqlscan.l" +YY_FATAL_ERROR( "flex scanner jammed" ); + YY_BREAK +#line 3344 "psqlscan.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 + * 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 ( 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 user's declarations */ +} /* end of 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; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = yyg->yytext_ptr; + 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 + { + int 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_LVALUE; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int 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. */ + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = NULL; + + 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; + 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 ((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. */ + int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); + } + + 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) +{ + yy_state_type yy_current_state; + char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = 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_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)]; + } + + 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) +{ + int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + + yy_current_state = yy_nxt[yy_current_state][1]; + yy_is_jam = (yy_current_state <= 0); + + (void)yyg; + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + +#endif + +#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 */ + int offset = (int) (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. */ + yyrestart( yyin , yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( 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 yyrestart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); + } + + yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner); + yy_load_buffer_state( yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void 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 + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + 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; + yy_load_buffer_state( yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void 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 yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in 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 *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file , yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * @param yyscanner The scanner object. + */ + void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree( (void *) b->yy_ch_buf , yyscanner ); + + yyfree( (void *) b , yyscanner ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_flush_buffer( b , yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from 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 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 ) + 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. + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(yyscanner); + + /* This block is copied from yy_switch_to_buffer. */ + 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; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void yypop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void 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; /* After all that talk, this was set to 1 anyways... */ + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in 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. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)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 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 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 NULL; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = (int) (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 = NULL; + 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; + + yy_switch_to_buffer( b , yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to 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 + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) +{ + + return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_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. + */ +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n , yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n , yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + 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. + */ +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int yyget_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int yyget_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +int yyget_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *yyget_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** 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 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 line number + * @param yyscanner The scanner object. + */ +void yyset_lineno (int _line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); + + yylineno = _line_number; +} + +/** Set the current column. + * @param _column_no column number + * @param yyscanner The scanner object. + */ +void yyset_column (int _column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + YY_FATAL_ERROR( "yyset_column called with no buffer" ); + + yycolumn = _column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param _in_str A readable stream. + * @param yyscanner The scanner object. + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * _in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = _in_str ; +} + +void yyset_out (FILE * _out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = _out_str ; +} + +int yyget_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void yyset_debug (int _bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = _bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +YYSTYPE * yyget_lval (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylval; +} + +void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylval = yylval_param; +} + +/* User-visible API */ + +/* 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 yylex_init(yyscan_t* ptr_yy_globals) +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) 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 ); +} + +/* yylex_init_extra has the same functionality as 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 yyalloc in + * the yyextra field. + */ +int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) +{ + struct yyguts_t dummy_yyguts; + + yyset_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + 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)); + + yyset_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +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 yylex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = NULL; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = NULL; + 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 = NULL; + yyout = NULL; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + yyfree(yyg->yy_buffer_stack , yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + yyfree( yyg->yy_start_stack , yyscanner ); + yyg->yy_start_stack = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + yyfree ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (const char * s , yyscan_t yyscanner) +{ + int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + return malloc(size); +} + +void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return realloc(ptr, size); +} + +void yyfree (void * ptr , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 945 "psqlscan.l" + + +/* LCOV_EXCL_STOP */ + +/* + * Create a lexer working state struct. + * + * callbacks is a struct of function pointers that encapsulate some + * behavior we need from the surrounding program. This struct must + * remain valid for the lifespan of the PsqlScanState. + */ +PsqlScanState +psql_scan_create(const PsqlScanCallbacks *callbacks) +{ + PsqlScanState state; + + state = (PsqlScanStateData *) pg_malloc0(sizeof(PsqlScanStateData)); + + state->callbacks = callbacks; + + yylex_init(&state->scanner); + + yyset_extra(state, state->scanner); + + psql_scan_reset(state); + + return state; +} + +/* + * Destroy a lexer working state struct, releasing all resources. + */ +void +psql_scan_destroy(PsqlScanState state) +{ + psql_scan_finish(state); + + psql_scan_reset(state); + + yylex_destroy(state->scanner); + + free(state); +} + +/* + * Set the callback passthrough pointer for the lexer. + * + * This could have been integrated into psql_scan_create, but keeping it + * separate allows the application to change the pointer later, which might + * be useful. + */ +void +psql_scan_set_passthrough(PsqlScanState state, void *passthrough) +{ + state->cb_passthrough = passthrough; +} + +/* + * Set up to perform lexing of the given input line. + * + * The text at *line, extending for line_len bytes, will be scanned by + * subsequent calls to the psql_scan routines. psql_scan_finish should + * be called when scanning is complete. Note that the lexer retains + * a pointer to the storage at *line --- this string must not be altered + * or freed until after psql_scan_finish is called. + * + * encoding is the libpq identifier for the character encoding in use, + * and std_strings says whether standard_conforming_strings is on. + */ +void +psql_scan_setup(PsqlScanState state, + const char *line, int line_len, + int encoding, bool std_strings) +{ + /* Mustn't be scanning already */ + Assert(state->scanbufhandle == NULL); + Assert(state->buffer_stack == NULL); + + /* Do we need to hack the character set encoding? */ + state->encoding = encoding; + state->safe_encoding = pg_valid_server_encoding_id(encoding); + + /* Save standard-strings flag as well */ + state->std_strings = std_strings; + + /* Set up flex input buffer with appropriate translation and padding */ + state->scanbufhandle = psqlscan_prepare_buffer(state, line, line_len, + &state->scanbuf); + state->scanline = line; + + /* Set lookaside data in case we have to map unsafe encoding */ + state->curline = state->scanbuf; + state->refline = state->scanline; +} + +/* + * Do lexical analysis of SQL command text. + * + * The text previously passed to psql_scan_setup is scanned, and appended + * (possibly with transformation) to query_buf. + * + * The return value indicates the condition that stopped scanning: + * + * PSCAN_SEMICOLON: found a command-ending semicolon. (The semicolon is + * transferred to query_buf.) The command accumulated in query_buf should + * be executed, then clear query_buf and call again to scan the remainder + * of the line. + * + * PSCAN_BACKSLASH: found a backslash that starts a special command. + * Any previous data on the line has been transferred to query_buf. + * The caller will typically next apply a separate flex lexer to scan + * the special command. + * + * PSCAN_INCOMPLETE: the end of the line was reached, but we have an + * incomplete SQL command. *prompt is set to the appropriate prompt type. + * + * PSCAN_EOL: the end of the line was reached, and there is no lexical + * reason to consider the command incomplete. The caller may or may not + * choose to send it. *prompt is set to the appropriate prompt type if + * the caller chooses to collect more input. + * + * In the PSCAN_INCOMPLETE and PSCAN_EOL cases, psql_scan_finish() should + * be called next, then the cycle may be repeated with a fresh input line. + * + * In all cases, *prompt is set to an appropriate prompt type code for the + * next line-input operation. + */ +PsqlScanResult +psql_scan(PsqlScanState state, + PQExpBuffer query_buf, + promptStatus_t *prompt) +{ + PsqlScanResult result; + int lexresult; + + /* Must be scanning already */ + Assert(state->scanbufhandle != NULL); + + /* Set current output target */ + state->output_buf = query_buf; + + /* Set input source */ + if (state->buffer_stack != NULL) + yy_switch_to_buffer(state->buffer_stack->buf, state->scanner); + else + yy_switch_to_buffer(state->scanbufhandle, state->scanner); + + /* And lex. */ + lexresult = yylex(NULL, state->scanner); + + /* + * Check termination state and return appropriate result info. + */ + switch (lexresult) + { + case LEXRES_EOL: /* end of input */ + switch (state->start_state) + { + case INITIAL: + case xqs: /* we treat this like INITIAL */ + if (state->paren_depth > 0) + { + result = PSCAN_INCOMPLETE; + *prompt = PROMPT_PAREN; + } + else if (state->begin_depth > 0) + { + result = PSCAN_INCOMPLETE; + *prompt = PROMPT_CONTINUE; + } + else if (query_buf->len > 0) + { + result = PSCAN_EOL; + *prompt = PROMPT_CONTINUE; + } + else + { + /* never bother to send an empty buffer */ + result = PSCAN_INCOMPLETE; + *prompt = PROMPT_READY; + } + break; + case xb: + result = PSCAN_INCOMPLETE; + *prompt = PROMPT_SINGLEQUOTE; + break; + case xc: + result = PSCAN_INCOMPLETE; + *prompt = PROMPT_COMMENT; + break; + case xd: + result = PSCAN_INCOMPLETE; + *prompt = PROMPT_DOUBLEQUOTE; + break; + case xh: + result = PSCAN_INCOMPLETE; + *prompt = PROMPT_SINGLEQUOTE; + break; + case xe: + result = PSCAN_INCOMPLETE; + *prompt = PROMPT_SINGLEQUOTE; + break; + case xq: + result = PSCAN_INCOMPLETE; + *prompt = PROMPT_SINGLEQUOTE; + break; + case xdolq: + result = PSCAN_INCOMPLETE; + *prompt = PROMPT_DOLLARQUOTE; + break; + case xui: + result = PSCAN_INCOMPLETE; + *prompt = PROMPT_DOUBLEQUOTE; + break; + case xus: + result = PSCAN_INCOMPLETE; + *prompt = PROMPT_SINGLEQUOTE; + break; + default: + /* can't get here */ + fprintf(stderr, "invalid YY_START\n"); + exit(1); + } + break; + case LEXRES_SEMI: /* semicolon */ + result = PSCAN_SEMICOLON; + *prompt = PROMPT_READY; + break; + case LEXRES_BACKSLASH: /* backslash */ + result = PSCAN_BACKSLASH; + *prompt = PROMPT_READY; + break; + default: + /* can't get here */ + fprintf(stderr, "invalid yylex result\n"); + exit(1); + } + + return result; +} + +/* + * Clean up after scanning a string. This flushes any unread input and + * releases resources (but not the PsqlScanState itself). Note however + * that this does not reset the lexer scan state; that can be done by + * psql_scan_reset(), which is an orthogonal operation. + * + * It is legal to call this when not scanning anything (makes it easier + * to deal with error recovery). + */ +void +psql_scan_finish(PsqlScanState state) +{ + /* Drop any incomplete variable expansions. */ + while (state->buffer_stack != NULL) + psqlscan_pop_buffer_stack(state); + + /* Done with the outer scan buffer, too */ + if (state->scanbufhandle) + yy_delete_buffer(state->scanbufhandle, state->scanner); + state->scanbufhandle = NULL; + if (state->scanbuf) + free(state->scanbuf); + state->scanbuf = NULL; +} + +/* + * Reset lexer scanning state to start conditions. This is appropriate + * for executing \r psql commands (or any other time that we discard the + * prior contents of query_buf). It is not, however, necessary to do this + * when we execute and clear the buffer after getting a PSCAN_SEMICOLON or + * PSCAN_EOL scan result, because the scan state must be INITIAL when those + * conditions are returned. + * + * Note that this is unrelated to flushing unread input; that task is + * done by psql_scan_finish(). + */ +void +psql_scan_reset(PsqlScanState state) +{ + state->start_state = INITIAL; + state->paren_depth = 0; + state->xcdepth = 0; /* not really necessary */ + if (state->dolqstart) + free(state->dolqstart); + state->dolqstart = NULL; + state->identifier_count = 0; + state->begin_depth = 0; +} + +/* + * Reselect this lexer (psqlscan.l) after using another one. + * + * Currently and for foreseeable uses, it's sufficient to reset to INITIAL + * state, because we'd never switch to another lexer in a different state. + * However, we don't want to reset e.g. paren_depth, so this can't be + * the same as psql_scan_reset(). + * + * Note: psql setjmp error recovery just calls psql_scan_reset(), so that + * must be a superset of this. + * + * Note: it seems likely that other lexers could just assign INITIAL for + * themselves, since that probably has the value zero in every flex-generated + * lexer. But let's not assume that. + */ +void +psql_scan_reselect_sql_lexer(PsqlScanState state) +{ + state->start_state = INITIAL; +} + +/* + * Return true if lexer is currently in an "inside quotes" state. + * + * This is pretty grotty but is needed to preserve the old behavior + * that mainloop.c drops blank lines not inside quotes without even + * echoing them. + */ +bool +psql_scan_in_quote(PsqlScanState state) +{ + return state->start_state != INITIAL && + state->start_state != xqs; +} + +/* + * Push the given string onto the stack of stuff to scan. + * + * NOTE SIDE EFFECT: the new buffer is made the active flex input buffer. + */ +void +psqlscan_push_new_buffer(PsqlScanState state, const char *newstr, + const char *varname) +{ + StackElem *stackelem; + + stackelem = (StackElem *) pg_malloc(sizeof(StackElem)); + + /* + * In current usage, the passed varname points at the current flex input + * buffer; we must copy it before calling psqlscan_prepare_buffer() + * because that will change the buffer state. + */ + stackelem->varname = varname ? pg_strdup(varname) : NULL; + + stackelem->buf = psqlscan_prepare_buffer(state, newstr, strlen(newstr), + &stackelem->bufstring); + state->curline = stackelem->bufstring; + if (state->safe_encoding) + { + stackelem->origstring = NULL; + state->refline = stackelem->bufstring; + } + else + { + stackelem->origstring = pg_strdup(newstr); + state->refline = stackelem->origstring; + } + stackelem->next = state->buffer_stack; + state->buffer_stack = stackelem; +} + +/* + * Pop the topmost buffer stack item (there must be one!) + * + * NB: after this, the flex input state is unspecified; caller must + * switch to an appropriate buffer to continue lexing. + * See psqlscan_select_top_buffer(). + */ +void +psqlscan_pop_buffer_stack(PsqlScanState state) +{ + StackElem *stackelem = state->buffer_stack; + + state->buffer_stack = stackelem->next; + yy_delete_buffer(stackelem->buf, state->scanner); + free(stackelem->bufstring); + if (stackelem->origstring) + free(stackelem->origstring); + if (stackelem->varname) + free(stackelem->varname); + free(stackelem); +} + +/* + * Select the topmost surviving buffer as the active input. + */ +void +psqlscan_select_top_buffer(PsqlScanState state) +{ + StackElem *stackelem = state->buffer_stack; + + if (stackelem != NULL) + { + yy_switch_to_buffer(stackelem->buf, state->scanner); + state->curline = stackelem->bufstring; + state->refline = stackelem->origstring ? stackelem->origstring : stackelem->bufstring; + } + else + { + yy_switch_to_buffer(state->scanbufhandle, state->scanner); + state->curline = state->scanbuf; + state->refline = state->scanline; + } +} + +/* + * Check if specified variable name is the source for any string + * currently being scanned + */ +bool +psqlscan_var_is_current_source(PsqlScanState state, const char *varname) +{ + StackElem *stackelem; + + for (stackelem = state->buffer_stack; + stackelem != NULL; + stackelem = stackelem->next) + { + if (stackelem->varname && strcmp(stackelem->varname, varname) == 0) + return true; + } + return false; +} + +/* + * Set up a flex input buffer to scan the given data. We always make a + * copy of the data. If working in an unsafe encoding, the copy has + * multibyte sequences replaced by FFs to avoid fooling the lexer rules. + * + * NOTE SIDE EFFECT: the new buffer is made the active flex input buffer. + */ +YY_BUFFER_STATE +psqlscan_prepare_buffer(PsqlScanState state, const char *txt, int len, + char **txtcopy) +{ + char *newtxt; + + /* Flex wants two \0 characters after the actual data */ + newtxt = pg_malloc(len + 2); + *txtcopy = newtxt; + newtxt[len] = newtxt[len + 1] = YY_END_OF_BUFFER_CHAR; + + if (state->safe_encoding) + memcpy(newtxt, txt, len); + else + { + /* Gotta do it the hard way */ + int i = 0; + + while (i < len) + { + int thislen = PQmblen(txt + i, state->encoding); + + /* first byte should always be okay... */ + newtxt[i] = txt[i]; + i++; + while (--thislen > 0 && i < len) + newtxt[i++] = (char) 0xFF; + } + } + + return yy_scan_buffer(newtxt, len + 2, state->scanner); +} + +/* + * psqlscan_emit() --- body for ECHO macro + * + * NB: this must be used for ALL and ONLY the text copied from the flex + * input data. If you pass it something that is not part of the yytext + * string, you are making a mistake. Internally generated text can be + * appended directly to state->output_buf. + */ +void +psqlscan_emit(PsqlScanState state, const char *txt, int len) +{ + PQExpBuffer output_buf = state->output_buf; + + if (state->safe_encoding) + appendBinaryPQExpBuffer(output_buf, txt, len); + else + { + /* Gotta do it the hard way */ + const char *reference = state->refline; + int i; + + reference += (txt - state->curline); + + for (i = 0; i < len; i++) + { + char ch = txt[i]; + + if (ch == (char) 0xFF) + ch = reference[i]; + appendPQExpBufferChar(output_buf, ch); + } + } +} + +/* + * psqlscan_extract_substring --- fetch value of (part of) the current token + * + * This is like psqlscan_emit(), except that the data is returned as a + * malloc'd string rather than being pushed directly to state->output_buf. + */ +char * +psqlscan_extract_substring(PsqlScanState state, const char *txt, int len) +{ + char *result = (char *) pg_malloc(len + 1); + + if (state->safe_encoding) + memcpy(result, txt, len); + else + { + /* Gotta do it the hard way */ + const char *reference = state->refline; + int i; + + reference += (txt - state->curline); + + for (i = 0; i < len; i++) + { + char ch = txt[i]; + + if (ch == (char) 0xFF) + ch = reference[i]; + result[i] = ch; + } + } + result[len] = '\0'; + return result; +} + +/* + * psqlscan_escape_variable --- process :'VARIABLE' or :"VARIABLE" + * + * If the variable name is found, escape its value using the appropriate + * quoting method and emit the value to output_buf. (Since the result is + * surely quoted, there is never any reason to rescan it.) If we don't + * find the variable or escaping fails, emit the token as-is. + */ +void +psqlscan_escape_variable(PsqlScanState state, const char *txt, int len, + PsqlScanQuoteType quote) +{ + char *varname; + char *value; + + /* Variable lookup. */ + varname = psqlscan_extract_substring(state, txt + 2, len - 3); + if (state->callbacks->get_variable) + value = state->callbacks->get_variable(varname, quote, + state->cb_passthrough); + else + value = NULL; + free(varname); + + if (value) + { + /* Emit the suitably-escaped value */ + appendPQExpBufferStr(state->output_buf, value); + free(value); + } + else + { + /* Emit original token as-is */ + psqlscan_emit(state, txt, len); + } +} + +void +psqlscan_test_variable(PsqlScanState state, const char *txt, int len) +{ + char *varname; + char *value; + + varname = psqlscan_extract_substring(state, txt + 3, len - 4); + if (state->callbacks->get_variable) + value = state->callbacks->get_variable(varname, PQUOTE_PLAIN, + state->cb_passthrough); + else + value = NULL; + free(varname); + + if (value != NULL) + { + psqlscan_emit(state, "TRUE", 4); + free(value); + } + else + { + psqlscan_emit(state, "FALSE", 5); + } +} diff --git a/psql/psql/downstream/psqlscan.l b/psql/psql/downstream/psqlscan.l new file mode 120000 index 0000000..bf59721 --- /dev/null +++ b/psql/psql/downstream/psqlscan.l @@ -0,0 +1 @@ +../../../upstream/src/fe_utils/psqlscan.l \ No newline at end of file diff --git a/psql/psql/downstream/psqlscanslash.c b/psql/psql/downstream/psqlscanslash.c new file mode 100644 index 0000000..0ee61db --- /dev/null +++ b/psql/psql/downstream/psqlscanslash.c @@ -0,0 +1,3484 @@ +#line 1 "psqlscanslash.c" +/*------------------------------------------------------------------------- + * + * psqlscanslash.l + * lexical scanner for psql backslash commands + * + * XXX Avoid creating backtracking cases --- see the backend lexer for info. + * + * See fe_utils/psqlscan_int.h for additional commentary. + * + * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/bin/psql/psqlscanslash.l + * + *------------------------------------------------------------------------- + */ +#include "postgres_fe.h" + +#include "psqlscanslash.h" +#include "common/logging.h" +#include "fe_utils/conditional.h" + +#include "libpq-fe.h" + +#line 27 "psqlscanslash.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 6 +#define YY_FLEX_SUBMINOR_VERSION 4 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +#ifdef yy_create_buffer +#define slash_yy_create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer slash_yy_create_buffer +#endif + +#ifdef yy_delete_buffer +#define slash_yy_delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer slash_yy_delete_buffer +#endif + +#ifdef yy_scan_buffer +#define slash_yy_scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer slash_yy_scan_buffer +#endif + +#ifdef yy_scan_string +#define slash_yy_scan_string_ALREADY_DEFINED +#else +#define yy_scan_string slash_yy_scan_string +#endif + +#ifdef yy_scan_bytes +#define slash_yy_scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes slash_yy_scan_bytes +#endif + +#ifdef yy_init_buffer +#define slash_yy_init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer slash_yy_init_buffer +#endif + +#ifdef yy_flush_buffer +#define slash_yy_flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer slash_yy_flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define slash_yy_load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state slash_yy_load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define slash_yy_switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer slash_yy_switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define slash_yypush_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state slash_yypush_buffer_state +#endif + +#ifdef yypop_buffer_state +#define slash_yypop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state slash_yypop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define slash_yyensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack slash_yyensure_buffer_stack +#endif + +#ifdef yylex +#define slash_yylex_ALREADY_DEFINED +#else +#define yylex slash_yylex +#endif + +#ifdef yyrestart +#define slash_yyrestart_ALREADY_DEFINED +#else +#define yyrestart slash_yyrestart +#endif + +#ifdef yylex_init +#define slash_yylex_init_ALREADY_DEFINED +#else +#define yylex_init slash_yylex_init +#endif + +#ifdef yylex_init_extra +#define slash_yylex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra slash_yylex_init_extra +#endif + +#ifdef yylex_destroy +#define slash_yylex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy slash_yylex_destroy +#endif + +#ifdef yyget_debug +#define slash_yyget_debug_ALREADY_DEFINED +#else +#define yyget_debug slash_yyget_debug +#endif + +#ifdef yyset_debug +#define slash_yyset_debug_ALREADY_DEFINED +#else +#define yyset_debug slash_yyset_debug +#endif + +#ifdef yyget_extra +#define slash_yyget_extra_ALREADY_DEFINED +#else +#define yyget_extra slash_yyget_extra +#endif + +#ifdef yyset_extra +#define slash_yyset_extra_ALREADY_DEFINED +#else +#define yyset_extra slash_yyset_extra +#endif + +#ifdef yyget_in +#define slash_yyget_in_ALREADY_DEFINED +#else +#define yyget_in slash_yyget_in +#endif + +#ifdef yyset_in +#define slash_yyset_in_ALREADY_DEFINED +#else +#define yyset_in slash_yyset_in +#endif + +#ifdef yyget_out +#define slash_yyget_out_ALREADY_DEFINED +#else +#define yyget_out slash_yyget_out +#endif + +#ifdef yyset_out +#define slash_yyset_out_ALREADY_DEFINED +#else +#define yyset_out slash_yyset_out +#endif + +#ifdef yyget_leng +#define slash_yyget_leng_ALREADY_DEFINED +#else +#define yyget_leng slash_yyget_leng +#endif + +#ifdef yyget_text +#define slash_yyget_text_ALREADY_DEFINED +#else +#define yyget_text slash_yyget_text +#endif + +#ifdef yyget_lineno +#define slash_yyget_lineno_ALREADY_DEFINED +#else +#define yyget_lineno slash_yyget_lineno +#endif + +#ifdef yyset_lineno +#define slash_yyset_lineno_ALREADY_DEFINED +#else +#define yyset_lineno slash_yyset_lineno +#endif + +#ifdef yyget_column +#define slash_yyget_column_ALREADY_DEFINED +#else +#define yyget_column slash_yyget_column +#endif + +#ifdef yyset_column +#define slash_yyset_column_ALREADY_DEFINED +#else +#define yyset_column slash_yyset_column +#endif + +#ifdef yywrap +#define slash_yywrap_ALREADY_DEFINED +#else +#define yywrap slash_yywrap +#endif + +#ifdef yyget_lval +#define slash_yyget_lval_ALREADY_DEFINED +#else +#define yyget_lval slash_yyget_lval +#endif + +#ifdef yyset_lval +#define slash_yyset_lval_ALREADY_DEFINED +#else +#define yyset_lval slash_yyset_lval +#endif + +#ifdef yyalloc +#define slash_yyalloc_ALREADY_DEFINED +#else +#define yyalloc slash_yyalloc +#endif + +#ifdef yyrealloc +#define slash_yyrealloc_ALREADY_DEFINED +#else +#define yyrealloc slash_yyrealloc +#endif + +#ifdef yyfree +#define slash_yyfree_ALREADY_DEFINED +#else +#define yyfree slash_yyfree +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . 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 +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; +#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; + +/* 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 + +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* begin standard C++ headers. */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. + */ +#define YY_SC_TO_UI(c) ((YY_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 yyrestart( yyin , yyscanner ) +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#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) + #define YY_LINENO_REWIND_TO(ptr) + +/* 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. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int 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 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 yyrestart ( FILE *input_file , yyscan_t yyscanner ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); +void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +void yypop_buffer_state ( yyscan_t yyscanner ); + +static void yyensure_buffer_stack ( yyscan_t yyscanner ); +static void yy_load_buffer_state ( yyscan_t yyscanner ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner) + +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); + +void *yyalloc ( yy_size_t , yyscan_t yyscanner ); +void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); +void yyfree ( void * , yyscan_t yyscanner ); + +#define yy_new_buffer yy_create_buffer +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + 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 ){\ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + 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 slash_yywrap(yyscanner) (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP +typedef flex_uint8_t YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static const flex_int16_t yy_nxt[][22] = + { + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0 + }, + + { + 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20 + }, + + { + 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20 + }, + + { + 19, 21, 22, 23, 21, 21, 21, 21, 21, 21, + + 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21 + }, + + { + 19, 21, 22, 23, 21, 21, 21, 21, 21, 21, + 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21 + }, + + { + 19, 24, 25, 26, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 27, 24 + }, + + { + 19, 24, 25, 26, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + + 27, 24 + }, + + { + 19, 28, 29, 30, 31, 32, 28, 28, 33, 28, + 28, 29, 34, 28, 28, 28, 28, 28, 28, 28, + 28, 28 + }, + + { + 19, 28, 29, 30, 31, 32, 28, 28, 33, 28, + 28, 29, 34, 28, 28, 28, 28, 28, 28, 28, + 28, 28 + }, + + { + 19, 35, 35, 35, 35, 36, 35, 35, 35, 35, + 35, 37, 35, 35, 35, 35, 35, 35, 35, 35, + 35, 35 + + }, + + { + 19, 35, 35, 35, 35, 36, 35, 35, 35, 35, + 35, 37, 35, 35, 35, 35, 35, 35, 35, 35, + 35, 35 + }, + + { + 19, 38, 38, 38, 38, 38, 38, 38, 39, 38, + 38, 38, 40, 38, 38, 38, 38, 38, 38, 38, + 38, 38 + }, + + { + 19, 38, 38, 38, 38, 38, 38, 38, 39, 38, + 38, 38, 40, 38, 38, 38, 38, 38, 38, 38, + 38, 38 + }, + + { + 19, 41, 41, 41, 42, 41, 41, 41, 41, 41, + + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41 + }, + + { + 19, 41, 41, 41, 42, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41 + }, + + { + 19, 43, 44, 45, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43 + }, + + { + 19, 43, 44, 45, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + + 43, 43 + }, + + { + 19, 46, 46, 46, 46, 46, 46, 46, 46, 46, + 46, 47, 46, 46, 46, 46, 46, 46, 46, 46, + 46, 46 + }, + + { + 19, 46, 46, 46, 46, 46, 46, 46, 46, 46, + 46, 47, 46, 46, 46, 46, 46, 46, 46, 46, + 46, 46 + }, + + { + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19 + + }, + + { + 19, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20 + }, + + { + 19, -21, -21, -21, -21, -21, -21, -21, -21, -21, + -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, + -21, -21 + }, + + { + 19, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22 + }, + + { + 19, -23, -23, -23, -23, -23, -23, -23, -23, -23, + + -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, + -23, -23 + }, + + { + 19, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24 + }, + + { + 19, -25, 48, 48, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25 + }, + + { + 19, -26, 48, 48, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + + -26, -26 + }, + + { + 19, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27 + }, + + { + 19, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28 + }, + + { + 19, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29 + + }, + + { + 19, -30, -30, -30, -30, -30, -30, -30, -30, -30, + -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, + -30, -30 + }, + + { + 19, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31 + }, + + { + 19, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32 + }, + + { + 19, -33, -33, -33, 49, 50, 51, 51, -33, -33, + + 51, -33, -33, 51, 51, 51, 51, 51, 51, 52, + -33, -33 + }, + + { + 19, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34 + }, + + { + 19, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35 + }, + + { + 19, -36, -36, -36, -36, 53, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + + -36, -36 + }, + + { + 19, 54, 54, -37, 54, 54, 55, 54, 54, 54, + 54, 54, 54, 56, 57, 58, 59, 60, 61, 54, + 54, 54 + }, + + { + 19, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38 + }, + + { + 19, -39, -39, -39, -39, 62, 63, 63, -39, -39, + 63, -39, -39, 63, 63, 63, 63, 63, 63, -39, + -39, -39 + + }, + + { + 19, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40 + }, + + { + 19, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41 + }, + + { + 19, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42 + }, + + { + 19, -43, -43, -43, -43, -43, -43, -43, -43, -43, + + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43 + }, + + { + 19, -44, 64, 64, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44 + }, + + { + 19, -45, 64, 64, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45 + }, + + { + 19, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + + -46, -46 + }, + + { + 19, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, 65, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47 + }, + + { + 19, -48, 48, 48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48 + }, + + { + 19, -49, -49, -49, -49, -49, 66, 66, -49, -49, + 66, -49, -49, 66, 66, 66, 66, 66, 66, -49, + -49, -49 + + }, + + { + 19, -50, -50, -50, -50, -50, 67, 67, -50, -50, + 67, -50, -50, 67, 67, 67, 67, 67, 67, -50, + -50, -50 + }, + + { + 19, -51, -51, -51, -51, -51, 51, 51, -51, -51, + 51, -51, -51, 51, 51, 51, 51, 51, 51, -51, + -51, -51 + }, + + { + 19, -52, -52, -52, -52, -52, -52, -52, -52, 68, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52 + }, + + { + 19, -53, -53, -53, -53, -53, -53, -53, -53, -53, + + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53 + }, + + { + 19, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54 + }, + + { + 19, -55, -55, -55, -55, -55, 69, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55 + }, + + { + 19, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + + -56, -56 + }, + + { + 19, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57 + }, + + { + 19, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58 + }, + + { + 19, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59 + + }, + + { + 19, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60 + }, + + { + 19, -61, -61, -61, -61, -61, 70, 70, -61, -61, + -61, -61, -61, 70, 70, -61, -61, -61, -61, -61, + -61, -61 + }, + + { + 19, -62, -62, -62, -62, -62, 71, 71, -62, -62, + 71, -62, -62, 71, 71, 71, 71, 71, 71, -62, + -62, -62 + }, + + { + 19, -63, -63, -63, -63, -63, 63, 63, -63, -63, + + 63, -63, -63, 63, 63, 63, 63, 63, 63, -63, + -63, -63 + }, + + { + 19, -64, 64, 64, -64, -64, -64, -64, -64, -64, + -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, + -64, -64 + }, + + { + 19, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65 + }, + + { + 19, -66, -66, -66, 72, -66, 66, 66, -66, -66, + 66, -66, -66, 66, 66, 66, 66, 66, 66, -66, + + -66, -66 + }, + + { + 19, -67, -67, -67, -67, 73, 67, 67, -67, -67, + 67, -67, -67, 67, 67, 67, 67, 67, 67, -67, + -67, -67 + }, + + { + 19, -68, -68, -68, -68, -68, 74, 74, -68, -68, + 74, -68, -68, 74, 74, 74, 74, 74, 74, -68, + -68, -68 + }, + + { + 19, -69, -69, -69, -69, -69, 75, -69, -69, -69, + -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, + -69, -69 + + }, + + { + 19, -70, -70, -70, -70, -70, 76, 76, -70, -70, + -70, -70, -70, 76, 76, -70, -70, -70, -70, -70, + -70, -70 + }, + + { + 19, -71, -71, -71, -71, 77, 71, 71, -71, -71, + 71, -71, -71, 71, 71, 71, 71, 71, 71, -71, + -71, -71 + }, + + { + 19, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72 + }, + + { + 19, -73, -73, -73, -73, -73, -73, -73, -73, -73, + + -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, + -73, -73 + }, + + { + 19, -74, -74, -74, -74, -74, 74, 74, -74, -74, + 74, -74, -74, 74, 74, 74, 74, 74, 74, -74, + -74, 78 + }, + + { + 19, -75, -75, -75, -75, -75, -75, -75, -75, -75, + -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, + -75, -75 + }, + + { + 19, -76, -76, -76, -76, -76, -76, -76, -76, -76, + -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, + + -76, -76 + }, + + { + 19, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77 + }, + + { + 19, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78 + }, + + } ; + +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 yynoreturn yy_fatal_error ( const 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 = (int) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; +#define YY_NUM_RULES 42 +#define YY_END_OF_BUFFER 43 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static const flex_int16_t yy_accept[79] = + { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 43, 1, + 3, 2, 2, 6, 4, 4, 5, 19, 7, 7, + 10, 8, 19, 9, 30, 20, 30, 35, 35, 31, + 37, 36, 39, 38, 38, 41, 41, 4, 16, 15, + 11, 18, 21, 29, 27, 24, 26, 22, 25, 23, + 29, 34, 32, 38, 40, 16, 15, 17, 27, 28, + 34, 13, 12, 17, 27, 28, 33, 14 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 4, 1, 1, 1, 1, 5, 1, + 1, 1, 1, 1, 1, 1, 1, 6, 6, 6, + 6, 6, 6, 6, 6, 7, 7, 8, 1, 1, + 1, 1, 9, 1, 7, 7, 7, 7, 7, 7, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 1, 11, 1, 1, 10, 12, 7, 13, 7, 7, + + 7, 14, 10, 10, 10, 10, 10, 10, 10, 15, + 10, 10, 10, 16, 10, 17, 10, 10, 10, 18, + 10, 10, 19, 20, 21, 1, 1, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10 + } ; + +/* 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 "psqlscanslash.l" + +#line 29 "psqlscanslash.l" +#include "fe_utils/psqlscan_int.h" + +/* + * We must have a typedef YYSTYPE for yylex's first argument, but this lexer + * doesn't presently make use of that argument, so just declare it as int. + */ +typedef int YYSTYPE; + +/* + * Set the type of yyextra; we use it as a pointer back to the containing + * PsqlScanState. + */ +#define YY_EXTRA_TYPE PsqlScanState + +/* + * These variables do not need to be saved across calls. Yeah, it's a bit + * of a hack, but putting them into PsqlScanStateData would be klugy too. + */ +static enum slash_option_type option_type; +static char *option_quote; +static int unquoted_option_chars; +static int backtick_start_offset; + + +/* Return values from yylex() */ +#define LEXRES_EOL 0 /* end of input */ +#define LEXRES_OK 1 /* OK completion of backslash argument */ + + +static void evaluate_backtick(PsqlScanState state); + +#define ECHO psqlscan_emit(cur_state, yytext, yyleng) + +/* + * 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 slash_yyget_column(yyscan_t yyscanner); +extern void slash_yyset_column(int column_no, yyscan_t yyscanner); + +/* LCOV_EXCL_START */ + +#line 1196 "psqlscanslash.c" +/* Except for the prefix, these options should match psqlscan.l */ +#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. + */ +/* Exclusive states for lexing backslash commands */ + +/* + * Assorted character class definitions that should match psqlscan.l. + */ +#line 1212 "psqlscanslash.c" + +#define INITIAL 0 +#define xslashcmd 1 +#define xslashargstart 2 +#define xslasharg 3 +#define xslashquote 4 +#define xslashbackquote 5 +#define xslashdquote 6 +#define xslashwholeline 7 +#define xslashend 8 + +#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 +#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; + int yy_n_chars; + int 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; + + }; /* 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 + +int yylex_init (yyscan_t* scanner); + +int 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 yylex_destroy ( yyscan_t yyscanner ); + +int yyget_debug ( yyscan_t yyscanner ); + +void yyset_debug ( int debug_flag , yyscan_t yyscanner ); + +YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); + +void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); + +FILE *yyget_in ( yyscan_t yyscanner ); + +void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); + +FILE *yyget_out ( yyscan_t yyscanner ); + +void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); + + int yyget_leng ( yyscan_t yyscanner ); + +char *yyget_text ( yyscan_t yyscanner ); + +int yyget_lineno ( yyscan_t yyscanner ); + +void yyset_lineno ( int _line_number , yyscan_t yyscanner ); + +int yyget_column ( yyscan_t yyscanner ); + +void yyset_column ( int _column_no , yyscan_t yyscanner ); + +YYSTYPE * yyget_lval ( yyscan_t yyscanner ); + +void yyset_lval ( YYSTYPE * yylval_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 yywrap ( yyscan_t yyscanner ); +#else +extern int yywrap ( yyscan_t yyscanner ); +#endif +#endif + +#ifndef YY_NO_UNPUT + +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const 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 +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#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 do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) +#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 = '*'; \ + int 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 = (int) fread(buf, 1, (yy_size_t) 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 yylex \ + (YYSTYPE * yylval_param , yyscan_t yyscanner); + +#define YY_DECL int yylex \ + (YYSTYPE * yylval_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 /*LINTED*/break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yylval = yylval_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 ) { + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); + } + + yy_load_buffer_state( yyscanner ); + } + + { +#line 119 "psqlscanslash.l" + + + +#line 123 "psqlscanslash.l" + /* Declare some local variables inside yylex(), for convenience */ + PsqlScanState cur_state = yyextra; + PQExpBuffer output_buf = cur_state->output_buf; + + /* + * Force flex into the state indicated by start_state. This has a + * couple of purposes: it lets some of the functions below set a new + * starting state without ugly direct access to flex variables, and it + * allows us to transition from one flex lexer to another so that we + * can lex different parts of the source string using separate lexers. + */ + BEGIN(cur_state->start_state); + + + /* + * We don't really expect to be invoked in the INITIAL state in this + * lexer; but if we are, just spit data to the output_buf until EOF. + */ + +#line 1516 "psqlscanslash.c" + + while ( /*CONSTCOND*/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 = yyg->yy_start; +yy_match: + while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 ) + ++yy_cp; + + yy_current_state = -yy_current_state; + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + 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 142 "psqlscanslash.l" +{ ECHO; } + YY_BREAK +/* + * Exclusive lexer states to handle backslash command lexing + */ + +/* command name ends at whitespace or backslash; eat all else */ +case 2: +/* rule 2 can match eol */ +YY_RULE_SETUP +#line 151 "psqlscanslash.l" +{ + yyless(0); + cur_state->start_state = YY_START; + return LEXRES_OK; + } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 157 "psqlscanslash.l" +{ ECHO; } + YY_BREAK + + +/* + * Discard any whitespace before argument, then go to xslasharg state. + * An exception is that "|" is only special at start of argument, so we + * check for it here. + */ +case 4: +/* rule 4 can match eol */ +YY_RULE_SETUP +#line 168 "psqlscanslash.l" +{ } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 170 "psqlscanslash.l" +{ + if (option_type == OT_FILEPIPE) + { + /* treat like whole-string case */ + ECHO; + BEGIN(xslashwholeline); + } + else + { + /* vertical bar is not special otherwise */ + yyless(0); + BEGIN(xslasharg); + } + } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 185 "psqlscanslash.l" +{ + yyless(0); + BEGIN(xslasharg); + } + YY_BREAK + + +/* + * Default processing of text in a slash command's argument. + * + * Note: unquoted_option_chars counts the number of characters at the + * end of the argument that were not subject to any form of quoting. + * psql_scan_slash_option needs this to strip trailing semicolons safely. + */ +case 7: +/* rule 7 can match eol */ +YY_RULE_SETUP +#line 201 "psqlscanslash.l" +{ + /* + * Unquoted space is end of arg; do not eat. Likewise + * backslash is end of command or next command, do not eat + * + * XXX this means we can't conveniently accept options + * that include unquoted backslashes; therefore, option + * processing that encourages use of backslashes is rather + * broken. + */ + yyless(0); + cur_state->start_state = YY_START; + return LEXRES_OK; + } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 216 "psqlscanslash.l" +{ + *option_quote = '\''; + unquoted_option_chars = 0; + BEGIN(xslashquote); + } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 222 "psqlscanslash.l" +{ + backtick_start_offset = output_buf->len; + *option_quote = '`'; + unquoted_option_chars = 0; + BEGIN(xslashbackquote); + } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 229 "psqlscanslash.l" +{ + ECHO; + *option_quote = '"'; + unquoted_option_chars = 0; + BEGIN(xslashdquote); + } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 236 "psqlscanslash.l" +{ + /* Possible psql variable substitution */ + if (cur_state->callbacks->get_variable == NULL) + ECHO; + else + { + char *varname; + char *value; + + varname = psqlscan_extract_substring(cur_state, + yytext + 1, + yyleng - 1); + value = cur_state->callbacks->get_variable(varname, + PQUOTE_PLAIN, + cur_state->cb_passthrough); + free(varname); + + /* + * The variable value is just emitted without any + * further examination. This is consistent with the + * pre-8.0 code behavior, if not with the way that + * variables are handled outside backslash commands. + * Note that we needn't guard against recursion here. + */ + if (value) + { + appendPQExpBufferStr(output_buf, value); + free(value); + } + else + ECHO; + + *option_quote = ':'; + } + unquoted_option_chars = 0; + } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 273 "psqlscanslash.l" +{ + psqlscan_escape_variable(cur_state, yytext, yyleng, + PQUOTE_SQL_LITERAL); + *option_quote = ':'; + unquoted_option_chars = 0; + } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 281 "psqlscanslash.l" +{ + psqlscan_escape_variable(cur_state, yytext, yyleng, + PQUOTE_SQL_IDENT); + *option_quote = ':'; + unquoted_option_chars = 0; + } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 288 "psqlscanslash.l" +{ + psqlscan_test_variable(cur_state, yytext, yyleng); + } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 292 "psqlscanslash.l" +{ + /* Throw back everything but the colon */ + yyless(1); + unquoted_option_chars++; + ECHO; + } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 299 "psqlscanslash.l" +{ + /* Throw back everything but the colon */ + yyless(1); + unquoted_option_chars++; + ECHO; + } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 306 "psqlscanslash.l" +{ + /* Throw back everything but the colon */ + yyless(1); + unquoted_option_chars++; + ECHO; + } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 313 "psqlscanslash.l" +{ + /* Throw back everything but the colon */ + yyless(1); + unquoted_option_chars++; + ECHO; + } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 320 "psqlscanslash.l" +{ + unquoted_option_chars++; + ECHO; + } + YY_BREAK + + +/* + * single-quoted text: copy literally except for '' and backslash + * sequences + */ +case 20: +YY_RULE_SETUP +#line 333 "psqlscanslash.l" +{ BEGIN(xslasharg); } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 335 "psqlscanslash.l" +{ appendPQExpBufferChar(output_buf, '\''); } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 337 "psqlscanslash.l" +{ appendPQExpBufferChar(output_buf, '\n'); } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 338 "psqlscanslash.l" +{ appendPQExpBufferChar(output_buf, '\t'); } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 339 "psqlscanslash.l" +{ appendPQExpBufferChar(output_buf, '\b'); } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 340 "psqlscanslash.l" +{ appendPQExpBufferChar(output_buf, '\r'); } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 341 "psqlscanslash.l" +{ appendPQExpBufferChar(output_buf, '\f'); } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 343 "psqlscanslash.l" +{ + /* octal case */ + appendPQExpBufferChar(output_buf, + (char) strtol(yytext + 1, NULL, 8)); + } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 349 "psqlscanslash.l" +{ + /* hex case */ + appendPQExpBufferChar(output_buf, + (char) strtol(yytext + 2, NULL, 16)); + } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 355 "psqlscanslash.l" +{ psqlscan_emit(cur_state, yytext + 1, 1); } + YY_BREAK +case 30: +/* rule 30 can match eol */ +YY_RULE_SETUP +#line 357 "psqlscanslash.l" +{ ECHO; } + YY_BREAK + + +/* + * backticked text: copy everything until next backquote (expanding + * variable references, but doing nought else), then evaluate. + */ +case 31: +YY_RULE_SETUP +#line 367 "psqlscanslash.l" +{ + /* In an inactive \if branch, don't evaluate the command */ + if (cur_state->cb_passthrough == NULL || + conditional_active((ConditionalStack) cur_state->cb_passthrough)) + evaluate_backtick(cur_state); + BEGIN(xslasharg); + } + YY_BREAK +case 32: +YY_RULE_SETUP +#line 375 "psqlscanslash.l" +{ + /* Possible psql variable substitution */ + if (cur_state->callbacks->get_variable == NULL) + ECHO; + else + { + char *varname; + char *value; + + varname = psqlscan_extract_substring(cur_state, + yytext + 1, + yyleng - 1); + value = cur_state->callbacks->get_variable(varname, + PQUOTE_PLAIN, + cur_state->cb_passthrough); + free(varname); + + if (value) + { + appendPQExpBufferStr(output_buf, value); + free(value); + } + else + ECHO; + } + } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 402 "psqlscanslash.l" +{ + psqlscan_escape_variable(cur_state, yytext, yyleng, + PQUOTE_SHELL_ARG); + } + YY_BREAK +case 34: +YY_RULE_SETUP +#line 407 "psqlscanslash.l" +{ + /* Throw back everything but the colon */ + yyless(1); + ECHO; + } + YY_BREAK +case 35: +/* rule 35 can match eol */ +YY_RULE_SETUP +#line 413 "psqlscanslash.l" +{ ECHO; } + YY_BREAK + + +/* double-quoted text: copy verbatim, including the double quotes */ +case 36: +YY_RULE_SETUP +#line 420 "psqlscanslash.l" +{ + ECHO; + BEGIN(xslasharg); + } + YY_BREAK +case 37: +/* rule 37 can match eol */ +YY_RULE_SETUP +#line 425 "psqlscanslash.l" +{ ECHO; } + YY_BREAK + + +/* copy everything until end of input line */ +/* but suppress leading whitespace */ +case 38: +/* rule 38 can match eol */ +YY_RULE_SETUP +#line 433 "psqlscanslash.l" +{ + if (output_buf->len > 0) + ECHO; + } + YY_BREAK +case 39: +YY_RULE_SETUP +#line 438 "psqlscanslash.l" +{ ECHO; } + YY_BREAK + + +/* at end of command, eat a double backslash, but not anything else */ +case 40: +YY_RULE_SETUP +#line 445 "psqlscanslash.l" +{ + cur_state->start_state = YY_START; + return LEXRES_OK; + } + YY_BREAK +case 41: +/* rule 41 can match eol */ +YY_RULE_SETUP +#line 450 "psqlscanslash.l" +{ + yyless(0); + cur_state->start_state = YY_START; + return LEXRES_OK; + } + YY_BREAK + +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(xslashcmd): +case YY_STATE_EOF(xslashargstart): +case YY_STATE_EOF(xslasharg): +case YY_STATE_EOF(xslashquote): +case YY_STATE_EOF(xslashbackquote): +case YY_STATE_EOF(xslashdquote): +case YY_STATE_EOF(xslashwholeline): +case YY_STATE_EOF(xslashend): +#line 458 "psqlscanslash.l" +{ + if (cur_state->buffer_stack == NULL) + { + cur_state->start_state = YY_START; + return LEXRES_EOL; /* end of input reached */ + } + + /* + * We were expanding a variable, so pop the inclusion + * stack and keep lexing + */ + psqlscan_pop_buffer_stack(cur_state); + psqlscan_select_top_buffer(cur_state); + } + YY_BREAK +case 42: +YY_RULE_SETUP +#line 473 "psqlscanslash.l" +YY_FATAL_ERROR( "flex scanner jammed" ); + YY_BREAK +#line 2010 "psqlscanslash.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 + * 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 ( 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 user's declarations */ +} /* end of 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; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = yyg->yytext_ptr; + 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 + { + int 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_LVALUE; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int 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. */ + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = NULL; + + 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; + 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 ((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. */ + int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); + } + + 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) +{ + yy_state_type yy_current_state; + char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = 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_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)]; + } + + 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) +{ + int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + + yy_current_state = yy_nxt[yy_current_state][1]; + yy_is_jam = (yy_current_state <= 0); + + (void)yyg; + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + +#endif + +#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 */ + int offset = (int) (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. */ + yyrestart( yyin , yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( 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 yyrestart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); + } + + yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner); + yy_load_buffer_state( yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void 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 + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + 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; + yy_load_buffer_state( yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void 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 yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in 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 *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file , yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * @param yyscanner The scanner object. + */ + void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree( (void *) b->yy_ch_buf , yyscanner ); + + yyfree( (void *) b , yyscanner ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_flush_buffer( b , yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from 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 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 ) + 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. + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(yyscanner); + + /* This block is copied from yy_switch_to_buffer. */ + 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; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void yypop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void 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; /* After all that talk, this was set to 1 anyways... */ + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in 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. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)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 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 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 NULL; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = (int) (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 = NULL; + 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; + + yy_switch_to_buffer( b , yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to 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 + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) +{ + + return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_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. + */ +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n , yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n , yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + 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. + */ +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int yyget_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int yyget_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +int yyget_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *yyget_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** 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 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 line number + * @param yyscanner The scanner object. + */ +void yyset_lineno (int _line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); + + yylineno = _line_number; +} + +/** Set the current column. + * @param _column_no column number + * @param yyscanner The scanner object. + */ +void yyset_column (int _column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + YY_FATAL_ERROR( "yyset_column called with no buffer" ); + + yycolumn = _column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param _in_str A readable stream. + * @param yyscanner The scanner object. + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * _in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = _in_str ; +} + +void yyset_out (FILE * _out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = _out_str ; +} + +int yyget_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void yyset_debug (int _bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = _bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +YYSTYPE * yyget_lval (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylval; +} + +void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylval = yylval_param; +} + +/* User-visible API */ + +/* 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 yylex_init(yyscan_t* ptr_yy_globals) +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) 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 ); +} + +/* yylex_init_extra has the same functionality as 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 yyalloc in + * the yyextra field. + */ +int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) +{ + struct yyguts_t dummy_yyguts; + + yyset_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + 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)); + + yyset_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +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 yylex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = NULL; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = NULL; + 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 = NULL; + yyout = NULL; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + yyfree(yyg->yy_buffer_stack , yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + yyfree( yyg->yy_start_stack , yyscanner ); + yyg->yy_start_stack = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + yyfree ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (const char * s , yyscan_t yyscanner) +{ + int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + return malloc(size); +} + +void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return realloc(ptr, size); +} + +void yyfree (void * ptr , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 473 "psqlscanslash.l" + + +/* LCOV_EXCL_STOP */ + +/* + * Scan the command name of a psql backslash command. This should be called + * after psql_scan() returns PSCAN_BACKSLASH. It is assumed that the input + * has been consumed through the leading backslash. + * + * The return value is a malloc'd copy of the command name, as parsed off + * from the input. + */ +char * +psql_scan_slash_command(PsqlScanState state) +{ + PQExpBufferData mybuf; + + /* Must be scanning already */ + Assert(state->scanbufhandle != NULL); + + /* Build a local buffer that we'll return the data of */ + initPQExpBuffer(&mybuf); + + /* Set current output target */ + state->output_buf = &mybuf; + + /* Set input source */ + if (state->buffer_stack != NULL) + yy_switch_to_buffer(state->buffer_stack->buf, state->scanner); + else + yy_switch_to_buffer(state->scanbufhandle, state->scanner); + + /* + * Set lexer start state. Note that this is sufficient to switch + * state->scanner over to using the tables in this lexer file. + */ + state->start_state = xslashcmd; + + /* And lex. */ + yylex(NULL, state->scanner); + + /* There are no possible errors in this lex state... */ + + /* + * In case the caller returns to using the regular SQL lexer, reselect the + * appropriate initial state. + */ + psql_scan_reselect_sql_lexer(state); + + return mybuf.data; +} + +/* + * Parse off the next argument for a backslash command, and return it as a + * malloc'd string. If there are no more arguments, returns NULL. + * + * type tells what processing, if any, to perform on the option string; + * for example, if it's a SQL identifier, we want to downcase any unquoted + * letters. + * + * if quote is not NULL, *quote is set to 0 if no quoting was found, else + * the last quote symbol used in the argument. + * + * if semicolon is true, unquoted trailing semicolon(s) that would otherwise + * be taken as part of the option string will be stripped. + * + * NOTE: the only possible syntax errors for backslash options are unmatched + * quotes, which are detected when we run out of input. Therefore, on a + * syntax error we just throw away the string and return NULL; there is no + * need to worry about flushing remaining input. + */ +char * +psql_scan_slash_option(PsqlScanState state, + enum slash_option_type type, + char *quote, + bool semicolon) +{ + PQExpBufferData mybuf; + int lexresult PG_USED_FOR_ASSERTS_ONLY; + int final_state; + char local_quote; + + /* Must be scanning already */ + Assert(state->scanbufhandle != NULL); + + if (quote == NULL) + quote = &local_quote; + *quote = 0; + + /* Build a local buffer that we'll return the data of */ + initPQExpBuffer(&mybuf); + + /* Set up static variables that will be used by yylex */ + option_type = type; + option_quote = quote; + unquoted_option_chars = 0; + + /* Set current output target */ + state->output_buf = &mybuf; + + /* Set input source */ + if (state->buffer_stack != NULL) + yy_switch_to_buffer(state->buffer_stack->buf, state->scanner); + else + yy_switch_to_buffer(state->scanbufhandle, state->scanner); + + /* Set lexer start state */ + if (type == OT_WHOLE_LINE) + state->start_state = xslashwholeline; + else + state->start_state = xslashargstart; + + /* And lex. */ + lexresult = yylex(NULL, state->scanner); + + /* Save final state for a moment... */ + final_state = state->start_state; + + /* + * In case the caller returns to using the regular SQL lexer, reselect the + * appropriate initial state. + */ + psql_scan_reselect_sql_lexer(state); + + /* + * Check the lex result: we should have gotten back either LEXRES_OK + * or LEXRES_EOL (the latter indicating end of string). If we were inside + * a quoted string, as indicated by final_state, EOL is an error. + */ + Assert(lexresult == LEXRES_EOL || lexresult == LEXRES_OK); + + switch (final_state) + { + case xslashargstart: + /* empty arg */ + break; + case xslasharg: + /* Strip any unquoted trailing semi-colons if requested */ + if (semicolon) + { + while (unquoted_option_chars-- > 0 && + mybuf.len > 0 && + mybuf.data[mybuf.len - 1] == ';') + { + mybuf.data[--mybuf.len] = '\0'; + } + } + + /* + * If SQL identifier processing was requested, then we strip out + * excess double quotes and optionally downcase unquoted letters. + */ + if (type == OT_SQLID || type == OT_SQLIDHACK) + { + dequote_downcase_identifier(mybuf.data, + (type != OT_SQLIDHACK), + state->encoding); + /* update mybuf.len for possible shortening */ + mybuf.len = strlen(mybuf.data); + } + break; + case xslashquote: + case xslashbackquote: + case xslashdquote: + /* must have hit EOL inside quotes */ + pg_log_error("unterminated quoted string"); + termPQExpBuffer(&mybuf); + return NULL; + case xslashwholeline: + /* always okay */ + break; + default: + /* can't get here */ + fprintf(stderr, "invalid YY_START\n"); + exit(1); + } + + /* + * An unquoted empty argument isn't possible unless we are at end of + * command. Return NULL instead. + */ + if (mybuf.len == 0 && *quote == 0) + { + termPQExpBuffer(&mybuf); + return NULL; + } + + /* Else return the completed string. */ + return mybuf.data; +} + +/* + * Eat up any unused \\ to complete a backslash command. + */ +void +psql_scan_slash_command_end(PsqlScanState state) +{ + /* Must be scanning already */ + Assert(state->scanbufhandle != NULL); + + /* Set current output target */ + state->output_buf = NULL; /* we won't output anything */ + + /* Set input source */ + if (state->buffer_stack != NULL) + yy_switch_to_buffer(state->buffer_stack->buf, state->scanner); + else + yy_switch_to_buffer(state->scanbufhandle, state->scanner); + + /* Set lexer start state */ + state->start_state = xslashend; + + /* And lex. */ + yylex(NULL, state->scanner); + + /* There are no possible errors in this lex state... */ + + /* + * We expect the caller to return to using the regular SQL lexer, so + * reselect the appropriate initial state. + */ + psql_scan_reselect_sql_lexer(state); +} + +/* + * Fetch current paren nesting depth + */ +int +psql_scan_get_paren_depth(PsqlScanState state) +{ + return state->paren_depth; +} + +/* + * Set paren nesting depth + */ +void +psql_scan_set_paren_depth(PsqlScanState state, int depth) +{ + Assert(depth >= 0); + state->paren_depth = depth; +} + +/* + * De-quote and optionally downcase a SQL identifier. + * + * The string at *str is modified in-place; it can become shorter, + * but not longer. + * + * If downcase is true then non-quoted letters are folded to lower case. + * Ideally this behavior will match the backend's downcase_identifier(); + * but note that it could differ if LC_CTYPE is different in the frontend. + * + * Note that a string like FOO"BAR"BAZ will be converted to fooBARbaz; + * this is somewhat inconsistent with the SQL spec, which would have us + * parse it as several identifiers. But for psql's purposes, we want a + * string like "foo"."bar" to be treated as one option, so there's little + * choice; this routine doesn't get to change the token boundaries. + */ +void +dequote_downcase_identifier(char *str, bool downcase, int encoding) +{ + bool inquotes = false; + char *cp = str; + + while (*cp) + { + if (*cp == '"') + { + if (inquotes && cp[1] == '"') + { + /* Keep the first quote, remove the second */ + cp++; + } + else + inquotes = !inquotes; + /* Collapse out quote at *cp */ + memmove(cp, cp + 1, strlen(cp)); + /* do not advance cp */ + } + else + { + if (downcase && !inquotes) + *cp = pg_tolower((unsigned char) *cp); + cp += PQmblenBounded(cp, encoding); + } + } +} + +/* + * Evaluate a backticked substring of a slash command's argument. + * + * The portion of output_buf starting at backtick_start_offset is evaluated + * as a shell command and then replaced by the command's output. + */ +static void +evaluate_backtick(PsqlScanState state) +{ + PQExpBuffer output_buf = state->output_buf; + char *cmd = output_buf->data + backtick_start_offset; + PQExpBufferData cmd_output; + FILE *fd; + bool error = false; + char buf[512]; + size_t result; + + initPQExpBuffer(&cmd_output); + + fd = popen(cmd, "r"); + if (!fd) + { + pg_log_error("%s: %m", cmd); + error = true; + } + + if (!error) + { + do + { + result = fread(buf, 1, sizeof(buf), fd); + if (ferror(fd)) + { + pg_log_error("%s: %m", cmd); + error = true; + break; + } + appendBinaryPQExpBuffer(&cmd_output, buf, result); + } while (!feof(fd)); + } + + if (fd && pclose(fd) == -1) + { + pg_log_error("%s: %m", cmd); + error = true; + } + + if (PQExpBufferDataBroken(cmd_output)) + { + pg_log_error("%s: out of memory", cmd); + error = true; + } + + /* Now done with cmd, delete it from output_buf */ + output_buf->len = backtick_start_offset; + output_buf->data[output_buf->len] = '\0'; + + /* If no error, transfer result to output_buf */ + if (!error) + { + /* strip any trailing newline (but only one) */ + if (cmd_output.len > 0 && + cmd_output.data[cmd_output.len - 1] == '\n') + cmd_output.len--; + appendBinaryPQExpBuffer(output_buf, cmd_output.data, cmd_output.len); + } + + termPQExpBuffer(&cmd_output); +} diff --git a/psql/psql/downstream/psqlscanslash.l b/psql/psql/downstream/psqlscanslash.l new file mode 120000 index 0000000..276c2bd --- /dev/null +++ b/psql/psql/downstream/psqlscanslash.l @@ -0,0 +1 @@ +../src/psql/psqlscanslash.l \ No newline at end of file diff --git a/psql/psql/downstream/sql_help.c b/psql/psql/downstream/sql_help.c new file mode 100644 index 0000000..38d6943 --- /dev/null +++ b/psql/psql/downstream/sql_help.c @@ -0,0 +1,6060 @@ +/* + * *** Do not change this file by hand. It is automatically + * *** generated from the DocBook documentation. + * + * generated by src/bin/psql/create_help.pl + * + */ + +#define N_(x) (x) /* gettext noop */ + +#include "postgres_fe.h" +#include "sql_help.h" + +static void +sql_help_ABORT(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ABORT [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]"); +} + +static void +sql_help_ALTER_AGGREGATE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER AGGREGATE %s ( %s ) RENAME TO %s\n" + "ALTER AGGREGATE %s ( %s )\n" + " OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER AGGREGATE %s ( %s ) SET SCHEMA %s\n" + "\n" + "%s\n" + "\n" + "* |\n" + "[ %s ] [ %s ] %s [ , ... ] |\n" + "[ [ %s ] [ %s ] %s [ , ... ] ] ORDER BY [ %s ] [ %s ] %s [ , ... ]", + _("name"), + _("aggregate_signature"), + _("new_name"), + _("name"), + _("aggregate_signature"), + _("new_owner"), + _("name"), + _("aggregate_signature"), + _("new_schema"), + _("where aggregate_signature is:"), + _("argmode"), + _("argname"), + _("argtype"), + _("argmode"), + _("argname"), + _("argtype"), + _("argmode"), + _("argname"), + _("argtype")); +} + +static void +sql_help_ALTER_COLLATION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER COLLATION %s REFRESH VERSION\n" + "\n" + "ALTER COLLATION %s RENAME TO %s\n" + "ALTER COLLATION %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER COLLATION %s SET SCHEMA %s", + _("name"), + _("name"), + _("new_name"), + _("name"), + _("new_owner"), + _("name"), + _("new_schema")); +} + +static void +sql_help_ALTER_CONVERSION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER CONVERSION %s RENAME TO %s\n" + "ALTER CONVERSION %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER CONVERSION %s SET SCHEMA %s", + _("name"), + _("new_name"), + _("name"), + _("new_owner"), + _("name"), + _("new_schema")); +} + +static void +sql_help_ALTER_DATABASE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER DATABASE %s [ [ WITH ] %s [ ... ] ]\n" + "\n" + "%s\n" + "\n" + " ALLOW_CONNECTIONS %s\n" + " CONNECTION LIMIT %s\n" + " IS_TEMPLATE %s\n" + "\n" + "ALTER DATABASE %s RENAME TO %s\n" + "\n" + "ALTER DATABASE %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "\n" + "ALTER DATABASE %s SET TABLESPACE %s\n" + "\n" + "ALTER DATABASE %s SET %s { TO | = } { %s | DEFAULT }\n" + "ALTER DATABASE %s SET %s FROM CURRENT\n" + "ALTER DATABASE %s RESET %s\n" + "ALTER DATABASE %s RESET ALL", + _("name"), + _("option"), + _("where option can be:"), + _("allowconn"), + _("connlimit"), + _("istemplate"), + _("name"), + _("new_name"), + _("name"), + _("new_owner"), + _("name"), + _("new_tablespace"), + _("name"), + _("configuration_parameter"), + _("value"), + _("name"), + _("configuration_parameter"), + _("name"), + _("configuration_parameter"), + _("name")); +} + +static void +sql_help_ALTER_DEFAULT_PRIVILEGES(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER DEFAULT PRIVILEGES\n" + " [ FOR { ROLE | USER } %s [, ...] ]\n" + " [ IN SCHEMA %s [, ...] ]\n" + " %s\n" + "\n" + "%s\n" + "\n" + "GRANT { { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER }\n" + " [, ...] | ALL [ PRIVILEGES ] }\n" + " ON TABLES\n" + " TO { [ GROUP ] %s | PUBLIC } [, ...] [ WITH GRANT OPTION ]\n" + "\n" + "GRANT { { USAGE | SELECT | UPDATE }\n" + " [, ...] | ALL [ PRIVILEGES ] }\n" + " ON SEQUENCES\n" + " TO { [ GROUP ] %s | PUBLIC } [, ...] [ WITH GRANT OPTION ]\n" + "\n" + "GRANT { EXECUTE | ALL [ PRIVILEGES ] }\n" + " ON { FUNCTIONS | ROUTINES }\n" + " TO { [ GROUP ] %s | PUBLIC } [, ...] [ WITH GRANT OPTION ]\n" + "\n" + "GRANT { USAGE | ALL [ PRIVILEGES ] }\n" + " ON TYPES\n" + " TO { [ GROUP ] %s | PUBLIC } [, ...] [ WITH GRANT OPTION ]\n" + "\n" + "GRANT { USAGE | CREATE | ALL [ PRIVILEGES ] }\n" + " ON SCHEMAS\n" + " TO { [ GROUP ] %s | PUBLIC } [, ...] [ WITH GRANT OPTION ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER }\n" + " [, ...] | ALL [ PRIVILEGES ] }\n" + " ON TABLES\n" + " FROM { [ GROUP ] %s | PUBLIC } [, ...]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { { USAGE | SELECT | UPDATE }\n" + " [, ...] | ALL [ PRIVILEGES ] }\n" + " ON SEQUENCES\n" + " FROM { [ GROUP ] %s | PUBLIC } [, ...]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { EXECUTE | ALL [ PRIVILEGES ] }\n" + " ON { FUNCTIONS | ROUTINES }\n" + " FROM { [ GROUP ] %s | PUBLIC } [, ...]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { USAGE | ALL [ PRIVILEGES ] }\n" + " ON TYPES\n" + " FROM { [ GROUP ] %s | PUBLIC } [, ...]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { USAGE | CREATE | ALL [ PRIVILEGES ] }\n" + " ON SCHEMAS\n" + " FROM { [ GROUP ] %s | PUBLIC } [, ...]\n" + " [ CASCADE | RESTRICT ]", + _("target_role"), + _("schema_name"), + _("abbreviated_grant_or_revoke"), + _("where abbreviated_grant_or_revoke is one of:"), + _("role_name"), + _("role_name"), + _("role_name"), + _("role_name"), + _("role_name"), + _("role_name"), + _("role_name"), + _("role_name"), + _("role_name"), + _("role_name")); +} + +static void +sql_help_ALTER_DOMAIN(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER DOMAIN %s\n" + " { SET DEFAULT %s | DROP DEFAULT }\n" + "ALTER DOMAIN %s\n" + " { SET | DROP } NOT NULL\n" + "ALTER DOMAIN %s\n" + " ADD %s [ NOT VALID ]\n" + "ALTER DOMAIN %s\n" + " DROP CONSTRAINT [ IF EXISTS ] %s [ RESTRICT | CASCADE ]\n" + "ALTER DOMAIN %s\n" + " RENAME CONSTRAINT %s TO %s\n" + "ALTER DOMAIN %s\n" + " VALIDATE CONSTRAINT %s\n" + "ALTER DOMAIN %s\n" + " OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER DOMAIN %s\n" + " RENAME TO %s\n" + "ALTER DOMAIN %s\n" + " SET SCHEMA %s", + _("name"), + _("expression"), + _("name"), + _("name"), + _("domain_constraint"), + _("name"), + _("constraint_name"), + _("name"), + _("constraint_name"), + _("new_constraint_name"), + _("name"), + _("constraint_name"), + _("name"), + _("new_owner"), + _("name"), + _("new_name"), + _("name"), + _("new_schema")); +} + +static void +sql_help_ALTER_EVENT_TRIGGER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER EVENT TRIGGER %s DISABLE\n" + "ALTER EVENT TRIGGER %s ENABLE [ REPLICA | ALWAYS ]\n" + "ALTER EVENT TRIGGER %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER EVENT TRIGGER %s RENAME TO %s", + _("name"), + _("name"), + _("name"), + _("new_owner"), + _("name"), + _("new_name")); +} + +static void +sql_help_ALTER_EXTENSION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER EXTENSION %s UPDATE [ TO %s ]\n" + "ALTER EXTENSION %s SET SCHEMA %s\n" + "ALTER EXTENSION %s ADD %s\n" + "ALTER EXTENSION %s DROP %s\n" + "\n" + "%s\n" + "\n" + " ACCESS METHOD %s |\n" + " AGGREGATE %s ( %s ) |\n" + " CAST (%s AS %s) |\n" + " COLLATION %s |\n" + " CONVERSION %s |\n" + " DOMAIN %s |\n" + " EVENT TRIGGER %s |\n" + " FOREIGN DATA WRAPPER %s |\n" + " FOREIGN TABLE %s |\n" + " FUNCTION %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ] |\n" + " MATERIALIZED VIEW %s |\n" + " OPERATOR %s (%s, %s) |\n" + " OPERATOR CLASS %s USING %s |\n" + " OPERATOR FAMILY %s USING %s |\n" + " [ PROCEDURAL ] LANGUAGE %s |\n" + " PROCEDURE %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ] |\n" + " ROUTINE %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ] |\n" + " SCHEMA %s |\n" + " SEQUENCE %s |\n" + " SERVER %s |\n" + " TABLE %s |\n" + " TEXT SEARCH CONFIGURATION %s |\n" + " TEXT SEARCH DICTIONARY %s |\n" + " TEXT SEARCH PARSER %s |\n" + " TEXT SEARCH TEMPLATE %s |\n" + " TRANSFORM FOR %s LANGUAGE %s |\n" + " TYPE %s |\n" + " VIEW %s\n" + "\n" + "%s\n" + "\n" + "* |\n" + "[ %s ] [ %s ] %s [ , ... ] |\n" + "[ [ %s ] [ %s ] %s [ , ... ] ] ORDER BY [ %s ] [ %s ] %s [ , ... ]", + _("name"), + _("new_version"), + _("name"), + _("new_schema"), + _("name"), + _("member_object"), + _("name"), + _("member_object"), + _("where member_object is:"), + _("object_name"), + _("aggregate_name"), + _("aggregate_signature"), + _("source_type"), + _("target_type"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("function_name"), + _("argmode"), + _("argname"), + _("argtype"), + _("object_name"), + _("operator_name"), + _("left_type"), + _("right_type"), + _("object_name"), + _("index_method"), + _("object_name"), + _("index_method"), + _("object_name"), + _("procedure_name"), + _("argmode"), + _("argname"), + _("argtype"), + _("routine_name"), + _("argmode"), + _("argname"), + _("argtype"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("type_name"), + _("lang_name"), + _("object_name"), + _("object_name"), + _("and aggregate_signature is:"), + _("argmode"), + _("argname"), + _("argtype"), + _("argmode"), + _("argname"), + _("argtype"), + _("argmode"), + _("argname"), + _("argtype")); +} + +static void +sql_help_ALTER_FOREIGN_DATA_WRAPPER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER FOREIGN DATA WRAPPER %s\n" + " [ HANDLER %s | NO HANDLER ]\n" + " [ VALIDATOR %s | NO VALIDATOR ]\n" + " [ OPTIONS ( [ ADD | SET | DROP ] %s ['%s'] [, ... ]) ]\n" + "ALTER FOREIGN DATA WRAPPER %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER FOREIGN DATA WRAPPER %s RENAME TO %s", + _("name"), + _("handler_function"), + _("validator_function"), + _("option"), + _("value"), + _("name"), + _("new_owner"), + _("name"), + _("new_name")); +} + +static void +sql_help_ALTER_FOREIGN_TABLE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER FOREIGN TABLE [ IF EXISTS ] [ ONLY ] %s [ * ]\n" + " %s [, ... ]\n" + "ALTER FOREIGN TABLE [ IF EXISTS ] [ ONLY ] %s [ * ]\n" + " RENAME [ COLUMN ] %s TO %s\n" + "ALTER FOREIGN TABLE [ IF EXISTS ] %s\n" + " RENAME TO %s\n" + "ALTER FOREIGN TABLE [ IF EXISTS ] %s\n" + " SET SCHEMA %s\n" + "\n" + "%s\n" + "\n" + " ADD [ COLUMN ] %s %s [ COLLATE %s ] [ %s [ ... ] ]\n" + " DROP [ COLUMN ] [ IF EXISTS ] %s [ RESTRICT | CASCADE ]\n" + " ALTER [ COLUMN ] %s [ SET DATA ] TYPE %s [ COLLATE %s ]\n" + " ALTER [ COLUMN ] %s SET DEFAULT %s\n" + " ALTER [ COLUMN ] %s DROP DEFAULT\n" + " ALTER [ COLUMN ] %s { SET | DROP } NOT NULL\n" + " ALTER [ COLUMN ] %s SET STATISTICS %s\n" + " ALTER [ COLUMN ] %s SET ( %s = %s [, ... ] )\n" + " ALTER [ COLUMN ] %s RESET ( %s [, ... ] )\n" + " ALTER [ COLUMN ] %s SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN }\n" + " ALTER [ COLUMN ] %s OPTIONS ( [ ADD | SET | DROP ] %s ['%s'] [, ... ])\n" + " ADD %s [ NOT VALID ]\n" + " VALIDATE CONSTRAINT %s\n" + " DROP CONSTRAINT [ IF EXISTS ] %s [ RESTRICT | CASCADE ]\n" + " DISABLE TRIGGER [ %s | ALL | USER ]\n" + " ENABLE TRIGGER [ %s | ALL | USER ]\n" + " ENABLE REPLICA TRIGGER %s\n" + " ENABLE ALWAYS TRIGGER %s\n" + " SET WITHOUT OIDS\n" + " INHERIT %s\n" + " NO INHERIT %s\n" + " OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + " OPTIONS ( [ ADD | SET | DROP ] %s ['%s'] [, ... ])", + _("name"), + _("action"), + _("name"), + _("column_name"), + _("new_column_name"), + _("name"), + _("new_name"), + _("name"), + _("new_schema"), + _("where action is one of:"), + _("column_name"), + _("data_type"), + _("collation"), + _("column_constraint"), + _("column_name"), + _("column_name"), + _("data_type"), + _("collation"), + _("column_name"), + _("expression"), + _("column_name"), + _("column_name"), + _("column_name"), + _("integer"), + _("column_name"), + _("attribute_option"), + _("value"), + _("column_name"), + _("attribute_option"), + _("column_name"), + _("column_name"), + _("option"), + _("value"), + _("table_constraint"), + _("constraint_name"), + _("constraint_name"), + _("trigger_name"), + _("trigger_name"), + _("trigger_name"), + _("trigger_name"), + _("parent_table"), + _("parent_table"), + _("new_owner"), + _("option"), + _("value")); +} + +static void +sql_help_ALTER_FUNCTION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER FUNCTION %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ]\n" + " %s [ ... ] [ RESTRICT ]\n" + "ALTER FUNCTION %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ]\n" + " RENAME TO %s\n" + "ALTER FUNCTION %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ]\n" + " OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER FUNCTION %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ]\n" + " SET SCHEMA %s\n" + "ALTER FUNCTION %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ]\n" + " [ NO ] DEPENDS ON EXTENSION %s\n" + "\n" + "%s\n" + "\n" + " CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT\n" + " IMMUTABLE | STABLE | VOLATILE\n" + " [ NOT ] LEAKPROOF\n" + " [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER\n" + " PARALLEL { UNSAFE | RESTRICTED | SAFE }\n" + " COST %s\n" + " ROWS %s\n" + " SUPPORT %s\n" + " SET %s { TO | = } { %s | DEFAULT }\n" + " SET %s FROM CURRENT\n" + " RESET %s\n" + " RESET ALL", + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("action"), + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("new_name"), + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("new_owner"), + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("new_schema"), + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("extension_name"), + _("where action is one of:"), + _("execution_cost"), + _("result_rows"), + _("support_function"), + _("configuration_parameter"), + _("value"), + _("configuration_parameter"), + _("configuration_parameter")); +} + +static void +sql_help_ALTER_GROUP(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER GROUP %s ADD USER %s [, ... ]\n" + "ALTER GROUP %s DROP USER %s [, ... ]\n" + "\n" + "%s\n" + "\n" + " %s\n" + " | CURRENT_ROLE\n" + " | CURRENT_USER\n" + " | SESSION_USER\n" + "\n" + "ALTER GROUP %s RENAME TO %s", + _("role_specification"), + _("user_name"), + _("role_specification"), + _("user_name"), + _("where role_specification can be:"), + _("role_name"), + _("group_name"), + _("new_name")); +} + +static void +sql_help_ALTER_INDEX(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER INDEX [ IF EXISTS ] %s RENAME TO %s\n" + "ALTER INDEX [ IF EXISTS ] %s SET TABLESPACE %s\n" + "ALTER INDEX %s ATTACH PARTITION %s\n" + "ALTER INDEX %s [ NO ] DEPENDS ON EXTENSION %s\n" + "ALTER INDEX [ IF EXISTS ] %s SET ( %s [= %s] [, ... ] )\n" + "ALTER INDEX [ IF EXISTS ] %s RESET ( %s [, ... ] )\n" + "ALTER INDEX [ IF EXISTS ] %s ALTER [ COLUMN ] %s\n" + " SET STATISTICS %s\n" + "ALTER INDEX ALL IN TABLESPACE %s [ OWNED BY %s [, ... ] ]\n" + " SET TABLESPACE %s [ NOWAIT ]", + _("name"), + _("new_name"), + _("name"), + _("tablespace_name"), + _("name"), + _("index_name"), + _("name"), + _("extension_name"), + _("name"), + _("storage_parameter"), + _("value"), + _("name"), + _("storage_parameter"), + _("name"), + _("column_number"), + _("integer"), + _("name"), + _("role_name"), + _("new_tablespace")); +} + +static void +sql_help_ALTER_LANGUAGE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER [ PROCEDURAL ] LANGUAGE %s RENAME TO %s\n" + "ALTER [ PROCEDURAL ] LANGUAGE %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }", + _("name"), + _("new_name"), + _("name"), + _("new_owner")); +} + +static void +sql_help_ALTER_LARGE_OBJECT(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER LARGE OBJECT %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }", + _("large_object_oid"), + _("new_owner")); +} + +static void +sql_help_ALTER_MATERIALIZED_VIEW(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER MATERIALIZED VIEW [ IF EXISTS ] %s\n" + " %s [, ... ]\n" + "ALTER MATERIALIZED VIEW %s\n" + " [ NO ] DEPENDS ON EXTENSION %s\n" + "ALTER MATERIALIZED VIEW [ IF EXISTS ] %s\n" + " RENAME [ COLUMN ] %s TO %s\n" + "ALTER MATERIALIZED VIEW [ IF EXISTS ] %s\n" + " RENAME TO %s\n" + "ALTER MATERIALIZED VIEW [ IF EXISTS ] %s\n" + " SET SCHEMA %s\n" + "ALTER MATERIALIZED VIEW ALL IN TABLESPACE %s [ OWNED BY %s [, ... ] ]\n" + " SET TABLESPACE %s [ NOWAIT ]\n" + "\n" + "%s\n" + "\n" + " ALTER [ COLUMN ] %s SET STATISTICS %s\n" + " ALTER [ COLUMN ] %s SET ( %s = %s [, ... ] )\n" + " ALTER [ COLUMN ] %s RESET ( %s [, ... ] )\n" + " ALTER [ COLUMN ] %s SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN }\n" + " ALTER [ COLUMN ] %s SET COMPRESSION %s\n" + " CLUSTER ON %s\n" + " SET WITHOUT CLUSTER\n" + " SET ( %s [= %s] [, ... ] )\n" + " RESET ( %s [, ... ] )\n" + " OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }", + _("name"), + _("action"), + _("name"), + _("extension_name"), + _("name"), + _("column_name"), + _("new_column_name"), + _("name"), + _("new_name"), + _("name"), + _("new_schema"), + _("name"), + _("role_name"), + _("new_tablespace"), + _("where action is one of:"), + _("column_name"), + _("integer"), + _("column_name"), + _("attribute_option"), + _("value"), + _("column_name"), + _("attribute_option"), + _("column_name"), + _("column_name"), + _("compression_method"), + _("index_name"), + _("storage_parameter"), + _("value"), + _("storage_parameter"), + _("new_owner")); +} + +static void +sql_help_ALTER_OPERATOR(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER OPERATOR %s ( { %s | NONE } , %s )\n" + " OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "\n" + "ALTER OPERATOR %s ( { %s | NONE } , %s )\n" + " SET SCHEMA %s\n" + "\n" + "ALTER OPERATOR %s ( { %s | NONE } , %s )\n" + " SET ( { RESTRICT = { %s | NONE }\n" + " | JOIN = { %s | NONE }\n" + " } [, ... ] )", + _("name"), + _("left_type"), + _("right_type"), + _("new_owner"), + _("name"), + _("left_type"), + _("right_type"), + _("new_schema"), + _("name"), + _("left_type"), + _("right_type"), + _("res_proc"), + _("join_proc")); +} + +static void +sql_help_ALTER_OPERATOR_CLASS(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER OPERATOR CLASS %s USING %s\n" + " RENAME TO %s\n" + "\n" + "ALTER OPERATOR CLASS %s USING %s\n" + " OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "\n" + "ALTER OPERATOR CLASS %s USING %s\n" + " SET SCHEMA %s", + _("name"), + _("index_method"), + _("new_name"), + _("name"), + _("index_method"), + _("new_owner"), + _("name"), + _("index_method"), + _("new_schema")); +} + +static void +sql_help_ALTER_OPERATOR_FAMILY(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER OPERATOR FAMILY %s USING %s ADD\n" + " { OPERATOR %s %s ( %s, %s )\n" + " [ FOR SEARCH | FOR ORDER BY %s ]\n" + " | FUNCTION %s [ ( %s [ , %s ] ) ]\n" + " %s [ ( %s [, ...] ) ]\n" + " } [, ... ]\n" + "\n" + "ALTER OPERATOR FAMILY %s USING %s DROP\n" + " { OPERATOR %s ( %s [ , %s ] )\n" + " | FUNCTION %s ( %s [ , %s ] )\n" + " } [, ... ]\n" + "\n" + "ALTER OPERATOR FAMILY %s USING %s\n" + " RENAME TO %s\n" + "\n" + "ALTER OPERATOR FAMILY %s USING %s\n" + " OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "\n" + "ALTER OPERATOR FAMILY %s USING %s\n" + " SET SCHEMA %s", + _("name"), + _("index_method"), + _("strategy_number"), + _("operator_name"), + _("op_type"), + _("op_type"), + _("sort_family_name"), + _("support_number"), + _("op_type"), + _("op_type"), + _("function_name"), + _("argument_type"), + _("name"), + _("index_method"), + _("strategy_number"), + _("op_type"), + _("op_type"), + _("support_number"), + _("op_type"), + _("op_type"), + _("name"), + _("index_method"), + _("new_name"), + _("name"), + _("index_method"), + _("new_owner"), + _("name"), + _("index_method"), + _("new_schema")); +} + +static void +sql_help_ALTER_POLICY(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER POLICY %s ON %s RENAME TO %s\n" + "\n" + "ALTER POLICY %s ON %s\n" + " [ TO { %s | PUBLIC | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] ]\n" + " [ USING ( %s ) ]\n" + " [ WITH CHECK ( %s ) ]", + _("name"), + _("table_name"), + _("new_name"), + _("name"), + _("table_name"), + _("role_name"), + _("using_expression"), + _("check_expression")); +} + +static void +sql_help_ALTER_PROCEDURE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER PROCEDURE %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ]\n" + " %s [ ... ] [ RESTRICT ]\n" + "ALTER PROCEDURE %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ]\n" + " RENAME TO %s\n" + "ALTER PROCEDURE %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ]\n" + " OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER PROCEDURE %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ]\n" + " SET SCHEMA %s\n" + "ALTER PROCEDURE %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ]\n" + " [ NO ] DEPENDS ON EXTENSION %s\n" + "\n" + "%s\n" + "\n" + " [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER\n" + " SET %s { TO | = } { %s | DEFAULT }\n" + " SET %s FROM CURRENT\n" + " RESET %s\n" + " RESET ALL", + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("action"), + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("new_name"), + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("new_owner"), + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("new_schema"), + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("extension_name"), + _("where action is one of:"), + _("configuration_parameter"), + _("value"), + _("configuration_parameter"), + _("configuration_parameter")); +} + +static void +sql_help_ALTER_PUBLICATION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER PUBLICATION %s ADD TABLE [ ONLY ] %s [ * ] [, ...]\n" + "ALTER PUBLICATION %s SET TABLE [ ONLY ] %s [ * ] [, ...]\n" + "ALTER PUBLICATION %s DROP TABLE [ ONLY ] %s [ * ] [, ...]\n" + "ALTER PUBLICATION %s SET ( %s [= %s] [, ... ] )\n" + "ALTER PUBLICATION %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER PUBLICATION %s RENAME TO %s", + _("name"), + _("table_name"), + _("name"), + _("table_name"), + _("name"), + _("table_name"), + _("name"), + _("publication_parameter"), + _("value"), + _("name"), + _("new_owner"), + _("name"), + _("new_name")); +} + +static void +sql_help_ALTER_ROLE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER ROLE %s [ WITH ] %s [ ... ]\n" + "\n" + "%s\n" + "\n" + " SUPERUSER | NOSUPERUSER\n" + " | CREATEDB | NOCREATEDB\n" + " | CREATEROLE | NOCREATEROLE\n" + " | INHERIT | NOINHERIT\n" + " | LOGIN | NOLOGIN\n" + " | REPLICATION | NOREPLICATION\n" + " | BYPASSRLS | NOBYPASSRLS\n" + " | CONNECTION LIMIT %s\n" + " | [ ENCRYPTED ] PASSWORD '%s' | PASSWORD NULL\n" + " | VALID UNTIL '%s'\n" + "\n" + "ALTER ROLE %s RENAME TO %s\n" + "\n" + "ALTER ROLE { %s | ALL } [ IN DATABASE %s ] SET %s { TO | = } { %s | DEFAULT }\n" + "ALTER ROLE { %s | ALL } [ IN DATABASE %s ] SET %s FROM CURRENT\n" + "ALTER ROLE { %s | ALL } [ IN DATABASE %s ] RESET %s\n" + "ALTER ROLE { %s | ALL } [ IN DATABASE %s ] RESET ALL\n" + "\n" + "%s\n" + "\n" + " %s\n" + " | CURRENT_ROLE\n" + " | CURRENT_USER\n" + " | SESSION_USER", + _("role_specification"), + _("option"), + _("where option can be:"), + _("connlimit"), + _("password"), + _("timestamp"), + _("name"), + _("new_name"), + _("role_specification"), + _("database_name"), + _("configuration_parameter"), + _("value"), + _("role_specification"), + _("database_name"), + _("configuration_parameter"), + _("role_specification"), + _("database_name"), + _("configuration_parameter"), + _("role_specification"), + _("database_name"), + _("where role_specification can be:"), + _("role_name")); +} + +static void +sql_help_ALTER_ROUTINE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER ROUTINE %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ]\n" + " %s [ ... ] [ RESTRICT ]\n" + "ALTER ROUTINE %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ]\n" + " RENAME TO %s\n" + "ALTER ROUTINE %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ]\n" + " OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER ROUTINE %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ]\n" + " SET SCHEMA %s\n" + "ALTER ROUTINE %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ]\n" + " [ NO ] DEPENDS ON EXTENSION %s\n" + "\n" + "%s\n" + "\n" + " IMMUTABLE | STABLE | VOLATILE\n" + " [ NOT ] LEAKPROOF\n" + " [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER\n" + " PARALLEL { UNSAFE | RESTRICTED | SAFE }\n" + " COST %s\n" + " ROWS %s\n" + " SET %s { TO | = } { %s | DEFAULT }\n" + " SET %s FROM CURRENT\n" + " RESET %s\n" + " RESET ALL", + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("action"), + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("new_name"), + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("new_owner"), + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("new_schema"), + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("extension_name"), + _("where action is one of:"), + _("execution_cost"), + _("result_rows"), + _("configuration_parameter"), + _("value"), + _("configuration_parameter"), + _("configuration_parameter")); +} + +static void +sql_help_ALTER_RULE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER RULE %s ON %s RENAME TO %s", + _("name"), + _("table_name"), + _("new_name")); +} + +static void +sql_help_ALTER_SCHEMA(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER SCHEMA %s RENAME TO %s\n" + "ALTER SCHEMA %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }", + _("name"), + _("new_name"), + _("name"), + _("new_owner")); +} + +static void +sql_help_ALTER_SEQUENCE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER SEQUENCE [ IF EXISTS ] %s\n" + " [ AS %s ]\n" + " [ INCREMENT [ BY ] %s ]\n" + " [ MINVALUE %s | NO MINVALUE ] [ MAXVALUE %s | NO MAXVALUE ]\n" + " [ START [ WITH ] %s ]\n" + " [ RESTART [ [ WITH ] %s ] ]\n" + " [ CACHE %s ] [ [ NO ] CYCLE ]\n" + " [ OWNED BY { %s.%s | NONE } ]\n" + "ALTER SEQUENCE [ IF EXISTS ] %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER SEQUENCE [ IF EXISTS ] %s RENAME TO %s\n" + "ALTER SEQUENCE [ IF EXISTS ] %s SET SCHEMA %s", + _("name"), + _("data_type"), + _("increment"), + _("minvalue"), + _("maxvalue"), + _("start"), + _("restart"), + _("cache"), + _("table_name"), + _("column_name"), + _("name"), + _("new_owner"), + _("name"), + _("new_name"), + _("name"), + _("new_schema")); +} + +static void +sql_help_ALTER_SERVER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER SERVER %s [ VERSION '%s' ]\n" + " [ OPTIONS ( [ ADD | SET | DROP ] %s ['%s'] [, ... ] ) ]\n" + "ALTER SERVER %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER SERVER %s RENAME TO %s", + _("name"), + _("new_version"), + _("option"), + _("value"), + _("name"), + _("new_owner"), + _("name"), + _("new_name")); +} + +static void +sql_help_ALTER_STATISTICS(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER STATISTICS %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER STATISTICS %s RENAME TO %s\n" + "ALTER STATISTICS %s SET SCHEMA %s\n" + "ALTER STATISTICS %s SET STATISTICS %s", + _("name"), + _("new_owner"), + _("name"), + _("new_name"), + _("name"), + _("new_schema"), + _("name"), + _("new_target")); +} + +static void +sql_help_ALTER_SUBSCRIPTION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER SUBSCRIPTION %s CONNECTION '%s'\n" + "ALTER SUBSCRIPTION %s SET PUBLICATION %s [, ...] [ WITH ( %s [= %s] [, ... ] ) ]\n" + "ALTER SUBSCRIPTION %s ADD PUBLICATION %s [, ...] [ WITH ( %s [= %s] [, ... ] ) ]\n" + "ALTER SUBSCRIPTION %s DROP PUBLICATION %s [, ...] [ WITH ( %s [= %s] [, ... ] ) ]\n" + "ALTER SUBSCRIPTION %s REFRESH PUBLICATION [ WITH ( %s [= %s] [, ... ] ) ]\n" + "ALTER SUBSCRIPTION %s ENABLE\n" + "ALTER SUBSCRIPTION %s DISABLE\n" + "ALTER SUBSCRIPTION %s SET ( %s [= %s] [, ... ] )\n" + "ALTER SUBSCRIPTION %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER SUBSCRIPTION %s RENAME TO %s", + _("name"), + _("conninfo"), + _("name"), + _("publication_name"), + _("publication_option"), + _("value"), + _("name"), + _("publication_name"), + _("publication_option"), + _("value"), + _("name"), + _("publication_name"), + _("publication_option"), + _("value"), + _("name"), + _("refresh_option"), + _("value"), + _("name"), + _("name"), + _("name"), + _("subscription_parameter"), + _("value"), + _("name"), + _("new_owner"), + _("name"), + _("new_name")); +} + +static void +sql_help_ALTER_SYSTEM(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER SYSTEM SET %s { TO | = } { %s | '%s' | DEFAULT }\n" + "\n" + "ALTER SYSTEM RESET %s\n" + "ALTER SYSTEM RESET ALL", + _("configuration_parameter"), + _("value"), + _("value"), + _("configuration_parameter")); +} + +static void +sql_help_ALTER_TABLE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER TABLE [ IF EXISTS ] [ ONLY ] %s [ * ]\n" + " %s [, ... ]\n" + "ALTER TABLE [ IF EXISTS ] [ ONLY ] %s [ * ]\n" + " RENAME [ COLUMN ] %s TO %s\n" + "ALTER TABLE [ IF EXISTS ] [ ONLY ] %s [ * ]\n" + " RENAME CONSTRAINT %s TO %s\n" + "ALTER TABLE [ IF EXISTS ] %s\n" + " RENAME TO %s\n" + "ALTER TABLE [ IF EXISTS ] %s\n" + " SET SCHEMA %s\n" + "ALTER TABLE ALL IN TABLESPACE %s [ OWNED BY %s [, ... ] ]\n" + " SET TABLESPACE %s [ NOWAIT ]\n" + "ALTER TABLE [ IF EXISTS ] %s\n" + " ATTACH PARTITION %s { FOR VALUES %s | DEFAULT }\n" + "ALTER TABLE [ IF EXISTS ] %s\n" + " DETACH PARTITION %s [ CONCURRENTLY | FINALIZE ]\n" + "\n" + "%s\n" + "\n" + " ADD [ COLUMN ] [ IF NOT EXISTS ] %s %s [ COLLATE %s ] [ %s [ ... ] ]\n" + " DROP [ COLUMN ] [ IF EXISTS ] %s [ RESTRICT | CASCADE ]\n" + " ALTER [ COLUMN ] %s [ SET DATA ] TYPE %s [ COLLATE %s ] [ USING %s ]\n" + " ALTER [ COLUMN ] %s SET DEFAULT %s\n" + " ALTER [ COLUMN ] %s DROP DEFAULT\n" + " ALTER [ COLUMN ] %s { SET | DROP } NOT NULL\n" + " ALTER [ COLUMN ] %s DROP EXPRESSION [ IF EXISTS ]\n" + " ALTER [ COLUMN ] %s ADD GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( %s ) ]\n" + " ALTER [ COLUMN ] %s { SET GENERATED { ALWAYS | BY DEFAULT } | SET %s | RESTART [ [ WITH ] %s ] } [...]\n" + " ALTER [ COLUMN ] %s DROP IDENTITY [ IF EXISTS ]\n" + " ALTER [ COLUMN ] %s SET STATISTICS %s\n" + " ALTER [ COLUMN ] %s SET ( %s = %s [, ... ] )\n" + " ALTER [ COLUMN ] %s RESET ( %s [, ... ] )\n" + " ALTER [ COLUMN ] %s SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN }\n" + " ALTER [ COLUMN ] %s SET COMPRESSION %s\n" + " ADD %s [ NOT VALID ]\n" + " ADD %s\n" + " ALTER CONSTRAINT %s [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]\n" + " VALIDATE CONSTRAINT %s\n" + " DROP CONSTRAINT [ IF EXISTS ] %s [ RESTRICT | CASCADE ]\n" + " DISABLE TRIGGER [ %s | ALL | USER ]\n" + " ENABLE TRIGGER [ %s | ALL | USER ]\n" + " ENABLE REPLICA TRIGGER %s\n" + " ENABLE ALWAYS TRIGGER %s\n" + " DISABLE RULE %s\n" + " ENABLE RULE %s\n" + " ENABLE REPLICA RULE %s\n" + " ENABLE ALWAYS RULE %s\n" + " DISABLE ROW LEVEL SECURITY\n" + " ENABLE ROW LEVEL SECURITY\n" + " FORCE ROW LEVEL SECURITY\n" + " NO FORCE ROW LEVEL SECURITY\n" + " CLUSTER ON %s\n" + " SET WITHOUT CLUSTER\n" + " SET WITHOUT OIDS\n" + " SET TABLESPACE %s\n" + " SET { LOGGED | UNLOGGED }\n" + " SET ( %s [= %s] [, ... ] )\n" + " RESET ( %s [, ... ] )\n" + " INHERIT %s\n" + " NO INHERIT %s\n" + " OF %s\n" + " NOT OF\n" + " OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + " REPLICA IDENTITY { DEFAULT | USING INDEX %s | FULL | NOTHING }\n" + "\n" + "%s\n" + "\n" + "IN ( %s [, ...] ) |\n" + "FROM ( { %s | MINVALUE | MAXVALUE } [, ...] )\n" + " TO ( { %s | MINVALUE | MAXVALUE } [, ...] ) |\n" + "WITH ( MODULUS %s, REMAINDER %s )\n" + "\n" + "%s\n" + "\n" + "[ CONSTRAINT %s ]\n" + "{ NOT NULL |\n" + " NULL |\n" + " CHECK ( %s ) [ NO INHERIT ] |\n" + " DEFAULT %s |\n" + " GENERATED ALWAYS AS ( %s ) STORED |\n" + " GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( %s ) ] |\n" + " UNIQUE %s |\n" + " PRIMARY KEY %s |\n" + " REFERENCES %s [ ( %s ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ]\n" + " [ ON DELETE %s ] [ ON UPDATE %s ] }\n" + "[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]\n" + "\n" + "%s\n" + "\n" + "[ CONSTRAINT %s ]\n" + "{ CHECK ( %s ) [ NO INHERIT ] |\n" + " UNIQUE ( %s [, ... ] ) %s |\n" + " PRIMARY KEY ( %s [, ... ] ) %s |\n" + " EXCLUDE [ USING %s ] ( %s WITH %s [, ... ] ) %s [ WHERE ( %s ) ] |\n" + " FOREIGN KEY ( %s [, ... ] ) REFERENCES %s [ ( %s [, ... ] ) ]\n" + " [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE %s ] [ ON UPDATE %s ] }\n" + "[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]\n" + "\n" + "%s\n" + "\n" + " [ CONSTRAINT %s ]\n" + " { UNIQUE | PRIMARY KEY } USING INDEX %s\n" + " [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]\n" + "\n" + "%s\n" + "\n" + "[ INCLUDE ( %s [, ... ] ) ]\n" + "[ WITH ( %s [= %s] [, ... ] ) ]\n" + "[ USING INDEX TABLESPACE %s ]\n" + "\n" + "%s\n" + "\n" + "{ %s | ( %s ) } [ %s ] [ ASC | DESC ] [ NULLS { FIRST | LAST } ]", + _("name"), + _("action"), + _("name"), + _("column_name"), + _("new_column_name"), + _("name"), + _("constraint_name"), + _("new_constraint_name"), + _("name"), + _("new_name"), + _("name"), + _("new_schema"), + _("name"), + _("role_name"), + _("new_tablespace"), + _("name"), + _("partition_name"), + _("partition_bound_spec"), + _("name"), + _("partition_name"), + _("where action is one of:"), + _("column_name"), + _("data_type"), + _("collation"), + _("column_constraint"), + _("column_name"), + _("column_name"), + _("data_type"), + _("collation"), + _("expression"), + _("column_name"), + _("expression"), + _("column_name"), + _("column_name"), + _("column_name"), + _("column_name"), + _("sequence_options"), + _("column_name"), + _("sequence_option"), + _("restart"), + _("column_name"), + _("column_name"), + _("integer"), + _("column_name"), + _("attribute_option"), + _("value"), + _("column_name"), + _("attribute_option"), + _("column_name"), + _("column_name"), + _("compression_method"), + _("table_constraint"), + _("table_constraint_using_index"), + _("constraint_name"), + _("constraint_name"), + _("constraint_name"), + _("trigger_name"), + _("trigger_name"), + _("trigger_name"), + _("trigger_name"), + _("rewrite_rule_name"), + _("rewrite_rule_name"), + _("rewrite_rule_name"), + _("rewrite_rule_name"), + _("index_name"), + _("new_tablespace"), + _("storage_parameter"), + _("value"), + _("storage_parameter"), + _("parent_table"), + _("parent_table"), + _("type_name"), + _("new_owner"), + _("index_name"), + _("and partition_bound_spec is:"), + _("partition_bound_expr"), + _("partition_bound_expr"), + _("partition_bound_expr"), + _("numeric_literal"), + _("numeric_literal"), + _("and column_constraint is:"), + _("constraint_name"), + _("expression"), + _("default_expr"), + _("generation_expr"), + _("sequence_options"), + _("index_parameters"), + _("index_parameters"), + _("reftable"), + _("refcolumn"), + _("referential_action"), + _("referential_action"), + _("and table_constraint is:"), + _("constraint_name"), + _("expression"), + _("column_name"), + _("index_parameters"), + _("column_name"), + _("index_parameters"), + _("index_method"), + _("exclude_element"), + _("operator"), + _("index_parameters"), + _("predicate"), + _("column_name"), + _("reftable"), + _("refcolumn"), + _("referential_action"), + _("referential_action"), + _("and table_constraint_using_index is:"), + _("constraint_name"), + _("index_name"), + _("index_parameters in UNIQUE, PRIMARY KEY, and EXCLUDE constraints are:"), + _("column_name"), + _("storage_parameter"), + _("value"), + _("tablespace_name"), + _("exclude_element in an EXCLUDE constraint is:"), + _("column_name"), + _("expression"), + _("opclass")); +} + +static void +sql_help_ALTER_TABLESPACE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER TABLESPACE %s RENAME TO %s\n" + "ALTER TABLESPACE %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER TABLESPACE %s SET ( %s = %s [, ... ] )\n" + "ALTER TABLESPACE %s RESET ( %s [, ... ] )", + _("name"), + _("new_name"), + _("name"), + _("new_owner"), + _("name"), + _("tablespace_option"), + _("value"), + _("name"), + _("tablespace_option")); +} + +static void +sql_help_ALTER_TEXT_SEARCH_CONFIGURATION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER TEXT SEARCH CONFIGURATION %s\n" + " ADD MAPPING FOR %s [, ... ] WITH %s [, ... ]\n" + "ALTER TEXT SEARCH CONFIGURATION %s\n" + " ALTER MAPPING FOR %s [, ... ] WITH %s [, ... ]\n" + "ALTER TEXT SEARCH CONFIGURATION %s\n" + " ALTER MAPPING REPLACE %s WITH %s\n" + "ALTER TEXT SEARCH CONFIGURATION %s\n" + " ALTER MAPPING FOR %s [, ... ] REPLACE %s WITH %s\n" + "ALTER TEXT SEARCH CONFIGURATION %s\n" + " DROP MAPPING [ IF EXISTS ] FOR %s [, ... ]\n" + "ALTER TEXT SEARCH CONFIGURATION %s RENAME TO %s\n" + "ALTER TEXT SEARCH CONFIGURATION %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER TEXT SEARCH CONFIGURATION %s SET SCHEMA %s", + _("name"), + _("token_type"), + _("dictionary_name"), + _("name"), + _("token_type"), + _("dictionary_name"), + _("name"), + _("old_dictionary"), + _("new_dictionary"), + _("name"), + _("token_type"), + _("old_dictionary"), + _("new_dictionary"), + _("name"), + _("token_type"), + _("name"), + _("new_name"), + _("name"), + _("new_owner"), + _("name"), + _("new_schema")); +} + +static void +sql_help_ALTER_TEXT_SEARCH_DICTIONARY(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER TEXT SEARCH DICTIONARY %s (\n" + " %s [ = %s ] [, ... ]\n" + ")\n" + "ALTER TEXT SEARCH DICTIONARY %s RENAME TO %s\n" + "ALTER TEXT SEARCH DICTIONARY %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER TEXT SEARCH DICTIONARY %s SET SCHEMA %s", + _("name"), + _("option"), + _("value"), + _("name"), + _("new_name"), + _("name"), + _("new_owner"), + _("name"), + _("new_schema")); +} + +static void +sql_help_ALTER_TEXT_SEARCH_PARSER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER TEXT SEARCH PARSER %s RENAME TO %s\n" + "ALTER TEXT SEARCH PARSER %s SET SCHEMA %s", + _("name"), + _("new_name"), + _("name"), + _("new_schema")); +} + +static void +sql_help_ALTER_TEXT_SEARCH_TEMPLATE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER TEXT SEARCH TEMPLATE %s RENAME TO %s\n" + "ALTER TEXT SEARCH TEMPLATE %s SET SCHEMA %s", + _("name"), + _("new_name"), + _("name"), + _("new_schema")); +} + +static void +sql_help_ALTER_TRIGGER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER TRIGGER %s ON %s RENAME TO %s\n" + "ALTER TRIGGER %s ON %s [ NO ] DEPENDS ON EXTENSION %s", + _("name"), + _("table_name"), + _("new_name"), + _("name"), + _("table_name"), + _("extension_name")); +} + +static void +sql_help_ALTER_TYPE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER TYPE %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER TYPE %s RENAME TO %s\n" + "ALTER TYPE %s SET SCHEMA %s\n" + "ALTER TYPE %s RENAME ATTRIBUTE %s TO %s [ CASCADE | RESTRICT ]\n" + "ALTER TYPE %s %s [, ... ]\n" + "ALTER TYPE %s ADD VALUE [ IF NOT EXISTS ] %s [ { BEFORE | AFTER } %s ]\n" + "ALTER TYPE %s RENAME VALUE %s TO %s\n" + "ALTER TYPE %s SET ( %s = %s [, ... ] )\n" + "\n" + "%s\n" + "\n" + " ADD ATTRIBUTE %s %s [ COLLATE %s ] [ CASCADE | RESTRICT ]\n" + " DROP ATTRIBUTE [ IF EXISTS ] %s [ CASCADE | RESTRICT ]\n" + " ALTER ATTRIBUTE %s [ SET DATA ] TYPE %s [ COLLATE %s ] [ CASCADE | RESTRICT ]", + _("name"), + _("new_owner"), + _("name"), + _("new_name"), + _("name"), + _("new_schema"), + _("name"), + _("attribute_name"), + _("new_attribute_name"), + _("name"), + _("action"), + _("name"), + _("new_enum_value"), + _("neighbor_enum_value"), + _("name"), + _("existing_enum_value"), + _("new_enum_value"), + _("name"), + _("property"), + _("value"), + _("where action is one of:"), + _("attribute_name"), + _("data_type"), + _("collation"), + _("attribute_name"), + _("attribute_name"), + _("data_type"), + _("collation")); +} + +static void +sql_help_ALTER_USER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER USER %s [ WITH ] %s [ ... ]\n" + "\n" + "%s\n" + "\n" + " SUPERUSER | NOSUPERUSER\n" + " | CREATEDB | NOCREATEDB\n" + " | CREATEROLE | NOCREATEROLE\n" + " | INHERIT | NOINHERIT\n" + " | LOGIN | NOLOGIN\n" + " | REPLICATION | NOREPLICATION\n" + " | BYPASSRLS | NOBYPASSRLS\n" + " | CONNECTION LIMIT %s\n" + " | [ ENCRYPTED ] PASSWORD '%s' | PASSWORD NULL\n" + " | VALID UNTIL '%s'\n" + "\n" + "ALTER USER %s RENAME TO %s\n" + "\n" + "ALTER USER { %s | ALL } [ IN DATABASE %s ] SET %s { TO | = } { %s | DEFAULT }\n" + "ALTER USER { %s | ALL } [ IN DATABASE %s ] SET %s FROM CURRENT\n" + "ALTER USER { %s | ALL } [ IN DATABASE %s ] RESET %s\n" + "ALTER USER { %s | ALL } [ IN DATABASE %s ] RESET ALL\n" + "\n" + "%s\n" + "\n" + " %s\n" + " | CURRENT_ROLE\n" + " | CURRENT_USER\n" + " | SESSION_USER", + _("role_specification"), + _("option"), + _("where option can be:"), + _("connlimit"), + _("password"), + _("timestamp"), + _("name"), + _("new_name"), + _("role_specification"), + _("database_name"), + _("configuration_parameter"), + _("value"), + _("role_specification"), + _("database_name"), + _("configuration_parameter"), + _("role_specification"), + _("database_name"), + _("configuration_parameter"), + _("role_specification"), + _("database_name"), + _("where role_specification can be:"), + _("role_name")); +} + +static void +sql_help_ALTER_USER_MAPPING(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER USER MAPPING FOR { %s | USER | CURRENT_ROLE | CURRENT_USER | SESSION_USER | PUBLIC }\n" + " SERVER %s\n" + " OPTIONS ( [ ADD | SET | DROP ] %s ['%s'] [, ... ] )", + _("user_name"), + _("server_name"), + _("option"), + _("value")); +} + +static void +sql_help_ALTER_VIEW(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ALTER VIEW [ IF EXISTS ] %s ALTER [ COLUMN ] %s SET DEFAULT %s\n" + "ALTER VIEW [ IF EXISTS ] %s ALTER [ COLUMN ] %s DROP DEFAULT\n" + "ALTER VIEW [ IF EXISTS ] %s OWNER TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\n" + "ALTER VIEW [ IF EXISTS ] %s RENAME [ COLUMN ] %s TO %s\n" + "ALTER VIEW [ IF EXISTS ] %s RENAME TO %s\n" + "ALTER VIEW [ IF EXISTS ] %s SET SCHEMA %s\n" + "ALTER VIEW [ IF EXISTS ] %s SET ( %s [= %s] [, ... ] )\n" + "ALTER VIEW [ IF EXISTS ] %s RESET ( %s [, ... ] )", + _("name"), + _("column_name"), + _("expression"), + _("name"), + _("column_name"), + _("name"), + _("new_owner"), + _("name"), + _("column_name"), + _("new_column_name"), + _("name"), + _("new_name"), + _("name"), + _("new_schema"), + _("name"), + _("view_option_name"), + _("view_option_value"), + _("name"), + _("view_option_name")); +} + +static void +sql_help_ANALYZE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ANALYZE [ ( %s [, ...] ) ] [ %s [, ...] ]\n" + "ANALYZE [ VERBOSE ] [ %s [, ...] ]\n" + "\n" + "%s\n" + "\n" + " VERBOSE [ %s ]\n" + " SKIP_LOCKED [ %s ]\n" + "\n" + "%s\n" + "\n" + " %s [ ( %s [, ...] ) ]", + _("option"), + _("table_and_columns"), + _("table_and_columns"), + _("where option can be one of:"), + _("boolean"), + _("boolean"), + _("and table_and_columns is:"), + _("table_name"), + _("column_name")); +} + +static void +sql_help_BEGIN(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "BEGIN [ WORK | TRANSACTION ] [ %s [, ...] ]\n" + "\n" + "%s\n" + "\n" + " ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }\n" + " READ WRITE | READ ONLY\n" + " [ NOT ] DEFERRABLE", + _("transaction_mode"), + _("where transaction_mode is one of:")); +} + +static void +sql_help_CALL(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CALL %s ( [ %s ] [, ...] )", + _("name"), + _("argument")); +} + +static void +sql_help_CHECKPOINT(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CHECKPOINT"); +} + +static void +sql_help_CLOSE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CLOSE { %s | ALL }", + _("name")); +} + +static void +sql_help_CLUSTER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CLUSTER [VERBOSE] %s [ USING %s ]\n" + "CLUSTER ( %s [, ...] ) %s [ USING %s ]\n" + "CLUSTER [VERBOSE]\n" + "\n" + "%s\n" + "\n" + " VERBOSE [ %s ]", + _("table_name"), + _("index_name"), + _("option"), + _("table_name"), + _("index_name"), + _("where option can be one of:"), + _("boolean")); +} + +static void +sql_help_COMMENT(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "COMMENT ON\n" + "{\n" + " ACCESS METHOD %s |\n" + " AGGREGATE %s ( %s ) |\n" + " CAST (%s AS %s) |\n" + " COLLATION %s |\n" + " COLUMN %s.%s |\n" + " CONSTRAINT %s ON %s |\n" + " CONSTRAINT %s ON DOMAIN %s |\n" + " CONVERSION %s |\n" + " DATABASE %s |\n" + " DOMAIN %s |\n" + " EXTENSION %s |\n" + " EVENT TRIGGER %s |\n" + " FOREIGN DATA WRAPPER %s |\n" + " FOREIGN TABLE %s |\n" + " FUNCTION %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ] |\n" + " INDEX %s |\n" + " LARGE OBJECT %s |\n" + " MATERIALIZED VIEW %s |\n" + " OPERATOR %s (%s, %s) |\n" + " OPERATOR CLASS %s USING %s |\n" + " OPERATOR FAMILY %s USING %s |\n" + " POLICY %s ON %s |\n" + " [ PROCEDURAL ] LANGUAGE %s |\n" + " PROCEDURE %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ] |\n" + " PUBLICATION %s |\n" + " ROLE %s |\n" + " ROUTINE %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ] |\n" + " RULE %s ON %s |\n" + " SCHEMA %s |\n" + " SEQUENCE %s |\n" + " SERVER %s |\n" + " STATISTICS %s |\n" + " SUBSCRIPTION %s |\n" + " TABLE %s |\n" + " TABLESPACE %s |\n" + " TEXT SEARCH CONFIGURATION %s |\n" + " TEXT SEARCH DICTIONARY %s |\n" + " TEXT SEARCH PARSER %s |\n" + " TEXT SEARCH TEMPLATE %s |\n" + " TRANSFORM FOR %s LANGUAGE %s |\n" + " TRIGGER %s ON %s |\n" + " TYPE %s |\n" + " VIEW %s\n" + "} IS '%s'\n" + "\n" + "%s\n" + "\n" + "* |\n" + "[ %s ] [ %s ] %s [ , ... ] |\n" + "[ [ %s ] [ %s ] %s [ , ... ] ] ORDER BY [ %s ] [ %s ] %s [ , ... ]", + _("object_name"), + _("aggregate_name"), + _("aggregate_signature"), + _("source_type"), + _("target_type"), + _("object_name"), + _("relation_name"), + _("column_name"), + _("constraint_name"), + _("table_name"), + _("constraint_name"), + _("domain_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("function_name"), + _("argmode"), + _("argname"), + _("argtype"), + _("object_name"), + _("large_object_oid"), + _("object_name"), + _("operator_name"), + _("left_type"), + _("right_type"), + _("object_name"), + _("index_method"), + _("object_name"), + _("index_method"), + _("policy_name"), + _("table_name"), + _("object_name"), + _("procedure_name"), + _("argmode"), + _("argname"), + _("argtype"), + _("object_name"), + _("object_name"), + _("routine_name"), + _("argmode"), + _("argname"), + _("argtype"), + _("rule_name"), + _("table_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("type_name"), + _("lang_name"), + _("trigger_name"), + _("table_name"), + _("object_name"), + _("object_name"), + _("text"), + _("where aggregate_signature is:"), + _("argmode"), + _("argname"), + _("argtype"), + _("argmode"), + _("argname"), + _("argtype"), + _("argmode"), + _("argname"), + _("argtype")); +} + +static void +sql_help_COMMIT(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "COMMIT [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]"); +} + +static void +sql_help_COMMIT_PREPARED(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "COMMIT PREPARED %s", + _("transaction_id")); +} + +static void +sql_help_COPY(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "COPY %s [ ( %s [, ...] ) ]\n" + " FROM { '%s' | PROGRAM '%s' | STDIN }\n" + " [ [ WITH ] ( %s [, ...] ) ]\n" + " [ WHERE %s ]\n" + "\n" + "COPY { %s [ ( %s [, ...] ) ] | ( %s ) }\n" + " TO { '%s' | PROGRAM '%s' | STDOUT }\n" + " [ [ WITH ] ( %s [, ...] ) ]\n" + "\n" + "%s\n" + "\n" + " FORMAT %s\n" + " FREEZE [ %s ]\n" + " DELIMITER '%s'\n" + " NULL '%s'\n" + " HEADER [ %s ]\n" + " QUOTE '%s'\n" + " ESCAPE '%s'\n" + " FORCE_QUOTE { ( %s [, ...] ) | * }\n" + " FORCE_NOT_NULL ( %s [, ...] )\n" + " FORCE_NULL ( %s [, ...] )\n" + " ENCODING '%s'", + _("table_name"), + _("column_name"), + _("filename"), + _("command"), + _("option"), + _("condition"), + _("table_name"), + _("column_name"), + _("query"), + _("filename"), + _("command"), + _("option"), + _("where option can be one of:"), + _("format_name"), + _("boolean"), + _("delimiter_character"), + _("null_string"), + _("boolean"), + _("quote_character"), + _("escape_character"), + _("column_name"), + _("column_name"), + _("column_name"), + _("encoding_name")); +} + +static void +sql_help_CREATE_ACCESS_METHOD(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE ACCESS METHOD %s\n" + " TYPE %s\n" + " HANDLER %s", + _("name"), + _("access_method_type"), + _("handler_function")); +} + +static void +sql_help_CREATE_AGGREGATE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE [ OR REPLACE ] AGGREGATE %s ( [ %s ] [ %s ] %s [ , ... ] ) (\n" + " SFUNC = %s,\n" + " STYPE = %s\n" + " [ , SSPACE = %s ]\n" + " [ , FINALFUNC = %s ]\n" + " [ , FINALFUNC_EXTRA ]\n" + " [ , FINALFUNC_MODIFY = { READ_ONLY | SHAREABLE | READ_WRITE } ]\n" + " [ , COMBINEFUNC = %s ]\n" + " [ , SERIALFUNC = %s ]\n" + " [ , DESERIALFUNC = %s ]\n" + " [ , INITCOND = %s ]\n" + " [ , MSFUNC = %s ]\n" + " [ , MINVFUNC = %s ]\n" + " [ , MSTYPE = %s ]\n" + " [ , MSSPACE = %s ]\n" + " [ , MFINALFUNC = %s ]\n" + " [ , MFINALFUNC_EXTRA ]\n" + " [ , MFINALFUNC_MODIFY = { READ_ONLY | SHAREABLE | READ_WRITE } ]\n" + " [ , MINITCOND = %s ]\n" + " [ , SORTOP = %s ]\n" + " [ , PARALLEL = { SAFE | RESTRICTED | UNSAFE } ]\n" + ")\n" + "\n" + "CREATE [ OR REPLACE ] AGGREGATE %s ( [ [ %s ] [ %s ] %s [ , ... ] ]\n" + " ORDER BY [ %s ] [ %s ] %s [ , ... ] ) (\n" + " SFUNC = %s,\n" + " STYPE = %s\n" + " [ , SSPACE = %s ]\n" + " [ , FINALFUNC = %s ]\n" + " [ , FINALFUNC_EXTRA ]\n" + " [ , FINALFUNC_MODIFY = { READ_ONLY | SHAREABLE | READ_WRITE } ]\n" + " [ , INITCOND = %s ]\n" + " [ , PARALLEL = { SAFE | RESTRICTED | UNSAFE } ]\n" + " [ , HYPOTHETICAL ]\n" + ")\n" + "\n" + "%s\n" + "\n" + "CREATE [ OR REPLACE ] AGGREGATE %s (\n" + " BASETYPE = %s,\n" + " SFUNC = %s,\n" + " STYPE = %s\n" + " [ , SSPACE = %s ]\n" + " [ , FINALFUNC = %s ]\n" + " [ , FINALFUNC_EXTRA ]\n" + " [ , FINALFUNC_MODIFY = { READ_ONLY | SHAREABLE | READ_WRITE } ]\n" + " [ , COMBINEFUNC = %s ]\n" + " [ , SERIALFUNC = %s ]\n" + " [ , DESERIALFUNC = %s ]\n" + " [ , INITCOND = %s ]\n" + " [ , MSFUNC = %s ]\n" + " [ , MINVFUNC = %s ]\n" + " [ , MSTYPE = %s ]\n" + " [ , MSSPACE = %s ]\n" + " [ , MFINALFUNC = %s ]\n" + " [ , MFINALFUNC_EXTRA ]\n" + " [ , MFINALFUNC_MODIFY = { READ_ONLY | SHAREABLE | READ_WRITE } ]\n" + " [ , MINITCOND = %s ]\n" + " [ , SORTOP = %s ]\n" + ")", + _("name"), + _("argmode"), + _("argname"), + _("arg_data_type"), + _("sfunc"), + _("state_data_type"), + _("state_data_size"), + _("ffunc"), + _("combinefunc"), + _("serialfunc"), + _("deserialfunc"), + _("initial_condition"), + _("msfunc"), + _("minvfunc"), + _("mstate_data_type"), + _("mstate_data_size"), + _("mffunc"), + _("minitial_condition"), + _("sort_operator"), + _("name"), + _("argmode"), + _("argname"), + _("arg_data_type"), + _("argmode"), + _("argname"), + _("arg_data_type"), + _("sfunc"), + _("state_data_type"), + _("state_data_size"), + _("ffunc"), + _("initial_condition"), + _("or the old syntax"), + _("name"), + _("base_type"), + _("sfunc"), + _("state_data_type"), + _("state_data_size"), + _("ffunc"), + _("combinefunc"), + _("serialfunc"), + _("deserialfunc"), + _("initial_condition"), + _("msfunc"), + _("minvfunc"), + _("mstate_data_type"), + _("mstate_data_size"), + _("mffunc"), + _("minitial_condition"), + _("sort_operator")); +} + +static void +sql_help_CREATE_CAST(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE CAST (%s AS %s)\n" + " WITH FUNCTION %s [ (%s [, ...]) ]\n" + " [ AS ASSIGNMENT | AS IMPLICIT ]\n" + "\n" + "CREATE CAST (%s AS %s)\n" + " WITHOUT FUNCTION\n" + " [ AS ASSIGNMENT | AS IMPLICIT ]\n" + "\n" + "CREATE CAST (%s AS %s)\n" + " WITH INOUT\n" + " [ AS ASSIGNMENT | AS IMPLICIT ]", + _("source_type"), + _("target_type"), + _("function_name"), + _("argument_type"), + _("source_type"), + _("target_type"), + _("source_type"), + _("target_type")); +} + +static void +sql_help_CREATE_COLLATION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE COLLATION [ IF NOT EXISTS ] %s (\n" + " [ LOCALE = %s, ]\n" + " [ LC_COLLATE = %s, ]\n" + " [ LC_CTYPE = %s, ]\n" + " [ PROVIDER = %s, ]\n" + " [ DETERMINISTIC = %s, ]\n" + " [ VERSION = %s ]\n" + ")\n" + "CREATE COLLATION [ IF NOT EXISTS ] %s FROM %s", + _("name"), + _("locale"), + _("lc_collate"), + _("lc_ctype"), + _("provider"), + _("boolean"), + _("version"), + _("name"), + _("existing_collation")); +} + +static void +sql_help_CREATE_CONVERSION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE [ DEFAULT ] CONVERSION %s\n" + " FOR %s TO %s FROM %s", + _("name"), + _("source_encoding"), + _("dest_encoding"), + _("function_name")); +} + +static void +sql_help_CREATE_DATABASE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE DATABASE %s\n" + " [ [ WITH ] [ OWNER [=] %s ]\n" + " [ TEMPLATE [=] %s ]\n" + " [ ENCODING [=] %s ]\n" + " [ LOCALE [=] %s ]\n" + " [ LC_COLLATE [=] %s ]\n" + " [ LC_CTYPE [=] %s ]\n" + " [ TABLESPACE [=] %s ]\n" + " [ ALLOW_CONNECTIONS [=] %s ]\n" + " [ CONNECTION LIMIT [=] %s ]\n" + " [ IS_TEMPLATE [=] %s ] ]", + _("name"), + _("user_name"), + _("template"), + _("encoding"), + _("locale"), + _("lc_collate"), + _("lc_ctype"), + _("tablespace_name"), + _("allowconn"), + _("connlimit"), + _("istemplate")); +} + +static void +sql_help_CREATE_DOMAIN(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE DOMAIN %s [ AS ] %s\n" + " [ COLLATE %s ]\n" + " [ DEFAULT %s ]\n" + " [ %s [ ... ] ]\n" + "\n" + "%s\n" + "\n" + "[ CONSTRAINT %s ]\n" + "{ NOT NULL | NULL | CHECK (%s) }", + _("name"), + _("data_type"), + _("collation"), + _("expression"), + _("constraint"), + _("where constraint is:"), + _("constraint_name"), + _("expression")); +} + +static void +sql_help_CREATE_EVENT_TRIGGER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE EVENT TRIGGER %s\n" + " ON %s\n" + " [ WHEN %s IN (%s [, ... ]) [ AND ... ] ]\n" + " EXECUTE { FUNCTION | PROCEDURE } %s()", + _("name"), + _("event"), + _("filter_variable"), + _("filter_value"), + _("function_name")); +} + +static void +sql_help_CREATE_EXTENSION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE EXTENSION [ IF NOT EXISTS ] %s\n" + " [ WITH ] [ SCHEMA %s ]\n" + " [ VERSION %s ]\n" + " [ CASCADE ]", + _("extension_name"), + _("schema_name"), + _("version")); +} + +static void +sql_help_CREATE_FOREIGN_DATA_WRAPPER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE FOREIGN DATA WRAPPER %s\n" + " [ HANDLER %s | NO HANDLER ]\n" + " [ VALIDATOR %s | NO VALIDATOR ]\n" + " [ OPTIONS ( %s '%s' [, ... ] ) ]", + _("name"), + _("handler_function"), + _("validator_function"), + _("option"), + _("value")); +} + +static void +sql_help_CREATE_FOREIGN_TABLE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE FOREIGN TABLE [ IF NOT EXISTS ] %s ( [\n" + " { %s %s [ OPTIONS ( %s '%s' [, ... ] ) ] [ COLLATE %s ] [ %s [ ... ] ]\n" + " | %s }\n" + " [, ... ]\n" + "] )\n" + "[ INHERITS ( %s [, ... ] ) ]\n" + " SERVER %s\n" + "[ OPTIONS ( %s '%s' [, ... ] ) ]\n" + "\n" + "CREATE FOREIGN TABLE [ IF NOT EXISTS ] %s\n" + " PARTITION OF %s [ (\n" + " { %s [ WITH OPTIONS ] [ %s [ ... ] ]\n" + " | %s }\n" + " [, ... ]\n" + ") ] %s\n" + " SERVER %s\n" + "[ OPTIONS ( %s '%s' [, ... ] ) ]\n" + "\n" + "%s\n" + "\n" + "[ CONSTRAINT %s ]\n" + "{ NOT NULL |\n" + " NULL |\n" + " CHECK ( %s ) [ NO INHERIT ] |\n" + " DEFAULT %s |\n" + " GENERATED ALWAYS AS ( %s ) STORED }\n" + "\n" + "%s\n" + "\n" + "[ CONSTRAINT %s ]\n" + "CHECK ( %s ) [ NO INHERIT ]", + _("table_name"), + _("column_name"), + _("data_type"), + _("option"), + _("value"), + _("collation"), + _("column_constraint"), + _("table_constraint"), + _("parent_table"), + _("server_name"), + _("option"), + _("value"), + _("table_name"), + _("parent_table"), + _("column_name"), + _("column_constraint"), + _("table_constraint"), + _("partition_bound_spec"), + _("server_name"), + _("option"), + _("value"), + _("where column_constraint is:"), + _("constraint_name"), + _("expression"), + _("default_expr"), + _("generation_expr"), + _("and table_constraint is:"), + _("constraint_name"), + _("expression")); +} + +static void +sql_help_CREATE_FUNCTION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE [ OR REPLACE ] FUNCTION\n" + " %s ( [ [ %s ] [ %s ] %s [ { DEFAULT | = } %s ] [, ...] ] )\n" + " [ RETURNS %s\n" + " | RETURNS TABLE ( %s %s [, ...] ) ]\n" + " { LANGUAGE %s\n" + " | TRANSFORM { FOR TYPE %s } [, ... ]\n" + " | WINDOW\n" + " | { IMMUTABLE | STABLE | VOLATILE }\n" + " | [ NOT ] LEAKPROOF\n" + " | { CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT }\n" + " | { [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER }\n" + " | PARALLEL { UNSAFE | RESTRICTED | SAFE }\n" + " | COST %s\n" + " | ROWS %s\n" + " | SUPPORT %s\n" + " | SET %s { TO %s | = %s | FROM CURRENT }\n" + " | AS '%s'\n" + " | AS '%s', '%s'\n" + " | %s\n" + " } ...", + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("default_expr"), + _("rettype"), + _("column_name"), + _("column_type"), + _("lang_name"), + _("type_name"), + _("execution_cost"), + _("result_rows"), + _("support_function"), + _("configuration_parameter"), + _("value"), + _("value"), + _("definition"), + _("obj_file"), + _("link_symbol"), + _("sql_body")); +} + +static void +sql_help_CREATE_GROUP(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE GROUP %s [ [ WITH ] %s [ ... ] ]\n" + "\n" + "%s\n" + "\n" + " SUPERUSER | NOSUPERUSER\n" + " | CREATEDB | NOCREATEDB\n" + " | CREATEROLE | NOCREATEROLE\n" + " | INHERIT | NOINHERIT\n" + " | LOGIN | NOLOGIN\n" + " | REPLICATION | NOREPLICATION\n" + " | BYPASSRLS | NOBYPASSRLS\n" + " | CONNECTION LIMIT %s\n" + " | [ ENCRYPTED ] PASSWORD '%s' | PASSWORD NULL\n" + " | VALID UNTIL '%s'\n" + " | IN ROLE %s [, ...]\n" + " | IN GROUP %s [, ...]\n" + " | ROLE %s [, ...]\n" + " | ADMIN %s [, ...]\n" + " | USER %s [, ...]\n" + " | SYSID %s", + _("name"), + _("option"), + _("where option can be:"), + _("connlimit"), + _("password"), + _("timestamp"), + _("role_name"), + _("role_name"), + _("role_name"), + _("role_name"), + _("role_name"), + _("uid")); +} + +static void +sql_help_CREATE_INDEX(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ [ IF NOT EXISTS ] %s ] ON [ ONLY ] %s [ USING %s ]\n" + " ( { %s | ( %s ) } [ COLLATE %s ] [ %s [ ( %s = %s [, ... ] ) ] ] [ ASC | DESC ] [ NULLS { FIRST | LAST } ] [, ...] )\n" + " [ INCLUDE ( %s [, ...] ) ]\n" + " [ WITH ( %s [= %s] [, ... ] ) ]\n" + " [ TABLESPACE %s ]\n" + " [ WHERE %s ]", + _("name"), + _("table_name"), + _("method"), + _("column_name"), + _("expression"), + _("collation"), + _("opclass"), + _("opclass_parameter"), + _("value"), + _("column_name"), + _("storage_parameter"), + _("value"), + _("tablespace_name"), + _("predicate")); +} + +static void +sql_help_CREATE_LANGUAGE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE %s\n" + " HANDLER %s [ INLINE %s ] [ VALIDATOR %s ]\n" + "CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE %s", + _("name"), + _("call_handler"), + _("inline_handler"), + _("valfunction"), + _("name")); +} + +static void +sql_help_CREATE_MATERIALIZED_VIEW(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE MATERIALIZED VIEW [ IF NOT EXISTS ] %s\n" + " [ (%s [, ...] ) ]\n" + " [ USING %s ]\n" + " [ WITH ( %s [= %s] [, ... ] ) ]\n" + " [ TABLESPACE %s ]\n" + " AS %s\n" + " [ WITH [ NO ] DATA ]", + _("table_name"), + _("column_name"), + _("method"), + _("storage_parameter"), + _("value"), + _("tablespace_name"), + _("query")); +} + +static void +sql_help_CREATE_OPERATOR(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE OPERATOR %s (\n" + " {FUNCTION|PROCEDURE} = %s\n" + " [, LEFTARG = %s ] [, RIGHTARG = %s ]\n" + " [, COMMUTATOR = %s ] [, NEGATOR = %s ]\n" + " [, RESTRICT = %s ] [, JOIN = %s ]\n" + " [, HASHES ] [, MERGES ]\n" + ")", + _("name"), + _("function_name"), + _("left_type"), + _("right_type"), + _("com_op"), + _("neg_op"), + _("res_proc"), + _("join_proc")); +} + +static void +sql_help_CREATE_OPERATOR_CLASS(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE OPERATOR CLASS %s [ DEFAULT ] FOR TYPE %s\n" + " USING %s [ FAMILY %s ] AS\n" + " { OPERATOR %s %s [ ( %s, %s ) ] [ FOR SEARCH | FOR ORDER BY %s ]\n" + " | FUNCTION %s [ ( %s [ , %s ] ) ] %s ( %s [, ...] )\n" + " | STORAGE %s\n" + " } [, ... ]", + _("name"), + _("data_type"), + _("index_method"), + _("family_name"), + _("strategy_number"), + _("operator_name"), + _("op_type"), + _("op_type"), + _("sort_family_name"), + _("support_number"), + _("op_type"), + _("op_type"), + _("function_name"), + _("argument_type"), + _("storage_type")); +} + +static void +sql_help_CREATE_OPERATOR_FAMILY(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE OPERATOR FAMILY %s USING %s", + _("name"), + _("index_method")); +} + +static void +sql_help_CREATE_POLICY(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE POLICY %s ON %s\n" + " [ AS { PERMISSIVE | RESTRICTIVE } ]\n" + " [ FOR { ALL | SELECT | INSERT | UPDATE | DELETE } ]\n" + " [ TO { %s | PUBLIC | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] ]\n" + " [ USING ( %s ) ]\n" + " [ WITH CHECK ( %s ) ]", + _("name"), + _("table_name"), + _("role_name"), + _("using_expression"), + _("check_expression")); +} + +static void +sql_help_CREATE_PROCEDURE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE [ OR REPLACE ] PROCEDURE\n" + " %s ( [ [ %s ] [ %s ] %s [ { DEFAULT | = } %s ] [, ...] ] )\n" + " { LANGUAGE %s\n" + " | TRANSFORM { FOR TYPE %s } [, ... ]\n" + " | [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER\n" + " | SET %s { TO %s | = %s | FROM CURRENT }\n" + " | AS '%s'\n" + " | AS '%s', '%s'\n" + " | %s\n" + " } ...", + _("name"), + _("argmode"), + _("argname"), + _("argtype"), + _("default_expr"), + _("lang_name"), + _("type_name"), + _("configuration_parameter"), + _("value"), + _("value"), + _("definition"), + _("obj_file"), + _("link_symbol"), + _("sql_body")); +} + +static void +sql_help_CREATE_PUBLICATION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE PUBLICATION %s\n" + " [ FOR TABLE [ ONLY ] %s [ * ] [, ...]\n" + " | FOR ALL TABLES ]\n" + " [ WITH ( %s [= %s] [, ... ] ) ]", + _("name"), + _("table_name"), + _("publication_parameter"), + _("value")); +} + +static void +sql_help_CREATE_ROLE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE ROLE %s [ [ WITH ] %s [ ... ] ]\n" + "\n" + "%s\n" + "\n" + " SUPERUSER | NOSUPERUSER\n" + " | CREATEDB | NOCREATEDB\n" + " | CREATEROLE | NOCREATEROLE\n" + " | INHERIT | NOINHERIT\n" + " | LOGIN | NOLOGIN\n" + " | REPLICATION | NOREPLICATION\n" + " | BYPASSRLS | NOBYPASSRLS\n" + " | CONNECTION LIMIT %s\n" + " | [ ENCRYPTED ] PASSWORD '%s' | PASSWORD NULL\n" + " | VALID UNTIL '%s'\n" + " | IN ROLE %s [, ...]\n" + " | IN GROUP %s [, ...]\n" + " | ROLE %s [, ...]\n" + " | ADMIN %s [, ...]\n" + " | USER %s [, ...]\n" + " | SYSID %s", + _("name"), + _("option"), + _("where option can be:"), + _("connlimit"), + _("password"), + _("timestamp"), + _("role_name"), + _("role_name"), + _("role_name"), + _("role_name"), + _("role_name"), + _("uid")); +} + +static void +sql_help_CREATE_RULE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE [ OR REPLACE ] RULE %s AS ON %s\n" + " TO %s [ WHERE %s ]\n" + " DO [ ALSO | INSTEAD ] { NOTHING | %s | ( %s ; %s ... ) }\n" + "\n" + "%s\n" + "\n" + " SELECT | INSERT | UPDATE | DELETE", + _("name"), + _("event"), + _("table_name"), + _("condition"), + _("command"), + _("command"), + _("command"), + _("where event can be one of:")); +} + +static void +sql_help_CREATE_SCHEMA(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE SCHEMA %s [ AUTHORIZATION %s ] [ %s [ ... ] ]\n" + "CREATE SCHEMA AUTHORIZATION %s [ %s [ ... ] ]\n" + "CREATE SCHEMA IF NOT EXISTS %s [ AUTHORIZATION %s ]\n" + "CREATE SCHEMA IF NOT EXISTS AUTHORIZATION %s\n" + "\n" + "%s\n" + "\n" + " %s\n" + " | CURRENT_ROLE\n" + " | CURRENT_USER\n" + " | SESSION_USER", + _("schema_name"), + _("role_specification"), + _("schema_element"), + _("role_specification"), + _("schema_element"), + _("schema_name"), + _("role_specification"), + _("role_specification"), + _("where role_specification can be:"), + _("user_name")); +} + +static void +sql_help_CREATE_SEQUENCE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE [ TEMPORARY | TEMP ] SEQUENCE [ IF NOT EXISTS ] %s\n" + " [ AS %s ]\n" + " [ INCREMENT [ BY ] %s ]\n" + " [ MINVALUE %s | NO MINVALUE ] [ MAXVALUE %s | NO MAXVALUE ]\n" + " [ START [ WITH ] %s ] [ CACHE %s ] [ [ NO ] CYCLE ]\n" + " [ OWNED BY { %s.%s | NONE } ]", + _("name"), + _("data_type"), + _("increment"), + _("minvalue"), + _("maxvalue"), + _("start"), + _("cache"), + _("table_name"), + _("column_name")); +} + +static void +sql_help_CREATE_SERVER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE SERVER [ IF NOT EXISTS ] %s [ TYPE '%s' ] [ VERSION '%s' ]\n" + " FOREIGN DATA WRAPPER %s\n" + " [ OPTIONS ( %s '%s' [, ... ] ) ]", + _("server_name"), + _("server_type"), + _("server_version"), + _("fdw_name"), + _("option"), + _("value")); +} + +static void +sql_help_CREATE_STATISTICS(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE STATISTICS [ IF NOT EXISTS ] %s\n" + " ON ( %s )\n" + " FROM %s\n" + "\n" + "CREATE STATISTICS [ IF NOT EXISTS ] %s\n" + " [ ( %s [, ... ] ) ]\n" + " ON { %s | ( %s ) }, { %s | ( %s ) } [, ...]\n" + " FROM %s", + _("statistics_name"), + _("expression"), + _("table_name"), + _("statistics_name"), + _("statistics_kind"), + _("column_name"), + _("expression"), + _("column_name"), + _("expression"), + _("table_name")); +} + +static void +sql_help_CREATE_SUBSCRIPTION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE SUBSCRIPTION %s\n" + " CONNECTION '%s'\n" + " PUBLICATION %s [, ...]\n" + " [ WITH ( %s [= %s] [, ... ] ) ]", + _("subscription_name"), + _("conninfo"), + _("publication_name"), + _("subscription_parameter"), + _("value")); +} + +static void +sql_help_CREATE_TABLE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXISTS ] %s ( [\n" + " { %s %s [ COMPRESSION %s ] [ COLLATE %s ] [ %s [ ... ] ]\n" + " | %s\n" + " | LIKE %s [ %s ... ] }\n" + " [, ... ]\n" + "] )\n" + "[ INHERITS ( %s [, ... ] ) ]\n" + "[ PARTITION BY { RANGE | LIST | HASH } ( { %s | ( %s ) } [ COLLATE %s ] [ %s ] [, ... ] ) ]\n" + "[ USING %s ]\n" + "[ WITH ( %s [= %s] [, ... ] ) | WITHOUT OIDS ]\n" + "[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]\n" + "[ TABLESPACE %s ]\n" + "\n" + "CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXISTS ] %s\n" + " OF %s [ (\n" + " { %s [ WITH OPTIONS ] [ %s [ ... ] ]\n" + " | %s }\n" + " [, ... ]\n" + ") ]\n" + "[ PARTITION BY { RANGE | LIST | HASH } ( { %s | ( %s ) } [ COLLATE %s ] [ %s ] [, ... ] ) ]\n" + "[ USING %s ]\n" + "[ WITH ( %s [= %s] [, ... ] ) | WITHOUT OIDS ]\n" + "[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]\n" + "[ TABLESPACE %s ]\n" + "\n" + "CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXISTS ] %s\n" + " PARTITION OF %s [ (\n" + " { %s [ WITH OPTIONS ] [ %s [ ... ] ]\n" + " | %s }\n" + " [, ... ]\n" + ") ] { FOR VALUES %s | DEFAULT }\n" + "[ PARTITION BY { RANGE | LIST | HASH } ( { %s | ( %s ) } [ COLLATE %s ] [ %s ] [, ... ] ) ]\n" + "[ USING %s ]\n" + "[ WITH ( %s [= %s] [, ... ] ) | WITHOUT OIDS ]\n" + "[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]\n" + "[ TABLESPACE %s ]\n" + "\n" + "%s\n" + "\n" + "[ CONSTRAINT %s ]\n" + "{ NOT NULL |\n" + " NULL |\n" + " CHECK ( %s ) [ NO INHERIT ] |\n" + " DEFAULT %s |\n" + " GENERATED ALWAYS AS ( %s ) STORED |\n" + " GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( %s ) ] |\n" + " UNIQUE %s |\n" + " PRIMARY KEY %s |\n" + " REFERENCES %s [ ( %s ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ]\n" + " [ ON DELETE %s ] [ ON UPDATE %s ] }\n" + "[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]\n" + "\n" + "%s\n" + "\n" + "[ CONSTRAINT %s ]\n" + "{ CHECK ( %s ) [ NO INHERIT ] |\n" + " UNIQUE ( %s [, ... ] ) %s |\n" + " PRIMARY KEY ( %s [, ... ] ) %s |\n" + " EXCLUDE [ USING %s ] ( %s WITH %s [, ... ] ) %s [ WHERE ( %s ) ] |\n" + " FOREIGN KEY ( %s [, ... ] ) REFERENCES %s [ ( %s [, ... ] ) ]\n" + " [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE %s ] [ ON UPDATE %s ] }\n" + "[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]\n" + "\n" + "%s\n" + "\n" + "{ INCLUDING | EXCLUDING } { COMMENTS | COMPRESSION | CONSTRAINTS | DEFAULTS | GENERATED | IDENTITY | INDEXES | STATISTICS | STORAGE | ALL }\n" + "\n" + "%s\n" + "\n" + "IN ( %s [, ...] ) |\n" + "FROM ( { %s | MINVALUE | MAXVALUE } [, ...] )\n" + " TO ( { %s | MINVALUE | MAXVALUE } [, ...] ) |\n" + "WITH ( MODULUS %s, REMAINDER %s )\n" + "\n" + "%s\n" + "\n" + "[ INCLUDE ( %s [, ... ] ) ]\n" + "[ WITH ( %s [= %s] [, ... ] ) ]\n" + "[ USING INDEX TABLESPACE %s ]\n" + "\n" + "%s\n" + "\n" + "{ %s | ( %s ) } [ %s ] [ ASC | DESC ] [ NULLS { FIRST | LAST } ]", + _("table_name"), + _("column_name"), + _("data_type"), + _("compression_method"), + _("collation"), + _("column_constraint"), + _("table_constraint"), + _("source_table"), + _("like_option"), + _("parent_table"), + _("column_name"), + _("expression"), + _("collation"), + _("opclass"), + _("method"), + _("storage_parameter"), + _("value"), + _("tablespace_name"), + _("table_name"), + _("type_name"), + _("column_name"), + _("column_constraint"), + _("table_constraint"), + _("column_name"), + _("expression"), + _("collation"), + _("opclass"), + _("method"), + _("storage_parameter"), + _("value"), + _("tablespace_name"), + _("table_name"), + _("parent_table"), + _("column_name"), + _("column_constraint"), + _("table_constraint"), + _("partition_bound_spec"), + _("column_name"), + _("expression"), + _("collation"), + _("opclass"), + _("method"), + _("storage_parameter"), + _("value"), + _("tablespace_name"), + _("where column_constraint is:"), + _("constraint_name"), + _("expression"), + _("default_expr"), + _("generation_expr"), + _("sequence_options"), + _("index_parameters"), + _("index_parameters"), + _("reftable"), + _("refcolumn"), + _("referential_action"), + _("referential_action"), + _("and table_constraint is:"), + _("constraint_name"), + _("expression"), + _("column_name"), + _("index_parameters"), + _("column_name"), + _("index_parameters"), + _("index_method"), + _("exclude_element"), + _("operator"), + _("index_parameters"), + _("predicate"), + _("column_name"), + _("reftable"), + _("refcolumn"), + _("referential_action"), + _("referential_action"), + _("and like_option is:"), + _("and partition_bound_spec is:"), + _("partition_bound_expr"), + _("partition_bound_expr"), + _("partition_bound_expr"), + _("numeric_literal"), + _("numeric_literal"), + _("index_parameters in UNIQUE, PRIMARY KEY, and EXCLUDE constraints are:"), + _("column_name"), + _("storage_parameter"), + _("value"), + _("tablespace_name"), + _("exclude_element in an EXCLUDE constraint is:"), + _("column_name"), + _("expression"), + _("opclass")); +} + +static void +sql_help_CREATE_TABLE_AS(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXISTS ] %s\n" + " [ (%s [, ...] ) ]\n" + " [ USING %s ]\n" + " [ WITH ( %s [= %s] [, ... ] ) | WITHOUT OIDS ]\n" + " [ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]\n" + " [ TABLESPACE %s ]\n" + " AS %s\n" + " [ WITH [ NO ] DATA ]", + _("table_name"), + _("column_name"), + _("method"), + _("storage_parameter"), + _("value"), + _("tablespace_name"), + _("query")); +} + +static void +sql_help_CREATE_TABLESPACE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE TABLESPACE %s\n" + " [ OWNER { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER } ]\n" + " LOCATION '%s'\n" + " [ WITH ( %s = %s [, ... ] ) ]", + _("tablespace_name"), + _("new_owner"), + _("directory"), + _("tablespace_option"), + _("value")); +} + +static void +sql_help_CREATE_TEXT_SEARCH_CONFIGURATION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE TEXT SEARCH CONFIGURATION %s (\n" + " PARSER = %s |\n" + " COPY = %s\n" + ")", + _("name"), + _("parser_name"), + _("source_config")); +} + +static void +sql_help_CREATE_TEXT_SEARCH_DICTIONARY(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE TEXT SEARCH DICTIONARY %s (\n" + " TEMPLATE = %s\n" + " [, %s = %s [, ... ]]\n" + ")", + _("name"), + _("template"), + _("option"), + _("value")); +} + +static void +sql_help_CREATE_TEXT_SEARCH_PARSER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE TEXT SEARCH PARSER %s (\n" + " START = %s ,\n" + " GETTOKEN = %s ,\n" + " END = %s ,\n" + " LEXTYPES = %s\n" + " [, HEADLINE = %s ]\n" + ")", + _("name"), + _("start_function"), + _("gettoken_function"), + _("end_function"), + _("lextypes_function"), + _("headline_function")); +} + +static void +sql_help_CREATE_TEXT_SEARCH_TEMPLATE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE TEXT SEARCH TEMPLATE %s (\n" + " [ INIT = %s , ]\n" + " LEXIZE = %s\n" + ")", + _("name"), + _("init_function"), + _("lexize_function")); +} + +static void +sql_help_CREATE_TRANSFORM(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE [ OR REPLACE ] TRANSFORM FOR %s LANGUAGE %s (\n" + " FROM SQL WITH FUNCTION %s [ (%s [, ...]) ],\n" + " TO SQL WITH FUNCTION %s [ (%s [, ...]) ]\n" + ");", + _("type_name"), + _("lang_name"), + _("from_sql_function_name"), + _("argument_type"), + _("to_sql_function_name"), + _("argument_type")); +} + +static void +sql_help_CREATE_TRIGGER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE [ OR REPLACE ] [ CONSTRAINT ] TRIGGER %s { BEFORE | AFTER | INSTEAD OF } { %s [ OR ... ] }\n" + " ON %s\n" + " [ FROM %s ]\n" + " [ NOT DEFERRABLE | [ DEFERRABLE ] [ INITIALLY IMMEDIATE | INITIALLY DEFERRED ] ]\n" + " [ REFERENCING { { OLD | NEW } TABLE [ AS ] %s } [ ... ] ]\n" + " [ FOR [ EACH ] { ROW | STATEMENT } ]\n" + " [ WHEN ( %s ) ]\n" + " EXECUTE { FUNCTION | PROCEDURE } %s ( %s )\n" + "\n" + "%s\n" + "\n" + " INSERT\n" + " UPDATE [ OF %s [, ... ] ]\n" + " DELETE\n" + " TRUNCATE", + _("name"), + _("event"), + _("table_name"), + _("referenced_table_name"), + _("transition_relation_name"), + _("condition"), + _("function_name"), + _("arguments"), + _("where event can be one of:"), + _("column_name")); +} + +static void +sql_help_CREATE_TYPE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE TYPE %s AS\n" + " ( [ %s %s [ COLLATE %s ] [, ... ] ] )\n" + "\n" + "CREATE TYPE %s AS ENUM\n" + " ( [ '%s' [, ... ] ] )\n" + "\n" + "CREATE TYPE %s AS RANGE (\n" + " SUBTYPE = %s\n" + " [ , SUBTYPE_OPCLASS = %s ]\n" + " [ , COLLATION = %s ]\n" + " [ , CANONICAL = %s ]\n" + " [ , SUBTYPE_DIFF = %s ]\n" + " [ , MULTIRANGE_TYPE_NAME = %s ]\n" + ")\n" + "\n" + "CREATE TYPE %s (\n" + " INPUT = %s,\n" + " OUTPUT = %s\n" + " [ , RECEIVE = %s ]\n" + " [ , SEND = %s ]\n" + " [ , TYPMOD_IN = %s ]\n" + " [ , TYPMOD_OUT = %s ]\n" + " [ , ANALYZE = %s ]\n" + " [ , SUBSCRIPT = %s ]\n" + " [ , INTERNALLENGTH = { %s | VARIABLE } ]\n" + " [ , PASSEDBYVALUE ]\n" + " [ , ALIGNMENT = %s ]\n" + " [ , STORAGE = %s ]\n" + " [ , LIKE = %s ]\n" + " [ , CATEGORY = %s ]\n" + " [ , PREFERRED = %s ]\n" + " [ , DEFAULT = %s ]\n" + " [ , ELEMENT = %s ]\n" + " [ , DELIMITER = %s ]\n" + " [ , COLLATABLE = %s ]\n" + ")\n" + "\n" + "CREATE TYPE %s", + _("name"), + _("attribute_name"), + _("data_type"), + _("collation"), + _("name"), + _("label"), + _("name"), + _("subtype"), + _("subtype_operator_class"), + _("collation"), + _("canonical_function"), + _("subtype_diff_function"), + _("multirange_type_name"), + _("name"), + _("input_function"), + _("output_function"), + _("receive_function"), + _("send_function"), + _("type_modifier_input_function"), + _("type_modifier_output_function"), + _("analyze_function"), + _("subscript_function"), + _("internallength"), + _("alignment"), + _("storage"), + _("like_type"), + _("category"), + _("preferred"), + _("default"), + _("element"), + _("delimiter"), + _("collatable"), + _("name")); +} + +static void +sql_help_CREATE_USER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE USER %s [ [ WITH ] %s [ ... ] ]\n" + "\n" + "%s\n" + "\n" + " SUPERUSER | NOSUPERUSER\n" + " | CREATEDB | NOCREATEDB\n" + " | CREATEROLE | NOCREATEROLE\n" + " | INHERIT | NOINHERIT\n" + " | LOGIN | NOLOGIN\n" + " | REPLICATION | NOREPLICATION\n" + " | BYPASSRLS | NOBYPASSRLS\n" + " | CONNECTION LIMIT %s\n" + " | [ ENCRYPTED ] PASSWORD '%s' | PASSWORD NULL\n" + " | VALID UNTIL '%s'\n" + " | IN ROLE %s [, ...]\n" + " | IN GROUP %s [, ...]\n" + " | ROLE %s [, ...]\n" + " | ADMIN %s [, ...]\n" + " | USER %s [, ...]\n" + " | SYSID %s", + _("name"), + _("option"), + _("where option can be:"), + _("connlimit"), + _("password"), + _("timestamp"), + _("role_name"), + _("role_name"), + _("role_name"), + _("role_name"), + _("role_name"), + _("uid")); +} + +static void +sql_help_CREATE_USER_MAPPING(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE USER MAPPING [ IF NOT EXISTS ] FOR { %s | USER | CURRENT_ROLE | CURRENT_USER | PUBLIC }\n" + " SERVER %s\n" + " [ OPTIONS ( %s '%s' [ , ... ] ) ]", + _("user_name"), + _("server_name"), + _("option"), + _("value")); +} + +static void +sql_help_CREATE_VIEW(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "CREATE [ OR REPLACE ] [ TEMP | TEMPORARY ] [ RECURSIVE ] VIEW %s [ ( %s [, ...] ) ]\n" + " [ WITH ( %s [= %s] [, ... ] ) ]\n" + " AS %s\n" + " [ WITH [ CASCADED | LOCAL ] CHECK OPTION ]", + _("name"), + _("column_name"), + _("view_option_name"), + _("view_option_value"), + _("query")); +} + +static void +sql_help_DEALLOCATE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DEALLOCATE [ PREPARE ] { %s | ALL }", + _("name")); +} + +static void +sql_help_DECLARE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DECLARE %s [ BINARY ] [ ASENSITIVE | INSENSITIVE ] [ [ NO ] SCROLL ]\n" + " CURSOR [ { WITH | WITHOUT } HOLD ] FOR %s", + _("name"), + _("query")); +} + +static void +sql_help_DELETE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "[ WITH [ RECURSIVE ] %s [, ...] ]\n" + "DELETE FROM [ ONLY ] %s [ * ] [ [ AS ] %s ]\n" + " [ USING %s [, ...] ]\n" + " [ WHERE %s | WHERE CURRENT OF %s ]\n" + " [ RETURNING * | %s [ [ AS ] %s ] [, ...] ]", + _("with_query"), + _("table_name"), + _("alias"), + _("from_item"), + _("condition"), + _("cursor_name"), + _("output_expression"), + _("output_name")); +} + +static void +sql_help_DISCARD(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DISCARD { ALL | PLANS | SEQUENCES | TEMPORARY | TEMP }"); +} + +static void +sql_help_DO(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DO [ LANGUAGE %s ] %s", + _("lang_name"), + _("code")); +} + +static void +sql_help_DROP_ACCESS_METHOD(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP ACCESS METHOD [ IF EXISTS ] %s [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_AGGREGATE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP AGGREGATE [ IF EXISTS ] %s ( %s ) [, ...] [ CASCADE | RESTRICT ]\n" + "\n" + "%s\n" + "\n" + "* |\n" + "[ %s ] [ %s ] %s [ , ... ] |\n" + "[ [ %s ] [ %s ] %s [ , ... ] ] ORDER BY [ %s ] [ %s ] %s [ , ... ]", + _("name"), + _("aggregate_signature"), + _("where aggregate_signature is:"), + _("argmode"), + _("argname"), + _("argtype"), + _("argmode"), + _("argname"), + _("argtype"), + _("argmode"), + _("argname"), + _("argtype")); +} + +static void +sql_help_DROP_CAST(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP CAST [ IF EXISTS ] (%s AS %s) [ CASCADE | RESTRICT ]", + _("source_type"), + _("target_type")); +} + +static void +sql_help_DROP_COLLATION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP COLLATION [ IF EXISTS ] %s [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_CONVERSION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP CONVERSION [ IF EXISTS ] %s [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_DATABASE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP DATABASE [ IF EXISTS ] %s [ [ WITH ] ( %s [, ...] ) ]\n" + "\n" + "%s\n" + "\n" + " FORCE", + _("name"), + _("option"), + _("where option can be:")); +} + +static void +sql_help_DROP_DOMAIN(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP DOMAIN [ IF EXISTS ] %s [, ...] [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_EVENT_TRIGGER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP EVENT TRIGGER [ IF EXISTS ] %s [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_EXTENSION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP EXTENSION [ IF EXISTS ] %s [, ...] [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_FOREIGN_DATA_WRAPPER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP FOREIGN DATA WRAPPER [ IF EXISTS ] %s [, ...] [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_FOREIGN_TABLE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP FOREIGN TABLE [ IF EXISTS ] %s [, ...] [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_FUNCTION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP FUNCTION [ IF EXISTS ] %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ] [, ...]\n" + " [ CASCADE | RESTRICT ]", + _("name"), + _("argmode"), + _("argname"), + _("argtype")); +} + +static void +sql_help_DROP_GROUP(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP GROUP [ IF EXISTS ] %s [, ...]", + _("name")); +} + +static void +sql_help_DROP_INDEX(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] %s [, ...] [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_LANGUAGE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP [ PROCEDURAL ] LANGUAGE [ IF EXISTS ] %s [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_MATERIALIZED_VIEW(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP MATERIALIZED VIEW [ IF EXISTS ] %s [, ...] [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_OPERATOR(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP OPERATOR [ IF EXISTS ] %s ( { %s | NONE } , %s ) [, ...] [ CASCADE | RESTRICT ]", + _("name"), + _("left_type"), + _("right_type")); +} + +static void +sql_help_DROP_OPERATOR_CLASS(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP OPERATOR CLASS [ IF EXISTS ] %s USING %s [ CASCADE | RESTRICT ]", + _("name"), + _("index_method")); +} + +static void +sql_help_DROP_OPERATOR_FAMILY(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP OPERATOR FAMILY [ IF EXISTS ] %s USING %s [ CASCADE | RESTRICT ]", + _("name"), + _("index_method")); +} + +static void +sql_help_DROP_OWNED(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP OWNED BY { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_POLICY(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP POLICY [ IF EXISTS ] %s ON %s [ CASCADE | RESTRICT ]", + _("name"), + _("table_name")); +} + +static void +sql_help_DROP_PROCEDURE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP PROCEDURE [ IF EXISTS ] %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ] [, ...]\n" + " [ CASCADE | RESTRICT ]", + _("name"), + _("argmode"), + _("argname"), + _("argtype")); +} + +static void +sql_help_DROP_PUBLICATION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP PUBLICATION [ IF EXISTS ] %s [, ...] [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_ROLE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP ROLE [ IF EXISTS ] %s [, ...]", + _("name")); +} + +static void +sql_help_DROP_ROUTINE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP ROUTINE [ IF EXISTS ] %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ] [, ...]\n" + " [ CASCADE | RESTRICT ]", + _("name"), + _("argmode"), + _("argname"), + _("argtype")); +} + +static void +sql_help_DROP_RULE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP RULE [ IF EXISTS ] %s ON %s [ CASCADE | RESTRICT ]", + _("name"), + _("table_name")); +} + +static void +sql_help_DROP_SCHEMA(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP SCHEMA [ IF EXISTS ] %s [, ...] [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_SEQUENCE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP SEQUENCE [ IF EXISTS ] %s [, ...] [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_SERVER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP SERVER [ IF EXISTS ] %s [, ...] [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_STATISTICS(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP STATISTICS [ IF EXISTS ] %s [, ...] [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_SUBSCRIPTION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP SUBSCRIPTION [ IF EXISTS ] %s [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_TABLE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP TABLE [ IF EXISTS ] %s [, ...] [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_TABLESPACE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP TABLESPACE [ IF EXISTS ] %s", + _("name")); +} + +static void +sql_help_DROP_TEXT_SEARCH_CONFIGURATION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP TEXT SEARCH CONFIGURATION [ IF EXISTS ] %s [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_TEXT_SEARCH_DICTIONARY(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP TEXT SEARCH DICTIONARY [ IF EXISTS ] %s [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_TEXT_SEARCH_PARSER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP TEXT SEARCH PARSER [ IF EXISTS ] %s [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_TEXT_SEARCH_TEMPLATE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP TEXT SEARCH TEMPLATE [ IF EXISTS ] %s [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_TRANSFORM(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP TRANSFORM [ IF EXISTS ] FOR %s LANGUAGE %s [ CASCADE | RESTRICT ]", + _("type_name"), + _("lang_name")); +} + +static void +sql_help_DROP_TRIGGER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP TRIGGER [ IF EXISTS ] %s ON %s [ CASCADE | RESTRICT ]", + _("name"), + _("table_name")); +} + +static void +sql_help_DROP_TYPE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP TYPE [ IF EXISTS ] %s [, ...] [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_DROP_USER(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP USER [ IF EXISTS ] %s [, ...]", + _("name")); +} + +static void +sql_help_DROP_USER_MAPPING(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP USER MAPPING [ IF EXISTS ] FOR { %s | USER | CURRENT_ROLE | CURRENT_USER | PUBLIC } SERVER %s", + _("user_name"), + _("server_name")); +} + +static void +sql_help_DROP_VIEW(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "DROP VIEW [ IF EXISTS ] %s [, ...] [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_END(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "END [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]"); +} + +static void +sql_help_EXECUTE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "EXECUTE %s [ ( %s [, ...] ) ]", + _("name"), + _("parameter")); +} + +static void +sql_help_EXPLAIN(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "EXPLAIN [ ( %s [, ...] ) ] %s\n" + "EXPLAIN [ ANALYZE ] [ VERBOSE ] %s\n" + "\n" + "%s\n" + "\n" + " ANALYZE [ %s ]\n" + " VERBOSE [ %s ]\n" + " COSTS [ %s ]\n" + " SETTINGS [ %s ]\n" + " BUFFERS [ %s ]\n" + " WAL [ %s ]\n" + " TIMING [ %s ]\n" + " SUMMARY [ %s ]\n" + " FORMAT { TEXT | XML | JSON | YAML }", + _("option"), + _("statement"), + _("statement"), + _("where option can be one of:"), + _("boolean"), + _("boolean"), + _("boolean"), + _("boolean"), + _("boolean"), + _("boolean"), + _("boolean"), + _("boolean")); +} + +static void +sql_help_FETCH(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "FETCH [ %s [ FROM | IN ] ] %s\n" + "\n" + "%s\n" + "\n" + " NEXT\n" + " PRIOR\n" + " FIRST\n" + " LAST\n" + " ABSOLUTE %s\n" + " RELATIVE %s\n" + " %s\n" + " ALL\n" + " FORWARD\n" + " FORWARD %s\n" + " FORWARD ALL\n" + " BACKWARD\n" + " BACKWARD %s\n" + " BACKWARD ALL", + _("direction"), + _("cursor_name"), + _("where direction can be empty or one of:"), + _("count"), + _("count"), + _("count"), + _("count"), + _("count")); +} + +static void +sql_help_GRANT(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "GRANT { { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER }\n" + " [, ...] | ALL [ PRIVILEGES ] }\n" + " ON { [ TABLE ] %s [, ...]\n" + " | ALL TABLES IN SCHEMA %s [, ...] }\n" + " TO %s [, ...] [ WITH GRANT OPTION ]\n" + " [ GRANTED BY %s ]\n" + "\n" + "GRANT { { SELECT | INSERT | UPDATE | REFERENCES } ( %s [, ...] )\n" + " [, ...] | ALL [ PRIVILEGES ] ( %s [, ...] ) }\n" + " ON [ TABLE ] %s [, ...]\n" + " TO %s [, ...] [ WITH GRANT OPTION ]\n" + " [ GRANTED BY %s ]\n" + "\n" + "GRANT { { USAGE | SELECT | UPDATE }\n" + " [, ...] | ALL [ PRIVILEGES ] }\n" + " ON { SEQUENCE %s [, ...]\n" + " | ALL SEQUENCES IN SCHEMA %s [, ...] }\n" + " TO %s [, ...] [ WITH GRANT OPTION ]\n" + " [ GRANTED BY %s ]\n" + "\n" + "GRANT { { CREATE | CONNECT | TEMPORARY | TEMP } [, ...] | ALL [ PRIVILEGES ] }\n" + " ON DATABASE %s [, ...]\n" + " TO %s [, ...] [ WITH GRANT OPTION ]\n" + " [ GRANTED BY %s ]\n" + "\n" + "GRANT { USAGE | ALL [ PRIVILEGES ] }\n" + " ON DOMAIN %s [, ...]\n" + " TO %s [, ...] [ WITH GRANT OPTION ]\n" + " [ GRANTED BY %s ]\n" + "\n" + "GRANT { USAGE | ALL [ PRIVILEGES ] }\n" + " ON FOREIGN DATA WRAPPER %s [, ...]\n" + " TO %s [, ...] [ WITH GRANT OPTION ]\n" + " [ GRANTED BY %s ]\n" + "\n" + "GRANT { USAGE | ALL [ PRIVILEGES ] }\n" + " ON FOREIGN SERVER %s [, ...]\n" + " TO %s [, ...] [ WITH GRANT OPTION ]\n" + " [ GRANTED BY %s ]\n" + "\n" + "GRANT { EXECUTE | ALL [ PRIVILEGES ] }\n" + " ON { { FUNCTION | PROCEDURE | ROUTINE } %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ] [, ...]\n" + " | ALL { FUNCTIONS | PROCEDURES | ROUTINES } IN SCHEMA %s [, ...] }\n" + " TO %s [, ...] [ WITH GRANT OPTION ]\n" + " [ GRANTED BY %s ]\n" + "\n" + "GRANT { USAGE | ALL [ PRIVILEGES ] }\n" + " ON LANGUAGE %s [, ...]\n" + " TO %s [, ...] [ WITH GRANT OPTION ]\n" + " [ GRANTED BY %s ]\n" + "\n" + "GRANT { { SELECT | UPDATE } [, ...] | ALL [ PRIVILEGES ] }\n" + " ON LARGE OBJECT %s [, ...]\n" + " TO %s [, ...] [ WITH GRANT OPTION ]\n" + " [ GRANTED BY %s ]\n" + "\n" + "GRANT { { CREATE | USAGE } [, ...] | ALL [ PRIVILEGES ] }\n" + " ON SCHEMA %s [, ...]\n" + " TO %s [, ...] [ WITH GRANT OPTION ]\n" + " [ GRANTED BY %s ]\n" + "\n" + "GRANT { CREATE | ALL [ PRIVILEGES ] }\n" + " ON TABLESPACE %s [, ...]\n" + " TO %s [, ...] [ WITH GRANT OPTION ]\n" + " [ GRANTED BY %s ]\n" + "\n" + "GRANT { USAGE | ALL [ PRIVILEGES ] }\n" + " ON TYPE %s [, ...]\n" + " TO %s [, ...] [ WITH GRANT OPTION ]\n" + " [ GRANTED BY %s ]\n" + "\n" + "GRANT %s [, ...] TO %s [, ...]\n" + " [ WITH ADMIN OPTION ]\n" + " [ GRANTED BY %s ]\n" + "\n" + "%s\n" + "\n" + " [ GROUP ] %s\n" + " | PUBLIC\n" + " | CURRENT_ROLE\n" + " | CURRENT_USER\n" + " | SESSION_USER", + _("table_name"), + _("schema_name"), + _("role_specification"), + _("role_specification"), + _("column_name"), + _("column_name"), + _("table_name"), + _("role_specification"), + _("role_specification"), + _("sequence_name"), + _("schema_name"), + _("role_specification"), + _("role_specification"), + _("database_name"), + _("role_specification"), + _("role_specification"), + _("domain_name"), + _("role_specification"), + _("role_specification"), + _("fdw_name"), + _("role_specification"), + _("role_specification"), + _("server_name"), + _("role_specification"), + _("role_specification"), + _("routine_name"), + _("argmode"), + _("arg_name"), + _("arg_type"), + _("schema_name"), + _("role_specification"), + _("role_specification"), + _("lang_name"), + _("role_specification"), + _("role_specification"), + _("loid"), + _("role_specification"), + _("role_specification"), + _("schema_name"), + _("role_specification"), + _("role_specification"), + _("tablespace_name"), + _("role_specification"), + _("role_specification"), + _("type_name"), + _("role_specification"), + _("role_specification"), + _("role_name"), + _("role_specification"), + _("role_specification"), + _("where role_specification can be:"), + _("role_name")); +} + +static void +sql_help_IMPORT_FOREIGN_SCHEMA(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "IMPORT FOREIGN SCHEMA %s\n" + " [ { LIMIT TO | EXCEPT } ( %s [, ...] ) ]\n" + " FROM SERVER %s\n" + " INTO %s\n" + " [ OPTIONS ( %s '%s' [, ... ] ) ]", + _("remote_schema"), + _("table_name"), + _("server_name"), + _("local_schema"), + _("option"), + _("value")); +} + +static void +sql_help_INSERT(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "[ WITH [ RECURSIVE ] %s [, ...] ]\n" + "INSERT INTO %s [ AS %s ] [ ( %s [, ...] ) ]\n" + " [ OVERRIDING { SYSTEM | USER } VALUE ]\n" + " { DEFAULT VALUES | VALUES ( { %s | DEFAULT } [, ...] ) [, ...] | %s }\n" + " [ ON CONFLICT [ %s ] %s ]\n" + " [ RETURNING * | %s [ [ AS ] %s ] [, ...] ]\n" + "\n" + "%s\n" + "\n" + " ( { %s | ( %s ) } [ COLLATE %s ] [ %s ] [, ...] ) [ WHERE %s ]\n" + " ON CONSTRAINT %s\n" + "\n" + "%s\n" + "\n" + " DO NOTHING\n" + " DO UPDATE SET { %s = { %s | DEFAULT } |\n" + " ( %s [, ...] ) = [ ROW ] ( { %s | DEFAULT } [, ...] ) |\n" + " ( %s [, ...] ) = ( %s )\n" + " } [, ...]\n" + " [ WHERE %s ]", + _("with_query"), + _("table_name"), + _("alias"), + _("column_name"), + _("expression"), + _("query"), + _("conflict_target"), + _("conflict_action"), + _("output_expression"), + _("output_name"), + _("where conflict_target can be one of:"), + _("index_column_name"), + _("index_expression"), + _("collation"), + _("opclass"), + _("index_predicate"), + _("constraint_name"), + _("and conflict_action is one of:"), + _("column_name"), + _("expression"), + _("column_name"), + _("expression"), + _("column_name"), + _("sub-SELECT"), + _("condition")); +} + +static void +sql_help_LISTEN(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "LISTEN %s", + _("channel")); +} + +static void +sql_help_LOAD(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "LOAD '%s'", + _("filename")); +} + +static void +sql_help_LOCK(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "LOCK [ TABLE ] [ ONLY ] %s [ * ] [, ...] [ IN %s MODE ] [ NOWAIT ]\n" + "\n" + "%s\n" + "\n" + " ACCESS SHARE | ROW SHARE | ROW EXCLUSIVE | SHARE UPDATE EXCLUSIVE\n" + " | SHARE | SHARE ROW EXCLUSIVE | EXCLUSIVE | ACCESS EXCLUSIVE", + _("name"), + _("lockmode"), + _("where lockmode is one of:")); +} + +static void +sql_help_MOVE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "MOVE [ %s [ FROM | IN ] ] %s\n" + "\n" + "%s\n" + "\n" + " NEXT\n" + " PRIOR\n" + " FIRST\n" + " LAST\n" + " ABSOLUTE %s\n" + " RELATIVE %s\n" + " %s\n" + " ALL\n" + " FORWARD\n" + " FORWARD %s\n" + " FORWARD ALL\n" + " BACKWARD\n" + " BACKWARD %s\n" + " BACKWARD ALL", + _("direction"), + _("cursor_name"), + _("where direction can be empty or one of:"), + _("count"), + _("count"), + _("count"), + _("count"), + _("count")); +} + +static void +sql_help_NOTIFY(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "NOTIFY %s [ , %s ]", + _("channel"), + _("payload")); +} + +static void +sql_help_PREPARE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "PREPARE %s [ ( %s [, ...] ) ] AS %s", + _("name"), + _("data_type"), + _("statement")); +} + +static void +sql_help_PREPARE_TRANSACTION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "PREPARE TRANSACTION %s", + _("transaction_id")); +} + +static void +sql_help_REASSIGN_OWNED(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "REASSIGN OWNED BY { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...]\n" + " TO { %s | CURRENT_ROLE | CURRENT_USER | SESSION_USER }", + _("old_role"), + _("new_role")); +} + +static void +sql_help_REFRESH_MATERIALIZED_VIEW(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "REFRESH MATERIALIZED VIEW [ CONCURRENTLY ] %s\n" + " [ WITH [ NO ] DATA ]", + _("name")); +} + +static void +sql_help_REINDEX(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "REINDEX [ ( %s [, ...] ) ] { INDEX | TABLE | SCHEMA | DATABASE | SYSTEM } [ CONCURRENTLY ] %s\n" + "\n" + "%s\n" + "\n" + " CONCURRENTLY [ %s ]\n" + " TABLESPACE %s\n" + " VERBOSE [ %s ]", + _("option"), + _("name"), + _("where option can be one of:"), + _("boolean"), + _("new_tablespace"), + _("boolean")); +} + +static void +sql_help_RELEASE_SAVEPOINT(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "RELEASE [ SAVEPOINT ] %s", + _("savepoint_name")); +} + +static void +sql_help_RESET(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "RESET %s\n" + "RESET ALL", + _("configuration_parameter")); +} + +static void +sql_help_REVOKE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "REVOKE [ GRANT OPTION FOR ]\n" + " { { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER }\n" + " [, ...] | ALL [ PRIVILEGES ] }\n" + " ON { [ TABLE ] %s [, ...]\n" + " | ALL TABLES IN SCHEMA %s [, ...] }\n" + " FROM %s [, ...]\n" + " [ GRANTED BY %s ]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { { SELECT | INSERT | UPDATE | REFERENCES } ( %s [, ...] )\n" + " [, ...] | ALL [ PRIVILEGES ] ( %s [, ...] ) }\n" + " ON [ TABLE ] %s [, ...]\n" + " FROM %s [, ...]\n" + " [ GRANTED BY %s ]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { { USAGE | SELECT | UPDATE }\n" + " [, ...] | ALL [ PRIVILEGES ] }\n" + " ON { SEQUENCE %s [, ...]\n" + " | ALL SEQUENCES IN SCHEMA %s [, ...] }\n" + " FROM %s [, ...]\n" + " [ GRANTED BY %s ]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { { CREATE | CONNECT | TEMPORARY | TEMP } [, ...] | ALL [ PRIVILEGES ] }\n" + " ON DATABASE %s [, ...]\n" + " FROM %s [, ...]\n" + " [ GRANTED BY %s ]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { USAGE | ALL [ PRIVILEGES ] }\n" + " ON DOMAIN %s [, ...]\n" + " FROM %s [, ...]\n" + " [ GRANTED BY %s ]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { USAGE | ALL [ PRIVILEGES ] }\n" + " ON FOREIGN DATA WRAPPER %s [, ...]\n" + " FROM %s [, ...]\n" + " [ GRANTED BY %s ]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { USAGE | ALL [ PRIVILEGES ] }\n" + " ON FOREIGN SERVER %s [, ...]\n" + " FROM %s [, ...]\n" + " [ GRANTED BY %s ]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { EXECUTE | ALL [ PRIVILEGES ] }\n" + " ON { { FUNCTION | PROCEDURE | ROUTINE } %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ] [, ...]\n" + " | ALL { FUNCTIONS | PROCEDURES | ROUTINES } IN SCHEMA %s [, ...] }\n" + " FROM %s [, ...]\n" + " [ GRANTED BY %s ]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { USAGE | ALL [ PRIVILEGES ] }\n" + " ON LANGUAGE %s [, ...]\n" + " FROM %s [, ...]\n" + " [ GRANTED BY %s ]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { { SELECT | UPDATE } [, ...] | ALL [ PRIVILEGES ] }\n" + " ON LARGE OBJECT %s [, ...]\n" + " FROM %s [, ...]\n" + " [ GRANTED BY %s ]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { { CREATE | USAGE } [, ...] | ALL [ PRIVILEGES ] }\n" + " ON SCHEMA %s [, ...]\n" + " FROM %s [, ...]\n" + " [ GRANTED BY %s ]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { CREATE | ALL [ PRIVILEGES ] }\n" + " ON TABLESPACE %s [, ...]\n" + " FROM %s [, ...]\n" + " [ GRANTED BY %s ]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ GRANT OPTION FOR ]\n" + " { USAGE | ALL [ PRIVILEGES ] }\n" + " ON TYPE %s [, ...]\n" + " FROM %s [, ...]\n" + " [ GRANTED BY %s ]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "REVOKE [ ADMIN OPTION FOR ]\n" + " %s [, ...] FROM %s [, ...]\n" + " [ GRANTED BY %s ]\n" + " [ CASCADE | RESTRICT ]\n" + "\n" + "%s\n" + "\n" + " [ GROUP ] %s\n" + " | PUBLIC\n" + " | CURRENT_ROLE\n" + " | CURRENT_USER\n" + " | SESSION_USER", + _("table_name"), + _("schema_name"), + _("role_specification"), + _("role_specification"), + _("column_name"), + _("column_name"), + _("table_name"), + _("role_specification"), + _("role_specification"), + _("sequence_name"), + _("schema_name"), + _("role_specification"), + _("role_specification"), + _("database_name"), + _("role_specification"), + _("role_specification"), + _("domain_name"), + _("role_specification"), + _("role_specification"), + _("fdw_name"), + _("role_specification"), + _("role_specification"), + _("server_name"), + _("role_specification"), + _("role_specification"), + _("function_name"), + _("argmode"), + _("arg_name"), + _("arg_type"), + _("schema_name"), + _("role_specification"), + _("role_specification"), + _("lang_name"), + _("role_specification"), + _("role_specification"), + _("loid"), + _("role_specification"), + _("role_specification"), + _("schema_name"), + _("role_specification"), + _("role_specification"), + _("tablespace_name"), + _("role_specification"), + _("role_specification"), + _("type_name"), + _("role_specification"), + _("role_specification"), + _("role_name"), + _("role_specification"), + _("role_specification"), + _("where role_specification can be:"), + _("role_name")); +} + +static void +sql_help_ROLLBACK(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ROLLBACK [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]"); +} + +static void +sql_help_ROLLBACK_PREPARED(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ROLLBACK PREPARED %s", + _("transaction_id")); +} + +static void +sql_help_ROLLBACK_TO_SAVEPOINT(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "ROLLBACK [ WORK | TRANSACTION ] TO [ SAVEPOINT ] %s", + _("savepoint_name")); +} + +static void +sql_help_SAVEPOINT(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "SAVEPOINT %s", + _("savepoint_name")); +} + +static void +sql_help_SECURITY_LABEL(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "SECURITY LABEL [ FOR %s ] ON\n" + "{\n" + " TABLE %s |\n" + " COLUMN %s.%s |\n" + " AGGREGATE %s ( %s ) |\n" + " DATABASE %s |\n" + " DOMAIN %s |\n" + " EVENT TRIGGER %s |\n" + " FOREIGN TABLE %s\n" + " FUNCTION %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ] |\n" + " LARGE OBJECT %s |\n" + " MATERIALIZED VIEW %s |\n" + " [ PROCEDURAL ] LANGUAGE %s |\n" + " PROCEDURE %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ] |\n" + " PUBLICATION %s |\n" + " ROLE %s |\n" + " ROUTINE %s [ ( [ [ %s ] [ %s ] %s [, ...] ] ) ] |\n" + " SCHEMA %s |\n" + " SEQUENCE %s |\n" + " SUBSCRIPTION %s |\n" + " TABLESPACE %s |\n" + " TYPE %s |\n" + " VIEW %s\n" + "} IS '%s'\n" + "\n" + "%s\n" + "\n" + "* |\n" + "[ %s ] [ %s ] %s [ , ... ] |\n" + "[ [ %s ] [ %s ] %s [ , ... ] ] ORDER BY [ %s ] [ %s ] %s [ , ... ]", + _("provider"), + _("object_name"), + _("table_name"), + _("column_name"), + _("aggregate_name"), + _("aggregate_signature"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("function_name"), + _("argmode"), + _("argname"), + _("argtype"), + _("large_object_oid"), + _("object_name"), + _("object_name"), + _("procedure_name"), + _("argmode"), + _("argname"), + _("argtype"), + _("object_name"), + _("object_name"), + _("routine_name"), + _("argmode"), + _("argname"), + _("argtype"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("object_name"), + _("label"), + _("where aggregate_signature is:"), + _("argmode"), + _("argname"), + _("argtype"), + _("argmode"), + _("argname"), + _("argtype"), + _("argmode"), + _("argname"), + _("argtype")); +} + +static void +sql_help_SELECT(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "[ WITH [ RECURSIVE ] %s [, ...] ]\n" + "SELECT [ ALL | DISTINCT [ ON ( %s [, ...] ) ] ]\n" + " [ * | %s [ [ AS ] %s ] [, ...] ]\n" + " [ FROM %s [, ...] ]\n" + " [ WHERE %s ]\n" + " [ GROUP BY [ ALL | DISTINCT ] %s [, ...] ]\n" + " [ HAVING %s ]\n" + " [ WINDOW %s AS ( %s ) [, ...] ]\n" + " [ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] %s ]\n" + " [ ORDER BY %s [ ASC | DESC | USING %s ] [ NULLS { FIRST | LAST } ] [, ...] ]\n" + " [ LIMIT { %s | ALL } ]\n" + " [ OFFSET %s [ ROW | ROWS ] ]\n" + " [ FETCH { FIRST | NEXT } [ %s ] { ROW | ROWS } { ONLY | WITH TIES } ]\n" + " [ FOR { UPDATE | NO KEY UPDATE | SHARE | KEY SHARE } [ OF %s [, ...] ] [ NOWAIT | SKIP LOCKED ] [...] ]\n" + "\n" + "%s\n" + "\n" + " [ ONLY ] %s [ * ] [ [ AS ] %s [ ( %s [, ...] ) ] ]\n" + " [ TABLESAMPLE %s ( %s [, ...] ) [ REPEATABLE ( %s ) ] ]\n" + " [ LATERAL ] ( %s ) [ AS ] %s [ ( %s [, ...] ) ]\n" + " %s [ [ AS ] %s [ ( %s [, ...] ) ] ]\n" + " [ LATERAL ] %s ( [ %s [, ...] ] )\n" + " [ WITH ORDINALITY ] [ [ AS ] %s [ ( %s [, ...] ) ] ]\n" + " [ LATERAL ] %s ( [ %s [, ...] ] ) [ AS ] %s ( %s [, ...] )\n" + " [ LATERAL ] %s ( [ %s [, ...] ] ) AS ( %s [, ...] )\n" + " [ LATERAL ] ROWS FROM( %s ( [ %s [, ...] ] ) [ AS ( %s [, ...] ) ] [, ...] )\n" + " [ WITH ORDINALITY ] [ [ AS ] %s [ ( %s [, ...] ) ] ]\n" + " %s [ NATURAL ] %s %s [ ON %s | USING ( %s [, ...] ) [ AS %s ] ]\n" + "\n" + "%s\n" + "\n" + " ( )\n" + " %s\n" + " ( %s [, ...] )\n" + " ROLLUP ( { %s | ( %s [, ...] ) } [, ...] )\n" + " CUBE ( { %s | ( %s [, ...] ) } [, ...] )\n" + " GROUPING SETS ( %s [, ...] )\n" + "\n" + "%s\n" + "\n" + " %s [ ( %s [, ...] ) ] AS [ [ NOT ] MATERIALIZED ] ( %s | %s | %s | %s | %s )\n" + " [ SEARCH { BREADTH | DEPTH } FIRST BY %s [, ...] SET %s ]\n" + " [ CYCLE %s [, ...] SET %s [ TO %s DEFAULT %s ] USING %s ]\n" + "\n" + "TABLE [ ONLY ] %s [ * ]", + _("with_query"), + _("expression"), + _("expression"), + _("output_name"), + _("from_item"), + _("condition"), + _("grouping_element"), + _("condition"), + _("window_name"), + _("window_definition"), + _("select"), + _("expression"), + _("operator"), + _("count"), + _("start"), + _("count"), + _("table_name"), + _("where from_item can be one of:"), + _("table_name"), + _("alias"), + _("column_alias"), + _("sampling_method"), + _("argument"), + _("seed"), + _("select"), + _("alias"), + _("column_alias"), + _("with_query_name"), + _("alias"), + _("column_alias"), + _("function_name"), + _("argument"), + _("alias"), + _("column_alias"), + _("function_name"), + _("argument"), + _("alias"), + _("column_definition"), + _("function_name"), + _("argument"), + _("column_definition"), + _("function_name"), + _("argument"), + _("column_definition"), + _("alias"), + _("column_alias"), + _("from_item"), + _("join_type"), + _("from_item"), + _("join_condition"), + _("join_column"), + _("join_using_alias"), + _("and grouping_element can be one of:"), + _("expression"), + _("expression"), + _("expression"), + _("expression"), + _("expression"), + _("expression"), + _("grouping_element"), + _("and with_query is:"), + _("with_query_name"), + _("column_name"), + _("select"), + _("values"), + _("insert"), + _("update"), + _("delete"), + _("column_name"), + _("search_seq_col_name"), + _("column_name"), + _("cycle_mark_col_name"), + _("cycle_mark_value"), + _("cycle_mark_default"), + _("cycle_path_col_name"), + _("table_name")); +} + +static void +sql_help_SELECT_INTO(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "[ WITH [ RECURSIVE ] %s [, ...] ]\n" + "SELECT [ ALL | DISTINCT [ ON ( %s [, ...] ) ] ]\n" + " * | %s [ [ AS ] %s ] [, ...]\n" + " INTO [ TEMPORARY | TEMP | UNLOGGED ] [ TABLE ] %s\n" + " [ FROM %s [, ...] ]\n" + " [ WHERE %s ]\n" + " [ GROUP BY %s [, ...] ]\n" + " [ HAVING %s ]\n" + " [ WINDOW %s AS ( %s ) [, ...] ]\n" + " [ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] %s ]\n" + " [ ORDER BY %s [ ASC | DESC | USING %s ] [ NULLS { FIRST | LAST } ] [, ...] ]\n" + " [ LIMIT { %s | ALL } ]\n" + " [ OFFSET %s [ ROW | ROWS ] ]\n" + " [ FETCH { FIRST | NEXT } [ %s ] { ROW | ROWS } ONLY ]\n" + " [ FOR { UPDATE | SHARE } [ OF %s [, ...] ] [ NOWAIT ] [...] ]", + _("with_query"), + _("expression"), + _("expression"), + _("output_name"), + _("new_table"), + _("from_item"), + _("condition"), + _("expression"), + _("condition"), + _("window_name"), + _("window_definition"), + _("select"), + _("expression"), + _("operator"), + _("count"), + _("start"), + _("count"), + _("table_name")); +} + +static void +sql_help_SET(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "SET [ SESSION | LOCAL ] %s { TO | = } { %s | '%s' | DEFAULT }\n" + "SET [ SESSION | LOCAL ] TIME ZONE { %s | LOCAL | DEFAULT }", + _("configuration_parameter"), + _("value"), + _("value"), + _("timezone")); +} + +static void +sql_help_SET_CONSTRAINTS(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "SET CONSTRAINTS { ALL | %s [, ...] } { DEFERRED | IMMEDIATE }", + _("name")); +} + +static void +sql_help_SET_ROLE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "SET [ SESSION | LOCAL ] ROLE %s\n" + "SET [ SESSION | LOCAL ] ROLE NONE\n" + "RESET ROLE", + _("role_name")); +} + +static void +sql_help_SET_SESSION_AUTHORIZATION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "SET [ SESSION | LOCAL ] SESSION AUTHORIZATION %s\n" + "SET [ SESSION | LOCAL ] SESSION AUTHORIZATION DEFAULT\n" + "RESET SESSION AUTHORIZATION", + _("user_name")); +} + +static void +sql_help_SET_TRANSACTION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "SET TRANSACTION %s [, ...]\n" + "SET TRANSACTION SNAPSHOT %s\n" + "SET SESSION CHARACTERISTICS AS TRANSACTION %s [, ...]\n" + "\n" + "%s\n" + "\n" + " ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }\n" + " READ WRITE | READ ONLY\n" + " [ NOT ] DEFERRABLE", + _("transaction_mode"), + _("snapshot_id"), + _("transaction_mode"), + _("where transaction_mode is one of:")); +} + +static void +sql_help_SHOW(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "SHOW %s\n" + "SHOW ALL", + _("name")); +} + +static void +sql_help_START_TRANSACTION(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "START TRANSACTION [ %s [, ...] ]\n" + "\n" + "%s\n" + "\n" + " ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }\n" + " READ WRITE | READ ONLY\n" + " [ NOT ] DEFERRABLE", + _("transaction_mode"), + _("where transaction_mode is one of:")); +} + +static void +sql_help_TABLE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "[ WITH [ RECURSIVE ] %s [, ...] ]\n" + "SELECT [ ALL | DISTINCT [ ON ( %s [, ...] ) ] ]\n" + " [ * | %s [ [ AS ] %s ] [, ...] ]\n" + " [ FROM %s [, ...] ]\n" + " [ WHERE %s ]\n" + " [ GROUP BY [ ALL | DISTINCT ] %s [, ...] ]\n" + " [ HAVING %s ]\n" + " [ WINDOW %s AS ( %s ) [, ...] ]\n" + " [ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] %s ]\n" + " [ ORDER BY %s [ ASC | DESC | USING %s ] [ NULLS { FIRST | LAST } ] [, ...] ]\n" + " [ LIMIT { %s | ALL } ]\n" + " [ OFFSET %s [ ROW | ROWS ] ]\n" + " [ FETCH { FIRST | NEXT } [ %s ] { ROW | ROWS } { ONLY | WITH TIES } ]\n" + " [ FOR { UPDATE | NO KEY UPDATE | SHARE | KEY SHARE } [ OF %s [, ...] ] [ NOWAIT | SKIP LOCKED ] [...] ]\n" + "\n" + "%s\n" + "\n" + " [ ONLY ] %s [ * ] [ [ AS ] %s [ ( %s [, ...] ) ] ]\n" + " [ TABLESAMPLE %s ( %s [, ...] ) [ REPEATABLE ( %s ) ] ]\n" + " [ LATERAL ] ( %s ) [ AS ] %s [ ( %s [, ...] ) ]\n" + " %s [ [ AS ] %s [ ( %s [, ...] ) ] ]\n" + " [ LATERAL ] %s ( [ %s [, ...] ] )\n" + " [ WITH ORDINALITY ] [ [ AS ] %s [ ( %s [, ...] ) ] ]\n" + " [ LATERAL ] %s ( [ %s [, ...] ] ) [ AS ] %s ( %s [, ...] )\n" + " [ LATERAL ] %s ( [ %s [, ...] ] ) AS ( %s [, ...] )\n" + " [ LATERAL ] ROWS FROM( %s ( [ %s [, ...] ] ) [ AS ( %s [, ...] ) ] [, ...] )\n" + " [ WITH ORDINALITY ] [ [ AS ] %s [ ( %s [, ...] ) ] ]\n" + " %s [ NATURAL ] %s %s [ ON %s | USING ( %s [, ...] ) [ AS %s ] ]\n" + "\n" + "%s\n" + "\n" + " ( )\n" + " %s\n" + " ( %s [, ...] )\n" + " ROLLUP ( { %s | ( %s [, ...] ) } [, ...] )\n" + " CUBE ( { %s | ( %s [, ...] ) } [, ...] )\n" + " GROUPING SETS ( %s [, ...] )\n" + "\n" + "%s\n" + "\n" + " %s [ ( %s [, ...] ) ] AS [ [ NOT ] MATERIALIZED ] ( %s | %s | %s | %s | %s )\n" + " [ SEARCH { BREADTH | DEPTH } FIRST BY %s [, ...] SET %s ]\n" + " [ CYCLE %s [, ...] SET %s [ TO %s DEFAULT %s ] USING %s ]\n" + "\n" + "TABLE [ ONLY ] %s [ * ]", + _("with_query"), + _("expression"), + _("expression"), + _("output_name"), + _("from_item"), + _("condition"), + _("grouping_element"), + _("condition"), + _("window_name"), + _("window_definition"), + _("select"), + _("expression"), + _("operator"), + _("count"), + _("start"), + _("count"), + _("table_name"), + _("where from_item can be one of:"), + _("table_name"), + _("alias"), + _("column_alias"), + _("sampling_method"), + _("argument"), + _("seed"), + _("select"), + _("alias"), + _("column_alias"), + _("with_query_name"), + _("alias"), + _("column_alias"), + _("function_name"), + _("argument"), + _("alias"), + _("column_alias"), + _("function_name"), + _("argument"), + _("alias"), + _("column_definition"), + _("function_name"), + _("argument"), + _("column_definition"), + _("function_name"), + _("argument"), + _("column_definition"), + _("alias"), + _("column_alias"), + _("from_item"), + _("join_type"), + _("from_item"), + _("join_condition"), + _("join_column"), + _("join_using_alias"), + _("and grouping_element can be one of:"), + _("expression"), + _("expression"), + _("expression"), + _("expression"), + _("expression"), + _("expression"), + _("grouping_element"), + _("and with_query is:"), + _("with_query_name"), + _("column_name"), + _("select"), + _("values"), + _("insert"), + _("update"), + _("delete"), + _("column_name"), + _("search_seq_col_name"), + _("column_name"), + _("cycle_mark_col_name"), + _("cycle_mark_value"), + _("cycle_mark_default"), + _("cycle_path_col_name"), + _("table_name")); +} + +static void +sql_help_TRUNCATE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "TRUNCATE [ TABLE ] [ ONLY ] %s [ * ] [, ... ]\n" + " [ RESTART IDENTITY | CONTINUE IDENTITY ] [ CASCADE | RESTRICT ]", + _("name")); +} + +static void +sql_help_UNLISTEN(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "UNLISTEN { %s | * }", + _("channel")); +} + +static void +sql_help_UPDATE(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "[ WITH [ RECURSIVE ] %s [, ...] ]\n" + "UPDATE [ ONLY ] %s [ * ] [ [ AS ] %s ]\n" + " SET { %s = { %s | DEFAULT } |\n" + " ( %s [, ...] ) = [ ROW ] ( { %s | DEFAULT } [, ...] ) |\n" + " ( %s [, ...] ) = ( %s )\n" + " } [, ...]\n" + " [ FROM %s [, ...] ]\n" + " [ WHERE %s | WHERE CURRENT OF %s ]\n" + " [ RETURNING * | %s [ [ AS ] %s ] [, ...] ]", + _("with_query"), + _("table_name"), + _("alias"), + _("column_name"), + _("expression"), + _("column_name"), + _("expression"), + _("column_name"), + _("sub-SELECT"), + _("from_item"), + _("condition"), + _("cursor_name"), + _("output_expression"), + _("output_name")); +} + +static void +sql_help_VACUUM(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "VACUUM [ ( %s [, ...] ) ] [ %s [, ...] ]\n" + "VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ %s [, ...] ]\n" + "\n" + "%s\n" + "\n" + " FULL [ %s ]\n" + " FREEZE [ %s ]\n" + " VERBOSE [ %s ]\n" + " ANALYZE [ %s ]\n" + " DISABLE_PAGE_SKIPPING [ %s ]\n" + " SKIP_LOCKED [ %s ]\n" + " INDEX_CLEANUP { AUTO | ON | OFF }\n" + " PROCESS_TOAST [ %s ]\n" + " TRUNCATE [ %s ]\n" + " PARALLEL %s\n" + "\n" + "%s\n" + "\n" + " %s [ ( %s [, ...] ) ]", + _("option"), + _("table_and_columns"), + _("table_and_columns"), + _("where option can be one of:"), + _("boolean"), + _("boolean"), + _("boolean"), + _("boolean"), + _("boolean"), + _("boolean"), + _("boolean"), + _("boolean"), + _("integer"), + _("and table_and_columns is:"), + _("table_name"), + _("column_name")); +} + +static void +sql_help_VALUES(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "VALUES ( %s [, ...] ) [, ...]\n" + " [ ORDER BY %s [ ASC | DESC | USING %s ] [, ...] ]\n" + " [ LIMIT { %s | ALL } ]\n" + " [ OFFSET %s [ ROW | ROWS ] ]\n" + " [ FETCH { FIRST | NEXT } [ %s ] { ROW | ROWS } ONLY ]", + _("expression"), + _("sort_expression"), + _("operator"), + _("count"), + _("start"), + _("count")); +} + +static void +sql_help_WITH(PQExpBuffer buf) +{ + appendPQExpBuffer(buf, + "[ WITH [ RECURSIVE ] %s [, ...] ]\n" + "SELECT [ ALL | DISTINCT [ ON ( %s [, ...] ) ] ]\n" + " [ * | %s [ [ AS ] %s ] [, ...] ]\n" + " [ FROM %s [, ...] ]\n" + " [ WHERE %s ]\n" + " [ GROUP BY [ ALL | DISTINCT ] %s [, ...] ]\n" + " [ HAVING %s ]\n" + " [ WINDOW %s AS ( %s ) [, ...] ]\n" + " [ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] %s ]\n" + " [ ORDER BY %s [ ASC | DESC | USING %s ] [ NULLS { FIRST | LAST } ] [, ...] ]\n" + " [ LIMIT { %s | ALL } ]\n" + " [ OFFSET %s [ ROW | ROWS ] ]\n" + " [ FETCH { FIRST | NEXT } [ %s ] { ROW | ROWS } { ONLY | WITH TIES } ]\n" + " [ FOR { UPDATE | NO KEY UPDATE | SHARE | KEY SHARE } [ OF %s [, ...] ] [ NOWAIT | SKIP LOCKED ] [...] ]\n" + "\n" + "%s\n" + "\n" + " [ ONLY ] %s [ * ] [ [ AS ] %s [ ( %s [, ...] ) ] ]\n" + " [ TABLESAMPLE %s ( %s [, ...] ) [ REPEATABLE ( %s ) ] ]\n" + " [ LATERAL ] ( %s ) [ AS ] %s [ ( %s [, ...] ) ]\n" + " %s [ [ AS ] %s [ ( %s [, ...] ) ] ]\n" + " [ LATERAL ] %s ( [ %s [, ...] ] )\n" + " [ WITH ORDINALITY ] [ [ AS ] %s [ ( %s [, ...] ) ] ]\n" + " [ LATERAL ] %s ( [ %s [, ...] ] ) [ AS ] %s ( %s [, ...] )\n" + " [ LATERAL ] %s ( [ %s [, ...] ] ) AS ( %s [, ...] )\n" + " [ LATERAL ] ROWS FROM( %s ( [ %s [, ...] ] ) [ AS ( %s [, ...] ) ] [, ...] )\n" + " [ WITH ORDINALITY ] [ [ AS ] %s [ ( %s [, ...] ) ] ]\n" + " %s [ NATURAL ] %s %s [ ON %s | USING ( %s [, ...] ) [ AS %s ] ]\n" + "\n" + "%s\n" + "\n" + " ( )\n" + " %s\n" + " ( %s [, ...] )\n" + " ROLLUP ( { %s | ( %s [, ...] ) } [, ...] )\n" + " CUBE ( { %s | ( %s [, ...] ) } [, ...] )\n" + " GROUPING SETS ( %s [, ...] )\n" + "\n" + "%s\n" + "\n" + " %s [ ( %s [, ...] ) ] AS [ [ NOT ] MATERIALIZED ] ( %s | %s | %s | %s | %s )\n" + " [ SEARCH { BREADTH | DEPTH } FIRST BY %s [, ...] SET %s ]\n" + " [ CYCLE %s [, ...] SET %s [ TO %s DEFAULT %s ] USING %s ]\n" + "\n" + "TABLE [ ONLY ] %s [ * ]", + _("with_query"), + _("expression"), + _("expression"), + _("output_name"), + _("from_item"), + _("condition"), + _("grouping_element"), + _("condition"), + _("window_name"), + _("window_definition"), + _("select"), + _("expression"), + _("operator"), + _("count"), + _("start"), + _("count"), + _("table_name"), + _("where from_item can be one of:"), + _("table_name"), + _("alias"), + _("column_alias"), + _("sampling_method"), + _("argument"), + _("seed"), + _("select"), + _("alias"), + _("column_alias"), + _("with_query_name"), + _("alias"), + _("column_alias"), + _("function_name"), + _("argument"), + _("alias"), + _("column_alias"), + _("function_name"), + _("argument"), + _("alias"), + _("column_definition"), + _("function_name"), + _("argument"), + _("column_definition"), + _("function_name"), + _("argument"), + _("column_definition"), + _("alias"), + _("column_alias"), + _("from_item"), + _("join_type"), + _("from_item"), + _("join_condition"), + _("join_column"), + _("join_using_alias"), + _("and grouping_element can be one of:"), + _("expression"), + _("expression"), + _("expression"), + _("expression"), + _("expression"), + _("expression"), + _("grouping_element"), + _("and with_query is:"), + _("with_query_name"), + _("column_name"), + _("select"), + _("values"), + _("insert"), + _("update"), + _("delete"), + _("column_name"), + _("search_seq_col_name"), + _("column_name"), + _("cycle_mark_col_name"), + _("cycle_mark_value"), + _("cycle_mark_default"), + _("cycle_path_col_name"), + _("table_name")); +} + + +const struct _helpStruct QL_HELP[] = { + {"ABORT", + N_("abort the current transaction"), + "sql-abort", + sql_help_ABORT, + 0}, + + {"ALTER AGGREGATE", + N_("change the definition of an aggregate function"), + "sql-alteraggregate", + sql_help_ALTER_AGGREGATE, + 9}, + + {"ALTER COLLATION", + N_("change the definition of a collation"), + "sql-altercollation", + sql_help_ALTER_COLLATION, + 4}, + + {"ALTER CONVERSION", + N_("change the definition of a conversion"), + "sql-alterconversion", + sql_help_ALTER_CONVERSION, + 2}, + + {"ALTER DATABASE", + N_("change a database"), + "sql-alterdatabase", + sql_help_ALTER_DATABASE, + 17}, + + {"ALTER DEFAULT PRIVILEGES", + N_("define default access privileges"), + "sql-alterdefaultprivileges", + sql_help_ALTER_DEFAULT_PRIVILEGES, + 59}, + + {"ALTER DOMAIN", + N_("change the definition of a domain"), + "sql-alterdomain", + sql_help_ALTER_DOMAIN, + 17}, + + {"ALTER EVENT TRIGGER", + N_("change the definition of an event trigger"), + "sql-altereventtrigger", + sql_help_ALTER_EVENT_TRIGGER, + 3}, + + {"ALTER EXTENSION", + N_("change the definition of an extension"), + "sql-alterextension", + sql_help_ALTER_EXTENSION, + 40}, + + {"ALTER FOREIGN DATA WRAPPER", + N_("change the definition of a foreign-data wrapper"), + "sql-alterforeigndatawrapper", + sql_help_ALTER_FOREIGN_DATA_WRAPPER, + 5}, + + {"ALTER FOREIGN TABLE", + N_("change the definition of a foreign table"), + "sql-alterforeigntable", + sql_help_ALTER_FOREIGN_TABLE, + 33}, + + {"ALTER FUNCTION", + N_("change the definition of a function"), + "sql-alterfunction", + sql_help_ALTER_FUNCTION, + 24}, + + {"ALTER GROUP", + N_("change role name or membership"), + "sql-altergroup", + sql_help_ALTER_GROUP, + 10}, + + {"ALTER INDEX", + N_("change the definition of an index"), + "sql-alterindex", + sql_help_ALTER_INDEX, + 9}, + + {"ALTER LANGUAGE", + N_("change the definition of a procedural language"), + "sql-alterlanguage", + sql_help_ALTER_LANGUAGE, + 1}, + + {"ALTER LARGE OBJECT", + N_("change the definition of a large object"), + "sql-alterlargeobject", + sql_help_ALTER_LARGE_OBJECT, + 0}, + + {"ALTER MATERIALIZED VIEW", + N_("change the definition of a materialized view"), + "sql-altermaterializedview", + sql_help_ALTER_MATERIALIZED_VIEW, + 24}, + + {"ALTER OPERATOR", + N_("change the definition of an operator"), + "sql-alteroperator", + sql_help_ALTER_OPERATOR, + 9}, + + {"ALTER OPERATOR CLASS", + N_("change the definition of an operator class"), + "sql-alteropclass", + sql_help_ALTER_OPERATOR_CLASS, + 7}, + + {"ALTER OPERATOR FAMILY", + N_("change the definition of an operator family"), + "sql-alteropfamily", + sql_help_ALTER_OPERATOR_FAMILY, + 19}, + + {"ALTER POLICY", + N_("change the definition of a row-level security policy"), + "sql-alterpolicy", + sql_help_ALTER_POLICY, + 5}, + + {"ALTER PROCEDURE", + N_("change the definition of a procedure"), + "sql-alterprocedure", + sql_help_ALTER_PROCEDURE, + 17}, + + {"ALTER PUBLICATION", + N_("change the definition of a publication"), + "sql-alterpublication", + sql_help_ALTER_PUBLICATION, + 5}, + + {"ALTER ROLE", + N_("change a database role"), + "sql-alterrole", + sql_help_ALTER_ROLE, + 27}, + + {"ALTER ROUTINE", + N_("change the definition of a routine"), + "sql-alterroutine", + sql_help_ALTER_ROUTINE, + 22}, + + {"ALTER RULE", + N_("change the definition of a rule"), + "sql-alterrule", + sql_help_ALTER_RULE, + 0}, + + {"ALTER SCHEMA", + N_("change the definition of a schema"), + "sql-alterschema", + sql_help_ALTER_SCHEMA, + 1}, + + {"ALTER SEQUENCE", + N_("change the definition of a sequence generator"), + "sql-altersequence", + sql_help_ALTER_SEQUENCE, + 10}, + + {"ALTER SERVER", + N_("change the definition of a foreign server"), + "sql-alterserver", + sql_help_ALTER_SERVER, + 3}, + + {"ALTER STATISTICS", + N_("change the definition of an extended statistics object"), + "sql-alterstatistics", + sql_help_ALTER_STATISTICS, + 3}, + + {"ALTER SUBSCRIPTION", + N_("change the definition of a subscription"), + "sql-altersubscription", + sql_help_ALTER_SUBSCRIPTION, + 9}, + + {"ALTER SYSTEM", + N_("change a server configuration parameter"), + "sql-altersystem", + sql_help_ALTER_SYSTEM, + 3}, + + {"ALTER TABLE", + N_("change the definition of a table"), + "sql-altertable", + sql_help_ALTER_TABLE, + 112}, + + {"ALTER TABLESPACE", + N_("change the definition of a tablespace"), + "sql-altertablespace", + sql_help_ALTER_TABLESPACE, + 3}, + + {"ALTER TEXT SEARCH CONFIGURATION", + N_("change the definition of a text search configuration"), + "sql-altertsconfig", + sql_help_ALTER_TEXT_SEARCH_CONFIGURATION, + 12}, + + {"ALTER TEXT SEARCH DICTIONARY", + N_("change the definition of a text search dictionary"), + "sql-altertsdictionary", + sql_help_ALTER_TEXT_SEARCH_DICTIONARY, + 5}, + + {"ALTER TEXT SEARCH PARSER", + N_("change the definition of a text search parser"), + "sql-altertsparser", + sql_help_ALTER_TEXT_SEARCH_PARSER, + 1}, + + {"ALTER TEXT SEARCH TEMPLATE", + N_("change the definition of a text search template"), + "sql-altertstemplate", + sql_help_ALTER_TEXT_SEARCH_TEMPLATE, + 1}, + + {"ALTER TRIGGER", + N_("change the definition of a trigger"), + "sql-altertrigger", + sql_help_ALTER_TRIGGER, + 1}, + + {"ALTER TYPE", + N_("change the definition of a type"), + "sql-altertype", + sql_help_ALTER_TYPE, + 13}, + + {"ALTER USER", + N_("change a database role"), + "sql-alteruser", + sql_help_ALTER_USER, + 27}, + + {"ALTER USER MAPPING", + N_("change the definition of a user mapping"), + "sql-alterusermapping", + sql_help_ALTER_USER_MAPPING, + 2}, + + {"ALTER VIEW", + N_("change the definition of a view"), + "sql-alterview", + sql_help_ALTER_VIEW, + 7}, + + {"ANALYZE", + N_("collect statistics about a database"), + "sql-analyze", + sql_help_ANALYZE, + 10}, + + {"BEGIN", + N_("start a transaction block"), + "sql-begin", + sql_help_BEGIN, + 6}, + + {"CALL", + N_("invoke a procedure"), + "sql-call", + sql_help_CALL, + 0}, + + {"CHECKPOINT", + N_("force a write-ahead log checkpoint"), + "sql-checkpoint", + sql_help_CHECKPOINT, + 0}, + + {"CLOSE", + N_("close a cursor"), + "sql-close", + sql_help_CLOSE, + 0}, + + {"CLUSTER", + N_("cluster a table according to an index"), + "sql-cluster", + sql_help_CLUSTER, + 6}, + + {"COMMENT", + N_("define or change the comment of an object"), + "sql-comment", + sql_help_COMMENT, + 51}, + + {"COMMIT", + N_("commit the current transaction"), + "sql-commit", + sql_help_COMMIT, + 0}, + + {"COMMIT PREPARED", + N_("commit a transaction that was earlier prepared for two-phase commit"), + "sql-commit-prepared", + sql_help_COMMIT_PREPARED, + 0}, + + {"COPY", + N_("copy data between a file and a table"), + "sql-copy", + sql_help_COPY, + 21}, + + {"CREATE ACCESS METHOD", + N_("define a new access method"), + "sql-create-access-method", + sql_help_CREATE_ACCESS_METHOD, + 2}, + + {"CREATE AGGREGATE", + N_("define a new aggregate function"), + "sql-createaggregate", + sql_help_CREATE_AGGREGATE, + 59}, + + {"CREATE CAST", + N_("define a new cast"), + "sql-createcast", + sql_help_CREATE_CAST, + 10}, + + {"CREATE COLLATION", + N_("define a new collation"), + "sql-createcollation", + sql_help_CREATE_COLLATION, + 8}, + + {"CREATE CONVERSION", + N_("define a new encoding conversion"), + "sql-createconversion", + sql_help_CREATE_CONVERSION, + 1}, + + {"CREATE DATABASE", + N_("create a new database"), + "sql-createdatabase", + sql_help_CREATE_DATABASE, + 10}, + + {"CREATE DOMAIN", + N_("define a new domain"), + "sql-createdomain", + sql_help_CREATE_DOMAIN, + 8}, + + {"CREATE EVENT TRIGGER", + N_("define a new event trigger"), + "sql-createeventtrigger", + sql_help_CREATE_EVENT_TRIGGER, + 3}, + + {"CREATE EXTENSION", + N_("install an extension"), + "sql-createextension", + sql_help_CREATE_EXTENSION, + 3}, + + {"CREATE FOREIGN DATA WRAPPER", + N_("define a new foreign-data wrapper"), + "sql-createforeigndatawrapper", + sql_help_CREATE_FOREIGN_DATA_WRAPPER, + 3}, + + {"CREATE FOREIGN TABLE", + N_("define a new foreign table"), + "sql-createforeigntable", + sql_help_CREATE_FOREIGN_TABLE, + 30}, + + {"CREATE FUNCTION", + N_("define a new function"), + "sql-createfunction", + sql_help_CREATE_FUNCTION, + 19}, + + {"CREATE GROUP", + N_("define a new database role"), + "sql-creategroup", + sql_help_CREATE_GROUP, + 19}, + + {"CREATE INDEX", + N_("define a new index"), + "sql-createindex", + sql_help_CREATE_INDEX, + 5}, + + {"CREATE LANGUAGE", + N_("define a new procedural language"), + "sql-createlanguage", + sql_help_CREATE_LANGUAGE, + 2}, + + {"CREATE MATERIALIZED VIEW", + N_("define a new materialized view"), + "sql-creatematerializedview", + sql_help_CREATE_MATERIALIZED_VIEW, + 6}, + + {"CREATE OPERATOR", + N_("define a new operator"), + "sql-createoperator", + sql_help_CREATE_OPERATOR, + 6}, + + {"CREATE OPERATOR CLASS", + N_("define a new operator class"), + "sql-createopclass", + sql_help_CREATE_OPERATOR_CLASS, + 5}, + + {"CREATE OPERATOR FAMILY", + N_("define a new operator family"), + "sql-createopfamily", + sql_help_CREATE_OPERATOR_FAMILY, + 0}, + + {"CREATE POLICY", + N_("define a new row-level security policy for a table"), + "sql-createpolicy", + sql_help_CREATE_POLICY, + 5}, + + {"CREATE PROCEDURE", + N_("define a new procedure"), + "sql-createprocedure", + sql_help_CREATE_PROCEDURE, + 9}, + + {"CREATE PUBLICATION", + N_("define a new publication"), + "sql-createpublication", + sql_help_CREATE_PUBLICATION, + 3}, + + {"CREATE ROLE", + N_("define a new database role"), + "sql-createrole", + sql_help_CREATE_ROLE, + 19}, + + {"CREATE RULE", + N_("define a new rewrite rule"), + "sql-createrule", + sql_help_CREATE_RULE, + 6}, + + {"CREATE SCHEMA", + N_("define a new schema"), + "sql-createschema", + sql_help_CREATE_SCHEMA, + 10}, + + {"CREATE SEQUENCE", + N_("define a new sequence generator"), + "sql-createsequence", + sql_help_CREATE_SEQUENCE, + 5}, + + {"CREATE SERVER", + N_("define a new foreign server"), + "sql-createserver", + sql_help_CREATE_SERVER, + 2}, + + {"CREATE STATISTICS", + N_("define extended statistics"), + "sql-createstatistics", + sql_help_CREATE_STATISTICS, + 7}, + + {"CREATE SUBSCRIPTION", + N_("define a new subscription"), + "sql-createsubscription", + sql_help_CREATE_SUBSCRIPTION, + 3}, + + {"CREATE TABLE", + N_("define a new table"), + "sql-createtable", + sql_help_CREATE_TABLE, + 83}, + + {"CREATE TABLE AS", + N_("define a new table from the results of a query"), + "sql-createtableas", + sql_help_CREATE_TABLE_AS, + 7}, + + {"CREATE TABLESPACE", + N_("define a new tablespace"), + "sql-createtablespace", + sql_help_CREATE_TABLESPACE, + 3}, + + {"CREATE TEXT SEARCH CONFIGURATION", + N_("define a new text search configuration"), + "sql-createtsconfig", + sql_help_CREATE_TEXT_SEARCH_CONFIGURATION, + 3}, + + {"CREATE TEXT SEARCH DICTIONARY", + N_("define a new text search dictionary"), + "sql-createtsdictionary", + sql_help_CREATE_TEXT_SEARCH_DICTIONARY, + 3}, + + {"CREATE TEXT SEARCH PARSER", + N_("define a new text search parser"), + "sql-createtsparser", + sql_help_CREATE_TEXT_SEARCH_PARSER, + 6}, + + {"CREATE TEXT SEARCH TEMPLATE", + N_("define a new text search template"), + "sql-createtstemplate", + sql_help_CREATE_TEXT_SEARCH_TEMPLATE, + 3}, + + {"CREATE TRANSFORM", + N_("define a new transform"), + "sql-createtransform", + sql_help_CREATE_TRANSFORM, + 3}, + + {"CREATE TRIGGER", + N_("define a new trigger"), + "sql-createtrigger", + sql_help_CREATE_TRIGGER, + 14}, + + {"CREATE TYPE", + N_("define a new data type"), + "sql-createtype", + sql_help_CREATE_TYPE, + 37}, + + {"CREATE USER", + N_("define a new database role"), + "sql-createuser", + sql_help_CREATE_USER, + 19}, + + {"CREATE USER MAPPING", + N_("define a new mapping of a user to a foreign server"), + "sql-createusermapping", + sql_help_CREATE_USER_MAPPING, + 2}, + + {"CREATE VIEW", + N_("define a new view"), + "sql-createview", + sql_help_CREATE_VIEW, + 3}, + + {"DEALLOCATE", + N_("deallocate a prepared statement"), + "sql-deallocate", + sql_help_DEALLOCATE, + 0}, + + {"DECLARE", + N_("define a cursor"), + "sql-declare", + sql_help_DECLARE, + 1}, + + {"DELETE", + N_("delete rows of a table"), + "sql-delete", + sql_help_DELETE, + 4}, + + {"DISCARD", + N_("discard session state"), + "sql-discard", + sql_help_DISCARD, + 0}, + + {"DO", + N_("execute an anonymous code block"), + "sql-do", + sql_help_DO, + 0}, + + {"DROP ACCESS METHOD", + N_("remove an access method"), + "sql-drop-access-method", + sql_help_DROP_ACCESS_METHOD, + 0}, + + {"DROP AGGREGATE", + N_("remove an aggregate function"), + "sql-dropaggregate", + sql_help_DROP_AGGREGATE, + 6}, + + {"DROP CAST", + N_("remove a cast"), + "sql-dropcast", + sql_help_DROP_CAST, + 0}, + + {"DROP COLLATION", + N_("remove a collation"), + "sql-dropcollation", + sql_help_DROP_COLLATION, + 0}, + + {"DROP CONVERSION", + N_("remove a conversion"), + "sql-dropconversion", + sql_help_DROP_CONVERSION, + 0}, + + {"DROP DATABASE", + N_("remove a database"), + "sql-dropdatabase", + sql_help_DROP_DATABASE, + 4}, + + {"DROP DOMAIN", + N_("remove a domain"), + "sql-dropdomain", + sql_help_DROP_DOMAIN, + 0}, + + {"DROP EVENT TRIGGER", + N_("remove an event trigger"), + "sql-dropeventtrigger", + sql_help_DROP_EVENT_TRIGGER, + 0}, + + {"DROP EXTENSION", + N_("remove an extension"), + "sql-dropextension", + sql_help_DROP_EXTENSION, + 0}, + + {"DROP FOREIGN DATA WRAPPER", + N_("remove a foreign-data wrapper"), + "sql-dropforeigndatawrapper", + sql_help_DROP_FOREIGN_DATA_WRAPPER, + 0}, + + {"DROP FOREIGN TABLE", + N_("remove a foreign table"), + "sql-dropforeigntable", + sql_help_DROP_FOREIGN_TABLE, + 0}, + + {"DROP FUNCTION", + N_("remove a function"), + "sql-dropfunction", + sql_help_DROP_FUNCTION, + 1}, + + {"DROP GROUP", + N_("remove a database role"), + "sql-dropgroup", + sql_help_DROP_GROUP, + 0}, + + {"DROP INDEX", + N_("remove an index"), + "sql-dropindex", + sql_help_DROP_INDEX, + 0}, + + {"DROP LANGUAGE", + N_("remove a procedural language"), + "sql-droplanguage", + sql_help_DROP_LANGUAGE, + 0}, + + {"DROP MATERIALIZED VIEW", + N_("remove a materialized view"), + "sql-dropmaterializedview", + sql_help_DROP_MATERIALIZED_VIEW, + 0}, + + {"DROP OPERATOR", + N_("remove an operator"), + "sql-dropoperator", + sql_help_DROP_OPERATOR, + 0}, + + {"DROP OPERATOR CLASS", + N_("remove an operator class"), + "sql-dropopclass", + sql_help_DROP_OPERATOR_CLASS, + 0}, + + {"DROP OPERATOR FAMILY", + N_("remove an operator family"), + "sql-dropopfamily", + sql_help_DROP_OPERATOR_FAMILY, + 0}, + + {"DROP OWNED", + N_("remove database objects owned by a database role"), + "sql-drop-owned", + sql_help_DROP_OWNED, + 0}, + + {"DROP POLICY", + N_("remove a row-level security policy from a table"), + "sql-droppolicy", + sql_help_DROP_POLICY, + 0}, + + {"DROP PROCEDURE", + N_("remove a procedure"), + "sql-dropprocedure", + sql_help_DROP_PROCEDURE, + 1}, + + {"DROP PUBLICATION", + N_("remove a publication"), + "sql-droppublication", + sql_help_DROP_PUBLICATION, + 0}, + + {"DROP ROLE", + N_("remove a database role"), + "sql-droprole", + sql_help_DROP_ROLE, + 0}, + + {"DROP ROUTINE", + N_("remove a routine"), + "sql-droproutine", + sql_help_DROP_ROUTINE, + 1}, + + {"DROP RULE", + N_("remove a rewrite rule"), + "sql-droprule", + sql_help_DROP_RULE, + 0}, + + {"DROP SCHEMA", + N_("remove a schema"), + "sql-dropschema", + sql_help_DROP_SCHEMA, + 0}, + + {"DROP SEQUENCE", + N_("remove a sequence"), + "sql-dropsequence", + sql_help_DROP_SEQUENCE, + 0}, + + {"DROP SERVER", + N_("remove a foreign server descriptor"), + "sql-dropserver", + sql_help_DROP_SERVER, + 0}, + + {"DROP STATISTICS", + N_("remove extended statistics"), + "sql-dropstatistics", + sql_help_DROP_STATISTICS, + 0}, + + {"DROP SUBSCRIPTION", + N_("remove a subscription"), + "sql-dropsubscription", + sql_help_DROP_SUBSCRIPTION, + 0}, + + {"DROP TABLE", + N_("remove a table"), + "sql-droptable", + sql_help_DROP_TABLE, + 0}, + + {"DROP TABLESPACE", + N_("remove a tablespace"), + "sql-droptablespace", + sql_help_DROP_TABLESPACE, + 0}, + + {"DROP TEXT SEARCH CONFIGURATION", + N_("remove a text search configuration"), + "sql-droptsconfig", + sql_help_DROP_TEXT_SEARCH_CONFIGURATION, + 0}, + + {"DROP TEXT SEARCH DICTIONARY", + N_("remove a text search dictionary"), + "sql-droptsdictionary", + sql_help_DROP_TEXT_SEARCH_DICTIONARY, + 0}, + + {"DROP TEXT SEARCH PARSER", + N_("remove a text search parser"), + "sql-droptsparser", + sql_help_DROP_TEXT_SEARCH_PARSER, + 0}, + + {"DROP TEXT SEARCH TEMPLATE", + N_("remove a text search template"), + "sql-droptstemplate", + sql_help_DROP_TEXT_SEARCH_TEMPLATE, + 0}, + + {"DROP TRANSFORM", + N_("remove a transform"), + "sql-droptransform", + sql_help_DROP_TRANSFORM, + 0}, + + {"DROP TRIGGER", + N_("remove a trigger"), + "sql-droptrigger", + sql_help_DROP_TRIGGER, + 0}, + + {"DROP TYPE", + N_("remove a data type"), + "sql-droptype", + sql_help_DROP_TYPE, + 0}, + + {"DROP USER", + N_("remove a database role"), + "sql-dropuser", + sql_help_DROP_USER, + 0}, + + {"DROP USER MAPPING", + N_("remove a user mapping for a foreign server"), + "sql-dropusermapping", + sql_help_DROP_USER_MAPPING, + 0}, + + {"DROP VIEW", + N_("remove a view"), + "sql-dropview", + sql_help_DROP_VIEW, + 0}, + + {"END", + N_("commit the current transaction"), + "sql-end", + sql_help_END, + 0}, + + {"EXECUTE", + N_("execute a prepared statement"), + "sql-execute", + sql_help_EXECUTE, + 0}, + + {"EXPLAIN", + N_("show the execution plan of a statement"), + "sql-explain", + sql_help_EXPLAIN, + 13}, + + {"FETCH", + N_("retrieve rows from a query using a cursor"), + "sql-fetch", + sql_help_FETCH, + 17}, + + {"GRANT", + N_("define access privileges"), + "sql-grant", + sql_help_GRANT, + 81}, + + {"IMPORT FOREIGN SCHEMA", + N_("import table definitions from a foreign server"), + "sql-importforeignschema", + sql_help_IMPORT_FOREIGN_SCHEMA, + 4}, + + {"INSERT", + N_("create new rows in a table"), + "sql-insert", + sql_help_INSERT, + 19}, + + {"LISTEN", + N_("listen for a notification"), + "sql-listen", + sql_help_LISTEN, + 0}, + + {"LOAD", + N_("load a shared library file"), + "sql-load", + sql_help_LOAD, + 0}, + + {"LOCK", + N_("lock a table"), + "sql-lock", + sql_help_LOCK, + 5}, + + {"MOVE", + N_("position a cursor"), + "sql-move", + sql_help_MOVE, + 17}, + + {"NOTIFY", + N_("generate a notification"), + "sql-notify", + sql_help_NOTIFY, + 0}, + + {"PREPARE", + N_("prepare a statement for execution"), + "sql-prepare", + sql_help_PREPARE, + 0}, + + {"PREPARE TRANSACTION", + N_("prepare the current transaction for two-phase commit"), + "sql-prepare-transaction", + sql_help_PREPARE_TRANSACTION, + 0}, + + {"REASSIGN OWNED", + N_("change the ownership of database objects owned by a database role"), + "sql-reassign-owned", + sql_help_REASSIGN_OWNED, + 1}, + + {"REFRESH MATERIALIZED VIEW", + N_("replace the contents of a materialized view"), + "sql-refreshmaterializedview", + sql_help_REFRESH_MATERIALIZED_VIEW, + 1}, + + {"REINDEX", + N_("rebuild indexes"), + "sql-reindex", + sql_help_REINDEX, + 6}, + + {"RELEASE SAVEPOINT", + N_("destroy a previously defined savepoint"), + "sql-release-savepoint", + sql_help_RELEASE_SAVEPOINT, + 0}, + + {"RESET", + N_("restore the value of a run-time parameter to the default value"), + "sql-reset", + sql_help_RESET, + 1}, + + {"REVOKE", + N_("remove access privileges"), + "sql-revoke", + sql_help_REVOKE, + 108}, + + {"ROLLBACK", + N_("abort the current transaction"), + "sql-rollback", + sql_help_ROLLBACK, + 0}, + + {"ROLLBACK PREPARED", + N_("cancel a transaction that was earlier prepared for two-phase commit"), + "sql-rollback-prepared", + sql_help_ROLLBACK_PREPARED, + 0}, + + {"ROLLBACK TO SAVEPOINT", + N_("roll back to a savepoint"), + "sql-rollback-to", + sql_help_ROLLBACK_TO_SAVEPOINT, + 0}, + + {"SAVEPOINT", + N_("define a new savepoint within the current transaction"), + "sql-savepoint", + sql_help_SAVEPOINT, + 0}, + + {"SECURITY LABEL", + N_("define or change a security label applied to an object"), + "sql-security-label", + sql_help_SECURITY_LABEL, + 29}, + + {"SELECT", + N_("retrieve rows from a table or view"), + "sql-select", + sql_help_SELECT, + 44}, + + {"SELECT INTO", + N_("define a new table from the results of a query"), + "sql-selectinto", + sql_help_SELECT_INTO, + 14}, + + {"SET", + N_("change a run-time parameter"), + "sql-set", + sql_help_SET, + 1}, + + {"SET CONSTRAINTS", + N_("set constraint check timing for the current transaction"), + "sql-set-constraints", + sql_help_SET_CONSTRAINTS, + 0}, + + {"SET ROLE", + N_("set the current user identifier of the current session"), + "sql-set-role", + sql_help_SET_ROLE, + 2}, + + {"SET SESSION AUTHORIZATION", + N_("set the session user identifier and the current user identifier of the current session"), + "sql-set-session-authorization", + sql_help_SET_SESSION_AUTHORIZATION, + 2}, + + {"SET TRANSACTION", + N_("set the characteristics of the current transaction"), + "sql-set-transaction", + sql_help_SET_TRANSACTION, + 8}, + + {"SHOW", + N_("show the value of a run-time parameter"), + "sql-show", + sql_help_SHOW, + 1}, + + {"START TRANSACTION", + N_("start a transaction block"), + "sql-start-transaction", + sql_help_START_TRANSACTION, + 6}, + + {"TABLE", + N_("retrieve rows from a table or view"), + "sql-select", + sql_help_TABLE, + 44}, + + {"TRUNCATE", + N_("empty a table or set of tables"), + "sql-truncate", + sql_help_TRUNCATE, + 1}, + + {"UNLISTEN", + N_("stop listening for a notification"), + "sql-unlisten", + sql_help_UNLISTEN, + 0}, + + {"UPDATE", + N_("update rows of a table"), + "sql-update", + sql_help_UPDATE, + 8}, + + {"VACUUM", + N_("garbage-collect and optionally analyze a database"), + "sql-vacuum", + sql_help_VACUUM, + 18}, + + {"VALUES", + N_("compute a set of rows"), + "sql-values", + sql_help_VALUES, + 4}, + + {"WITH", + N_("retrieve rows from a table or view"), + "sql-select", + sql_help_WITH, + 44}, + + + {NULL, NULL, NULL} /* End of list marker */ +}; diff --git a/psql/psql/downstream/sql_help.h b/psql/psql/downstream/sql_help.h new file mode 100644 index 0000000..abacd7f --- /dev/null +++ b/psql/psql/downstream/sql_help.h @@ -0,0 +1,30 @@ +/* + * *** Do not change this file by hand. It is automatically + * *** generated from the DocBook documentation. + * + * generated by src/bin/psql/create_help.pl + * + */ + +#ifndef SQL_HELP_H +#define SQL_HELP_H + +#include "pqexpbuffer.h" + +struct _helpStruct +{ + const char *cmd; /* the command name */ + const char *help; /* the help associated with it */ + const char *docbook_id; /* DocBook XML id (for generating URL) */ + void (*syntaxfunc) (PQExpBuffer); /* function that prints the + * syntax associated with it */ + int nl_count; /* number of newlines in syntax (for pager) */ +}; + +extern const struct _helpStruct QL_HELP[]; + +#define QL_HELP_COUNT 184 /* number of help items */ +#define QL_MAX_CMD_LEN 32 /* largest strlen(cmd) */ + + +#endif /* SQL_HELP_H */ diff --git a/psql/psql/downstream/strlcat.c b/psql/psql/downstream/strlcat.c new file mode 100644 index 0000000..97b0cc3 --- /dev/null +++ b/psql/psql/downstream/strlcat.c @@ -0,0 +1,6 @@ +/* file : psql/downstream/strlcat.c -*- C -*- + * license : PostgreSQL License; see accompanying COPYRIGHT file + */ +#if !HAVE_DECL_STRLCAT +# include +#endif diff --git a/psql/psql/downstream/strlcpy.c b/psql/psql/downstream/strlcpy.c new file mode 100644 index 0000000..c196963 --- /dev/null +++ b/psql/psql/downstream/strlcpy.c @@ -0,0 +1,6 @@ +/* file : psql/downstream/strlcpy.c -*- C -*- + * license : PostgreSQL License; see accompanying COPYRIGHT file + */ +#if !HAVE_DECL_STRLCPY +# include +#endif diff --git a/psql/psql/include/.gitattributes b/psql/psql/include/.gitattributes new file mode 100644 index 0000000..8cb5c4f --- /dev/null +++ b/psql/psql/include/.gitattributes @@ -0,0 +1 @@ +common symlink=dir diff --git a/psql/psql/include/c.h b/psql/psql/include/c.h new file mode 120000 index 0000000..6f95f77 --- /dev/null +++ b/psql/psql/include/c.h @@ -0,0 +1 @@ +../../../upstream/src/include/c.h \ No newline at end of file diff --git a/psql/psql/include/catalog/genbki.h b/psql/psql/include/catalog/genbki.h new file mode 120000 index 0000000..1fe9988 --- /dev/null +++ b/psql/psql/include/catalog/genbki.h @@ -0,0 +1 @@ +../../../../upstream/src/include/catalog/genbki.h \ No newline at end of file diff --git a/psql/psql/include/catalog/pg_am.h b/psql/psql/include/catalog/pg_am.h new file mode 120000 index 0000000..3cc161d --- /dev/null +++ b/psql/psql/include/catalog/pg_am.h @@ -0,0 +1 @@ +../../../../upstream/src/include/catalog/pg_am.h \ No newline at end of file diff --git a/psql/psql/include/common b/psql/psql/include/common new file mode 120000 index 0000000..4379965 --- /dev/null +++ b/psql/psql/include/common @@ -0,0 +1 @@ +../../../upstream/src/include/common \ No newline at end of file diff --git a/psql/psql/include/fe_utils/cancel.h b/psql/psql/include/fe_utils/cancel.h new file mode 120000 index 0000000..5b55d78 --- /dev/null +++ b/psql/psql/include/fe_utils/cancel.h @@ -0,0 +1 @@ +../../../../upstream/src/include/fe_utils/cancel.h \ No newline at end of file diff --git a/psql/psql/include/fe_utils/conditional.h b/psql/psql/include/fe_utils/conditional.h new file mode 120000 index 0000000..389c31e --- /dev/null +++ b/psql/psql/include/fe_utils/conditional.h @@ -0,0 +1 @@ +../../../../upstream/src/include/fe_utils/conditional.h \ No newline at end of file diff --git a/psql/psql/include/fe_utils/mbprint.h b/psql/psql/include/fe_utils/mbprint.h new file mode 120000 index 0000000..91c4a37 --- /dev/null +++ b/psql/psql/include/fe_utils/mbprint.h @@ -0,0 +1 @@ +../../../../upstream/src/include/fe_utils/mbprint.h \ No newline at end of file diff --git a/psql/psql/include/fe_utils/print.h b/psql/psql/include/fe_utils/print.h new file mode 120000 index 0000000..9bb3874 --- /dev/null +++ b/psql/psql/include/fe_utils/print.h @@ -0,0 +1 @@ +../../../../upstream/src/include/fe_utils/print.h \ No newline at end of file diff --git a/psql/psql/include/fe_utils/psqlscan.h b/psql/psql/include/fe_utils/psqlscan.h new file mode 120000 index 0000000..c9d2c3b --- /dev/null +++ b/psql/psql/include/fe_utils/psqlscan.h @@ -0,0 +1 @@ +../../../../upstream/src/include/fe_utils/psqlscan.h \ No newline at end of file diff --git a/psql/psql/include/fe_utils/psqlscan_int.h b/psql/psql/include/fe_utils/psqlscan_int.h new file mode 120000 index 0000000..974bfa0 --- /dev/null +++ b/psql/psql/include/fe_utils/psqlscan_int.h @@ -0,0 +1 @@ +../../../../upstream/src/include/fe_utils/psqlscan_int.h \ No newline at end of file diff --git a/psql/psql/include/fe_utils/string_utils.h b/psql/psql/include/fe_utils/string_utils.h new file mode 120000 index 0000000..c8ad0e7 --- /dev/null +++ b/psql/psql/include/fe_utils/string_utils.h @@ -0,0 +1 @@ +../../../../upstream/src/include/fe_utils/string_utils.h \ No newline at end of file diff --git a/psql/psql/include/getopt_long.h b/psql/psql/include/getopt_long.h new file mode 120000 index 0000000..d2a9386 --- /dev/null +++ b/psql/psql/include/getopt_long.h @@ -0,0 +1 @@ +../../../upstream/src/include/getopt_long.h \ No newline at end of file diff --git a/psql/psql/include/lib/sort_template.h b/psql/psql/include/lib/sort_template.h new file mode 120000 index 0000000..6821f8a --- /dev/null +++ b/psql/psql/include/lib/sort_template.h @@ -0,0 +1 @@ +../../../../upstream/src/include/lib/sort_template.h \ No newline at end of file diff --git a/psql/psql/include/lib/stringinfo.h b/psql/psql/include/lib/stringinfo.h new file mode 120000 index 0000000..c5c3439 --- /dev/null +++ b/psql/psql/include/lib/stringinfo.h @@ -0,0 +1 @@ +../../../../upstream/src/include/lib/stringinfo.h \ No newline at end of file diff --git a/psql/psql/include/libpq/pqcomm.h b/psql/psql/include/libpq/pqcomm.h new file mode 120000 index 0000000..69de3bc --- /dev/null +++ b/psql/psql/include/libpq/pqcomm.h @@ -0,0 +1 @@ +../../../../upstream/src/include/libpq/pqcomm.h \ No newline at end of file diff --git a/psql/psql/include/mb/pg_wchar.h b/psql/psql/include/mb/pg_wchar.h new file mode 120000 index 0000000..ed65657 --- /dev/null +++ b/psql/psql/include/mb/pg_wchar.h @@ -0,0 +1 @@ +../../../../upstream/src/include/mb/pg_wchar.h \ No newline at end of file diff --git a/psql/psql/include/parser/kwlist.h b/psql/psql/include/parser/kwlist.h new file mode 120000 index 0000000..5872329 --- /dev/null +++ b/psql/psql/include/parser/kwlist.h @@ -0,0 +1 @@ +../../../../upstream/src/include/parser/kwlist.h \ No newline at end of file diff --git a/psql/psql/include/pg_config_manual.h b/psql/psql/include/pg_config_manual.h new file mode 120000 index 0000000..485eb76 --- /dev/null +++ b/psql/psql/include/pg_config_manual.h @@ -0,0 +1 @@ +../../../upstream/src/include/pg_config_manual.h \ No newline at end of file diff --git a/psql/psql/include/pg_getopt.h b/psql/psql/include/pg_getopt.h new file mode 120000 index 0000000..447954e --- /dev/null +++ b/psql/psql/include/pg_getopt.h @@ -0,0 +1 @@ +../../../upstream/src/include/pg_getopt.h \ No newline at end of file diff --git a/psql/psql/include/port.h b/psql/psql/include/port.h new file mode 120000 index 0000000..82aed06 --- /dev/null +++ b/psql/psql/include/port.h @@ -0,0 +1 @@ +../../../upstream/src/include/port.h \ No newline at end of file diff --git a/psql/psql/include/port/.gitattributes b/psql/psql/include/port/.gitattributes new file mode 100644 index 0000000..2ba6a7e --- /dev/null +++ b/psql/psql/include/port/.gitattributes @@ -0,0 +1,2 @@ +win32 symlink=dir +win32_msvc symlink=dir diff --git a/psql/psql/include/port/darwin.h b/psql/psql/include/port/darwin.h new file mode 120000 index 0000000..7844da8 --- /dev/null +++ b/psql/psql/include/port/darwin.h @@ -0,0 +1 @@ +../../../../upstream/src/include/port/darwin.h \ No newline at end of file diff --git a/psql/psql/include/port/freebsd.h b/psql/psql/include/port/freebsd.h new file mode 120000 index 0000000..7685fa5 --- /dev/null +++ b/psql/psql/include/port/freebsd.h @@ -0,0 +1 @@ +../../../../upstream/src/include/port/freebsd.h \ No newline at end of file diff --git a/psql/psql/include/port/linux.h b/psql/psql/include/port/linux.h new file mode 120000 index 0000000..3e054ce --- /dev/null +++ b/psql/psql/include/port/linux.h @@ -0,0 +1 @@ +../../../../upstream/src/include/port/linux.h \ No newline at end of file diff --git a/psql/psql/include/port/win32 b/psql/psql/include/port/win32 new file mode 120000 index 0000000..306f506 --- /dev/null +++ b/psql/psql/include/port/win32 @@ -0,0 +1 @@ +../../../../upstream/src/include/port/win32 \ No newline at end of file diff --git a/psql/psql/include/port/win32.h b/psql/psql/include/port/win32.h new file mode 120000 index 0000000..f48b8ef --- /dev/null +++ b/psql/psql/include/port/win32.h @@ -0,0 +1 @@ +../../../../upstream/src/include/port/win32.h \ No newline at end of file diff --git a/psql/psql/include/port/win32_msvc b/psql/psql/include/port/win32_msvc new file mode 120000 index 0000000..bf2a9ef --- /dev/null +++ b/psql/psql/include/port/win32_msvc @@ -0,0 +1 @@ +../../../../upstream/src/include/port/win32_msvc \ No newline at end of file diff --git a/psql/psql/include/portability/instr_time.h b/psql/psql/include/portability/instr_time.h new file mode 120000 index 0000000..4768836 --- /dev/null +++ b/psql/psql/include/portability/instr_time.h @@ -0,0 +1 @@ +../../../../upstream/src/include/portability/instr_time.h \ No newline at end of file diff --git a/psql/psql/include/postgres_fe.h b/psql/psql/include/postgres_fe.h new file mode 120000 index 0000000..5277360 --- /dev/null +++ b/psql/psql/include/postgres_fe.h @@ -0,0 +1 @@ +../../../upstream/src/include/postgres_fe.h \ No newline at end of file diff --git a/psql/psql/include/pqexpbuffer.h b/psql/psql/include/pqexpbuffer.h new file mode 120000 index 0000000..8430a6d --- /dev/null +++ b/psql/psql/include/pqexpbuffer.h @@ -0,0 +1 @@ +../../../upstream/src/interfaces/libpq/pqexpbuffer.h \ No newline at end of file diff --git a/psql/psql/src/.gitattributes b/psql/psql/src/.gitattributes new file mode 100644 index 0000000..3ad0908 --- /dev/null +++ b/psql/psql/src/.gitattributes @@ -0,0 +1 @@ +psql symlink=dir diff --git a/psql/psql/src/common/exec.c b/psql/psql/src/common/exec.c new file mode 120000 index 0000000..2c234c1 --- /dev/null +++ b/psql/psql/src/common/exec.c @@ -0,0 +1 @@ +../../../../upstream/src/common/exec.c \ No newline at end of file diff --git a/psql/psql/src/common/fe_memutils.c b/psql/psql/src/common/fe_memutils.c new file mode 120000 index 0000000..9612fe0 --- /dev/null +++ b/psql/psql/src/common/fe_memutils.c @@ -0,0 +1 @@ +../../../../upstream/src/common/fe_memutils.c \ No newline at end of file diff --git a/psql/psql/src/common/keywords.c b/psql/psql/src/common/keywords.c new file mode 120000 index 0000000..caa9311 --- /dev/null +++ b/psql/psql/src/common/keywords.c @@ -0,0 +1 @@ +../../../../upstream/src/common/keywords.c \ No newline at end of file diff --git a/psql/psql/src/common/kwlookup.c b/psql/psql/src/common/kwlookup.c new file mode 120000 index 0000000..9422291 --- /dev/null +++ b/psql/psql/src/common/kwlookup.c @@ -0,0 +1 @@ +../../../../upstream/src/common/kwlookup.c \ No newline at end of file diff --git a/psql/psql/src/common/logging.c b/psql/psql/src/common/logging.c new file mode 120000 index 0000000..c23a3d6 --- /dev/null +++ b/psql/psql/src/common/logging.c @@ -0,0 +1 @@ +../../../../upstream/src/common/logging.c \ No newline at end of file diff --git a/psql/psql/src/common/pg_get_line.c b/psql/psql/src/common/pg_get_line.c new file mode 120000 index 0000000..9c031ff --- /dev/null +++ b/psql/psql/src/common/pg_get_line.c @@ -0,0 +1 @@ +../../../../upstream/src/common/pg_get_line.c \ No newline at end of file diff --git a/psql/psql/src/common/psprintf.c b/psql/psql/src/common/psprintf.c new file mode 120000 index 0000000..420da37 --- /dev/null +++ b/psql/psql/src/common/psprintf.c @@ -0,0 +1 @@ +../../../../upstream/src/common/psprintf.c \ No newline at end of file diff --git a/psql/psql/src/common/sprompt.c b/psql/psql/src/common/sprompt.c new file mode 120000 index 0000000..d67c058 --- /dev/null +++ b/psql/psql/src/common/sprompt.c @@ -0,0 +1 @@ +../../../../upstream/src/common/sprompt.c \ No newline at end of file diff --git a/psql/psql/src/common/string.c b/psql/psql/src/common/string.c new file mode 120000 index 0000000..bd4d956 --- /dev/null +++ b/psql/psql/src/common/string.c @@ -0,0 +1 @@ +../../../../upstream/src/common/string.c \ No newline at end of file diff --git a/psql/psql/src/common/stringinfo.c b/psql/psql/src/common/stringinfo.c new file mode 120000 index 0000000..1bbe7ff --- /dev/null +++ b/psql/psql/src/common/stringinfo.c @@ -0,0 +1 @@ +../../../../upstream/src/common/stringinfo.c \ No newline at end of file diff --git a/psql/psql/src/common/username.c b/psql/psql/src/common/username.c new file mode 120000 index 0000000..5947624 --- /dev/null +++ b/psql/psql/src/common/username.c @@ -0,0 +1 @@ +../../../../upstream/src/common/username.c \ No newline at end of file diff --git a/psql/psql/src/common/wait_error.c b/psql/psql/src/common/wait_error.c new file mode 120000 index 0000000..47dfbd0 --- /dev/null +++ b/psql/psql/src/common/wait_error.c @@ -0,0 +1 @@ +../../../../upstream/src/common/wait_error.c \ No newline at end of file diff --git a/psql/psql/src/fe_utils/cancel.c b/psql/psql/src/fe_utils/cancel.c new file mode 120000 index 0000000..6f89257 --- /dev/null +++ b/psql/psql/src/fe_utils/cancel.c @@ -0,0 +1 @@ +../../../../upstream/src/fe_utils/cancel.c \ No newline at end of file diff --git a/psql/psql/src/fe_utils/conditional.c b/psql/psql/src/fe_utils/conditional.c new file mode 120000 index 0000000..466657e --- /dev/null +++ b/psql/psql/src/fe_utils/conditional.c @@ -0,0 +1 @@ +../../../../upstream/src/fe_utils/conditional.c \ No newline at end of file diff --git a/psql/psql/src/fe_utils/mbprint.c b/psql/psql/src/fe_utils/mbprint.c new file mode 120000 index 0000000..392b596 --- /dev/null +++ b/psql/psql/src/fe_utils/mbprint.c @@ -0,0 +1 @@ +../../../../upstream/src/fe_utils/mbprint.c \ No newline at end of file diff --git a/psql/psql/src/fe_utils/print.c b/psql/psql/src/fe_utils/print.c new file mode 120000 index 0000000..2c2e779 --- /dev/null +++ b/psql/psql/src/fe_utils/print.c @@ -0,0 +1 @@ +../../../../upstream/src/fe_utils/print.c \ No newline at end of file diff --git a/psql/psql/src/fe_utils/string_utils.c b/psql/psql/src/fe_utils/string_utils.c new file mode 120000 index 0000000..a1018aa --- /dev/null +++ b/psql/psql/src/fe_utils/string_utils.c @@ -0,0 +1 @@ +../../../../upstream/src/fe_utils/string_utils.c \ No newline at end of file diff --git a/psql/psql/src/port/getopt.c b/psql/psql/src/port/getopt.c new file mode 120000 index 0000000..02989d3 --- /dev/null +++ b/psql/psql/src/port/getopt.c @@ -0,0 +1 @@ +../../../../upstream/src/port/getopt.c \ No newline at end of file diff --git a/psql/psql/src/port/getopt_long.c b/psql/psql/src/port/getopt_long.c new file mode 120000 index 0000000..9a11c79 --- /dev/null +++ b/psql/psql/src/port/getopt_long.c @@ -0,0 +1 @@ +../../../../upstream/src/port/getopt_long.c \ No newline at end of file diff --git a/psql/psql/src/port/open.c b/psql/psql/src/port/open.c new file mode 120000 index 0000000..4af6355 --- /dev/null +++ b/psql/psql/src/port/open.c @@ -0,0 +1 @@ +../../../../upstream/src/port/open.c \ No newline at end of file diff --git a/psql/psql/src/port/path.c b/psql/psql/src/port/path.c new file mode 120000 index 0000000..64b4ae4 --- /dev/null +++ b/psql/psql/src/port/path.c @@ -0,0 +1 @@ +../../../../upstream/src/port/path.c \ No newline at end of file diff --git a/psql/psql/src/port/pgsleep.c b/psql/psql/src/port/pgsleep.c new file mode 120000 index 0000000..1d55cbe --- /dev/null +++ b/psql/psql/src/port/pgsleep.c @@ -0,0 +1 @@ +../../../../upstream/src/port/pgsleep.c \ No newline at end of file diff --git a/psql/psql/src/port/pgstrcasecmp.c b/psql/psql/src/port/pgstrcasecmp.c new file mode 120000 index 0000000..e3f5acc --- /dev/null +++ b/psql/psql/src/port/pgstrcasecmp.c @@ -0,0 +1 @@ +../../../../upstream/src/port/pgstrcasecmp.c \ No newline at end of file diff --git a/psql/psql/src/port/pgstrsignal.c b/psql/psql/src/port/pgstrsignal.c new file mode 120000 index 0000000..aac4272 --- /dev/null +++ b/psql/psql/src/port/pgstrsignal.c @@ -0,0 +1 @@ +../../../../upstream/src/port/pgstrsignal.c \ No newline at end of file diff --git a/psql/psql/src/port/qsort.c b/psql/psql/src/port/qsort.c new file mode 120000 index 0000000..60f39df --- /dev/null +++ b/psql/psql/src/port/qsort.c @@ -0,0 +1 @@ +../../../../upstream/src/port/qsort.c \ No newline at end of file diff --git a/psql/psql/src/port/snprintf.c b/psql/psql/src/port/snprintf.c new file mode 120000 index 0000000..5b30ae3 --- /dev/null +++ b/psql/psql/src/port/snprintf.c @@ -0,0 +1 @@ +../../../../upstream/src/port/snprintf.c \ No newline at end of file diff --git a/psql/psql/src/port/strerror.c b/psql/psql/src/port/strerror.c new file mode 120000 index 0000000..47b4c7b --- /dev/null +++ b/psql/psql/src/port/strerror.c @@ -0,0 +1 @@ +../../../../upstream/src/port/strerror.c \ No newline at end of file diff --git a/psql/psql/src/port/strlcat.c b/psql/psql/src/port/strlcat.c new file mode 120000 index 0000000..b64d26e --- /dev/null +++ b/psql/psql/src/port/strlcat.c @@ -0,0 +1 @@ +../../../../upstream/src/port/strlcat.c \ No newline at end of file diff --git a/psql/psql/src/port/strlcpy.c b/psql/psql/src/port/strlcpy.c new file mode 120000 index 0000000..ea1aa2d --- /dev/null +++ b/psql/psql/src/port/strlcpy.c @@ -0,0 +1 @@ +../../../../upstream/src/port/strlcpy.c \ No newline at end of file diff --git a/psql/psql/src/port/system.c b/psql/psql/src/port/system.c new file mode 120000 index 0000000..71f4107 --- /dev/null +++ b/psql/psql/src/port/system.c @@ -0,0 +1 @@ +../../../../upstream/src/port/system.c \ No newline at end of file diff --git a/psql/psql/src/port/thread.c b/psql/psql/src/port/thread.c new file mode 120000 index 0000000..ff3bb09 --- /dev/null +++ b/psql/psql/src/port/thread.c @@ -0,0 +1 @@ +../../../../upstream/src/port/thread.c \ No newline at end of file diff --git a/psql/psql/src/port/win32env.c b/psql/psql/src/port/win32env.c new file mode 120000 index 0000000..72b4100 --- /dev/null +++ b/psql/psql/src/port/win32env.c @@ -0,0 +1 @@ +../../../../upstream/src/port/win32env.c \ No newline at end of file diff --git a/psql/psql/src/port/win32error.c b/psql/psql/src/port/win32error.c new file mode 120000 index 0000000..2813115 --- /dev/null +++ b/psql/psql/src/port/win32error.c @@ -0,0 +1 @@ +../../../../upstream/src/port/win32error.c \ No newline at end of file diff --git a/psql/psql/src/port/win32setlocale.c b/psql/psql/src/port/win32setlocale.c new file mode 120000 index 0000000..43d64a3 --- /dev/null +++ b/psql/psql/src/port/win32setlocale.c @@ -0,0 +1 @@ +../../../../upstream/src/port/win32setlocale.c \ No newline at end of file diff --git a/psql/psql/src/port/win32stat.c b/psql/psql/src/port/win32stat.c new file mode 120000 index 0000000..291077c --- /dev/null +++ b/psql/psql/src/port/win32stat.c @@ -0,0 +1 @@ +../../../../upstream/src/port/win32stat.c \ No newline at end of file diff --git a/psql/psql/src/psql b/psql/psql/src/psql new file mode 120000 index 0000000..ba3fc93 --- /dev/null +++ b/psql/psql/src/psql @@ -0,0 +1 @@ +../../../upstream/src/bin/psql \ No newline at end of file diff --git a/psql/tests/.gitignore b/psql/tests/.gitignore new file mode 100644 index 0000000..ce6eed8 --- /dev/null +++ b/psql/tests/.gitignore @@ -0,0 +1,4 @@ +# Testscript output directories (can be symlinks). +# +test +test-* diff --git a/psql/tests/build/.gitignore b/psql/tests/build/.gitignore new file mode 100644 index 0000000..4a730a3 --- /dev/null +++ b/psql/tests/build/.gitignore @@ -0,0 +1,3 @@ +config.build +root/ +bootstrap/ diff --git a/psql/tests/build/bootstrap.build b/psql/tests/build/bootstrap.build new file mode 100644 index 0000000..092a76b --- /dev/null +++ b/psql/tests/build/bootstrap.build @@ -0,0 +1,8 @@ +# file : tests/build/bootstrap.build +# license : PostgreSQL License; see accompanying COPYRIGHT file + +project = # Unnamed tests subproject. + +using config +using test +using dist diff --git a/psql/tests/build/root.build b/psql/tests/build/root.build new file mode 100644 index 0000000..4c0e7c3 --- /dev/null +++ b/psql/tests/build/root.build @@ -0,0 +1,15 @@ +# file : tests/build/root.build +# license : PostgreSQL License; see accompanying COPYRIGHT file + +# We need to configure C module to obtain the target information (see below). +# +using c.config + +# Setup the psql program that we are testing. +# +import psql = psql%exe{psql} +testscript{*}: test = $psql + +# Specify the test target for cross-testing. +# +test.target = $c.target diff --git a/psql/tests/buildfile b/psql/tests/buildfile new file mode 100644 index 0000000..78b6dd7 --- /dev/null +++ b/psql/tests/buildfile @@ -0,0 +1,4 @@ +# file : tests/buildfile +# license : PostgreSQL License; see accompanying COPYRIGHT file + +./: testscript{*} $psql diff --git a/psql/tests/help.testscript b/psql/tests/help.testscript new file mode 100644 index 0000000..165eb35 --- /dev/null +++ b/psql/tests/help.testscript @@ -0,0 +1,12 @@ +# file : tests/help.testscript +# license : PostgreSQL License; see accompanying COPYRIGHT file + +: basics +: +: Test that stdout contains at least one non-empty line. +: +$* --help >>~%EOO% + %.* + %.+% + %.* + EOO diff --git a/psql/tests/version.testscript b/psql/tests/version.testscript new file mode 100644 index 0000000..cfeea80 --- /dev/null +++ b/psql/tests/version.testscript @@ -0,0 +1,8 @@ +# file : tests/version.testscript +# license : PostgreSQL License; see accompanying COPYRIGHT file + +: basics +: +$* --version >>~%EOO% + %.+PostgreSQL.+% + EOO -- cgit v1.1