Skip to content

Commit a453004

Browse files
committed
Merge with PostgreSQL 8.3.23.
Everything in PostgreSQL 8.3 is now in Greenplum. PostgreSQL 8.3 has been end-of-lifed in upstream, so there will be no new upstream minor releases of this series anymore either. This includes a lot of new features from PostgreSQL 8.3, and a ton of bug fixes. See upstream release notes for details. One big user-visible change included is the removal of implicit cast from other datatypes to text. When this was done in PostgreSQL, it caused a lot of sloppily written application queries to break. Which is a good thing in the long run, but it caused a lot of pain on upgrade. A few features work slightly differently in GPDB: * Lazy XIDs feature in upstream reduces XID consumption, by not assigning XIDs to read-only transactions. That optimization has not been implemented for GPDB distributed transactions, however, so practically all queries in GPDB still consume XIDs, whether they're read-only or not. * temp_tablespaces GUC was added in upstream, but it has been disabled in GPDB, in favor of GPDB-specific system to decide which filespace to use for temporary files. * B-tree indexes can now be used to answer "col IS NULL" queries. That support has not been implemented for bitmap indexes. * Support was added for "top N" sorting, speeding up queries with ORDER BY and LIMIT. That support was not implemented for tuplesort_mk.c, however, so you only get that benefit with enable_mk_sort=off. * Multi-worker autovacuum support was merged, but autovacuum as whole is still disabled in GPDB. * Planner hook was added. Nothing special there, but we should consider refactoring the ORCA glue code to use it. * Plan cache invalidation was added upstream, which made the gp_plpgsql_clear_cache_always option obsolete. We also backported the further invalidation improvements from 8.4. See below for more information. In addition to those, there were some big refactorings that were not that interesting from user point of view, but caused a lot of code churn: InitPlans are now initialized separately at executor startup, the executor range table was changed to be "flat", and code related to parse analysis of DDL commands was moved around. The way UPDATE WHERE CURRENT OF was implemented in GPDB was refactored to match the new upstream support for the same (see below for more information). Plan cache invalidation ----------------------- One notable feature included in this merge is the support for plan cache invalidation. GPDB contained a hack to invalidate all plans in master between transactions, for the same purpose, but the proper plan cache invalidation is a much better solution. However, because the GPDB hack also handled dropped/recreated functions in some cases, if we just leave it out and replace with the 8.3 plan cache invalidation, there will be a regression in those cases. To fix, this merge commit includes a backport the rest of the plan cache invalidation support from PostgreSQL 8.4, which handles functions and operators too. The upstream commit for that was: commit ee33b95 Author: Tom Lane <[email protected]> Date: Tue Sep 9 18:58:09 2008 +0000 Improve the plan cache invalidation mechanism to make it invalidate plans when user-defined functions used in a plan are modified. Also invalidate plans when schemas, operators, or operator classes are modified; but for these cases we just invalidate everything rather than tracking exact dependencies, since these types of objects seldom change in a production database. Tom Lane; loosely based on a patch by Martin Pihlak. As a result of that, the gp_plpgsql_clear_cache_always GUC is removed, as it's no longer needed. This also includes new test cases in the plpgsql cache regression test, to demonstrate the improvements. CURRENT OF code changes ----------------------- This merge includes the upstream support for UPDATE WHERE CURRENT OF. GPDB had support for that already, it's been refactored to use the upstream code as much as possible (execCurrentOf()). Now that we have the upstream code available, this also refactors the way current position of a cursor is dispatched. Instead of modifying every CurrentOfExpr node in the plan tree before dispatching it, store the current positions of each cursor mentioned in a CurrentOfExpr in a separate CursorPosInfo node, and dispatch those along with the query plan, in QueryDispatchDesc. This was a joint effort between me (Heikki) and Daniel Gustafsson.
2 parents 5dc7dda + d13f41d commit a453004

File tree

1,480 files changed

+129472
-66369
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,480 files changed

+129472
-66369
lines changed

GNUmakefile.in

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ distdir = postgresql-$(VERSION)
119119
dummy = =install=
120120
garbage = =* "#"* ."#"* *~* *.orig *.rej core postgresql-*
121121

122-
dist: $(distdir).tar.gz
122+
dist: $(distdir).tar.gz $(distdir).tar.bz2
123123
ifeq ($(split-dist), yes)
124124
dist: postgresql-base-$(VERSION).tar.gz postgresql-docs-$(VERSION).tar.gz postgresql-opt-$(VERSION).tar.gz postgresql-test-$(VERSION).tar.gz
125125
endif
@@ -129,6 +129,8 @@ dist:
129129
$(distdir).tar: distdir
130130
$(TAR) chf $@ $(distdir)
131131

132+
.INTERMEDIATE: $(distdir).tar
133+
132134
opt_files = \
133135
src/tools src/tutorial \
134136
$(addprefix src/pl/, plperl plpython tcl)
@@ -150,7 +152,7 @@ postgresql-test-$(VERSION).tar: distdir
150152

151153
distdir:
152154
-rm -rf $(distdir)* $(dummy)
153-
for x in `cd $(top_srcdir) && find . -name CVS -prune -o -print`; do \
155+
for x in `cd $(top_srcdir) && find . \( -name CVS -prune \) -o \( -name .git -prune \) -o -print`; do \
154156
file=`expr X$$x : 'X\./\(.*\)'`; \
155157
if test -d "$(top_srcdir)/$$file" ; then \
156158
mkdir "$(distdir)/$$file" && chmod 777 "$(distdir)/$$file"; \
@@ -165,12 +167,12 @@ distdir:
165167
#cp $(distdir)/doc/src/sgml/INSTALL $(distdir)/
166168
#cp $(distdir)/doc/src/sgml/regress_README $(distdir)/src/test/regress/README
167169
$(MAKE) -C $(distdir) distclean
168-
-rm -f $(distdir)/README.CVS
170+
#rm -f $(distdir)/README.git
169171

170-
distcheck: $(distdir).tar.gz
172+
distcheck: dist
171173
-rm -rf $(dummy)
172174
mkdir $(dummy)
173-
$(GZIP) -d -c $< | $(TAR) xf -
175+
$(GZIP) -d -c $(distdir).tar.gz | $(TAR) xf -
174176
install_prefix=`cd $(dummy) && pwd`; \
175177
cd $(distdir) \
176178
&& ./configure --prefix="$$install_prefix"

config/c-library.m4

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Macros that test various C library quirks
2-
# $PostgreSQL: pgsql/config/c-library.m4,v 1.33 2008/08/21 13:53:28 petere Exp $
2+
# config/c-library.m4
33

44

55
# PGAC_VAR_INT_TIMEZONE
@@ -298,6 +298,7 @@ int main()
298298
AC_MSG_RESULT([$pgac_cv_printf_arg_control])
299299
])# PGAC_FUNC_PRINTF_ARG_CONTROL
300300

301+
301302
# PGAC_TYPE_LOCALE_T
302303
# ------------------
303304
# Check for the locale_t type and find the right header file. Mac OS

config/docbook.m4

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# config/docbook.m4
1+
# $PostgreSQL: pgsql/config/docbook.m4,v 1.8 2007/08/09 02:33:58 tgl Exp $
22

33
# PGAC_PROG_JADE
44
# --------------
@@ -55,7 +55,7 @@ AC_CACHE_VAL([pgac_cv_path_stylesheets],
5555
[if test -n "$DOCBOOKSTYLE"; then
5656
pgac_cv_path_stylesheets=$DOCBOOKSTYLE
5757
else
58-
for pgac_prefix in /usr /usr/local /opt /sw; do
58+
for pgac_prefix in /usr /usr/local /opt; do
5959
for pgac_infix in share lib; do
6060
for pgac_postfix in \
6161
sgml/stylesheets/nwalsh-modular \
@@ -64,8 +64,7 @@ else
6464
sgml/docbook-dsssl \
6565
sgml/docbook/dsssl/modular \
6666
sgml/docbook/stylesheet/dsssl/modular \
67-
sgml/docbook/dsssl-stylesheets \
68-
sgml/dsssl/docbook-dsssl-nwalsh
67+
sgml/docbook/dsssl-stylesheets
6968
do
7069
pgac_candidate=$pgac_prefix/$pgac_infix/$pgac_postfix
7170
if test -r "$pgac_candidate/html/docbook.dsl" \
@@ -97,32 +96,3 @@ if test -n "$DOCBOOKSTYLE"; then
9796
else
9897
AC_PATH_PROGS(COLLATEINDEX, collateindex.pl)
9998
fi])# PGAC_PATH_COLLATEINDEX
100-
101-
102-
# PGAC_PATH_DOCBOOK2MAN
103-
# ---------------------
104-
# Find docbook2man program from the docbook2X package. Upstream calls
105-
# this program docbook2man, but there is also a different docbook2man
106-
# out there from the docbook-utils package. Thus, the program we want
107-
# is called docbook2x-man on Debian and db2x_docbook2man on Fedora.
108-
#
109-
# (Consider rewriting this macro using AC_PATH_PROGS_FEATURE_CHECK
110-
# when switching to Autoconf 2.62+.)
111-
AC_DEFUN([PGAC_PATH_DOCBOOK2MAN],
112-
[AC_CACHE_CHECK([for docbook2man], [ac_cv_path_DOCBOOK2MAN],
113-
[if test -z "$DOCBOOK2MAN"; then
114-
_AS_PATH_WALK([],
115-
[for ac_prog in docbook2x-man db2x_docbook2man docbook2man; do
116-
ac_path="$as_dir/$ac_prog"
117-
AS_EXECUTABLE_P(["$ac_path"]) || continue
118-
if "$ac_path" --version 2>/dev/null | $GREP docbook2x >/dev/null 2>&1; then
119-
ac_cv_path_DOCBOOK2MAN=$ac_path
120-
break
121-
fi
122-
done])
123-
else
124-
ac_cv_path_DOCBOOK2MAN=$DOCBOOK2MAN
125-
fi])
126-
DOCBOOK2MAN=$ac_cv_path_DOCBOOK2MAN
127-
AC_SUBST(DOCBOOK2MAN)
128-
])# PGAC_PATH_DOCBOOK2MAN

config/mkinstalldirs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,15 @@ esac
105105

106106
for file
107107
do
108-
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
108+
# pathcomp starts with leading slash if present, else empty
109+
pathcomp=`echo "$file" | sed -ne 's|^\(.\).*$|\1|;s|[^/]||;p'`
110+
# swap spaces and slashes, then split on spaces
111+
set fnord `echo "$file" | tr ' /' '/ '`
109112
shift
110113

111-
pathcomp=
112114
for d
113115
do
114-
pathcomp="$pathcomp$d"
116+
pathcomp="$pathcomp"`echo "$d" | tr '/' ' '`
115117
case $pathcomp in
116118
-*) pathcomp=./$pathcomp ;;
117119
esac

config/programs.m4

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# config/programs.m4
1+
# $PostgreSQL: pgsql/config/programs.m4,v 1.24 2008/08/29 13:02:32 petere Exp $
22

33

44
# PGAC_PATH_BISON
@@ -10,7 +10,7 @@
1010
AC_DEFUN([PGAC_PATH_BISON],
1111
[# Let the user override the search
1212
if test -z "$BISON"; then
13-
AC_PATH_PROGS(BISON, bison)
13+
AC_CHECK_PROGS(BISON, bison)
1414
fi
1515
1616
if test "$BISON"; then
@@ -19,15 +19,15 @@ if test "$BISON"; then
1919
if echo "$pgac_bison_version" | $AWK '{ if ([$]4 < 1.875) exit 0; else exit 1;}'
2020
then
2121
AC_MSG_WARN([
22-
*** The installed version of Bison, $BISON, is too old to use with PostgreSQL.
23-
*** Bison version 1.875 or later is required, but this is $pgac_bison_version.])
22+
*** The installed version of Bison is too old to use with PostgreSQL.
23+
*** Bison version 1.875 or later is required.])
2424
BISON=""
2525
fi
2626
fi
2727
2828
if test -z "$BISON"; then
2929
AC_MSG_WARN([
30-
*** Without Bison you will not be able to build PostgreSQL from Git nor
30+
*** Without Bison you will not be able to build PostgreSQL from CVS nor
3131
*** change any of the parser definition files. You can obtain Bison from
3232
*** a GNU mirror site. (If you are using the official distribution of
3333
*** PostgreSQL then you do not need to worry about this, because the Bison
@@ -42,11 +42,8 @@ AC_SUBST(BISONFLAGS)
4242
# PGAC_PATH_FLEX
4343
# --------------
4444
# Look for Flex, set the output variable FLEX to its path if found.
45-
# Reject versions before 2.5.31, as we need a reasonably non-buggy reentrant
46-
# scanner. (Note: the well-publicized security problem in 2.5.31 does not
47-
# affect Postgres, and there are still distros shipping patched 2.5.31,
48-
# so allow it.) Also find Flex if its installed under `lex', but do not
49-
# accept other Lex programs.
45+
# Avoid the buggy version 2.5.3. Also find Flex if its installed
46+
# under `lex', but do not accept other Lex programs.
5047

5148
AC_DEFUN([PGAC_PATH_FLEX],
5249
[AC_CACHE_CHECK([for flex], pgac_cv_path_flex,
@@ -78,6 +75,9 @@ else
7875
*** The installed version of Flex, $pgac_candidate, is too old to use with Greenplum DB.
7976
*** Flex version 2.5.4 or later is required, but this is $pgac_flex_version.])
8077
fi
78+
79+
pgac_cv_path_flex=$pgac_candidate
80+
break 2
8181
fi
8282
fi
8383
done
@@ -88,8 +88,14 @@ fi
8888
])[]dnl AC_CACHE_CHECK
8989
9090
if test x"$pgac_cv_path_flex" = x"no"; then
91+
if test -n "$pgac_broken_flex"; then
92+
AC_MSG_WARN([
93+
*** The Flex version 2.5.3 you have at $pgac_broken_flex contains a bug. You
94+
*** should get version 2.5.4 or later.])
95+
fi
96+
9197
AC_MSG_WARN([
92-
*** Without Flex you will not be able to build PostgreSQL from Git nor
98+
*** Without Flex you will not be able to build PostgreSQL from CVS or
9399
*** change any of the scanner definition files. You can obtain Flex from
94100
*** a GNU mirror site. (If you are using the official distribution of
95101
*** PostgreSQL then you do not need to worry about this because the Flex
@@ -98,7 +104,7 @@ if test x"$pgac_cv_path_flex" = x"no"; then
98104
FLEX=
99105
else
100106
FLEX=$pgac_cv_path_flex
101-
pgac_flex_version=`$FLEX --version 2>/dev/null`
107+
pgac_flex_version=`$FLEX -V 2>/dev/null`
102108
AC_MSG_NOTICE([using $pgac_flex_version])
103109
fi
104110
@@ -117,14 +123,15 @@ AC_SUBST(FLEXFLAGS)
117123
AC_DEFUN([PGAC_CHECK_READLINE],
118124
[AC_REQUIRE([AC_CANONICAL_HOST])
119125
120-
AC_CACHE_CHECK([for library containing readline], [pgac_cv_check_readline],
126+
AC_CACHE_VAL([pgac_cv_check_readline],
121127
[pgac_cv_check_readline=no
122128
pgac_save_LIBS=$LIBS
123129
if test x"$with_libedit_preferred" != x"yes"
124130
then READLINE_ORDER="-lreadline -ledit"
125131
else READLINE_ORDER="-ledit -lreadline"
126132
fi
127133
for pgac_rllib in $READLINE_ORDER ; do
134+
AC_MSG_CHECKING([for ${pgac_rllib}])
128135
for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
129136
LIBS="${pgac_rllib}${pgac_lib} $pgac_save_LIBS"
130137
AC_TRY_LINK_FUNC([readline], [[
@@ -143,11 +150,14 @@ for pgac_rllib in $READLINE_ORDER ; do
143150
]])
144151
done
145152
if test "$pgac_cv_check_readline" != no ; then
153+
AC_MSG_RESULT([yes ($pgac_cv_check_readline)])
146154
break
155+
else
156+
AC_MSG_RESULT(no)
147157
fi
148158
done
149159
LIBS=$pgac_save_LIBS
150-
])[]dnl AC_CACHE_CHECK
160+
])[]dnl AC_CACHE_VAL
151161
152162
if test "$pgac_cv_check_readline" != no ; then
153163
LIBS="$pgac_cv_check_readline $LIBS"
@@ -163,21 +173,19 @@ fi
163173
# Readline versions < 2.1 don't have rl_completion_append_character
164174

165175
AC_DEFUN([PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER],
166-
[AC_CACHE_CHECK([for rl_completion_append_character], pgac_cv_var_rl_completion_append_character,
167-
[AC_TRY_LINK([#include <stdio.h>
176+
[AC_MSG_CHECKING([for rl_completion_append_character])
177+
AC_TRY_LINK([#include <stdio.h>
168178
#ifdef HAVE_READLINE_READLINE_H
169179
# include <readline/readline.h>
170180
#elif defined(HAVE_READLINE_H)
171181
# include <readline.h>
172182
#endif
173183
],
174184
[rl_completion_append_character = 'x';],
175-
[pgac_cv_var_rl_completion_append_character=yes],
176-
[pgac_cv_var_rl_completion_append_character=no])])
177-
if test x"$pgac_cv_var_rl_completion_append_character" = x"yes"; then
185+
[AC_MSG_RESULT(yes)
178186
AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
179-
[Define to 1 if you have the global variable 'rl_completion_append_character'.])
180-
fi])# PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
187+
[Define to 1 if you have the global variable 'rl_completion_append_character'.])],
188+
[AC_MSG_RESULT(no)])])# PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
181189

182190

183191

config/python.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ AC_SUBST(python_libdir)[]dnl
8585
AC_SUBST(python_libspec)[]dnl
8686
AC_SUBST(python_additional_libs)[]dnl
8787
88-
# threaded python is not supported on bsd's
88+
# threaded python is not supported on OpenBSD
8989
AC_MSG_CHECKING(whether Python is compiled with thread support)
9090
pythreads=`${PYTHON} -c "import sys; print(int('thread' in sys.builtin_module_names))"`
9191
if test "$pythreads" = "1"; then
9292
AC_MSG_RESULT(yes)
9393
case $host_os in
94-
openbsd*|freebsd*)
94+
openbsd*)
9595
AC_MSG_ERROR([threaded Python not supported on this platform])
9696
;;
9797
esac

0 commit comments

Comments
 (0)