1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-28 05:21:27 +03:00

21586 Commits

Author SHA1 Message Date
Tom Lane
e2c60a2cfe 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:23:41 +00:00
Tom Lane
34b0ac6ada Remove extraneous backslash from 'fixseq.sql' example --- mea culpa
certainly.  Per report from George Woodring.
2006-01-12 18:09:42 +00:00
Tom Lane
db55a807de Improve error messages for missing-FROM-entry cases, as per recent discussion. 2006-01-10 22:00:07 +00:00
Neil Conway
e838df6ff8 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:30 +00:00
Tom Lane
d3934a3f38 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:25 +00:00
Andrew Dunstan
ed47146f1e Stop perl from hijacking stdio and other stuff on Windows. 2006-01-08 15:50:00 +00:00
Tom Lane
e1926aa91e 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:45:53 +00:00
Tom Lane
c66f4ec569 During CatCacheRemoveCList, we must now remove any members that are
dead and have become unreferenced.  Before 8.1, such members were left
for AtEOXact_CatCache() to clean up, but now AtEOXact_CatCache isn't
supposed to have anything to do.  In an assert-enabled build this bug
leads to an assertion failure at transaction end, but in a non-assert
build the dead member is effectively just a small memory leak.
Per report from Jeremy Drake.
2006-01-07 21:16:44 +00:00
Tom Lane
4b1f09d5bd 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:18 +00:00
Tom Lane
68f4ed462a Release-note updates and copy editing. REL8_1_2 2006-01-06 03:00:06 +00:00
Tom Lane
c628930966 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:32 +00:00
Tom Lane
9395f4911a 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:15:58 +00:00
Tom Lane
cf3c9c14c3 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:26 +00:00
Bruce Momjian
ffc7186004 New pgcrypto item wording. 2006-01-05 15:19:52 +00:00
Bruce Momjian
61180e80d4 Wording improvements. 2006-01-05 15:13:26 +00:00
Bruce Momjian
045de2d865 Improve markup. 2006-01-05 14:54:07 +00:00
Peter Eisentraut
3e62f08e9a Translation update 2006-01-05 09:32:12 +00:00
Bruce Momjian
e0f1f8ad0b Update release notes for 8.1.X, 8.0.X, 7.4.X, and 7.3.X. 2006-01-05 05:16:03 +00:00
Bruce Momjian
f54a68d24a Stamp release 8.1.2. 2006-01-05 04:02:26 +00:00
Tom Lane
e9bb12d5ab 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:54:51 +00:00
Tom Lane
f336613438 Fix another case in which autovacuum would fail while analyzing
expressional indexes.  Per report from Brian Hirt.
2006-01-04 19:16:32 +00:00
Tom Lane
f5b50af291 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:38 +00:00
Joe Conway
17903a7375 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:46:32 +00:00
Tom Lane
54b84d4838 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:34 +00:00
Tom Lane
495be39266 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:21 +00:00
Tom Lane
a61ca095a9 Reset flex state in a way that works for both flex 2.5.4 and 2.5.31. 2006-01-02 19:55:31 +00:00
Tom Lane
7833a8870c Rewrite ProcessConfigFile() to avoid misbehavior at EOF, as per report
from Andrus Moor.  The former state-machine-style coding wasn't actually
doing much except obscuring the control flow, and it didn't extend
readily to fix this case, so I just took it out.  Also, add a
YY_FLUSH_BUFFER call to ensure the lexer is reset correctly if the
previous scan failed partway through the file.
2006-01-01 19:53:48 +00:00
Neil Conway
49d3d5dc17 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:21 +00:00
Tom Lane
fff24e9b47 Repair EXPLAIN failure when trying to display a plan condition that involves
selection of a field from the result of a function returning RECORD.
I believe this case is new in 8.1; it's due to the addition of OUT parameters.
Per example from Michael Fuhr.
2005-12-30 18:34:27 +00:00
Neil Conway
ff48fb9579 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:40 +00:00
Bruce Momjian
8136eca59c Remove a space that incorrectly precedes a comma in the PL/pgSQL
documentation.

Michael Fuhr
2005-12-29 04:02:41 +00:00
Bruce Momjian
5fcf4a9c03 Add COPY CSV test that tests CSV output of \. 2005-12-28 15:07:13 +00:00
Bruce Momjian
c54fee814f Update COPY CSV \. wording for externally created files. 2005-12-28 14:38:43 +00:00
Bruce Momjian
c7fc2ccf63 Add regression tests for CSV and \., and add automatic quoting of a
single column dump that has a \. value, so the load works properly.  I
also added documentation describing this issue.

Backpatch to 8.1.X.
2005-12-28 05:38:27 +00:00
Bruce Momjian
3f99c2d5a7 Our code had:
if (c == '\\' && cstate->line_buf.len == 0)

The problem with that is the because of the input and _output_
buffering, cstate->line_buf.len could be zero even if we are not on the
first character of a line.  In fact, for a typical line, it is zero for
all characters on the line.  The proper solution is to introduce a
boolean, first_char_in_line, that we set as we enter the loop and clear
once we process a character.

I have restructured the line-reading code in copy.c by:

        o  merging the CSV/non-CSV functions into a single function
        o  used macros to centralize and clarify the buffering code
        o  updated comments
        o  renamed client_encoding_only to encoding_embeds_ascii
        o  added a high-bit test to the encoding_embeds_ascii test for
           performance
        o  in CSV mode, allow a backslash followed by a non-period to
           continue being processed as a data value

There should be no performance impact from this patch because it is
functionally equivalent.  If you apply the patch you will see copy.c is
much clearer in this area now and might suggest additional
optimizations.

I have also attached a 8.1-only patch to fix the CSV \. handling bug
with no code restructuring.
2005-12-27 18:10:57 +00:00
Tatsuo Ishii
ab2d8c41ff 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 09:42:30 +00:00
Tatsuo Ishii
5343bcadd6 Fix for rearranging encoding id ISO-8859-5 to ISO-8859-8.
Also make the code more robust by searching for target encoding
in the internal charset map.

Problem reported by Sagi Bashari on 2005/12/21.
See "[BUGS] BUG #2120: Crash when doing UTF8<->ISO_8859_8 encoding conversion"
on pgsql-bugs list for more details.

Back patch for 8.1_STABLE.
2005-12-24 00:49:18 +00:00
Tom Lane
13d954d744 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:27 +00:00
Tom Lane
e6242ba176 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:07 +00:00
Bruce Momjian
f545a05704 Update interval documenation to mention the storage system used. 2005-12-22 21:45:30 +00:00
Bruce Momjian
14e9a17f0a Add documentation example of using interval multiplication with 'days'.
Backpatch to 8.1.X.
2005-12-21 23:23:09 +00:00
Bruce Momjian
2469b99665 Add additional example for interval multiplication.
Fix example for day and hours interval subtraction for new computation
method.

Update interval examples to display zero seconds, which is our default.

Backpatch to 8.1.X.
2005-12-21 16:02:44 +00:00
Teodor Sigaev
dacf7e774d Fix word's length in pg_regexec call 2005-12-21 13:07:38 +00:00
Tom Lane
ba7fd49de5 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:37 +00:00
Tom Lane
599e225c11 Fix problem with whole-row Vars referencing sub-select outputs, per
example from Jim Dew.  Add some simple regression tests, since this is
an area we seem to break regularly :-(
2005-12-14 16:28:49 +00:00
Tom Lane
f23e9f7a54 Teach deparsing of CASE expressions to cope with the simplified forms
that simplify_boolean_equality() may leave behind.  This is only relevant
if the user writes something a bit silly, like CASE x=y WHEN TRUE THEN.
Per example from Michael Fuhr; may or may not explain bug #2106.
2005-12-10 19:21:17 +00:00
Tom Lane
31a21e3df0 Remove incorrect increment of lineno, per David Fetter.
Sync HEAD and 8.1 branches of pgbench.
REL8_1_1
2005-12-10 01:09:14 +00:00
Peter Eisentraut
8c1fc987e4 Translation updates 2005-12-09 22:33:32 +00:00
Tom Lane
a2fc8ca797 Add release notes for back branches (7.3 and up).
Also minor improvements to 8.1.1 release notes.
2005-12-09 20:40:26 +00:00
Bruce Momjian
24cea65634 Add documentation about the behavior of BEFORE triggers and referential
integrity actions.

Stephan Szabo
2005-12-09 19:39:43 +00:00