Tom Lane [Sat, 16 Oct 2004 21:50:02 +0000 (21:50 +0000)]
Include dllist.c directly instead of assuming that libpq will provide it.
Whack some semblance of project-conventions-conformance into pg_autovacuum.h.
Tom Lane [Sat, 16 Oct 2004 20:10:57 +0000 (20:10 +0000)]
Generate the various .def files for libpq DLLs from a single list of
exportable functions. The .def files are removed from CVS, but will
still be present in distribution tarballs, since we can't assume that
Windows boxes will have sed.
Tom Lane [Sat, 16 Oct 2004 19:08:38 +0000 (19:08 +0000)]
Limit NBuffers and some related values to INT_MAX / BLCKSZ, to prevent
arithmetic overflow during initial sizing calculations. This is not
water-tight but it should avoid the grossest sorts of failures.
Tom Lane [Sat, 16 Oct 2004 18:57:26 +0000 (18:57 +0000)]
Give the ResourceOwner mechanism full responsibility for releasing buffer
pins at end of transaction, and reduce AtEOXact_Buffers to an Assert
cross-check that this was done correctly. When not USE_ASSERT_CHECKING,
AtEOXact_Buffers is a complete no-op. This gets rid of an O(NBuffers)
bottleneck during transaction commit/abort, which recent testing has shown
becomes significant above a few tens of thousands of shared buffers.
Tom Lane [Sat, 16 Oct 2004 18:05:07 +0000 (18:05 +0000)]
Remove BufferLocks[] array in favor of a single pointer to the buffer
(if any) currently waited for by LockBufferForCleanup(), which is all
that we were using it for anymore. Saves some space and eliminates
proportional-to-NBuffers slowdown in UnlockBuffers().
Tom Lane [Fri, 15 Oct 2004 22:40:29 +0000 (22:40 +0000)]
Repair possible failure to update hint bits back to disk, per
http://archives.postgresql.org/pgsql-hackers/2004-10/msg00464.php.
This fix is intended to be permanent: it moves the responsibility for
calling SetBufferCommitInfoNeedsSave() into the tqual.c routines,
eliminating the requirement for callers to test whether t_infomask changed.
Also, tighten validity checking on buffer IDs in bufmgr.c --- several
routines were paranoid about out-of-range shared buffer numbers but not
about out-of-range local ones, which seems a tad pointless.
Bruce Momjian [Fri, 15 Oct 2004 17:10:58 +0000 (17:10 +0000)]
The previous build rules caused each binary to be re-linked on every
"make", even if nothing had changed. With this patch, it's only relinked
if it's actually updated.
//Magnus
PS. Yes, the old buildrule for the .rc file is still needed, as it's
used by pgevent.rc (or any other binary in the future that would need
it's own .rc file)
Bruce Momjian [Fri, 15 Oct 2004 17:08:26 +0000 (17:08 +0000)]
I have attached 5 patches (split up for ease of review) to plperl.c.
1. Two minor cleanups:
- We don't need to call hv_exists+hv_fetch; we should just check the
return value of hv_fetch.
- newSVpv("undef",0) is the string "undef", not a real undef.
2. This should fix the bug Andrew Dunstan described in a recent -hackers
post. It replaces three bogus "eval_pv(key, 0)" calls with newSVpv,
and eliminates another redundant hv_exists+hv_fetch pair.
3. plperl_build_tuple_argument builds up a string of Perl code to create
a hash representing the tuple. This patch creates the hash directly.
4. Another minor cleanup: replace a couple of av_store()s with av_push.
5. Analogous to #3 for plperl_trigger_build_args. This patch removes the
static sv_add_tuple_value function, which does much the same as two
other utility functions defined later, and merges the functionality
into plperl_hash_from_tuple.
I have tested the patches to the best of my limited ability, but I would
appreciate it very much if someone else could review and test them too.
(Thanks to Andrew and David Fetter for their help with some testing.)
Bruce Momjian [Fri, 15 Oct 2004 05:11:00 +0000 (05:11 +0000)]
> This lets you do something like:
>
> ./configure LDFLAGS=-static-libgcc LDFLAGS_SL=-static-libgcc
>
> to produce binaries that do not depend on libgcc_s.so at all.
Bruce Momjian [Fri, 15 Oct 2004 04:54:33 +0000 (04:54 +0000)]
Fix pg_ctl -D handling for Win32:
C:\msys\1.0\home\y-asaba>pg_ctl -D data restart
waiting for postmaster to shut down...LOG: received smart shutdown
request.
LOG: shutting down
LOG: database system is shut down
done
postmaster stopped
postmaster starting
C:\msys\1.0\home\y-asaba>postmaster.exe: invalid argument: "'-D'"
Try "postmaster.exe --help" for more information.
Neil Conway [Wed, 13 Oct 2004 01:25:13 +0000 (01:25 +0000)]
More minor cosmetic improvements:
- remove another senseless "extern" keyword that was applied to a
function definition
- change a foo more function signatures from "some_type foo()" to
"some_type foo(void)"
- rewrite another K&R style function definition
- make the type of the "action" function pointer in the KeyWord struct
in src/backend/utils/adt/formatting.c more precise
Bruce Momjian [Wed, 13 Oct 2004 01:03:11 +0000 (01:03 +0000)]
Add:
> * Add RESET CONNECTION command to reset all session state 329a331,334
> This would include resetting of all variables (RESET ALL), dropping of
> all temporary tables, removal of any NOTIFYs, etc. This could be used
> for connection pooling. We could also change RESET ALL to have this
> functionality.
Tom Lane [Tue, 12 Oct 2004 15:44:15 +0000 (15:44 +0000)]
plpgsql EXIT construct forgot to downcase or quote-strip its identifier
argument, leading to label matching failures at run-time. Per report from
Patrick Fiche. Also, fix it so that an unrecognized label argument draws
a more useful error message than 'syntax error'.
Tom Lane [Mon, 11 Oct 2004 23:27:23 +0000 (23:27 +0000)]
Use -fPIC not -fpic for BSDen on Sparc. Also switch from
$(LD) -x -Bshareable to $(CC) -shared on OpenBSD (I suspect this
should be carried over to the other two as well, but will refrain
pending suggestions from people who actually use those platforms).
Per Stefan Kaltenbrunner.
Tom Lane [Mon, 11 Oct 2004 22:57:00 +0000 (22:57 +0000)]
Fix OR-index-scan planner to recognize that a partial index is usable
for scanning one term of an OR clause if the index's predicate is implied
by that same OR clause term (possibly in conjunction with top-level WHERE
clauses). Per recent example from Dawid Kuroczko,
http://archives.postgresql.org/pgsql-performance/2004-10/msg00095.php
Also, fix a very long-standing bug in index predicate testing, namely the
bizarre ordering of decomposition of predicate and restriction clauses.
AFAICS the correct way is to break down the predicate all the way, and
then for each component term see if you can prove it from the entire
restriction set. The original coding had a purely-implementation-artifact
distinction between ANDing at the top level and ANDing below that, and
proceeded to get the decomposition order wrong everywhere below the top
level, with the result that even slightly complicated AND/OR predicates
could not be proven. For instance, given
create index foop on foo(f2) where f1=42 or f1=1
or (f1 = 11 and f2 = 55);
the old code would fail to match this index to the query
select * from foo where f1 = 11 and f2 = 55;
when it obviously ought to match.
Tom Lane [Mon, 11 Oct 2004 19:32:19 +0000 (19:32 +0000)]
Another try at making plpython autoconfiguration work correctly. Use a
-L spec rather than assuming libpython is in the standard search path
(this returns to the way 7.4 did it). But check the distutils output
to see if it looks like Python has built a shared library, and if so
link with that instead of the probably-not-shared library found in
configdir.
Tom Lane [Mon, 11 Oct 2004 17:24:41 +0000 (17:24 +0000)]
Fix pg_indexes view so that it shows the index's tablespace not the
parent table's tablespace, as per gripe from Michael Kleiser. Choose
a more plausible column order for this view and pg_tables. Update
documentation of these views, which was missed in original patch.
Neil Conway [Sun, 10 Oct 2004 23:37:45 +0000 (23:37 +0000)]
Cosmetic improvements/code cleanup:
- replace some function signatures of the form "some_type foo()" with
"some_type foo(void)"
- replace a few instances of a literal 0 being used as a NULL pointer;
there are more instances of this in the code, but I just fixed a few
- in src/backend/utils/mb/wstrncmp.c, replace K&R style function
declarations with ANSI style, remove use of 'register' keyword
- remove an "extern" modifier that was applied to a function definition
(rather than a declaration)
Tom Lane [Sat, 9 Oct 2004 23:13:22 +0000 (23:13 +0000)]
Adjust configuration-files GUC behavior as per my recent proposal.
The vars are renamed to data_directory, config_file, hba_file, and
ident_file, and are guaranteed to be set to accurate absolute paths
during postmaster startup.
This commit does not yet do anything about hiding path values from
non-superusers.
Bruce Momjian [Fri, 8 Oct 2004 16:28:32 +0000 (16:28 +0000)]
Move Win32 TODO items to main TODO list:
<
> * Win32
> o Remove per-backend parameter file and move into shared memory?
> o Remove configure.in check for link failure when cause is found
> o Remove readdir() errno patch when runtime/mingwex/dirent.c rev
> 1.4 is released
> o Remove psql newline patch when we find out why mingw outputs an
> extra newline
> o Allow psql to use readline once non-US code pages work with
> backslashes
Neil Conway [Fri, 8 Oct 2004 11:24:19 +0000 (11:24 +0000)]
Another minor tweak to psql startup: set the default values for the PROMPT1,
PROMPT2 and PROMPT3 variables before we read any of the settings specified
via the user on the command-line or in psqlrc, so that the latter can
override the former. Per original patch from Ingo van Lil, simpler fix
suggested by Tom Lane.
Tom Lane [Fri, 8 Oct 2004 01:36:36 +0000 (01:36 +0000)]
Whack some sense into the configuration-file-location patch.
Refactor code into something reasonably understandable, cause
use of the feature to not fail in standalone backends or in
EXEC_BACKEND case, fix sloppy guc.c table entries, make the
documentation minimally usable.
Bruce Momjian [Fri, 8 Oct 2004 00:36:23 +0000 (00:36 +0000)]
Add:
* Consider parallel processing a single query
This would involve using multiple threads or processes to do optimization,
sorting, or execution of single query. The major advantage of such a
feature would be to allow multiple CPUs to work together to process a
single query.
Tom Lane [Thu, 7 Oct 2004 20:36:52 +0000 (20:36 +0000)]
Change get_rule_expr so that when the input is a List, it displays the
list elements comma-separated instead of barfing. This allows elimination
of half a dozen redundant copies of that behavior, and also makes the
world safe again for pg_get_expr() applied to pg_index.indexprs, per gripe
from Alexander Zhiltsov.
Tom Lane [Thu, 7 Oct 2004 18:38:51 +0000 (18:38 +0000)]
Fix problems with SQL functions returning rowtypes that have dropped
columns. The returned tuple needs to have appropriate NULL columns
inserted so that it actually matches the declared rowtype. It seemed
convenient to use a JunkFilter for this, so I made some cleanups and
simplifications in the JunkFilter code to allow it to support this
additional functionality. (That in turn exposed a latent bug in
nodeAppend.c, which is that it was returning a tuple slot whose
descriptor didn't match its data.) Also, move check_sql_fn_retval
out of pg_proc.c and into functions.c, where it seems to more naturally
belong.
Bruce Momjian [Thu, 7 Oct 2004 17:03:50 +0000 (17:03 +0000)]
Update comment to fix nibble mention:
* We are not sure how much precision is in tv_usec, so we
* swap the high and low 16 bits of 'later' and XOR them with
* 'earlier'. On the off chance that the result is 0, we
* loop until it isn't.