summaryrefslogtreecommitdiff
path: root/src/backend/utils
Commit message (Collapse)AuthorAgeFilesLines
* Standardize on MAXPGPATH as the size of a file pathname buffer,Tom Lane1999-10-254-60/+66
| | | | | | | eliminating some wildly inconsistent coding in various parts of the system. I set MAXPGPATH = 1024 in config.h.in. If anyone is really convinced that there ought to be a configure-time test to set the value, go right ahead ... but I think it's a waste of time.
* Look Ma, no MAX_PARSE_BUFFER! (At least not in the backend.Tom Lane1999-10-231-2/+2
| | | | pg_dump and interfaces/odbc still need some work.)
* Drive a stake through the heart of the last use of MAX_PARSE_BUFFERTom Lane1999-10-181-21/+25
| | | | | in the backend. Still a few stragglers, but we're getting closer to being rid of query length limits...
* Remove now-dead sort modules.Tom Lane1999-10-172-1380/+0
|
* Final stage of psort reconstruction work: replace psort.c withTom Lane1999-10-173-6/+1471
| | | | | | | a generalized module 'tuplesort.c' that can sort either HeapTuples or IndexTuples, and is not tied to execution of a Sort node. Clean up memory leakages in sorting, and replace nbtsort.c's private implementation of mergesorting with calls to tuplesort.c.
* Second phase of psort reconstruction project: add bookkeeping logic toTom Lane1999-10-163-240/+1137
| | | | | | recycle storage within sort temp file on a block-by-block basis. This reduces peak disk usage to essentially just the volume of data being sorted, whereas it had been about 4x the data volume before.
* Split 'BufFile' routines out of fd.c into a new module, buffile.c. ExtendTom Lane1999-10-131-55/+57
| | | | | | | | BufFile so that it handles multi-segment temporary files transparently. This allows sorts and hashes to work with data exceeding 2Gig (or whatever the local limit on file size is). Change psort.c to use relative seeks instead of absolute seeks for backwards scanning, so that it won't fail when the data volume exceeds 2Gig.
* The 1st step to implement new type of scan,TidScan.Hiroshi Inoue1999-10-111-4/+126
| | | | | Now WHERE restriction on ctid is allowed though it is sequentially scanned.
* First real FOREIGN KEY constraint trigger functionality.Jan Wieck1999-10-081-12/+942
| | | | | | | | | Implemented now: FOREIGN KEY ... REFERENCES ... MATCH FULL FOREIGN KEY ... MATCH FULL ... ON DELETE CASCADE Jan
* Cleanup -is flag to -l for SSL. Another PERL variable name fix. CleanBruce Momjian1999-10-081-2/+2
| | | | | up debugging options for postmaster and postgres programs. postmaster -d is no longer optional. Documentation updates.
* XLOG (also known as WAL -:)) Bootstrap/Startup/Shutdown.Vadim B. Mikheev1999-10-064-188/+86
| | | | | First step in cleaning up backend initialization code. Fix for FATAL: now FATAL is ERROR + exit.
* Make the rule deparser a little less quote-happy, so thatTom Lane1999-10-041-63/+147
| | | | display of default expressions isn't quite so ugly.
* Reimplement parsing and storage of default expressions and constraintTom Lane1999-10-032-225/+246
| | | | | | | | | | | | | | | expressions in CREATE TABLE. There is no longer an emasculated expression syntax for these things; it's full a_expr for constraints, and b_expr for defaults (unfortunately the fact that NOT NULL is a part of the column constraint syntax causes a shift/reduce conflict if you try a_expr. Oh well --- at least parenthesized boolean expressions work now). Also, stored expression for a column default is not pre-coerced to the column type; we rely on transformInsertStatement to do that when the default is actually used. This means "f1 datetime default 'now'" behaves the way people usually expect it to. BTW, all the support code is now there to implement ALTER TABLE ADD CONSTRAINT and ALTER TABLE ADD COLUMN with a default value. I didn't actually teach ALTER TABLE to call it, but it wouldn't be much work.
* Allow CREATE FUNCTION's WITH clause to be used for all language types,Tom Lane1999-10-021-6/+8
| | | | | | | not just C, so that ISCACHABLE attribute can be specified for user-defined functions. Get rid of ParamString node type, which wasn't actually being generated by gram.y anymore, even though define.c thought that was what it was getting. Clean up minor bug in dfmgr.c (premature heap_close).
* Replace float.c's #ifdef finite check with a proper autoconf check, so itTom Lane1999-10-021-5/+5
| | | | works if finite() is a function. Patch from Christof Petig.
* Revise rule-printing routines to use expandable StringInfo buffers, so thatTom Lane1999-10-021-402/+340
| | | | | | | they have no hardwired limit on the length of a rule's text. Fix a couple of minor bugs in passing --- deparsed UPDATE queries didn't have quotes around relation name, and quotes and backslashes in constant values weren't backslash-quoted.
* Added utils/adt/ri_triggers with empty shells for theJan Wieck1999-09-302-2/+187
| | | | | | | | FOREIGN KEY triggers. Added pg_proc entries for all the new functions. Jan
* Removed (useless) pg_proc_prosrc_indexJan Wieck1999-09-301-12/+1
| | | | Jan
* Added nbtree operator class for NUMERICJan Wieck1999-09-291-1/+29
| | | | Jan
* Make tree compilable (+WAL).Vadim B. Mikheev1999-09-281-1/+3
|
* heap_close(rel, AccessShareLock);Vadim B. Mikheev1999-09-281-2/+2
| | | | ^^^^^^^^^^^^^^^^^ need in
* I have been working with user defined types and user defined cBruce Momjian1999-09-281-3/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | functions. One problem that I have encountered with the function manager is that it does not allow the user to define type conversion functions that convert between user types. For instance if mytype1, mytype2, and mytype3 are three Postgresql user types, and if I wish to define Postgresql conversion functions like I run into problems, because the Postgresql dynamic loader would look for a single link symbol, mytype3, for both pieces of object code. If I just change the name of one of the Postgresql functions (to make the symbols distinct), the automatic type conversion that Postgresql uses, for example, when matching operators to arguments no longer finds the type conversion function. The solution that I propose, and have implemented in the attatched patch extends the CREATE FUNCTION syntax as follows. In the first case above I use the link symbol mytype2_to_mytype3 for the link object that implements the first conversion function, and define the Postgresql operator with the following syntax The patch includes changes to the parser to include the altered syntax, changes to the ProcedureStmt node in nodes/parsenodes.h, changes to commands/define.c to handle the extra information in the AS clause, and changes to utils/fmgr/dfmgr.c that alter the way that the dynamic loader figures out what link symbol to use. I store the string for the link symbol in the prosrc text attribute of the pg_proc table which is currently unused in rows that reference dynamically loaded functions. Bernie Frankpitt
* Massimo's SET FSYNC and SHOW PG_OPTIONS changes, without SET QUERY_LIMIT.Bruce Momjian1999-09-272-2/+12
|
* Modify nodeAgg.c so that no rows are returned for a GROUP BYTom Lane1999-09-261-18/+23
| | | | | | | | with no input rows, per pghackers discussions around 7/22/99. Clean up a bunch of ugly coding while at it; remove redundant re-lookup of aggregate info at start of each new GROUP. Arrange to pfree intermediate values when they are pass-by-ref types, so that aggregates on pass-by-ref types no longer eat memory. This takes care of a couple of TODO items...
* Several changes here, not very related but touching some of the same files.Tom Lane1999-09-242-78/+126
| | | | | | | | | | | | | | | | | | | | | * Buffer refcount cleanup (per my "progress report" to pghackers, 9/22). * Add links to backend PROC structs to sinval's array of per-backend info, and use these links for routines that need to check the state of all backends (rather than the slow, complicated search of the ShmemIndex hashtable that was used before). Add databaseOID to PROC structs. * Use this to implement an interlock that prevents DESTROY DATABASE of a database containing running backends. (It's a little tricky to prevent a concurrently-starting backend from getting in there, since the new backend is not able to lock anything at the time it tries to look up its database in pg_database. My solution is to recheck that the DB is OK at the end of InitPostgres. It may not be a 100% solution, but it's a lot better than no interlock at all...) * In ALTER TABLE RENAME, flush buffers for the relation before doing the rename of the physical files, to ensure we don't get failures later from mdblindwrt(). * Update TRUNCATE patch so that it actually compiles against current sources :-(. You should do "make clean all" after pulling these changes.
* Fix for netmask('x.x.x.x/0') is 255.255.255.255 instead of 0.0.0.0Bruce Momjian1999-09-231-2/+3
| | | | | | This is because (-1) << 32 is -1 (Only intel arc. has been checked) Oleg Sharoiko
* Add TRUNCATE command, with psql help and sgml additions.Bruce Momjian1999-09-231-1/+3
|
* values.h patch from Alex HowanskyBruce Momjian1999-09-212-2/+16
|
* Mega-commit to make heap_open/heap_openr/heap_close take anTom Lane1999-09-189-127/+106
| | | | | | | | | | | | | | | | | additional argument specifying the kind of lock to acquire/release (or 'NoLock' to do no lock processing). Ensure that all relations are locked with some appropriate lock level before being examined --- this ensures that relevant shared-inval messages have been processed and should prevent problems caused by concurrent VACUUM. Fix several bugs having to do with mismatched increment/decrement of relation ref count and mismatched heap_open/close (which amounts to the same thing). A bogus ref count on a relation doesn't matter much *unless* a SI Inval message happens to arrive at the wrong time, which is probably why we got away with this sloppiness for so long. Repair missing grab of AccessExclusiveLock in DROP TABLE, ALTER/RENAME TABLE, etc, as noted by Hiroshi. Recommend 'make clean all' after pulling this update; I modified the Relation struct layout slightly. Will post further discussion to pghackers list shortly.
* Eliminate query length limitation imposed by pg_client_to_serverTom Lane1999-09-111-27/+49
| | | | | and pg_server_to_client. Eliminate copy.c's restriction on the length of a single attribute.
* Eliminate elog()'s hardwired limit on length of an error message.Tom Lane1999-09-112-93/+234
| | | | | | | | | This change seems necessary in conjunction with long queries, and it cleans up some bogosity in connection with long EXPLAIN texts anyway. Note that current libpq will accept any length error message (at least until it runs out of memory); prior versions have a limit of 8K, but will cleanly discard excess error text, so there shouldn't be any big compatibility problems with old clients.
* Repair incorrect cleanup of heap memory allocation duringTom Lane1999-09-091-3/+2
| | | | | | transaction abort --- before it only worked if there was exactly one level of allocation context stacked in the blank portal. Now it does the right thing for any depth, including zero...
* Repair error noticed by Roberto Cornacchia: selectivity codeTom Lane1999-09-092-10/+32
| | | | | | | | was rejecting negative attnums as bogus, which of course they are not. Add code to get_attdisbursion to produce a useful value for OID attribute, since VACUUM does not store stats for system attributes. Also, repair bug that's been in eqjoinsel for a long time: it was taking the max of the two columns' disbursions, whereas it should use the min.
* Repair logic error in LIKE: should not return LIKE_ABORTTom Lane1999-09-071-41/+50
| | | | when reach end of pattern before end of text. Improve code comments.
* Fix relcache.c so that local relations (those created duringTom Lane1999-09-061-10/+21
| | | | | | | current transaction) are not flushed by shared-cache-inval reset message. SI reset actually works now, for probably the first time in a long time. I was able to run initdb and regression tests with a 16-element SI message array, with a lot of NOTICE: cache state reset messages but no crashes.
* RelationCacheInvalidate thought there were 7 nailed-in-cacheTom Lane1999-09-061-11/+18
| | | | | system tables, but actually there are only 6 --- see RelationInitialize. Kinda makes you wonder how long ago this code was last executed...
* remove elogs used for debugging.Bruce Momjian1999-09-041-9/+1
|
* Intercept temp table lookups further up to map temp names.Bruce Momjian1999-09-042-2/+21
|
* In RelationNameGetRelation(), replace temp table name byTom Lane1999-09-041-21/+12
| | | | | | real name before doing lookup. We only want to index temp tables by their real names in the relcache, to ensure there's not more than one relcache entry for them.
* Avoid transaction overhead when there are no temp tablesTom Lane1999-09-041-1/+5
| | | | to be deleted.
* Invalidate temp entries for aborted transactions.Bruce Momjian1999-09-041-15/+65
|
* Modify RelationFlushRelation so that if the relcache entryTom Lane1999-09-041-49/+118
| | | | | | | | | | | has positive refcount, it is rebuilt from pg_class data. This ensures that relcache entries will track changes made by other backends. Formerly, a shared inval report would just be ignored if it happened to arrive while the relcache entry was in use. Also, fix relcache to reset ref counts to zero during transaction abort. Finally, change LockRelation() so that it checks for shared inval reports after obtaining the lock. In this way, once any kind of lock has been obtained on a rel, we can trust the relcache entry to be up-to-date.
* Rule deparser didn't handle unary operators correctly.Tom Lane1999-09-021-22/+74
|
* Repair a bunch of problems in md.c. This builds on Hiroshi'sTom Lane1999-09-021-13/+6
| | | | | | | | | | | | | | | | | | | insight that RelationFlushRelation ought to invoke smgrclose, and that the way to make that work is to ensure that mdclose doesn't fail if the relation is already closed (or unlinked, if we are looking at a DROP TABLE). While I was testing that, I was able to identify several problems that we had with multiple-segment relations. The system is now able to do initdb and pass the regression tests with a very small segment size (I had it set to 64Kb per segment for testing). I don't believe that ever worked before. File descriptor leaks seem to be gone too. I have partially addressed the concerns we had about mdtruncate(), too. On a Win32 or NFS filesystem it is not possible to unlink a file that another backend is holding open, so what md.c now does is to truncate unwanted files to zero length before trying to unlink them. The other backends will be forced to close their open files by relation cache invalidation --- but I think it would take considerable work to make that happen before vacuum truncates the relation rather than after. Leaving zero-length files lying around seems a usable compromise.
* Fix several problems in rule deparsing: didn't handle arrayTom Lane1999-08-281-200/+199
| | | | | | | references or CASE expressions, didn't parenthesize complex expressions properly. Also, always output variable references as fully qualified names to eliminate ambiguity bug recently reported. (This could be smarter, but reliability comes first.)
* Revise implementation of SubLinks so that there is a consistent,Tom Lane1999-08-251-8/+9
| | | | | | | | | documented intepretation of the lefthand and oper fields. Fix a number of obscure problems while at it --- for example, the old code failed if the parser decided to insert a type-coercion function just below the operator of a SubLink. CAUTION: this will break stored rules that contain subplans. You may need to initdb.
* Alter AllocSet routines so that requests larger thanTom Lane1999-08-241-40/+133
| | | | | | | | | | ALLOC_BIGCHUNK_LIMIT are always allocated as separate malloc() blocks, and are free()d immediately upon pfree(). Also, if such a chunk is enlarged with repalloc(), translate the operation into a realloc() so as to minimize memory usage. Of course, these large chunks still get freed automatically if the alloc set is reset. I have set ALLOC_BIGCHUNK_LIMIT at 64K for now, but perhaps another size would be better?
* Major revision of sort-node handling: push knowledge of queryTom Lane1999-08-211-17/+6
| | | | | | | | | | | | | sort order down into planner, instead of handling it only at the very top level of the planner. This fixes many things. An explicit sort is now avoided if there is a cheaper alternative (typically an indexscan) not only for ORDER BY, but also for the internal sort of GROUP BY. It works even when there is no other reason (such as a WHERE condition) to consider the indexscan. It works for indexes on functions. It works for indexes on functions, backwards. It's just so cool... CAUTION: I have changed the representation of SortClause nodes, therefore THIS UPDATE BREAKS STORED RULES. You will need to initdb.
* Cleanups for int8: guard against null inputs in comparisonTom Lane1999-08-211-19/+87
| | | | | operators (and some other places), fix rangechecks in int8 to int4 conversion (same problem we recently figured out in pg_atoi).
* Ooops ... I had left some test coding in selfuncs.c thatTom Lane1999-08-211-6/+16
| | | | failed on 'field < textconstant' ...