Compare commits

..

No commits in common. "6fd1dbdb21cb02ea2d307cc8fd931e6a218bfa64" and "890a73ba3ac0ea9ec2ad6a828ffe03ca12b11564" have entirely different histories.

7 changed files with 23 additions and 62 deletions

View File

@ -31,7 +31,6 @@
#include "access/xact.h"
#include "catalog/index.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opfamily_d.h"
#include "commands/tablecmds.h"
#include "lib/bloomfilter.h"
#include "miscadmin.h"
@ -334,20 +333,10 @@ bt_index_check_internal(Oid indrelid, bool parentcheck, bool heapallindexed,
errmsg("index \"%s\" metapage has equalimage field set on unsupported nbtree version",
RelationGetRelationName(indrel))));
if (allequalimage && !_bt_allequalimage(indrel, false))
{
bool has_interval_ops = false;
for (int i = 0; i < IndexRelationGetNumberOfKeyAttributes(indrel); i++)
if (indrel->rd_opfamily[i] == INTERVAL_BTREE_FAM_OID)
has_interval_ops = true;
ereport(ERROR,
(errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("index \"%s\" metapage incorrectly indicates that deduplication is safe",
RelationGetRelationName(indrel)),
has_interval_ops
? errhint("This is known of \"interval\" indexes last built on a version predating 2023-11.")
: 0));
}
RelationGetRelationName(indrel))));
/* Check index, possibly against table it is an index on */
bt_check_every_level(indrel, heaprel, heapkeyspace, parentcheck,

View File

@ -43,7 +43,6 @@
#include "postgres.h"
#include "access/detoast.h"
#include "catalog/pg_type_d.h"
#include "fmgr.h"
#include "utils/builtins.h"
#include "utils/datum.h"
@ -334,17 +333,20 @@ datum_image_eq(Datum value1, Datum value2, bool typByVal, int typLen)
* datum_image_eq() in all cases can use this as their "equalimage" support
* function.
*
* Earlier minor releases erroneously associated this function with
* interval_ops. Detect that case to rescind deduplication support, without
* requiring initdb.
* Currently, we unconditionally assume that any B-Tree operator class that
* registers btequalimage as its support function 4 must be able to safely use
* optimizations like deduplication (i.e. we return true unconditionally). If
* it ever proved necessary to rescind support for an operator class, we could
* do that in a targeted fashion by doing something with the opcintype
* argument.
*-------------------------------------------------------------------------
*/
Datum
btequalimage(PG_FUNCTION_ARGS)
{
Oid opcintype = PG_GETARG_OID(0);
/* Oid opcintype = PG_GETARG_OID(0); */
PG_RETURN_BOOL(opcintype != INTERVALOID);
PG_RETURN_BOOL(true);
}
/*-------------------------------------------------------------------------

View File

@ -6710,22 +6710,15 @@ clear_socket_set(socket_set *sa)
static void
add_socket_to_set(socket_set *sa, int fd, int idx)
{
/* See connect_slot() for background on this code. */
#ifdef WIN32
if (sa->fds.fd_count + 1 >= FD_SETSIZE)
{
pg_log_fatal("too many concurrent database clients for this platform: %d",
sa->fds.fd_count + 1);
exit(1);
}
#else
if (fd < 0 || fd >= FD_SETSIZE)
{
pg_log_fatal("socket file descriptor out of range for select(): %d",
fd);
/*
* Doing a hard exit here is a bit grotty, but it doesn't seem worth
* complicating the API to make it less grotty.
*/
pg_log_fatal("too many client connections for select()");
exit(1);
}
#endif
FD_SET(fd, &sa->fds);
if (fd > sa->maxfd)
sa->maxfd = fd;

View File

@ -223,39 +223,15 @@ ParallelSlotsSetup(const ConnParams *cparams,
conn = connectDatabase(cparams, progname, echo, false, true);
/*
* POSIX defines FD_SETSIZE as the highest file descriptor
* acceptable to FD_SET() and allied macros. Windows defines it
* as a ceiling on the count of file descriptors in the set, not a
* ceiling on the value of each file descriptor; see
* https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-select
* and
* https://learn.microsoft.com/en-us/windows/win32/api/winsock/ns-winsock-fd_set.
* We can't ignore that, because Windows starts file descriptors
* at a higher value, delays reuse, and skips values. With less
* than ten concurrent file descriptors, opened and closed
* rapidly, one can reach file descriptor 1024.
*
* Doing a hard exit here is a bit grotty, but it doesn't seem
* worth complicating the API to make it less grotty.
* Fail and exit immediately if trying to use a socket in an
* unsupported range. POSIX requires open(2) to use the lowest
* unused file descriptor and the hint given relies on that.
*/
#ifdef WIN32
if (i >= FD_SETSIZE)
if (PQsocket(conn) >= FD_SETSIZE)
{
pg_log_fatal("too many jobs for this platform: %d", i);
pg_log_fatal("too many jobs for this platform -- try %d", i);
exit(1);
}
#else
{
int fd = PQsocket(conn);
if (fd >= FD_SETSIZE)
{
pg_log_fatal("socket file descriptor out of range for select(): %d",
fd);
exit(1);
}
}
#endif
init_slot(slots + i, conn);
}

View File

@ -172,6 +172,8 @@
{ amprocfamily => 'btree/interval_ops', amproclefttype => 'interval',
amprocrighttype => 'interval', amprocnum => '3',
amproc => 'in_range(interval,interval,interval,bool,bool)' },
{ amprocfamily => 'btree/interval_ops', amproclefttype => 'interval',
amprocrighttype => 'interval', amprocnum => '4', amproc => 'btequalimage' },
{ amprocfamily => 'btree/macaddr_ops', amproclefttype => 'macaddr',
amprocrighttype => 'macaddr', amprocnum => '1', amproc => 'macaddr_cmp' },
{ amprocfamily => 'btree/macaddr_ops', amproclefttype => 'macaddr',

View File

@ -50,7 +50,7 @@
opfmethod => 'btree', opfname => 'integer_ops' },
{ oid => '1977',
opfmethod => 'hash', opfname => 'integer_ops' },
{ oid => '1982', oid_symbol => 'INTERVAL_BTREE_FAM_OID',
{ oid => '1982',
opfmethod => 'btree', opfname => 'interval_ops' },
{ oid => '1983',
opfmethod => 'hash', opfname => 'interval_ops' },

View File

@ -2192,7 +2192,6 @@ ORDER BY 1, 2, 3;
| array_ops | array_ops | anyarray
| float_ops | float4_ops | real
| float_ops | float8_ops | double precision
| interval_ops | interval_ops | interval
| jsonb_ops | jsonb_ops | jsonb
| numeric_ops | numeric_ops | numeric
| range_ops | range_ops | anyrange
@ -2200,7 +2199,7 @@ ORDER BY 1, 2, 3;
| record_ops | record_ops | record
| tsquery_ops | tsquery_ops | tsquery
| tsvector_ops | tsvector_ops | tsvector
(15 rows)
(14 rows)
-- **************** pg_index ****************
-- Look for illegal values in pg_index fields.