Commit Graph

24119 Commits

Author SHA1 Message Date
Tom Lane
8e010acb0d Fix vac_update_relstats to ensure it always sends a relcache inval message,
even if none of the fields in the pg_class row change.  This behavior is
necessary to ensure other backends flush rd_targblock values that might
point to truncated-away pages.  We got this right pre-8.2 but it was broken
by overoptimistic change to not write out the pg_class row if unchanged.
Per report from Pavan Deolasee.
2007-03-08 17:03:43 +00:00
Teodor Sigaev
2b1abc8756 Athough cube is a varlena type, nowhere was a detoasting of cube's value, so
fix it.  Add macroses DatumGetNDBOX, PG_GETARG_NDBOX and PG_RETURN_NDBOX.
Backpatch for 8.2 too.

Previous versions use version 0 calling conventions. And fmgr code detoast
values for user-defined functions.
2007-03-07 21:25:18 +00:00
Tom Lane
cafbf1e1cc Fix oversight in original coding of inline_function(): since
check_sql_fn_retval allows binary-compatibility cases, the expression
extracted from an inline-able SQL function might have a type that is only
binary-compatible with the declared function result type.  To avoid possibly
changing the semantics of the expression, we should insert a RelabelType node
in such cases.  This has only been shown to have bad consequences in recent
8.1 and up releases, but I suspect there may be failure cases in the older
branches too, so patch it all the way back.  Per bug #3116 from Greg Mullane.

Along the way, fix an omission in eval_const_expressions_mutator: it failed
to copy the relabelformat field when processing a RelabelType.  No known
observable failures from this, but it definitely isn't intended behavior.
2007-03-06 22:45:23 +00:00
Tom Lane
3530283dae Fix miscalculation of stats collector's write delay, introduced in revision 1.117. 2007-03-01 20:07:02 +00:00
Tom Lane
44089027d5 Fix markQueryForLocking() to work correctly in the presence of nested views.
It has been wrong for this case since it was first written for 7.1 :-(
Per report from Pavel Hanák.
2007-03-01 18:50:36 +00:00
Michael Meskes
bde73ab21a Backported bug fix for #2956. 2007-02-27 13:27:13 +00:00
Bruce Momjian
9395aa5392 Update Chinese FAQs to have two versions, a traditional Chinese version (Taiwan)
and a Simplified version (China (PRC)).

Backpatch to 8.2.X.

Daojing.Zhou
2007-02-21 16:42:43 +00:00
Bruce Momjian
664009ecb1 Update "encode" documentation to mention that 'escape' only changes null
bytes and backslashes, remove "ASCII" mention.  Backpatch to 8.2.X.
2007-02-20 19:59:18 +00:00
Bruce Momjian
6f9027372b Update information_schema documentation to match system tables.
Backpatch to 8.2.X.
2007-02-20 18:47:34 +00:00
Bruce Momjian
57bcfe0065 More clearly document that most PostgreSQL utilities support libpq
environment variables.  Backpatch to 8.2.X.
2007-02-20 18:11:17 +00:00
Bruce Momjian
44764fba1b Spell check on array patch. 2007-02-20 14:54:51 +00:00
Bruce Momjian
0586e9b682 Update array slice documentation to be clearer. 2007-02-20 14:34:29 +00:00
Bruce Momjian
7194ab3f55 Comment-out documentation for IS OF because it doesn't conform to the
ISO SQL behavior. Backpatch removal to 8.2.X.
2007-02-20 14:05:02 +00:00
Bruce Momjian
d9341ce1b8 Document IS [NOT] OF, which was added in 7.3. 2007-02-20 00:25:16 +00:00
Bruce Momjian
c2039e4477 Update PQfree() documentation to be clearer, backpatch to 8.2.X. 2007-02-19 22:06:30 +00:00
Magnus Hagander
7c2e6f31be Fix pg_dump on win32 to properly dump files larger than 2Gb when using
binary dump formats.
2007-02-19 15:05:21 +00:00
Tom Lane
812a929a85 Fix portal management code to support non-default command completion tags for
portals using PORTAL_UTIL_SELECT strategy.  This is currently significant only
for FETCH queries, which are supposed to include a count in the tag.  Seems
it's been broken since 7.4, but nobody noticed before Knut Lehre.
2007-02-18 19:49:30 +00:00
Tom Lane
33b41590df Adjust the definition of is_pushed_down so that it's always true for INNER
JOIN quals, just like WHERE quals, even if they reference every one of the
join's relations.  Now that we can reorder outer and inner joins, it's
possible for such a qual to end up being assigned to an outer join plan node,
and we mustn't have it treated as a join qual rather than a filter qual for
the node.  (If it were, the join could produce null-extended rows that it
shouldn't.)  Per bug report from Pelle Johansson.
2007-02-16 20:57:26 +00:00
Tom Lane
36e24e8d17 Fix another problem in 8.2 changes that allowed "one-time" qual conditions to
be checked at plan levels below the top; namely, we have to allow for Result
nodes inserted just above a nestloop inner indexscan.  Should think about
using the general Param mechanism to pass down outer-relation variables, but
for the moment we need a back-patchable solution.  Per report from Phil Frost.
2007-02-16 03:49:10 +00:00
Tom Lane
84222cf0dd Restructure code that is responsible for ensuring that clauseless joins are
considered when it is necessary to do so because of a join-order restriction
(that is, an outer-join or IN-subselect construct).  The former coding was a
bit ad-hoc and inconsistent, and it missed some cases, as exposed by Mario
Weilguni's recent bug report.  His specific problem was that an IN could be
turned into a "clauseless" join due to constant-propagation removing the IN's
joinclause, and if the IN's subselect involved more than one relation and
there was more than one such IN linking to the same upper relation, then the
only valid join orders involve "bushy" plans but we would fail to consider the
specific paths needed to get there.  (See the example case added to the join
regression test.)  On examining the code I wonder if there weren't some other
problem cases too; in particular it seems that GEQO was defending against a
different set of corner cases than the main planner was.  There was also an
efficiency problem, in that when we did realize we needed a clauseless join
because of an IN, we'd consider clauseless joins against every other relation
whether this was sensible or not.  It seems a better design is to use the
outer-join and in-clause lists as a backup heuristic, just as the rule of
joining only where there are joinclauses is a heuristic: we'll join two
relations if they have a usable joinclause *or* this might be necessary to
satisfy an outer-join or IN-clause join order restriction.  I refactored the
code to have just one place considering this instead of three, and made sure
that it covered all the cases that any of them had been considering.

Backpatch as far as 8.1 (which has only the IN-clause form of the disease).
By rights 8.0 and 7.4 should have the bug too, but they accidentally fail
to fail, because the joininfo structure used in those releases preserves some
memory of there having once been a joinclause between the inner and outer
sides of an IN, and so it leads the code in the right direction anyway.
I'll be conservative and not touch them.
2007-02-16 00:14:08 +00:00
Tom Lane
9e850cfc72 Repair oversight in 8.2 change that improved the handling of "pseudoconstant"
WHERE clauses.  createplan.c is now willing to stick a gating Result node
almost anywhere in the plan tree, and in particular one can wind up directly
underneath a MergeJoin node.  This means it had better be willing to handle
Mark/Restore.  Fortunately, that's trivial in such cases, since we can just
pass off the call to the input node (which the planner has previously ensured
can handle Mark/Restore).  Per report from Phil Frost.
2007-02-15 03:07:21 +00:00
Tom Lane
538a983237 Disallow committing a prepared transaction unless we are in the same database
it was executed in.  Someday it might be nice to allow cross-DB commits, but
work would be needed in NOTIFY and perhaps other places.  Per Heikki.
2007-02-13 19:39:48 +00:00
Tom Lane
bc16005c0d Repair bug in 8.2's new logic for planning outer joins: we have to allow joins
that overlap an outer join's min_righthand but aren't fully contained in it,
to support joining within the RHS after having performed an outer join that
can commute with this one.  Aside from the direct fix in make_join_rel(),
fix has_join_restriction() and GEQO's desirable_join() to consider this
possibility.  Per report from Ian Harding.
2007-02-13 02:31:12 +00:00
Teodor Sigaev
15f910da96 Fix backend crash in parsing incorrect tsquery.
Per report from Jon Rosebaugh <jon@inklesspen.com>
2007-02-12 14:15:13 +00:00
Magnus Hagander
9c6cfdc239 Fix for early log messages during postmaster startup getting lost when
running as a service on Win32.

Per report from Harald Armin Massa.

Backpatch to 8.2.
2007-02-11 15:12:21 +00:00
Bruce Momjian
d6c1e1682c Fix bug when localized to_char() day or month names were incorectly
trnasformed to lower or upper string.

Backpatch to 8.2.X.

Pavel Stehule
2007-02-08 20:33:54 +00:00
Tom Lane
d1be38cc7d Fix an ancient logic error in plpgsql's exec_stmt_block: it thought it could
get away with not (re)initializing a local variable if the variable is marked
"isconst" and not "isnull".  Unfortunately it makes this decision after having
already freed the old value, meaning that something like

   for i in 1..10 loop
     declare c constant text := 'hi there';

leads to subsequent accesses to freed memory, and hence probably crashes.
(In particular, this is why Asif Ali Rehman's bug leads to crash and not
just an unexpectedly-NULL value for SQLERRM: SQLERRM is marked CONSTANT
and so triggers this error.)

The whole thing seems wrong on its face anyway: CONSTANT means that you can't
change the variable inside the block, not that the initializer expression is
guaranteed not to change value across successive block entries.  Hence,
remove the "optimization" instead of trying to fix it.
2007-02-08 18:37:43 +00:00
Tom Lane
799290b1c5 Rearrange use of plpgsql_add_initdatums() so that only the parsing of a
DECLARE section needs to know about it.  Formerly, everyplace besides DECLARE
that created variables needed to do "plpgsql_add_initdatums(NULL)" to prevent
those variables from being sucked up as part of a subsequent DECLARE block.
This is obviously error-prone, and in fact the SQLSTATE/SQLERRM patch had
failed to do it for those two variables, leading to the bug recently exhibited
by Asif Ali Rehman: a DECLARE within an exception handler tried to reinitialize
SQLERRM.

Although the SQLSTATE/SQLERRM patch isn't in any pre-8.1 branches, and so
I can't point to a demonstrable failure there, it seems wise to back-patch
this into the older branches anyway, just to keep the logic similar to HEAD.
2007-02-08 18:37:38 +00:00
Bruce Momjian
760f4823e6 This patch fixes shared_preload_libraries on Windows hosts. It forces
each backend to re-load all shared_preload_libraries.

Backpatch to 8.2.X.

Korry Douglas
2007-02-08 17:04:48 +00:00
Bruce Momjian
e1c266493c Update URL for "Generalized Partial Indexes" paper to point to a cached
version.

Backpatch to 8.2.X.
2007-02-08 04:31:41 +00:00
Bruce Momjian
76f46f5cf6 Document that wal_sync_method open_* methods use O_DIRECT, if available.
Backpatch to 8.2.X.
2007-02-08 03:57:52 +00:00
Bruce Momjian
d015e14880 Stamp releases notes for 8.2.3, 8.1.8, 8.0.12. 2007-02-07 04:23:01 +00:00
Tom Lane
18b0d7de09 Fix PG_VERSION_NUM too. 2007-02-07 03:59:30 +00:00
Bruce Momjian
98e08d1aa0 Stamp releases 8.2.3, 8.1.8, 8.0.12. No release notes yet. 2007-02-07 03:48:58 +00:00
Bruce Momjian
0b36bbf8f2 Update FAQ for 8.2.3. 2007-02-07 03:16:59 +00:00
Tom Lane
04dc48b528 Fix an error in the original coding of holdable cursors: PersistHoldablePortal
thought that it didn't have to reposition the underlying tuplestore if the
portal is atEnd.  But this is not so, because tuplestores have separate read
and write cursors ... and the read cursor hasn't moved from the start.
This mistake explains bug #2970 from William Zhang.

Note: the coding here is pretty inefficient, but given that no one has noticed
this bug until now, I'd say hardly anyone uses the case where the cursor has
been advanced before being persisted.  So maybe it's not worth worrying about.
2007-02-06 22:49:30 +00:00
Bruce Momjian
b93d4a75a0 Backpatch FAQs to 8.2.X branch. 2007-02-06 18:38:04 +00:00
Tom Lane
8d24b8bd7a Remove typmod checking from the recent security-related patches. It turns
out that ExecEvalVar and friends don't necessarily have access to a tuple
descriptor with correct typmod: it definitely can contain -1, and possibly
might contain other values that are different from the Var's value.
Arguably this should be cleaned up someday, but it's not a simple change,
and in any case typmod discrepancies don't pose a security hazard.
Per reports from numerous people :-(

I'm not entirely sure whether the failure can occur in 8.0 --- the simple
test cases reported so far don't trigger it there.  But back-patch the
change all the way anyway.
2007-02-06 17:35:27 +00:00
Michael Meskes
33623b51b6 Backported regression test changes from HEAD so the buildfarm hopefully gets green again. 2007-02-06 10:48:28 +00:00
Michael Meskes
b8dd3a8604 Backported va_list handling cleanup 2007-02-06 09:41:44 +00:00
Tom Lane
a95abdf856 Fix a performance regression in 8.2: optimization of MIN/MAX into indexscans
had stopped working for tables buried inside views or sub-selects.  This is
because I had gotten rid of the simplify_jointree() preprocessing step, and
optimize_minmax_aggregates() wasn't smart enough to deal with a non-canonical
FromExpr.  Per gripe from Bill Howe.
2007-02-06 06:50:33 +00:00
Tom Lane
5338847fcd Not only did we agree that this 'hint' doesn't belong here, but the
markup's broken.  So just remove it...
2007-02-06 03:05:00 +00:00
Bruce Momjian
de9acc94f1 Trim down environment variable instructions for Win32, backpatch to 8.2.X. 2007-02-05 22:18:18 +00:00
Andrew Dunstan
e7c63e522c Pass modern COPY syntax to backend, since copy (query) does not accept old syntax. Per complaint from Michael Fuhr. 2007-02-05 15:23:24 +00:00
Tom Lane
54111e9511 Don't MAXALIGN in the checks to decide whether a tuple is over TOAST's
threshold for tuple length.  On 4-byte-MAXALIGN machines, the toast code
creates tuples that have t_len exactly TOAST_TUPLE_THRESHOLD ... but this
number is not itself maxaligned, so if heap_insert maxaligns t_len before
comparing to TOAST_TUPLE_THRESHOLD, it'll uselessly recurse back to
tuptoaster.c, wasting cycles.  (It turns out that this does not happen on
8-byte-MAXALIGN machines, because for them the outer MAXALIGN in the
TOAST_MAX_CHUNK_SIZE macro reduces TOAST_MAX_CHUNK_SIZE so that toast tuples
will be less than TOAST_TUPLE_THRESHOLD in size.  That MAXALIGN is really
incorrect, but we can't remove it now, see below.)  There isn't any particular
value in maxaligning before comparing to the thresholds, so just don't do
that, which saves a small number of cycles in itself.

These numbers should be rejiggered to minimize wasted space on toast-relation
pages, but we can't do that in the back branches because changing
TOAST_MAX_CHUNK_SIZE would force an initdb (by changing the contents of toast
tables).  We can move the toast decision thresholds a bit, though, which is
what this patch effectively does.

Thanks to Pavan Deolasee for discovering the unintended recursion.

Back-patch into 8.2, but not further, pending more testing.  (HEAD is about
to get a further patch modifying the thresholds, so it won't help much
for testing this form of the patch.)
2007-02-04 20:00:49 +00:00
Bruce Momjian
e5352a2556 Update wording. 2007-02-04 04:00:33 +00:00
Bruce Momjian
1015fd53b6 Add documentation for Windows on how to set an environment variable.
Backpatch to 8.2.X.
2007-02-04 03:58:58 +00:00
Bruce Momjian
d68f1ecbe2 Document that a client-only install using:
gmake -C src/bin install

does install a few server-only binaries.
2007-02-03 23:01:13 +00:00
Bruce Momjian
554d3a683c Fix configure detection code when --with-ldap and --enable-thread-safety
are both used.

Backpatch to 8.2.X.

Albe Laurenz
2007-02-03 02:47:35 +00:00
Neil Conway
3714d82f76 Reword suggestion that libpq.dll be installed in WINNT\SYSTEM32 under
Windows. Per Magnus Hagander, this is not recommended.
2007-02-02 16:10:10 +00:00