aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
Commit message (Collapse)AuthorAge
...
* Fix log_statement to properly recognize SELECT INTO and CREATE TABLE ASBruce Momjian2005-06-01
| | | | | | | | and DDL statements. Backpatch fix to 8.0.X. Per report from Murthy Kambhampaty
* Log queries for client-side prepare/execute. Simon RiggsBruce Momjian2005-05-24
| | | | Log prepare query during execute. Bruce Momjian
* Rethink original decision to use AND/OR Expr nodes to represent bitmapTom Lane2005-04-21
| | | | | | | logic operations during planning. Seems cleaner to create two new Path node types, instead --- this avoids duplication of cost-estimation code. Also, create an enable_bitmapscan GUC parameter to control use of bitmap plans.
* Use _() macro consistently rather than gettext(). Add translationBruce Momjian2005-02-22
| | | | macros around strings that were missing them.
* Add code to prevent transaction ID wraparound by enforcing a safe limitTom Lane2005-02-20
| | | | | | | | | | | | | | in GetNewTransactionId(). Since the limit value has to be computed before we run any real transactions, this requires adding code to database startup to scan pg_database and determine the oldest datfrozenxid. This can conveniently be combined with the first stage of an attack on the problem that the 'flat file' copies of pg_shadow and pg_group are not properly updated during WAL recovery. The code I've added to startup resides in a new file src/backend/utils/init/flatfiles.c, and it is responsible for rewriting the flat files as well as initializing the XID wraparound limit value. This will eventually allow us to get rid of GetRawDatabaseInfo too, but we'll need an initdb so we can add a trigger to pg_database.
* Tag appropriate files for rc3PostgreSQL Daemon2004-12-31
| | | | | | | | Also performed an initial run through of upgrading our Copyright date to extend to 2005 ... first run here was very simple ... change everything where: grep 1996-2004 && the word 'Copyright' ... scanned through the generated list with 'less' first, and after, to make sure that I only picked up the right entries ...
* A client_encoding specification coming from the connection request hasTom Lane2004-11-24
| | | | | | | | | | to be processed by GUC before InitPostgres, because any required lookup of the encoding conversion function has to be done during InitializeClientEncoding. So, I broke this last week by moving GUC processing to after InitPostgres :-(. What we can do as a compromise is process non-SUSET variables during command line scanning (the same as before), and postpone the processing of only SUSET variables. None of the SUSET variables need to be set before InitPostgres.
* Move pgstat_report_tabstat() call so that stats are not reported to theTom Lane2004-11-20
| | | | | | collector until the transaction commits. Per recent discussion, this should avoid confusing autovacuum when an updating transaction runs for a long time.
* Remove GUC USERLIMIT variable category, making the affected variablesTom Lane2004-11-14
| | | | | | | plain SUSET instead. Also delay processing of options received in client connection request until after we know if the user is a superuser, so that SUSET values can be set that way by legitimate superusers. Per recent discussion.
* Have log_duration only output when log_statement has printed the query.Bruce Momjian2004-10-15
| | | | | | This handles the new multiple log_statement values. Ed L.
* Message style revisionsPeter Eisentraut2004-10-12
|
* Whack some sense into the configuration-file-location patch.Tom Lane2004-10-08
| | | | | | | 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.
* Repair bug that would allow libpq to think a command had succeeded whenTom Lane2004-09-26
| | | | | it really hadn't, due to double output of previous command's response. Fix prevents recursive entry to libpq routines. Found by Jan Wieck.
* Redesign query-snapshot timing so that volatile functions in READ COMMITTEDTom Lane2004-09-13
| | | | | | | | | | | | | mode see a fresh snapshot for each command in the function, rather than using the latest interactive command's snapshot. Also, suppress fresh snapshots as well as CommandCounterIncrement inside STABLE and IMMUTABLE functions, instead using the snapshot taken for the most closely nested regular query. (This behavior is only sane for read-only functions, so the patch also enforces that such functions contain only SELECT commands.) As per my proposal of 6-Sep-2004; I note that I floated essentially the same proposal on 19-Jun-2002, but that discussion tailed off without any action. Since 8.0 seems like the right place to be taking possibly nontrivial backwards compatibility hits, let's get it done now.
* Fire non-deferred AFTER triggers immediately upon query completion,Tom Lane2004-09-10
| | | | | | | | | | | | | rather than when returning to the idle loop. This makes no particular difference for interactively-issued queries, but it makes a big difference for queries issued within functions: trigger execution now occurs before the calling function is allowed to proceed. This responds to numerous complaints about nonintuitive behavior of foreign key checking, such as http://archives.postgresql.org/pgsql-bugs/2004-09/msg00020.php, and appears to be required by the SQL99 spec. Also take the opportunity to simplify the data structures used for the pending-trigger list, rename them for more clarity, and squeeze out a bit of space.
* Pgindent run for 8.0.Bruce Momjian2004-08-29
|
* Update copyright to 2004.Bruce Momjian2004-08-29
|
* Allow DECLARE CURSOR to take parameters from the portal in which it isTom Lane2004-08-02
| | | | | | | | | | executed. Previously, the DECLARE would succeed but subsequent FETCHes would fail since the parameter values supplied to DECLARE were not propagated to the portal created for the cursor. In support of this, add type Oids to ParamListInfo entries, which seems like a good idea anyway since code that extracts a value can double-check that it got the type of value it was expecting. Oliver Jowett, with minor editorialization by Tom Lane.
* Restructure error handling as recently discussed. It is now reallyTom Lane2004-07-31
| | | | | | possible to trap an error inside a function rather than letting it propagate out to PostgresMain. You still have to use AbortCurrentTransaction to clean up, but at least the error handling itself will cooperate.
* Revert ill-conceived patch that made elog(FATAL) the same as elog(ERROR)Tom Lane2004-07-28
| | | | | | followed by seeing EOF from client. If we want a safe session-kill capability we will need to write one, not break our error handling mechanism.
* Replace nested-BEGIN syntax for subtransactions with spec-compliantTom Lane2004-07-27
| | | | | | | SAVEPOINT/RELEASE/ROLLBACK-TO syntax. (Alvaro) Cause COMMIT of a failed transaction to report ROLLBACK instead of COMMIT in its command tag. (Tom) Fix a few loose ends in the nested-transactions stuff.
* Invent ResourceOwner mechanism as per my recent proposal, and use it toTom Lane2004-07-17
| | | | | | | | keep track of portal-related resources separately from transaction-related resources. This allows cursors to work in a somewhat sane fashion with nested transactions. For now, cursor behavior is non-subtransactional, that is a cursor's state does not roll back if you abort a subtransaction that fetched from the cursor. We might want to change that later.
* Allow configuration files to be placed outside the data directory.Bruce Momjian2004-07-11
| | | | | | | Add new postgresql.conf variables to point to data, pg_hba.conf, and pg_ident.conf files. Needs more documentation.
* Nested transactions. There is still much left to do, especially on theTom Lane2004-07-01
| | | | | | | performance front, but with feature freeze upon us I think it's time to drive a stake in the ground and say that this will be in 7.5. Alvaro Herrera, with some help from Tom Lane.
* Replace direct fprintf(stderr) calls by write_stderr(), and cause thisTom Lane2004-06-24
| | | | | | | routine to do something appropriate on Win32. Also, add a security check on Win32 that parallels the can't-run-as-root check on Unix. Magnus Hagander
* When using extended-query protocol, postpone planning of unnamed statementsTom Lane2004-06-11
| | | | | | | | | | | | | | | | | | | until Bind is received, so that actual parameter values are visible to the planner. Make use of the parameter values for estimation purposes (but don't fold them into the actual plan). This buys back most of the potential loss of plan quality that ensues from using out-of-line parameters instead of putting literal values right into the query text. This patch creates a notion of constant-folding expressions 'for estimation purposes only', in which case we can be more aggressive than the normal eval_const_expressions() logic can be. Right now the only difference in behavior is inserting bound values for Params, but it will be interesting to look at other possibilities. One that we've seen come up repeatedly is reducing now() and related functions to current values, so that queries like ... WHERE timestampcol > now() - '1 day' have some chance of being planned effectively. Oliver Jowett, with some kibitzing from Tom Lane.
* Infrastructure for I/O of composite types: arrange for the I/O routinesTom Lane2004-06-06
| | | | | | | | | | of a composite type to get that type's OID as their second parameter, in place of typelem which is useless. The actual changes are mostly centralized in getTypeInputInfo and siblings, but I had to fix a few places that were fetching pg_type.typelem for themselves instead of using the lsyscache.c routines. Also, I renamed all the related variables from 'typelem' to 'typioparam' to discourage people from assuming that they necessarily contain array element types.
* Adjust our timezone library to use pg_time_t (typedef'd as int64) inTom Lane2004-06-03
| | | | | | | | | | | | | | | | | | | place of time_t, as per prior discussion. The behavior does not change on machines without a 64-bit-int type, but on machines with one, which is most, we are rid of the bizarre boundary behavior at the edges of the 32-bit-time_t range (1901 and 2038). The system will now treat times over the full supported timestamp range as being in your local time zone. It may seem a little bizarre to consider that times in 4000 BC are PST or EST, but this is surely at least as reasonable as propagating Gregorian calendar rules back that far. I did not modify the format of the zic timezone database files, which means that for the moment the system will not know about daylight-savings periods outside the range 1901-2038. Given the way the files are set up, it's not a simple decision like 'widen to 64 bits'; we have to actually think about the range of years that need to be supported. We should probably inquire what the plans of the upstream zic people are before making any decisions of our own.
* Separate out bgwriter code into a logically separate module, ratherTom Lane2004-05-29
| | | | | | | | | than being random pieces of other files. Give bgwriter responsibility for all checkpoint activity (other than a post-recovery checkpoint); so this child process absorbs the functionality of the former transient checkpoint and shutdown subprocesses. While at it, create an actual include file for postmaster.c, which for some reason never had its own file before.
* Code review for EXEC_BACKEND changes. Reduce the number of #ifdefs byTom Lane2004-05-28
| | | | | | | | | | | about a third, make it work on non-Windows platforms again. (But perhaps I broke the WIN32 code, since I have no way to test that.) Fold all the paths that fork postmaster child processes to go through the single routine SubPostmasterMain, which takes care of resurrecting the state that would normally be inherited from the postmaster (including GUC variables). Clean up some places where there's no particularly good reason for the EXEC and non-EXEC cases to work differently. Take care of one or two FIXMEs that remained in the code.
* Reimplement the linked list data structure used throughout the backend.Neil Conway2004-05-26
| | | | | | | | | | | | | | | | In the past, we used a 'Lispy' linked list implementation: a "list" was merely a pointer to the head node of the list. The problem with that design is that it makes lappend() and length() linear time. This patch fixes that problem (and others) by maintaining a count of the list length and a pointer to the tail node along with each head node pointer. A "list" is now a pointer to a structure containing some meta-data about the list; the head and tail pointers in that structure refer to ListCell structures that maintain the actual linked list of nodes. The function names of the list API have also been changed to, I hope, be more logically consistent. By default, the old function names are still available; they will be disabled-by-default once the rest of the tree has been updated to use the new API names.
* Handle impending sinval queue overflow by means of a separate signalTom Lane2004-05-23
| | | | | | | | | | | | | | | | | (SIGUSR1, which we have not been using recently) instead of piggybacking on SIGUSR2-driven NOTIFY processing. This has several good results: the processing needed to drain the sinval queue is a lot less than the processing needed to answer a NOTIFY; there's less contention since we don't have a bunch of backends all trying to acquire exclusive lock on pg_listener; backends that are sitting inside a transaction block can still drain the queue, whereas NOTIFY processing can't run if there's an open transaction block. (This last is a fairly serious issue that I don't think we ever recognized before --- with clients like JDBC that tend to sit with open transaction blocks, the sinval queue draining mechanism never really worked as intended, probably resulting in a lot of useless cache-reset overhead.) This is the last of several proposed changes in response to Philip Warner's recent report of sinval-induced performance problems.
* Integrate src/timezone library for all platforms. There is more we canTom Lane2004-05-21
| | | | | | and should do now that we control our own destiny for timezone handling, but this commit gets the bulk of the picayune diffs in place. Magnus Hagander and Tom Lane.
* Only do pkglib_path if needed.Bruce Momjian2004-05-19
|
* Only do find_my_exec if it doesn't come from the postmaster.Bruce Momjian2004-05-19
|
* Move find_my_exec lower so elog() works, per Tom.Bruce Momjian2004-05-19
|
* Move get_pkglib_path up into main.c too.Bruce Momjian2004-05-18
|
* Move find_my_exec() way up into main.c so it is available to theBruce Momjian2004-05-18
| | | | | | | | timezone code and other places. Remove elog() calls from find_my_exec; do fprintf(stderr) instead. We can then remove the exec.c handling in the makefile because it doesn't have to be built to suppress elog calls.
* Reorganize code to allow path-relative installs.Bruce Momjian2004-05-17
| | | | | | | Create new get_* functions to access compiled-in paths and adjust if relative installs are to be used. Clean up substitute_libpath_macro() code.
* Adjust find_my_exec/find_other_exec() so that the return parameter isBruce Momjian2004-05-14
| | | | last, not first. This fits our style better.
* Reorganize backend code to more cleanly manage executable names andBruce Momjian2004-05-13
| | | | backend startup.
* Rename find_my_binary/find_other_binary toBruce Momjian2004-05-12
| | | | | | | | | find_my_exec/find_other_exec(). Remove passing of progname to these functions as they can find that out from argv[0], which they already have. Make get_progname return const char *, and update all progname variables to be const char *.
* As part of the work for making relocatable installs, I have re-factoredBruce Momjian2004-05-11
| | | | | | | | | | | | all the code that looks for other binaries. I move FindExec into port/exec.c (and renamed it to find_my_binary()). I also added find_other_binary that looks for another binary in the same directory as the calling program, and checks the version string. The only behavior change was that initdb and pg_dump would look in the hard-coded bindir directory if it can't find the requested binary in the same directory as the caller. The new code throws an error. The old behavior seemed too error prone for version mismatches.
* Remove crude test for log_statement_stats in startup code now that weBruce Momjian2004-05-07
| | | | | | | have a more proper GUC based test. Also change error return code to ERRCODE_INVALID_PARAMETER_VALUE so it matches the old error return code.
* Remove the last traces of Joe Hellerstein's "xfunc" optimization. PatchNeil Conway2004-04-25
| | | | | from Alvaro Herrera. Also, removed lispsort.c, since it is no longer used.
* * Most changes are to fix warnings issued when compiling win32Bruce Momjian2004-04-19
| | | | | | | | | | | | | | | | | | | | | * removed a few redundant defines * get_user_name safe under win32 * rationalized pipe read EOF for win32 (UPDATED PATCH USED) * changed all backend instances of sleep() to pg_usleep - except for the SLEEP_ON_ASSERT in assert.c, as it would exceed a 32-bit long [Note to patcher: If a SLEEP_ON_ASSERT of 2000 seconds is acceptable, please replace with pg_usleep(2000000000L)] I added a comment to that part of the code: /* * It would be nice to use pg_usleep() here, but only does 2000 sec * or 33 minutes, which seems too short. */ sleep(1000000); Claudio Natoli
* Exit backend from SIGTERM or FATAL by simulating client EOF, rather thanBruce Momjian2004-04-11
| | | | calling proc_exit() directly. This should make SIGTERM more reliable.
* > >>1. change the type of "log_statement" option from boolean to string,Bruce Momjian2004-04-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > >>with allowed values of "all, mod, ddl, none" with default "none". OK, here is a patch that implements #1. Here is sample output: test=> set client_min_messages = 'log'; SET test=> set log_statement = 'mod'; SET test=> select 1; ?column? ---------- 1 (1 row) test=> update test set x=1; LOG: statement: update test set x=1; ERROR: relation "test" does not exist test=> update test set x=1; LOG: statement: update test set x=1; ERROR: relation "test" does not exist test=> copy test from '/tmp/x'; LOG: statement: copy test from '/tmp/x'; ERROR: relation "test" does not exist test=> copy test to '/tmp/x'; ERROR: relation "test" does not exist test=> prepare xx as select 1; PREPARE test=> prepare xx as update x set y=1; LOG: statement: prepare xx as update x set y=1; ERROR: relation "x" does not exist test=> explain analyze select 1;; QUERY PLAN ------------------------------------------------------------------------------------ Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.006..0.007 rows=1 loops=1) Total runtime: 0.046 ms (2 rows) test=> explain analyze update test set x=1; LOG: statement: explain analyze update test set x=1; ERROR: relation "test" does not exist test=> explain update test set x=1; ERROR: relation "test" does not exist It checks PREPARE and EXECUTE ANALYZE too. The log_statement values are 'none', 'mod', 'ddl', and 'all'. For 'all', it prints before the query is parsed, and for ddl/mod, it does it right after parsing using the node tag (or command tag for CREATE/ALTER/DROP), so any non-parse errors will print after the log line.
* Replace max_expr_depth parameter with a max_stack_depth parameter thatTom Lane2004-03-24
| | | | | | is measured in kilobytes and checked against actual physical execution stack depth, as per my proposal of 30-Dec. This gives us a fairly bulletproof defense against crashing due to runaway recursive functions.
* Revise syntax-error reporting behavior to give pleasant results forTom Lane2004-03-21
| | | | | errors in internally-generated queries, such as those submitted by plpgsql functions. Per recent discussions with Fabien Coelho.