summaryrefslogtreecommitdiff
path: root/src/include/utils
Commit message (Collapse)AuthorAgeFilesLines
* Clean up local redeclarations of variables with DLLIMPORT, per reportTom Lane2006-10-191-3/+3
| | | | from Magnus that MSVC complains about this.
* Fix up timetz input so that a date is required only when the specifiedTom Lane2006-10-181-2/+2
| | | | | | | | timezone actually has a daylight-savings rule. This avoids breaking cases that used to work because they went through the DecodePosixTimezone code path. Per contrib regression failures (mea culpa for not running those yesterday...). Also document the already-applied change to allow GMT offsets up to 14 hours.
* On platforms that have getrlimit(RLIMIT_STACK), use it to ensure thatTom Lane2006-10-071-2/+2
| | | | | | | | 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().
* Fix SysCacheGetAttr() to handle the case where the specified syscache has notTom Lane2006-10-061-2/+2
| | | | | | | | | | | been initialized yet. This can happen because there are code paths that call SysCacheGetAttr() on a tuple originally fetched from a different syscache (hopefully on the same catalog) than the one specified in the call. It doesn't seem useful or robust to try to prevent that from happening, so just improve the function to cope instead. Per bug#2678 from Jeff Trout. The specific example shown by Jeff is new in 8.1, but to be on the safe side I'm backpatching 8.0 as well. We could patch 7.x similarly but I think that's probably overkill, given the lack of evidence of old bugs of this ilk.
* Cleanup for pglz_compress code: remove dead code, const-ify API ofTom Lane2006-10-051-120/+10
| | | | | | remaining functions, simplify pglz_compress's API to not require a useless data copy when compression fails. Also add a check in pglz_decompress that the expected amount of data was decompressed.
* pgindent run for 8.2.Bruce Momjian2006-10-0414-62/+62
|
* The attached patch changes units of the some default values inBruce Momjian2006-10-031-3/+4
| | | | | | | | | | | | | | | | | | | postgresql.conf. - shared_buffers = 32000kB => 32MB - temp_buffers = 8000kB => 8MB - wal_buffers = 8 => 64kB The code of initdb was a bit modified to write MB-unit values. Values greater than 8000kB are rounded out to MB. GUC_UNIT_XBLOCKS is added for wal_buffers. It is like GUC_UNIT_BLOCKS, but uses XLOG_BLCKSZ instead of BLCKSZ. Also, I cleaned up the test of GUC_UNIT_* flags in preparation to add more unit flags in less bits. ITAGAKI Takahiro
* Fix IS NULL and IS NOT NULL tests on row-valued expressions to conform toTom Lane2006-09-281-1/+2
| | | | | | | | | | | | the SQL spec, viz IS NULL is true if all the row's fields are null, IS NOT NULL is true if all the row's fields are not null. The former coding got this right for a limited number of cases with IS NULL (ie, those where it could disassemble a ROW constructor at parse time), but was entirely wrong for IS NOT NULL. Per report from Teodor. I desisted from changing the behavior for arrays, since on closer inspection it's not clear that there's any support for that in the SQL spec. This probably needs more consideration.
* Change patternsel (LIKE/regex selectivity estimation) so that if thereTom Lane2006-09-201-1/+4
| | | | | | | | | is a large enough histogram, it will use the number of matches in the histogram to derive a selectivity estimate, rather than the admittedly pretty bogus heuristics involving examining the pattern contents. I set 'large enough' at 100, but perhaps we should change that later. Also apply the same technique in contrib/ltree's <@ and @> estimator. Per discussion with Stefan Kaltenbrunner and Matteo Beccati.
* Add built-in userlock manipulation functions to replace the formerTom Lane2006-09-181-1/+14
| | | | | | | contrib functionality. Along the way, remove the USER_LOCKS configuration symbol, since it no longer makes any sense to try to compile that out. No user documentation yet ... mmoncure has promised to write some. Thanks to Abhijit Menon-Sen for creating a first draft to work from.
* Rename the recently-added pg_timezonenames view to pg_timezone_abbrevs,Tom Lane2006-09-161-2/+3
| | | | | | and create a new view pg_timezone_names that provides information about the zones known in the 'zic' database. Magnus Hagander, with some additional work by Tom Lane.
* If we're going to advertise the array overlap/containment operators,Tom Lane2006-09-101-1/+4
| | | | | | we probably should make them work reliably for all arrays. Fix code to handle NULLs and multidimensional arrays, move it into arrayfuncs.c. GIN is still restricted to indexing arrays with no null elements, however.
* Clean up logging for extended-query-protocol operations, as per my recentTom Lane2006-09-071-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Get rid of the separate RULE privilege for tables: now only a table's ownerTom Lane2006-09-051-3/+2
| | | | | | | | | | | | | can create or modify rules for the table. Do setRuleCheckAsUser() while loading rules into the relcache, rather than when defining a rule. This ensures that permission checks for tables referenced in a rule are done with respect to the current owner of the rule's table, whereas formerly ALTER TABLE OWNER would fail to update the permission checking for associated rules. Removal of separate RULE privilege is needed to prevent various scenarios in which a grantee of RULE privilege could effectively have any privilege of the table owner. For backwards compatibility, GRANT/REVOKE RULE is still accepted, but it doesn't do anything. Per discussion here: http://archives.postgresql.org/pgsql-hackers/2006-04/msg01138.php
* Fix imprecision from interval rounding of multiplication/division.Bruce Momjian2006-09-051-4/+7
| | | | Bruce, Michael Glaesemann
* Arrange for GetSnapshotData to copy live-subtransaction XIDs from theTom Lane2006-09-031-1/+7
| | | | | | | | | | PGPROC array into snapshots, and use this information to avoid visits to pg_subtrans in HeapTupleSatisfiesSnapshot. This appears to solve the pg_subtrans-related context swap storm problem that's been reported by several people for 8.1. While at it, modify GetSnapshotData to not take an exclusive lock on ProcArrayLock, as closer analysis shows that shared lock is always sufficient. Itagaki Takahiro and Tom Lane
* Revert FETCH/MOVE int64 patch. Was using incorrect checks forBruce Momjian2006-09-031-2/+2
| | | | fetch/move in scan.l.
* Change FETCH/MOVE to use int8.Bruce Momjian2006-09-021-2/+2
| | | | Dhanaraj M
* Now bind displays prepare as detail, and execute displays prepare andBruce Momjian2006-08-291-2/+4
| | | | | | | | | | 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.
* Fix oversight in initial implementation of PORTAL_ONE_RETURNING mode: weTom Lane2006-08-141-5/+10
| | | | | | | | | | cannot assume that there's exactly one Query in the Portal, as we can for ONE_SELECT mode, because non-SELECT queries might have extra queries added during rule rewrites. Fix things up so that we'll use ONE_RETURNING mode when a Portal contains one primary (canSetTag) query and that query has a RETURNING list. This appears to be a second showstopper reason for running the Portal to completion before we start to hand anything back --- we want to be sure that the rule-added queries get run too.
* Revert (again) GUC patch to return commented fields to their defaultBruce Momjian2006-08-142-13/+6
| | | | values, due to concern about the patch.
* Recommit patch to allow commented GUC variables to return to theirBruce Momjian2006-08-131-5/+9
| | | | default values.
* Re-apply guc cleanup patch, with memory allocation bugs fixed.Bruce Momjian2006-08-131-1/+4
|
* Back out patch to reorganize guc processing. Was causing regressionBruce Momjian2006-08-121-4/+1
| | | | failures.
* Back out patch that allowed commented guc variables to return to theirBruce Momjian2006-08-121-9/+5
| | | | default values. Was causing regression failures.
* Add INSERT/UPDATE/DELETE RETURNING, with basic docs and regression tests.Tom Lane2006-08-121-5/+11
| | | | | | | | 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
* Allow commenting of variables in postgresql.conf to restore them toBruce Momjian2006-08-111-5/+9
| | | | | | defaults. Zdenek Kotala
* Refactor GUC set_config_option function:Bruce Momjian2006-08-111-1/+4
| | | | | | | | | | | | | | | | | | 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
* For protocol-level prepare/bind/execute:Bruce Momjian2006-08-081-1/+3
| | | | | | | | 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
* Change the relation_open protocol so that we obtain lock on a relationTom Lane2006-07-311-6/+2
| | | | | | | | | | | | (table or index) before trying to open its relcache entry. This fixes race conditions in which someone else commits a change to the relation's catalog entries while we are in process of doing relcache load. Problems of that ilk have been reported sporadically for years, but it was not really practical to fix until recently --- for instance, the recent addition of WAL-log support for in-place updates helped. Along the way, remove pg_am.amconcurrent: all AMs are now expected to support concurrent update.
* Adjust initialization sequence for timezone_abbreviations so thatTom Lane2006-07-291-1/+3
| | | | | | | | | 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.
* SQL2003-standard statistical aggregates, by Sergey Koposov. I've added onlyTom Lane2006-07-282-2/+16
| | | | | | | the float8 versions of the aggregates, which is all that the standard requires. Sergey's original patch also provided versions using numeric arithmetic, but given the size and slowness of the code, I doubt we ought to include those in core.
* Allow units to be specified with configuration settings.Peter Eisentraut2006-07-271-1/+10
|
* Remove hard-wired lists of timezone abbreviations in favor of providingTom Lane2006-07-253-6/+41
| | | | | | | | | configuration files that can be altered by a DBA. The australian_timezones GUC setting disappears, replaced by a timezone_abbreviations setting (set this to 'Australia' to get the effect of australian_timezones). The list of zone names defined by default has undergone a bit of cleanup, too. Documentation still needs some work --- in particular, should we fix Table B-4, or just get rid of it? Joachim Wieland, with some editorializing by moi.
* Add support to dynahash.c for partitioning shared hashtables accordingTom Lane2006-07-221-76/+22
| | | | | | to the low-order bits of the entry hash value. Also make some incidental cleanups in the dynahash API, such as not exporting the hash header structs to the world.
* Add the full set of comparison functions for type TID, including a btreeTom Lane2006-07-211-1/+8
| | | | | | | | opclass. This is not so much because anyone's likely to create an index on TID, as that sorting TIDs can be useful. Also added max and min aggregates while at it, so that one can investigate the clusteredness of a table with queries like SELECT min(ctid), max(ctid) FROM tab WHERE ... Greg Stark and Tom Lane
* More include file adjustments.Bruce Momjian2006-07-135-12/+5
|
* More include file adjustments.Bruce Momjian2006-07-133-3/+8
|
* Allow include files to compile own their own.Bruce Momjian2006-07-139-15/+25
| | | | | | | 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.
* Allow each C include file to compile on its own by including any neededBruce Momjian2006-07-113-3/+8
| | | | header files.
* Code review for FILLFACTOR patch. Change WITH grammar as per earlierTom Lane2006-07-031-8/+48
| | | | | | | | | | | | | | | | discussion (including making def_arg allow reserved words), add missed opt_definition for UNIQUE case. Put the reloptions support code in a less random place (I chose to make a new file access/common/reloptions.c). Eliminate header inclusion creep. Make the index options functions safely user-callable (seems like client apps might like to be able to test validity of options before trying to make an index). Reduce overhead for normal case with no options by allowing rd_options to be NULL. Fix some unmaintainably klugy code, including getting rid of Natts_pg_class_fixed at long last. Some stylistic cleanup too, and pay attention to keeping comments in sync with code. Documentation still needs work, though I did fix the omissions in catalogs.sgml and indexam.sgml.
* Add FILLFACTOR to CREATE INDEX.Bruce Momjian2006-07-021-1/+8
| | | | ITAGAKI Takahiro
* Fix oversight in planning for multiple indexscans driven byTom Lane2006-07-011-1/+2
| | | | | | | | ScalarArrayOpExpr index quals: we were estimating the right total number of rows returned, but treating the index-access part of the cost as if a single scan were fetching that many consecutive index tuples. Actually we should treat it as a multiple indexscan, and if there are enough of 'em the Mackert-Lohman discount should kick in.
* Add GUC update_process_title to control whether 'ps' display is updatedBruce Momjian2006-06-271-3/+5
| | | | for every command, default to on.
* Extend the MinimalTuple concept to tuplesort.c, thereby reducing theTom Lane2006-06-271-17/+19
| | | | | | | | | per-tuple space overhead for sorts in memory. I chose to replace the previous patch that tried to write out the bare minimum amount of data when sorting on disk; instead, just dump the MinimalTuples as-is. This wastes 3 to 10 bytes per tuple depending on architecture and null-bitmap length, but the simplification in the writetup/readtup routines seems worth it.
* Create infrastructure for 'MinimalTuple' representation of in-memoryTom Lane2006-06-271-9/+15
| | | | | | | | tuples with less header overhead than a regular HeapTuple, per my recent proposal. Teach TupleTableSlot code how to deal with these. As proof of concept, change tuplestore.c to store MinimalTuples instead of HeapTuples. Future patches will expand the concept to other places where it is useful.
* Tweak dynahash.c to avoid wasting memory space in non-shared hash tables.Tom Lane2006-06-251-3/+1
| | | | | | | | 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.
* Remove redundant gettimeofday() calls to the extent practical withoutTom Lane2006-06-201-1/+11
| | | | | | | | | | | 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.
* Code review for SELECT INTO STRICT patch: use saner choices of errorTom Lane2006-06-161-1/+3
| | | | SQLSTATEs, fix some documentation problems.
* Fix problems with cached tuple descriptors disappearing while still in useTom Lane2006-06-162-3/+13
| | | | | | | | | | 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