Commit Graph

16182 Commits

Author SHA1 Message Date
Tom Lane c859294ca2 Remove hash_destroy calls in hash_create's failure paths. As noted by
a Coverity warning, these are risky since the hashtable isn't necessarily
fully set up yet.  They're unnecessary anyway: a deletable hashtable
should be in a memory context that will be cleared following elog(ERROR).
Per report from Martijn van Oosterhout.
2006-08-14 12:39:55 +00:00
Bruce Momjian f058451871 Revert (again) GUC patch to return commented fields to their default
values, due to concern about the patch.
2006-08-14 02:27:27 +00:00
Tom Lane 3648147401 Get rid of "lookahead" functionality in plpgsql's yylex() function,
and instead make the grammar production for the RETURN statement do the
heavy lifting.  The lookahead idea was copied from the main parser, but
it does not work in plpgsql's parser because here gram.y looks explicitly
at the scanner's yytext variable, which will be out of sync after a
failed lookahead step.  A minimal example is

create or replace function foo() returns void language plpgsql as '
begin
  perform return foo bar;
end';

which can be seen by testing to deliver "foo foo bar" to the main parser
instead of the expected "return foo bar".  This isn't a huge bug since
RETURN is not found in the main grammar, but it could bite someone who
tried to use "return" as an identifier.

Back-patch to 8.1.  Bug exists further back, but HEAD patch doesn't apply
cleanly, and given the lack of field complaints it doesn't seem worth
the effort to develop adjusted patches.
2006-08-14 00:46:53 +00:00
Tom Lane 1b67e0cc52 Fix core dump in duration logging for a V3-protocol Execute message
when what's being executed is a COMMIT or ROLLBACK.  Per report from
Sergey Koposov.  Backpatch to 8.1; 8.0 and before don't have the bug
due to lack of any logging at all here.
2006-08-13 22:18:08 +00:00
Tom Lane b475d25f6c Cause psql to report both the returned data and the command status tag
for INSERT/UPDATE/DELETE RETURNING.  Per discussion.
2006-08-13 21:10:04 +00:00
Tom Lane fbc7f59bfe If test postmaster fails to start within 60 seconds, try to kill -9 it
so that it won't interfere with later trials.  Per recent buildfarm
experience.  Anyone know how to do this on Windows?
2006-08-13 20:39:07 +00:00
Tom Lane a1dad99c63 Extend 'guc' regression test to check manipulations of datestyle as
well as vacuum_cost_delay.  Since datestyle is a string variable,
this exercises memory allocation issues that might not appear when
modifying an integer GUC variable.  Also, we can observe the side
effects of changing datestyle to check that assign hooks are called
at the right times.
2006-08-13 19:31:06 +00:00
Tom Lane d2ccc707af Original coding of 'returning' regression test inadvertently chose a
nonunique join value, leading to plan-choice-dependent results ... and
it seems some platforms will choose a different plan.  Tweak the test
so that it has well-defined results.  Per report from Olivier Prenant.
2006-08-13 17:58:49 +00:00
Bruce Momjian 12cf0fdf19 Back out plperl OUT hash/array parameter patch, again. 2006-08-13 17:31:10 +00:00
Bruce Momjian e0d6630bd8 Fix recent guc comment-to-default patch for custom variables. 2006-08-13 15:37:02 +00:00
Michael Meskes ab6aa40b64 Applied patch for VPATH builds by Alvaro Herrera <alvherre@commandprompt.com>
Merged dyntest.pgc and dyntest2.pgc.
Hopefully fixed the last Coverity reports (finally)
2006-08-13 10:18:31 +00:00
Bruce Momjian b5633943cb Re-apply plperl patch that allows OUT parameters to be placed into Perl
hash and array variables.  (regression output updated)
2006-08-13 02:37:11 +00:00
Bruce Momjian f09fb71af9 Recommit patch to allow commented GUC variables to return to their
default values.
2006-08-13 02:22:24 +00:00
Bruce Momjian e7da38bf31 Re-apply guc cleanup patch, with memory allocation bugs fixed. 2006-08-13 01:30:17 +00:00
Tom Lane 3f8db37c2f Tweak SPI_cursor_open to allow INSERT/UPDATE/DELETE RETURNING; this was
merely a matter of fixing the error check, since the underlying Portal
infrastructure already handles it.  This in turn allows these statements
to be used in some existing plpgsql and plperl contexts, such as a
plpgsql FOR loop.  Also, do some marginal code cleanup in places that
were being sloppy about distinguishing SELECT from SELECT INTO.
2006-08-12 20:05:56 +00:00
Tom Lane 883f4b42d7 Remove ancient, obsolete comment. 2006-08-12 18:58:54 +00:00
Bruce Momjian 4178de3d43 Back out patch for plperl to handle OUT paramaters into arrays and
hashes.  Was causing regression failures.
2006-08-12 04:16:45 +00:00
Bruce Momjian fb55af227e Back out patch to reorganize guc processing. Was causing regression
failures.
2006-08-12 04:12:41 +00:00
Bruce Momjian 2d2eec6ef2 Back out patch that allowed commented guc variables to return to their
default values.  Was causing regression failures.
2006-08-12 04:11:50 +00:00
Tom Lane 7a3e30e608 Add INSERT/UPDATE/DELETE RETURNING, with basic docs and regression tests.
plpgsql support to come later.  Along the way, convert execMain's
SELECT INTO support into a DestReceiver, in order to eliminate some ugly
special cases.

Jonah Harris and Tom Lane
2006-08-12 02:52:06 +00:00
Bruce Momjian 5c9e9c0c42 Set Win32 server-size socket buffer to 32k, for performance reasons.
Yoshiyuki Asaba
2006-08-11 20:44:20 +00:00
Bruce Momjian 262a7bc14c Allow commenting of variables in postgresql.conf to restore them to
defaults.

Zdenek Kotala
2006-08-11 20:15:16 +00:00
Bruce Momjian f91ddb768b Refactor GUC set_config_option function:
The main reason for refactoring was that set_config_option() was too
overloaded function and its behavior did not consistent. Old version of
set_config_function hides some messages. For example if you type:

tcp_port = 5432.1

then old implementation ignore this error without any message to log
file in the signal context (configuration reload). Main problem was that
semantic analysis of postgresql.conf is not perform in the
ProcessConfigFile function, but in the set_config_options *after*
context check. This skipped check for variables with PG_POSTMASTER
context. There was request from Joachim Wieland to add more messages
about ignored changes in the config file as well.

Zdenek Kotala
2006-08-11 20:08:28 +00:00
Bruce Momjian c07fbcf577 plperl:
Allow conversion from perl to postgresql array in OUT parameters. Second,
allow hash form output from procedures with one OUT argument.

Pavel Stehule
2006-08-11 19:42:35 +00:00
Bruce Momjian 33bf73a79a Make the psql line counter 64-bit so it can handle files > 4gig lines.
David Fetter
2006-08-11 19:20:59 +00:00
Tom Lane 0ee26100b6 Fix UNION/INTERSECT/EXCEPT so that when two inputs being merged have
same data type and same typmod, we show that typmod as the output
typmod, rather than generic -1.  This responds to several complaints
over the past few years about UNIONs unexpectedly dropping length or
precision info.
2006-08-10 02:36:29 +00:00
Bruce Momjian e860e746e1 Return inline to win32.h because code was OK, but keep additional
comment.  8.1.X is not affected by this commit.
2006-08-10 01:41:29 +00:00
Bruce Momjian 3929b6e9f6 Move "#define inline __inline" from port/win32.h to c.h because Win32
interface builds like libpq need it.

Backpatch addition to 8.1.X.
2006-08-10 01:35:21 +00:00
Bruce Momjian a4f14fd109 Fix display of log duration so it is milliseconds.microseconds "ms".
Greg Sabino Mullane
2006-08-10 00:44:01 +00:00
Tom Lane 0bf9d3a59e Fix inadequate makefile-fu in ecpg regression tests. I think this
will fix current platypus build failure.
2006-08-09 22:48:17 +00:00
Bruce Momjian 6a7d3d093e Round microseconds on setitimer upwards. 2006-08-09 21:18:13 +00:00
Bruce Momjian 0553a0507c On Win32, make minimum setitimer() sleep be 1ms, so sleeps < 1ms aren't
rounded down to zero.

Backpatch to 8.1.X.
2006-08-09 20:40:56 +00:00
Bruce Momjian 8f73c88c7c Fix statement_timeout on Win32 so that it properly treats micro-seconds
as micro-seconds, rather than as 100 microseconds, as it does now.  This
actually fixes all setitimer calls on Win32, but statement_timeout is
the most visible fix.

Backpatch to 8.1.X.  8.0 works as documented.
2006-08-09 17:47:03 +00:00
Bruce Momjian f896b5e146 Formatting improvement. 2006-08-09 17:33:52 +00:00
Michael Meskes e6e61afe16 Fixed some memory bugs that somehow reappeared.
Also fixed a new Coverity report.
2006-08-09 09:08:32 +00:00
Michael Meskes 7c9e2c75da Fixed error handling in numeric conversion (Joachim).
Further regression cleanup.
2006-08-09 07:30:56 +00:00
Bruce Momjian 8a7a6afe2d Suppress MSVC warnings about weak functions by using
_CRT_SECURE_NO_DEPRECATE.

Hiroshi Saito
2006-08-09 03:09:56 +00:00
Bruce Momjian 9d5d87a5db Fix win32.mak for config cleanup.
Hiroshi Saito
2006-08-08 22:44:05 +00:00
Tom Lane 644e3fe368 Fix 'make clean' for change of regression.diffs file name. 2006-08-08 19:43:11 +00:00
Tom Lane b09bfcaa57 Add a feature for automatic initialization and finalization of dynamically
loaded libraries: call functions _PG_init() and _PG_fini() if the library
defines such symbols.  Hence we no longer need to specify an initialization
function in preload_libraries: we can assume that the library used the
_PG_init() convention, instead.  This removes one source of pilot error
in use of preloaded libraries.  Original patch by Ralf Engelschall,
preload_libraries changes by me.
2006-08-08 19:15:09 +00:00
Bruce Momjian c554bf878f Fix definition of "errcode" for MSVC.
Hiroshi Saito
2006-08-08 18:49:14 +00:00
Michael Meskes 79a1a2ec6b Cleaned up log output a little bit more. 2006-08-08 15:30:39 +00:00
Michael Meskes 6e11202dbe Made parser check for valid copy to/from stdin/stdout combinations.
Lots of small changes in regression test suite
2006-08-08 11:51:25 +00:00
Bruce Momjian 3716f90c39 For protocol-level prepare/bind/execute:
o  print user name for all
	o  print portal name if defined for all
	o  print query for all
	o  reduce log_statement header to single keyword
	o  print bind parameters as DETAIL if text mode
2006-08-08 01:23:15 +00:00
Tom Lane 2dd7ab0627 Put back another improperly-removed #include. 2006-08-07 21:56:25 +00:00
Tom Lane 2dc7c88c2e On some platforms, pg_usleep isn't interruptible by signals; fix
archiver to behave per original coder's expectation on these machines.
We already know this everywhere else AFAICT.
2006-08-07 17:41:42 +00:00
Tom Lane e002836913 Make recovery from WAL be restartable, by executing a checkpoint-like
operation every so often.  This improves the usefulness of PITR log
shipping for hot standby: formerly, if the standby server crashed, it
was necessary to restart it from the last base backup and replay all
the WAL since then.  Now it will only need to reread about the same
amount of WAL as the master server would.  The behavior might also
come in handy during a long PITR replay sequence.  Simon Riggs,
with some editorialization by Tom Lane.
2006-08-07 16:57:57 +00:00
Michael Meskes 977ac90001 Joachim fixed some bugs in numeric handling in pgtypeslib.
Fixed and cleaned up some regression tests. Also added a new one.
2006-08-07 13:17:02 +00:00
Tom Lane 23dc308245 Tweak sanity_check regression test to display more tables (viz, those
without indexes) but not to display temp tables.  It's a bit hard to
credit that sanity_check could get through a database-wide VACUUM
while the preceding create_index test is still trying to clean up
its temp tables ... but I see no other explanation for the current
failure report from buildfarm member sponge.
2006-08-06 04:35:21 +00:00
Tom Lane 704ddaaa09 Add support for forcing a switch to a new xlog file; cause such a switch
to happen automatically during pg_stop_backup().  Add some functions for
interrogating the current xlog insertion point and for easily extracting
WAL filenames from the hex WAL locations displayed by pg_stop_backup
and friends.  Simon Riggs with some editorialization by Tom Lane.
2006-08-06 03:53:44 +00:00