Compare commits

..

No commits in common. "782be0f7124a7e45acf122c1f4988937b94ddb4e" and "1e81d3e6e0a0e35e52e109742c5ce3738c3e87c6" have entirely different histories.

7 changed files with 20 additions and 70 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 "common/pg_prng.h"
#include "lib/bloomfilter.h"
@ -338,20 +337,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 "common/hashfn.h"
#include "fmgr.h"
#include "utils/builtins.h"
@ -386,17 +385,20 @@ datum_image_hash(Datum value, 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

@ -7815,23 +7815,14 @@ 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_error("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_error("socket file descriptor out of range for select(): %d",
fd);
pg_log_error_hint("Try fewer concurrent database clients.");
exit(1);
/*
* Doing a hard exit here is a bit grotty, but it doesn't seem worth
* complicating the API to make it less grotty.
*/
pg_fatal("too many client connections for select()");
}
#endif
FD_SET(fd, &sa->fds);
if (fd > sa->maxfd)
sa->maxfd = fd;

View File

@ -297,41 +297,8 @@ connect_slot(ParallelSlotArray *sa, int slotno, const char *dbname)
slot->connection = connectDatabase(sa->cparams, sa->progname, sa->echo, false, true);
sa->cparams->override_dbname = old_override;
/*
* 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.
*/
#ifdef WIN32
if (slotno >= FD_SETSIZE)
{
pg_log_error("too many jobs for this platform: %d", slotno);
exit(1);
}
#else
{
int fd = PQsocket(slot->connection);
if (fd >= FD_SETSIZE)
{
pg_log_error("socket file descriptor out of range for select(): %d",
fd);
pg_log_error_hint("Try fewer jobs.");
exit(1);
}
}
#endif
if (PQsocket(slot->connection) >= FD_SETSIZE)
pg_fatal("too many jobs for this platform");
/* Setup the connection using the supplied command, if any. */
if (sa->initcmd)

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

@ -2175,7 +2175,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
| multirange_ops | multirange_ops | anymultirange
| numeric_ops | numeric_ops | numeric
@ -2184,7 +2183,7 @@ ORDER BY 1, 2, 3;
| record_ops | record_ops | record
| tsquery_ops | tsquery_ops | tsquery
| tsvector_ops | tsvector_ops | tsvector
(16 rows)
(15 rows)
-- **************** pg_index ****************
-- Look for illegal values in pg_index fields.