Skip to content

[pull] master from postgres:master #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions contrib/isn/isn.c
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ string2ean(const char *str, struct Node *escontext, ean13 *result,
if (type != INVALID)
goto eaninvalid;
type = ISSN;
*aux1++ = pg_ascii_toupper((unsigned char) *aux2);
*aux1++ = toupper((unsigned char) *aux2);
length++;
}
else if (length == 9 && (digit || *aux2 == 'X' || *aux2 == 'x') && last)
Expand All @@ -736,7 +736,7 @@ string2ean(const char *str, struct Node *escontext, ean13 *result,
goto eaninvalid;
if (type == INVALID)
type = ISBN; /* ISMN must start with 'M' */
*aux1++ = pg_ascii_toupper((unsigned char) *aux2);
*aux1++ = toupper((unsigned char) *aux2);
length++;
}
else if (length == 11 && digit && last)
Expand Down
2 changes: 1 addition & 1 deletion contrib/spi/refint.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ check_foreign_key(PG_FUNCTION_ARGS)
if (nrefs < 1)
/* internal error */
elog(ERROR, "check_foreign_key: %d (< 1) number of references specified", nrefs);
action = pg_ascii_tolower((unsigned char) *(args[1]));
action = tolower((unsigned char) *(args[1]));
if (action != 'r' && action != 'c' && action != 's')
/* internal error */
elog(ERROR, "check_foreign_key: invalid action %s", args[1]);
Expand Down
25 changes: 16 additions & 9 deletions src/backend/access/nbtree/nbtutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static bool _bt_check_compare(IndexScanDesc scan, ScanDirection dir,
bool *continuescan, int *ikey);
static bool _bt_check_rowcompare(ScanKey skey,
IndexTuple tuple, int tupnatts, TupleDesc tupdesc,
ScanDirection dir, bool *continuescan);
ScanDirection dir, bool forcenonrequired, bool *continuescan);
static void _bt_checkkeys_look_ahead(IndexScanDesc scan, BTReadPageState *pstate,
int tupnatts, TupleDesc tupdesc);
static int _bt_keep_natts(Relation rel, IndexTuple lastleft,
Expand Down Expand Up @@ -2902,10 +2902,8 @@ _bt_check_compare(IndexScanDesc scan, ScanDirection dir,
/* row-comparison keys need special processing */
if (key->sk_flags & SK_ROW_HEADER)
{
Assert(!forcenonrequired); /* forbidden by _bt_set_startikey */

if (_bt_check_rowcompare(key, tuple, tupnatts, tupdesc, dir,
continuescan))
forcenonrequired, continuescan))
continue;
return false;
}
Expand Down Expand Up @@ -3062,7 +3060,8 @@ _bt_check_compare(IndexScanDesc scan, ScanDirection dir,
*/
static bool
_bt_check_rowcompare(ScanKey skey, IndexTuple tuple, int tupnatts,
TupleDesc tupdesc, ScanDirection dir, bool *continuescan)
TupleDesc tupdesc, ScanDirection dir,
bool forcenonrequired, bool *continuescan)
{
ScanKey subkey = (ScanKey) DatumGetPointer(skey->sk_argument);
int32 cmpresult = 0;
Expand Down Expand Up @@ -3102,7 +3101,11 @@ _bt_check_rowcompare(ScanKey skey, IndexTuple tuple, int tupnatts,

if (isNull)
{
if (subkey->sk_flags & SK_BT_NULLS_FIRST)
if (forcenonrequired)
{
/* treating scan's keys as non-required */
}
else if (subkey->sk_flags & SK_BT_NULLS_FIRST)
{
/*
* Since NULLs are sorted before non-NULLs, we know we have
Expand Down Expand Up @@ -3156,8 +3159,12 @@ _bt_check_rowcompare(ScanKey skey, IndexTuple tuple, int tupnatts,
*/
Assert(subkey != (ScanKey) DatumGetPointer(skey->sk_argument));
subkey--;
if ((subkey->sk_flags & SK_BT_REQFWD) &&
ScanDirectionIsForward(dir))
if (forcenonrequired)
{
/* treating scan's keys as non-required */
}
else if ((subkey->sk_flags & SK_BT_REQFWD) &&
ScanDirectionIsForward(dir))
*continuescan = false;
else if ((subkey->sk_flags & SK_BT_REQBKWD) &&
ScanDirectionIsBackward(dir))
Expand Down Expand Up @@ -3209,7 +3216,7 @@ _bt_check_rowcompare(ScanKey skey, IndexTuple tuple, int tupnatts,
break;
}

if (!result)
if (!result && !forcenonrequired)
{
/*
* Tuple fails this qual. If it's a required qual for the current
Expand Down
2 changes: 1 addition & 1 deletion src/backend/commands/copyfromparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,7 @@ GetDecimalFromHex(char hex)
if (isdigit((unsigned char) hex))
return hex - '0';
else
return pg_ascii_tolower((unsigned char) hex) - 'a' + 10;
return tolower((unsigned char) hex) - 'a' + 10;
}

/*
Expand Down
3 changes: 2 additions & 1 deletion src/backend/utils/adt/inet_net_pton.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size)
src++; /* skip x or X. */
while ((ch = *src++) != '\0' && isxdigit((unsigned char) ch))
{
ch = pg_ascii_tolower((unsigned char) ch);
if (isupper((unsigned char) ch))
ch = tolower((unsigned char) ch);
n = strchr(xdigits, ch) - xdigits;
assert(n >= 0 && n <= 15);
if (dirty == 0)
Expand Down
2 changes: 1 addition & 1 deletion src/bin/psql/tab-complete.in.c
Original file line number Diff line number Diff line change
Expand Up @@ -3289,7 +3289,7 @@ match_previous_words(int pattern_id,
COMPLETE_WITH("FORMAT", "FREEZE", "DELIMITER", "NULL",
"HEADER", "QUOTE", "ESCAPE", "FORCE_QUOTE",
"FORCE_NOT_NULL", "FORCE_NULL", "ENCODING", "DEFAULT",
"ON_ERROR", "LOG_VERBOSITY");
"ON_ERROR", "LOG_VERBOSITY", "REJECT_LIMIT");

/* Complete COPY <sth> FROM|TO filename WITH (FORMAT */
else if (Matches("COPY|\\copy", MatchAny, "FROM|TO", MatchAny, "WITH", "(", "FORMAT"))
Expand Down