diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/access/transam/xlog.c | 9 | ||||
-rw-r--r-- | src/backend/nodes/tidbitmap.c | 1 | ||||
-rw-r--r-- | src/backend/replication/logical/proto.c | 14 | ||||
-rw-r--r-- | src/backend/replication/logical/reorderbuffer.c | 14 | ||||
-rw-r--r-- | src/backend/replication/pgoutput/pgoutput.c | 2 | ||||
-rw-r--r-- | src/backend/utils/activity/pgstat_relation.c | 2 | ||||
-rw-r--r-- | src/backend/utils/adt/network_spgist.c | 1 | ||||
-rw-r--r-- | src/backend/utils/adt/pg_locale_builtin.c | 20 | ||||
-rw-r--r-- | src/backend/utils/adt/pg_locale_icu.c | 18 | ||||
-rw-r--r-- | src/backend/utils/adt/pg_locale_libc.c | 70 | ||||
-rw-r--r-- | src/bin/pgbench/pgbench.c | 6 | ||||
-rw-r--r-- | src/include/access/amapi.h | 2 | ||||
-rw-r--r-- | src/include/access/genam.h | 4 | ||||
-rw-r--r-- | src/include/access/nbtree.h | 1 | ||||
-rw-r--r-- | src/include/c.h | 13 | ||||
-rw-r--r-- | src/include/nodes/tidbitmap.h | 1 | ||||
-rw-r--r-- | src/include/replication/reorderbuffer.h | 2 | ||||
-rw-r--r-- | src/include/utils/elog.h | 16 | ||||
-rw-r--r-- | src/include/utils/pg_locale.h | 2 | ||||
-rw-r--r-- | src/pl/plpython/plpy_exec.c | 2 | ||||
-rw-r--r-- | src/pl/plpython/plpy_typeio.c | 134 | ||||
-rw-r--r-- | src/pl/plpython/plpy_typeio.h | 4 |
22 files changed, 173 insertions, 165 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 109713315c0..eceab341255 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -3134,6 +3134,10 @@ XLogNeedsFlush(XLogRecPtr record) */ if (!XLogInsertAllowed()) { + /* Quick exit if already known to be updated or cannot be updated */ + if (!updateMinRecoveryPoint || record <= LocalMinRecoveryPoint) + return false; + /* * An invalid minRecoveryPoint means that we need to recover all the * WAL, i.e., we're doing crash recovery. We never modify the control @@ -3143,11 +3147,10 @@ XLogNeedsFlush(XLogRecPtr record) * it has not replayed all WAL available when doing crash recovery. */ if (XLogRecPtrIsInvalid(LocalMinRecoveryPoint) && InRecovery) + { updateMinRecoveryPoint = false; - - /* Quick exit if already known to be updated or cannot be updated */ - if (record <= LocalMinRecoveryPoint || !updateMinRecoveryPoint) return false; + } /* * Update local copy of minRecoveryPoint. But if the lock is busy, diff --git a/src/backend/nodes/tidbitmap.c b/src/backend/nodes/tidbitmap.c index 41031aa8f2f..fac2ba5d0ca 100644 --- a/src/backend/nodes/tidbitmap.c +++ b/src/backend/nodes/tidbitmap.c @@ -40,6 +40,7 @@ #include <limits.h> +#include "access/htup_details.h" #include "common/hashfn.h" #include "common/int.h" #include "nodes/bitmapset.h" diff --git a/src/backend/replication/logical/proto.c b/src/backend/replication/logical/proto.c index 1b3d9eb49dd..2436a263dc2 100644 --- a/src/backend/replication/logical/proto.c +++ b/src/backend/replication/logical/proto.c @@ -52,7 +52,7 @@ logicalrep_write_begin(StringInfo out, ReorderBufferTXN *txn) /* fixed fields */ pq_sendint64(out, txn->final_lsn); - pq_sendint64(out, txn->xact_time.commit_time); + pq_sendint64(out, txn->commit_time); pq_sendint32(out, txn->xid); } @@ -88,7 +88,7 @@ logicalrep_write_commit(StringInfo out, ReorderBufferTXN *txn, /* send fields */ pq_sendint64(out, commit_lsn); pq_sendint64(out, txn->end_lsn); - pq_sendint64(out, txn->xact_time.commit_time); + pq_sendint64(out, txn->commit_time); } /* @@ -120,7 +120,7 @@ logicalrep_write_begin_prepare(StringInfo out, ReorderBufferTXN *txn) /* fixed fields */ pq_sendint64(out, txn->final_lsn); pq_sendint64(out, txn->end_lsn); - pq_sendint64(out, txn->xact_time.prepare_time); + pq_sendint64(out, txn->prepare_time); pq_sendint32(out, txn->xid); /* send gid */ @@ -173,7 +173,7 @@ logicalrep_write_prepare_common(StringInfo out, LogicalRepMsgType type, /* send fields */ pq_sendint64(out, prepare_lsn); pq_sendint64(out, txn->end_lsn); - pq_sendint64(out, txn->xact_time.prepare_time); + pq_sendint64(out, txn->prepare_time); pq_sendint32(out, txn->xid); /* send gid */ @@ -253,7 +253,7 @@ logicalrep_write_commit_prepared(StringInfo out, ReorderBufferTXN *txn, /* send fields */ pq_sendint64(out, commit_lsn); pq_sendint64(out, txn->end_lsn); - pq_sendint64(out, txn->xact_time.commit_time); + pq_sendint64(out, txn->commit_time); pq_sendint32(out, txn->xid); /* send gid */ @@ -311,7 +311,7 @@ logicalrep_write_rollback_prepared(StringInfo out, ReorderBufferTXN *txn, pq_sendint64(out, prepare_end_lsn); pq_sendint64(out, txn->end_lsn); pq_sendint64(out, prepare_time); - pq_sendint64(out, txn->xact_time.commit_time); + pq_sendint64(out, txn->commit_time); pq_sendint32(out, txn->xid); /* send gid */ @@ -1119,7 +1119,7 @@ logicalrep_write_stream_commit(StringInfo out, ReorderBufferTXN *txn, /* send fields */ pq_sendint64(out, commit_lsn); pq_sendint64(out, txn->end_lsn); - pq_sendint64(out, txn->xact_time.commit_time); + pq_sendint64(out, txn->commit_time); } /* diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index 4736f993c37..a5e165fb123 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -2830,7 +2830,7 @@ ReorderBufferReplay(ReorderBufferTXN *txn, txn->final_lsn = commit_lsn; txn->end_lsn = end_lsn; - txn->xact_time.commit_time = commit_time; + txn->commit_time = commit_time; txn->origin_id = origin_id; txn->origin_lsn = origin_lsn; @@ -2922,7 +2922,7 @@ ReorderBufferRememberPrepareInfo(ReorderBuffer *rb, TransactionId xid, */ txn->final_lsn = prepare_lsn; txn->end_lsn = end_lsn; - txn->xact_time.prepare_time = prepare_time; + txn->prepare_time = prepare_time; txn->origin_id = origin_id; txn->origin_lsn = origin_lsn; @@ -2979,7 +2979,7 @@ ReorderBufferPrepare(ReorderBuffer *rb, TransactionId xid, txn->gid = pstrdup(gid); ReorderBufferReplay(txn, rb, xid, txn->final_lsn, txn->end_lsn, - txn->xact_time.prepare_time, txn->origin_id, txn->origin_lsn); + txn->prepare_time, txn->origin_id, txn->origin_lsn); /* * Send a prepare if not already done so. This might occur if we have @@ -3018,7 +3018,7 @@ ReorderBufferFinishPrepared(ReorderBuffer *rb, TransactionId xid, * be later used for rollback. */ prepare_end_lsn = txn->end_lsn; - prepare_time = txn->xact_time.prepare_time; + prepare_time = txn->prepare_time; /* add the gid in the txn */ txn->gid = pstrdup(gid); @@ -3050,12 +3050,12 @@ ReorderBufferFinishPrepared(ReorderBuffer *rb, TransactionId xid, * prepared after the restart. */ ReorderBufferReplay(txn, rb, xid, txn->final_lsn, txn->end_lsn, - txn->xact_time.prepare_time, txn->origin_id, txn->origin_lsn); + txn->prepare_time, txn->origin_id, txn->origin_lsn); } txn->final_lsn = commit_lsn; txn->end_lsn = end_lsn; - txn->xact_time.commit_time = commit_time; + txn->commit_time = commit_time; txn->origin_id = origin_id; txn->origin_lsn = origin_lsn; @@ -3095,7 +3095,7 @@ ReorderBufferAbort(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn, if (txn == NULL) return; - txn->xact_time.abort_time = abort_time; + txn->abort_time = abort_time; /* For streamed transactions notify the remote node about the abort. */ if (rbtxn_is_streamed(txn)) diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c index 80540c017bd..92eb17049c3 100644 --- a/src/backend/replication/pgoutput/pgoutput.c +++ b/src/backend/replication/pgoutput/pgoutput.c @@ -1888,7 +1888,7 @@ pgoutput_stream_abort(struct LogicalDecodingContext *ctx, OutputPluginPrepareWrite(ctx, true); logicalrep_write_stream_abort(ctx->out, toptxn->xid, txn->xid, abort_lsn, - txn->xact_time.abort_time, write_abort_info); + txn->abort_time, write_abort_info); OutputPluginWrite(ctx, true); diff --git a/src/backend/utils/activity/pgstat_relation.c b/src/backend/utils/activity/pgstat_relation.c index 69df741cbf6..b5e3903a290 100644 --- a/src/backend/utils/activity/pgstat_relation.c +++ b/src/backend/utils/activity/pgstat_relation.c @@ -3,7 +3,7 @@ * pgstat_relation.c * Implementation of relation statistics. * - * This file contains the implementation of function relation. It is kept + * This file contains the implementation of relation statistics. It is kept * separate from pgstat.c to enforce the line between the statistics access / * storage implementation and the details about individual types of * statistics. diff --git a/src/backend/utils/adt/network_spgist.c b/src/backend/utils/adt/network_spgist.c index 602276a35c3..a84747d9275 100644 --- a/src/backend/utils/adt/network_spgist.c +++ b/src/backend/utils/adt/network_spgist.c @@ -37,6 +37,7 @@ #include "catalog/pg_type.h" #include "utils/fmgrprotos.h" #include "utils/inet.h" +#include "varatt.h" static int inet_spg_node_number(const inet *val, int commonbits); diff --git a/src/backend/utils/adt/pg_locale_builtin.c b/src/backend/utils/adt/pg_locale_builtin.c index 0c9fbdb40f2..526ab3c6711 100644 --- a/src/backend/utils/adt/pg_locale_builtin.c +++ b/src/backend/utils/adt/pg_locale_builtin.c @@ -72,7 +72,7 @@ strlower_builtin(char *dest, size_t destsize, const char *src, ssize_t srclen, pg_locale_t locale) { return unicode_strlower(dest, destsize, src, srclen, - locale->info.builtin.casemap_full); + locale->builtin.casemap_full); } static size_t @@ -83,13 +83,13 @@ strtitle_builtin(char *dest, size_t destsize, const char *src, ssize_t srclen, .str = src, .len = srclen, .offset = 0, - .posix = !locale->info.builtin.casemap_full, + .posix = !locale->builtin.casemap_full, .init = false, .prev_alnum = false, }; return unicode_strtitle(dest, destsize, src, srclen, - locale->info.builtin.casemap_full, + locale->builtin.casemap_full, initcap_wbnext, &wbstate); } @@ -98,7 +98,7 @@ strupper_builtin(char *dest, size_t destsize, const char *src, ssize_t srclen, pg_locale_t locale) { return unicode_strupper(dest, destsize, src, srclen, - locale->info.builtin.casemap_full); + locale->builtin.casemap_full); } static size_t @@ -106,13 +106,13 @@ strfold_builtin(char *dest, size_t destsize, const char *src, ssize_t srclen, pg_locale_t locale) { return unicode_strfold(dest, destsize, src, srclen, - locale->info.builtin.casemap_full); + locale->builtin.casemap_full); } static bool wc_isdigit_builtin(pg_wchar wc, pg_locale_t locale) { - return pg_u_isdigit(wc, !locale->info.builtin.casemap_full); + return pg_u_isdigit(wc, !locale->builtin.casemap_full); } static bool @@ -124,7 +124,7 @@ wc_isalpha_builtin(pg_wchar wc, pg_locale_t locale) static bool wc_isalnum_builtin(pg_wchar wc, pg_locale_t locale) { - return pg_u_isalnum(wc, !locale->info.builtin.casemap_full); + return pg_u_isalnum(wc, !locale->builtin.casemap_full); } static bool @@ -154,7 +154,7 @@ wc_isprint_builtin(pg_wchar wc, pg_locale_t locale) static bool wc_ispunct_builtin(pg_wchar wc, pg_locale_t locale) { - return pg_u_ispunct(wc, !locale->info.builtin.casemap_full); + return pg_u_ispunct(wc, !locale->builtin.casemap_full); } static bool @@ -238,8 +238,8 @@ create_pg_locale_builtin(Oid collid, MemoryContext context) result = MemoryContextAllocZero(context, sizeof(struct pg_locale_struct)); - result->info.builtin.locale = MemoryContextStrdup(context, locstr); - result->info.builtin.casemap_full = (strcmp(locstr, "PG_UNICODE_FAST") == 0); + result->builtin.locale = MemoryContextStrdup(context, locstr); + result->builtin.casemap_full = (strcmp(locstr, "PG_UNICODE_FAST") == 0); result->deterministic = true; result->collate_is_c = true; result->ctype_is_c = (strcmp(locstr, "C") == 0); diff --git a/src/backend/utils/adt/pg_locale_icu.c b/src/backend/utils/adt/pg_locale_icu.c index 96741e08269..9f0b4eead73 100644 --- a/src/backend/utils/adt/pg_locale_icu.c +++ b/src/backend/utils/adt/pg_locale_icu.c @@ -290,8 +290,8 @@ create_pg_locale_icu(Oid collid, MemoryContext context) collator = make_icu_collator(iculocstr, icurules); result = MemoryContextAllocZero(context, sizeof(struct pg_locale_struct)); - result->info.icu.locale = MemoryContextStrdup(context, iculocstr); - result->info.icu.ucol = collator; + result->icu.locale = MemoryContextStrdup(context, iculocstr); + result->icu.ucol = collator; result->deterministic = deterministic; result->collate_is_c = false; result->ctype_is_c = false; @@ -571,7 +571,7 @@ strncoll_icu_utf8(const char *arg1, ssize_t len1, const char *arg2, ssize_t len2 Assert(GetDatabaseEncoding() == PG_UTF8); status = U_ZERO_ERROR; - result = ucol_strcollUTF8(locale->info.icu.ucol, + result = ucol_strcollUTF8(locale->icu.ucol, arg1, len1, arg2, len2, &status); @@ -608,7 +608,7 @@ strnxfrm_icu(char *dest, size_t destsize, const char *src, ssize_t srclen, ulen = uchar_convert(icu_converter, uchar, ulen + 1, src, srclen); - result_bsize = ucol_getSortKey(locale->info.icu.ucol, + result_bsize = ucol_getSortKey(locale->icu.ucol, uchar, ulen, (uint8_t *) dest, destsize); @@ -644,7 +644,7 @@ strnxfrm_prefix_icu_utf8(char *dest, size_t destsize, uiter_setUTF8(&iter, src, srclen); state[0] = state[1] = 0; /* won't need that again */ status = U_ZERO_ERROR; - result = ucol_nextSortKeyPart(locale->info.icu.ucol, + result = ucol_nextSortKeyPart(locale->icu.ucol, &iter, state, (uint8_t *) dest, @@ -755,7 +755,7 @@ icu_convert_case(ICU_Convert_Func func, pg_locale_t mylocale, *buff_dest = palloc(len_dest * sizeof(**buff_dest)); status = U_ZERO_ERROR; len_dest = func(*buff_dest, len_dest, buff_source, len_source, - mylocale->info.icu.locale, &status); + mylocale->icu.locale, &status); if (status == U_BUFFER_OVERFLOW_ERROR) { /* try again with adjusted length */ @@ -763,7 +763,7 @@ icu_convert_case(ICU_Convert_Func func, pg_locale_t mylocale, *buff_dest = palloc(len_dest * sizeof(**buff_dest)); status = U_ZERO_ERROR; len_dest = func(*buff_dest, len_dest, buff_source, len_source, - mylocale->info.icu.locale, &status); + mylocale->icu.locale, &status); } if (U_FAILURE(status)) ereport(ERROR, @@ -859,7 +859,7 @@ strncoll_icu(const char *arg1, ssize_t len1, ulen1 = uchar_convert(icu_converter, uchar1, ulen1 + 1, arg1, len1); ulen2 = uchar_convert(icu_converter, uchar2, ulen2 + 1, arg2, len2); - result = ucol_strcoll(locale->info.icu.ucol, + result = ucol_strcoll(locale->icu.ucol, uchar1, ulen1, uchar2, ulen2); @@ -904,7 +904,7 @@ strnxfrm_prefix_icu(char *dest, size_t destsize, uiter_setString(&iter, uchar, ulen); state[0] = state[1] = 0; /* won't need that again */ status = U_ZERO_ERROR; - result_bsize = ucol_nextSortKeyPart(locale->info.icu.ucol, + result_bsize = ucol_nextSortKeyPart(locale->icu.ucol, &iter, state, (uint8_t *) dest, diff --git a/src/backend/utils/adt/pg_locale_libc.c b/src/backend/utils/adt/pg_locale_libc.c index 8d88b53c375..f56b5dbdd37 100644 --- a/src/backend/utils/adt/pg_locale_libc.c +++ b/src/backend/utils/adt/pg_locale_libc.c @@ -121,116 +121,116 @@ static size_t strupper_libc_mb(char *dest, size_t destsize, static bool wc_isdigit_libc_sb(pg_wchar wc, pg_locale_t locale) { - return isdigit_l((unsigned char) wc, locale->info.lt); + return isdigit_l((unsigned char) wc, locale->lt); } static bool wc_isalpha_libc_sb(pg_wchar wc, pg_locale_t locale) { - return isalpha_l((unsigned char) wc, locale->info.lt); + return isalpha_l((unsigned char) wc, locale->lt); } static bool wc_isalnum_libc_sb(pg_wchar wc, pg_locale_t locale) { - return isalnum_l((unsigned char) wc, locale->info.lt); + return isalnum_l((unsigned char) wc, locale->lt); } static bool wc_isupper_libc_sb(pg_wchar wc, pg_locale_t locale) { - return isupper_l((unsigned char) wc, locale->info.lt); + return isupper_l((unsigned char) wc, locale->lt); } static bool wc_islower_libc_sb(pg_wchar wc, pg_locale_t locale) { - return islower_l((unsigned char) wc, locale->info.lt); + return islower_l((unsigned char) wc, locale->lt); } static bool wc_isgraph_libc_sb(pg_wchar wc, pg_locale_t locale) { - return isgraph_l((unsigned char) wc, locale->info.lt); + return isgraph_l((unsigned char) wc, locale->lt); } static bool wc_isprint_libc_sb(pg_wchar wc, pg_locale_t locale) { - return isprint_l((unsigned char) wc, locale->info.lt); + return isprint_l((unsigned char) wc, locale->lt); } static bool wc_ispunct_libc_sb(pg_wchar wc, pg_locale_t locale) { - return ispunct_l((unsigned char) wc, locale->info.lt); + return ispunct_l((unsigned char) wc, locale->lt); } static bool wc_isspace_libc_sb(pg_wchar wc, pg_locale_t locale) { - return isspace_l((unsigned char) wc, locale->info.lt); + return isspace_l((unsigned char) wc, locale->lt); } static bool wc_isdigit_libc_mb(pg_wchar wc, pg_locale_t locale) { - return iswdigit_l((wint_t) wc, locale->info.lt); + return iswdigit_l((wint_t) wc, locale->lt); } static bool wc_isalpha_libc_mb(pg_wchar wc, pg_locale_t locale) { - return iswalpha_l((wint_t) wc, locale->info.lt); + return iswalpha_l((wint_t) wc, locale->lt); } static bool wc_isalnum_libc_mb(pg_wchar wc, pg_locale_t locale) { - return iswalnum_l((wint_t) wc, locale->info.lt); + return iswalnum_l((wint_t) wc, locale->lt); } static bool wc_isupper_libc_mb(pg_wchar wc, pg_locale_t locale) { - return iswupper_l((wint_t) wc, locale->info.lt); + return iswupper_l((wint_t) wc, locale->lt); } static bool wc_islower_libc_mb(pg_wchar wc, pg_locale_t locale) { - return iswlower_l((wint_t) wc, locale->info.lt); + return iswlower_l((wint_t) wc, locale->lt); } static bool wc_isgraph_libc_mb(pg_wchar wc, pg_locale_t locale) { - return iswgraph_l((wint_t) wc, locale->info.lt); + return iswgraph_l((wint_t) wc, locale->lt); } static bool wc_isprint_libc_mb(pg_wchar wc, pg_locale_t locale) { - return iswprint_l((wint_t) wc, locale->info.lt); + return iswprint_l((wint_t) wc, locale->lt); } static bool wc_ispunct_libc_mb(pg_wchar wc, pg_locale_t locale) { - return iswpunct_l((wint_t) wc, locale->info.lt); + return iswpunct_l((wint_t) wc, locale->lt); } static bool wc_isspace_libc_mb(pg_wchar wc, pg_locale_t locale) { - return iswspace_l((wint_t) wc, locale->info.lt); + return iswspace_l((wint_t) wc, locale->lt); } static char char_tolower_libc(unsigned char ch, pg_locale_t locale) { Assert(pg_database_encoding_max_length() == 1); - return tolower_l(ch, locale->info.lt); + return tolower_l(ch, locale->lt); } static bool @@ -241,7 +241,7 @@ char_is_cased_libc(char ch, pg_locale_t locale) if (is_multibyte && IS_HIGHBIT_SET(ch)) return true; else - return isalpha_l((unsigned char) ch, locale->info.lt); + return isalpha_l((unsigned char) ch, locale->lt); } static pg_wchar @@ -253,7 +253,7 @@ toupper_libc_sb(pg_wchar wc, pg_locale_t locale) if (locale->is_default && wc <= (pg_wchar) 127) return pg_ascii_toupper((unsigned char) wc); if (wc <= (pg_wchar) UCHAR_MAX) - return toupper_l((unsigned char) wc, locale->info.lt); + return toupper_l((unsigned char) wc, locale->lt); else return wc; } @@ -267,7 +267,7 @@ toupper_libc_mb(pg_wchar wc, pg_locale_t locale) if (locale->is_default && wc <= (pg_wchar) 127) return pg_ascii_toupper((unsigned char) wc); if (sizeof(wchar_t) >= 4 || wc <= (pg_wchar) 0xFFFF) - return towupper_l((wint_t) wc, locale->info.lt); + return towupper_l((wint_t) wc, locale->lt); else return wc; } @@ -281,7 +281,7 @@ tolower_libc_sb(pg_wchar wc, pg_locale_t locale) if (locale->is_default && wc <= (pg_wchar) 127) return pg_ascii_tolower((unsigned char) wc); if (wc <= (pg_wchar) UCHAR_MAX) - return tolower_l((unsigned char) wc, locale->info.lt); + return tolower_l((unsigned char) wc, locale->lt); else return wc; } @@ -295,7 +295,7 @@ tolower_libc_mb(pg_wchar wc, pg_locale_t locale) if (locale->is_default && wc <= (pg_wchar) 127) return pg_ascii_tolower((unsigned char) wc); if (sizeof(wchar_t) >= 4 || wc <= (pg_wchar) 0xFFFF) - return towlower_l((wint_t) wc, locale->info.lt); + return towlower_l((wint_t) wc, locale->lt); else return wc; } @@ -406,7 +406,7 @@ strlower_libc_sb(char *dest, size_t destsize, const char *src, ssize_t srclen, if (srclen + 1 <= destsize) { - locale_t loc = locale->info.lt; + locale_t loc = locale->lt; char *p; if (srclen + 1 > destsize) @@ -438,7 +438,7 @@ static size_t strlower_libc_mb(char *dest, size_t destsize, const char *src, ssize_t srclen, pg_locale_t locale) { - locale_t loc = locale->info.lt; + locale_t loc = locale->lt; size_t result_size; wchar_t *workspace; char *result; @@ -491,7 +491,7 @@ strtitle_libc_sb(char *dest, size_t destsize, const char *src, ssize_t srclen, if (srclen + 1 <= destsize) { - locale_t loc = locale->info.lt; + locale_t loc = locale->lt; int wasalnum = false; char *p; @@ -532,7 +532,7 @@ static size_t strtitle_libc_mb(char *dest, size_t destsize, const char *src, ssize_t srclen, pg_locale_t locale) { - locale_t loc = locale->info.lt; + locale_t loc = locale->lt; int wasalnum = false; size_t result_size; wchar_t *workspace; @@ -592,7 +592,7 @@ strupper_libc_sb(char *dest, size_t destsize, const char *src, ssize_t srclen, if (srclen + 1 <= destsize) { - locale_t loc = locale->info.lt; + locale_t loc = locale->lt; char *p; memcpy(dest, src, srclen); @@ -621,7 +621,7 @@ static size_t strupper_libc_mb(char *dest, size_t destsize, const char *src, ssize_t srclen, pg_locale_t locale) { - locale_t loc = locale->info.lt; + locale_t loc = locale->lt; size_t result_size; wchar_t *workspace; char *result; @@ -718,7 +718,7 @@ create_pg_locale_libc(Oid collid, MemoryContext context) (strcmp(collate, "POSIX") == 0); result->ctype_is_c = (strcmp(ctype, "C") == 0) || (strcmp(ctype, "POSIX") == 0); - result->info.lt = loc; + result->lt = loc; if (!result->collate_is_c) { #ifdef WIN32 @@ -862,7 +862,7 @@ strncoll_libc(const char *arg1, ssize_t len1, const char *arg2, ssize_t len2, arg2n = buf2; } - result = strcoll_l(arg1n, arg2n, locale->info.lt); + result = strcoll_l(arg1n, arg2n, locale->lt); if (buf != sbuf) pfree(buf); @@ -887,7 +887,7 @@ strnxfrm_libc(char *dest, size_t destsize, const char *src, ssize_t srclen, size_t result; if (srclen == -1) - return strxfrm_l(dest, src, destsize, locale->info.lt); + return strxfrm_l(dest, src, destsize, locale->lt); if (bufsize > TEXTBUFLEN) buf = palloc(bufsize); @@ -896,7 +896,7 @@ strnxfrm_libc(char *dest, size_t destsize, const char *src, ssize_t srclen, memcpy(buf, src, srclen); buf[srclen] = '\0'; - result = strxfrm_l(dest, buf, destsize, locale->info.lt); + result = strxfrm_l(dest, buf, destsize, locale->lt); if (buf != sbuf) pfree(buf); @@ -1038,7 +1038,7 @@ strncoll_libc_win32_utf8(const char *arg1, ssize_t len1, const char *arg2, ((LPWSTR) a2p)[r] = 0; errno = 0; - result = wcscoll_l((LPWSTR) a1p, (LPWSTR) a2p, locale->info.lt); + result = wcscoll_l((LPWSTR) a1p, (LPWSTR) a2p, locale->lt); if (result == 2147483647) /* _NLSCMPERROR; missing from mingw headers */ ereport(ERROR, (errmsg("could not compare Unicode strings: %m"))); diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index cc03af05447..36c6469149e 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -3356,7 +3356,7 @@ readCommandResponse(CState *st, MetaCommand meta, char *varprefix) st->num_syncs--; if (st->num_syncs == 0 && PQexitPipelineMode(st->con) != 1) pg_log_error("client %d failed to exit pipeline mode: %s", st->id, - PQerrorMessage(st->con)); + PQresultErrorMessage(res)); break; case PGRES_NONFATAL_ERROR: @@ -3366,7 +3366,7 @@ readCommandResponse(CState *st, MetaCommand meta, char *varprefix) if (canRetryError(st->estatus)) { if (verbose_errors) - commandError(st, PQerrorMessage(st->con)); + commandError(st, PQresultErrorMessage(res)); goto error; } /* fall through */ @@ -3375,7 +3375,7 @@ readCommandResponse(CState *st, MetaCommand meta, char *varprefix) /* anything else is unexpected */ pg_log_error("client %d script %d aborted in command %d query %d: %s", st->id, st->use_file, st->command, qrynum, - PQerrorMessage(st->con)); + PQresultErrorMessage(res)); goto error; } diff --git a/src/include/access/amapi.h b/src/include/access/amapi.h index 2b4482dc1e6..63dd41c1f21 100644 --- a/src/include/access/amapi.h +++ b/src/include/access/amapi.h @@ -15,6 +15,8 @@ #include "access/cmptype.h" #include "access/genam.h" #include "access/stratnum.h" +#include "nodes/nodes.h" +#include "nodes/pg_list.h" /* * We don't wish to include planner header files here, since most of an index diff --git a/src/include/access/genam.h b/src/include/access/genam.h index ac62f6a6abd..9200a22bd9f 100644 --- a/src/include/access/genam.h +++ b/src/include/access/genam.h @@ -20,13 +20,15 @@ #include "nodes/tidbitmap.h" #include "storage/buf.h" #include "storage/lockdefs.h" -#include "utils/relcache.h" #include "utils/snapshot.h" /* We don't want this file to depend on execnodes.h. */ typedef struct IndexInfo IndexInfo; typedef struct TupleTableSlot TupleTableSlot; +/* or relcache.h */ +typedef struct RelationData *Relation; + /* * Struct for statistics maintained by amgettuple and amgetbitmap diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h index 9ab467cb8fd..db1345f54c8 100644 --- a/src/include/access/nbtree.h +++ b/src/include/access/nbtree.h @@ -22,6 +22,7 @@ #include "catalog/pg_index.h" #include "lib/stringinfo.h" #include "storage/bufmgr.h" +#include "storage/dsm.h" #include "storage/shm_toc.h" #include "utils/skipsupport.h" diff --git a/src/include/c.h b/src/include/c.h index 7fe083c3afb..9ab5e617995 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -336,14 +336,13 @@ * compile-time integer const. We don't define this macro to return 0 when * unsupported due to the risk of users of the macro misbehaving if we return * 0 when the expression *is* an integer constant. Callers may check if this - * macro is defined by checking if HAVE_PG_BUILTIN_INTEGER_CONSTANT_P is - * defined. + * macro is defined by checking if HAVE_PG_INTEGER_CONSTANT_P is defined. */ #if defined(HAVE__BUILTIN_CONSTANT_P) -/* When __builtin_const_p() is available, use it. */ -#define pg_builtin_integer_constant_p(x) __builtin_constant_p(x) -#define HAVE_PG_BUILTIN_INTEGER_CONSTANT_P +/* When __builtin_constant_p() is available, use it. */ +#define pg_integer_constant_p(x) __builtin_constant_p(x) +#define HAVE_PG_INTEGER_CONSTANT_P #elif defined(_MSC_VER) && defined(__STDC_VERSION__) /* @@ -353,9 +352,9 @@ * and only works with integer constants. Compilation will fail if given a * constant or variable of any type other than an integer. */ -#define pg_builtin_integer_constant_p(x) \ +#define pg_integer_constant_p(x) \ _Generic((1 ? ((void *) ((x) * (uintptr_t) 0)) : &(int) {1}), int *: 1, void *: 0) -#define HAVE_PG_BUILTIN_INTEGER_CONSTANT_P +#define HAVE_PG_INTEGER_CONSTANT_P #endif /* diff --git a/src/include/nodes/tidbitmap.h b/src/include/nodes/tidbitmap.h index 99f795ceab5..f54e61c7190 100644 --- a/src/include/nodes/tidbitmap.h +++ b/src/include/nodes/tidbitmap.h @@ -22,7 +22,6 @@ #ifndef TIDBITMAP_H #define TIDBITMAP_H -#include "access/htup_details.h" #include "storage/itemptr.h" #include "utils/dsa.h" diff --git a/src/include/replication/reorderbuffer.h b/src/include/replication/reorderbuffer.h index fa0745552f8..91dc7e5e448 100644 --- a/src/include/replication/reorderbuffer.h +++ b/src/include/replication/reorderbuffer.h @@ -359,7 +359,7 @@ typedef struct ReorderBufferTXN TimestampTz commit_time; TimestampTz prepare_time; TimestampTz abort_time; - } xact_time; + }; /* * The base snapshot is used to decode all changes until either this diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h index b4945eb7ee0..348dafbf906 100644 --- a/src/include/utils/elog.h +++ b/src/include/utils/elog.h @@ -119,11 +119,11 @@ struct Node; * ereport_domain() directly, or preferably they can override the TEXTDOMAIN * macro. * - * When pg_builtin_integer_constant_p is available and elevel >= ERROR we make + * When pg_integer_constant_p is available and elevel >= ERROR we make * a call to errstart_cold() instead of errstart(). This version of the * function is marked with pg_attribute_cold which will coax supporting * compilers into generating code which is more optimized towards non-ERROR - * cases. Because we use pg_builtin_integer_constant_p() in the condition, + * cases. Because we use pg_integer_constant_p() in the condition, * when elevel is not a compile-time constant, or if it is, but it's < ERROR, * the compiler has no need to generate any code for this branch. It can * simply call errstart() unconditionally. @@ -131,25 +131,25 @@ struct Node; * If elevel >= ERROR, the call will not return; we try to inform the compiler * of that via pg_unreachable(). However, no useful optimization effect is * obtained unless the compiler sees elevel as a compile-time constant, else - * we're just adding code bloat. So, if pg_builtin_integer_constant_p is + * we're just adding code bloat. So, if pg_integer_constant_p is * available, use that to cause the second if() to vanish completely for * non-constant cases. We avoid using a local variable because it's not * necessary and prevents gcc from making the unreachability deduction at * optlevel -O0. *---------- */ -#ifdef HAVE_PG_BUILTIN_INTEGER_CONSTANT_P +#ifdef HAVE_PG_INTEGER_CONSTANT_P #define ereport_domain(elevel, domain, ...) \ do { \ pg_prevent_errno_in_scope(); \ - if (pg_builtin_integer_constant_p(elevel) && (elevel) >= ERROR ? \ + if (pg_integer_constant_p(elevel) && (elevel) >= ERROR ? \ errstart_cold(elevel, domain) : \ errstart(elevel, domain)) \ __VA_ARGS__, errfinish(__FILE__, __LINE__, __func__); \ - if (pg_builtin_integer_constant_p(elevel) && (elevel) >= ERROR) \ + if (pg_integer_constant_p(elevel) && (elevel) >= ERROR) \ pg_unreachable(); \ } while(0) -#else /* !HAVE_PG_BUILTIN_INTEGER_CONSTANT_P */ +#else /* !HAVE_PG_INTEGER_CONSTANT_P */ #define ereport_domain(elevel, domain, ...) \ do { \ const int elevel_ = (elevel); \ @@ -159,7 +159,7 @@ struct Node; if (elevel_ >= ERROR) \ pg_unreachable(); \ } while(0) -#endif /* HAVE_PG_BUILTIN_INTEGER_CONSTANT_P */ +#endif /* HAVE_PG_INTEGER_CONSTANT_P */ #define ereport(elevel, ...) \ ereport_domain(elevel, TEXTDOMAIN, __VA_ARGS__) diff --git a/src/include/utils/pg_locale.h b/src/include/utils/pg_locale.h index 2b072cafb4d..7e83594fbaf 100644 --- a/src/include/utils/pg_locale.h +++ b/src/include/utils/pg_locale.h @@ -171,7 +171,7 @@ struct pg_locale_struct UCollator *ucol; } icu; #endif - } info; + }; }; extern void init_database_collation(void); diff --git a/src/pl/plpython/plpy_exec.c b/src/pl/plpython/plpy_exec.c index fd06b9e0e4e..0117f1e77ef 100644 --- a/src/pl/plpython/plpy_exec.c +++ b/src/pl/plpython/plpy_exec.c @@ -1046,7 +1046,7 @@ PLy_modify_tuple(PLyProcedure *proc, PyObject *pltd, TriggerData *tdata, Py_INCREF(plval); /* We assume proc->result is set up to convert tuples properly */ - att = &proc->result.u.tuple.atts[attn - 1]; + att = &proc->result.tuple.atts[attn - 1]; modvalues[attn - 1] = PLy_output_convert(att, plval, diff --git a/src/pl/plpython/plpy_typeio.c b/src/pl/plpython/plpy_typeio.c index f6509a41902..bba78fb7592 100644 --- a/src/pl/plpython/plpy_typeio.c +++ b/src/pl/plpython/plpy_typeio.c @@ -171,15 +171,15 @@ PLy_input_setup_tuple(PLyDatumToOb *arg, TupleDesc desc, PLyProcedure *proc) /* Save pointer to tupdesc, but only if this is an anonymous record type */ if (arg->typoid == RECORDOID && arg->typmod < 0) - arg->u.tuple.recdesc = desc; + arg->tuple.recdesc = desc; /* (Re)allocate atts array as needed */ - if (arg->u.tuple.natts != desc->natts) + if (arg->tuple.natts != desc->natts) { - if (arg->u.tuple.atts) - pfree(arg->u.tuple.atts); - arg->u.tuple.natts = desc->natts; - arg->u.tuple.atts = (PLyDatumToOb *) + if (arg->tuple.atts) + pfree(arg->tuple.atts); + arg->tuple.natts = desc->natts; + arg->tuple.atts = (PLyDatumToOb *) MemoryContextAllocZero(arg->mcxt, desc->natts * sizeof(PLyDatumToOb)); } @@ -188,7 +188,7 @@ PLy_input_setup_tuple(PLyDatumToOb *arg, TupleDesc desc, PLyProcedure *proc) for (i = 0; i < desc->natts; i++) { Form_pg_attribute attr = TupleDescAttr(desc, i); - PLyDatumToOb *att = &arg->u.tuple.atts[i]; + PLyDatumToOb *att = &arg->tuple.atts[i]; if (attr->attisdropped) continue; @@ -221,15 +221,15 @@ PLy_output_setup_tuple(PLyObToDatum *arg, TupleDesc desc, PLyProcedure *proc) /* Save pointer to tupdesc, but only if this is an anonymous record type */ if (arg->typoid == RECORDOID && arg->typmod < 0) - arg->u.tuple.recdesc = desc; + arg->tuple.recdesc = desc; /* (Re)allocate atts array as needed */ - if (arg->u.tuple.natts != desc->natts) + if (arg->tuple.natts != desc->natts) { - if (arg->u.tuple.atts) - pfree(arg->u.tuple.atts); - arg->u.tuple.natts = desc->natts; - arg->u.tuple.atts = (PLyObToDatum *) + if (arg->tuple.atts) + pfree(arg->tuple.atts); + arg->tuple.natts = desc->natts; + arg->tuple.atts = (PLyObToDatum *) MemoryContextAllocZero(arg->mcxt, desc->natts * sizeof(PLyObToDatum)); } @@ -238,7 +238,7 @@ PLy_output_setup_tuple(PLyObToDatum *arg, TupleDesc desc, PLyProcedure *proc) for (i = 0; i < desc->natts; i++) { Form_pg_attribute attr = TupleDescAttr(desc, i); - PLyObToDatum *att = &arg->u.tuple.atts[i]; + PLyObToDatum *att = &arg->tuple.atts[i]; if (attr->attisdropped) continue; @@ -277,9 +277,9 @@ PLy_output_setup_record(PLyObToDatum *arg, TupleDesc desc, PLyProcedure *proc) * for the record type. */ arg->typmod = desc->tdtypmod; - if (arg->u.tuple.recdesc && - arg->u.tuple.recdesc->tdtypmod != arg->typmod) - arg->u.tuple.recdesc = NULL; + if (arg->tuple.recdesc && + arg->tuple.recdesc->tdtypmod != arg->typmod) + arg->tuple.recdesc = NULL; /* Update derived data if necessary */ PLy_output_setup_tuple(arg, desc, proc); @@ -343,11 +343,11 @@ PLy_output_setup_func(PLyObToDatum *arg, MemoryContext arg_mcxt, { /* Domain */ arg->func = PLyObject_ToDomain; - arg->u.domain.domain_info = NULL; + arg->domain.domain_info = NULL; /* Recursively set up conversion info for the element type */ - arg->u.domain.base = (PLyObToDatum *) + arg->domain.base = (PLyObToDatum *) MemoryContextAllocZero(arg_mcxt, sizeof(PLyObToDatum)); - PLy_output_setup_func(arg->u.domain.base, arg_mcxt, + PLy_output_setup_func(arg->domain.base, arg_mcxt, typentry->domainBaseType, typentry->domainBaseTypmod, proc); @@ -359,11 +359,11 @@ PLy_output_setup_func(PLyObToDatum *arg, MemoryContext arg_mcxt, arg->func = PLySequence_ToArray; /* Get base type OID to insert into constructed array */ /* (note this might not be the same as the immediate child type) */ - arg->u.array.elmbasetype = getBaseType(typentry->typelem); + arg->array.elmbasetype = getBaseType(typentry->typelem); /* Recursively set up conversion info for the element type */ - arg->u.array.elm = (PLyObToDatum *) + arg->array.elm = (PLyObToDatum *) MemoryContextAllocZero(arg_mcxt, sizeof(PLyObToDatum)); - PLy_output_setup_func(arg->u.array.elm, arg_mcxt, + PLy_output_setup_func(arg->array.elm, arg_mcxt, typentry->typelem, typmod, proc); } @@ -372,20 +372,20 @@ PLy_output_setup_func(PLyObToDatum *arg, MemoryContext arg_mcxt, proc->trftypes))) { arg->func = PLyObject_ToTransform; - fmgr_info_cxt(trfuncid, &arg->u.transform.typtransform, arg_mcxt); + fmgr_info_cxt(trfuncid, &arg->transform.typtransform, arg_mcxt); } else if (typtype == TYPTYPE_COMPOSITE) { /* Named composite type, or RECORD */ arg->func = PLyObject_ToComposite; /* We'll set up the per-field data later */ - arg->u.tuple.recdesc = NULL; - arg->u.tuple.typentry = typentry; - arg->u.tuple.tupdescid = INVALID_TUPLEDESC_IDENTIFIER; - arg->u.tuple.atts = NULL; - arg->u.tuple.natts = 0; + arg->tuple.recdesc = NULL; + arg->tuple.typentry = typentry; + arg->tuple.tupdescid = INVALID_TUPLEDESC_IDENTIFIER; + arg->tuple.atts = NULL; + arg->tuple.natts = 0; /* Mark this invalid till needed, too */ - arg->u.tuple.recinfunc.fn_oid = InvalidOid; + arg->tuple.recinfunc.fn_oid = InvalidOid; } else { @@ -400,8 +400,8 @@ PLy_output_setup_func(PLyObToDatum *arg, MemoryContext arg_mcxt, break; default: arg->func = PLyObject_ToScalar; - getTypeInputInfo(typeOid, &typinput, &arg->u.scalar.typioparam); - fmgr_info_cxt(typinput, &arg->u.scalar.typfunc, arg_mcxt); + getTypeInputInfo(typeOid, &typinput, &arg->scalar.typioparam); + fmgr_info_cxt(typinput, &arg->scalar.typfunc, arg_mcxt); break; } } @@ -476,9 +476,9 @@ PLy_input_setup_func(PLyDatumToOb *arg, MemoryContext arg_mcxt, /* Standard array */ arg->func = PLyList_FromArray; /* Recursively set up conversion info for the element type */ - arg->u.array.elm = (PLyDatumToOb *) + arg->array.elm = (PLyDatumToOb *) MemoryContextAllocZero(arg_mcxt, sizeof(PLyDatumToOb)); - PLy_input_setup_func(arg->u.array.elm, arg_mcxt, + PLy_input_setup_func(arg->array.elm, arg_mcxt, typentry->typelem, typmod, proc); } @@ -487,18 +487,18 @@ PLy_input_setup_func(PLyDatumToOb *arg, MemoryContext arg_mcxt, proc->trftypes))) { arg->func = PLyObject_FromTransform; - fmgr_info_cxt(trfuncid, &arg->u.transform.typtransform, arg_mcxt); + fmgr_info_cxt(trfuncid, &arg->transform.typtransform, arg_mcxt); } else if (typtype == TYPTYPE_COMPOSITE) { /* Named composite type, or RECORD */ arg->func = PLyDict_FromComposite; /* We'll set up the per-field data later */ - arg->u.tuple.recdesc = NULL; - arg->u.tuple.typentry = typentry; - arg->u.tuple.tupdescid = INVALID_TUPLEDESC_IDENTIFIER; - arg->u.tuple.atts = NULL; - arg->u.tuple.natts = 0; + arg->tuple.recdesc = NULL; + arg->tuple.typentry = typentry; + arg->tuple.tupdescid = INVALID_TUPLEDESC_IDENTIFIER; + arg->tuple.atts = NULL; + arg->tuple.natts = 0; } else { @@ -535,7 +535,7 @@ PLy_input_setup_func(PLyDatumToOb *arg, MemoryContext arg_mcxt, default: arg->func = PLyUnicode_FromScalar; getTypeOutputInfo(typeOid, &typoutput, &typisvarlena); - fmgr_info_cxt(typoutput, &arg->u.scalar.typfunc, arg_mcxt); + fmgr_info_cxt(typoutput, &arg->scalar.typfunc, arg_mcxt); break; } } @@ -641,7 +641,7 @@ PLyBytes_FromBytea(PLyDatumToOb *arg, Datum d) static PyObject * PLyUnicode_FromScalar(PLyDatumToOb *arg, Datum d) { - char *x = OutputFunctionCall(&arg->u.scalar.typfunc, d); + char *x = OutputFunctionCall(&arg->scalar.typfunc, d); PyObject *r = PLyUnicode_FromString(x); pfree(x); @@ -656,7 +656,7 @@ PLyObject_FromTransform(PLyDatumToOb *arg, Datum d) { Datum t; - t = FunctionCall1(&arg->u.transform.typtransform, d); + t = FunctionCall1(&arg->transform.typtransform, d); return (PyObject *) DatumGetPointer(t); } @@ -667,7 +667,7 @@ static PyObject * PLyList_FromArray(PLyDatumToOb *arg, Datum d) { ArrayType *array = DatumGetArrayTypeP(d); - PLyDatumToOb *elm = arg->u.array.elm; + PLyDatumToOb *elm = arg->array.elm; int ndim; int *dims; char *dataptr; @@ -817,7 +817,7 @@ PLyDict_FromTuple(PLyDatumToOb *arg, HeapTuple tuple, TupleDesc desc, bool inclu PyObject *volatile dict; /* Simple sanity check that desc matches */ - Assert(desc->natts == arg->u.tuple.natts); + Assert(desc->natts == arg->tuple.natts); dict = PyDict_New(); if (dict == NULL) @@ -827,9 +827,9 @@ PLyDict_FromTuple(PLyDatumToOb *arg, HeapTuple tuple, TupleDesc desc, bool inclu { int i; - for (i = 0; i < arg->u.tuple.natts; i++) + for (i = 0; i < arg->tuple.natts; i++) { - PLyDatumToOb *att = &arg->u.tuple.atts[i]; + PLyDatumToOb *att = &arg->tuple.atts[i]; Form_pg_attribute attr = TupleDescAttr(desc, i); char *key; Datum vattr; @@ -971,22 +971,22 @@ PLyObject_ToComposite(PLyObToDatum *arg, PyObject *plrv, { desc = lookup_rowtype_tupdesc(arg->typoid, arg->typmod); /* We should have the descriptor of the type's typcache entry */ - Assert(desc == arg->u.tuple.typentry->tupDesc); + Assert(desc == arg->tuple.typentry->tupDesc); /* Detect change of descriptor, update cache if needed */ - if (arg->u.tuple.tupdescid != arg->u.tuple.typentry->tupDesc_identifier) + if (arg->tuple.tupdescid != arg->tuple.typentry->tupDesc_identifier) { PLy_output_setup_tuple(arg, desc, PLy_current_execution_context()->curr_proc); - arg->u.tuple.tupdescid = arg->u.tuple.typentry->tupDesc_identifier; + arg->tuple.tupdescid = arg->tuple.typentry->tupDesc_identifier; } } else { - desc = arg->u.tuple.recdesc; + desc = arg->tuple.recdesc; if (desc == NULL) { desc = lookup_rowtype_tupdesc(arg->typoid, arg->typmod); - arg->u.tuple.recdesc = desc; + arg->tuple.recdesc = desc; } else { @@ -996,7 +996,7 @@ PLyObject_ToComposite(PLyObToDatum *arg, PyObject *plrv, } /* Simple sanity check on our caching */ - Assert(desc->natts == arg->u.tuple.natts); + Assert(desc->natts == arg->tuple.natts); /* * Convert, using the appropriate method depending on the type of the @@ -1088,9 +1088,9 @@ PLyObject_ToScalar(PLyObToDatum *arg, PyObject *plrv, str = PLyObject_AsString(plrv); - return InputFunctionCall(&arg->u.scalar.typfunc, + return InputFunctionCall(&arg->scalar.typfunc, str, - arg->u.scalar.typioparam, + arg->scalar.typioparam, arg->typmod); } @@ -1103,11 +1103,11 @@ PLyObject_ToDomain(PLyObToDatum *arg, PyObject *plrv, bool *isnull, bool inarray) { Datum result; - PLyObToDatum *base = arg->u.domain.base; + PLyObToDatum *base = arg->domain.base; result = base->func(base, plrv, isnull, inarray); domain_check(result, *isnull, arg->typoid, - &arg->u.domain.domain_info, arg->mcxt); + &arg->domain.domain_info, arg->mcxt); return result; } @@ -1125,7 +1125,7 @@ PLyObject_ToTransform(PLyObToDatum *arg, PyObject *plrv, return (Datum) 0; } *isnull = false; - return FunctionCall1(&arg->u.transform.typtransform, PointerGetDatum(plrv)); + return FunctionCall1(&arg->transform.typtransform, PointerGetDatum(plrv)); } @@ -1169,12 +1169,12 @@ PLySequence_ToArray(PLyObToDatum *arg, PyObject *plrv, */ PLySequence_ToArray_recurse(plrv, &astate, &ndims, dims, 1, - arg->u.array.elm, - arg->u.array.elmbasetype); + arg->array.elm, + arg->array.elmbasetype); /* ensure we get zero-D array for no inputs, as per PG convention */ if (astate == NULL) - return PointerGetDatum(construct_empty_array(arg->u.array.elmbasetype)); + return PointerGetDatum(construct_empty_array(arg->array.elmbasetype)); for (int i = 0; i < ndims; i++) lbs[i] = 1; @@ -1289,8 +1289,8 @@ PLyUnicode_ToComposite(PLyObToDatum *arg, PyObject *string, bool inarray) * Set up call data for record_in, if we didn't already. (We can't just * use DirectFunctionCall, because record_in needs a fn_extra field.) */ - if (!OidIsValid(arg->u.tuple.recinfunc.fn_oid)) - fmgr_info_cxt(F_RECORD_IN, &arg->u.tuple.recinfunc, arg->mcxt); + if (!OidIsValid(arg->tuple.recinfunc.fn_oid)) + fmgr_info_cxt(F_RECORD_IN, &arg->tuple.recinfunc, arg->mcxt); str = PLyObject_AsString(string); @@ -1334,7 +1334,7 @@ PLyUnicode_ToComposite(PLyObToDatum *arg, PyObject *string, bool inarray) errhint("To return a composite type in an array, return the composite type as a Python tuple, e.g., \"[('foo',)]\"."))); } - return InputFunctionCall(&arg->u.tuple.recinfunc, + return InputFunctionCall(&arg->tuple.recinfunc, str, arg->typoid, arg->typmod); @@ -1371,7 +1371,7 @@ PLyMapping_ToComposite(PLyObToDatum *arg, TupleDesc desc, PyObject *mapping) key = NameStr(attr->attname); value = NULL; - att = &arg->u.tuple.atts[i]; + att = &arg->tuple.atts[i]; PG_TRY(); { value = PyMapping_GetItemString(mapping, key); @@ -1451,7 +1451,7 @@ PLySequence_ToComposite(PLyObToDatum *arg, TupleDesc desc, PyObject *sequence) } value = NULL; - att = &arg->u.tuple.atts[i]; + att = &arg->tuple.atts[i]; PG_TRY(); { value = PySequence_GetItem(sequence, idx); @@ -1511,7 +1511,7 @@ PLyGenericObject_ToComposite(PLyObToDatum *arg, TupleDesc desc, PyObject *object key = NameStr(attr->attname); value = NULL; - att = &arg->u.tuple.atts[i]; + att = &arg->tuple.atts[i]; PG_TRY(); { value = PyObject_GetAttrString(object, key); diff --git a/src/pl/plpython/plpy_typeio.h b/src/pl/plpython/plpy_typeio.h index 5417f0945d2..29258509b5c 100644 --- a/src/pl/plpython/plpy_typeio.h +++ b/src/pl/plpython/plpy_typeio.h @@ -69,7 +69,7 @@ struct PLyDatumToOb PLyArrayToOb array; PLyTupleToOb tuple; PLyTransformToOb transform; - } u; + }; }; /* @@ -143,7 +143,7 @@ struct PLyObToDatum PLyObToTuple tuple; PLyObToDomain domain; PLyObToTransform transform; - } u; + }; }; |