Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
71c1136
Fix mistakes in commit 4020b370f214315b8c10430301898ac21658143f
robertmhaas Jan 29, 2026
ec31744
Replace literal 0 with InvalidXLogRecPtr for XLogRecPtr assignments
alvherre Jan 29, 2026
de90bb7
Fix theoretical memory leaks in pg_locale_libc.c.
jeff-davis Jan 29, 2026
bd9dfac
Further fix extended alignment for older g++.
tglsfdc Jan 29, 2026
333f586
bufmgr: Allow conditionally locking of already locked buffer
anarazel Jan 29, 2026
87f7b82
tableam: Perform CheckXidAlive check once per scan
anarazel Jan 29, 2026
bb26a81
Remove unused argument from ApplyLogicalMappingFile().
MasaoFujii Jan 30, 2026
1eb09ed
Use C99 designated designators in a couple of places
alvherre Jan 30, 2026
e76221b
Minor cosmetic tweaks
alvherre Jan 30, 2026
e2362eb
Move shmem allocator's fields from PGShmemHeader to its own struct
hlinnaka Jan 30, 2026
a1d7ae2
Improve guards against false regex matches in BackgroundPsql.pm.
tglsfdc Jan 30, 2026
6918434
Make psql/t/030_pager.pl more robust.
tglsfdc Jan 30, 2026
d46aa32
Fix build inconsistency due to the generation of wait-event code
michaelpq Feb 1, 2026
a9afa02
Fix error message in RemoveWalSummaryIfOlderThan()
michaelpq Feb 2, 2026
0c9f46c
In s_lock.h, use regular labels with %= instead of local labels.
tglsfdc Feb 2, 2026
da7a1dc
Refactor att_align_nominal() to improve performance.
tglsfdc Feb 2, 2026
12451d9
test_shm_mq: Set background worker names.
nathan-bossart Feb 2, 2026
4a99ef1
Fix flakiness in the pg_visibility VM-only vacuum test by using a tem…
melanieplageman Feb 2, 2026
dddbbc2
psql: Add %i prompt escape to indicate hot standby status.
MasaoFujii Feb 3, 2026
21c1125
Release synchronous replication waiters immediately on configuration …
MasaoFujii Feb 3, 2026
213fec2
Fix incorrect errno in OpenWalSummaryFile()
michaelpq Feb 3, 2026
e05a24c
Add two IO wait events for COPY FROM/TO on a pipe/file/program
michaelpq Feb 3, 2026
137d05d
Rename AssertVariableIsOfType to StaticAssertVariableIsOfType
petere Feb 3, 2026
955e507
Change StaticAssertVariableIsOfType to be a declaration
petere Feb 3, 2026
96e2af6
Reject ADD CONSTRAINT NOT NULL if name mismatches existing constraint
alvherre Feb 3, 2026
cd375d5
Remove useless errdetail_abort()
hlinnaka Feb 3, 2026
57bff90
Don't hint that you can reconnect when the database is dropped
hlinnaka Feb 3, 2026
78bf28e
Docs: consolidate dependency notes in pg_dump and pg_restore
alvherre Feb 3, 2026
c8ec747
pg_resetwal: Fix incorrect error message related to pg_wal/summaries/
michaelpq Feb 4, 2026
4cfce4e
Change copyObject() to use typeof_unqual
petere Feb 4, 2026
084e42b
Add backendType to PGPROC, replacing isRegularBackend
hlinnaka Feb 4, 2026
176dffd
Fix various instances of undefined behavior
j-naylor Feb 4, 2026
36ead71
Fix logical replication TAP test to read publisher log correctly.
MasaoFujii Feb 4, 2026
0c8e082
Assign "backend" type earlier during process start-up
alvherre Feb 4, 2026
3c5ec35
oid2name: Add relation path to the information provided by -x/--extended
michaelpq Feb 5, 2026
7a1f0f8
pg_upgrade: Optimize logical replication slot caught-up check.
MasahikoSawada Feb 5, 2026
9476ef2
Fix comment in extended_stats_funcs.c
michaelpq Feb 5, 2026
e35add4
doc: Move synchronized_standby_slots to "Primary Server" section.
MasaoFujii Feb 6, 2026
f94e914
Add file_extend_method=posix_fallocate,write_zeros.
macdice May 31, 2025
74a116a
Fix some error message inconsistencies
michaelpq Feb 6, 2026
072c842
Fix use of proc number in pgstat_create_backend()
michaelpq Feb 6, 2026
e3d3785
doc: Expand upon protocol versions and extensions
jchampio Feb 6, 2026
d8d7c5d
libpq: Prepare for protocol grease during 19beta
jchampio Feb 6, 2026
ba1e141
Adjust style of some debugging macros.
nathan-bossart Feb 6, 2026
7cdb633
Make some minor cleanups in typalign-related code.
tglsfdc Feb 7, 2026
0af05b5
Revert "Change copyObject() to use typeof_unqual"
petere Feb 7, 2026
7467041
Future-proof sort template against undefined behavior
j-naylor Feb 7, 2026
1653ce5
Further error message fix
petere Feb 7, 2026
c0bf157
meson: host_system value for Solaris is 'sunos' not 'solaris'.
tglsfdc Feb 8, 2026
73dd716
Replace some hard-wired OID constants with corresponding macros.
tglsfdc Feb 8, 2026
379695d
pgcrypto: Fix buffer overflow in pgp_pub_decrypt_bytea()
michaelpq Feb 8, 2026
5459867
Remove 'charlen' argument from make_trigrams()
hlinnaka Jan 20, 2026
00896dd
Fix buffer overflows in pg_trgm due to lower-casing
hlinnaka Jan 20, 2026
af79c30
Fix encoding length for EUC_CN.
macdice Feb 4, 2026
74ee636
Fix mb2wchar functions on short input.
macdice Jan 25, 2026
1e7fe06
Replace pg_mblen() with bounds-checked versions.
macdice Jan 7, 2026
c67bef3
Code coverage for most pg_mblen* calls.
macdice Jan 11, 2026
38e0190
Allow log_min_messages to be set per process type
alvherre Feb 9, 2026
d536aee
Require PGP-decrypted text to pass encoding validation.
nmisch Feb 9, 2026
60e7ae4
Guard against unexpected dimensions of oidvector/int2vector.
tglsfdc Feb 9, 2026
841d42c
Require superuser to install a non-built-in selectivity estimator.
tglsfdc Feb 9, 2026
8ebdf41
Harden _int_matchsel() against being attached to the wrong operator.
tglsfdc Feb 9, 2026
c5dc754
Fix test "NUL byte in text decrypt" for --without-zlib builds.
nmisch Feb 9, 2026
18f0afb
Fix incorrect iteration type in extension_file_exists()
hlinnaka Feb 9, 2026
cbef472
Remove HeapTupleheaderSetXminCommitted/Invalid functions
alvherre Feb 9, 2026
73d60ac
cleanup: Deadlock checker is no longer called from signal handler
hlinnaka Feb 9, 2026
158408f
pg_upgrade: Fix handling of pg_largeobject_metadata.
nathan-bossart Feb 9, 2026
0a37961
Optimize IS DISTINCT FROM with non-nullable inputs
Feb 10, 2026
0aaf0de
Optimize BooleanTest with non-nullable input
Feb 10, 2026
f41ab51
Teach planner to transform "x IS [NOT] DISTINCT FROM NULL" to a NullTest
Feb 10, 2026
307447e
Add information about range type stats to pg_stats_ext_exprs
michaelpq Feb 10, 2026
f33c585
Simplify some log messages in extended_stats_funcs.c
michaelpq Feb 10, 2026
ddc3250
Use ProcNumber rather than pid in ReplicationSlot
hlinnaka Feb 10, 2026
17f51ea
Separate RecoveryConflictReasons from procsignals
hlinnaka Feb 10, 2026
be52577
Refactor ProcessRecoveryConflictInterrupt for readability
hlinnaka Feb 10, 2026
cbdf93d
Fix PGS_CONSIDER_NONPARTIAL interaction with Materialize nodes.
robertmhaas Feb 10, 2026
0f4c8d3
Pass cursorOptions to planner_setup_hook.
robertmhaas Feb 10, 2026
adbad83
Store information about range-table flattening in the final plan.
robertmhaas Feb 10, 2026
0d4391b
Store information about elided nodes in the final plan.
robertmhaas Feb 10, 2026
9181c87
Improve type handling of varlena structures
michaelpq Feb 10, 2026
7358abc
Store information about Append node consolidation in the final plan.
robertmhaas Feb 10, 2026
ab32a9e
Remove useless store to local variable
hlinnaka Feb 11, 2026
227a6ea
doc: Clarify RLS policies applied for ON CONFLICT DO NOTHING.
deanrasheed Feb 11, 2026
bc953bf
doc: Mention all SELECT privileges required by INSERT ... ON CONFLICT.
deanrasheed Feb 11, 2026
7984ce7
Move ProcStructLock to the ProcGlobal struct
hlinnaka Feb 11, 2026
1efdd7c
Cleanup for log_min_messages changes in 38e0190ced71
alvherre Feb 11, 2026
a3fd53b
Further stabilize a postgres_fdw test case.
tglsfdc Feb 11, 2026
1d92e0c
Add password expiration warnings.
nathan-bossart Feb 11, 2026
78a5e30
Fix pg_stat_get_backend_wait_event() for aux processes
hlinnaka Feb 11, 2026
9863c90
Fix plpgsql's handling of "return simple_record_variable".
tglsfdc Feb 11, 2026
cf74558
Reduce LEFT JOIN to ANTI JOIN using NOT NULL constraints
Feb 12, 2026
706cadd
Remove p_is_insert from struct ParseState.
deanrasheed Feb 12, 2026
788ec96
Refactor slot synchronization logic in slotsync.c.
Feb 12, 2026
8832709
Add support for INSERT ... ON CONFLICT DO SELECT.
deanrasheed Feb 12, 2026
cb7b2e5
Remove some unnecessary optimizations in popcount code.
nathan-bossart Feb 12, 2026
a468898
Remove specialized word-length popcount implementations.
nathan-bossart Feb 12, 2026
d7a4291
Fix comment neglected in commit ddc3250208
hlinnaka Feb 12, 2026
d7edcec
Make pg_numa_query_pages() work in frontend programs
hlinnaka Feb 12, 2026
775fc01
Improve error message for checksum failures in pgstat_database.c
michaelpq Feb 13, 2026
53c6bd0
Restart BackgroundPsql's timer more nicely.
danielgustafsson Feb 13, 2026
6736dea
pg_dump: Use pg_malloc_object() and pg_malloc_array()
michaelpq Feb 13, 2026
4ec0e75
meson: Add target for generating docs images
danielgustafsson Feb 13, 2026
4469fe1
doc: Update docs images README with required ditaa version
danielgustafsson Feb 13, 2026
aa082be
doc: Mention PASSING support for jsonpath variables
danielgustafsson Feb 13, 2026
ef3c3cf
Perform radix sort on SortTuples with pass-by-value Datums
j-naylor Feb 14, 2026
4644f8b
pg_mblen_range, pg_mblen_with_len: Valgrind after encoding ereport.
nmisch Feb 14, 2026
9f4fd11
Fix SUBSTRING() for toasted multibyte characters.
nmisch Feb 14, 2026
4595763
pgcrypto: Tweak error message for incorrect session key length
michaelpq Feb 16, 2026
351265a
Remove recovery.signal at recovery end when both signal files are pre…
MasaoFujii Feb 16, 2026
d50c86e
Change remaining StaticAssertStmt() to StaticAssertDecl()
petere Feb 16, 2026
07e90c6
Avoid using the X25519 curve in ssl tests
danielgustafsson Feb 16, 2026
db93988
doc: Add note to ssl_group config on X25519 and FIPS
danielgustafsson Feb 16, 2026
6be5b76
Ensure that all three build methods install the same set of files.
tglsfdc Feb 16, 2026
b33f753
pg_upgrade: Use COPY for LO metadata for upgrades from < v12.
nathan-bossart Feb 16, 2026
a6f823e
hstore: Fix NULL pointer dereference with receive function
michaelpq Feb 16, 2026
8cef93d
Suppress new "may be used uninitialized" warning.
nmisch Feb 17, 2026
bd626ef
Fix test_valid_server_encoding helper function.
macdice Feb 17, 2026
3d28ecb
Test List macros in C++ extensions
petere Feb 17, 2026
451650e
Test most StaticAssert macros in C++ extensions
petere Feb 17, 2026
a92b809
Ignore SIGINT in walwriter and walsummarizer
hlinnaka Feb 17, 2026
6612370
Fix memory leak in new GUC check_hook
alvherre Feb 17, 2026
b7271aa
Use a bitmask for ExecInsertIndexTuples options
alvherre Feb 17, 2026
f7df12a
Fix one-off issue with cache ID in objectaddress.c
michaelpq Feb 17, 2026
c06b5b9
Add concept of invalid value to SysCacheIdentifier
michaelpq Feb 18, 2026
ee642cc
Switch SysCacheIdentifier to a typedef enum
michaelpq Feb 18, 2026
623a90c
Force creation of stamp file after libpq library check in meson builds
michaelpq Feb 18, 2026
3894f08
Update obsolete comment
alvherre Feb 18, 2026
d62dca3
Use standard die() handler for SIGTERM in bgworkers
hlinnaka Feb 18, 2026
759b03b
Simplify creation of built-in functions with default arguments.
tglsfdc Feb 18, 2026
21e323e
Sanitize some WAL-logging buffer handling in GIN and GiST code
michaelpq Feb 19, 2026
0c3fbb3
Remove useless fallthrough annotation
petere Feb 19, 2026
8354b9d
Use fallthrough attribute instead of comment
petere Feb 19, 2026
5b93a59
Log checkpoint request flags in checkpoint completion messages.
MasaoFujii Feb 19, 2026
8a6af3a
Make GUC wal_receiver_timeout user-settable.
MasaoFujii Feb 19, 2026
fb80f38
Add per-subscription wal_receiver_timeout setting.
MasaoFujii Feb 19, 2026
2f248ad
Remove no-longer-useful markers in pg_hba.conf.sample.
tglsfdc Feb 19, 2026
fc3896c
Add translator comment
alvherre Feb 19, 2026
4590893
Allow extensions to mark an individual index as disabled.
robertmhaas Feb 7, 2026
b97994b
Replace get_relation_info_hook with build_simple_rel_hook.
robertmhaas Feb 10, 2026
a33d6c5
Add pg_plan_advice contrib module.
robertmhaas Jan 26, 2026
fd927b2
Use rt_fetch, not planner_rt_fetch.
robertmhaas Feb 19, 2026
7942bad
clean up an XXX comment
robertmhaas Feb 19, 2026
149d895
fix another XXX comment and reindent
robertmhaas Feb 19, 2026
e161d7c
Fix add_partial_path interaction with disabled_nodes
robertmhaas Feb 5, 2026
5783db0
Consider startup cost as a figure of merit for partial paths.
robertmhaas Feb 6, 2026
7ae36cd
Test pg_plan_advice using a new test_plan_advice module.
robertmhaas Feb 7, 2026
8c4d351
in test_plan_advice, enable feedback warnings
robertmhaas Feb 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
40 changes: 20 additions & 20 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -5616,15 +5616,15 @@ fi



{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wimplicit-fallthrough=3, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wimplicit-fallthrough=3, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wimplicit-fallthrough=5, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wimplicit-fallthrough=5, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_5+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS} -Wimplicit-fallthrough=3"
CFLAGS="${CFLAGS} -Wimplicit-fallthrough=5"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
Expand All @@ -5639,31 +5639,31 @@ main ()
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3=yes
pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_5=yes
else
pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3=no
pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_5=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3" = x"yes"; then
CFLAGS="${CFLAGS} -Wimplicit-fallthrough=3"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_5" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_5" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_5" = x"yes"; then
CFLAGS="${CFLAGS} -Wimplicit-fallthrough=5"
fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -Wimplicit-fallthrough=3, for CXXFLAGS" >&5
$as_echo_n "checking whether ${CXX} supports -Wimplicit-fallthrough=3, for CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -Wimplicit-fallthrough=5, for CXXFLAGS" >&5
$as_echo_n "checking whether ${CXX} supports -Wimplicit-fallthrough=5, for CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_5+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CXX}
CXXFLAGS="${CXXFLAGS} -Wimplicit-fallthrough=3"
CXXFLAGS="${CXXFLAGS} -Wimplicit-fallthrough=5"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
Expand All @@ -5684,9 +5684,9 @@ main ()
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3=yes
pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_5=yes
else
pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3=no
pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_5=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
Expand All @@ -5699,10 +5699,10 @@ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3" = x"yes"; then
CXXFLAGS="${CXXFLAGS} -Wimplicit-fallthrough=3"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_5" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_5" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_5" = x"yes"; then
CXXFLAGS="${CXXFLAGS} -Wimplicit-fallthrough=5"
fi


Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,8 @@ if test "$GCC" = yes -a "$ICC" = no; then
PGAC_PROG_CXX_CFLAGS_OPT([-Wendif-labels])
PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-format-attribute])
PGAC_PROG_CXX_CFLAGS_OPT([-Wmissing-format-attribute])
PGAC_PROG_CC_CFLAGS_OPT([-Wimplicit-fallthrough=3])
PGAC_PROG_CXX_CFLAGS_OPT([-Wimplicit-fallthrough=3])
PGAC_PROG_CC_CFLAGS_OPT([-Wimplicit-fallthrough=5])
PGAC_PROG_CXX_CFLAGS_OPT([-Wimplicit-fallthrough=5])
PGAC_PROG_CC_CFLAGS_OPT([-Wcast-function-type])
PGAC_PROG_CXX_CFLAGS_OPT([-Wcast-function-type])
PGAC_PROG_CC_CFLAGS_OPT([-Wshadow=compatible-local])
Expand Down
1 change: 1 addition & 0 deletions contrib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ SUBDIRS = \
pg_freespacemap \
pg_logicalinspect \
pg_overexplain \
pg_plan_advice \
pg_prewarm \
pg_stat_statements \
pg_surgery \
Expand Down
8 changes: 4 additions & 4 deletions contrib/amcheck/verify_heapam.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ typedef enum SkipPages
*/
typedef struct ToastedAttribute
{
struct varatt_external toast_pointer;
varatt_external toast_pointer;
BlockNumber blkno; /* block in main table */
OffsetNumber offnum; /* offset in main table */
AttrNumber attnum; /* attribute in main table */
Expand Down Expand Up @@ -1660,11 +1660,11 @@ static bool
check_tuple_attribute(HeapCheckContext *ctx)
{
Datum attdatum;
struct varlena *attr;
varlena *attr;
char *tp; /* pointer to the tuple data */
uint16 infomask;
CompactAttribute *thisatt;
struct varatt_external toast_pointer;
varatt_external toast_pointer;

infomask = ctx->tuphdr->t_infomask;
thisatt = TupleDescCompactAttr(RelationGetDescr(ctx->rel), ctx->attnum);
Expand Down Expand Up @@ -1754,7 +1754,7 @@ check_tuple_attribute(HeapCheckContext *ctx)
* We go further, because we need to check if the toast datum is corrupt.
*/

attr = (struct varlena *) DatumGetPointer(attdatum);
attr = (varlena *) DatumGetPointer(attdatum);

/*
* Now we follow the logic of detoast_external_attr(), with the same
Expand Down
2 changes: 1 addition & 1 deletion contrib/btree_gin/btree_gin.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ gin_btree_extract_query(FunctionCallInfo fcinfo,
case BTGreaterEqualStrategyNumber:
case BTGreaterStrategyNumber:
*ptr_partialmatch = true;
/* FALLTHROUGH */
pg_fallthrough;
case BTEqualStrategyNumber:
/* If we have a conversion function, apply it */
if (cvt_fns && cvt_fns[rhs_code])
Expand Down
25 changes: 18 additions & 7 deletions contrib/btree_gist/btree_utils_var.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ gbt_var_key_readable(const GBT_VARKEY *k)
* Create a leaf-entry to store in the index, from a single Datum.
*/
static GBT_VARKEY *
gbt_var_key_from_datum(const struct varlena *u)
gbt_var_key_from_datum(const varlena *u)
{
int32 lowersize = VARSIZE(u);
GBT_VARKEY *r;
Expand Down Expand Up @@ -115,36 +115,47 @@ gbt_var_leaf2node(GBT_VARKEY *leaf, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)

/*
* returns the common prefix length of a node key
*
* If the underlying type is character data, the prefix length may point in
* the middle of a multibyte character.
*/
static int32
gbt_var_node_cp_len(const GBT_VARKEY *node, const gbtree_vinfo *tinfo)
{
GBT_VARKEY_R r = gbt_var_key_readable(node);
int32 i = 0;
int32 l = 0;
int32 l_left_to_match = 0;
int32 l_total = 0;
int32 t1len = VARSIZE(r.lower) - VARHDRSZ;
int32 t2len = VARSIZE(r.upper) - VARHDRSZ;
int32 ml = Min(t1len, t2len);
char *p1 = VARDATA(r.lower);
char *p2 = VARDATA(r.upper);
const char *end1 = p1 + t1len;
const char *end2 = p2 + t2len;

if (ml == 0)
return 0;

while (i < ml)
{
if (tinfo->eml > 1 && l == 0)
if (tinfo->eml > 1 && l_left_to_match == 0)
{
if ((l = pg_mblen(p1)) != pg_mblen(p2))
l_total = pg_mblen_range(p1, end1);
if (l_total != pg_mblen_range(p2, end2))
{
return i;
}
l_left_to_match = l_total;
}
if (*p1 != *p2)
{
if (tinfo->eml > 1)
{
return (i - l + 1);
int32 l_matched_subset = l_total - l_left_to_match;

/* end common prefix at final byte of last matching char */
return i - l_matched_subset;
}
else
{
Expand All @@ -154,7 +165,7 @@ gbt_var_node_cp_len(const GBT_VARKEY *node, const gbtree_vinfo *tinfo)

p1++;
p2++;
l--;
l_left_to_match--;
i++;
}
return ml; /* lower == upper */
Expand Down Expand Up @@ -283,7 +294,7 @@ gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo)

if (entry->leafkey)
{
struct varlena *leaf = PG_DETOAST_DATUM(entry->key);
varlena *leaf = PG_DETOAST_DATUM(entry->key);
GBT_VARKEY *r;

r = gbt_var_key_from_datum(leaf);
Expand Down
4 changes: 3 additions & 1 deletion contrib/dblink/dblink.c
Original file line number Diff line number Diff line change
Expand Up @@ -2069,6 +2069,7 @@ get_text_array_contents(ArrayType *array, int *numitems)
int16 typlen;
bool typbyval;
char typalign;
uint8 typalignby;
char **values;
char *ptr;
bits8 *bitmap;
Expand All @@ -2081,6 +2082,7 @@ get_text_array_contents(ArrayType *array, int *numitems)

get_typlenbyvalalign(ARR_ELEMTYPE(array),
&typlen, &typbyval, &typalign);
typalignby = typalign_to_alignby(typalign);

values = palloc_array(char *, nitems);

Expand All @@ -2098,7 +2100,7 @@ get_text_array_contents(ArrayType *array, int *numitems)
{
values[i] = TextDatumGetCString(PointerGetDatum(ptr));
ptr = att_addlength_pointer(ptr, typlen, ptr);
ptr = (char *) att_align_nominal(ptr, typalign);
ptr = (char *) att_nominal_alignby(ptr, typalignby);
}

/* advance bitmap pointer if any */
Expand Down
4 changes: 2 additions & 2 deletions contrib/dict_xsyn/dict_xsyn.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ find_word(char *in, char **end)

*end = NULL;
while (*in && isspace((unsigned char) *in))
in += pg_mblen(in);
in += pg_mblen_cstr(in);

if (!*in || *in == '#')
return NULL;
start = in;

while (*in && !isspace((unsigned char) *in))
in += pg_mblen(in);
in += pg_mblen_cstr(in);

*end = in;

Expand Down
5 changes: 3 additions & 2 deletions contrib/hstore/hstore_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ prssyntaxerror(HSParser *state)
errsave(state->escontext,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("syntax error in hstore, near \"%.*s\" at position %d",
pg_mblen(state->ptr), state->ptr,
pg_mblen_cstr(state->ptr), state->ptr,
(int) (state->ptr - state->begin))));
/* In soft error situation, return false as convenience for caller */
return false;
Expand Down Expand Up @@ -385,7 +385,8 @@ hstoreUniquePairs(Pairs *a, int32 l, int32 *buflen)
if (ptr->needfree)
{
pfree(ptr->key);
pfree(ptr->val);
if (ptr->val != NULL)
pfree(ptr->val);
}
}
else
Expand Down
13 changes: 7 additions & 6 deletions contrib/hstore_plperl/hstore_plperl.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,32 @@ static hstoreCheckKeyLen_t hstoreCheckKeyLen_p;
typedef size_t (*hstoreCheckValLen_t) (size_t len);
static hstoreCheckValLen_t hstoreCheckValLen_p;

/* Static asserts verify that typedefs above match original declarations */
StaticAssertVariableIsOfType(&hstoreUpgrade, hstoreUpgrade_t);
StaticAssertVariableIsOfType(&hstoreUniquePairs, hstoreUniquePairs_t);
StaticAssertVariableIsOfType(&hstorePairs, hstorePairs_t);
StaticAssertVariableIsOfType(&hstoreCheckKeyLen, hstoreCheckKeyLen_t);
StaticAssertVariableIsOfType(&hstoreCheckValLen, hstoreCheckValLen_t);


/*
* Module initialize function: fetch function pointers for cross-module calls.
*/
void
_PG_init(void)
{
/* Asserts verify that typedefs above match original declarations */
AssertVariableIsOfType(&hstoreUpgrade, hstoreUpgrade_t);
hstoreUpgrade_p = (hstoreUpgrade_t)
load_external_function("$libdir/hstore", "hstoreUpgrade",
true, NULL);
AssertVariableIsOfType(&hstoreUniquePairs, hstoreUniquePairs_t);
hstoreUniquePairs_p = (hstoreUniquePairs_t)
load_external_function("$libdir/hstore", "hstoreUniquePairs",
true, NULL);
AssertVariableIsOfType(&hstorePairs, hstorePairs_t);
hstorePairs_p = (hstorePairs_t)
load_external_function("$libdir/hstore", "hstorePairs",
true, NULL);
AssertVariableIsOfType(&hstoreCheckKeyLen, hstoreCheckKeyLen_t);
hstoreCheckKeyLen_p = (hstoreCheckKeyLen_t)
load_external_function("$libdir/hstore", "hstoreCheckKeyLen",
true, NULL);
AssertVariableIsOfType(&hstoreCheckValLen, hstoreCheckValLen_t);
hstoreCheckValLen_p = (hstoreCheckValLen_t)
load_external_function("$libdir/hstore", "hstoreCheckValLen",
true, NULL);
Expand Down
17 changes: 9 additions & 8 deletions contrib/hstore_plpython/hstore_plpython.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,40 @@ static hstoreCheckKeyLen_t hstoreCheckKeyLen_p;
typedef size_t (*hstoreCheckValLen_t) (size_t len);
static hstoreCheckValLen_t hstoreCheckValLen_p;

/* Static asserts verify that typedefs above match original declarations */
StaticAssertVariableIsOfType(&PLyObject_AsString, PLyObject_AsString_t);
StaticAssertVariableIsOfType(&PLyUnicode_FromStringAndSize, PLyUnicode_FromStringAndSize_t);
StaticAssertVariableIsOfType(&hstoreUpgrade, hstoreUpgrade_t);
StaticAssertVariableIsOfType(&hstoreUniquePairs, hstoreUniquePairs_t);
StaticAssertVariableIsOfType(&hstorePairs, hstorePairs_t);
StaticAssertVariableIsOfType(&hstoreCheckKeyLen, hstoreCheckKeyLen_t);
StaticAssertVariableIsOfType(&hstoreCheckValLen, hstoreCheckValLen_t);


/*
* Module initialize function: fetch function pointers for cross-module calls.
*/
void
_PG_init(void)
{
/* Asserts verify that typedefs above match original declarations */
AssertVariableIsOfType(&PLyObject_AsString, PLyObject_AsString_t);
PLyObject_AsString_p = (PLyObject_AsString_t)
load_external_function("$libdir/" PLPYTHON_LIBNAME, "PLyObject_AsString",
true, NULL);
AssertVariableIsOfType(&PLyUnicode_FromStringAndSize, PLyUnicode_FromStringAndSize_t);
PLyUnicode_FromStringAndSize_p = (PLyUnicode_FromStringAndSize_t)
load_external_function("$libdir/" PLPYTHON_LIBNAME, "PLyUnicode_FromStringAndSize",
true, NULL);
AssertVariableIsOfType(&hstoreUpgrade, hstoreUpgrade_t);
hstoreUpgrade_p = (hstoreUpgrade_t)
load_external_function("$libdir/hstore", "hstoreUpgrade",
true, NULL);
AssertVariableIsOfType(&hstoreUniquePairs, hstoreUniquePairs_t);
hstoreUniquePairs_p = (hstoreUniquePairs_t)
load_external_function("$libdir/hstore", "hstoreUniquePairs",
true, NULL);
AssertVariableIsOfType(&hstorePairs, hstorePairs_t);
hstorePairs_p = (hstorePairs_t)
load_external_function("$libdir/hstore", "hstorePairs",
true, NULL);
AssertVariableIsOfType(&hstoreCheckKeyLen, hstoreCheckKeyLen_t);
hstoreCheckKeyLen_p = (hstoreCheckKeyLen_t)
load_external_function("$libdir/hstore", "hstoreCheckKeyLen",
true, NULL);
AssertVariableIsOfType(&hstoreCheckValLen, hstoreCheckValLen_t);
hstoreCheckValLen_p = (hstoreCheckValLen_t)
load_external_function("$libdir/hstore", "hstoreCheckValLen",
true, NULL);
Expand Down
Loading