Commit Graph

19998 Commits

Author SHA1 Message Date
Bruce Momjian
92d1dd845f Fix pgxs -L library path specification for Win32 and Cygwin, was /bin,
now /lib.
2006-01-19 20:01:32 +00:00
Tom Lane
9fad6e338b It turns out that TablespaceCreateDbspace fails badly if a relcache flush
occurs when it tries to heap_open pg_tablespace.  When control returns to
smgrcreate, that routine will be holding a dangling pointer to a closed
SMgrRelation, resulting in mayhem.  This is of course a consequence of
the violation of proper module layering inherent in having smgr.c call
a tablespace command routine, but the simplest fix seems to be to change
the locking mechanism.  There's no real need for TablespaceCreateDbspace
to touch pg_tablespace at all --- it's only opening it as a way of locking
against a parallel DROP TABLESPACE command.  A much better answer is to
create a special-purpose LWLock to interlock these two operations.
This drops TablespaceCreateDbspace quite a few layers down the food chain
and makes it something reasonably safe for smgr to call.
2006-01-19 04:45:58 +00:00
Tom Lane
754da88e19 Repair problems with the result of lookup_rowtype_tupdesc() possibly being
discarded by cache flush while still in use.  This is a minimal patch that
just copies the tupdesc anywhere it could be needed across a flush.  Applied
to back branches only; Neil Conway is working on a better long-term solution
for HEAD.
2006-01-17 17:33:37 +00:00
Neil Conway
8372956243 When using GCC on AMD64 and PPC, ECPGget_variable() takes a va_list *, not
a va_list. Christof Petig's previous patch made this change, but neglected
to update ecpglib/descriptor.c, resulting in a compiler warning (and a
likely runtime crash) on AMD64 and PPC.
2006-01-15 22:47:21 +00:00
Peter Eisentraut
9d570f7e21 Fix pg_ctl crash on "unregister" when a data directory is not specified.
by Magnus Hagander
2006-01-14 16:18:30 +00:00
Neil Conway
b0b8bab575 We neglected to apply domain constraints on UNKNOWN parameters to
prepared statements, per report from David Wheeler.
2006-01-12 22:29:22 +00:00
Tom Lane
e26b09618b Repair "Halloween problem" in EvalPlanQual: a tuple that's been inserted by
our own command (or more generally, xmin = our xact and cmin >= current
command ID) should not be seen as good.  Else we may try to update rows
we already updated.  This error was inserted last August while fixing the
even bigger problem that the old coding wouldn't see *any* tuples inserted
by our own transaction as good.  Per report from Euler Taveira de Oliveira.
2006-01-12 21:49:19 +00:00
Tom Lane
01e2a15ada Use a more bulletproof test for whether finite() and isinf() are present.
It seems that recent gcc versions can optimize away calls to these functions
even when the functions do not exist on the platform, resulting in a bogus
positive result.  Avoid this by using a non-constant argument and ensuring
that the function result is not simply discarded.  Per report from
François Laupretre.
2006-01-12 19:24:02 +00:00
Tom Lane
2946ccf35f Fix pg_tzset() to ensure that 'lclmem' (the static variable holding
the localtime timezone data) is not overwritten until we know the data
is good.  tzload() is capable of failing after having begun modifying
the struct it's pointed at, and in such cases the static data was left
in a corrupt state.  Bug does not exist pre-8.0 (since we didn't have
this code then) nor post-8.0 (since we already changed the code to
tzload into local variables initially).  Per report from Nick Martens.
2006-01-10 20:16:25 +00:00
Neil Conway
95f88ddf49 In PLy_function_build_args(), the code loops repeatedly, constructing
one argument at a time and then inserting the argument into a Python
list via PyList_SetItem(). This "steals" the reference to the argument:
that is, the reference to the new list member is now held by the Python
list itself. This works fine, except if an elog occurs. This causes the
function's PG_CATCH() block to be invoked, which decrements the
reference counts on both the current argument and the list of arguments.
If the elog happens to occur during the second or subsequent iteration
of the loop, the reference count on the current argument will be
decremented twice.

The fix is simple: set the local pointer to the current argument to NULL
immediately after adding it to the argument list. This ensures that the
Py_XDECREF() in the PG_CATCH() block doesn't double-decrement.
2006-01-10 00:33:48 +00:00
Tom Lane
59327401cc Fix pg_dump to add the required OPERATOR() decoration to schema-qualified
operator names.  This is needed when dumping operator definitions that have
COMMUTATOR (or similar) links to operators in other schemas.
Apparently Daniel Whitter is the first person ever to try this :-(
2006-01-09 21:16:37 +00:00
Andrew Dunstan
d984548ac9 Stop perl from hijacking stdio and other stuff on Windows. 2006-01-08 15:51:19 +00:00
Tom Lane
b443043d18 Add RelationOpenSmgr() calls to ensure rd_smgr is valid when we try to
use it.  While it normally has been opened earlier during btree index
build, testing shows that it's possible for the link to be closed again
if an sinval reset occurs while the index is being built.
2006-01-07 22:46:07 +00:00
Tom Lane
2aee785469 Fix failure to apply domain constraints to a NULL constant that's added to
an INSERT target list during rule rewriting.  Per report from John Supplee.
2006-01-06 20:11:24 +00:00
Tom Lane
e82858f013 Release-note updates and copy editing. 2006-01-06 03:00:20 +00:00
Tom Lane
5d0def8d52 Fix Windows-only postmaster code to reject a connection request and continue,
rather than elog(FATAL), when there is no more room in ShmemBackendArray.
This is a security issue since too many connection requests arriving close
together could cause the postmaster to shut down, resulting in denial of
service.  Reported by Yoshiyuki Asaba, fixed by Magnus Hagander.
2006-01-06 02:58:40 +00:00
Tom Lane
240112222c Generate back-branch configure scripts with the appropriate version of autoconf. 2006-01-06 02:30:52 +00:00
Tom Lane
a2dca8e9e3 Convert Assert checking for empty page into a regular test and elog.
The consequences of overwriting a non-empty page are bad enough that
we should not omit this test in production builds.
2006-01-06 00:16:09 +00:00
Tom Lane
718d3232af Fix ReadBuffer() to correctly handle the case where it's trying to extend
the relation but it finds a pre-existing valid buffer.  The buffer does not
correspond to any page known to the kernel, so we *must* do smgrextend to
ensure that the space becomes allocated.  The 7.x branches all do this
correctly, but the corner case got lost somewhere during 8.0 bufmgr rewrites.
(My fault no doubt :-( ... I think I assumed that such a buffer must be
not-BM_VALID, which is not so.)
2006-01-06 00:04:33 +00:00
Bruce Momjian
0add52b4f6 New pgcrypto item wording. 2006-01-05 15:18:29 +00:00
Bruce Momjian
240fb6dd4f Wording improvements. 2006-01-05 15:12:03 +00:00
Bruce Momjian
4011909a02 Improve markup. 2006-01-05 14:53:18 +00:00
Bruce Momjian
748a71fbff Update release notes. 2006-01-05 05:23:09 +00:00
Bruce Momjian
2a35aedd97 Stamp relesae 8.0.6. 2006-01-05 04:00:29 +00:00
Tom Lane
7179b96be9 Arrange to set the LC_XXX environment variables to match our locale setup.
Back-patch of previous fix in HEAD for plperl-vs-locale issue.
2006-01-05 00:55:07 +00:00
Joe Conway
6c2fa48885 When the remote query result has a different number of columns
than the local query specifies (e.g. in the FROM clause),
throw an ERROR (instead of crashing). Fix for bug #2129 reported
by Akio Iwaasa.
2006-01-03 23:47:24 +00:00
Tom Lane
a559ef6594 There is a signedness bug in Openwall gen_salt code that pgcrypto uses.
This makes the salt space for md5 and xdes algorithms a lot smaller than
it should be.

Marko Kreen
2006-01-03 23:46:44 +00:00
Tom Lane
bf6c87f5a4 Fix incorrect treatment of RL_PROMPT_START_IGNORE/RL_PROMPT_END_IGNORE,
per http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=343616 via Martin Pitt.
2006-01-03 23:32:40 +00:00
Tom Lane
dea775eb25 Add checks to verify that a plpgsql function returning a rowtype is actually
returning the rowtype it's supposed to return.  Per reports from David Niblett
and Michael Fuhr.
2006-01-03 22:48:28 +00:00
Neil Conway
6b0e64431c Remove DOS line endings ("\r\n") from several .po files. DOS line endings
are inconsistent with the rest of the .po files, and apparently cause
problems for Sun's cc. Per report on IRC from "bitvector2".
2006-01-01 10:14:59 +00:00
Neil Conway
8af900f885 Index: src/pl/plpython/plpython.c
===================================================================
RCS file: /Users/neilc/postgres/cvs_root/pgsql/src/pl/plpython/plpython.c,v
retrieving revision 1.67
diff -c -r1.67 plpython.c
*** src/pl/plpython/plpython.c	26 Dec 2005 04:28:48 -0000	1.67
--- src/pl/plpython/plpython.c	29 Dec 2005 16:54:57 -0000
***************
*** 2,8 ****
   * plpython.c - python as a procedural language for PostgreSQL
   *
   * This software is copyright by Andrew Bosma
!  * but is really shameless cribbed from pltcl.c by Jan Weick, and
   * plperl.c by Mark Hollomon.
   *
   * The author hereby grants permission to use, copy, modify,
--- 2,8 ----
   * plpython.c - python as a procedural language for PostgreSQL
   *
   * This software is copyright by Andrew Bosma
!  * but is really shamelessly cribbed from pltcl.c by Jan Wieck, and
   * plperl.c by Mark Hollomon.
   *
   * The author hereby grants permission to use, copy, modify,
***************
*** 1996,2002 ****
  	int			i,
  				rv;
  	PLyPlanObject *plan;
- 	char	   *nulls;
  	MemoryContext oldcontext;

  	if (list != NULL)
--- 1996,2001 ----
***************
*** 2018,2024 ****
  	if (nargs != plan->nargs)
  	{
  		char	   *sv;
-
  		PyObject   *so = PyObject_Str(list);

  		if (!so)
--- 2017,2022 ----
***************
*** 2036,2048 ****
  	oldcontext = CurrentMemoryContext;
  	PG_TRY();
  	{
! 		nulls = palloc(nargs * sizeof(char));

  		for (i = 0; i < nargs; i++)
  		{
  			PyObject   *elem,
  					   *so;
- 			char	   *sv;

  			elem = PySequence_GetItem(list, i);
  			if (elem != Py_None)
--- 2034,2045 ----
  	oldcontext = CurrentMemoryContext;
  	PG_TRY();
  	{
! 		char	   *nulls = palloc(nargs * sizeof(char));

  		for (i = 0; i < nargs; i++)
  		{
  			PyObject   *elem,
  					   *so;

  			elem = PySequence_GetItem(list, i);
  			if (elem != Py_None)
***************
*** 2051,2070 ****
  				if (!so)
  					PLy_elog(ERROR, "function \"%s\" could not execute plan",
  							 PLy_procedure_name(PLy_curr_procedure));
! 				sv = PyString_AsString(so);

! 				/*
! 				 * FIXME -- if this elogs, we have Python reference leak
! 				 */
! 				plan->values[i] =
! 					FunctionCall3(&(plan->args[i].out.d.typfunc),
! 								  CStringGetDatum(sv),
! 							ObjectIdGetDatum(plan->args[i].out.d.typioparam),
! 								  Int32GetDatum(-1));

! 				Py_DECREF(so);
! 				Py_DECREF(elem);

  				nulls[i] = ' ';
  			}
  			else
--- 2048,2073 ----
  				if (!so)
  					PLy_elog(ERROR, "function \"%s\" could not execute plan",
  							 PLy_procedure_name(PLy_curr_procedure));
! 				Py_DECREF(elem);

! 				PG_TRY();
! 				{
! 					char *sv = PyString_AsString(so);

! 					plan->values[i] =
! 						FunctionCall3(&(plan->args[i].out.d.typfunc),
! 									  CStringGetDatum(sv),
! 								ObjectIdGetDatum(plan->args[i].out.d.typioparam),
! 									  Int32GetDatum(-1));
! 				}
! 				PG_CATCH();
! 				{
! 					Py_DECREF(so);
! 					PG_RE_THROW();
! 				}
! 				PG_END_TRY();

+ 				Py_DECREF(so);
  				nulls[i] = ' ';
  			}
  			else
2005-12-29 21:47:49 +00:00
Tatsuo Ishii
95da30b20f Fix long standing Asian multibyte charsets bug.
See:

Subject: [HACKERS] bugs with certain Asian multibyte charsets
From: Tatsuo Ishii <ishii@sraoss.co.jp>
To: pgsql-hackers@postgresql.org
Date: Sat, 24 Dec 2005 18:25:33 +0900 (JST)

for more details.
2005-12-24 10:11:32 +00:00
Tom Lane
988fe9f7dd Fix make_relative_path() to support cases where target_path and bin_path
differ by more than the last directory component.  Instead of insisting
that they match up to the last component, accept whatever common prefix
they have, and try to replace the non-matching part of bin_path with
the non-matching part of target_path in the actual executable's path.
In one way this is tighter than the old code, because it insists on
a match to the part of bin_path we want to substitute for, rather than
blindly stripping one directory component from the executable's path.
Per gripe from Martin Pitt and subsequent discussion.
2005-12-23 22:34:33 +00:00
Tom Lane
faefc812f8 Adjust string comparison so that only bitwise-equal strings are considered
equal: if strcoll claims two strings are equal, check it with strcmp, and
sort according to strcmp if not identical.  This fixes inconsistent
behavior under glibc's hu_HU locale, and probably under some other locales
as well.  Also, take advantage of the now-well-defined behavior to speed up
texteq, textne, bpchareq, bpcharne: they may as well just do a bitwise
comparison and not bother with strcoll at all.

NOTE: affected databases may need to REINDEX indexes on text columns to be
sure they are self-consistent.
2005-12-22 22:50:14 +00:00
Teodor Sigaev
ba6e1b2e72 Fix word's length in pg_regexec call 2005-12-21 13:08:14 +00:00
Tom Lane
1200fc58a7 Defend against crash while processing Describe Statement or Describe Portal
messages, when client attempts to execute these outside a transaction (start
one) or in a failed transaction (reject message, except for COMMIT/ROLLBACK
statements which we can handle).  Per report from Francisco Figueiredo Jr.
2005-12-14 17:06:51 +00:00
Tom Lane
ec8c876bde Fix a *different* problem with whole-row Vars afflicting 8.0 branch.
This is a back-port of a fix made to markTargetListOrigin() on 2005-04-25.
2005-12-14 16:30:20 +00:00
Peter Eisentraut
4138c3833d Translation updates 2005-12-09 22:16:16 +00:00
Tom Lane
499dad06f2 Stamp 8.0.5. 2005-12-09 20:49:38 +00:00
Tom Lane
9e127658f2 Add release notes for back branches (7.3 and up).
Also minor improvements to 8.1.1 release notes.
2005-12-09 20:40:38 +00:00
Peter Eisentraut
bd760bf800 Documentation fix: s/event_object_name/event_object_table/g 2005-12-08 20:45:26 +00:00
Tom Lane
929f852287 Fix bgwriter's failure to release buffer pins and open files after an
error.  This probably explains bug #2099 and could also account for
mysterious VACUUM hangups.
2005-12-08 19:19:45 +00:00
Teodor Sigaev
9a40b555d3 Fix stupid bug with sizeof 2005-12-06 18:22:21 +00:00
Tom Lane
7563a16b11 In a nestloop inner indexscan, it's OK to use pushed-down baserestrictinfo
clauses even if it's an outer join.  This is a corner case since such
clauses could only arise from weird OUTER JOIN ON conditions, but worth
fixing.  Per example from Ron at cheapcomplexdevices.com.
2005-12-06 16:50:55 +00:00
Tom Lane
81788719b9 Add regression test to see if the min/max values of int8 convert correctly. 2005-12-05 04:14:07 +00:00
Tom Lane
91ab1fefbd Fix out-of-order inclusion of -L switches from LDFLAGS on AIX and HPUX.
Per example from Dirk Pirschel.
2005-12-03 20:16:50 +00:00
Tom Lane
b0be56634b Fix obsolete description of -h option, per Andreas Schmidt. 2005-12-02 23:14:02 +00:00
Tom Lane
eeae797d33 Retry in FileRead and FileWrite if Windows returns ERROR_NO_SYSTEM_RESOURCES.
Also add a retry for Unixen returning EINTR, which hasn't been reported
as an issue but at least theoretically could be.  Patch by Qingqing Zhou,
some minor adjustments by me.
2005-12-01 20:24:49 +00:00
Tom Lane
64c09adea7 Check for overflow in strtol() while parsing datetime inputs.
Michael Fuhr.
2005-12-01 17:56:54 +00:00
Tom Lane
a4a51d58e8 Rearrange code in pg_atoi() to avoid assuming that isspace() cannot
change errno.  No reported bugs here, but why take a chance?
2005-11-30 23:10:34 +00:00