summaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
AgeCommit message (Collapse)Author
2005-12-30Rename send_rfq to send_ready_for_query.Bruce Momjian
2005-12-30Mmark client-side prepare/bind/execute statements with "[client]" soBruce Momjian
they can be easily distinguished from SQL commands.
2005-12-14Defend against crash while processing Describe Statement or Describe PortalTom Lane
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.
2005-11-22Re-run pgindent, fixing a problem where comment lines after a blankBruce Momjian
comment line where output as too long, and update typedefs for /lib directory. Also fix case where identifiers were used as variable names in the backend, but as typedefs in ecpg (favor the backend for indenting). Backpatch to 8.1.X.
2005-11-10When in transaction-aborted state, reject Bind message for portals containingTom Lane
anything but transaction-exiting commands (ROLLBACK etc). We already rejected Parse and Execute in such cases, so there seems little point in allowing Bind. This prevents at least an Assert failure, and probably worse things, since there's a lot of infrastructure that doesn't work when not in a live transaction. We can also simplify the Bind logic a bit by rejecting messages with a nonzero number of parameters, instead of the former kluge to silently substitute NULL for each parameter. Per bug #2033 from Joel Stevenson.
2005-11-03Rename the members of CommandDest enum so they don't collide with other uses ofAlvaro Herrera
those names. (Debug and None were pretty bad names anyway.) I hope I catched all uses of the names in comments too.
2005-10-20Postpone pg_timezone_initialize() until after creation of postmaster.pid,Tom Lane
since it can take a fair amount of time and this can confuse boot scripts that expect postmaster.pid to appear quickly. Move initialization of SSL library and preloaded libraries to after that point, too, just for luck. Per reports from Tony Caduto and others.
2005-10-15Standard pgindent run for 8.1.Bruce Momjian
2005-10-13Make stack_base_ptr non-static, for PL/Java.Bruce Momjian
2005-10-05Code cleanup for log_disconnections(). Patch from Qingqing Zhou,Neil Conway
fixes by Neil Conway.
2005-09-26Log protocol-excute fetch operatation as fetch, rather than execute,Bruce Momjian
adjusted from a patch by Simon.
2005-09-24Suppress signed-vs-unsigned-char warnings.Tom Lane
2005-09-22Suppress port number for unix domain sockets in log connect/disconnectBruce Momjian
messages.
2005-09-19Print proper cause of statement cancel, user interaction or timeout.Bruce Momjian
2005-09-16Update query cancel message:Bruce Momjian
errmsg("canceling query due to user request or statement timeout")));
2005-09-02Add log display label for unnamed server-side portals.Bruce Momjian
2005-08-11Autovacuum loose end mop-up. Provide autovacuum-specific vacuum costTom Lane
delay and limit, both as global GUCs and as table-specific entries in pg_autovacuum. stats_reset_on_server_start is now OFF by default, but a reset is forced if we did WAL replay. XID-wrap vacuums do not ANALYZE, but do FREEZE if it's a template database. Alvaro Herrera
2005-08-08Cause ShutdownPostgres to do a normal transaction abort during backendTom Lane
exit, instead of trying to take shortcuts. Introduce some additional shutdown callback routines to eliminate kluges like having ProcKill be responsible for shutting down the buffer manager. Ensure that the order of operations during shutdown is predictable and what you would expect given the module layering.
2005-07-21Add time/date macros for code clarity:Bruce Momjian
#define DAYS_PER_YEAR 365.25 #define MONTHS_PER_YEAR 12 #define DAYS_PER_MONTH 30 #define HOURS_PER_DAY 24
2005-07-14Integrate autovacuum functionality into the backend. There's still aTom Lane
few loose ends to be dealt with, but it seems to work. Alvaro Herrera, based on the contrib code by Matthew O'Connor.
2005-07-10Change typreceive function API so that receive functions get the sameTom Lane
optional arguments as text input functions, ie, typioparam OID and atttypmod. Make all the datatypes that use typmod enforce it the same way in typreceive as they do in typinput. This fixes a problem with failure to enforce length restrictions during COPY FROM BINARY.
2005-07-04Arrange for the postmaster (and standalone backends, initdb, etc) toTom Lane
chdir into PGDATA and subsequently use relative paths instead of absolute paths to access all files under PGDATA. This seems to give a small performance improvement, and it should make the system more robust against naive DBAs doing things like moving a database directory that has a live postmaster in it. Per recent discussion.
2005-06-29Clean up the rather historically encumbered interface to now() andTom Lane
current time: provide a GetCurrentTimestamp() function that returns current time in the form of a TimestampTz, instead of separate time_t and microseconds fields. This is what all the callers really want anyway, and it eliminates low-level dependencies on AbsoluteTime, which is a deprecated datatype that will have to disappear eventually.
2005-06-22Fix the mechanism for reporting the original table OID and column numberTom Lane
of columns of a query result so that it can "see through" cursors and prepared statements. Per gripe a couple months back from John DeSoi.
2005-06-17Two-phase commit. Original patch by Heikki Linnakangas, with additionalTom Lane
hacking by Alvaro Herrera and Tom Lane.
2005-06-14Add pg_postmaster_start_time() function.Bruce Momjian
Euler Taveira de Oliveira Matthias Schmidt
2005-06-03Revise handling of dropped columns in JOIN alias lists to avoid aTom Lane
performance problem pointed out by phil@vodafone: to wit, we were spending O(N^2) time to check dropped-ness in an N-deep join tree, even in the case where the tree was freshly constructed and couldn't possibly mention any dropped columns. Instead of recursing in get_rte_attribute_is_dropped(), change the data structure definition: the joinaliasvars list of a JOIN RTE must have a NULL Const instead of a Var at any position that references a now-dropped column. This costs nothing during normal parse-rewrite-plan path, and instead we have a linear-time update to make when loading a stored rule that might contain now-dropped columns. While at it, move the responsibility for acquring locks on relations referenced by rules into this separate function (which I therefore chose to call AcquireRewriteLocks). This saves effort --- namely, duplicated lock grabs in parser and rewriter --- in the normal path at a cost of one extra non-locked heap_open() in the stored-rule path; seems a good tradeoff. A fringe benefit is that it is now *much* clearer that we acquire lock on relations referenced in rules before we make any rewriter decisions based on their properties. (I don't know of any bug of that ilk, but it wasn't exactly clear before.)
2005-06-02Push enable/disable of notify and catchup interrupts all the way downTom Lane
to just around the bare recv() call that gets a command from the client. The former placement in PostgresMain was unsafe because the intermediate processing layers (especially SSL) use facilities such as malloc that are not necessarily re-entrant. Per report from counterstorm.com.
2005-06-01Fix log_statement to properly recognize SELECT INTO and CREATE TABLE ASBruce Momjian
and DDL statements. Backpatch fix to 8.0.X. Per report from Murthy Kambhampaty
2005-05-24Log queries for client-side prepare/execute. Simon RiggsBruce Momjian
Log prepare query during execute. Bruce Momjian
2005-04-21Rethink original decision to use AND/OR Expr nodes to represent bitmapTom Lane
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.
2005-02-22Use _() macro consistently rather than gettext(). Add translationBruce Momjian
macros around strings that were missing them.
2005-02-20Add code to prevent transaction ID wraparound by enforcing a safe limitTom Lane
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.
2004-12-31Tag appropriate files for rc3PostgreSQL Daemon
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 ...
2004-11-24A client_encoding specification coming from the connection request hasTom Lane
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.
2004-11-20Move pgstat_report_tabstat() call so that stats are not reported to theTom Lane
collector until the transaction commits. Per recent discussion, this should avoid confusing autovacuum when an updating transaction runs for a long time.
2004-11-14Remove GUC USERLIMIT variable category, making the affected variablesTom Lane
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.
2004-10-15Have log_duration only output when log_statement has printed the query.Bruce Momjian
This handles the new multiple log_statement values. Ed L.
2004-10-12Message style revisionsPeter Eisentraut
2004-10-08Whack some sense into the configuration-file-location patch.Tom Lane
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.
2004-09-26Repair bug that would allow libpq to think a command had succeeded whenTom Lane
it really hadn't, due to double output of previous command's response. Fix prevents recursive entry to libpq routines. Found by Jan Wieck.
2004-09-13Redesign query-snapshot timing so that volatile functions in READ COMMITTEDTom Lane
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.
2004-09-10Fire non-deferred AFTER triggers immediately upon query completion,Tom Lane
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.
2004-08-29Pgindent run for 8.0.Bruce Momjian
2004-08-29Update copyright to 2004.Bruce Momjian
2004-08-02Allow DECLARE CURSOR to take parameters from the portal in which it isTom Lane
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.
2004-07-31Restructure error handling as recently discussed. It is now reallyTom Lane
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.
2004-07-28Revert ill-conceived patch that made elog(FATAL) the same as elog(ERROR)Tom Lane
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.
2004-07-27Replace nested-BEGIN syntax for subtransactions with spec-compliantTom Lane
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.
2004-07-17Invent ResourceOwner mechanism as per my recent proposal, and use it toTom Lane
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.