Commit Graph

15926 Commits

Author SHA1 Message Date
Bruce Momjian fe491fb9af On Win32, use loop to create pg_dump temporary tar file in the current
directory, not in device root, for permission reasons.

Backpatch to 8.1.X.
2006-06-27 01:16:58 +00:00
Bruce Momjian 3b1790f987 Add PQescapeIdentifier() to libpq
Christopher Kings-Lynne
2006-06-27 00:03:42 +00:00
Bruce Momjian 59a853e48b Fix blank line. 2006-06-26 23:53:14 +00:00
Bruce Momjian ecae3a9689 Add comment about the use of pg_config_paths.h. 2006-06-26 18:40:50 +00:00
Tom Lane ca0d2197ca Change the row constructor syntax (ROW(...)) so that list elements foo.*
will be expanded to a list of their member fields, rather than creating
a nested rowtype field as formerly.  (The old behavior is still available
by omitting '.*'.)  This syntax is not allowed by the SQL spec AFAICS,
so changing its behavior doesn't violate the spec.  The new behavior is
substantially more useful since it allows, for example, triggers to check
for data changes with 'if row(new.*) is distinct from row(old.*)'.  Per
my recent proposal.
2006-06-26 17:24:41 +00:00
Michael Meskes 4b98d423d7 Added missing braces to prevent a segfault after usage of an undeclared cursor. 2006-06-26 14:12:02 +00:00
Bruce Momjian e56756e94e Use Unix line endings instead of DOS ones, per Magnus. 2006-06-26 12:59:44 +00:00
Bruce Momjian e2fee8cf6d Update include files to Unix newline format, per report from Magnus. 2006-06-26 12:52:12 +00:00
Bruce Momjian 217d543943 Update comment description of geo routines and move comment to more
relevant location.
2006-06-26 12:32:42 +00:00
Michael Meskes ea9ec780ed Added some more coverity report patches send in by Joachim Wieland <joe@mcknight.de>. 2006-06-26 09:20:09 +00:00
Tom Lane 2924ca6747 Tweak dynahash.c to avoid wasting memory space in non-shared hash tables.
palloc() will normally round allocation requests up to the next power of 2,
so make dynahash choose allocation sizes that are as close to a power of 2
as possible.
Back-patch to 8.1 --- the problem exists further back, but a much larger
patch would be needed and it doesn't seem worth taking any risks.
2006-06-25 18:29:49 +00:00
Michael Meskes 17bab8c3fe Moved some free() calls that coverity correctly complains about. 2006-06-25 09:38:40 +00:00
Alvaro Herrera 885a4d3d9a Our version of getopt_long does not set optarg upon detecting an error, as
opposed to what other versions apparently do, so it's not safe to print an
error message.  Besides, getopt_long itself already did, so it's redundant
anyway.
2006-06-25 04:37:55 +00:00
Bruce Momjian e970b2a62b Remove individual user copyright because the code is contributed to
PGDG:

> Yes. In fact the copyright belongs to credativ GmbH the company that
> paid Carsten for his work. As you may or may not know I'm the CEO of
> that company and can assure you that his work was contributed to the
> PostgreSQL project.
2006-06-25 01:45:32 +00:00
Bruce Momjian 199f8f2858 Fix GEVHDRSZ for Win32.
Magnus Hagander
2006-06-25 01:02:12 +00:00
Bruce Momjian d8f75d4131 Fix Win32/Cygwin problems:
After updating to the latest cvs, and also building most of the addons
(like PLs), the following patch is neededf for win32 + Visual C++.

* Switch to use the new win32 semaphore code
* Rename win32_open to pgwin32_open. win32_open collides with symbols
defined in Perl. MingW didn't detect ig, MSVC did. And it's a bit too
generic a name to export globally, imho...
* Python defines some partially broken #pragmas in the headers when
doing a debug build. Workaround.

Magnus Hagander
2006-06-25 00:18:24 +00:00
Tom Lane 50aa69a825 Fix re-inclusion of port header file on Windows, per Magnus. 2006-06-24 14:52:48 +00:00
Michael Meskes c2f3c168fb Clarified copyright notice 2006-06-23 14:50:01 +00:00
Tom Lane 69bf0a0ddd Remove dllinit.c; it was only needed for long-obsolete Cygwin versions,
and there was some question about its copyright status.
2006-06-22 23:50:35 +00:00
Tom Lane 3a04f53e7f pg_stop_backup was calling XLogArchiveNotify() twice for the newly created
backup history file.  Bug introduced by the 8.1 change to make pg_stop_backup
delete older history files.  Per report from Masao Fujii.
2006-06-22 20:42:57 +00:00
Tom Lane 39bed3b388 Standalone backends need pgstat_bestart() too, per Qingqing Zhou. 2006-06-22 14:36:12 +00:00
Tom Lane a5606579fc Move setup_cancel_handler() up near start of psql main(), where the
setup_win32_locks() call formerly was, to ensure that cancelConnLock is
valid when it needs to be.  Per Yoshiyuki Asaba.
2006-06-21 19:40:31 +00:00
Tom Lane 59fd249a30 Remove ancient kluge that kept nodeAgg.c from crashing on UPDATEs involving
aggregates.  We just disallowed that, and AFAICS there should be no other
cases where direct (non-aggregated) references to input columns are allowed
in a query with aggregation and no GROUP BY.
2006-06-21 18:39:42 +00:00
Tom Lane 1f5ca045a4 Disallow aggregate functions in UPDATE commands (unless within a sub-SELECT).
This is disallowed by the SQL spec because it doesn't have any very sensible
interpretation.  Historically Postgres has allowed it but behaved strangely.
As of PG 8.1 a server crash is possible if the MIN/MAX index optimization gets
applied; rather than try to "fix" that, it seems best to just enforce the
spec restriction.  Per report from Josh Drake and Alvaro Herrera.
2006-06-21 18:30:11 +00:00
Tom Lane e256bafaa2 Eliminate a gratuitously different wording of the 'cannot use aggregate function in check constraint' error message. 2006-06-21 18:09:53 +00:00
Tom Lane 04c5b69603 Clean up psql variable code a little: eliminate unnecessary tests in
GetVariable() and be consistent about treatment of the list header.
Motivated by noticing strspn() taking an unreasonable percentage of
runtime --- the call removed from GetVariable() was the only one that
could be in a high-usage path ...
2006-06-21 16:05:11 +00:00
Michael Meskes 3f9aace723 Added some more coverity report patches send in by Martijn van Oosterhout <kleptog@svana.org>. 2006-06-21 11:38:07 +00:00
Michael Meskes 6bba43111e Fixed small typo in changelog 2006-06-21 10:34:48 +00:00
Michael Meskes a829da152c Added fixed from the coverity report send in by Joachim Wieland <joe@mcknight.de>
Added missing error handling in a few functions in ecpglib
2006-06-21 10:24:41 +00:00
Tom Lane 27c3e3de09 Remove redundant gettimeofday() calls to the extent practical without
changing semantics too much.  statement_timestamp is now set immediately
upon receipt of a client command message, and the various places that used
to do their own gettimeofday() calls to mark command startup are referenced
to that instead.  I have also made stats_command_string use that same
value for pg_stat_activity.query_start for both the command itself and
its eventual replacement by <IDLE> or <idle in transaction>.  There was
some debate about that, but no argument that seemed convincing enough to
justify an extra gettimeofday() call.
2006-06-20 22:52:00 +00:00
Tom Lane 47a37aeebd Split definitions for md5.c out of crypt.h and into their own header
libpq/md5.h, so that there's a clear separation between backend-only
definitions and shared frontend/backend definitions.  (Turns out this
is reversing a bad decision from some years ago...)  Fix up references
to crypt.h as needed.  I looked into moving the code into src/port, but
the headers in src/include/libpq are sufficiently intertwined that it
seems more work than it's worth to do that.
2006-06-20 19:56:52 +00:00
Michael Meskes aaf125f8df Do not use already free'ed errmsg, bug found by Joachim Wieland
<joachim.wieland@credativ.de>
2006-06-19 09:19:49 +00:00
Tom Lane b13c9686d0 Take the statistics collector out of the loop for monitoring backends'
current commands; instead, store current-status information in shared
memory.  This substantially reduces the overhead of stats_command_string
and also ensures that pg_stat_activity is fully up to date at all times.
Per my recent proposal.
2006-06-19 01:51:22 +00:00
Tom Lane 1e8ae13640 Don't try to call posix_fadvise() unless <fcntl.h> supplies a declaration
for it.  Hopefully will fix core dump evidenced by some buildfarm members
since fadvise patch went in.  The actual definition of the function is not
ABI-compatible with compiler's default assumption in the absence of any
declaration, so it's clearly unsafe to try to call it without seeing a
declaration.
2006-06-18 18:30:21 +00:00
Tom Lane 22045666d6 Fix saveHistory() to not emit bogus complaint during psql exit when using
Darwin's libedit; per my proposal last August.  Also, suppress cast-away-
const warnings.
2006-06-18 17:30:48 +00:00
Tom Lane f1e671a0b4 Increase timeout in statement_timeout test from 1 second to 2 seconds.
We have once or twice seen failures suggesting that control didn't get
to the exception block before the timeout elapsed, which is unlikely
but not impossible in a parallel regression test (with a dozen other
backends competing for cycles).  This change doesn't completely prevent
the problem of course, but it should reduce the probability enough that
we don't see it anymore.  Per buildfarm results.
2006-06-18 16:21:23 +00:00
Peter Eisentraut 5266f221a2 Merge postmaster and postgres command into just postgres. postmaster
symlink is kept for now for compatibility.  To call single-user mode, use
postgres --single.
2006-06-18 15:38:37 +00:00
Tom Lane 44cb3ae7ef Fix a couple of obvious problems in DROP IF EXISTS patch. 2006-06-16 23:50:48 +00:00
Tom Lane c892643a3c Code review for SELECT INTO STRICT patch: use saner choices of error
SQLSTATEs, fix some documentation problems.
2006-06-16 23:29:27 +00:00
Bruce Momjian 4fff9d7290 Document issues with non-default tablespaces and pg_dumpall restores.
Backpatch documentation addition to 8.1.X.
2006-06-16 22:01:17 +00:00
Andrew Dunstan bbcd01692b DROP ... IF EXISTS for the following cases:
language, tablespace, trigger, rule, opclass, function, aggregate. operator, and cast.
2006-06-16 20:23:45 +00:00
Tom Lane 06e10abc0b Fix problems with cached tuple descriptors disappearing while still in use
by creating a reference-count mechanism, similar to what we did a long time
ago for catcache entries.  The back branches have an ugly solution involving
lots of extra copies, but this way is more efficient.  Reference counting is
only applied to tupdescs that are actually in caches --- there seems no need
to use it for tupdescs that are generated in the executor, since they'll go
away during plan shutdown by virtue of being in the per-query memory context.
Neil Conway and Tom Lane
2006-06-16 18:42:24 +00:00
Bruce Momjian 40bc06fa16 Test for POSIX_FADV_DONTNEED to use posix_fadvise(). 2006-06-16 04:11:48 +00:00
Bruce Momjian 94a5c4a01b Use posix_fadvise() to avoid kernel caching of WAL contents on WAL file
close.

ITAGAKI Takahiro
2006-06-15 19:15:00 +00:00
Bruce Momjian a584c12426 Add STRICT to PL/pgSQL SELECT INTO, so exceptions are thrown if more or
less than one row is returned by the SELECT, for Oracle PL/SQL
compatibility.

Improve SELECT INTO documentation.

Matt Miller
2006-06-15 18:02:22 +00:00
Tom Lane 8b9bc234ad Remove the limit on the number of entries allowed in catcaches, and
remove the infrastructure needed to enforce the limit, ie, the global
LRU list of cache entries.  On small-to-middling databases this wins
because maintaining the LRU list is a waste of time.  On large databases
this wins because it's better to keep more cache entries (we assume
such users can afford to use some more per-backend memory than was
contemplated in the Berkeley-era catcache design).  This provides a
noticeable improvement in the speed of psql \d on a 10000-table
database, though it doesn't make it instantaneous.

While at it, use per-catcache settings for the number of hash buckets
per catcache, rather than the former one-size-fits-all value.  It's a
bit silly to be using the same number of hash buckets for, eg, pg_am
and pg_attribute.  The specific values I used might need some tuning,
but they seem to be in the right ballpark based on CATCACHE_STATS
results from the standard regression tests.
2006-06-15 02:08:09 +00:00
Tom Lane 2193beb761 Further thoughts about lo_export/lo_import error handling: if one of
the lower-level large object functions fails, it will have already set
a suitable error message --- probably something from the backend ---
and it is not useful to overwrite that with a generic 'error while
reading large object' message.  So remove redundant messages.
2006-06-14 17:49:25 +00:00
Tom Lane f3164c0200 Clean up psql's control-C handling to avoid longjmp'ing out of random
places --- that risks corrupting data structures, losing sync with the
backend, etc.  We now longjmp only from calls to readline, fgets, and
fread, which we assume are coded to protect themselves against interrupts
at undesirable times.  This requires adding explicit tests for
cancel_pressed in long-running loops, but on the whole it's far cleaner.
Martijn van Oosterhout and Tom Lane.
2006-06-14 16:49:03 +00:00
Tom Lane ace93353ea Improve error detection and recovery in lo_import()/lo_export().
Problems noted while experimenting with new control-C code for psql.
2006-06-14 01:28:55 +00:00
Tom Lane 067e40cc6d Do a CHECK_FOR_INTERRUPTS immediately before terminating a fastpath
function call.  Previously, there may have been no CHECK_FOR_INTERRUPTS
at all in the fastpath code path, making it impossible to cancel an
operation such as \lo_import externally.  This addition doesn't ensure
you can cancel, since your SIGINT may arrive while the backend is idle
waiting for the client, but it gives the largest window we can easily
provide.  Noted while experimenting with new control-C code for psql.
2006-06-14 01:24:14 +00:00