aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/relcache.c
Commit message (Collapse)AuthorAge
...
* I neglected to remove a debug message,sorry.Hiroshi Inoue2001-01-04
|
* Clean up non-reentrant interface for hash_seq/HashTableWalk, so thatTom Lane2001-01-02
| | | | | | | | starting a new hashtable search no longer clobbers any other search active anywhere in the system. Fix RelationCacheInvalidate() so that it will not crash or go into an infinite loop if invoked recursively, as for example by a second SI Reset message arriving while we are still processing a prior one.
* Small cleanup of temp-table handling. Disallow creation of a non-tempTom Lane2000-12-22
| | | | | | | table that inherits from a temp table. Make sure the right things happen if one creates a temp table, creates another temp that inherits from it, then renames the first one. (Previously, system would end up trying to delete the temp tables in the wrong order.)
* Suppress compiler warnings.Tom Lane2000-12-09
|
* REINDEX under WAL.Hiroshi Inoue2000-12-08
|
* Remove VARLENA_FIXED_SIZE hack, which is irreversibly broken now thatTom Lane2000-11-30
| | | | | | | | both MULTIBYTE and TOAST prevent char(n) from being truly fixed-size. Simplify and speed up fastgetattr() and index_getattr() macros by eliminating special cases for attnum=1. It's just as fast to handle the first attribute by presetting its attcacheoff to zero; so do that instead when loading the tupledesc in relcache.c.
* No more #ifdef XLOG.Vadim B. Mikheev2000-11-30
|
* Clean up syscache so that recursive invocation is safe, and remove errorTom Lane2000-11-10
| | | | | | | | message about recursive use of a syscache. Also remove most of the specialized indexscan routines in indexing.c --- it turns out that catcache.c is perfectly able to perform the indexscan for itself, in fact has already looked up all the information needed to do so! This should be faster as well as needing far less boilerplate code.
* Make DROP TABLE rollback-able: postpone physical file delete until commit.Tom Lane2000-11-08
| | | | | | | | | (WAL logging for this is not done yet, however.) Clean up a number of really crufty things that are no longer needed now that DROP behaves nicely. Make temp table mapper do the right things when drop or rename affecting a temp table is rolled back. Also, remove "relation modified while in use" error check, in favor of locking tables at first reference and holding that lock throughout the statement.
* WALVadim B. Mikheev2000-10-28
|
* New relcache hash table with RelFileNode as key to be usedVadim B. Mikheev2000-10-23
| | | | | | | from bufmgr - it would be nice to have separate hash in smgr for node <--> fd mappings, but for the moment it's easy to add new hash to relcache. Fixed small bug in xlog.c:ReadRecord.
* New file naming. Database OID is used as "tablespace" id andVadim B. Mikheev2000-10-16
| | | | | relation OID is used as file node on creation but may be changed later if required. Regression Tests Approved (c) -:)))
* This patch implements a different "relkind"Bruce Momjian2000-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for views. Views are now have a "relkind" of RELKIND_VIEW instead of RELKIND_RELATION. Also, views no longer have actual heap storage files. The following changes were made 1. CREATE VIEW sets the new relkind 2. The executor complains if a DELETE or INSERT references a view. 3. DROP RULE complains if an attempt is made to delete a view SELECT rule. 4. CREATE RULE "_RETmytable" AS ON SELECT TO mytable DO INSTEAD ... 1. checks to make sure mytable is empty. 2. sets the relkind to RELKIND_VIEW. 3. deletes the heap storage files. 5. LOCK myview is not allowed. :) 6. the regression test type_sanity was changed to account for the new relkind value. 7. CREATE INDEX ON myview ... is not allowed. 8. VACUUM myview is not allowed. VACUUM automatically skips views when do the entire database. 9. TRUNCATE myview is not allowed. THINGS LEFT TO THINK ABOUT o pg_views o pg_dump o pgsql (\d \dv) o Do we really want to be able to inherit from views? o Is 'DROP TABLE myview' OK? -- Mark Hollomon
* Improve the following.Hiroshi Inoue2000-08-30
| | | | | | | | | | | | | | | | | | | | | =# create table t (id int4 unique); NOTICE: CREATE TABLE/UNIQUE will create implicit index 't_id_key' for table 't' =# begin; query: drop table t; NOTICE: Caution: DROP TABLE cannot be rolled back, so don't abort now NOTICE: Caution: DROP INDEX cannot be rolled back, so don't abort now =# rollback; =# drop table t; NOTICE: mdopen: couldn't open t: No such file or directory NOTICE: RelationIdBuildRelation: smgropen(t): No such file or directory NOTICE: mdopen: couldn't open t: No such file or directory NOTICE: mdopen: couldn't open t: No such file or directory NOTICE: mdopen: couldn't open t_id_key: No such file or directory NOTICE: RelationIdBuildRelation: smgropen(t_id_key): No such file or directory NOTICE: mdopen: couldn't open t: No such file or directory NOTICE: RelationIdBuildRelation: smgropen(t): No such file or directory NOTICE: mdopen: couldn't open t: No such file or directory ERROR: cannot open relation t
* Toast all the system-table columns that seem to need it. It turns outTom Lane2000-08-06
| | | | | | | | | | | | | | | | that giving pg_proc a toast table required solving the same problems we'd have to solve for pg_class --- pg_proc is one of the relations that gets bootstrapped in relcache.c. Solution is to go back at the end of initialization and read in the *real* pg_class row to replace the phony entry created by formrdesc(). This should work as long as there's no need to touch any toasted values during initialization, which seems a reasonable assumption. Although I did not add a toast-table for every single system table with a varlena attribute, I believe that it would work to just do ALTER TABLE pg_class CREATE TOAST TABLE. So anyone who's really intent on having several thousand ACL entries for a rel could do it. NOTE: I didn't force initdb, but you must do one to see the effects of this patch.
* Type lztext is toast.Tom Lane2000-07-30
| | | | | | | (Sorry, couldn't help it...) Removed type filename as well, since it's unused and probably useless. INITDB FORCED, because pg_rewrite columns are now plain text again.
* Cleanup of code for creating index entries. Functional indexes withTom Lane2000-07-14
| | | | | | | | | | | | | pass-by-ref data types --- eg, an index on lower(textfield) --- no longer leak memory during index creation or update. Clean up a lot of redundant code ... did you know that copy, vacuum, truncate, reindex, extend index, and bootstrap each basically duplicated the main executor's logic for extracting information about an index and preparing index entries? Functional indexes should be a little faster now too, due to removal of repeated function lookups. CREATE INDEX 'opt_type' clause is deimplemented by these changes, but I haven't removed it from the parser yet (need to merge with Thomas' latest change set first).
* Update textin() and textout() to new fmgr style. This is just phaseTom Lane2000-07-05
| | | | | one of updating the whole text datatype, but there are so dang many calls of these two routines that it seems worth a separate commit.
* Use a private memory context to store rule information in each relcacheTom Lane2000-06-30
| | | | | | | | | | | | | | entry that has rules. This allows us to release the rule parsetrees on relcache flush without needing a working freeObject() routine. Formerly, the rule trees were leaked permanently at relcache flush. Also, clean up handling of rule creation and deletion --- there was not sufficient locking of the relation being modified, and there was no reliable notification of other backends that a relcache reload was needed. Also, clean up relcache.c code so that scans of system tables needed to load a relcache entry are done in the caller's memory context, not in CacheMemoryContext. This prevents any un-pfreed memory from those scans from becoming a permanent memory leak.
* First phase of memory management rewrite (see backend/utils/mmgr/READMETom Lane2000-06-28
| | | | | | | | | | | | | for details). It doesn't really do that much yet, since there are no short-term memory contexts in the executor, but the infrastructure is in place and long-term contexts are handled reasonably. A few long- standing bugs have been fixed, such as 'VACUUM; anything' in a single query string crashing. Also, out-of-memory is now considered a recoverable ERROR, not FATAL. Eliminate a large amount of crufty, now-dead code in and around memory management. Fix problem with holding off SIGTRAP, SIGSEGV, etc in postmaster and backend startup.
* Modify index-opening code to guarantee that the indexes of a relationTom Lane2000-06-19
| | | | | | | are opened in a consistent order by different backends (I ordered them by index OID because that's easy, but any other consistent order would do as well). This avoids potential deadlock for index types that we acquire exclusive locks on ... ie, rtree.
* Reimplement nodeMaterial to use a temporary BufFile (or even memory, if theTom Lane2000-06-18
| | | | | | | | | | materialized tupleset is small enough) instead of a temporary relation. This was something I was thinking of doing anyway for performance, and Jan says he needs it for TOAST because he doesn't want to cope with toasting noname relations. With this change, the 'noname table' support in heap.c is dead code, and I have accordingly removed it. Also clean up 'noname' plan handling in planner --- nonames are either sort or materialize plans, and it seems less confusing to handle them separately under those names.
* Fix performance problems with pg_index lookups (see, for example,Tom Lane2000-06-17
| | | | | | | | | | discussion of 5/19/00). pg_index is now searched for indexes of a relation using an indexscan. Moreover, this is done once and cached in the relcache entry for the relation, in the form of a list of OIDs for the indexes. This list is used by the parser and executor to drive lookups in the pg_index syscache when they want to know the properties of the indexes. Net result: index information will be fully cached for repetitive operations such as inserts.
* Clean out another pocket of functions called via nonspecific functionTom Lane2000-06-17
| | | | | | | pointers, namely the catcache tuple fetch routines. Also get rid of the unused and possibly confusing 'size' field in struct cachedesc. Since it doesn't allow for variable-length fields, anyone who actually trusted it would likely be making a mistake...
* Remove NT-specific file open defines by defining our own open macros forBruce Momjian2000-06-02
| | | | "rb" and "wb".
* Remove unused include files. Do not touch /port or includes used by defines.Bruce Momjian2000-05-30
|
* First round of changes for new fmgr interface. fmgr itself and theTom Lane2000-05-28
| | | | | | | key call sites are changed, but most called functions are still oldstyle. An exception is that the PL managers are updated (so, for example, NULL handling now behaves as expected in plperl and plpgsql functions). NOTE initdb is forced due to added column in pg_proc.
* Repair memory leaks that caused CacheCxt to grow without bound. WeTom Lane2000-05-21
| | | | | | | | | really ought to fix relcache entry construction so that it does not do so much with CurrentMemoryContext = CacheCxt. As is, relatively harmless leaks in either sequential or index scanning translate to permanent leaks if they occur when called from relcache build. For the moment, however, the path of least resistance is to repair all such leaks...
* Ye-old pgindent run. Same 4-space tabs.Bruce Momjian2000-04-12
|
* Fix low-probability bug in relcache startup: write_irels wrote theTom Lane2000-03-31
| | | | | | | | | | pg_internal.init file in-place, which meant that if another backend started at about the same time, it might read the incomplete file. init_irels tries to guard against that, but I have now seen a crash due to reading bad data from a partly-written file. (This may indicate a kernel bug on my platform? Not sure.) Anyway, clearly the safest course is to write the new pg_internal.init file under a unique temporary filename, and rename it into place only after it's all written.
* Fix a bunch of minor portability problems and maybe-bugs revealed byTom Lane2000-03-17
| | | | | | running gcc and HP's cc with warnings cranked way up. Signed vs unsigned comparisons, routines declared static and then defined not-static, that kind of thing. Tedious, but perhaps useful...
* Trial implementation of ALTER DROP COLUMN.Hiroshi Inoue2000-03-09
| | | | | | They are #ifdef'd. Add -D_DROP_COLUMN_HACK__ compile option to evaluate it.
* Reactivated LZTEXT data type and changed rule plan- and qual-stringsJan Wieck2000-02-27
| | | | | | into lztext. Jan
* Implement reindex commandHiroshi Inoue2000-02-18
|
* Fix problems seen in parallel regress tests when SI buffer overruns (causingTom Lane2000-01-31
| | | | | | | | | | | | | | | | | | | | | | | syscache and relcache flushes). Relcache entry rebuild now preserves original tupledesc, rewrite rules, and triggers if possible, so that pointers to these things remain valid --- if these things change while relcache entry has positive refcount, we elog(ERROR) to avoid later crash. Arrange for xact-local rels to be rebuilt when an SI inval message is seen for them, so that they are updated by CommandCounterIncrement the same as regular rels. (This is useful because of Hiroshi's recent changes to process our own SI messages at CommandCounterIncrement time.) This allows simplification of some routines that previously hacked around the lack of an automatic update. catcache now keeps its own copy of tupledesc for its relation, rather than depending on the relcache's copy; this avoids needing to reinitialize catcache during a cache flush, which saves some cycles and eliminates nasty circularity problems that occur if a cache flush happens while trying to initialize a catcache. Eliminate a number of permanent memory leaks that used to happen during catcache or relcache flush; not least of which was that catcache never freed any cached tuples! (Rule parsetree storage is still leaked, however; will fix that separately.) Nothing done yet about code that uses tuples retrieved by SearchSysCache for longer than is safe.
* Modify uses of RelationFlushRelation and RelationCacheInvalidate so thatTom Lane2000-01-29
| | | | | | we *always* rebuild, rather than deleting, an invalidated relcache entry that has positive refcount. Otherwise an SI cache overrun leads to dangling Relation pointers all over the place!
* Add:Bruce Momjian2000-01-26
| | | | | | * Portions Copyright (c) 1996-2000, PostgreSQL, Inc to all files copyright Regents of Berkeley. Man, that's a lot of files.
* added ALTER TABLE DROP COLUMN, early versionPeter Eisentraut2000-01-22
|
* Fixed all elog related warnings, as well as a few others.Peter Eisentraut2000-01-15
|
* Repair bugs discussed in pghackers thread of 15 May 1999: creation of aTom Lane1999-12-30
| | | | | | relcache entry no longer leaks a small amount of memory. index_endscan now releases all the memory acquired by index_beginscan, so callers of it should NOT pfree the scan descriptor anymore.
* Removed LZTEXT datatype as discussed.Jan Wieck1999-12-28
| | | | Jan
* Some changes to prepare for LONG attributes.Jan Wieck1999-12-16
| | | | Jan
* Add system indexes to match all caches.Bruce Momjian1999-11-22
| | | | | | | Make all system indexes unique. Make all cache loads use system indexes. Rename *rel to *relid in inheritance tables. Rename cache names to be clearer.
* Repair problem exposed by Jan's new parallel-regression-test scaffold:Tom Lane1999-11-21
| | | | | | | inval.c thought it could safely use the catcache to look up the OIDs of system relations. Not good, considering that inval.c could be called during catcache loading, if a shared-inval message arrives. Rip out the lookup logic and instead use the known OIDs from pg_class.h.
* Changed pg_rewrite attributes ev_qual and ev_action to the newJan Wieck1999-11-18
| | | | | | compressed lztext data type. Jan
* Fix problem with temp tables shown in regression test by Jan.Bruce Momjian1999-11-17
|
* Commit to make clearer distinction for temp names and real names.Bruce Momjian1999-11-16
| | | | Thanks to Tom Lane for ideas.
* New NameStr macro to convert Name to Str. No need for var.data anymore.Bruce Momjian1999-11-07
| | | | | | Fewer calls to nameout. Better use of RelationGetRelationName.
* Make it possible to execute crashed CREATE/DROP commands again.Hiroshi Inoue1999-11-04
| | | | | | | | | | Now indexes of pg_class and pg_type are unique indexes and guarantee the uniqueness of correponding attributes. heap_create() was changed to take another boolean parameter which allows to postpone the creation of disk file. The name of rd_nonameunlinked was changed to rd_unlinked. It is used generally(not only for noname relations) now. Requires initdb.
* Reimplement parsing and storage of default expressions and constraintTom Lane1999-10-03
| | | | | | | | | | | | | | | 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.