mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Post-PG 10 beta1 pgindent run
perltidy run not included.
This commit is contained in:
@@ -165,11 +165,11 @@ blbuildempty(Relation index)
|
||||
BloomFillMetapage(index, metapage);
|
||||
|
||||
/*
|
||||
* Write the page and log it. It might seem that an immediate sync
|
||||
* would be sufficient to guarantee that the file exists on disk, but
|
||||
* recovery itself might remove it while replaying, for example, an
|
||||
* XLOG_DBASE_CREATE or XLOG_TBLSPC_CREATE record. Therefore, we
|
||||
* need this even when wal_level=minimal.
|
||||
* Write the page and log it. It might seem that an immediate sync would
|
||||
* be sufficient to guarantee that the file exists on disk, but recovery
|
||||
* itself might remove it while replaying, for example, an
|
||||
* XLOG_DBASE_CREATE or XLOG_TBLSPC_CREATE record. Therefore, we need
|
||||
* this even when wal_level=minimal.
|
||||
*/
|
||||
PageSetChecksumInplace(metapage, BLOOM_METAPAGE_BLKNO);
|
||||
smgrwrite(index->rd_smgr, INIT_FORKNUM, BLOOM_METAPAGE_BLKNO,
|
||||
|
@@ -75,7 +75,7 @@ _PG_init(void)
|
||||
bl_relopt_tab[i + 1].optname = MemoryContextStrdup(TopMemoryContext,
|
||||
buf);
|
||||
bl_relopt_tab[i + 1].opttype = RELOPT_TYPE_INT;
|
||||
bl_relopt_tab[i + 1].offset = offsetof(BloomOptions, bitSize[0]) + sizeof(int) * i;
|
||||
bl_relopt_tab[i + 1].offset = offsetof(BloomOptions, bitSize[0]) +sizeof(int) * i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -112,13 +112,13 @@ gin_btree_compare_prefix(FunctionCallInfo fcinfo)
|
||||
cmp;
|
||||
|
||||
cmp = DatumGetInt32(CallerFInfoFunctionCall2(
|
||||
data->typecmp,
|
||||
fcinfo->flinfo,
|
||||
PG_GET_COLLATION(),
|
||||
(data->strategy == BTLessStrategyNumber ||
|
||||
data->strategy == BTLessEqualStrategyNumber)
|
||||
? data->datum : a,
|
||||
b));
|
||||
data->typecmp,
|
||||
fcinfo->flinfo,
|
||||
PG_GET_COLLATION(),
|
||||
(data->strategy == BTLessStrategyNumber ||
|
||||
data->strategy == BTLessEqualStrategyNumber)
|
||||
? data->datum : a,
|
||||
b));
|
||||
|
||||
switch (data->strategy)
|
||||
{
|
||||
@@ -438,16 +438,16 @@ GIN_SUPPORT(numeric, true, leftmostvalue_numeric, gin_numeric_cmp)
|
||||
*/
|
||||
|
||||
|
||||
#define ENUM_IS_LEFTMOST(x) ((x) == InvalidOid)
|
||||
#define ENUM_IS_LEFTMOST(x) ((x) == InvalidOid)
|
||||
|
||||
PG_FUNCTION_INFO_V1(gin_enum_cmp);
|
||||
|
||||
Datum
|
||||
gin_enum_cmp(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Oid a = PG_GETARG_OID(0);
|
||||
Oid b = PG_GETARG_OID(1);
|
||||
int res = 0;
|
||||
Oid a = PG_GETARG_OID(0);
|
||||
Oid b = PG_GETARG_OID(1);
|
||||
int res = 0;
|
||||
|
||||
if (ENUM_IS_LEFTMOST(a))
|
||||
{
|
||||
@@ -460,11 +460,11 @@ gin_enum_cmp(PG_FUNCTION_ARGS)
|
||||
else
|
||||
{
|
||||
res = DatumGetInt32(CallerFInfoFunctionCall2(
|
||||
enum_cmp,
|
||||
fcinfo->flinfo,
|
||||
PG_GET_COLLATION(),
|
||||
ObjectIdGetDatum(a),
|
||||
ObjectIdGetDatum(b)));
|
||||
enum_cmp,
|
||||
fcinfo->flinfo,
|
||||
PG_GET_COLLATION(),
|
||||
ObjectIdGetDatum(a),
|
||||
ObjectIdGetDatum(b)));
|
||||
}
|
||||
|
||||
PG_RETURN_INT32(res);
|
||||
|
@@ -170,7 +170,7 @@ gbt_cash_distance(PG_FUNCTION_ARGS)
|
||||
key.upper = (GBT_NUMKEY *) &kkk->upper;
|
||||
|
||||
PG_RETURN_FLOAT8(
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -182,7 +182,7 @@ gbt_date_distance(PG_FUNCTION_ARGS)
|
||||
key.upper = (GBT_NUMKEY *) &kkk->upper;
|
||||
|
||||
PG_RETURN_FLOAT8(
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -32,14 +32,14 @@ static bool
|
||||
gbt_enumgt(const void *a, const void *b, FmgrInfo *flinfo)
|
||||
{
|
||||
return DatumGetBool(
|
||||
CallerFInfoFunctionCall2(enum_gt, flinfo, InvalidOid, ObjectIdGetDatum(*((const Oid *) a)), ObjectIdGetDatum(*((const Oid *) b)))
|
||||
CallerFInfoFunctionCall2(enum_gt, flinfo, InvalidOid, ObjectIdGetDatum(*((const Oid *) a)), ObjectIdGetDatum(*((const Oid *) b)))
|
||||
);
|
||||
}
|
||||
static bool
|
||||
gbt_enumge(const void *a, const void *b, FmgrInfo *flinfo)
|
||||
{
|
||||
return DatumGetBool(
|
||||
CallerFInfoFunctionCall2(enum_ge, flinfo, InvalidOid, ObjectIdGetDatum(*((const Oid *) a)), ObjectIdGetDatum(*((const Oid *) b)))
|
||||
CallerFInfoFunctionCall2(enum_ge, flinfo, InvalidOid, ObjectIdGetDatum(*((const Oid *) a)), ObjectIdGetDatum(*((const Oid *) b)))
|
||||
);
|
||||
}
|
||||
static bool
|
||||
@@ -74,12 +74,12 @@ gbt_enumkey_cmp(const void *a, const void *b, FmgrInfo *flinfo)
|
||||
return 0;
|
||||
|
||||
return DatumGetInt32(
|
||||
CallerFInfoFunctionCall2(enum_cmp, flinfo, InvalidOid, ObjectIdGetDatum(ia->upper), ObjectIdGetDatum(ib->upper))
|
||||
CallerFInfoFunctionCall2(enum_cmp, flinfo, InvalidOid, ObjectIdGetDatum(ia->upper), ObjectIdGetDatum(ib->upper))
|
||||
);
|
||||
}
|
||||
|
||||
return DatumGetInt32(
|
||||
CallerFInfoFunctionCall2(enum_cmp, flinfo, InvalidOid, ObjectIdGetDatum(ia->lower), ObjectIdGetDatum(ib->lower))
|
||||
CallerFInfoFunctionCall2(enum_cmp, flinfo, InvalidOid, ObjectIdGetDatum(ia->lower), ObjectIdGetDatum(ib->lower))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ static const gbtree_ninfo tinfo =
|
||||
gbt_enumle,
|
||||
gbt_enumlt,
|
||||
gbt_enumkey_cmp,
|
||||
NULL /* no KNN support at least for now */
|
||||
NULL /* no KNN support at least for now */
|
||||
};
|
||||
|
||||
|
||||
|
@@ -163,7 +163,7 @@ gbt_float4_distance(PG_FUNCTION_ARGS)
|
||||
key.upper = (GBT_NUMKEY *) &kkk->upper;
|
||||
|
||||
PG_RETURN_FLOAT8(
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -170,7 +170,7 @@ gbt_float8_distance(PG_FUNCTION_ARGS)
|
||||
key.upper = (GBT_NUMKEY *) &kkk->upper;
|
||||
|
||||
PG_RETURN_FLOAT8(
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -133,7 +133,7 @@ gbt_inet_consistent(PG_FUNCTION_ARGS)
|
||||
key.upper = (GBT_NUMKEY *) &kkk->upper;
|
||||
|
||||
PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query,
|
||||
&strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
|
||||
&strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
|
||||
}
|
||||
|
||||
|
||||
|
@@ -170,7 +170,7 @@ gbt_int2_distance(PG_FUNCTION_ARGS)
|
||||
key.upper = (GBT_NUMKEY *) &kkk->upper;
|
||||
|
||||
PG_RETURN_FLOAT8(
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -171,7 +171,7 @@ gbt_int4_distance(PG_FUNCTION_ARGS)
|
||||
key.upper = (GBT_NUMKEY *) &kkk->upper;
|
||||
|
||||
PG_RETURN_FLOAT8(
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -171,7 +171,7 @@ gbt_int8_distance(PG_FUNCTION_ARGS)
|
||||
key.upper = (GBT_NUMKEY *) &kkk->upper;
|
||||
|
||||
PG_RETURN_FLOAT8(
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -245,7 +245,7 @@ gbt_intv_distance(PG_FUNCTION_ARGS)
|
||||
key.upper = (GBT_NUMKEY *) &kkk->upper;
|
||||
|
||||
PG_RETURN_FLOAT8(
|
||||
gbt_num_distance(&key, (void *) query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
gbt_num_distance(&key, (void *) query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -171,7 +171,7 @@ gbt_oid_distance(PG_FUNCTION_ARGS)
|
||||
key.upper = (GBT_NUMKEY *) &kkk->upper;
|
||||
|
||||
PG_RETURN_FLOAT8(
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -235,7 +235,7 @@ gbt_time_distance(PG_FUNCTION_ARGS)
|
||||
key.upper = (GBT_NUMKEY *) &kkk->upper;
|
||||
|
||||
PG_RETURN_FLOAT8(
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -283,7 +283,7 @@ gbt_ts_distance(PG_FUNCTION_ARGS)
|
||||
key.upper = (GBT_NUMKEY *) &kkk->upper;
|
||||
|
||||
PG_RETURN_FLOAT8(
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ gbt_tstz_distance(PG_FUNCTION_ARGS)
|
||||
qqq = tstz_to_ts_gmt(query);
|
||||
|
||||
PG_RETURN_FLOAT8(
|
||||
gbt_num_distance(&key, (void *) &qqq, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
gbt_num_distance(&key, (void *) &qqq, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -42,13 +42,13 @@ typedef struct
|
||||
|
||||
/* Methods */
|
||||
|
||||
bool (*f_gt) (const void *, const void *, FmgrInfo *); /* greater than */
|
||||
bool (*f_ge) (const void *, const void *, FmgrInfo *); /* greater or equal */
|
||||
bool (*f_eq) (const void *, const void *, FmgrInfo *); /* equal */
|
||||
bool (*f_le) (const void *, const void *, FmgrInfo *); /* less or equal */
|
||||
bool (*f_lt) (const void *, const void *, FmgrInfo *); /* less than */
|
||||
int (*f_cmp) (const void *, const void *, FmgrInfo *); /* key compare function */
|
||||
float8 (*f_dist) (const void *, const void *, FmgrInfo *); /* key distance function */
|
||||
bool (*f_gt) (const void *, const void *, FmgrInfo *); /* greater than */
|
||||
bool (*f_ge) (const void *, const void *, FmgrInfo *); /* greater or equal */
|
||||
bool (*f_eq) (const void *, const void *, FmgrInfo *); /* equal */
|
||||
bool (*f_le) (const void *, const void *, FmgrInfo *); /* less or equal */
|
||||
bool (*f_lt) (const void *, const void *, FmgrInfo *); /* less than */
|
||||
int (*f_cmp) (const void *, const void *, FmgrInfo *); /* key compare function */
|
||||
float8 (*f_dist) (const void *, const void *, FmgrInfo *); /* key distance function */
|
||||
} gbtree_ninfo;
|
||||
|
||||
|
||||
|
@@ -25,7 +25,7 @@ typedef struct
|
||||
{
|
||||
const gbtree_vinfo *tinfo;
|
||||
Oid collation;
|
||||
FmgrInfo *flinfo;
|
||||
FmgrInfo *flinfo;
|
||||
} gbt_vsrt_arg;
|
||||
|
||||
|
||||
@@ -402,8 +402,8 @@ gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n,
|
||||
*res = 0.0;
|
||||
else if (!(((*tinfo->f_cmp) (nk.lower, ok.lower, collation, flinfo) >= 0 ||
|
||||
gbt_bytea_pf_match(ok.lower, nk.lower, tinfo)) &&
|
||||
((*tinfo->f_cmp) (nk.upper, ok.upper, collation, flinfo) <= 0 ||
|
||||
gbt_bytea_pf_match(ok.upper, nk.upper, tinfo))))
|
||||
((*tinfo->f_cmp) (nk.upper, ok.upper, collation, flinfo) <= 0 ||
|
||||
gbt_bytea_pf_match(ok.upper, nk.upper, tinfo))))
|
||||
{
|
||||
Datum d = PointerGetDatum(0);
|
||||
double dres;
|
||||
|
@@ -34,12 +34,12 @@ typedef struct
|
||||
|
||||
/* Methods */
|
||||
|
||||
bool (*f_gt) (const void *, const void *, Oid, FmgrInfo *); /* greater than */
|
||||
bool (*f_ge) (const void *, const void *, Oid, FmgrInfo *); /* greater equal */
|
||||
bool (*f_eq) (const void *, const void *, Oid, FmgrInfo *); /* equal */
|
||||
bool (*f_le) (const void *, const void *, Oid, FmgrInfo *); /* less equal */
|
||||
bool (*f_lt) (const void *, const void *, Oid, FmgrInfo *); /* less than */
|
||||
int32 (*f_cmp) (const void *, const void *, Oid, FmgrInfo *); /* compare */
|
||||
bool (*f_gt) (const void *, const void *, Oid, FmgrInfo *); /* greater than */
|
||||
bool (*f_ge) (const void *, const void *, Oid, FmgrInfo *); /* greater equal */
|
||||
bool (*f_eq) (const void *, const void *, Oid, FmgrInfo *); /* equal */
|
||||
bool (*f_le) (const void *, const void *, Oid, FmgrInfo *); /* less equal */
|
||||
bool (*f_lt) (const void *, const void *, Oid, FmgrInfo *); /* less than */
|
||||
int32 (*f_cmp) (const void *, const void *, Oid, FmgrInfo *); /* compare */
|
||||
GBT_VARKEY *(*f_l2n) (GBT_VARKEY *, FmgrInfo *flinfo); /* convert leaf to node */
|
||||
} gbtree_vinfo;
|
||||
|
||||
|
@@ -150,7 +150,7 @@ gbt_uuid_consistent(PG_FUNCTION_ARGS)
|
||||
|
||||
PG_RETURN_BOOL(
|
||||
gbt_num_consistent(&key, (void *) query, &strategy,
|
||||
GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -113,7 +113,7 @@ static char *generate_relation_name(Relation rel);
|
||||
static void dblink_connstr_check(const char *connstr);
|
||||
static void dblink_security_check(PGconn *conn, remoteConn *rconn);
|
||||
static void dblink_res_error(PGconn *conn, const char *conname, PGresult *res,
|
||||
const char *dblink_context_msg, bool fail);
|
||||
const char *dblink_context_msg, bool fail);
|
||||
static char *get_connect_string(const char *servername);
|
||||
static char *escape_param_str(const char *from);
|
||||
static void validate_pkattnums(Relation rel,
|
||||
@@ -152,16 +152,19 @@ xpstrdup(const char *in)
|
||||
return pstrdup(in);
|
||||
}
|
||||
|
||||
static void pg_attribute_noreturn()
|
||||
static void
|
||||
pg_attribute_noreturn()
|
||||
dblink_res_internalerror(PGconn *conn, PGresult *res, const char *p2)
|
||||
{
|
||||
char *msg = pchomp(PQerrorMessage(conn));
|
||||
|
||||
if (res)
|
||||
PQclear(res);
|
||||
elog(ERROR, "%s: %s", p2, msg);
|
||||
}
|
||||
|
||||
static void pg_attribute_noreturn()
|
||||
static void
|
||||
pg_attribute_noreturn()
|
||||
dblink_conn_not_avail(const char *conname)
|
||||
{
|
||||
if (conname)
|
||||
@@ -176,7 +179,7 @@ dblink_conn_not_avail(const char *conname)
|
||||
|
||||
static void
|
||||
dblink_get_conn(char *conname_or_str,
|
||||
PGconn * volatile *conn_p, char **conname_p, volatile bool *freeconn_p)
|
||||
PGconn *volatile * conn_p, char **conname_p, volatile bool *freeconn_p)
|
||||
{
|
||||
remoteConn *rconn = getConnectionByName(conname_or_str);
|
||||
PGconn *conn;
|
||||
@@ -201,11 +204,12 @@ dblink_get_conn(char *conname_or_str,
|
||||
if (PQstatus(conn) == CONNECTION_BAD)
|
||||
{
|
||||
char *msg = pchomp(PQerrorMessage(conn));
|
||||
|
||||
PQfinish(conn);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
|
||||
errmsg("could not establish connection"),
|
||||
errdetail_internal("%s", msg)));
|
||||
(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
|
||||
errmsg("could not establish connection"),
|
||||
errdetail_internal("%s", msg)));
|
||||
}
|
||||
dblink_security_check(conn, rconn);
|
||||
if (PQclientEncoding(conn) != GetDatabaseEncoding())
|
||||
@@ -223,11 +227,12 @@ static PGconn *
|
||||
dblink_get_named_conn(const char *conname)
|
||||
{
|
||||
remoteConn *rconn = getConnectionByName(conname);
|
||||
|
||||
if (rconn)
|
||||
return rconn->conn;
|
||||
|
||||
dblink_conn_not_avail(conname);
|
||||
return NULL; /* keep compiler quiet */
|
||||
return NULL; /* keep compiler quiet */
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2699,9 +2704,9 @@ dblink_res_error(PGconn *conn, const char *conname, PGresult *res,
|
||||
message_context = xpstrdup(pg_diag_context);
|
||||
|
||||
/*
|
||||
* If we don't get a message from the PGresult, try the PGconn. This
|
||||
* is needed because for connection-level failures, PQexec may just
|
||||
* return NULL, not a PGresult at all.
|
||||
* If we don't get a message from the PGresult, try the PGconn. This is
|
||||
* needed because for connection-level failures, PQexec may just return
|
||||
* NULL, not a PGresult at all.
|
||||
*/
|
||||
if (message_primary == NULL)
|
||||
message_primary = pchomp(PQerrorMessage(conn));
|
||||
@@ -2732,7 +2737,7 @@ get_connect_string(const char *servername)
|
||||
ForeignServer *foreign_server = NULL;
|
||||
UserMapping *user_mapping;
|
||||
ListCell *cell;
|
||||
StringInfoData buf;
|
||||
StringInfoData buf;
|
||||
ForeignDataWrapper *fdw;
|
||||
AclResult aclresult;
|
||||
char *srvname;
|
||||
@@ -2820,7 +2825,7 @@ static char *
|
||||
escape_param_str(const char *str)
|
||||
{
|
||||
const char *cp;
|
||||
StringInfoData buf;
|
||||
StringInfoData buf;
|
||||
|
||||
initStringInfo(&buf);
|
||||
|
||||
|
@@ -507,7 +507,7 @@ sql_exec_searchtables(PGconn *conn, struct options * opts)
|
||||
todo = psprintf(
|
||||
"SELECT pg_catalog.pg_relation_filenode(c.oid) as \"Filenode\", relname as \"Table Name\" %s\n"
|
||||
"FROM pg_catalog.pg_class c\n"
|
||||
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"
|
||||
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"
|
||||
" LEFT JOIN pg_catalog.pg_database d ON d.datname = pg_catalog.current_database(),\n"
|
||||
" pg_catalog.pg_tablespace t\n"
|
||||
"WHERE relkind IN (" CppAsString2(RELKIND_RELATION) ","
|
||||
|
@@ -226,8 +226,8 @@ brin_page_items(PG_FUNCTION_ARGS)
|
||||
if (ItemIdIsUsed(itemId))
|
||||
{
|
||||
dtup = brin_deform_tuple(bdesc,
|
||||
(BrinTuple *) PageGetItem(page, itemId),
|
||||
NULL);
|
||||
(BrinTuple *) PageGetItem(page, itemId),
|
||||
NULL);
|
||||
attno = 1;
|
||||
unusedItem = false;
|
||||
}
|
||||
|
@@ -34,10 +34,10 @@ PG_FUNCTION_INFO_V1(hash_metapage_info);
|
||||
*/
|
||||
typedef struct HashPageStat
|
||||
{
|
||||
int live_items;
|
||||
int dead_items;
|
||||
int page_size;
|
||||
int free_size;
|
||||
int live_items;
|
||||
int dead_items;
|
||||
int page_size;
|
||||
int free_size;
|
||||
|
||||
/* opaque data */
|
||||
BlockNumber hasho_prevblkno;
|
||||
@@ -45,7 +45,7 @@ typedef struct HashPageStat
|
||||
Bucket hasho_bucket;
|
||||
uint16 hasho_flag;
|
||||
uint16 hasho_page_id;
|
||||
} HashPageStat;
|
||||
} HashPageStat;
|
||||
|
||||
|
||||
/*
|
||||
@@ -99,7 +99,7 @@ verify_hash_page(bytea *raw_page, int flags)
|
||||
case LH_BUCKET_PAGE | LH_OVERFLOW_PAGE:
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("page is not a hash bucket or overflow page")));
|
||||
errmsg("page is not a hash bucket or overflow page")));
|
||||
case LH_OVERFLOW_PAGE:
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
@@ -107,7 +107,7 @@ verify_hash_page(bytea *raw_page, int flags)
|
||||
default:
|
||||
elog(ERROR,
|
||||
"hash page of type %08x not in mask %08x",
|
||||
pagetype, flags);
|
||||
pagetype, flags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ verify_hash_page(bytea *raw_page, int flags)
|
||||
* -------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
GetHashPageStatistics(Page page, HashPageStat * stat)
|
||||
GetHashPageStatistics(Page page, HashPageStat *stat)
|
||||
{
|
||||
OffsetNumber maxoff = PageGetMaxOffsetNumber(page);
|
||||
HashPageOpaque opaque = (HashPageOpaque) PageGetSpecialPointer(page);
|
||||
@@ -515,8 +515,8 @@ hash_metapage_info(PG_FUNCTION_ARGS)
|
||||
j;
|
||||
Datum values[16];
|
||||
bool nulls[16];
|
||||
Datum spares[HASH_MAX_SPLITPOINTS];
|
||||
Datum mapp[HASH_MAX_BITMAPS];
|
||||
Datum spares[HASH_MAX_SPLITPOINTS];
|
||||
Datum mapp[HASH_MAX_BITMAPS];
|
||||
|
||||
if (!superuser())
|
||||
ereport(ERROR,
|
||||
|
@@ -311,9 +311,9 @@ page_checksum(PG_FUNCTION_ARGS)
|
||||
if (raw_page_size != BLCKSZ)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("incorrect size of input page (%d bytes)", raw_page_size)));
|
||||
errmsg("incorrect size of input page (%d bytes)", raw_page_size)));
|
||||
|
||||
page = (PageHeader) VARDATA(raw_page);
|
||||
|
||||
PG_RETURN_INT16(pg_checksum_page((char *)page, blkno));
|
||||
PG_RETURN_INT16(pg_checksum_page((char *) page, blkno));
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ char *xlogFilePath; /* where we are going to restore to */
|
||||
char *nextWALFileName; /* the file we need to get from archive */
|
||||
char *restartWALFileName; /* the file from which we can restart restore */
|
||||
char *priorWALFileName; /* the file we need to get from archive */
|
||||
char WALFilePath[MAXPGPATH * 2]; /* the file path including archive */
|
||||
char WALFilePath[MAXPGPATH * 2]; /* the file path including archive */
|
||||
char restoreCommand[MAXPGPATH]; /* run this to restore */
|
||||
char exclusiveCleanupFileName[MAXFNAMELEN]; /* the file we need to
|
||||
* get from archive */
|
||||
|
@@ -774,6 +774,6 @@ check_relation_relkind(Relation rel)
|
||||
rel->rd_rel->relkind != RELKIND_TOASTVALUE)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("\"%s\" is not a table, materialized view, or TOAST table",
|
||||
RelationGetRelationName(rel))));
|
||||
errmsg("\"%s\" is not a table, materialized view, or TOAST table",
|
||||
RelationGetRelationName(rel))));
|
||||
}
|
||||
|
@@ -238,7 +238,7 @@ px_find_digest(const char *name, PX_MD **res)
|
||||
* prototype for the EVP functions that return an algorithm, e.g.
|
||||
* EVP_aes_128_cbc().
|
||||
*/
|
||||
typedef const EVP_CIPHER *(*ossl_EVP_cipher_func)(void);
|
||||
typedef const EVP_CIPHER *(*ossl_EVP_cipher_func) (void);
|
||||
|
||||
/*
|
||||
* ossl_cipher contains the static information about each cipher.
|
||||
@@ -706,13 +706,15 @@ static const struct ossl_cipher ossl_cast_cbc = {
|
||||
|
||||
static const struct ossl_cipher ossl_aes_ecb = {
|
||||
ossl_aes_ecb_init,
|
||||
NULL, /* EVP_aes_XXX_ecb(), determined in init function */
|
||||
NULL, /* EVP_aes_XXX_ecb(), determined in init
|
||||
* function */
|
||||
128 / 8, 256 / 8
|
||||
};
|
||||
|
||||
static const struct ossl_cipher ossl_aes_cbc = {
|
||||
ossl_aes_cbc_init,
|
||||
NULL, /* EVP_aes_XXX_cbc(), determined in init function */
|
||||
NULL, /* EVP_aes_XXX_cbc(), determined in init
|
||||
* function */
|
||||
128 / 8, 256 / 8
|
||||
};
|
||||
|
||||
|
@@ -454,8 +454,8 @@ pg_random_uuid(PG_FUNCTION_ARGS)
|
||||
uint8 *buf = (uint8 *) palloc(UUID_LEN);
|
||||
|
||||
/*
|
||||
* Generate random bits. pg_backend_random() will do here, we don't
|
||||
* promis UUIDs to be cryptographically random, when built with
|
||||
* Generate random bits. pg_backend_random() will do here, we don't promis
|
||||
* UUIDs to be cryptographically random, when built with
|
||||
* --disable-strong-random.
|
||||
*/
|
||||
if (!pg_backend_random((char *) buf, UUID_LEN))
|
||||
|
@@ -99,7 +99,10 @@ pgrowlocks(PG_FUNCTION_ARGS)
|
||||
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
|
||||
rel = heap_openrv(relrv, AccessShareLock);
|
||||
|
||||
/* check permissions: must have SELECT on table or be in pg_stat_scan_tables */
|
||||
/*
|
||||
* check permissions: must have SELECT on table or be in
|
||||
* pg_stat_scan_tables
|
||||
*/
|
||||
aclresult = pg_class_aclcheck(RelationGetRelid(rel), GetUserId(),
|
||||
ACL_SELECT);
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
|
@@ -31,7 +31,7 @@
|
||||
PG_FUNCTION_INFO_V1(pgstattuple_approx);
|
||||
PG_FUNCTION_INFO_V1(pgstattuple_approx_v1_5);
|
||||
|
||||
Datum pgstattuple_approx_internal(Oid relid, FunctionCallInfo fcinfo);
|
||||
Datum pgstattuple_approx_internal(Oid relid, FunctionCallInfo fcinfo);
|
||||
|
||||
typedef struct output_type
|
||||
{
|
||||
|
@@ -64,7 +64,7 @@ PG_FUNCTION_INFO_V1(pg_relpages_v1_5);
|
||||
PG_FUNCTION_INFO_V1(pg_relpagesbyid_v1_5);
|
||||
PG_FUNCTION_INFO_V1(pgstatginindex_v1_5);
|
||||
|
||||
Datum pgstatginindex_internal(Oid relid, FunctionCallInfo fcinfo);
|
||||
Datum pgstatginindex_internal(Oid relid, FunctionCallInfo fcinfo);
|
||||
|
||||
#define IS_INDEX(r) ((r)->rd_rel->relkind == RELKIND_INDEX)
|
||||
#define IS_BTREE(r) ((r)->rd_rel->relam == BTREE_AM_OID)
|
||||
@@ -113,17 +113,17 @@ typedef struct GinIndexStat
|
||||
*/
|
||||
typedef struct HashIndexStat
|
||||
{
|
||||
int32 version;
|
||||
int32 space_per_page;
|
||||
int32 version;
|
||||
int32 space_per_page;
|
||||
|
||||
BlockNumber bucket_pages;
|
||||
BlockNumber bucket_pages;
|
||||
BlockNumber overflow_pages;
|
||||
BlockNumber bitmap_pages;
|
||||
BlockNumber unused_pages;
|
||||
|
||||
int64 live_items;
|
||||
int64 dead_items;
|
||||
uint64 free_space;
|
||||
int64 live_items;
|
||||
int64 dead_items;
|
||||
uint64 free_space;
|
||||
} HashIndexStat;
|
||||
|
||||
static Datum pgstatindex_impl(Relation rel, FunctionCallInfo fcinfo);
|
||||
@@ -581,8 +581,8 @@ Datum
|
||||
pgstathashindex(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Oid relid = PG_GETARG_OID(0);
|
||||
BlockNumber nblocks;
|
||||
BlockNumber blkno;
|
||||
BlockNumber nblocks;
|
||||
BlockNumber blkno;
|
||||
Relation rel;
|
||||
HashIndexStat stats;
|
||||
BufferAccessStrategy bstrategy;
|
||||
@@ -591,7 +591,7 @@ pgstathashindex(PG_FUNCTION_ARGS)
|
||||
Datum values[8];
|
||||
bool nulls[8];
|
||||
Buffer metabuf;
|
||||
HashMetaPage metap;
|
||||
HashMetaPage metap;
|
||||
float8 free_percent;
|
||||
uint64 total_space;
|
||||
|
||||
@@ -648,13 +648,13 @@ pgstathashindex(PG_FUNCTION_ARGS)
|
||||
MAXALIGN(sizeof(HashPageOpaqueData)))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INDEX_CORRUPTED),
|
||||
errmsg("index \"%s\" contains corrupted page at block %u",
|
||||
RelationGetRelationName(rel),
|
||||
BufferGetBlockNumber(buf))));
|
||||
errmsg("index \"%s\" contains corrupted page at block %u",
|
||||
RelationGetRelationName(rel),
|
||||
BufferGetBlockNumber(buf))));
|
||||
else
|
||||
{
|
||||
HashPageOpaque opaque;
|
||||
int pagetype;
|
||||
HashPageOpaque opaque;
|
||||
int pagetype;
|
||||
|
||||
opaque = (HashPageOpaque) PageGetSpecialPointer(page);
|
||||
pagetype = opaque->hasho_flag & LH_PAGE_TYPE;
|
||||
@@ -676,9 +676,9 @@ pgstathashindex(PG_FUNCTION_ARGS)
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INDEX_CORRUPTED),
|
||||
errmsg("unexpected page type 0x%04X in HASH index \"%s\" block %u",
|
||||
errmsg("unexpected page type 0x%04X in HASH index \"%s\" block %u",
|
||||
opaque->hasho_flag, RelationGetRelationName(rel),
|
||||
BufferGetBlockNumber(buf))));
|
||||
BufferGetBlockNumber(buf))));
|
||||
}
|
||||
UnlockReleaseBuffer(buf);
|
||||
}
|
||||
@@ -735,12 +735,12 @@ static void
|
||||
GetHashPageStats(Page page, HashIndexStat *stats)
|
||||
{
|
||||
OffsetNumber maxoff = PageGetMaxOffsetNumber(page);
|
||||
int off;
|
||||
int off;
|
||||
|
||||
/* count live and dead tuples, and free space */
|
||||
for (off = FirstOffsetNumber; off <= maxoff; off++)
|
||||
{
|
||||
ItemId id = PageGetItemId(page, off);
|
||||
ItemId id = PageGetItemId(page, off);
|
||||
|
||||
if (!ItemIdIsDead(id))
|
||||
stats->live_items++;
|
||||
|
@@ -171,8 +171,8 @@ static void deparseFromExprForRel(StringInfo buf, PlannerInfo *root,
|
||||
RelOptInfo *joinrel, bool use_alias, List **params_list);
|
||||
static void deparseFromExpr(List *quals, deparse_expr_cxt *context);
|
||||
static void deparseRangeTblRef(StringInfo buf, PlannerInfo *root,
|
||||
RelOptInfo *foreignrel, bool make_subquery,
|
||||
List **params_list);
|
||||
RelOptInfo *foreignrel, bool make_subquery,
|
||||
List **params_list);
|
||||
static void deparseAggref(Aggref *node, deparse_expr_cxt *context);
|
||||
static void appendGroupByClause(List *tlist, deparse_expr_cxt *context);
|
||||
static void appendAggOrderBy(List *orderList, List *targetList,
|
||||
@@ -185,9 +185,9 @@ static Node *deparseSortGroupClause(Index ref, List *tlist,
|
||||
* Helper functions
|
||||
*/
|
||||
static bool is_subquery_var(Var *node, RelOptInfo *foreignrel,
|
||||
int *relno, int *colno);
|
||||
int *relno, int *colno);
|
||||
static void get_relation_column_alias_ids(Var *node, RelOptInfo *foreignrel,
|
||||
int *relno, int *colno);
|
||||
int *relno, int *colno);
|
||||
|
||||
|
||||
/*
|
||||
@@ -1017,8 +1017,8 @@ deparseSelectSql(List *tlist, bool is_subquery, List **retrieved_attrs,
|
||||
{
|
||||
/*
|
||||
* For a relation that is deparsed as a subquery, emit expressions
|
||||
* specified in the relation's reltarget. Note that since this is
|
||||
* for the subquery, no need to care about *retrieved_attrs.
|
||||
* specified in the relation's reltarget. Note that since this is for
|
||||
* the subquery, no need to care about *retrieved_attrs.
|
||||
*/
|
||||
deparseSubqueryTargetList(context);
|
||||
}
|
||||
@@ -2189,8 +2189,8 @@ deparseVar(Var *node, deparse_expr_cxt *context)
|
||||
|
||||
/*
|
||||
* If the Var belongs to the foreign relation that is deparsed as a
|
||||
* subquery, use the relation and column alias to the Var provided
|
||||
* by the subquery, instead of the remote name.
|
||||
* subquery, use the relation and column alias to the Var provided by the
|
||||
* subquery, instead of the remote name.
|
||||
*/
|
||||
if (is_subquery_var(node, context->scanrel, &relno, &colno))
|
||||
{
|
||||
|
@@ -417,8 +417,8 @@ static void add_foreign_grouping_paths(PlannerInfo *root,
|
||||
static void apply_server_options(PgFdwRelationInfo *fpinfo);
|
||||
static void apply_table_options(PgFdwRelationInfo *fpinfo);
|
||||
static void merge_fdw_options(PgFdwRelationInfo *fpinfo,
|
||||
const PgFdwRelationInfo *fpinfo_o,
|
||||
const PgFdwRelationInfo *fpinfo_i);
|
||||
const PgFdwRelationInfo *fpinfo_o,
|
||||
const PgFdwRelationInfo *fpinfo_i);
|
||||
|
||||
|
||||
/*
|
||||
@@ -4170,8 +4170,8 @@ foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype,
|
||||
fpinfo->jointype = jointype;
|
||||
|
||||
/*
|
||||
* By default, both the input relations are not required to be deparsed
|
||||
* as subqueries, but there might be some relations covered by the input
|
||||
* By default, both the input relations are not required to be deparsed as
|
||||
* subqueries, but there might be some relations covered by the input
|
||||
* relations that are required to be deparsed as subqueries, so save the
|
||||
* relids of those relations for later use by the deparser.
|
||||
*/
|
||||
@@ -4227,8 +4227,8 @@ foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype,
|
||||
case JOIN_FULL:
|
||||
|
||||
/*
|
||||
* In this case, if any of the input relations has conditions,
|
||||
* we need to deparse that relation as a subquery so that the
|
||||
* In this case, if any of the input relations has conditions, we
|
||||
* need to deparse that relation as a subquery so that the
|
||||
* conditions can be evaluated before the join. Remember it in
|
||||
* the fpinfo of this relation so that the deparser can take
|
||||
* appropriate action. Also, save the relids of base relations
|
||||
@@ -4305,7 +4305,7 @@ foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype,
|
||||
* Note that since this joinrel is at the end of the join_rel_list list
|
||||
* when we are called, we can get the position by list_length.
|
||||
*/
|
||||
Assert(fpinfo->relation_index == 0); /* shouldn't be set yet */
|
||||
Assert(fpinfo->relation_index == 0); /* shouldn't be set yet */
|
||||
fpinfo->relation_index =
|
||||
list_length(root->parse->rtable) + list_length(root->join_rel_list);
|
||||
|
||||
@@ -4354,7 +4354,7 @@ add_paths_with_pathkeys_for_rel(PlannerInfo *root, RelOptInfo *rel,
|
||||
static void
|
||||
apply_server_options(PgFdwRelationInfo *fpinfo)
|
||||
{
|
||||
ListCell *lc;
|
||||
ListCell *lc;
|
||||
|
||||
foreach(lc, fpinfo->server->options)
|
||||
{
|
||||
@@ -4382,7 +4382,7 @@ apply_server_options(PgFdwRelationInfo *fpinfo)
|
||||
static void
|
||||
apply_table_options(PgFdwRelationInfo *fpinfo)
|
||||
{
|
||||
ListCell *lc;
|
||||
ListCell *lc;
|
||||
|
||||
foreach(lc, fpinfo->table->options)
|
||||
{
|
||||
@@ -4439,7 +4439,7 @@ merge_fdw_options(PgFdwRelationInfo *fpinfo,
|
||||
* best.
|
||||
*/
|
||||
fpinfo->use_remote_estimate = fpinfo_o->use_remote_estimate ||
|
||||
fpinfo_i->use_remote_estimate;
|
||||
fpinfo_i->use_remote_estimate;
|
||||
|
||||
/*
|
||||
* Set fetch size to maximum of the joining sides, since we are
|
||||
@@ -4869,7 +4869,7 @@ add_foreign_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
|
||||
fpinfo->table = ifpinfo->table;
|
||||
fpinfo->server = ifpinfo->server;
|
||||
fpinfo->user = ifpinfo->user;
|
||||
merge_fdw_options(fpinfo, ifpinfo , NULL);
|
||||
merge_fdw_options(fpinfo, ifpinfo, NULL);
|
||||
|
||||
/* Assess if it is safe to push down aggregation and grouping. */
|
||||
if (!foreign_grouping_ok(root, grouped_rel))
|
||||
|
@@ -96,9 +96,9 @@ typedef struct PgFdwRelationInfo
|
||||
List *grouped_tlist;
|
||||
|
||||
/* Subquery information */
|
||||
bool make_outerrel_subquery; /* do we deparse outerrel as a
|
||||
bool make_outerrel_subquery; /* do we deparse outerrel as a
|
||||
* subquery? */
|
||||
bool make_innerrel_subquery; /* do we deparse innerrel as a
|
||||
bool make_innerrel_subquery; /* do we deparse innerrel as a
|
||||
* subquery? */
|
||||
Relids lower_subquery_rels; /* all relids appearing in lower
|
||||
* subqueries */
|
||||
|
Reference in New Issue
Block a user