aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
Commit message (Collapse)AuthorAge
...
* Fix erroneous implementation of -s in postmaster.c (the switch doesn't takeTom Lane2007-01-04
| | | | | | an optarg). Add some comments noting that code in three different files has to be kept in sync. Fix erroneous description of -S switch (it sets work_mem not silent_mode), and do some light copy-editing elsewhere in postgres-ref.
* Fix the build for when SHOW_MEMORY_STATS is defined. The reference toNeil Conway2006-12-08
| | | | the nonexistent ShowStats variable is simply removed, per Gavin Sherry.
* On systems that have setsid(2) (which should be just about everything exceptTom Lane2006-11-21
| | | | | | | | | | | | | Windows), arrange for each postmaster child process to be its own process group leader, and deliver signals SIGINT, SIGTERM, SIGQUIT to the whole process group not only the direct child process. This provides saner behavior for archive and recovery scripts; in particular, it's possible to shut down a warm-standby recovery server using "pg_ctl stop -m immediate", since delivery of SIGQUIT to the startup subprocess will result in killing the waiting recovery_command. Also, this makes Query Cancel and statement_timeout apply to scripts being run from backends via system(). (There is no support in the core backend for that, but it's widely done using untrusted PLs.) Per gripe from Stephen Harris and subsequent discussion.
* Adjust elog.c so that elog(FATAL) exits (including cases where ERROR isTom Lane2006-11-21
| | | | | | | | | | | | | | | | promoted to FATAL) end in exit(1) not exit(0). Then change the postmaster to allow exit(1) without a system-wide panic, but not for the startup subprocess or the bgwriter. There were a couple of places that were using exit(1) to deliberately force a system-wide panic; adjust these to be exit(2) instead. This fixes the problem noted back in July that if the startup process exits with elog(ERROR), the postmaster would think everything is hunky-dory and proceed to start up. Alternative solutions such as trying to run the entire startup process as a critical section seem less clean, primarily because of the fact that a fair amount of startup code is shared by all postmaster children in the EXEC_BACKEND case. We'd need an ugly special case somewhere near the head of main.c to make it work if it's the child process's responsibility to determine what happens; and what's the point when the postmaster already treats different children differently?
* Make sure that debug_query_string contains the original query text,Tom Lane2006-10-19
| | | | | | if available (which it usually should be), during processing of Bind and Execute protocol messages. This improves usefulness of log_min_error_statement logging for extended query protocol.
* Add include needed for new getrusage() call.Bruce Momjian2006-10-08
|
* On Windows, we know the backend stack size limit because we have toTom Lane2006-10-08
| | | | | specify it explicitly in backend/Makefile. Arrange for this value to be known by get_stack_depth_rlimit() too. Per suggestion from Magnus.
* When planning a query at Bind time, be careful to pass the correctTom Lane2006-10-07
| | | | | query_list into the Portal, ie, the one seen and possibly modified by the planner. My fault :-( Per report from Sergey Koposov.
* On platforms that have getrlimit(RLIMIT_STACK), use it to ensure thatTom Lane2006-10-07
| | | | | | | | max_stack_depth is not set to an unsafe value. This commit also provides configure-time checking for <sys/resource.h>, and cleans up some perhaps-unportable code associated with use of that include file and getrlimit().
* Adjust HINT for stack depth limit to mention checking the underlyingTom Lane2006-10-07
| | | | | | platform limit, rather than just blindly raising max_stack_depth. Also, tweak the code to work properly if someone sets max_stack_depth to more than 2Gb, which guc.c will allow on a 64-bit machine.
* pgindent run for 8.2.Bruce Momjian2006-10-04
|
* Make logging of extended-protocol commands a bit more consistent, perTom Lane2006-09-13
| | | | discussion with Guillaume Smet.
* Tweak the behavior of log_duration as proposed by Guillaume Smet: ratherTom Lane2006-09-08
| | | | | | | than being equivalent to setting log_min_duration_statement to zero, this option now forces logging of all query durations, but doesn't force logging of query text. Also, add duration logging coverage for fastpath function calls.
* Clean up logging for extended-query-protocol operations, as per my recentTom Lane2006-09-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | proposal. Parameter logging works even for binary-format parameters, and logging overhead is avoided when disabled. log_statement = all output for the src/test/examples/testlibpq3.c example now looks like LOG: statement: execute <unnamed>: SELECT * FROM test1 WHERE t = $1 DETAIL: parameters: $1 = 'joe''s place' LOG: statement: execute <unnamed>: SELECT * FROM test1 WHERE i = $1::int4 DETAIL: parameters: $1 = '2' and log_min_duration_statement = 0 results in LOG: duration: 2.431 ms parse <unnamed>: SELECT * FROM test1 WHERE t = $1 LOG: duration: 2.335 ms bind <unnamed> to <unnamed>: SELECT * FROM test1 WHERE t = $1 DETAIL: parameters: $1 = 'joe''s place' LOG: duration: 0.394 ms execute <unnamed>: SELECT * FROM test1 WHERE t = $1 DETAIL: parameters: $1 = 'joe''s place' LOG: duration: 1.251 ms parse <unnamed>: SELECT * FROM test1 WHERE i = $1::int4 LOG: duration: 0.566 ms bind <unnamed> to <unnamed>: SELECT * FROM test1 WHERE i = $1::int4 DETAIL: parameters: $1 = '2' LOG: duration: 0.173 ms execute <unnamed>: SELECT * FROM test1 WHERE i = $1::int4 DETAIL: parameters: $1 = '2' (This example demonstrates the folly of ignoring parse/bind steps for duration logging purposes, BTW.) Along the way, create a less ad-hoc mechanism for determining which commands are logged by log_statement = mod and log_statement = ddl. The former coding was actually missing quite a few things that look like ddl to me, and it did not handle EXECUTE or extended query protocol correctly at all. This commit does not do anything about the question of whether log_duration should be removed or made less redundant with log_min_duration_statement.
* Change processing of extended-Query mode so that an unnamed statementTom Lane2006-09-06
| | | | | | | | that has parameters is always planned afresh for each Bind command, treating the parameter values as constants in the planner. This removes the performance penalty formerly often paid for using out-of-line parameters --- with this definition, the planner can do constant folding, LIKE optimization, etc. After a suggestion by Andrew@supernews.
* Revert FETCH/MOVE int64 patch. Was using incorrect checks forBruce Momjian2006-09-03
| | | | fetch/move in scan.l.
* Change FETCH/MOVE to use int8.Bruce Momjian2006-09-02
| | | | Dhanaraj M
* Update logging of prepare/execute syntax, per comments from Guillaume Smet.Bruce Momjian2006-08-30
|
* Separate prepared statement and bind parameters with comma.Bruce Momjian2006-08-29
| | | | Fix printing of NULL bind parameters, use "NULL".
* Only call log_after_parse() if necessary.Bruce Momjian2006-08-29
|
* Now bind displays prepare as detail, and execute displays prepare andBruce Momjian2006-08-29
| | | | | | | | | | optionally bind. I re-added the "statement:" label so people will understand why the line is being printed (it is log_*statement behavior). Use single quotes for bind values, instead of double quotes, and double literal single quotes in bind values (and document that). I also made use of the DETAIL line to have much cleaner output.
* Add server support for "plugin" libraries that can be used for add-on tasksTom Lane2006-08-15
| | | | | | | | | | | | | | | | | | such as debugging and performance measurement. This consists of two features: a table of "rendezvous variables" that allows separately-loaded shared libraries to communicate, and a new GUC setting "local_preload_libraries" that allows libraries to be loaded into specific sessions without explicit cooperation from the client application. To make local_preload_libraries as flexible as possible, we do not restrict its use to superusers; instead, it is restricted to load only libraries stored in $libdir/plugins/. The existing LOAD command has also been modified to allow non-superusers to LOAD libraries stored in this directory. This patch also renames the existing GUC variable preload_libraries to shared_preload_libraries (after a suggestion by Simon Riggs) and does some code refactoring in dfmgr.c to improve clarity. Korry Douglas, with a little help from Tom Lane.
* Fix core dump in duration logging for a V3-protocol Execute messageTom Lane2006-08-13
| | | | | | 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.
* Fix display of log duration so it is milliseconds.microseconds "ms".Bruce Momjian2006-08-10
| | | | Greg Sabino Mullane
* For protocol-level prepare/bind/execute:Bruce Momjian2006-08-08
| | | | | | | | 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
* Use better named loop variable for large loop, rather than 'i'.Bruce Momjian2006-08-06
|
* Improve logging of protocol-level prepared statements.Bruce Momjian2006-08-04
|
* Adjust initialization sequence for timezone_abbreviations so thatTom Lane2006-07-29
| | | | | | | | | it's handled just about like timezone; in particular, don't try to read anything during InitializeGUCOptions. Should solve current startup failure on Windows, and avoid wasted cycles if a nondefault setting is specified in postgresql.conf too. Possibly we need to think about a more general solution for handling 'expensive to set' GUC options.
* Remove 576 references of include files that were not needed.Bruce Momjian2006-07-14
|
* Allow include files to compile own their own.Bruce Momjian2006-07-13
| | | | | | | Strip unused include files out unused include files, and add needed includes to C files. The next step is to remove unused include files in C files.
* Add GUC update_process_title to control whether 'ps' display is updatedBruce Momjian2006-06-27
| | | | for every command, default to on.
* Remove redundant gettimeofday() calls to the extent practical withoutTom Lane2006-06-20
| | | | | | | | | | | 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.
* Merge postmaster and postgres command into just postgres. postmasterPeter Eisentraut2006-06-18
| | | | | symlink is kept for now for compatibility. To call single-user mode, use postgres --single.
* Fix Assert failure when a fastpath function call is attempted inside anTom Lane2006-06-11
| | | | | | | | | | | | | | | already-aborted transaction block. GetSnapshotData throws an Assert if not in a valid transaction; hence we mustn't attempt to set a snapshot for the function until after checking for aborted transaction. This is harmless AFAICT if Asserts aren't enabled (GetSnapshotData will compute a bogus snapshot, but it doesn't matter since HandleFunctionRequest will throw an error shortly anywy). Hence, not a major bug. Along the way, add some ability to log fastpath calls when statement logging is turned on. This could probably stand to be improved further, but not logging anything is clearly undesirable. Backpatched as far as 8.0; bug doesn't exist before that.
* Add statement_timestamp(), clock_timestamp(), andBruce Momjian2006-04-25
| | | | | | | | | transaction_timestamp() (just like now()). Also update statement_timeout() to mention it is statement arrival time that is measured. Catalog version updated.
* Simplify ParamListInfo data structure to support only numbered parameters,Tom Lane2006-04-22
| | | | | | | not named ones, and replace linear searches of the list with array indexing. The named-parameter support has been dead code for many years anyway, and recent profiling suggests that the searching was costing a noticeable amount of performance for complex queries.
* Document that errors are not output by log_statement (was they were inBruce Momjian2006-04-18
| | | | | | | | | 8.0), and add as suggestion to use log_min_error_statement for this purpose. I also fixed the code so the first EXECUTE has it's prepare, rather than the last which is what was in the current code. Also remove "protocol" prefix for SQL EXECUTE output because it is not accurate. Backpatch to 8.1.X.
* Modify all callers of datatype input and receive functions so that if theseTom Lane2006-04-04
| | | | | | | | | | | | | | | functions are not strict, they will be called (passing a NULL first parameter) during any attempt to input a NULL value of their datatype. Currently, all our input functions are strict and so this commit does not change any behavior. However, this will make it possible to build domain input functions that centralize checking of domain constraints, thereby closing numerous holes in our domain support, as per previous discussion. While at it, I took the opportunity to introduce convenience functions InputFunctionCall, OutputFunctionCall, etc to use in code that calls I/O functions. This eliminates a lot of grotty-looking casts, but the main motivation is to make it easier to grep for these places if we ever need to touch them again.
* Improve parser so that we can show an error cursor position for errorsTom Lane2006-03-14
| | | | | | | | | | | during parse analysis, not only errors detected in the flex/bison stages. This is per my earlier proposal. This commit includes all the basic infrastructure, but locations are only tracked and reported for errors involving column references, function calls, and operators. More could be done later but this seems like a good set to start with. I've also moved the ReportSyntaxErrorPosition logic out of psql and into libpq, which should make it available to more people --- even within psql this is an improvement because warnings weren't handled by ReportSyntaxErrorPosition.
* Update copyright for 2006. Update scripts.Bruce Momjian2006-03-05
|
* Fix typo in comment.Neil Conway2006-02-17
|
* Add a new system view, pg_cursors, that displays the currently availableNeil Conway2006-01-18
| | | | | | | | | | | | | | | | | | | | | cursors. Patch from Joachim Wieland, review and ediorialization by Neil Conway. The view lists cursors defined by DECLARE CURSOR, using SPI, or via the Bind message of the frontend/backend protocol. This means the view does not list the unnamed portal or the portal created to implement EXECUTE. Because we do list SPI portals, there might be more rows in this view than you might expect if you are using SPI implicitly (e.g. via a procedural language). Per recent discussion on -hackers, the query string included in the view for cursors defined by DECLARE CURSOR is based on debug_query_string. That means it is not accurate if multiple queries separated by semicolons are submitted as one query string. However, there doesn't seem a trivial fix for that: debug_query_string is better than nothing. I also changed SPI_cursor_open() to include the source text for the portal it creates: AFAICS there is no reason not to do this. Update the documentation and regression tests, bump the catversion.
* Add a new system view, pg_prepared_statements, that can be used toNeil Conway2006-01-08
| | | | | | | | | | | | | | | | access information about the prepared statements that are available in the current session. Original patch from Joachim Wieland, various improvements by Neil Conway. The "statement" column of the view contains the literal query string sent by the client, without any rewriting or pretty printing. This means that prepared statements created via SQL will be prefixed with "PREPARE ... AS ", whereas those prepared via the FE/BE protocol will not. That is unfortunate, but discussion on -patches did not yield an efficient way to improve this, and there is some merit in returning exactly what the client sent to the backend. Catalog version bumped, regression tests updated.
* Make all command-line options of postmaster and postgres the same. SeePeter Eisentraut2006-01-05
| | | | | http://archives.postgresql.org/pgsql-hackers/2006-01/msg00151.php for the complete plan.
* Remove BEOS port.Bruce Momjian2006-01-05
|
* Rearrange backend startup sequence so that ShmemIndexLock can becomeTom Lane2006-01-04
| | | | | | an LWLock instead of a spinlock. This hardly matters on Unix machines but should improve startup performance on Windows (or any port using EXEC_BACKEND). Per previous discussion.
* Prefix client-side prepare with '[protocol]' rather than '[client]'.Bruce Momjian2005-12-31
|
* Rename send_rfq to send_ready_for_query.Bruce Momjian2005-12-30
|
* Mmark client-side prepare/bind/execute statements with "[client]" soBruce Momjian2005-12-30
| | | | they can be easily distinguished from SQL commands.
* Defend against crash while processing Describe Statement or Describe PortalTom Lane2005-12-14
| | | | | | messages, when client attempts to execute these outside a transaction (start one) or in a failed transaction (reject message, except for COMMIT/ROLLBACK statements which we can handle). Per report from Francisco Figueiredo Jr.