]> granicus.if.org Git - postgresql/log
postgresql
15 years agoImprove the plan cache invalidation mechanism to make it invalidate plans
Tom Lane [Tue, 9 Sep 2008 18:58:09 +0000 (18:58 +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.

15 years agoImprove plpgsql's ability to report tuple incompatibility problems.
Alvaro Herrera [Tue, 9 Sep 2008 15:14:08 +0000 (15:14 +0000)]
Improve plpgsql's ability to report tuple incompatibility problems.

Volkan YAZICI

15 years agoFix a couple of problems pointed out by Fujii Masao in the 2008-Apr-05 patch
Tom Lane [Mon, 8 Sep 2008 16:42:15 +0000 (16:42 +0000)]
Fix a couple of problems pointed out by Fujii Masao in the 2008-Apr-05 patch
for pg_stop_backup.  First, it is possible that the history file name is not
alphabetically later than the last WAL file name, so we should explicitly
check that both have been archived.  Second, the previous coding would wait
forever if a checkpoint had managed to remove the WAL file before we look for
it.

Simon Riggs, plus some code cleanup by me.

15 years agoMake pg_dump --data-only try to order the table dumps so that foreign keys'
Tom Lane [Mon, 8 Sep 2008 15:26:23 +0000 (15:26 +0000)]
Make pg_dump --data-only try to order the table dumps so that foreign keys'
referenced tables are dumped before the referencing tables.  This avoids
failures when the data is loaded with the FK constraints already active.
If no such ordering is possible because of circular or self-referential
constraints, print a NOTICE to warn the user about it.

15 years agoCreate a separate grantable privilege for TRUNCATE, rather than having it be
Tom Lane [Mon, 8 Sep 2008 00:47:41 +0000 (00:47 +0000)]
Create a separate grantable privilege for TRUNCATE, rather than having it be
always owner-only.  The TRUNCATE privilege works identically to the DELETE
privilege so far as interactions with the rest of the system go.

Robert Haas

15 years agoSupport set-returning functions in the target lists of Agg and Group plan
Tom Lane [Mon, 8 Sep 2008 00:22:56 +0000 (00:22 +0000)]
Support set-returning functions in the target lists of Agg and Group plan
nodes.  This is a pretty ugly feature but since we don't yet have a
plausible substitute, we'd better support it everywhere.
Per gripe from Jeff Davis.

15 years agoClarify description of pg_restore's handling of large objects.
Tom Lane [Sun, 7 Sep 2008 19:12:57 +0000 (19:12 +0000)]
Clarify description of pg_restore's handling of large objects.

15 years agoReimplement text_position and related functions to use Boyer-Moore-Horspool
Tom Lane [Sun, 7 Sep 2008 04:20:00 +0000 (04:20 +0000)]
Reimplement text_position and related functions to use Boyer-Moore-Horspool
searching instead of naive matching.  In the worst case this has the same
O(M*N) complexity as the naive method, but the worst case is hard to hit,
and the average case is very fast, especially with longer patterns.

David Rowley

15 years agoAdd a few more details in the source-code-formatting documentation.
Tom Lane [Sun, 7 Sep 2008 02:01:04 +0000 (02:01 +0000)]
Add a few more details in the source-code-formatting documentation.
This isn't exhaustive but it covers some of the more common layout
mistakes I've seen in submitted patches.

15 years agoClarify documention workding for xip_list().
Bruce Momjian [Sun, 7 Sep 2008 01:29:36 +0000 (01:29 +0000)]
Clarify documention workding for xip_list().

Simon Riggs

15 years agoAdjust psql's new \ef command to present an empty CREATE FUNCTION template
Tom Lane [Sat, 6 Sep 2008 20:18:08 +0000 (20:18 +0000)]
Adjust psql's new \ef command to present an empty CREATE FUNCTION template
for editing if no function name is specified.  This seems a much cleaner way
to offer that functionality than the original patch had.  In passing,
de-clutter the error displays that are given for a bogus function-name
argument, and standardize on "$function$" as the default delimiter for the
function body.  (The original coding would use the shortest possible
dollar-quote delimiter, which seems to create unnecessarily high risk of
later conflicts with the user-modified function body.)

15 years agoImplement a psql command "\ef" to edit the definition of a function.
Tom Lane [Sat, 6 Sep 2008 00:01:25 +0000 (00:01 +0000)]
Implement a psql command "\ef" to edit the definition of a function.
In support of that, create a backend function pg_get_functiondef().
The psql command is functional but maybe a bit rough around the edges...

Abhijit Menon-Sen

15 years agoAdd comment about why pg_dump doesn't dump the public schema comment.
Bruce Momjian [Fri, 5 Sep 2008 23:53:42 +0000 (23:53 +0000)]
Add comment about why pg_dump doesn't dump the public schema comment.

15 years agoFix an oversight in the 8.2 patch that improved mergejoin performance by
Tom Lane [Fri, 5 Sep 2008 21:07:29 +0000 (21:07 +0000)]
Fix an oversight in the 8.2 patch that improved mergejoin performance by
inserting a materialize node above an inner-side sort node, when the sort is
expected to spill to disk.  (The materialize protects the sort from having
to support mark/restore, allowing it to do its final merge pass on-the-fly.)
We neglected to teach cost_mergejoin about that hack, so it was failing to
include the materialize's costs in the estimated cost of the mergejoin.
The materialize's costs are generally going to be pretty negligible in
comparison to the sort's, so this is only a small error and probably not
worth back-patching; but it's still wrong.

In the similar case where a materialize is inserted to protect an inner-side
node that can't do mark/restore at all, it's still true that the materialize
should not spill to disk, and so we should cost it cheaply rather than
expensively.

Noted while thinking about a question from Tom Raney.

15 years agoCheck for gcov and lcov only when coverage testing is enabled.
Peter Eisentraut [Fri, 5 Sep 2008 18:54:58 +0000 (18:54 +0000)]
Check for gcov and lcov only when coverage testing is enabled.

15 years agoAdd some additional casts and regression tests for the citext data type.
Tom Lane [Fri, 5 Sep 2008 18:25:17 +0000 (18:25 +0000)]
Add some additional casts and regression tests for the citext data type.
David Wheeler

15 years agoAdd Win32 MSVC code to support this recent patch:
Bruce Momjian [Fri, 5 Sep 2008 16:54:39 +0000 (16:54 +0000)]
Add Win32 MSVC code to support this recent patch:

Add missing descriptions for aggregates, functions and conversions.

Bernd Helmle

15 years agoCode coverage testing with gcov. Documentation is in the regression test
Peter Eisentraut [Fri, 5 Sep 2008 12:11:18 +0000 (12:11 +0000)]
Code coverage testing with gcov.  Documentation is in the regression test
chapter.

Author: Michelle Caisse <Michelle.Caisse@Sun.COM>

15 years agoAdd DSSSL stylesheet location for Mac OS X/Fink installation.
Peter Eisentraut [Fri, 5 Sep 2008 09:37:37 +0000 (09:37 +0000)]
Add DSSSL stylesheet location for Mac OS X/Fink installation.

15 years agoFix strategy propagation to scanEntry for partial match by moving propagation
Teodor Sigaev [Thu, 4 Sep 2008 11:47:05 +0000 (11:47 +0000)]
Fix strategy propagation to scanEntry for partial match by moving propagation
to initializaion of scanEntry.

15 years agoIf a loadable module has wrong values in its magic block, spell out
Tom Lane [Wed, 3 Sep 2008 22:34:50 +0000 (22:34 +0000)]
If a loadable module has wrong values in its magic block, spell out
exactly what they are in the complaint message.  Marko Kreen,
some editorialization by me.

15 years agoPrevent memory leaks in our various bison parsers when an error occurs
Tom Lane [Tue, 2 Sep 2008 20:37:55 +0000 (20:37 +0000)]
Prevent memory leaks in our various bison parsers when an error occurs
during parsing.  Formerly the parser's stack was allocated with malloc
and so wouldn't be reclaimed; this patch makes it use palloc instead,
so that flushing the current context will reclaim the memory.  Per
Marko Kreen.

15 years agoFix plpgsql's exec_move_row() to supply valid type OIDs to exec_assign_value()
Tom Lane [Mon, 1 Sep 2008 22:30:33 +0000 (22:30 +0000)]
Fix plpgsql's exec_move_row() to supply valid type OIDs to exec_assign_value()
whenever possible, as per bug report from Oleg Serov.  While at it, reorder
the operations in the RECORD case to avoid possible palloc failure while the
variable update is only partly complete.

Back-patch as far as 8.1.  Although the code of the particular function is
similar in 8.0, 8.0's support for composite fields in rows is sufficiently
broken elsewhere that it doesn't seem worth fixing this.

15 years agoSigh, I missed checking the ecpg tests ...
Tom Lane [Mon, 1 Sep 2008 21:42:18 +0000 (21:42 +0000)]
Sigh, I missed checking the ecpg tests ...

15 years agoAdd a variant expected-output file for the sequence regression test, to cover
Tom Lane [Mon, 1 Sep 2008 21:24:52 +0000 (21:24 +0000)]
Add a variant expected-output file for the sequence regression test, to cover
output that is seen when a checkpoint occurs at just the right time during
the test.  Per my report of 2008-08-31.

This could be back-patched but I'm not sure it's worth the trouble.

15 years agoAdd a bunch of new error location reports to parse-analysis error messages.
Tom Lane [Mon, 1 Sep 2008 20:42:46 +0000 (20:42 +0000)]
Add a bunch of new error location reports to parse-analysis error messages.
There are still some weak spots around JOIN USING and relation alias lists,
but most errors reported within backend/parser/ now have locations.

15 years agoHeapTupleHeaderAdjustCmax made the incorrect assumption that the raw
Heikki Linnakangas [Mon, 1 Sep 2008 18:52:45 +0000 (18:52 +0000)]
HeapTupleHeaderAdjustCmax made the incorrect assumption that the raw
command id is the cmin, when it can in fact be a combo cid. That made rows
incorrectly invisible to a transaction where a tuple was deleted by multiple
aborted subtransactions.

Report and patch Karl Schnaitter. Back-patch to 8.3, where combo cids was
introduced.

15 years agoSynchronize the shared object build rules in Makefile.port with Makefile.shlib
Peter Eisentraut [Mon, 1 Sep 2008 08:50:10 +0000 (08:50 +0000)]
Synchronize the shared object build rules in Makefile.port with Makefile.shlib
somewhat by adding CFLAGS where the compiler is used and Makefile.shlib
already used CFLAGS.

15 years agoFix (hopefully) some oversights in recent Bison cleanup patch.
Tom Lane [Sat, 30 Aug 2008 02:32:24 +0000 (02:32 +0000)]
Fix (hopefully) some oversights in recent Bison cleanup patch.
Per buildfarm results.

15 years agoFix the raw-parsetree representation of star (as in SELECT * FROM or
Tom Lane [Sat, 30 Aug 2008 01:39:14 +0000 (01:39 +0000)]
Fix the raw-parsetree representation of star (as in SELECT * FROM or
SELECT foo.*) so that it cannot be confused with a quoted identifier "*".
Instead create a separate node type A_Star to represent this notation.
Per pgsql-hackers discussion of 2007-Sep-27.

15 years agoIn GCC-based builds, use a better newNode() macro that relies on GCC-specific
Tom Lane [Fri, 29 Aug 2008 22:49:07 +0000 (22:49 +0000)]
In GCC-based builds, use a better newNode() macro that relies on GCC-specific
syntax to avoid a useless store into a global variable.  Per experimentation,
this works better than my original thought of trying to push the code into
an out-of-line subroutine.

15 years agoFixup pg_dumpall adding --lock-wait-timeout, to match pg_dump.
Alvaro Herrera [Fri, 29 Aug 2008 17:28:43 +0000 (17:28 +0000)]
Fixup pg_dumpall adding --lock-wait-timeout, to match pg_dump.

David Gould

15 years agoSuppress gcc warning about possibly-uninitialized variable. It's not
Tom Lane [Fri, 29 Aug 2008 16:34:14 +0000 (16:34 +0000)]
Suppress gcc warning about possibly-uninitialized variable.  It's not
clear to me why I'd not seen this message before --- on F-9 it seems to
only happen if Asserts are disabled, which ought to be irrelevant.
Maybe that affects a decision whether to inline get_ten(), which would
be needed to expose the warning condition to the compiler?  Anyway,
the fix is clear.

15 years agoDocument that \t and \x are now settable.
Alvaro Herrera [Fri, 29 Aug 2008 15:52:07 +0000 (15:52 +0000)]
Document that \t and \x are now settable.

15 years agoRemove all traces that suggest that a non-Bison yacc might be supported, and
Peter Eisentraut [Fri, 29 Aug 2008 13:02:33 +0000 (13:02 +0000)]
Remove all traces that suggest that a non-Bison yacc might be supported, and
change build system to use only Bison.  Simplify build rules, make file names
uniform.  Don't build the token table header file where it is not needed.

15 years agoExtend the parser location infrastructure to include a location field in
Tom Lane [Thu, 28 Aug 2008 23:09:48 +0000 (23:09 +0000)]
Extend the parser location infrastructure to include a location field in
most node types used in expression trees (both before and after parse
analysis).  This allows us to place an error cursor in many situations
where we formerly could not, because the information wasn't available
beyond the very first level of parse analysis.  There's a fair amount
of work still to be done to persuade individual ereport() calls to actually
include an error location, but this gets the initdb-forcing part of the
work out of the way; and the situation is already markedly better than
before for complaints about unimplementable implicit casts, such as
CASE and UNION constructs with incompatible alternative data types.
Per my proposal of a few days ago.

15 years agoTeach eval_const_expressions() to simplify an ArrayCoerceExpr to a constant
Tom Lane [Tue, 26 Aug 2008 02:16:31 +0000 (02:16 +0000)]
Teach eval_const_expressions() to simplify an ArrayCoerceExpr to a constant
when its input is constant and the element coercion function is immutable
(or nonexistent, ie, binary-coercible case).  This is an oversight in the
8.3 implementation of ArrayCoerceExpr, and its result is that certain cases
involving IN or NOT IN with constants don't get optimized as they should be.
Per experimentation with an example from Ow Mun Heng.

15 years agoFix pg_dump docs to acknowledge that you can use -Z with plain text output. Pointed...
Tom Lane [Tue, 26 Aug 2008 00:03:15 +0000 (00:03 +0000)]
Fix pg_dump docs to acknowledge that you can use -Z with plain text output.  Pointed out by Daniel Migowski.

15 years agoAdd %option noinput to contrib's flex scanners, to suppress gcc 4.3
Tom Lane [Mon, 25 Aug 2008 23:12:45 +0000 (23:12 +0000)]
Add %option noinput to contrib's flex scanners, to suppress gcc 4.3
warnings.  Peter did this for core awhile ago but evidently missed
contrib.

15 years agoMove exprType(), exprTypmod(), expression_tree_walker(), and related routines
Tom Lane [Mon, 25 Aug 2008 22:42:34 +0000 (22:42 +0000)]
Move exprType(), exprTypmod(), expression_tree_walker(), and related routines
into nodes/nodeFuncs, so as to reduce wanton cross-subsystem #includes inside
the backend.  There's probably more that should be done along this line,
but this is a start anyway.

15 years agoGet rid of the last remaining uses of var_is_rel(), to wit some debugging
Tom Lane [Mon, 25 Aug 2008 20:20:30 +0000 (20:20 +0000)]
Get rid of the last remaining uses of var_is_rel(), to wit some debugging
checks in ExecIndexBuildScanKeys() that were inadequate anyway: it's better
to verify the correct varno on an expected index key, not just reject OUTER
and INNER.

This makes the entire current contents of nodeFuncs.c dead code.  I'll be
replacing it with some other stuff later, as per recent proposal.

15 years agoAdd standard boilerplate sentence about when stats_temp_directory can be changed.
Tom Lane [Mon, 25 Aug 2008 19:03:37 +0000 (19:03 +0000)]
Add standard boilerplate sentence about when stats_temp_directory can be changed.

15 years agoUnconditionally write the statsfile when SIGHUP is received, to minimize
Magnus Hagander [Mon, 25 Aug 2008 18:55:43 +0000 (18:55 +0000)]
Unconditionally write the statsfile when SIGHUP is received, to minimize
the window during which backends have no statistics file to read.

15 years agoUpdate URL to Ross William's paper.
Alvaro Herrera [Mon, 25 Aug 2008 17:37:40 +0000 (17:37 +0000)]
Update URL to Ross William's paper.

Devrim Gunduz.

15 years agoHave man page generation work on VPATH builds too.
Alvaro Herrera [Mon, 25 Aug 2008 15:34:05 +0000 (15:34 +0000)]
Have man page generation work on VPATH builds too.

15 years agoMake stats_temp_directory PGC_SIGHUP, and document how it may cause a temporary
Magnus Hagander [Mon, 25 Aug 2008 15:11:01 +0000 (15:11 +0000)]
Make stats_temp_directory PGC_SIGHUP, and document how it may cause a temporary
"outage" of the statistics views.

This requires making the stats collector respond to SIGHUP, like the other
utility processes already did.

15 years agoConvert remaining builtin set-returning functions to use OUT parameters, making
Magnus Hagander [Mon, 25 Aug 2008 11:18:43 +0000 (11:18 +0000)]
Convert remaining builtin set-returning functions to use OUT parameters, making
it possible to call them without specifying a column list.

Jaime Casanova

15 years agoAdd missing descriptions for aggregates, functions and conversions.
Bruce Momjian [Sat, 23 Aug 2008 20:31:37 +0000 (20:31 +0000)]
Add missing descriptions for aggregates, functions and conversions.

Bernd Helmle

15 years agoFix possible duplicate tuples while GiST scan. Now page is processed
Teodor Sigaev [Sat, 23 Aug 2008 10:37:24 +0000 (10:37 +0000)]
Fix possible duplicate tuples while  GiST scan. Now page is processed
at once and ItemPointers are collected in memory.

Remove tuple's killing by killtuple() if tuple was moved to another
page - it could produce unaceptable overhead.

Backpatch up to 8.1 because the bug was introduced by GiST's concurrency support.

15 years agoUpdate link to developer's FAQ from main FAQ.
Bruce Momjian [Sat, 23 Aug 2008 01:55:36 +0000 (01:55 +0000)]
Update link to developer's FAQ from main FAQ.

15 years agoMake "log_temp_files" super-user set only, like other logging options.
Bruce Momjian [Fri, 22 Aug 2008 18:47:07 +0000 (18:47 +0000)]
Make "log_temp_files" super-user set only, like other logging options.

Simon Riggs

15 years agoMinor patch on pgbench
Bruce Momjian [Fri, 22 Aug 2008 17:57:34 +0000 (17:57 +0000)]
Minor patch on pgbench

1. -i option should run vacuum analyze only on pgbench tables, not *all*
tables in database.

2. pre-run cleanup step was DELETE FROM HISTORY then VACUUM HISTORY.
This is just a slow version of TRUNCATE HISTORY.

Simon Riggs

15 years agoImprove wording of error message when a postgresql.conf setting is
Bruce Momjian [Fri, 22 Aug 2008 00:20:40 +0000 (00:20 +0000)]
Improve wording of error message when a postgresql.conf setting is
ignored because it can only be set at server start.

15 years agoArrange to convert EXISTS subqueries that are equivalent to hashable IN
Tom Lane [Fri, 22 Aug 2008 00:16:04 +0000 (00:16 +0000)]
Arrange to convert EXISTS subqueries that are equivalent to hashable IN
subqueries into the same thing you'd have gotten from IN (except always with
unknownEqFalse = true, so as to get the proper semantics for an EXISTS).
I believe this fixes the last case within CVS HEAD in which an EXISTS could
give worse performance than an equivalent IN subquery.

The tricky part of this is that if the upper query probes the EXISTS for only
a few rows, the hashing implementation can actually be worse than the default,
and therefore we need to make a cost-based decision about which way to use.
But at the time when the planner generates plans for subqueries, it doesn't
really know how many times the subquery will be executed.  The least invasive
solution seems to be to generate both plans and postpone the choice until
execution.  Therefore, in a query that has been optimized this way, EXPLAIN
will show two subplans for the EXISTS, of which only one will actually get
executed.

There is a lot more that could be done based on this infrastructure: in
particular it's interesting to consider switching to the hash plan if we start
out using the non-hashed plan but find a lot more upper rows going by than we
expected.  I have therefore left some minor inefficiencies in place, such as
initializing both subplans even though we will currently only use one.

15 years agoMention that pg_dump does not dump ALTER DATABASE ... SET commands;
Bruce Momjian [Thu, 21 Aug 2008 22:25:44 +0000 (22:25 +0000)]
Mention that pg_dump does not dump ALTER DATABASE ... SET commands;
backpatch to 8.3.X. Also fix markup that had just one bullet.

15 years agoUpdate URL.
Alvaro Herrera [Thu, 21 Aug 2008 20:15:31 +0000 (20:15 +0000)]
Update URL.

15 years agoAutoconf 2.62 will require cache variables to contain "_cv_". Fix our few
Peter Eisentraut [Thu, 21 Aug 2008 13:53:28 +0000 (13:53 +0000)]
Autoconf 2.62 will require cache variables to contain "_cv_".  Fix our few
noncomplying cases to be future-proof.

15 years agoMarginal improvement in sublink planning: allow unknownEqFalse optimization
Tom Lane [Wed, 20 Aug 2008 19:58:24 +0000 (19:58 +0000)]
Marginal improvement in sublink planning: allow unknownEqFalse optimization
to be used for SubLinks that are underneath a top-level OR clause.  Just as at
the very top level of WHERE, it's not necessary to be accurate about whether
the sublink returns FALSE or NULL, because either result has the same impact
on whether the WHERE will succeed.

15 years agoRemove tools and documention for generating TODO.html.
Bruce Momjian [Wed, 20 Aug 2008 18:22:28 +0000 (18:22 +0000)]
Remove tools and documention for generating TODO.html.

15 years agoTODO now in wiki, html version removed.
Bruce Momjian [Wed, 20 Aug 2008 18:21:33 +0000 (18:21 +0000)]
TODO now in wiki, html version removed.

15 years agoNew TODO list URL wiki location listed; contents truncated.
Bruce Momjian [Wed, 20 Aug 2008 18:20:46 +0000 (18:20 +0000)]
New TODO list URL wiki location listed; contents truncated.

15 years agoFix obsolete comment. It's no longer the case that Param nodes don't
Tom Lane [Wed, 20 Aug 2008 15:49:30 +0000 (15:49 +0000)]
Fix obsolete comment.  It's no longer the case that Param nodes don't
carry typmod.

15 years agoSynced parser.
Michael Meskes [Wed, 20 Aug 2008 14:09:16 +0000 (14:09 +0000)]
Synced parser.

15 years agoMake libpq on windows not try to send chunks larger than 64Kb.
Magnus Hagander [Wed, 20 Aug 2008 11:53:45 +0000 (11:53 +0000)]
Make libpq on windows not try to send chunks larger than 64Kb.

Per Microsoft knowledge base article Q201213, early versions of
Windows fail when we do this. Later versions of Windows appear
to have a higher limit than 64Kb, but do still fail on large
sends, so we unconditionally limit it for all versions.

Patch from Tom Lane.

15 years agoNot done:
Bruce Momjian [Tue, 19 Aug 2008 19:19:53 +0000 (19:19 +0000)]
Not done:

<  o -Allow an existing index to be marked as a table's primary key
>  o Allow an existing index to be marked as a table's primary key

15 years agoRemove -Winline from the default set of CFLAGS for gcc. It's gotten much
Tom Lane [Tue, 19 Aug 2008 19:17:40 +0000 (19:17 +0000)]
Remove -Winline from the default set of CFLAGS for gcc.  It's gotten much
too noisy to be useful as of gcc 4.3, and we were never really doing
anything about inlining warnings anyway.

15 years agoCause the output from debug_print_parse, debug_print_rewritten, and
Tom Lane [Tue, 19 Aug 2008 18:30:04 +0000 (18:30 +0000)]
Cause the output from debug_print_parse, debug_print_rewritten, and
debug_print_plan to appear at LOG message level, not DEBUG1 as historically.
Make debug_pretty_print default to on.  Also, cause plans generated via
EXPLAIN to be subject to debug_print_plan.  This is all to make
debug_print_plan a reasonably comfortable substitute for the former behavior
of EXPLAIN VERBOSE.

15 years agoTODO done:
Bruce Momjian [Tue, 19 Aug 2008 16:56:42 +0000 (16:56 +0000)]
TODO done:

!       o Allow an existing index to be marked as a table's primary key

15 years agoFixed incorrect argument handling in SET command if argument is a variable.
Michael Meskes [Tue, 19 Aug 2008 10:40:32 +0000 (10:40 +0000)]
Fixed incorrect argument handling in SET command if argument is a variable.

15 years agoFix some issues that prevent this file to be processed by scripts.
Alvaro Herrera [Tue, 19 Aug 2008 03:08:56 +0000 (03:08 +0000)]
Fix some issues that prevent this file to be processed by scripts.

While at it, mark a couple of items completed in 8.4:
!   o -Prevent long-lived temporary tables from causing frozen-xid
      advancement starvation

! * -Improve performance of shared invalidation queue for multiple CPUs

Also remove a couple of obsolete assignments.

15 years agoAdd to TODO:
Bruce Momjian [Mon, 18 Aug 2008 15:02:46 +0000 (15:02 +0000)]
Add to TODO:

>
> * Fix all set-returning system functions so they support a wildcard
>   target list
>
>   SELECT * FROM pg_get_keywords() works but SELECT * FROM
>   pg_show_all_settings() does not.

15 years agoProperly remove src\include\utils\probes.h when running clean.bat.
Magnus Hagander [Mon, 18 Aug 2008 13:42:49 +0000 (13:42 +0000)]
Properly remove src\include\utils\probes.h when running clean.bat.

15 years agoAdd some defenses against constant-FALSE outer join conditions. Since
Tom Lane [Sun, 17 Aug 2008 19:40:11 +0000 (19:40 +0000)]
Add some defenses against constant-FALSE outer join conditions.  Since
eval_const_expressions will generally throw away anything that's ANDed with
constant FALSE, what we're left with given an example like

select * from tenk1 a where (unique1,0) in (select unique2,1 from tenk1 b);

is a cartesian product computation, which is really not acceptable.
This is a regression in CVS HEAD compared to previous releases, which were
able to notice the impossible join condition in this case --- though not in
some related cases that are also improved by this patch, such as

select * from tenk1 a left join tenk1 b on (a.unique1=b.unique2 and 0=1);

Fix by skipping evaluation of the appropriate side of the outer join in
cases where it's demonstrably unnecessary.

15 years agoRemove prohibition against SubLinks in the WHERE clause of an EXISTS subquery
Tom Lane [Sun, 17 Aug 2008 02:19:19 +0000 (02:19 +0000)]
Remove prohibition against SubLinks in the WHERE clause of an EXISTS subquery
that we're considering pulling up.  I hadn't wanted to think through whether
that could work during the first pass at this stuff.  However, on closer
inspection it seems to be safe enough.

15 years agoImprove sublink pullup code to handle ANY/EXISTS sublinks that are at top
Tom Lane [Sun, 17 Aug 2008 01:20:00 +0000 (01:20 +0000)]
Improve sublink pullup code to handle ANY/EXISTS sublinks that are at top
level of a JOIN/ON clause, not only at top level of WHERE.  (However, we
can't do this in an outer join's ON clause, unless the ANY/EXISTS refers
only to the nullable side of the outer join, so that it can effectively
be pushed down into the nullable side.)  Per request from Kevin Grittner.

In passing, fix a bug in the initial implementation of EXISTS pullup:
it would Assert if the EXIST's WHERE clause used a join alias variable.
Since we haven't yet flattened join aliases when this transformation
happens, it's necessary to include join relids in the computed set of
RHS relids.

15 years agoUpdate instructions on generating TODO.html.
Bruce Momjian [Sat, 16 Aug 2008 19:39:03 +0000 (19:39 +0000)]
Update instructions on generating TODO.html.

15 years agoprobes.h is generated from probes.d, not pg_trace.d.
Magnus Hagander [Sat, 16 Aug 2008 12:42:27 +0000 (12:42 +0000)]
probes.h is generated from probes.d, not pg_trace.d.

15 years agoAdd URL for:
Bruce Momjian [Sat, 16 Aug 2008 02:36:58 +0000 (02:36 +0000)]
Add URL for:

* Improve ability to modify views via ALTER TABLE
<
>   http://archives.postgresql.org/pgsql-hackers/2008-08/msg00300.php

15 years agoFix pg_dump/pg_restore's ExecuteSqlCommand() to behave suitably if PQexec
Tom Lane [Sat, 16 Aug 2008 02:25:06 +0000 (02:25 +0000)]
Fix pg_dump/pg_restore's ExecuteSqlCommand() to behave suitably if PQexec
returns NULL instead of a PGresult.  The former coding would fail, which
is OK, but it neglected to give you the PQerrorMessage that might tell
you why.  In the oldest branches, there was another problem: it'd sometimes
report PQerrorMessage from the wrong connection.

15 years agoAdd to TODO:
Bruce Momjian [Sat, 16 Aug 2008 02:15:33 +0000 (02:15 +0000)]
Add to TODO:

>
> * Prevent query cancel packets from being replayed by an attacker,
>   especially when using SSL
>
>   http://archives.postgresql.org/pgsql-hackers/2008-08/msg00345.php
>

15 years agoSynchronize Borland libpq makefile to match MSVC. Backpatch to 8.3.X.
Bruce Momjian [Sat, 16 Aug 2008 01:56:20 +0000 (01:56 +0000)]
Synchronize Borland libpq makefile to match MSVC.  Backpatch to 8.3.X.

15 years agoFix a couple of places where psql might fail to report a suitable error
Tom Lane [Sat, 16 Aug 2008 01:36:35 +0000 (01:36 +0000)]
Fix a couple of places where psql might fail to report a suitable error
if PQexec returns NULL.  These don't seem significant enough to be worth
back-patching, but they ought to get fixed ...

15 years agoUpdate Russian FAQ.
Bruce Momjian [Sat, 16 Aug 2008 01:14:49 +0000 (01:14 +0000)]
Update Russian FAQ.

corochoone@gmail.com

15 years agoAdd new SQL training web site to FAQ:
Bruce Momjian [Sat, 16 Aug 2008 00:32:36 +0000 (00:32 +0000)]
Add new SQL training web site to FAQ:

    <LI><A href=
    "http://sqlzoo.net">http://sqlzoo.net</A>
    </LI>

15 years agoFix version warning bug in recently applied adjustments to psql startup.
Bruce Momjian [Sat, 16 Aug 2008 00:16:56 +0000 (00:16 +0000)]
Fix version warning bug in recently applied adjustments to psql startup.

Gregory Stark

15 years agoClean up the loose ends in selectivity estimation left by my patch for semi
Tom Lane [Sat, 16 Aug 2008 00:01:38 +0000 (00:01 +0000)]
Clean up the loose ends in selectivity estimation left by my patch for semi
and anti joins.  To do this, pass the SpecialJoinInfo struct for the current
join as an additional optional argument to operator join selectivity
estimation functions.  This allows the estimator to tell not only what kind
of join is being formed, but which variable is on which side of the join;
a requirement long recognized but not dealt with till now.  This also leaves
the door open for future improvements in the estimators, such as accounting
for the null-insertion effects of lower outer joins.  I didn't do anything
about that in the current patch but the information is in principle deducible
from what's passed.

The patch also clarifies the definition of join selectivity for semi/anti
joins: it's the fraction of the left input that has (at least one) match
in the right input.  This allows getting rid of some very fuzzy thinking
that I had committed in the original 7.4-era IN-optimization patch.
There's probably room to estimate this better than the present patch does,
but at least we know what to estimate.

Since I had to touch CREATE OPERATOR anyway to allow a variant signature
for join estimator functions, I took the opportunity to add a couple of
additional checks that were missing, per my recent message to -hackers:
* Check that estimator functions return float8;
* Require execute permission at the time of CREATE OPERATOR on the
operator's function as well as the estimator functions;
* Require ownership of any pre-existing operator that's modified by
the command.
I also moved the lookup of the functions out of OperatorCreate() and
into operatorcmds.c, since that seemed more consistent with most of
the other catalog object creation processes, eg CREATE TYPE.

15 years agoPerformance fix for new anti-join code in nodeMergejoin.c: after finding a
Tom Lane [Fri, 15 Aug 2008 19:20:42 +0000 (19:20 +0000)]
Performance fix for new anti-join code in nodeMergejoin.c: after finding a
match in antijoin mode, we should advance to next outer tuple not next inner.
We know we don't want to return this outer tuple, and there is no point in
advancing over matching inner tuples now, because we'd just have to do it
again if the next outer tuple has the same merge key.  This makes a noticeable
difference if there are lots of duplicate keys in both inputs.

Similarly, after finding a match in semijoin mode, arrange to advance to
the next outer tuple after returning the current match; or immediately,
if it fails the extra quals.  The rationale is the same.  (This is a
performance bug in existing releases; perhaps worth back-patching?  The
planner tries to avoid using mergejoin with lots of duplicates, so it may
not be a big issue in practice.)

Nestloop and hash got this right to start with, but I made some cosmetic
adjustments there to make the corresponding bits of logic look more similar.

15 years agoMake the temporary directory for pgstat files configurable by the GUC
Magnus Hagander [Fri, 15 Aug 2008 08:37:41 +0000 (08:37 +0000)]
Make the temporary directory for pgstat files configurable by the GUC
variable stats_temp_directory, instead of requiring the admin to
mount/symlink the pg_stat_tmp directory manually.

For now the config variable is PGC_POSTMASTER. Room for further improvment
that would allow it to be changed on-the-fly.

15 years agoFix pull_up_simple_union_all to copy all rtable entries from child subquery to
Heikki Linnakangas [Thu, 14 Aug 2008 20:31:29 +0000 (20:31 +0000)]
Fix pull_up_simple_union_all to copy all rtable entries from child subquery to
parent, not only those with RangeTblRefs. We need them in ExecCheckRTPerms.

Report by Brendan O'Shea. Back-patch to 8.2, where pull_up_simple_union_all
was introduced.

15 years agoImplement SEMI and ANTI joins in the planner and executor. (Semijoins replace
Tom Lane [Thu, 14 Aug 2008 18:48:00 +0000 (18:48 +0000)]
Implement SEMI and ANTI joins in the planner and executor.  (Semijoins replace
the old JOIN_IN code, but antijoins are new functionality.)  Teach the planner
to convert appropriate EXISTS and NOT EXISTS subqueries into semi and anti
joins respectively.  Also, LEFT JOINs with suitable upper-level IS NULL
filters are recognized as being anti joins.  Unify the InClauseInfo and
OuterJoinInfo infrastructure into "SpecialJoinInfo".  With that change,
it becomes possible to associate a SpecialJoinInfo with every join attempt,
which permits some cleanup of join selectivity estimation.  That needs to be
taken much further than this patch does, but the next step is to change the
API for oprjoin selectivity functions, which seems like material for a
separate patch.  So for the moment the output size estimates for semi and
especially anti joins are quite bogus.

15 years agopg_buffercache needs to be taught about relation forks, as Greg Stark
Heikki Linnakangas [Thu, 14 Aug 2008 12:56:41 +0000 (12:56 +0000)]
pg_buffercache needs to be taught about relation forks, as Greg Stark
pointed out.

15 years agoAdd URL for:
Bruce Momjian [Thu, 14 Aug 2008 01:57:42 +0000 (01:57 +0000)]
Add URL for:

* Improve ability to modify views via ALTER TABLE

>   http://archives.postgresql.org/pgsql-hackers/2008-07/msg01410.php

15 years agoHave autovacuum consider processing TOAST tables separately from their
Alvaro Herrera [Wed, 13 Aug 2008 00:07:50 +0000 (00:07 +0000)]
Have autovacuum consider processing TOAST tables separately from their
main tables.

This requires vacuum() to accept processing a toast table standalone, so
there's a user-visible change in that it's now possible (for a superuser) to
execute "VACUUM pg_toast.pg_toast_XXX".

15 years agoRemove TODO item
Peter Eisentraut [Tue, 12 Aug 2008 09:55:08 +0000 (09:55 +0000)]
Remove TODO item

    Allow XML to accept more liberal DOCTYPE specifications

Everything works correctly, per today's email to -general.

15 years agoAdd:
Bruce Momjian [Tue, 12 Aug 2008 03:48:52 +0000 (03:48 +0000)]
Add:

> * Add 'hostgss' pg_hba.conf option to allow GSS link-level encryption
>
>   http://archives.postgresql.org/pgsql-hackers/2008-07/msg01454.php

15 years agoRelation forks patch requires a catversion bump due to changes in the format
Heikki Linnakangas [Mon, 11 Aug 2008 13:58:46 +0000 (13:58 +0000)]
Relation forks patch requires a catversion bump due to changes in the format
of some WAL records, and two-phase state files, which I forgot.

15 years agoIntroduce the concept of relation forks. An smgr relation can now consist
Heikki Linnakangas [Mon, 11 Aug 2008 11:05:11 +0000 (11:05 +0000)]
Introduce the concept of relation forks. An smgr relation can now consist
of multiple forks, and each fork can be created and grown separately.

The bulk of this patch is about changing the smgr API to include an extra
ForkNumber argument in every smgr function. Also, smgrscheduleunlink and
smgrdounlink no longer implicitly call smgrclose, because other forks might
still exist after unlinking one. The callers of those functions have been
modified to call smgrclose instead.

This patch in itself doesn't have any user-visible effect, but provides the
infrastructure needed for upcoming patches. The additional forks envisioned
are a rewritten FSM implementation that doesn't rely on a fixed-size shared
memory block, and a visibility map to allow skipping portions of a table in
VACUUM that have no dead tuples.

15 years agoFix corner-case bug introduced with HOT: if REINDEX TABLE pg_class (or a
Tom Lane [Sun, 10 Aug 2008 19:02:33 +0000 (19:02 +0000)]
Fix corner-case bug introduced with HOT: if REINDEX TABLE pg_class (or a
REINDEX DATABASE including same) is done before a session has done any other
update on pg_class, the pg_class relcache entry was left with an incorrect
setting of rd_indexattr, because the indexed-attributes set would be first
demanded at a time when we'd forced a partial list of indexes into the
pg_class entry, and it would remain cached after that.  This could result
in incorrect decisions about HOT-update safety later in the same session.
In practice, since only pg_class_relname_nsp_index would be missed out,
only ALTER TABLE RENAME and ALTER TABLE SET SCHEMA could trigger a problem.
Per report and test case from Ondrej Jirman.

15 years agoInstall checks in executor startup to ensure that the tuples produced by an
Tom Lane [Fri, 8 Aug 2008 17:01:11 +0000 (17:01 +0000)]
Install checks in executor startup to ensure that the tuples produced by an
INSERT or UPDATE will match the target table's current rowtype.  In pre-8.3
releases inconsistency can arise with stale cached plans, as reported by
Merlin Moncure.  (We patched the equivalent hazard on the SELECT side in Feb
2007; I'm not sure why we thought there was no risk on the insertion side.)
In 8.3 and HEAD this problem should be impossible due to plan cache
invalidation management, but it seems prudent to make the check anyway.

Back-patch as far as 8.0.  7.x versions lack ALTER COLUMN TYPE, so there
seems no way to abuse a stale plan comparably.

15 years agoImprove INTERSECT/EXCEPT hashing by realizing that we don't need to make any
Tom Lane [Thu, 7 Aug 2008 19:35:02 +0000 (19:35 +0000)]
Improve INTERSECT/EXCEPT hashing by realizing that we don't need to make any
hashtable entries for tuples that are found only in the second input: they
can never contribute to the output.  Furthermore, this implies that the
planner should endeavor to put first the smaller (in number of groups) input
relation for an INTERSECT.  Implement that, and upgrade prepunion's estimation
of the number of rows returned by setops so that there's some amount of sanity
in the estimate of which one is smaller.