Skip to content
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
320 changes: 143 additions & 177 deletions configure

Large diffs are not rendered by default.

28 changes: 2 additions & 26 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ m4_pattern_forbid(^PGAC_)dnl to catch undefined macros
dnl The PACKAGE_VERSION from upstream PostgreSQL is maintained in the
dnl PG_PACKAGE_VERSION variable, when merging make sure to update this
dnl variable with the merge conflict from the AC_INIT() statement.
AC_INIT([Greenplum Database], [7.0.0-alpha.0], [support@greenplum.org])
[PG_PACKAGE_VERSION=12beta2]
AC_INIT([Greenplum Database], [8.0.0-alpha.0], [support@greenplum.org])
[PG_PACKAGE_VERSION=13alpha0]
AC_SUBST(PG_PACKAGE_VERSION)

dnl m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required.
Expand Down Expand Up @@ -1155,30 +1155,6 @@ PGAC_ARG_REQ(with, apr-config,
[PATH], [path to apr-1-config utility])
AC_SUBST(with_apr_config)

#
# Elf
#

# Assume system is ELF if it predefines __ELF__ as 1,
# otherwise believe host_os based default.
case $host_os in
freebsd1*|freebsd2*) elf=no;;
freebsd3*|freebsd4*) elf=yes;;
esac

AC_EGREP_CPP(yes,
[#if __ELF__
yes
#endif
],
[ELF_SYS=true],
[if test "X$elf" = "Xyes" ; then
ELF_SYS=true
else
ELF_SYS=
fi])
AC_SUBST(ELF_SYS)

#
# Assignments
#
Expand Down
16 changes: 11 additions & 5 deletions contrib/amcheck/verify_nbtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,20 @@ bt_check_every_level(Relation rel, Relation heaprel, bool heapkeyspace,

if (state->heapallindexed)
{
int64 total_pages;
int64 total_elems;
uint64 seed;

/* Size Bloom filter based on estimated number of tuples in index */
total_elems = (int64) state->rel->rd_rel->reltuples;
/*
* Size Bloom filter based on estimated number of tuples in index,
* while conservatively assuming that each block must contain at least
* MaxIndexTuplesPerPage / 5 non-pivot tuples. (Non-leaf pages cannot
* contain non-pivot tuples. That's okay because they generally make
* up no more than about 1% of all pages in the index.)
*/
total_pages = RelationGetNumberOfBlocks(rel);
total_elems = Max(total_pages * (MaxIndexTuplesPerPage / 5),
(int64) state->rel->rd_rel->reltuples);
/* Random seed relies on backend srandom() call to avoid repetition */
seed = random();
/* Create Bloom filter to fingerprint index */
Expand Down Expand Up @@ -425,8 +434,6 @@ bt_check_every_level(Relation rel, Relation heaprel, bool heapkeyspace,
}
else
{
int64 total_pages;

/*
* Extra readonly downlink check.
*
Expand All @@ -437,7 +444,6 @@ bt_check_every_level(Relation rel, Relation heaprel, bool heapkeyspace,
* splits and page deletions, though. This is taken care of in
* bt_downlink_missing_check().
*/
total_pages = (int64) state->rel->rd_rel->relpages;
state->downlinkfilter = bloom_create(total_pages, work_mem, seed);
}
}
Expand Down
4 changes: 2 additions & 2 deletions contrib/cube/cube.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ bool g_cube_leaf_consistent(NDBOX *key, NDBOX *query, StrategyNumber strategy);
bool g_cube_internal_consistent(NDBOX *key, NDBOX *query, StrategyNumber strategy);

/*
** Auxiliary funxtions
** Auxiliary functions
*/
static double distance_1D(double a1, double a2, double b1, double b2);
static bool cube_is_point_internal(NDBOX *cube);
Expand Down Expand Up @@ -590,7 +590,7 @@ g_cube_picksplit(PG_FUNCTION_ARGS)
v->spl_nright++;
}
}
*left = *right = FirstOffsetNumber; /* sentinel value, see dosplit() */
*left = *right = FirstOffsetNumber; /* sentinel value */

v->spl_ldatum = PointerGetDatum(datum_l);
v->spl_rdatum = PointerGetDatum(datum_r);
Expand Down
9 changes: 3 additions & 6 deletions contrib/file_fdw/file_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,7 @@ fileGetOptions(Oid foreigntableid,
ForeignServer *server;
ForeignDataWrapper *wrapper;
List *options;
ListCell *lc,
*prev;
ListCell *lc;

/*
* Extract options from FDW objects. We ignore user mappings because
Expand All @@ -388,25 +387,23 @@ fileGetOptions(Oid foreigntableid,
*/
*filename = NULL;
*is_program = false;
prev = NULL;
foreach(lc, options)
{
DefElem *def = (DefElem *) lfirst(lc);

if (strcmp(def->defname, "filename") == 0)
{
*filename = defGetString(def);
options = list_delete_cell(options, lc, prev);
options = foreach_delete_current(options, lc);
break;
}
else if (strcmp(def->defname, "program") == 0)
{
*filename = defGetString(def);
*is_program = true;
options = list_delete_cell(options, lc, prev);
options = foreach_delete_current(options, lc);
break;
}
prev = lc;
}

/*
Expand Down
6 changes: 0 additions & 6 deletions contrib/intarray/_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ typedef struct

#define GETSIGN(x) ( (BITVECP)( (char*)x+GTHDRSIZE ) )

/*
* types for functions
*/
typedef ArrayType *(*formarray) (ArrayType *, ArrayType *);
typedef void (*formfloat) (ArrayType *, float *);

/*
* useful functions
*/
Expand Down
2 changes: 1 addition & 1 deletion contrib/jsonb_plperl/jsonb_plperlu--1.0.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* contrib/json_plperl/jsonb_plperl--1.0.sql */
/* contrib/jsonb_plperl/jsonb_plperlu--1.0.sql */

-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION jsonb_plperlu" to load this file. \quit
Expand Down
2 changes: 1 addition & 1 deletion contrib/ltree/ltxtquery_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ queryin(char *buf)
state.str = tmp;
}

/* set user friendly-operand view */
/* set user-friendly operand view */
memcpy((void *) GETOPERAND(query), (void *) state.op, state.sumlen);
pfree(state.op);

Expand Down
20 changes: 20 additions & 0 deletions contrib/passwordcheck/passwordcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@

PG_MODULE_MAGIC;

/* Saved hook value in case of unload */
static check_password_hook_type prev_check_password_hook = NULL;

/* passwords shorter than this will be rejected */
#define MIN_PWD_LENGTH 8

extern void _PG_init(void);
extern void _PG_fini(void);

/*
* check_password
Expand All @@ -55,6 +59,11 @@ check_password(const char *username,
Datum validuntil_time,
bool validuntil_null)
{
if (prev_check_password_hook)
prev_check_password_hook(username, shadow_pass,
password_type, validuntil_time,
validuntil_null);

if (password_type != PASSWORD_TYPE_PLAINTEXT)
{
/*
Expand Down Expand Up @@ -133,5 +142,16 @@ void
_PG_init(void)
{
/* activate password checks when the module is loaded */
prev_check_password_hook = check_password_hook;
check_password_hook = check_password;
}

/*
* Module unload function
*/
void
_PG_fini(void)
{
/* uninstall hook */
check_password_hook = prev_check_password_hook;
}
87 changes: 87 additions & 0 deletions contrib/pg_stat_statements/expected/pg_stat_statements.out
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,93 @@ SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C";
SELECT pg_stat_statements_reset() | 1 | 1
(5 rows)

--
-- queries with locking clauses
--
CREATE TABLE pgss_a (id integer PRIMARY KEY);
CREATE TABLE pgss_b (id integer PRIMARY KEY, a_id integer REFERENCES pgss_a);
SELECT pg_stat_statements_reset();
pg_stat_statements_reset
--------------------------

(1 row)

-- control query
SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id;
id | id | a_id
----+----+------
(0 rows)

-- test range tables
SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR UPDATE;
id | id | a_id
----+----+------
(0 rows)

SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR UPDATE OF pgss_a;
id | id | a_id
----+----+------
(0 rows)

SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR UPDATE OF pgss_b;
id | id | a_id
----+----+------
(0 rows)

SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR UPDATE OF pgss_a, pgss_b; -- matches plain "FOR UPDATE"
id | id | a_id
----+----+------
(0 rows)

SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR UPDATE OF pgss_b, pgss_a;
id | id | a_id
----+----+------
(0 rows)

-- test strengths
SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR NO KEY UPDATE;
id | id | a_id
----+----+------
(0 rows)

SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR SHARE;
id | id | a_id
----+----+------
(0 rows)

SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR KEY SHARE;
id | id | a_id
----+----+------
(0 rows)

-- test wait policies
SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR UPDATE NOWAIT;
id | id | a_id
----+----+------
(0 rows)

SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR UPDATE SKIP LOCKED;
id | id | a_id
----+----+------
(0 rows)

SELECT calls, query FROM pg_stat_statements ORDER BY query COLLATE "C";
calls | query
-------+------------------------------------------------------------------------------------------
1 | SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id
1 | SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR KEY SHARE
1 | SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR NO KEY UPDATE
1 | SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR SHARE
2 | SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR UPDATE
1 | SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR UPDATE NOWAIT
1 | SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR UPDATE OF pgss_a
1 | SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR UPDATE OF pgss_b
1 | SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR UPDATE OF pgss_b, pgss_a
1 | SELECT * FROM pgss_a JOIN pgss_b ON pgss_b.a_id = pgss_a.id FOR UPDATE SKIP LOCKED
1 | SELECT pg_stat_statements_reset()
(11 rows)

DROP TABLE pgss_a, pgss_b CASCADE;
--
-- utility commands
--
Expand Down
27 changes: 24 additions & 3 deletions contrib/pg_stat_statements/pg_stat_statements.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ static void AppendJumble(pgssJumbleState *jstate,
const unsigned char *item, Size size);
static void JumbleQuery(pgssJumbleState *jstate, Query *query);
static void JumbleRangeTable(pgssJumbleState *jstate, List *rtable);
static void JumbleRowMarks(pgssJumbleState *jstate, List *rowMarks);
static void JumbleExpr(pgssJumbleState *jstate, Node *node);
static void RecordConstLocation(pgssJumbleState *jstate, int location);
static char *generate_normalized_query(pgssJumbleState *jstate, const char *query,
Expand Down Expand Up @@ -787,7 +788,7 @@ pgss_post_parse_analyze(ParseState *pstate, Query *query)
Assert(query->queryId == UINT64CONST(0));

/* Safety check... */
if (!pgss || !pgss_hash)
if (!pgss || !pgss_hash || !pgss_enabled())
return;

/*
Expand Down Expand Up @@ -1992,7 +1993,7 @@ qtext_load_file(Size *buffer_size)
return NULL;
}

if (CloseTransientFile(fd))
if (CloseTransientFile(fd) != 0)
ereport(LOG,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m", PGSS_TEXT_FILE)));
Expand Down Expand Up @@ -2430,7 +2431,7 @@ JumbleQuery(pgssJumbleState *jstate, Query *query)
JumbleExpr(jstate, (Node *) query->sortClause);
JumbleExpr(jstate, query->limitOffset);
JumbleExpr(jstate, query->limitCount);
/* we ignore rowMarks */
JumbleRowMarks(jstate, query->rowMarks);
JumbleExpr(jstate, query->setOperations);
}

Expand Down Expand Up @@ -2489,6 +2490,26 @@ JumbleRangeTable(pgssJumbleState *jstate, List *rtable)
}
}

/*
* Jumble a rowMarks list
*/
static void
JumbleRowMarks(pgssJumbleState *jstate, List *rowMarks)
{
ListCell *lc;

foreach(lc, rowMarks)
{
RowMarkClause *rowmark = lfirst_node(RowMarkClause, lc);
if (!rowmark->pushedDown)
{
APP_JUMB(rowmark->rti);
APP_JUMB(rowmark->strength);
APP_JUMB(rowmark->waitPolicy);
}
}
}

/*
* Jumble an expression tree
*
Expand Down
Loading