Commit Graph

17159 Commits

Author SHA1 Message Date
Tom Lane 836feeda9c Fix condition for whether end_heap_rewrite must fsync, per Heikki. 2007-04-17 21:29:31 +00:00
Tom Lane 4942ee656a Don't assume rd_smgr stays open across all of a rewriteheap operation;
doing so can result in crash if an sinval reset occurs meanwhile.
I believe this explains intermittent buildfarm failures in cluster test.
2007-04-17 20:49:39 +00:00
Tom Lane 2e824a8ea9 Rewrite choose_bitmap_and() to make it more robust in the presence of
competing alternatives for indexes to use in a bitmap scan.  The former
coding took estimated selectivity as an overriding factor, causing it to
sometimes choose indexes that were much slower to scan than ones with a
slightly worse selectivity.  It was also too narrow-minded about which
combinations of indexes to consider ANDing.  The rewrite makes it pay more
attention to index scan cost than selectivity; this seems sane since it's
impossible to have very bad selectivity with low cost, whereas the reverse
isn't true.  Also, we now consider each index alone, as well as adding
each index to an AND-group led by each prior index, for a total of about
O(N^2) rather than O(N) combinations considered.  This makes the results
much less dependent on the exact order in which the indexes are
considered.  It's still a lot cheaper than an O(2^N) exhaustive search.
A prefilter step eliminates all but the cheapest of those indexes using
the same set of WHERE conditions, to keep the effective value of N down in
scenarios where the DBA has created lots of partially-redundant indexes.
2007-04-17 20:03:03 +00:00
Magnus Hagander 2ee5d945f9 Don't write timing output in quiet mode.
Merlin Moncure
2007-04-16 20:15:38 +00:00
Tom Lane 274dfdb513 Tweak clean_encoding_name() API to avoid need to cast away const.
Kris Jurka
2007-04-16 18:50:49 +00:00
Tom Lane 6ee2a3be4a Fix pg_dump to not crash if -t or a similar switch is used to select a serial
sequence for dumping without also selecting its owning table.  Make it not try
to emit ALTER SEQUENCE OWNED BY in this situation.
Per report from Michael Nolan.
2007-04-16 18:42:10 +00:00
Magnus Hagander de9effb55f Enable IPV6 for all MSVC builds, including the VC6 libpq-only build.
Per request from Hiroshi Saito.
2007-04-16 18:39:19 +00:00
Alvaro Herrera e2a186b03c Add a multi-worker capability to autovacuum. This allows multiple worker
processes to be running simultaneously.  Also, now autovacuum processes do not
count towards the max_connections limit; they are counted separately from
regular processes, and are limited by the new GUC variable
autovacuum_max_workers.

The launcher now has intelligence to launch workers on each database every
autovacuum_naptime seconds, limited only on the max amount of worker slots
available.

Also, the global worker I/O utilization is limited by the vacuum cost-based
delay feature.  Workers are "balanced" so that the total I/O consumption does
not exceed the established limit.  This part of the patch was contributed by
ITAGAKI Takahiro.

Per discussion.
2007-04-16 18:30:04 +00:00
Tom Lane 42dc4b66e6 Make plancache store cursor options so it can pass them to planner during
a replan.  I had originally thought this was not necessary, but the new
SPI facilities create a path whereby queries planned with non-default
options can get into the cache, so it is necessary.
2007-04-16 18:21:07 +00:00
Tom Lane f01b196597 Support scrollable cursors (ie, 'direction' clause in FETCH) in plpgsql.
Pavel Stehule, reworked a bit by Tom.
2007-04-16 17:21:24 +00:00
Tom Lane 66888f7424 Expose more cursor-related functionality in SPI: specifically, allow
access to the planner's cursor-related planning options, and provide new
FETCH/MOVE routines that allow access to the full power of those commands.
Small refactoring of planner(), pg_plan_query(), and pg_plan_queries()
APIs to make it convenient to pass the planning options down from SPI.

This is the core-code portion of Pavel Stehule's patch for scrollable
cursor support in plpgsql; I'll review and apply the plpgsql changes
separately.
2007-04-16 01:14:58 +00:00
Tom Lane fa92d21a48 Avoid running build_index_pathkeys() in situations where there cannot
possibly be any useful pathkeys --- to wit, queries with neither any
join clauses nor any ORDER BY request.  It's nearly free to check for
this case and it saves a useful fraction of the planning time for simple
queries.
2007-04-15 20:09:28 +00:00
Andrew Dunstan f97d4a267a Add --with-libxslt configure option 2007-04-15 12:48:24 +00:00
Tatsuo Ishii 6041b92238 Make JOHAB client only encoding per discussions in pgsql-hackers
"Server-side support of all encodings" around 2007/3/26.
initdb required.
2007-04-15 10:56:30 +00:00
Tatsuo Ishii bf47e3e419 Fix description how to create conversion function. 2007-04-15 10:49:26 +00:00
Magnus Hagander bf3b8d8ad8 Allow \timing in psql to have a better resolution than ~15ms on Windows.
ITAGAKI Takahiro
2007-04-13 20:40:59 +00:00
Andrew Dunstan 6506a584cc Enable building contrib/xml2 if configured using --with-libxml.
If this breaks things due to missing libxslt, then I'll have to
revert it, but let's see if it breaks the buildfarm.

Workarounds in case libxslt is missing include:
. don't configure with libxml, or
. don't build contrib modules from the contrib Makefile (use the individual module Makefiles instead), or
. change the xml2 Makefile
2007-04-13 18:50:01 +00:00
Magnus Hagander 15ebfeec2d Add O_DIRECT support on Windows.
ITAGAKI Takahiro
2007-04-13 10:30:30 +00:00
Neil Conway 6df6d8e361 Fixes for RESET SESSION patch, per Alvaro. Fix a typo in the RESET
ref page (sorry, my fault!), and simplify the coding of
ResetTempTableNamespace().
2007-04-12 22:34:45 +00:00
Tom Lane 995ba280c1 Rearrange mdsync() looping logic to avoid the problem that a sufficiently
fast flow of new fsync requests can prevent mdsync() from ever completing.
This was an unforeseen consequence of a patch added in Mar 2006 to prevent
the fsync request queue from overflowing.  Problem identified by Heikki
Linnakangas and independently by ITAGAKI Takahiro; fix based on ideas from
Takahiro-san, Heikki, and Tom.

Back-patch as far as 8.1 because a previous back-patch introduced the problem
into 8.1 ...
2007-04-12 17:10:55 +00:00
Tom Lane ebb6bae539 Cancel pending fsync requests during WAL replay of DROP DATABASE, per bug
report from David Darville.  Back-patch as far as 8.1, which may or may not
have the problem but it seems a safe change anyway.
2007-04-12 15:04:35 +00:00
Magnus Hagander b60ddffa93 Install debugger symbols (in their own directory) 2007-04-12 12:46:20 +00:00
Magnus Hagander 4dd3365086 Enable IPV6 when building with MSVC. 2007-04-12 07:03:00 +00:00
Neil Conway d13e903bea RESET SESSION, plus related new DDL commands. Patch from Marko Kreen,
reviewed by Neil Conway. This patch adds the following DDL command
variants: RESET SESSION, RESET TEMP, RESET PLANS, CLOSE ALL, and
DEALLOCATE ALL. RESET SESSION is intended for use by connection
pool software and the like, in order to reset a client session
to something close to its initial state.

Note that while most of these command variants can be executed
inside a transaction block (but are not transaction-aware!),
RESET SESSION cannot. While this is inconsistent, it is intended
to catch programmer mistakes: RESET SESSION in an open transaction
block is probably unintended.
2007-04-12 06:53:49 +00:00
Tom Lane 226a100568 Code review for btree page split WAL reduction patch. Make it actually work
(original code *always* created a full-page image for the left page, thus
leaving the intended savings unrealized), avoid risk of not having enough room
on the page during xlog restore, squeeze out another couple bytes in the xlog
record, clean up neglected comments.
2007-04-11 20:47:38 +00:00
Tom Lane 56218fbc48 Minor tweaking of index special-space definitions so that the various
index types can be reliably distinguished by examining the special space
on an index page.  Per my earlier proposal, plus the realization that
there's no need for btree's vacuum cycle ID to cycle through every possible
16-bit value.  Restricting its range a little costs nearly nothing and
eliminates the possibility of collisions.
Memo to self: remember to make bitmap indexes play along with this scheme,
assuming that patch ever gets accepted.
2007-04-09 22:04:08 +00:00
Magnus Hagander 6e09df9d26 Add cancel handlers so it's possible to Ctrl-C clusterdb, reindexdb
and vacuumdb.
ITAGAKI Takahiro, with minor fixes from me.
2007-04-09 18:21:22 +00:00
Tom Lane 7b78474da3 Make CLUSTER MVCC-safe. Heikki Linnakangas 2007-04-08 01:26:33 +00:00
Bruce Momjian e55c8e36ae Support syntax "CLUSTER table USING index", which is more logical.
Holger Schurig
2007-04-08 00:26:34 +00:00
Tom Lane b396df8485 Don't remove the 'alias' field from flattened rangetable entries;
there are some corner cases where this is needed by ruleutils.c for
proper display of variables during EXPLAIN.
2007-04-06 22:57:20 +00:00
Tom Lane f02a82b6ad Make 'col IS NULL' clauses be indexable conditions.
Teodor Sigaev, with some kibitzing from Tom Lane.
2007-04-06 22:33:43 +00:00
Andrew Dunstan e1f1a5358b Only run contrib check if there is a Makefile 2007-04-06 13:44:39 +00:00
Tom Lane 37a609b27f Now that core functionality is depending on autoconf's AC_C_BIGENDIAN to be
right, there seems precious little reason to have a pile of hand-maintained
endianness definitions in src/include/port/*.h.  Get rid of those, and make
the couple of places that used them depend on WORDS_BIGENDIAN instead.
2007-04-06 05:36:51 +00:00
Tom Lane 3e23b68dac Support varlena fields with single-byte headers and unaligned storage.
This commit breaks any code that assumes that the mere act of forming a tuple
(without writing it to disk) does not "toast" any fields.  While all available
regression tests pass, I'm not totally sure that we've fixed every nook and
cranny, especially in contrib.

Greg Stark with some help from Tom Lane
2007-04-06 04:21:44 +00:00
Bruce Momjian d44163953c Update XML error message text for missing libxml; update regression
output to match.
2007-04-05 13:53:24 +00:00
Magnus Hagander ab94cc92e4 Continue running contrib regression tests if one fails, and exit
with errorlevel 1 is >= 1 checks failed.
2007-04-05 12:31:36 +00:00
Magnus Hagander 4c40130296 Make sure list of tests is cleared out before getting the new list
of tests. Per Andrew Dunstan.
2007-04-05 12:10:40 +00:00
Bruce Momjian 43666e8216 Improve documentation/warning when --with-libxml is not used in the
installation.
2007-04-05 01:46:27 +00:00
Andrew Dunstan 618aec735c improve test headings 2007-04-04 20:53:44 +00:00
Andrew Dunstan e687c4c3c7 Don't install files for xml2 when building without libxml. 2007-04-04 18:45:59 +00:00
Bruce Momjian 3b93fba823 Remove plpython casts C source code casts:
It removes last remaining casts inside struct definitions.
Such usage is bad practice, as it hides problems from compiler.

Reason for the cast is popular practice in some circles
to define functions as foo(MyObj *) instead of foo(PyObject *)
thus avoiding a local variable inside functions and make
direct calling easier.  As pl/python does not use such style,
the casts were unnecessary from the start.


Marko Kreen
2007-04-04 17:28:11 +00:00
Magnus Hagander 8f296ebea7 Don't install files for sslinfo when building without openssl.
Per Andrew Dunstan.
2007-04-04 16:34:43 +00:00
Tom Lane 9c9b619473 Remove the CheckpointStartLock in favor of having backends show whether they
are in their commit critical sections via flags in the ProcArray.  Checkpoint
can watch the ProcArray to determine when it's safe to proceed.  This is
a considerably better solution to the original problem of race conditions
between checkpoint and transaction commit: it speeds up commit, since there's
one less lock to fool with, and it prevents the problem of checkpoint being
delayed indefinitely when there's a constant flow of commits.  Heikki, with
some kibitzing from Tom.
2007-04-03 16:34:36 +00:00
Bruce Momjian bfe8b89e41 Allow pl/pythonu >= version 2.3 to return boolean, rather than 1/0.
Marko Kreen
2007-04-03 15:50:58 +00:00
Bruce Momjian 749167cf2a Allow PL/PythonU to compile on Python 2.5. Change needed because of API
changes in Python.

Marko Kreen
2007-04-03 13:37:22 +00:00
Bruce Momjian 9665dd92b8 Update comment for new thread_test location. 2007-04-03 12:55:23 +00:00
Tom Lane b3005276eb Decouple the values of TOAST_TUPLE_THRESHOLD and TOAST_MAX_CHUNK_SIZE.
Add the latter to the values checked in pg_control, since it can't be changed
without invalidating toast table content.  This commit in itself shouldn't
change any behavior, but it lays some necessary groundwork for experimentation
with these toast-control numbers.

Note: while TOAST_TUPLE_THRESHOLD can now be changed without initdb, some
thought still needs to be given to needs_toast_table() in toasting.c before
unleashing random changes.
2007-04-03 04:14:26 +00:00
Bruce Momjian f16f89a616 Allow NOTIFY/LISTEN/UNLISTEN to only take relation names, not
schema.relation, because the notify code only honors the relation name.
schema.relation will now generate a syntax error.
2007-04-02 22:20:53 +00:00
Andrew Dunstan 325feaef7f Check length of enum literals on definition and input to make sure they will fit in a name field and not cause syscache errors. 2007-04-02 22:14:17 +00:00
Tom Lane 9a527f1848 Fix check_sql_fn_retval to allow the case where a SQL function declared to
return void ends with a SELECT, if that SELECT has a single result that is
also of type void.  Without this, it's hard to write a void function that
calls another void function.  Per gripe from Peter.

Back-patch as far as 8.0.
2007-04-02 18:49:29 +00:00
Magnus Hagander b7d3a84539 xcopy can only deal with forward-slashed paths when it's quoted - needed
for "vcregress check" to work.
Per report from Dave Page.
2007-04-02 12:11:26 +00:00
Tom Lane 57690c6803 Support enum data types. Along the way, use macros for the values of
pg_type.typtype whereever practical.  Tom Dunstan, with some kibitzing
from Tom Lane.
2007-04-02 03:49:42 +00:00
Peter Eisentraut a482a3e58b Update catversion for new XML mapping functions 2007-04-01 09:56:02 +00:00
Peter Eisentraut b0fe9c20e9 Update SQL conformance for SQL to XML mappings 2007-04-01 09:42:57 +00:00
Peter Eisentraut 0b75afda92 Mapping schemas and databases to XML and XML Schema.
Refactor and document the remaining mapping code.
2007-04-01 09:00:26 +00:00
Peter Eisentraut ae8072a404 Complete cleaning 2007-04-01 08:56:58 +00:00
Magnus Hagander 335feca441 Add some instrumentation to the bgwriter, through the stats collector.
New view pg_stat_bgwriter, and the functions required to build it.
2007-03-30 18:34:56 +00:00
Tom Lane 8875d0987d Fix oversight in coding of _bt_start_vacuum: we can't assume that the LWLock
will be released by transaction abort before _bt_end_vacuum gets called.
If either of these "can't happen" errors actually happened, we'd freeze up
trying to acquire an already-held lock.  Latest word is that this does
not explain Martin Pitt's trouble report, but it still looks like a bug.
2007-03-30 00:12:59 +00:00
Bruce Momjian 452427d0fd pg_char_to_encoding() was redundant in initdb because
pg_valid_server_encoding() returns the same result if the encoding is
valid.

ITAGAKI Takahiro
2007-03-29 22:46:42 +00:00
Magnus Hagander 81622ac36e Install include files 2007-03-29 20:48:26 +00:00
Tom Lane 972e20b429 exec_parse_message neglected to copy parameter type array into the
required memory context when handling client-specified parameter types
for an unnamed statement.  Per report from Kris Jurka.
2007-03-29 19:10:10 +00:00
Magnus Hagander 96b171903d Make ECPG regression tests use native threading instead of pthreads, now that
ecpglib supports it.
Change configure (patch from Bruce) and msvc build system to no longer require
 pthreads on win32, since all parts of postgresql can be thread-safe using the
 native platform functions.
2007-03-29 15:30:52 +00:00
Michael Meskes ddcb5bbf76 - Added patch by Magnus Hagander <magnus@hagander.net> to use native
win32 threads.
- Fixed regression tests to run threading tests.
2007-03-29 12:02:24 +00:00
Tom Lane fba8113c1b Teach CLUSTER to skip writing WAL if not needed (ie, not using archiving)
--- Simon.
Also, code review and cleanup for the previous COPY-no-WAL patches --- Tom.
2007-03-29 00:15:39 +00:00
Neil Conway 4591fb1aa8 Code cleanup for the new regexp UDFs: we can hardcode the OID and some
properties of the "text" type, and then simplify the code accordingly.
Patch from Jeremy Drake.
2007-03-28 22:59:37 +00:00
Alvaro Herrera 7d4c9a5793 Add the "recheck" logic to autovacuum worker code. The worker first builds
its table list and then rechecks pgstat before vacuuming each table to
verify that no one has vacuumed the table in the meantime.

In the current autovacuum world this only means that a worker will not
vacuum a table that a user has vacuumed manually after the worker started.
When support for multiple autovacuum workers is introduced, this will reduce
the probability of simultaneous workers on the same database doing redundant
work.
2007-03-28 22:17:12 +00:00
Magnus Hagander 685badd213 Fix compiler warnings in ereport messages on mingw.
ITAGAKI Takahiro
2007-03-28 08:06:11 +00:00
Tom Lane bf94076348 Fix array coercion expressions to ensure that the correct volatility is
seen by code inspecting the expression.  The best way to do this seems
to be to drop the original representation as a function invocation, and
instead make a special expression node type that represents applying
the element-type coercion function to each array element.  In this way
the element function is exposed and will be checked for volatility.
Per report from Guillaume Smet.
2007-03-27 23:21:12 +00:00
Magnus Hagander 87564ffc6a Install import libraries used to link to libpq, ecpg and the backend. 2007-03-27 21:47:10 +00:00
Alvaro Herrera f1a596bdfb Cosmetic changes: rename some struct fields, and move the fetching of pgstat
table entries to a separate routine.  Don't pass the pgstat database entry to
do_autovacuum; rather, have it fetch it by itself.
2007-03-27 20:36:03 +00:00
Bruce Momjian b8f856512e Fix typo in Makefile.
Marko Kreen
2007-03-27 14:29:51 +00:00
Tom Lane 856b87c294 Fix typo, ensable -> enable, per Steve Gieseking. 2007-03-27 03:25:28 +00:00
Bruce Momjian 87d82561c5 Remove Andrew Yu copyright, with permission from author. 2007-03-26 21:51:15 +00:00
Bruce Momjian 9dd3ec6c3b Remove advertising clause from Berkeley BSD-licensed files, per
instructions from Berkeley.
2007-03-26 21:44:11 +00:00
Tom Lane 55a7cf80a0 Allow non-superuser database owners to create procedural languages.
A DBA is allowed to create a language in his database if it's marked
"tmpldbacreate" in pg_pltemplate.  The factory default is that this is set
for all standard trusted languages, but of course a superuser may adjust
the settings.  In service of this, add the long-foreseen owner column to
pg_language; renaming, dropping, and altering owner of a PL now follow
normal ownership rules instead of being superuser-only.
Jeremy Drake, with some editorialization by Tom Lane.
2007-03-26 16:58:41 +00:00
Tatsuo Ishii a6fbd2f12a Fix pg_wchar_table's maxmblen field of EUC_CN, EUC_TW, MULE_INTERNAL
and GB18030. patches from ITAGAKI Takahiro.
2007-03-26 11:15:13 +00:00
Tom Lane 7ee8fd9113 Seems some people have been forgetting to run autoheader. 2007-03-26 02:38:22 +00:00
Tom Lane dc1b8cea93 Fix plancache's invalidation callback to do the right thing for a SI
reset event, namely invalidate everything.  This oversight probably
explains the rare failures that some buildfarm machines have been
showing for the plancache regression test.
2007-03-26 00:36:19 +00:00
Tom Lane 1cc97d175c Make _SPI_execute_plan pass the query source string down to ProcessUtility
if possible.  I had left this undone in the first pass at the API change
for ProcessUtility, but forgot to revisit it after the plancache changes
made it possible to do it.
2007-03-25 23:42:43 +00:00
Tom Lane bf8236526b Remove the prohibition on executing cursor commands through SPI_execute.
Vadim had included this restriction in the original design of the SPI code,
but I'm darned if I can see a reason for it.

I left the macro definition of SPI_ERROR_CURSOR in place, so as not to
needlessly break any SPI callers that are checking for it, but that code
will never actually be returned anymore.
2007-03-25 23:27:59 +00:00
Tom Lane e85a01df67 Clean up the representation of special snapshots by including a "method
pointer" in every Snapshot struct.  This allows removal of the case-by-case
tests in HeapTupleSatisfiesVisibility, which should make it a bit faster
(I didn't try any performance tests though).  More importantly, we are no
longer violating portable C practices by assuming that small integers are
distinct from all pointer values, and HeapTupleSatisfiesDirty no longer
has a non-reentrant API involving side-effects on a global variable.

There were a couple of places calling HeapTupleSatisfiesXXX routines
directly rather than through the HeapTupleSatisfiesVisibility macro.
Since these places had to be changed anyway, I chose to make them go
through the macro for uniformity.

Along the way I renamed HeapTupleSatisfiesSnapshot to HeapTupleSatisfiesMVCC
to emphasize that it's only used with MVCC-type snapshots.  I was sorely
tempted to rename HeapTupleSatisfiesVisibility to HeapTupleSatisfiesSnapshot,
but forebore for the moment to avoid confusion and reduce the likelihood that
this patch breaks some of the pending patches.  Might want to reconsider
doing that later.
2007-03-25 19:45:14 +00:00
Tatsuo Ishii 75c6519ff6 Add new encoding EUC_JIS_2004 and SHIFT_JIS_2004,
along with new conversions among EUC_JIS_2004, SHIFT_JIS_2004 and UTF-8.
catalog version has been bump up.
2007-03-25 11:56:04 +00:00
Magnus Hagander 8ca1571665 Support for installing NLS files, and update support to use gettext
from gnuwin32.
2007-03-24 22:16:49 +00:00
Magnus Hagander 5e37b4cb1a Install contrib sql and readme files 2007-03-24 15:28:48 +00:00
Magnus Hagander ecfb932a5a Properly parse the name of contrib modules that aren't named the same
way as their directory (notably xml2/pgxml and intarray/_int)
2007-03-24 14:13:27 +00:00
Alvaro Herrera e019bbc9e8 Set the node properly, per Tom. 2007-03-23 21:57:10 +00:00
Alvaro Herrera a0abe87f1c Separate the code to start a new worker into its own function. The code is
exactly the same, modulo whitespace.
2007-03-23 21:45:17 +00:00
Alvaro Herrera 6287eb7adc Separate fetch of pg_autovacuum tuple into its own function. 2007-03-23 21:23:13 +00:00
Alvaro Herrera 8aaecaf809 We no longer need to palloc the VacuumStmt node; keeping it on the stack is
simpler.
2007-03-23 20:56:39 +00:00
Tom Lane 23a41573c4 Adjust DatumGetBool macro so that it isn't fooled by garbage in the Datum
to the left of the actual bool value.  While in most cases there won't be
any, our support for old-style user-defined functions violates the C spec
to the extent of calling functions that might return char or short through
a function pointer declared to return "char *", which we then coerce to
Datum.  It is not surprising that the result might contain garbage
high-order bits ... what is surprising is that we didn't see such cases
long ago.  Per report from Magnus.
2007-03-23 20:24:41 +00:00
Tom Lane 547b6e537a Fix plancache so that any required replanning is done with the same
search_path that was active when the plan was first made.  To do this,
improve namespace.c to support a stack of "override" search path settings
(we must have a stack since nested replan events are entirely possible).
This facility replaces the "special namespace" hack formerly used by
CREATE SCHEMA, and should be able to support per-function search path
settings as well.
2007-03-23 19:53:52 +00:00
Tatsuo Ishii 4c35ec53a9 Allow 4 bytes UTF-8 (UCS-4 range 00010000-001FFFFF)
This is necessary to support JIS X 0213 <--> UTF-8 conversion.
2007-03-23 13:51:30 +00:00
Magnus Hagander 6b77e3a8cc Forgot commit: support for special-cases in pgcrypto 2007-03-23 10:05:34 +00:00
Magnus Hagander 3024b0aa94 Support for running contribcheck on msvc 2007-03-23 09:57:55 +00:00
Magnus Hagander e69f7f450c Generate SQL files for /contrib (based on .sql.in) 2007-03-23 09:53:33 +00:00
Magnus Hagander fb8155d0d2 Add define to exclude configured libraries, to be able to easily build a
stripped down version of libpq. To be used by the installer.
2007-03-23 08:43:51 +00:00
Magnus Hagander 1ca6ab1c78 Remove headers for old sysv shmem emulation that I forgot.
Also remove headers for old sysv semaphore emulation that were forgotten
when that was changed about a year ago.
2007-03-23 08:30:55 +00:00
Bruce Momjian 1e2bfb5811 Cleanup for procarray.c. 2007-03-23 03:16:39 +00:00
Bruce Momjian 9c51b922b6 Add comment that pg_dump 'append' format is used only by pg_dump, per
Dave Page.
2007-03-22 20:47:12 +00:00
Bruce Momjian ea3b212fee Commit newest version of xmlpath().
Nikolay Samokhvalov
2007-03-22 20:26:30 +00:00
Bruce Momjian f317a03734 In pg_dump, strcasecmp -> pg_strcasecmp. 2007-03-22 20:18:49 +00:00
Bruce Momjian e651bcf3f6 Add xmlpath() to evaluate XPath expressions, with namespaces support.
Nikolay Samokhvalov
2007-03-22 20:14:58 +00:00
Tom Lane 4f896dac17 Arrange for PreventTransactionChain to reject commands submitted as part
of a multi-statement simple-Query message.  This bug goes all the way
back, but unfortunately is not nearly so easy to fix in existing releases;
it is only the recent ProcessUtility API change that makes it fixable in
HEAD.  Per report from William Garrison.
2007-03-22 19:55:04 +00:00
Bruce Momjian 686956375a Allow the pgstat process to restart immediately after a receiving
SIGQUIT signal, rather than waiting for PGSTAT_RESTART_INTERVAL.
2007-03-22 19:53:31 +00:00
Tom Lane a4127b713d Allow DROP TABLESPACE to succeed (with a warning) if the pg_tblspc symlink
doesn't exist.  This allows DROP to be used to clean out the pg_tablespace
catalog entry in a situation where a previous DROP attempt failed before
committing but after having removed the directories and symlink.

Per report from William Garrison.  Even though his test case depends on an
unrelated bug in PreventTransactionChain, it's certainly possible for this
situation to arise due to other problems, eg a system crash at just the
right time.
2007-03-22 19:51:44 +00:00
Bruce Momjian 832b6d00e9 Properly enforce pg_dump -F formation options; only single letter or
full words support, per report from Mark Stosberg.
2007-03-22 19:42:02 +00:00
Alvaro Herrera 8f65c02f33 Remove the currently unused FRONTEND case in dllist.c. This allows the usage
of palloc instead of malloc, which means a list can be freed simply by deleting
the memory context that contains it.
2007-03-22 18:57:52 +00:00
Magnus Hagander d55227f01b Forgot to add file needed for PL regression tests 2007-03-22 13:43:02 +00:00
Tom Lane 54d20024c1 Fix some problems with selectivity estimation for partial indexes.
First, genericcostestimate() was being way too liberal about including
partial-index conditions in its selectivity estimate, resulting in
substantial underestimates for situations such as an indexqual "x = 42"
used with an index on x "WHERE x >= 40 AND x < 50".  While the code is
intentionally set up to favor selecting partial indexes when available,
this was too much...

Second, choose_bitmap_and() was likewise easily fooled by cases of this
type, since it would similarly think that the partial index had selectivity
independent of the indexqual.

Fixed by using predicate_implied_by() rather than simple equality checks
to determine redundancy.  This is a good deal more expensive but I don't
see much alternative.  At least the extra cost is only paid when there's
actually a partial index under consideration.

Per report from Jeff Davis.  I'm not going to risk back-patching this,
though.
2007-03-21 22:18:12 +00:00
Magnus Hagander e8a85e6f84 Add support for running regression tests on procedural languages 2007-03-21 16:21:40 +00:00
Magnus Hagander 3c5d5f070a Properly return exitcode when regression tests fails. 2007-03-21 15:39:03 +00:00
Magnus Hagander 18d82d03b5 Native shared memory implementation for win32.
Uses same underlying tech as before, but not the sysv emulation layer.
2007-03-21 14:39:23 +00:00
Neil Conway 9eb78beeae Add three new regexp functions: regexp_matches, regexp_split_to_array,
and regexp_split_to_table. These functions provide access to the
capture groups resulting from a POSIX regular expression match,
and provide the ability to split a string on a POSIX regular
expression, respectively. Patch from Jeremy Drake; code review by
Neil Conway, additional comments and suggestions from Tom and
Peter E.

This patch bumps the catversion, adds some regression tests,
and updates the docs.
2007-03-20 05:45:00 +00:00
Jan Wieck 5e96b04a7c Bumping catversion due to changes to pg_trigger and pg_rewrite.
BTW, the comment in this file says that we hope we never have more than
10 catversion changes per day, but to even make this possible we should
start counting at zero, shouldn't we?


Jan
2007-03-20 03:53:26 +00:00
Jan Wieck 0fe16500d3 Changes pg_trigger and extend pg_rewrite in order to allow triggers and
rules to be defined with different, per session controllable, behaviors
for replication purposes.

This will allow replication systems like Slony-I and, as has been stated
on pgsql-hackers, other products to control the firing mechanism of
triggers and rewrite rules without modifying the system catalog directly.

The firing mechanisms are controlled by a new superuser-only GUC
variable, session_replication_role, together with a change to
pg_trigger.tgenabled and a new column pg_rewrite.ev_enabled. Both
columns are a single char data type now (tgenabled was a bool before).
The possible values in these attributes are:

     'O' - Trigger/Rule fires when session_replication_role is "origin"
           (default) or "local". This is the default behavior.

     'D' - Trigger/Rule is disabled and fires never

     'A' - Trigger/Rule fires always regardless of the setting of
           session_replication_role

     'R' - Trigger/Rule fires when session_replication_role is "replica"

The GUC variable can only be changed as long as the system does not have
any cached query plans. This will prevent changing the session role and
accidentally executing stored procedures or functions that have plans
cached that expand to the wrong query set due to differences in the rule
firing semantics.

The SQL syntax for changing a triggers/rules firing semantics is

     ALTER TABLE <tabname> <when> TRIGGER|RULE <name>;

     <when> ::= ENABLE | ENABLE ALWAYS | ENABLE REPLICA | DISABLE

psql's \d command as well as pg_dump are extended in a backward
compatible fashion.

Jan
2007-03-19 23:38:32 +00:00
Tom Lane e28e318c65 Further buildfarm experience shows that actually we can't run the plancache
test in parallel with the rules test at all, because the former wants to
create a couple of temp views, which can sometimes show up in the latter's
output.  Let's try it in the next parallel group instead.
2007-03-19 16:44:41 +00:00
Tom Lane 9bc933b212 Fix 8.2 breakage of domains over array types, and add a regression test case
to cover it.  Per report from Anton Pikhteryev.
2007-03-19 16:30:32 +00:00
Magnus Hagander 62df7c31c0 ecpglib requires libpgport, per Andrew Dunstan 2007-03-19 09:34:09 +00:00
Tom Lane 584b6dc2d5 Fix ecpg/preproc makefile for parallel builds: parser.o must depend
on preproc.h, else make may try to build it before preproc.h is ready.
Per failures seen here and in buildfarm.
2007-03-18 17:57:34 +00:00
Neil Conway 7221b4fa50 Code cleanup: mark some variables with the "const" modifier, when they
are initialized with a string literal. Patch from Stefan Huehner.
2007-03-18 16:50:44 +00:00
Neil Conway b9954fbb4e Code cleanup for function prototypes: change two K&R-style prototypes
to ANSI-style, and change "()" -> "(void)". Patch from Stefan Huehner.
2007-03-18 05:36:50 +00:00
Michael Meskes 582e22a8c3 Simplified sortby rule 2007-03-17 19:27:12 +00:00
Michael Meskes d3e131e062 - Changed some whitespacing in connect statement.
- Made some chars const as proposed by Stefan Huehner <stefan@huehner.org>.
- Synced parser and keyword lists.
- Copied two token parsing from backend parser to ecpg parser.
- Also added a test case for this.
2007-03-17 19:25:24 +00:00
Magnus Hagander e6e78187ef msvc build actually needs Bison 2.2 or later, not 2.1. Or 1.875 as before. 2007-03-17 17:11:41 +00:00
Magnus Hagander 7bb40f9b82 Add cvs tags to msvc build files, along with a (very short) comment about
what each script does.
2007-03-17 14:01:01 +00:00
Magnus Hagander 4554ee362c Oops, forgot to remove the old genbki script. 2007-03-17 13:54:34 +00:00
Magnus Hagander 08bb618561 Turn most vc build scripts into modules instead of scripts, and just have
skeleton scripts calling them. To make it easier for the buildfarm
(or other "outside callers") to use these modules directly.

Per suggestion from Andrew Dunstan.
2007-03-17 13:50:42 +00:00
Tom Lane cdf8b56d54 SPI_cursor_open failed to enforce that only read-only queries could be
executed in read_only mode.  This could lead to various relatively-subtle
failures, such as an allegedly stable function returning non-stable results.
Bug goes all the way back to the introduction of read-only mode in 8.0.
Per report from Gaetano Mendola.
2007-03-17 03:15:38 +00:00
Tom Lane e88a7ad774 Ooops, got only one of the two ArrayExpr variants correct in first
cut at exprTypmod support.  Also, experimentation shows that we need
to label the type of Const nodes that are numeric with a specific
typmod.
2007-03-17 01:15:55 +00:00
Tom Lane 0f4ff460c4 Fix up the remaining places where the expression node structure would lose
available information about the typmod of an expression; namely, Const,
ArrayRef, ArrayExpr, and EXPR and ARRAY SubLinks.  In the ArrayExpr and
SubLink cases it wasn't really the data structure's fault, but exprTypmod()
being lazy.  This seems like a good idea in view of the expected increase in
typmod usage from Teodor's work to allow user-defined types to have typmods.
In particular this responds to the concerns we had about eliminating the
special-purpose hack that exprTypmod() used to have for BPCHAR Consts.
We can now tell whether or not such a Const has been cast to a specific
length, and report or display properly if so.

initdb forced due to changes in stored rules.
2007-03-17 00:11:05 +00:00
Magnus Hagander 51d7741db1 Add new columns for tuple statistics on a database level to
pg_stat_database.
2007-03-16 17:57:36 +00:00
Tom Lane c4fdfb8de3 Fix race condition in parallel regression tests. The new plancache test
was expecting there to be no regular table named 'foo', but it turns out
the rules test transiently creates one, so that plancache would sometimes
fail.  I couldn't reproduce that in quite a few tries here, but several
buildfarm machines have shown the failure.  Fix by renaming plancache's
temp table to something nonconflicting.
2007-03-16 16:11:49 +00:00
Andrew Dunstan f6e3313fea Remove undocumented support for copy syntax from before 7.3. Update comments to
reflect syntax actually supported, e.g. by including CSV params.
2007-03-16 13:41:21 +00:00
Magnus Hagander 348b621894 Show aggregate return types in psql \da output.
Greg Sabino Mullane
2007-03-16 08:28:01 +00:00
Tom Lane 95f6d2d209 Make use of plancache module for SPI plans. In particular, since plpgsql
uses SPI plans, this finally fixes the ancient gotcha that you can't
drop and recreate a temp table used by a plpgsql function.

Along the way, clean up SPI's API a little bit by declaring SPI plan
pointers as "SPIPlanPtr" instead of "void *".  This is cosmetic but
helps to forestall simple programming mistakes.  (I have changed some
but not all of the callers to match; there are still some "void *"'s
in contrib and the PL's.  This is intentional so that we can see if
anyone's compiler complains about it.)
2007-03-15 23:12:07 +00:00
Tom Lane d3ff180163 Fix a longstanding bug in VACUUM FULL's handling of update chains. The code
did not expect that a DEAD tuple could follow a RECENTLY_DEAD tuple in an
update chain, but because the OldestXmin rule for determining deadness is a
simplification of reality, it is possible for this situation to occur
(implying that the RECENTLY_DEAD tuple is in fact dead to all observers,
but this patch does not attempt to exploit that).  The code would follow a
chain forward all the way, but then stop before a DEAD tuple when backing
up, meaning that not all of the chain got moved.  This could lead to copying
the chain multiple times (resulting in duplicate copies of the live tuple at
its end), or leaving dangling index entries behind (which, aside from
generating warnings from later vacuums, creates a risk of wrong query
results or bogus duplicate-key errors once the heap slot the index entry
points to is repopulated).

The fix is to recheck HeapTupleSatisfiesVacuum while following a chain
forward, and to stop if a DEAD tuple is reached.  Each contiguous group
of RECENTLY_DEAD tuples will therefore be copied as a separate chain.
The patch also adds a couple of extra sanity checks to verify correct
behavior.

Per report and test case from Pavan Deolasee.
2007-03-14 18:48:55 +00:00
Tom Lane 0169c354bf Arrange to install a "posixrules" entry in our timezone database, so that
POSIX-style timezone specs that don't exactly match any database entry will
be treated as having correct USA DST rules.  Also, document that this can
be changed if you want to use some other DST rules with a POSIX zone spec.

We could consider changing localtime.c's TZDEFRULESTRING, but since that
facility can only deal with one DST transition rule, it seems fairly useless
now; might as well just plan to override it using a "posixrules" entry.

Backpatch as far as 8.0.  There isn't much we can do in 7.x ... either your
libc gets it right, or it doesn't.
2007-03-14 17:38:06 +00:00
Magnus Hagander 547e41cdf8 Remove extra single-quotes copied from Unix build. Win32 doesn't strip
single quotes...
2007-03-14 09:55:03 +00:00
Tom Lane 08ed6c3c5b Regression makefile now needs to make separate lists of what to clean
for input/ and output/ directories, because with the addition of
largeobject_1.source, they're not the same list.  Apparently the current
buildfarm process does not exercise whether 'make distclean' leaves a
clean tree behind, else the farm would have been failing for awhile.
2007-03-13 22:56:48 +00:00
Magnus Hagander be40754e91 Rewrite win32 install documentation (it's not client only anymore, and it's
now complete). Update for the MSVC6/Borland support now being only libpq.
Move most of the information about full MSVC build from README file into
documentation.
2007-03-13 16:03:36 +00:00
Peter Eisentraut f4ee82e3d3 Reverted waiting for further fixes:
Make configuration parameters fall back to their default values when they
are removed from the configuration file.

Joachim Wieland
2007-03-13 14:32:25 +00:00
Magnus Hagander f32515df77 Filter out warnings coming from the stylesheets, so that actual warnings show up properly.
Show some minor progress messages.
2007-03-13 14:28:30 +00:00
Magnus Hagander e40889adb2 Set root of docbook stuff from buildenv.bat and not from builddoc.bat.
Fix calling for file renaming when cd:ed into a different directory.
2007-03-13 09:45:32 +00:00
Magnus Hagander cbf1293ffd Properly use pg_strcasecmp() instead of strcasecmp().
Un-breaks win32 build.
2007-03-13 09:11:05 +00:00
Tom Lane b9527e9840 First phase of plan-invalidation project: create a plan cache management
module and teach PREPARE and protocol-level prepared statements to use it.
In service of this, rearrange utility-statement processing so that parse
analysis does not assume table schemas can't change before execution for
utility statements (necessary because we don't attempt to re-acquire locks
for utility statements when reusing a stored plan).  This requires some
refactoring of the ProcessUtility API, but it ends up cleaner anyway,
for instance we can get rid of the QueryContext global.

Still to do: fix up SPI and related code to use the plan cache; I'm tempted to
try to make SQL functions use it too.  Also, there are at least some aspects
of system state that we want to ensure remain the same during a replan as in
the original processing; search_path certainly ought to behave that way for
instance, and perhaps there are others.
2007-03-13 00:33:44 +00:00
Peter Eisentraut f84308f195 Make configuration parameters fall back to their default values when they
are removed from the configuration file.

Joachim Wieland
2007-03-12 22:09:28 +00:00
Magnus Hagander eee2289287 Make a run with perltidy to format the code. Per request from Andrew Dunstan. 2007-03-12 19:10:50 +00:00
Alvaro Herrera 576027bb3f Fix a race condition that caused pg_database_size() and pg_tablespace_size()
to fail if an object was removed between calls to ReadDir() and stat().
Per discussion in pgsql-hackers.

http://archives.postgresql.org/pgsql-hackers/2007-03/msg00671.php

Bug report and patch by Michael Fuhr.
2007-03-11 05:22:00 +00:00
Andrew Dunstan 5acde74e1a Add alternate result file for large object tests to handle Windows line ends. 2007-03-10 03:42:19 +00:00
Magnus Hagander c0aa50630b Remove unsafe calling of WSAStartup and WSACleanup from DllMain. Move the
inline cleanup call around so it will be called in the right order, and
be called on errors.

Per report from Tokuharu Yuzawa.
2007-03-08 19:27:28 +00:00