diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 804e47e..a8f7150 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,27 +18,30 @@ jobs: os: [ubuntu-latest] build-options: ["-Dssl=None -Ddisable-zlib -Ddisable-zstd", "-Dssl=OpenSSL", "-Dssl=LibreSSL"] include: - - zig-version: "0.14.0" + # Test for users that want stability and use older kernel, glibc and zig versions + - zig-version: "0.14.1" + os: ubuntu-22.04 # GLIBC 2.35 + build-options: "-Dssl=LibreSSL" + - zig-version: "0.15.2" os: ubuntu-latest - build-options: "-Dssl=None -Ddisable-zlib -Ddisable-zstd" - - zig-version: "master" - os: macos-latest # Apple Silicon (M1) build-options: "-Dssl=None" - zig-version: "master" - os: macos-13 # Intel macOS + os: macos-latest # Apple Silicon + build-options: "-Dssl=LibreSSL" + - zig-version: "master" + os: macos-latest-intel build-options: "-Dssl=LibreSSL" runs-on: ${{ matrix.os }} steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Set up Zig uses: mlugg/setup-zig@v2 with: version: ${{ matrix.zig-version }} - use-cache: false - name: Run `build` run: zig build ${{ matrix.build-options }} --summary all diff --git a/LICENSE b/LICENSE index 29ce4a4..058557f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 contributors +Copyright (c) 2024-2025 contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index d1134d8..a34ab2b 100644 --- a/README.md +++ b/README.md @@ -4,20 +4,18 @@ Provides a package to be used by the zig package manager for C programs. ## Status -| Architecture \ OS | Linux | MacOS | -|:------------------|:-----------|-------| -| x86_64 | ✅ | ✅ | -| arm 64 | (untested) | ✅* | +| Architecture \ OS | Linux | MacOS | +|:------------------|:-----------|-----------------------| +| x86_64 | ✅ | ✅ | +| arm 64 | (untested) | ✅ (not with OpenSSL) | | Refname | PostgreSQL version | Zig `0.16.x` | Zig `0.15.x` | Zig `0.14.x` | Zig `0.13.x` | |------------|--------------------|--------------|--------------|--------------|--------------| +| `5.18.1` | `REL_18_1` | ✅ | ✅ | ✅ | ❌ | | `5.16.4+5` | `REL_16_4` | ✅ | ✅ | ✅ | ❌ | -| `5.16.4+4` | `REL_16_4` | ✅* | ✅ | ✅ | ❌ | -| `5.16.4+4` | `REL_16_4` | ✅* | ✅ | ✅ | ❌ | | `5.16.4+3` | `REL_16_4` | ❌ | ❌ | ✅ | ❌ | | `5.16.4+2` | `REL_16_4` | ❌ | ❌ | ❌ | ✅ | -*: Will not work with OpenSSL ## Use @@ -54,7 +52,7 @@ exe.linkLibrary(postgres.artifact("pq")); To update this project dependencies: ```bash -zig fetch --save=upstream git+https://github.com/postgres/postgres#REL_16_4 +zig fetch --save=upstream git+https://github.com/postgres/postgres#REL_18_1 zig fetch --save git+https://github.com/allyourcodebase/openssl#main zig fetch --save git+https://github.com/allyourcodebase/libressl#master zig fetch --save git+https://github.com/allyourcodebase/zlib#main diff --git a/build.zig b/build.zig index da28023..e2bfdcb 100644 --- a/build.zig +++ b/build.zig @@ -1,6 +1,6 @@ const std = @import("std"); -const version = .{ .major = 16, .minor = 4 }; +const version = .{ .major = 18, .minor = 1 }; const libpq_path = "src/interfaces/libpq"; const ssl_type = enum { OpenSSL, LibreSSL, None }; @@ -22,10 +22,6 @@ pub fn build(b: *std.Build) !void { const upstream = b.dependency("upstream", .{ .target = target, .optimize = optimize }); - const config_ext = b.addConfigHeader( - .{ .style = .{ .autoconf_undef = upstream.path("src/include/pg_config_ext.h.in") }, .include_path = "pg_config_ext.h" }, - .{ .PG_INT64_TYPE = .@"long int" }, - ); const pg_config = b.addConfigHeader( .{ .style = .{ .autoconf_undef = upstream.path("src/include/pg_config.h.in") }, .include_path = "pg_config.h" }, autoconf, @@ -60,12 +56,14 @@ pub fn build(b: *std.Build) !void { .flags = &CFLAGS, }); - const config_headers = [_]*std.Build.Step.ConfigHeader{ config_ext, pg_config, config_os }; + const config_headers = [_]*std.Build.Step.ConfigHeader{ pg_config, config_os }; lib.addIncludePath(upstream.path("src/include")); lib.addIncludePath(b.path("include")); + lib.addIncludePath(upstream.path(libpq_path)); lib.addConfigHeader(config_path); lib.root_module.addCMacro("FRONTEND", "1"); + lib.root_module.addCMacro("JSONAPI_USE_PQEXPBUFFER", "1"); lib.linkLibC(); b.installArtifact(lib); @@ -101,15 +99,9 @@ pub fn build(b: *std.Build) !void { .OPENSSL_API_COMPAT = .@"0x10001000L", .HAVE_LIBCRYPTO = use_ssl, .HAVE_LIBSSL = use_ssl, - .HAVE_OPENSSL_INIT_SSL = use_ssl, .HAVE_SSL_CTX_SET_CERT_CB = use_openssl, .HAVE_SSL_CTX_SET_NUM_TICKETS = use_ssl, .HAVE_X509_GET_SIGNATURE_INFO = use_openssl, - .HAVE_X509_GET_SIGNATURE_NID = use_ssl, - .HAVE_BIO_METH_NEW = use_ssl, - .HAVE_HMAC_CTX_FREE = use_ssl, - .HAVE_HMAC_CTX_NEW = use_ssl, - .HAVE_ASN1_STRING_GET0_DATA = use_ssl, }); if (ssl_option != .None) { @@ -126,7 +118,6 @@ pub fn build(b: *std.Build) !void { .files = &.{ "cryptohash_openssl.c", "hmac_openssl.c", - "protocol_openssl.c", }, .flags = &CFLAGS, }); @@ -163,7 +154,7 @@ pub fn build(b: *std.Build) !void { .USE_ZSTD = use_zstd, }); - const have_strlcat: bool = target.result.os.tag == .macos; // or linux with glibc >= 2.38, how can I test that ? + const have_strlcat: bool = target.result.os.tag == .macos or (target.result.os.tag == .linux and target.result.os.versionRange().gnuLibCVersion().?.order(.{ .major = 2, .minor = 38, .patch = 0 }) == .gt); if (!have_strlcat) { lib.addCSourceFiles(.{ .root = upstream.path("src/port"), @@ -202,23 +193,27 @@ pub fn build(b: *std.Build) !void { if (target.result.os.tag == .linux) { pg_config.addValues(.{ .HAVE_EXPLICIT_BZERO = 1, - .HAVE_STRCHRNUL = 1, + .HAVE_DECL_STRCHRNUL = 1, .HAVE_STRINGS_H = 1, - .HAVE_MEMSET_S = null, + .HAVE_DECL_MEMSET_S = null, .HAVE_SYS_UCRED_H = null, + .HAVE_SYNCFS = 1, + .HAVE_XLOCALE_H = null, }); } else if (target.result.os.tag == .macos) { if (target.result.os.isAtLeast(.macos, .{ .major = 15, .minor = 4, .patch = 0 }).?) { - pg_config.addValues(.{ .HAVE_STRCHRNUL = 1 }); + pg_config.addValues(.{ .HAVE_DECL_STRCHRNUL = 1 }); } else { - pg_config.addValues(.{ .HAVE_STRCHRNUL = null }); + pg_config.addValues(.{ .HAVE_DECL_STRCHRNUL = null }); } pg_config.addValues(.{ .HAVE_EXPLICIT_BZERO = null, .HAVE_STRINGS_H = 0, - .HAVE_MEMSET_S = 1, + .HAVE_DECL_MEMSET_S = 1, .HAVE_SYS_UCRED_H = 1, + .HAVE_SYNCFS = null, + .HAVE_XLOCALE_H = 1, }); lib.addCSourceFile(.{ .file = upstream.path("src/port/explicit_bzero.c"), @@ -226,6 +221,22 @@ pub fn build(b: *std.Build) !void { }); } else return error.ConfigUnknown; + pg_config.addValues(.{ + .ALIGNOF_DOUBLE = target.result.cTypeAlignment(.double), + .ALIGNOF_INT = target.result.cTypeAlignment(.int), + .ALIGNOF_INT64_T = @alignOf(i64), + .ALIGNOF_LONG = target.result.cTypeAlignment(.long), + .ALIGNOF_PG_INT128_TYPE = @alignOf(i128), + .ALIGNOF_SHORT = target.result.cTypeAlignment(.short), + .MAXIMUM_ALIGNOF = target.result.cTypeAlignment(.longlong), + + .SIZEOF_LONG = target.result.cTypeByteSize(.long), + .SIZEOF_LONG_LONG = target.result.cTypeByteSize(.longlong), + .SIZEOF_OFF_T = target.result.cTypeByteSize(.long), + .SIZEOF_SIZE_T = target.result.cTypeByteSize(.ulong), + .SIZEOF_VOID_P = @sizeOf(*void), + }); + // Export public headers, the way the Makefile in src/interfaces/libpq does lib.installHeadersDirectory( upstream.path(libpq_path), @@ -310,6 +321,8 @@ pub fn build(b: *std.Build) !void { const libpq_sources = .{ "fe-auth-scram.c", + "fe-auth-oauth.c", + "fe-cancel.c", "fe-connect.c", "fe-exec.c", "fe-lobj.c", @@ -326,6 +339,7 @@ const libpq_sources = .{ const libport_sources = .{ "getpeereid.c", + "timingsafe_bcmp.c", "pg_crc32c_sb8.c", "bsearch_arg.c", "chklocale.c", @@ -333,6 +347,10 @@ const libport_sources = .{ "noblock.c", "path.c", "pg_bitutils.c", + "pg_localeconv_r.c", + "pg_numa.c", + "pg_popcount_aarch64.c", + "pg_popcount_avx512.c", "pg_strong_random.c", "pgcheckdir.c", "pgmkdirp.c", @@ -346,12 +364,13 @@ const libport_sources = .{ "snprintf.c", "strerror.c", "tar.c", - "thread.c", }; const common_sources = .{ "archive.c", "base64.c", + "binaryheap.c", + "blkreftable.c", "checksum_helper.c", "compression.c", "config_info.c", @@ -369,6 +388,7 @@ const common_sources = .{ "kwlookup.c", "link-canary.c", "md5_common.c", + "parse_manifest.c", "percentrepl.c", "pg_get_line.c", "pg_lzcompress.c", @@ -381,6 +401,8 @@ const common_sources = .{ "scram-common.c", "string.c", "stringinfo.c", + "unicode_case.c", + "unicode_category.c", "unicode_norm.c", "username.c", "wait_error.c", @@ -424,35 +446,54 @@ const default_paths = .{ }; const autoconf = .{ - .ALIGNOF_DOUBLE = @alignOf(f64), - .ALIGNOF_INT = @alignOf(c_int), - .ALIGNOF_LONG = @alignOf(c_long), - .ALIGNOF_PG_INT128_TYPE = @alignOf(i128), - .ALIGNOF_SHORT = @alignOf(c_short), - .MAXIMUM_ALIGNOF = @alignOf(c_longlong), - - .SIZEOF_BOOL = @sizeOf(bool), - .SIZEOF_LONG = @sizeOf(c_long), - .SIZEOF_OFF_T = @sizeOf(c_long), - .SIZEOF_SIZE_T = @sizeOf(usize), - .SIZEOF_VOID_P = @sizeOf(*void), - + ._FILE_OFFSET_BITS = null, + ._LARGE_FILES = null, + ._LARGEFILE_SOURCE = null, + .@"inline" = null, + .AC_APPLE_UNIVERSAL_BUILD = null, .BLCKSZ = 8192, .CONFIGURE_ARGS = " '--with-ssl=openssl' 'CC=zig cc' 'CXX=zig c++'", .DEF_PGPORT = 5432, .DEF_PGPORT_STR = "5432", .DLSUFFIX = ".so", - .ENABLE_THREAD_SAFETY = 1, + .ENABLE_GSS = null, + .ENABLE_NLS = null, + .HAVE__BUILTIN_BSWAP16 = 1, + .HAVE__BUILTIN_BSWAP32 = 1, + .HAVE__BUILTIN_BSWAP64 = 1, + .HAVE__BUILTIN_CLZ = 1, + .HAVE__BUILTIN_CONSTANT_P = 1, + .HAVE__BUILTIN_CTZ = 1, + .HAVE__BUILTIN_FRAME_ADDRESS = 1, + .HAVE__BUILTIN_OP_OVERFLOW = 1, + .HAVE__BUILTIN_POPCOUNT = 1, + .HAVE__BUILTIN_TYPES_COMPATIBLE_P = 1, + .HAVE__BUILTIN_UNREACHABLE = 1, + .HAVE__CPUID = null, + .HAVE__CPUIDEX = null, + .HAVE__GET_CPUID_COUNT = null, + .HAVE__STATIC_ASSERT = 1, .HAVE_APPEND_HISTORY = 1, - .HAVE_ATOMICS = 1, + .HAVE_ATOMIC_H = null, .HAVE_BACKTRACE_SYMBOLS = 1, .HAVE_COMPUTED_GOTO = 1, - .HAVE_DECL_FDATASYNC = 1, + .HAVE_COPY_FILE_RANGE = 0, + .HAVE_COPYFILE = null, + .HAVE_COPYFILE_H = null, + .HAVE_CRTDEFS_H = null, .HAVE_DECL_F_FULLFSYNC = 0, + .HAVE_DECL_FDATASYNC = 1, + .HAVE_DECL_LLVMCREATEGDBREGISTRATIONLISTENER = null, + .HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER = null, .HAVE_DECL_POSIX_FADVISE = 1, .HAVE_DECL_PREADV = 1, .HAVE_DECL_PWRITEV = 1, .HAVE_DECL_STRNLEN = 1, + .HAVE_DECL_STRSEP = null, + .HAVE_DECL_TIMINGSAFE_BCMP = null, + .HAVE_EDITLINE_HISTORY_H = null, + .HAVE_EDITLINE_READLINE_H = null, + .HAVE_ELF_AUX_INFO = null, .HAVE_EXECINFO_H = 1, .HAVE_FSEEKO = 1, .HAVE_GCC__ATOMIC_INT32_CAS = 1, @@ -461,30 +502,56 @@ const autoconf = .{ .HAVE_GCC__SYNC_INT32_CAS = 1, .HAVE_GCC__SYNC_INT32_TAS = 1, .HAVE_GCC__SYNC_INT64_CAS = 1, + .HAVE_GETAUXVAL = null, .HAVE_GETIFADDRS = 1, .HAVE_GETOPT = 1, .HAVE_GETOPT_H = 1, .HAVE_GETOPT_LONG = 1, + .HAVE_GETPEEREID = null, + .HAVE_GETPEERUCRED = null, + .HAVE_GSSAPI_EXT_H = null, + .HAVE_GSSAPI_GSSAPI_EXT_H = null, + .HAVE_GSSAPI_GSSAPI_H = null, + .HAVE_GSSAPI_H = null, + .HAVE_HISTORY_H = null, .HAVE_HISTORY_TRUNCATE_FILE = 1, + .HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P = null, .HAVE_IFADDRS_H = 1, .HAVE_INET_ATON = 1, .HAVE_INET_PTON = 1, - .HAVE_INTTYPES_H = 1, .HAVE_INT_OPTERR = 1, + .HAVE_INT_OPTRESET = null, .HAVE_INT_TIMEZONE = 1, - .HAVE_LANGINFO_H = 1, + .HAVE_INTTYPES_H = 1, + .HAVE_IO_URING_QUEUE_INIT_MEM = null, + .HAVE_KQUEUE = null, + .HAVE_LDAP_INITIALIZE = null, + .HAVE_LIBCURL = null, + .HAVE_LIBLDAP = null, + .HAVE_LIBLZ4 = null, .HAVE_LIBM = 1, + .HAVE_LIBNUMA = null, + .HAVE_LIBPAM = null, .HAVE_LIBREADLINE = 1, - .HAVE_LOCALE_T = 1, - .HAVE_LONG_INT_64 = 1, + .HAVE_LIBSELINUX = null, + .HAVE_LIBWLDAP32 = null, + .HAVE_LIBXML2 = null, + .HAVE_LIBXSLT = null, + .HAVE_LOCALECONV_L = null, + .HAVE_MBARRIER_H = null, + .HAVE_MBSTOWCS_L = null, .HAVE_MEMORY_H = 1, .HAVE_MKDTEMP = 1, + .HAVE_OSSP_UUID_H = null, + .HAVE_PAM_PAM_APPL_H = null, .HAVE_POSIX_FADVISE = 1, .HAVE_POSIX_FALLOCATE = 1, .HAVE_PPOLL = 1, .HAVE_PTHREAD = 1, .HAVE_PTHREAD_BARRIER_WAIT = 1, + .HAVE_PTHREAD_IS_THREADED_NP = null, .HAVE_PTHREAD_PRIO_INHERIT = 1, + .HAVE_READLINE_H = null, .HAVE_READLINE_HISTORY_H = 1, .HAVE_READLINE_READLINE_H = 1, .HAVE_RL_COMPLETION_MATCHES = 1, @@ -494,161 +561,100 @@ const autoconf = .{ .HAVE_RL_FILENAME_QUOTING_FUNCTION = 1, .HAVE_RL_RESET_SCREEN_SIZE = 1, .HAVE_RL_VARIABLE_BIND = 1, + .HAVE_SECURITY_PAM_APPL_H = null, + .HAVE_SETPROCTITLE = null, + .HAVE_SETPROCTITLE_FAST = null, .HAVE_SOCKLEN_T = 1, - .HAVE_SPINLOCKS = 1, - .HAVE_STDBOOL_H = 1, + .HAVE_SSL_CTX_SET_CIPHERSUITES = null, + .HAVE_SSL_CTX_SET_KEYLOG_CALLBACK = null, .HAVE_STDINT_H = 1, .HAVE_STDLIB_H = 1, + .HAVE_STRERROR_R = 1, .HAVE_STRING_H = 1, .HAVE_STRNLEN = 1, - .HAVE_STRERROR_R = 1, + .HAVE_STRSEP = null, .HAVE_STRSIGNAL = 1, .HAVE_STRUCT_OPTION = 1, + .HAVE_STRUCT_SOCKADDR_SA_LEN = null, .HAVE_STRUCT_TM_TM_ZONE = 1, - .HAVE_SYNCFS = 1, - .HAVE_SYSLOG = 1, .HAVE_SYS_EPOLL_H = 1, + .HAVE_SYS_EVENT_H = null, .HAVE_SYS_PERSONALITY_H = 1, .HAVE_SYS_PRCTL_H = 1, + .HAVE_SYS_PROCCTL_H = null, .HAVE_SYS_SIGNALFD_H = 1, .HAVE_SYS_STAT_H = 1, .HAVE_SYS_TYPES_H = 1, + .HAVE_SYSLOG = 1, .HAVE_TERMIOS_H = 1, + .HAVE_THREADSAFE_CURL_GLOBAL_INIT = null, + .HAVE_TIMINGSAFE_BCMP = null, .HAVE_TYPEOF = 1, + .HAVE_UCRED_H = null, + .HAVE_UNION_SEMUN = null, .HAVE_UNISTD_H = 1, .HAVE_USELOCALE = 1, + .HAVE_UUID_BSD = null, + .HAVE_UUID_E2FS = null, + .HAVE_UUID_H = null, + .HAVE_UUID_OSSP = null, + .HAVE_UUID_UUID_H = null, .HAVE_VISIBILITY_ATTRIBUTE = 1, - .HAVE__BOOL = 1, - .HAVE__BUILTIN_BSWAP16 = 1, - .HAVE__BUILTIN_BSWAP32 = 1, - .HAVE__BUILTIN_BSWAP64 = 1, - .HAVE__BUILTIN_CLZ = 1, - .HAVE__BUILTIN_CONSTANT_P = 1, - .HAVE__BUILTIN_CTZ = 1, - .HAVE__BUILTIN_FRAME_ADDRESS = 1, - .HAVE__BUILTIN_OP_OVERFLOW = 1, - .HAVE__BUILTIN_POPCOUNT = 1, - .HAVE__BUILTIN_TYPES_COMPATIBLE_P = 1, - .HAVE__BUILTIN_UNREACHABLE = 1, - .HAVE__STATIC_ASSERT = 1, + .HAVE_WCSTOMBS_L = null, + .HAVE_XSAVE_INTRINSICS = null, .MEMSET_LOOP_LIMIT = 1024, - .PG_INT128_TYPE = .__int128, - .PG_INT64_TYPE = .@"long int", - .PG_KRB_SRVNAM = "postgres", - .PG_PRINTF_ATTRIBUTE = .printf, - .INT64_MODIFIER = "l", - .PG_USE_STDBOOL = 1, - .PG_VERSION_NUM = version.major * 10000 + version.minor, - .RELSEG_SIZE = 131072, - .STDC_HEADERS = 1, - .USE_ICU = 1, - .USE_SLICING_BY_8_CRC32C = 1, - .USE_SYSV_SHARED_MEMORY = 1, - .USE_UNNAMED_POSIX_SEMAPHORES = 1, - .XLOG_BLCKSZ = 8192, - .pg_restrict = .__restrict, - .restrict = .__restrict, - .PACKAGE_BUGREPORT = "pgsql-bugs@lists.postgresql.org", .PACKAGE_NAME = "PostgreSQL", .PACKAGE_STRING = std.fmt.comptimePrint("PostgreSQL {}.{}", .{ version.major, version.minor }), .PACKAGE_TARNAME = "postgresql", .PACKAGE_URL = "https://www.postgresql.org/", .PACKAGE_VERSION = std.fmt.comptimePrint("{}.{}", .{ version.major, version.minor }), - + .PG_INT128_TYPE = .__int128, + .PG_KRB_SRVNAM = "postgres", + .PG_MAJORVERSION = std.fmt.comptimePrint("{}", .{version.major}), .PG_MAJORVERSION_NUM = version.major, .PG_MINORVERSION_NUM = version.minor, - .PG_MAJORVERSION = std.fmt.comptimePrint("{}", .{version.major}), + .PG_PRINTF_ATTRIBUTE = .printf, + .pg_restrict = .__restrict, .PG_VERSION = std.fmt.comptimePrint("{}.{}", .{ version.major, version.minor }), + .PG_VERSION_NUM = version.major * 10000 + version.minor, .PG_VERSION_STR = std.fmt.comptimePrint("PostgreSQL {}.{}", .{ version.major, version.minor }), - - .AC_APPLE_UNIVERSAL_BUILD = null, - .ALIGNOF_LONG_LONG_INT = null, - .ENABLE_GSS = null, - .ENABLE_NLS = null, - .HAVE_ATOMIC_H = null, - .HAVE_COPYFILE = null, - .HAVE_COPYFILE_H = null, - .HAVE_CRTDEFS_H = null, - .HAVE_CRYPTO_LOCK = null, - .HAVE_DECL_LLVMCREATEGDBREGISTRATIONLISTENER = null, - .HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER = null, - .HAVE_DECL_LLVMGETHOSTCPUFEATURES = null, - .HAVE_DECL_LLVMGETHOSTCPUNAME = null, - .HAVE_DECL_LLVMORCGETSYMBOLADDRESSIN = null, - .HAVE_EDITLINE_HISTORY_H = null, - .HAVE_EDITLINE_READLINE_H = null, - .HAVE_GETPEEREID = null, - .HAVE_GETPEERUCRED = null, - .HAVE_GSSAPI_EXT_H = null, - .HAVE_GSSAPI_GSSAPI_EXT_H = null, - .HAVE_GSSAPI_GSSAPI_H = null, - .HAVE_GSSAPI_H = null, - .HAVE_HISTORY_H = null, - .HAVE_INT64 = null, - .HAVE_INT8 = null, - .HAVE_INT_OPTRESET = null, - .HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P = null, - .HAVE_KQUEUE = null, - .HAVE_LDAP_INITIALIZE = null, - .HAVE_LIBLDAP = null, - .HAVE_LIBLZ4 = null, - .HAVE_LIBPAM = null, - .HAVE_LIBSELINUX = null, - .HAVE_LIBWLDAP32 = null, - .HAVE_LIBXML2 = null, - .HAVE_LIBXSLT = null, - .HAVE_LONG_LONG_INT_64 = null, - .HAVE_MBARRIER_H = null, - .HAVE_MBSTOWCS_L = null, - .HAVE_OSSP_UUID_H = null, - .HAVE_PAM_PAM_APPL_H = null, - .HAVE_PTHREAD_IS_THREADED_NP = null, - .HAVE_READLINE_H = null, - .HAVE_SECURITY_PAM_APPL_H = null, - .HAVE_SETPROCTITLE = null, - .HAVE_SETPROCTITLE_FAST = null, - .HAVE_STRUCT_SOCKADDR_SA_LEN = null, - .HAVE_SYS_EVENT_H = null, - .HAVE_SYS_PROCCTL_H = null, - .HAVE_UCRED_H = null, - .HAVE_UINT64 = null, - .HAVE_UINT8 = null, - .HAVE_UNION_SEMUN = null, - .HAVE_UUID_BSD = null, - .HAVE_UUID_E2FS = null, - .HAVE_UUID_H = null, - .HAVE_UUID_OSSP = null, - .HAVE_UUID_UUID_H = null, - .HAVE_WCSTOMBS_L = null, - .HAVE__CONFIGTHREADLOCALE = null, - .HAVE__CPUID = null, - .LOCALE_T_IN_XLOCALE = null, .PROFILE_PID_DIR = null, .PTHREAD_CREATE_JOINABLE = null, + .RELSEG_SIZE = 131072, + .restrict = .__restrict, + .STDC_HEADERS = 1, + .typeof = null, .USE_ARMV8_CRC32C = null, .USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK = null, .USE_ASSERT_CHECKING = null, + .USE_AVX512_CRC32C_WITH_RUNTIME_CHECK = null, + .USE_AVX512_POPCNT_WITH_RUNTIME_CHECK = null, .USE_BONJOUR = null, .USE_BSD_AUTH = null, + .USE_ICU = 1, + .USE_INJECTION_POINTS = null, .USE_LDAP = null, + .USE_LIBCURL = null, + .USE_LIBNUMA = null, + .USE_LIBURING = null, .USE_LIBXML = null, .USE_LIBXSLT = null, .USE_LLVM = null, + .USE_LOONGARCH_CRC32C = null, .USE_LZ4 = null, .USE_NAMED_POSIX_SEMAPHORES = null, .USE_PAM = null, + .USE_SLICING_BY_8_CRC32C = 1, .USE_SSE42_CRC32C = null, .USE_SSE42_CRC32C_WITH_RUNTIME_CHECK = null, + .USE_SVE_POPCNT_WITH_RUNTIME_CHECK = null, .USE_SYSTEMD = null, .USE_SYSV_SEMAPHORES = null, + .USE_SYSV_SHARED_MEMORY = 1, + .USE_UNNAMED_POSIX_SEMAPHORES = 1, .USE_WIN32_SEMAPHORES = null, .USE_WIN32_SHARED_MEMORY = null, - .WCSTOMBS_L_IN_XLOCALE = null, .WORDS_BIGENDIAN = null, - ._FILE_OFFSET_BITS = null, - ._LARGEFILE_SOURCE = null, - ._LARGE_FILES = null, - .@"inline" = null, - .typeof = null, + .XLOG_BLCKSZ = 8192, }; diff --git a/build.zig.zon b/build.zig.zon index e56763e..f9323fe 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,12 +1,12 @@ .{ .name = .libpq, - .version = "5.16.4", + .version = "5.18.1", .fingerprint = 0x9fa0f2ca693ac140, .minimum_zig_version = "0.14.0", .dependencies = .{ .upstream = .{ - .url = "git+https://github.com/postgres/postgres?ref=REL_16_4#2caa85f4aae689e6f6721d7363b4c66a2a6417d6", - .hash = "N-V-__8AAKeztweKsqUQCZESI7M-Rw2v-1IU1bTHR5SS-px6", + .url = "git+https://github.com/postgres/postgres?ref=REL_18_1#4b324845ba5d24682b9b3708a769f00d160afbd7", + .hash = "N-V-__8AAFtMXAi66ac6zMPeIBt5tVnTQSyckKgjCq_nZvZo", }, .openssl = .{ .url = "git+https://github.com/allyourcodebase/openssl?ref=main#7d4b2590b3b05fbc0e5cc20e2704a968e63503b1", @@ -19,8 +19,8 @@ .lazy = true, }, .zlib = .{ - .url = "git+https://github.com/allyourcodebase/zlib?ref=main#61e7df7e996ec5a5f13a653db3c419adb340d6ef", - .hash = "zlib-1.3.1-ZZQ7lbYMAAB1hTSOKSXAKAgHsfDcyWNH_37ojw5WSpgR", + .url = "git+https://github.com/allyourcodebase/zlib?ref=main#c2585c096171b8fbc8e5f78ab6c91b39e3573e15", + .hash = "zlib-1.3.1-ZZQ7lcMNAABPzkWdm_9y0tjlN17kF7czIiTVQ7h10rMR", .lazy = true, }, .zstd = .{ diff --git a/include/catalog/pg_tablespace_d.h b/include/catalog/pg_tablespace_d.h index 064e58d..7145363 100644 --- a/include/catalog/pg_tablespace_d.h +++ b/include/catalog/pg_tablespace_d.h @@ -3,7 +3,7 @@ * pg_tablespace_d.h * Macro definitions for pg_tablespace * - * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * NOTES @@ -18,6 +18,8 @@ #ifndef PG_TABLESPACE_D_H #define PG_TABLESPACE_D_H +/* Macros related to the structure of pg_tablespace */ + #define TableSpaceRelationId 1213 #define PgTablespaceToastTable 4185 #define PgTablespaceToastIndex 4186 @@ -32,6 +34,11 @@ #define Natts_pg_tablespace 5 +/* Definitions copied from pg_tablespace.h */ + + +/* OID symbols for objects defined in pg_tablespace.dat */ + #define DEFAULTTABLESPACE_OID 1663 #define GLOBALTABLESPACE_OID 1664 diff --git a/include/kwlist_d.h b/include/kwlist_d.h index e8af260..8f6b3c6 100644 --- a/include/kwlist_d.h +++ b/include/kwlist_d.h @@ -3,7 +3,7 @@ * kwlist_d.h * List of keywords represented as a ScanKeywordList. * - * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * NOTES @@ -90,6 +90,7 @@ static const char ScanKeywords_kw_string[] = "committed\0" "compression\0" "concurrently\0" + "conditional\0" "configuration\0" "conflict\0" "connection\0" @@ -144,11 +145,14 @@ static const char ScanKeywords_kw_string[] = "drop\0" "each\0" "else\0" + "empty\0" "enable\0" "encoding\0" "encrypted\0" "end\0" + "enforced\0" "enum\0" + "error\0" "escape\0" "event\0" "except\0" @@ -230,8 +234,15 @@ static const char ScanKeywords_kw_string[] = "json\0" "json_array\0" "json_arrayagg\0" + "json_exists\0" "json_object\0" "json_objectagg\0" + "json_query\0" + "json_scalar\0" + "json_serialize\0" + "json_table\0" + "json_value\0" + "keep\0" "key\0" "keys\0" "label\0" @@ -261,6 +272,7 @@ static const char ScanKeywords_kw_string[] = "materialized\0" "maxvalue\0" "merge\0" + "merge_action\0" "method\0" "minute\0" "minvalue\0" @@ -272,6 +284,7 @@ static const char ScanKeywords_kw_string[] = "national\0" "natural\0" "nchar\0" + "nested\0" "new\0" "next\0" "nfc\0" @@ -292,11 +305,13 @@ static const char ScanKeywords_kw_string[] = "nulls\0" "numeric\0" "object\0" + "objects\0" "of\0" "off\0" "offset\0" "oids\0" "old\0" + "omit\0" "on\0" "only\0" "operator\0" @@ -321,7 +336,10 @@ static const char ScanKeywords_kw_string[] = "partition\0" "passing\0" "password\0" + "path\0" + "period\0" "placing\0" + "plan\0" "plans\0" "policy\0" "position\0" @@ -339,11 +357,11 @@ static const char ScanKeywords_kw_string[] = "program\0" "publication\0" "quote\0" + "quotes\0" "range\0" "read\0" "real\0" "reassign\0" - "recheck\0" "recursive\0" "ref\0" "references\0" @@ -398,6 +416,7 @@ static const char ScanKeywords_kw_string[] = "smallint\0" "snapshot\0" "some\0" + "source\0" "sql\0" "stable\0" "standalone\0" @@ -409,6 +428,7 @@ static const char ScanKeywords_kw_string[] = "storage\0" "stored\0" "strict\0" + "string\0" "strip\0" "subscription\0" "substring\0" @@ -421,6 +441,7 @@ static const char ScanKeywords_kw_string[] = "tables\0" "tablesample\0" "tablespace\0" + "target\0" "temp\0" "template\0" "temporary\0" @@ -444,6 +465,7 @@ static const char ScanKeywords_kw_string[] = "uescape\0" "unbounded\0" "uncommitted\0" + "unconditional\0" "unencrypted\0" "union\0" "unique\0" @@ -467,6 +489,7 @@ static const char ScanKeywords_kw_string[] = "version\0" "view\0" "views\0" + "virtual\0" "volatile\0" "when\0" "where\0" @@ -564,534 +587,563 @@ static const uint16 ScanKeywords_kw_offsets[] = { 480, 492, 505, - 519, - 528, - 539, - 550, + 517, + 531, + 540, + 551, 562, - 570, - 579, - 590, - 595, - 600, + 574, + 582, + 591, + 602, 607, - 613, - 617, - 622, - 630, - 646, - 659, - 672, - 687, - 700, - 718, - 731, - 738, - 744, - 749, - 758, - 762, - 773, - 777, + 612, + 619, + 625, + 629, + 634, + 642, + 658, + 671, + 684, + 699, + 712, + 730, + 743, + 750, + 756, + 761, + 770, + 774, 785, - 793, - 801, - 810, - 821, - 830, - 838, - 845, - 855, - 866, - 874, - 880, - 885, + 789, + 797, + 805, + 813, + 822, + 833, + 842, + 850, + 857, + 867, + 878, + 886, 892, - 903, - 911, - 919, - 928, + 897, + 904, + 915, + 923, 931, 940, - 947, - 954, + 943, + 952, 959, - 964, - 969, + 966, + 971, 976, - 985, - 995, - 999, - 1004, - 1011, + 981, + 987, + 994, + 1003, + 1013, 1017, - 1024, - 1032, - 1042, - 1052, - 1060, - 1067, + 1026, + 1031, + 1037, + 1044, + 1050, + 1057, + 1065, 1075, - 1086, - 1096, - 1105, - 1113, + 1085, + 1093, + 1100, + 1108, 1119, - 1126, - 1132, - 1139, - 1148, - 1154, - 1160, - 1170, - 1174, - 1180, - 1188, - 1195, + 1129, + 1138, + 1146, + 1152, + 1159, + 1165, + 1172, + 1181, + 1187, + 1193, 1203, - 1210, - 1215, - 1220, - 1229, - 1239, - 1249, - 1256, + 1207, + 1213, + 1221, + 1228, + 1236, + 1243, + 1248, + 1253, 1262, - 1270, - 1279, - 1285, - 1294, - 1301, - 1309, - 1316, - 1323, - 1328, - 1333, + 1272, + 1282, + 1289, + 1295, + 1303, + 1312, + 1318, + 1327, + 1334, 1342, - 1345, - 1351, + 1349, + 1356, 1361, - 1371, - 1380, - 1387, - 1390, - 1398, - 1408, - 1418, - 1425, + 1366, + 1375, + 1378, + 1384, + 1394, + 1404, + 1413, + 1420, + 1423, 1431, - 1439, - 1447, - 1456, - 1466, - 1473, - 1479, - 1485, - 1491, - 1503, - 1510, + 1441, + 1451, + 1458, + 1464, + 1472, + 1480, + 1489, + 1499, + 1506, + 1512, 1518, - 1522, - 1530, - 1540, - 1549, - 1554, - 1562, - 1565, - 1572, + 1524, + 1536, + 1543, + 1551, + 1555, + 1563, + 1573, 1582, 1587, - 1592, - 1603, - 1617, - 1629, - 1644, - 1648, - 1653, - 1659, - 1668, + 1595, + 1598, + 1605, + 1615, + 1620, + 1625, + 1636, + 1650, + 1662, 1674, - 1679, - 1687, - 1695, - 1705, - 1711, - 1716, - 1722, + 1689, + 1700, + 1712, 1727, - 1733, - 1740, - 1745, - 1751, - 1761, - 1776, - 1785, - 1790, + 1738, + 1749, + 1754, + 1758, + 1763, + 1769, + 1778, + 1784, + 1789, 1797, - 1804, - 1812, - 1818, + 1805, + 1815, + 1821, 1826, - 1839, - 1848, - 1854, + 1832, + 1837, + 1843, + 1850, + 1855, 1861, - 1868, - 1877, - 1882, - 1888, - 1893, - 1898, - 1904, - 1913, - 1921, - 1927, - 1931, + 1871, + 1886, + 1895, + 1900, + 1907, + 1914, + 1922, + 1928, 1936, - 1940, - 1944, 1949, - 1954, - 1957, - 1962, - 1972, - 1983, - 1987, - 1995, - 2002, - 2010, - 2017, - 2022, - 2029, - 2035, - 2043, + 1958, + 1964, + 1977, + 1984, + 1991, + 2000, + 2005, + 2011, + 2016, + 2021, + 2027, + 2036, + 2044, 2050, - 2053, 2057, - 2064, - 2069, - 2073, - 2076, - 2081, - 2090, - 2097, - 2105, - 2108, - 2114, + 2061, + 2066, + 2070, + 2074, + 2079, + 2084, + 2087, + 2092, + 2102, + 2113, + 2117, 2125, 2132, - 2136, - 2142, + 2140, 2147, - 2156, - 2164, - 2175, - 2181, - 2187, - 2196, - 2206, - 2213, - 2221, - 2231, - 2239, + 2152, + 2159, + 2165, + 2173, + 2180, + 2188, + 2191, + 2195, + 2202, + 2207, + 2211, + 2216, + 2219, + 2224, + 2233, + 2240, 2248, - 2256, - 2262, - 2269, - 2278, - 2288, - 2298, - 2306, - 2315, + 2251, + 2257, + 2268, + 2275, + 2279, + 2285, + 2290, + 2299, + 2307, + 2318, 2324, - 2332, - 2338, + 2330, + 2339, 2349, - 2360, - 2370, - 2381, - 2389, - 2401, - 2407, - 2413, - 2418, - 2423, - 2432, - 2440, - 2450, - 2454, - 2465, - 2477, - 2485, - 2493, - 2502, - 2510, - 2517, - 2528, - 2536, - 2544, - 2550, - 2558, + 2356, + 2364, + 2374, + 2382, + 2391, + 2396, + 2403, + 2411, + 2416, + 2422, + 2429, + 2438, + 2448, + 2458, + 2466, + 2475, + 2484, + 2492, + 2498, + 2509, + 2520, + 2530, + 2541, + 2549, + 2561, 2567, 2574, - 2584, - 2592, + 2580, + 2585, + 2590, 2599, - 2605, - 2610, - 2619, - 2626, - 2634, - 2643, - 2647, + 2609, + 2613, + 2624, + 2636, + 2644, 2652, - 2657, - 2667, - 2674, - 2681, - 2689, - 2696, + 2661, + 2669, + 2676, + 2687, + 2695, 2703, - 2710, - 2719, + 2709, + 2717, 2726, - 2735, - 2745, + 2733, + 2743, + 2751, 2758, - 2765, - 2773, - 2786, - 2790, - 2796, - 2801, - 2807, - 2812, - 2820, - 2827, - 2832, - 2841, - 2850, + 2764, + 2769, + 2778, + 2785, + 2793, + 2802, + 2806, + 2811, + 2816, + 2826, + 2833, + 2840, + 2848, 2855, - 2859, - 2866, - 2877, - 2883, - 2893, + 2862, + 2869, + 2878, + 2885, + 2894, 2904, - 2910, 2917, - 2925, + 2924, 2932, - 2939, 2945, - 2958, - 2968, - 2976, + 2949, + 2955, + 2960, + 2966, + 2971, + 2979, 2986, - 2992, - 2999, - 3011, - 3017, - 3024, - 3036, - 3047, - 3052, - 3061, - 3071, + 2991, + 3000, + 3009, + 3014, + 3021, + 3025, + 3032, + 3043, + 3049, + 3059, + 3070, 3076, - 3081, - 3086, + 3083, 3091, - 3101, - 3104, - 3113, - 3125, - 3135, + 3098, + 3105, + 3112, + 3118, + 3131, 3141, 3149, - 3154, 3159, - 3168, - 3176, - 3181, - 3187, - 3195, - 3205, - 3217, - 3229, - 3235, - 3242, - 3250, - 3259, - 3268, - 3274, + 3165, + 3172, + 3184, + 3190, + 3197, + 3209, + 3220, + 3227, + 3232, + 3241, + 3251, + 3256, + 3261, + 3266, + 3271, 3281, - 3286, - 3292, - 3299, + 3284, + 3293, 3305, - 3314, - 3324, - 3330, - 3337, - 3345, - 3354, - 3362, - 3370, - 3378, - 3383, - 3389, - 3398, - 3403, - 3409, - 3420, - 3427, - 3432, - 3439, - 3447, - 3452, - 3460, - 3466, - 3470, - 3484, - 3494, - 3505, - 3515, - 3525, + 3315, + 3321, + 3329, + 3334, + 3339, + 3348, + 3356, + 3361, + 3367, + 3375, + 3385, + 3397, + 3411, + 3423, + 3429, + 3436, + 3444, + 3453, + 3462, + 3468, + 3475, + 3480, + 3486, + 3493, + 3499, + 3508, + 3518, + 3524, + 3531, 3539, 3548, - 3554, - 3562, - 3575, - 3584, - 3589, - 3593, + 3556, + 3564, + 3572, + 3577, + 3583, + 3591, + 3600, + 3605, + 3611, + 3622, + 3629, + 3634, + 3641, + 3649, + 3654, + 3662, + 3668, + 3672, + 3686, + 3696, + 3707, + 3717, + 3727, + 3741, + 3750, + 3756, + 3764, + 3777, + 3786, + 3791, + 3795, }; -#define SCANKEYWORDS_NUM_KEYWORDS 471 +#define SCANKEYWORDS_NUM_KEYWORDS 494 static int ScanKeywords_hash_func(const void *key, size_t keylen) { - static const int16 h[943] = { - 543, -186, 201, 0, 32767, 32767, 32767, 32767, - 221, -207, 32767, 0, 135, 283, 32767, 454, - 14, 79, 32767, 32767, 77, 32767, 102, 160, - 0, 32767, 151, 32767, 30, 392, -322, 452, - 32767, 0, 32767, 0, 0, 32767, 32767, 32767, - 234, 32767, 0, 32767, 0, 631, 32767, 368, - 80, 0, 0, -115, 32767, 285, 32767, 423, - 0, 32767, 155, 229, 32767, 126, 291, 165, - -22, 400, 327, 32767, 32767, 32767, 32767, -399, - 0, 406, 32767, 210, 1102, -203, 32767, 32767, - 32767, -944, 0, -188, 32767, 32767, 0, 347, - 32767, 0, 559, 316, 133, 32767, 202, 32767, - 305, 0, 32767, -94, 32767, 0, 32767, -222, - 32767, 138, 32767, -52, 32767, 32767, 279, 69, - -136, 0, 32767, 32767, 189, 32767, 32767, 88, - 0, 32767, 32767, 274, 32767, 514, 769, 248, - 32767, 32767, 32767, 32767, 32767, 32767, 0, 81, - 8, -29, 32767, 32767, 32767, -174, 258, 0, - 465, 211, 32767, 0, -229, 32767, -191, 32767, - 1263, 48, 32767, 343, 0, 58, 0, 32767, - 32767, 855, 0, 415, 0, -217, 32767, 1195, - 32767, 32767, 166, 32767, 42, 262, -736, 0, - 32767, 32767, 418, 178, 122, 32767, 46, 32767, - 32767, 32767, 229, 443, 32767, 32767, 250, 32767, - -300, 0, 32767, 1153, 32767, 108, 32767, -462, - 266, 32767, 478, -220, 235, 32767, 32767, -127, - 32767, 32767, 32767, 427, -231, 156, 32767, 0, - 0, 148, -218, 142, 73, 420, 32767, 32767, - 523, 32767, -36, 32767, 32767, 467, 844, -415, - 32767, 32767, -148, 179, 361, 32767, 151, 0, - 0, 32767, 145, 32767, 248, 110, 29, 125, - 282, 32767, -36, 43, 32767, 1125, 32767, 530, - 251, 519, 191, 0, 32767, -34, -502, 313, - 462, 845, 32767, 32767, -255, 412, 32767, 78, - 0, 32767, 444, 161, 0, 32767, 308, 32767, - -273, 400, 32767, 296, 32767, 32767, 72, 32767, - 32767, 34, 32767, 364, 151, -63, 4, 229, - 0, -276, 32767, 32767, 32767, 32767, -406, 32767, - 203, 32767, 140, 187, 160, 32767, 286, 0, - 32767, 32767, -88, 0, 100, -361, 32767, 9, - 0, -456, 32767, -37, -404, 32767, -969, 32767, - 371, 95, 0, 703, -31, 263, 373, -745, - 507, 14, 32767, -159, 0, 32767, 47, 299, - -126, 0, 32767, 83, 32767, 32767, 420, 236, - 32767, 32767, 0, 310, 89, 233, 32767, 93, - 32767, 0, 816, 60, 301, 211, 193, 0, - 452, -107, -403, -242, 353, 18, 32767, 32767, - 32767, 243, 104, 32767, 32767, 32767, -305, 32767, - -1048, 54, 0, 383, 32767, 32767, 32767, 226, - 319, 0, 32767, 32767, 32767, -130, 537, 32767, - 0, -206, 240, 696, 121, 32767, 180, 164, - 32767, 390, 185, 32767, 220, 545, 29, 32767, - 0, 32767, 32767, 1120, -163, 32767, 32767, 32767, - -368, 136, 445, 171, 233, 32767, 73, 32767, - 92, 32767, 0, 32767, 0, 208, 354, 32767, - 54, 32767, 32767, -246, -93, 389, 32767, 32767, - 32767, 32767, 50, 32767, 32767, 308, 32767, -278, - 0, 32767, 32767, -1172, 32767, 8, 32767, 0, - 32767, 341, 304, 242, -174, -92, 76, 419, - 32767, 87, 32767, -262, 32767, 32767, 32767, 109, - 200, 0, 32767, 0, 85, 530, 32767, -316, - 32767, 0, -286, 32767, 193, 268, 32767, 32767, - 278, 32767, 32767, 155, 445, 95, -310, 32767, - 207, -56, 32767, 32767, 0, -127, 232, -283, - 103, 32767, 1, 0, 32767, 32767, -485, 350, - 79, -56, -354, 32767, 121, 24, 81, 20, - 325, 40, 248, 32767, 32767, 32767, 358, 32767, - -56, 32767, 0, 174, -28, -301, -92, 32767, - 114, 295, 32767, 363, -355, 32767, 290, 0, - 32767, 32767, 32767, 122, 55, -142, 32767, 50, - 32767, 32767, 152, 571, 1397, 0, 472, -448, - 185, 140, 228, 435, 0, 32767, 32767, 414, - 32767, 379, 92, 185, 23, 299, 32767, 32767, - 0, 32767, 32767, 32767, 306, 439, -198, 219, - 340, 32767, 416, 0, -123, 377, 32767, 32767, - 0, 32767, 670, -670, 339, 32767, 32767, 32767, - 0, -256, 70, 514, 331, 0, 302, 469, - 0, 370, 32767, 32767, 42, 255, 212, 0, - 322, 277, 32767, -163, 32767, 216, 32767, 32767, - 0, 32767, 190, 32767, 32767, 0, 32767, 0, - -409, 1366, 32767, 32767, 32767, 193, 32767, 325, - 32767, 0, 142, 466, 32767, 32767, 32767, 113, - 32767, 32767, 62, 0, -62, 113, -90, 34, - -256, 32767, 32767, -936, 32767, 32767, 32767, 0, - -64, 0, -34, 451, 290, 108, 32767, 276, - 842, 0, 556, -153, 32767, 412, -168, 32767, - 32767, 1331, 407, 234, -60, 115, 457, -73, - 502, 772, 32767, 33, 404, -925, 32767, 32767, - 421, -123, 32767, 32767, 32767, 0, 0, 32767, - 32767, 32767, 429, 0, 3, 769, -81, 306, - 64, 32767, 192, 96, 0, 63, 44, 32767, - 32767, 32767, 32767, 0, 284, 32767, 575, 32767, - 32767, 12, 32767, 516, 116, 32767, 32767, 150, - 442, 134, 32767, 198, -45, 249, 40, 373, - 32767, 0, 32767, 32767, 0, 0, 352, 32767, - 117, 32767, 426, 0, 0, 32767, 32767, 32767, - 32767, -92, 32767, -442, 32767, 269, 32767, 32767, - 32767, 429, 32767, 0, 32767, 0, 143, 32767, - 508, -66, 32767, 280, 32767, 39, 162, 32767, - 32767, 0, 32767, 31, 32767, 32767, 32767, 0, - 32767, 257, -90, -249, 224, 272, 32767, 32767, - 313, -467, 214, 0, -85, 32767, 48, 0, - 32767, -336, 202, 0, 447, 90, 264, 32767, - 32767, 0, 101, 32767, 32767, 32767, 0, 32767, - 32767, 227, -1093, 32767, 0, 32767, 27, 174, - 32767, 7, 32767, -621, 146, 32767, 32767, 32767, - 854, 0, 32767, 161, 0, 137, 32767, 32767, - 32767, 32767, 0, 391, 219, 276, 32767, 168, - 32767, 32767, 0, 32767, 32767, 32767, 1, -4, - 32767, 0, 293, 0, 374, 256, 0, 0, - 32767, 355, 212, 404, 0, 186, 32767, 0, - 359, 32767, 32767, 172, 32767, 32767, -131, 0, - 402, 0, 56, 32767, 462, 389, 82, 0, - 32767, 0, 32767, 0, 32767, 32767, 32767, 32767, - 106, 425, -160, 31, 32767, 55, 0, 0, - 32767, 32767, 430, 1224, 179, -179, 0, 397, - 32767, 0, 0, 0, -60, 47, 32767, 396, - 32767, 326, 383, 369, 32767, 368, 32767 + static const int16 h[989] = { + 80, 32767, 734, 447, 183, 170, 93, 32767, + 0, 173, 53, 224, -72, -78, 0, 578, + 163, 32767, 32767, 0, 32767, 0, 49, 0, + 32767, 0, 32767, 32767, 214, 32767, -103, 32767, + 32767, -109, 0, 63, -233, 32767, -234, 146, + 32767, 32767, 344, 32767, 32767, 0, 40, 8, + 0, 321, 32767, 262, 527, 32767, -45, -38, + 98, 217, -343, 264, 32767, 184, 32767, 643, + 32767, 182, 32767, 32767, 32767, 32767, 32767, 326, + 0, 0, 0, 300, 477, 32767, 371, 32767, + 110, 275, 149, 32767, 32767, 116, 32767, 439, + 183, 32767, -150, 130, 289, 32767, 392, 32767, + 261, 471, 281, 335, 411, 32767, 32767, -372, + 32767, 0, 0, 32767, 32767, 0, 121, 435, + -329, 32767, 9, 37, 34, 32767, 32767, 32767, + 32767, 32767, 187, 32767, 0, 32767, 182, 401, + 53, 32767, 48, 32767, 32767, 0, 540, 527, + 137, 32767, 289, 151, 31, 32767, 32767, -145, + 429, 0, 288, -340, 32767, 301, 0, 32767, + 32767, 0, 32767, 32767, 32767, 469, -139, 454, + 32767, 32767, 226, -466, 32767, 32767, 0, 412, + 326, 32767, 250, -73, 0, 282, 294, -348, + 32767, -385, 446, 32767, 0, 862, 32767, -392, + 79, 168, 32767, 343, 0, 156, 32767, -47, + -6, 32767, 32767, 324, 32767, 0, 0, 393, + 32767, 449, 354, 357, 37, 90, 207, 32767, + 46, 32767, 32767, 505, 127, 221, 167, 32767, + 28, 32767, 0, 119, 282, 32767, 32767, 0, + 32767, 297, 437, 32767, 609, 0, 286, 32767, + 32767, 100, 371, 32767, 32767, -674, 484, 734, + 32767, 334, 335, 32767, -214, 0, 85, 252, + 32767, 84, 32767, 8, 160, 428, 186, 0, + 32767, 462, 23, 121, 32767, 32767, 0, 220, + 32767, 259, 32767, 32767, 32767, -169, 435, 32767, + -631, 32767, 32767, -223, 32767, 185, 32767, -300, + 432, 493, 32767, 32767, 191, 356, 110, 101, + 32767, 522, 32767, 32767, 0, 240, 561, 469, + 0, 229, 248, 751, 32767, 32767, 32767, 0, + 32767, 32767, 32767, 401, 32767, 32767, 270, 32767, + 32767, 470, 337, 0, -351, 0, 245, 18, + 24, 32767, -125, 0, 32767, 114, 0, 146, + 32767, 333, 467, 0, -65, 193, 32767, 180, + 0, -196, 229, 32767, 324, 387, 32767, 418, + 100, 32767, 32767, 0, 32767, 32767, 30, -359, + 32767, 107, 164, 32767, 457, 32767, 265, 32767, + -116, 5, -47, 32767, -223, 413, 355, 32767, + 237, 0, 0, -210, 32767, 698, 264, 283, + 36, 0, 32767, 133, 504, -8, 32767, 0, + 176, 32767, 0, 32767, 32767, 0, 198, 32767, + -413, 225, 32767, -91, 32767, 205, 0, 482, + 445, 32767, 0, 391, -76, 32767, 32767, 515, + 312, 32767, 0, 306, 32767, -239, 32767, 69, + 402, 0, 300, 32767, 32767, 4, 32767, -204, + 319, 440, 32767, 68, 32767, 83, 203, 25, + 32767, 32767, 32767, 32767, 236, 110, 215, 123, + 32767, 288, 142, -131, 247, 32767, 32767, 32767, + 32767, 10, 32767, 454, 49, 230, 43, 0, + 271, 32767, 450, 337, 32767, 222, 86, 479, + 32767, 32767, 44, -59, 0, -300, 32767, -306, + 32767, 32767, 153, -188, 0, 32767, 32767, 242, + 681, 32767, 32767, -158, 32767, 436, 284, 117, + 238, 0, 32767, 0, 32767, -314, 0, 32767, + 32767, 116, -475, 32767, 482, 32767, 20, 32767, + -671, 32767, 471, 359, 0, -419, 216, 32767, + 92, 541, -15, 32767, 459, 460, -104, 32767, + 442, 354, 0, 227, -341, 411, 312, 32767, + -163, -19, 0, 571, 32767, 32767, 32767, 207, + 236, 402, 0, 32767, 9, 414, 32767, 272, + 88, 168, 32767, 32767, -128, 32767, 32767, 32767, + 460, -289, 32767, 32767, 0, 32767, 183, -104, + 32767, 32767, 32767, 179, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 304, 226, 0, 81, + 32767, 141, 32767, -96, -6, 230, 39, 395, + -237, 32767, 0, -70, -122, 349, 107, 276, + 0, 770, 270, 159, 32767, 101, 86, 118, + -407, 32767, 427, 5, 234, 254, 32767, 0, + 218, 32767, 0, 32767, 32767, 32767, 150, 78, + 32767, -53, 32767, 128, 32767, 405, -223, 32767, + 370, -31, 32767, 216, 2, 45, 32767, 32767, + 32767, 379, 98, 360, 240, 32767, 212, 260, + 32767, -316, 391, 32767, -54, 0, 7, 0, + 363, 0, 438, 0, 206, 0, 317, 32767, + -290, 32767, 167, 32767, 159, 419, 32767, 421, + 204, 0, 251, 32767, 32767, 32767, 485, 0, + 32767, -41, 341, 464, 376, -27, 313, 0, + 32767, 198, 32767, -129, 439, 491, 32767, 32767, + 0, -178, 0, 32767, -339, 226, 32767, 543, + 32767, 311, 0, 0, -120, 0, 0, 0, + -245, 32767, 0, 32767, -121, 32767, -148, 32767, + 423, 239, 32767, 32767, 217, 189, 32767, 0, + 0, -202, 0, 32767, 0, 284, 0, 32767, + 79, 175, -41, 61, 244, 0, 0, 32767, + 32767, 32767, 32767, 0, 32767, 550, 160, 145, + 32767, 32767, 470, 32767, 172, -282, 89, 32767, + 32767, -98, 0, 32767, 0, 0, 188, 100, + 386, 32767, 32767, 32767, 472, 32767, 300, 32767, + 32767, 0, 32767, -235, 32767, -170, 32767, 0, + 0, 0, 0, 32767, 141, -71, 0, 0, + 32767, 32767, 0, 32767, 32767, 489, 474, 0, + 177, 0, -255, 184, 266, 32767, 0, 32767, + 32767, 32767, 32767, 356, 338, 237, 32767, 0, + 32767, 89, 388, 0, 0, 32767, 255, 41, + 32767, -14, 287, 32767, -163, 244, -355, -161, + -1, 406, 506, 0, 475, 119, 305, 32767, + 360, 0, 280, 32767, 32767, 32767, -108, 249, + 374, 32767, 32767, 0, 123, 0, 32767, 32767, + 420, 316, 0, 32767, 32767, -549, 0, 136, + 21, 32767, 133, 32767, 0, 32767, 0, -9, + -483, 110, 32767, 74, 0, 32767, 32767, 32767, + 32767, 0, 0, 32767, 103, 32767, 32767, 315, + 0, -390, 0, 32767, 32767, 150, 0, -58, + 32767, -270, 76, 0, 79, 275, 0, 0, + -100, 0, 0, 785, 0, 243, 0, 32767, + 32767, -223, 595, 217, -108, 0, 231, 0, + -342, 32767, 32767, 32767, -24, 32767, 32767, 32767, + 147, 0, 32767, 135, 0, 32767, 300, 32767, + -3, 32767, 0, 32767, 32767, 88, 0, 32767, + 407, 60, -186, 169, 32767, 0, 0, 234, + 179, 290, 0, 32767, 32767, 295, 330, -2, + 32767, -22, 32767, 32767, 0, 96, 157, 0, + 0, 0, 314, 473, 32767, 32767, 0, 32767, + 32767, 410, 426, 328, 32767, 32767, 213, 32767, + 0, 32767, 166, 298, 32767, 0, 0, 32767, + 19, 32767, 81, 0, 32767 }; const unsigned char *k = (const unsigned char *) key; @@ -1103,9 +1155,9 @@ ScanKeywords_hash_func(const void *key, size_t keylen) unsigned char c = *k++ | 0x20; a = a * 257 + c; - b = b * 31 + c; + b = b * 17 + c; } - return h[a % 943] + h[b % 943]; + return h[a % 989] + h[b % 989]; } const ScanKeywordList ScanKeywords = { diff --git a/include/utils/errcodes.h b/include/utils/errcodes.h index a2f604c..01ed270 100644 --- a/include/utils/errcodes.h +++ b/include/utils/errcodes.h @@ -54,6 +54,9 @@ #define ERRCODE_DIAGNOSTICS_EXCEPTION MAKE_SQLSTATE('0','Z','0','0','0') #define ERRCODE_STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER MAKE_SQLSTATE('0','Z','0','0','2') +/* Class 10 - XQuery Error */ +#define ERRCODE_INVALID_ARGUMENT_FOR_XQUERY MAKE_SQLSTATE('1','0','6','0','8') + /* Class 20 - Case Not Found */ #define ERRCODE_CASE_NOT_FOUND MAKE_SQLSTATE('2','0','0','0','0') @@ -157,6 +160,7 @@ #define ERRCODE_NO_ACTIVE_SQL_TRANSACTION MAKE_SQLSTATE('2','5','P','0','1') #define ERRCODE_IN_FAILED_SQL_TRANSACTION MAKE_SQLSTATE('2','5','P','0','2') #define ERRCODE_IDLE_IN_TRANSACTION_SESSION_TIMEOUT MAKE_SQLSTATE('2','5','P','0','3') +#define ERRCODE_TRANSACTION_TIMEOUT MAKE_SQLSTATE('2','5','P','0','4') /* Class 26 - Invalid SQL Statement Name */ #define ERRCODE_INVALID_SQL_STATEMENT_NAME MAKE_SQLSTATE('2','6','0','0','0') @@ -304,9 +308,7 @@ #define ERRCODE_IO_ERROR MAKE_SQLSTATE('5','8','0','3','0') #define ERRCODE_UNDEFINED_FILE MAKE_SQLSTATE('5','8','P','0','1') #define ERRCODE_DUPLICATE_FILE MAKE_SQLSTATE('5','8','P','0','2') - -/* Class 72 - Snapshot Failure */ -#define ERRCODE_SNAPSHOT_TOO_OLD MAKE_SQLSTATE('7','2','0','0','0') +#define ERRCODE_FILE_NAME_TOO_LONG MAKE_SQLSTATE('5','8','P','0','3') /* Class F0 - Configuration File Error */ #define ERRCODE_CONFIG_FILE_ERROR MAKE_SQLSTATE('F','0','0','0','0')