Bruce Momjian [Fri, 26 Aug 2005 19:32:43 +0000 (19:32 +0000)]
Update based on user comments:
< in PL/PgSQL is to use EXECUTE.
> in PL/PgSQL is to use EXECUTE. One complexity is that a function
> might itself drop and recreate dependent tables, causing it to
> invalidate its own query plan.
Bruce Momjian [Fri, 26 Aug 2005 19:10:48 +0000 (19:10 +0000)]
Update constraint_exclusion items:
< inheritance, and allow it to work for UPDATE and DELETE queries
> inheritance, allow it to work for UPDATE and DELETE queries, and allow
> it to be used for all queries with little performance impact
< * Allow constraint_elimination to be automatically performed
<
< This requires additional code to reduce the performance loss caused by
< constraint elimination.
Bruce Momjian [Fri, 26 Aug 2005 18:59:48 +0000 (18:59 +0000)]
Remove completed items:
< * -Allow limits on per-db/role connections
43d41
< * -Prevent dropping user that still owns objects, or auto-drop the objects
49d46
< * -Add the client IP address and port to pg_stat_activity
< * -Add session start time and last statement time to pg_stat_activity
< * -Add a function that returns the start time of the postmaster 230d224
< o -Allow MIN()/MAX() on arrays
< o -Modify array literal representation to handle array index lower bound
< of other than one 253d244
< * -Add function to return compressed length of TOAST data values
< * -Prevent to_char() on interval from returning meaningless values
<
< For example, to_char('1 month', 'mon') is meaningless. Basically,
< most date-related parameters to to_char() are meaningless for
< intervals because interval is not anchored to a date.
<
< * -Have views on temporary tables exist in the temporary namespace
< * -Allow temporary views on non-temporary tables 329d311
< * -Add BETWEEN SYMMETRIC/ASYMMETRIC
< * -Add E'' escape string marker so eventually ordinary strings can treat
< backslashes literally, for portability
<
< * -Allow additional tables to be specified in DELETE for joins
<
< UPDATE already allows this (UPDATE...FROM) but we need similar
< functionality in DELETE. It's been agreed that the keyword should
< be USING, to avoid anything as confusing as DELETE FROM a FROM b.
< 341d313
< * -Allow REINDEX to rebuild all database indexes
< * -Add an option to automatically use savepoints for each statement in a
< multi-statement transaction.
<
< When enabled, this would allow errors in multi-statement transactions
< to be automatically ignored.
< 426d391
< o -Allow FOR UPDATE queries to do NOWAIT locks 473d437
< o -Allow COPY to understand \x as a hex byte
< o -Allow COPY to optionally include column headings in the first line
< o -Allow COPY FROM ... CSV to interpret newlines and carriage
< returns in data 525d485
< o -Have SHOW ALL show descriptions for server-side variables
< o -Allow PL/PgSQL's RAISE function to take expressions
<
< Currently only constants are supported.
<
< o -Change PL/PgSQL to use palloc() instead of malloc() 545d499
< o -Allow PL/pgSQL EXECUTE query_var INTO record_var; 550d503
< o -Pass arrays natively instead of as text between plperl and postgres 598d550
< o -Add dumping and restoring of LOB comments 638d589
< * -Implement shared row locks and use them in RI triggers 642d592
< * -Allow triggers to be disabled
< * -Add two-phase commit
<
<
< * -Prevent inherited tables from expanding temporary subtables of other
< sessions
< * -Use indexes for MIN() and MAX()
<
< MIN/MAX queries can already be rewritten as SELECT col FROM tab ORDER
< BY col {DESC} LIMIT 1. Completing this item involves doing this
< transformation automatically.
<
< * -Use index to restrict rows returned by multi-key index when used with
< non-consecutive keys to reduce heap accesses
<
< For an index on col1,col2,col3, and a WHERE clause of col1 = 5 and
< col3 = 9, spin though the index checking for col1 and col3 matches,
< rather than just col1; also called skip-scanning.
<
< * -Fetch heap pages matching index entries in sequential order
<
< Rather than randomly accessing heap pages based on index entries, mark
< heap pages needing access in a bitmap and do the lookups in sequential
< order. Another method would be to sort heap ctids matching the index
< before accessing the heap rows.
<
< * -Allow non-bitmap indexes to be combined by creating bitmaps in memory
<
< This feature allows separate indexes to be ANDed or ORed together. This
< is particularly useful for data warehousing applications that need to
< query the database in an many permutations. This feature scans an index
< and creates an in-memory bitmap, and allows that bitmap to be combined
< with other bitmap created in a similar way. The bitmap can either index
< all TIDs, or be lossy, meaning it records just page numbers and each
< page tuple has to be checked for validity in a separate pass.
<
< * -Fix incorrect rtree results due to wrong assumptions about "over"
< operator semantics 782d694
< o -Add concurrency to GIST 813d724
< * -Allow multiple blocks to be written to WAL with one write()
< * -Consider use of open/fcntl(O_DIRECT) to minimize OS caching,
< for WAL writes
<
< O_DIRECT doesn't have the same media write guarantees as fsync, so it
< is in addition to the fsync method, not in place of it.
<
< * -Cache last known per-tuple offsets to speed long tuple access
< * -Allow the size of the buffer cache used by temporary objects to be
< specified as a GUC variable
<
< Larger local buffer cache sizes requires more efficient handling of
< local cache lookups.
<
< * -Improve the background writer
<
< Allow the background writer to more efficiently write dirty buffers
< from the end of the LRU cache and use a clock sweep algorithm to
< write other dirty buffers to reduced checkpoint I/O
< 897d788
< * -Add a warning when the free space map is too small 917d807
< o -Move into the backend code
< * -Make locking of shared data structures more fine-grained
<
< This requires that more locks be acquired but this would reduce lock
< contention, improving concurrency.
<
< * -Improve SMP performance on i386 machines
<
< i386-based SMP machines can generate excessive context switching
< caused by lock failure in high concurrency situations. This may be
< caused by CPU cache line invalidation inefficiencies.
< 979d857
< o -Add ability to turn off full page writes
< * -Eliminate WAL logging for CREATE TABLE AS when not doing WAL archiving
< * -Change WAL to use 32-bit CRC, for performance reasons
<
< * -Use CHECK constraints to influence optimizer decisions
<
< CHECK constraints contain information about the distribution of values
< within the table. This is also useful for implementing subtables where
< a tables content is distributed across several subtables.
< 1045d913
< * -ANALYZE should record a pg_statistic entry for an all-NULL column 1099d966
< * -Remove kerberos4 from source tree 1103d969
< * -Make src/port/snprintf.c thread-safe 1118d983
< * -Add C code on Unix to copy directories for use in creating new databases 1133d997
< o -Improve dlerror() reporting string
Bruce Momjian [Fri, 26 Aug 2005 18:52:44 +0000 (18:52 +0000)]
Great TODO updates from Tom:
< Currently SIGTERM of a backend can lead to lock table corruption.
> Lock table corruption following SIGTERM of an individual backend
> has been reported in 8.0. A possible cause was fixed in 8.1, but
> it is unknown whether other problems exist. This item mostly
> requires additional testing rather than of writing any new code.
< o Allow postgresql.conf values to be set so they can not be changed
< by the user 166c167,171
< * %Remove Money type, add money formatting for decimal type
> * Improve the MONEY data type
>
> Change the MONEY data type to use DECIMAL internally, with special
> locale-aware output formatting.
> 225c230
< o %Allow MIN()/MAX() on arrays
> o -Allow MIN()/MAX() on arrays 228c233
< o Modify array literal representation to handle array index lower bound
> o -Modify array literal representation to handle array index lower bound 235a241
> o Auto-delete large objects when referencing row is deleted
< Currently large objects entries do not have owners. Permissions can
< only be set at the pg_largeobject table level.
> /contrib/lo offers this functionality. 240d244
< o Auto-delete large objects when referencing row is deleted
< * %Have views on temporary tables exist in the temporary namespace
< * Allow temporary views on non-temporary tables
< * %Allow RULE recompilation
> * -Have views on temporary tables exist in the temporary namespace
> * -Allow temporary views on non-temporary tables
> * Allow VIEW/RULE recompilation when the underlying tables change 340a345,347
>
> This is like DELETE CASCADE, but truncates.
> 381c388
< * Make row-wise comparisons work per SQL spec
> * %Make row-wise comparisons work per SQL spec
< o Currently the system uses the operating system COPY command to
< create a new database. Add ON COMMIT capability to CREATE TABLE AS
< SELECT
> o Add ON COMMIT capability to CREATE TABLE AS ... SELECT 427c432
< o %Add ALTER DOMAIN TYPE
> o Add ALTER DOMAIN to modify the underlying data type
< o %Disallow dropping of an inherited constraint
< o -Allow objects to be moved to different schemas
> o Add missing object types for ALTER ... SET SCHEMA
< o %Prevent child tables from altering constraints like CHECK that were
< inherited from the parent table
> o %Disallow dropping of an inherited constraint
> o %Prevent child tables from altering or dropping constraints
> like CHECK that were inherited from the parent table
< o Handle references to temporary tables that are created, destroyed,
< then recreated during a session, and EXECUTE is not used
<
< This requires the cached PL/PgSQL byte code to be invalidated when
< an object referenced in the function is changed.
<
< o Add table function support to pltcl, plperl, plpython?
< o Allow PL/pgSQL to name columns by ordinal position, e.g. rec.(3)
> o Add table function support to pltcl, plpython 549a548
> o Allow function argument names to be queries from PL/PgSQL
< o Pass arrays natively instead of as text between plperl and postgres
< o Add support for polymorphic arguments and return types to plperl
> o -Pass arrays natively instead of as text between plperl and postgres
> o Add support for polymorphic arguments and return types to
> languages other than PL/PgSQL
> o Add support for OUT and INOUT parameters to languages other
> than PL/PgSQL
< * Allow libpq to access SQLSTATE so pg_ctl can test for connection failure
<
< This would be used for checking if the server is up.
< 565c563
< * Have initdb set DateStyle based on locale?
> * Have initdb set the input DateStyle (MDY or DMY) based on locale? 567d564
< * Add a schema option to createlang
< o Add pg_dumpall custom format dumps.
<
< This is probably best done by combining pg_dump and pg_dumpall
< into a single binary.
<
> o Add pg_dumpall custom format dumps? 612c605,606
< o Remove unnecessary abstractions in pg_dump source code
> o Remove unnecessary function pointer abstractions in pg_dump source
> code
< * %Remove CREATE CONSTRAINT TRIGGER
<
< This was used in older releases to dump referential integrity
< constraints.
< 682a672,675
> This is particularly important for references to temporary tables
> in PL/PgSQL because PL/PgSQL caches query plans. The only workaround
> in PL/PgSQL is to use EXECUTE.
> 748c741
< * Fetch heap pages matching index entries in sequential order
> * -Fetch heap pages matching index entries in sequential order 797c790
< Currently no only one hash bucket can be stored on a page. Ideally
> Currently only one hash bucket can be stored on a page. Ideally 806a800,802
> o Add WAL logging for crash recovery
> o Allow multi-column hash indexes
> 812a809,812
>
> Ideally this requires a separate test program that can be run
> at initdb time or optionally later.
> 867c867
< * Improve the background writer
> * -Improve the background writer
< For large table adjustements during vacuum, it is faster to reindex
< rather than update the index.
> For large table adjustements during VACUUM FULL, it is faster to
> reindex rather than update the index.
< * Reduce lock time by moving tuples with read lock, then write
< lock and truncate table
> * Reduce lock time during VACUUM FULL by moving tuples with read lock,
> then write lock and truncate table 919c919,920
< o %Suggest VACUUM FULL if a table is nearly empty
> o %Issue log message to suggest VACUUM FULL if a table is nearly
> empty? 995d995
< * Add WAL index reliability improvement to non-btree indexes 1045c1045
< * ANALYZE should record a pg_statistic entry for an all-NULL column
> * -ANALYZE should record a pg_statistic entry for an all-NULL column 1047a1048,1051
> * Allow constraint_elimination to be automatically performed
>
> This requires additional code to reduce the performance loss caused by
> constraint elimination. 1090c1094
< * Remove memory/file descriptor freeing before ereport(ERROR)
> * %Remove memory/file descriptor freeing before ereport(ERROR)
< * Promote debug_query_string into a server-side function current_query()
< * Allow the identifier length to be increased via a configure option
> * %Promote debug_query_string into a server-side function current_query()
> * %Allow the identifier length to be increased via a configure option 1113d1116
< * Fix cross-compiling of time zone database via 'zic' 1130c1133
< o Improve dlerror() reporting string
> o -Improve dlerror() reporting string 1132c1135
< o Add support for Unicode
> o %Add support for Unicode
Tom Lane [Fri, 26 Aug 2005 03:08:15 +0000 (03:08 +0000)]
Arrange for indexes and toast tables to inherit their ownership from
the parent table, even if the command that creates them is executed by
someone else (such as a superuser or a member of the owning role).
Per gripe from Michael Fuhr.
Tom Lane [Thu, 25 Aug 2005 05:01:43 +0000 (05:01 +0000)]
Factor out the common subexpression month_remainder * DAYS_PER_MONTH
in interval_mul and interval_div. This avoids an optimization bug
in A Certain Company's compiler (and given their explanation, I wouldn't
be surprised if other compilers blow it too). Besides the code seems
more clear this way --- in the original formulation, you had to mentally
recognize the common subexpression in order to understand what was going
on.
Tom Lane [Thu, 25 Aug 2005 02:22:59 +0000 (02:22 +0000)]
Original assumption that our own getaddrinfo routine would never support
IPv6 is obsoleted by recent Windows patch. Perform the runtime test
whenever HAVE_IPV6 is set. This should be OK since initdb can get
getaddrinfo from libpgport if needed.
Tom Lane [Wed, 24 Aug 2005 22:13:23 +0000 (22:13 +0000)]
Add code to use Windows getaddrinfo and friends if they exist. This
has to be tested dynamically if we want to make portable executables.
Chuck McDevitt and Andrew Dunstan.
Tom Lane [Wed, 24 Aug 2005 20:20:38 +0000 (20:20 +0000)]
Back off allow_nonpic_in_shlib for FreeBSD builds: only set it on i386.
This might be overly conservative, but we know it does not work on amd64.
Per buildfarm results.
Bruce Momjian [Wed, 24 Aug 2005 19:43:26 +0000 (19:43 +0000)]
Update:
< Currently, if a variable is commented out, it keeps the
< previous uncommented value until a server restarted.
> Currently, if a variable is commented out, it keeps the
> previous uncommented value until a server restarted.
> Logically, a reload should set the same values as a
> server restart.
Tom Lane [Wed, 24 Aug 2005 18:16:58 +0000 (18:16 +0000)]
Fix up plperl 'use_strict' so that it can be enabled or disabled on the
fly. Fix problem with incompletely duplicated setup code. Andrew Dunstan,
from an idea of Michael Fuhr's.
Tom Lane [Wed, 24 Aug 2005 17:50:00 +0000 (17:50 +0000)]
Add small hack to support use of Unicode-based locales on WIN32. This
is not adequately tested yet, but let's get it into beta1 so it can be
tested. Magnus Hagander and Tom Lane.
Tom Lane [Wed, 24 Aug 2005 17:38:35 +0000 (17:38 +0000)]
Fix ExecBRDeleteTriggers so that deletion is not suppressed when delete
triggers exist but are all disabled. Problem noted by Gavin Sherry in
original discussion of enable/disable trigger patch, but was never
addressed.
Michael Meskes [Wed, 24 Aug 2005 10:34:19 +0000 (10:34 +0000)]
- Check for NULL before checking whether argument is an array.
- Remove stary character from string quoting.
- Fixed check to report missing varchar pointer implementation.
Bruce Momjian [Tue, 23 Aug 2005 23:51:18 +0000 (23:51 +0000)]
Mark item as complete, add another:
< * Allow triggers to be disabled [trigger]
> * -Allow triggers to be disabled [trigger]
> * Allow triggers to be disabled in only the current session.
< Currently the only way to disable triggers is to modify the system
< tables.
> This is currently possible by starting a multi-statement transaction,
> modifying the system tables, performing the desired SQL, restoring the
> system tables, and committing the transaction. ALTER TABLE ...
> TRIGGER requires a table lock so it is not idea for this usage.
Tom Lane [Tue, 23 Aug 2005 22:40:47 +0000 (22:40 +0000)]
Add ALTER TABLE ENABLE/DISABLE TRIGGER commands. Change pg_dump to
use these instead of its previous hack of changing pg_class.reltriggers.
Documentation is lacking, will add that later.
Patch by Satoshi Nagayasu, review and some extra work by Tom Lane.
Bruce Momjian [Tue, 23 Aug 2005 21:02:05 +0000 (21:02 +0000)]
The attached patch updates the thread test program to run stand-alone on
Windows. The test itself is bypassed in configure as discussed, and
libpq has been updated appropriately to allow it to build in thread-safe
mode.
Tom Lane [Tue, 23 Aug 2005 20:49:47 +0000 (20:49 +0000)]
Clean up some very old and crufty code for TID scan planning. Not much
functional difference really, but make use of stuff added to the planner
since this code was touched last.
Tom Lane [Mon, 22 Aug 2005 23:59:04 +0000 (23:59 +0000)]
Rewrite gather-write patch into something less obviously bolted on
after the fact. Fix bug with incorrect test for whether we are at end
of logfile segment. Arrange for writes triggered by XLogInsert's
is-cache-more-than-half-full test to synchronize with the cache boundaries,
so that in long transactions we tend to write alternating halves of the
cache rather than randomly chosen portions of it; this saves one more
write syscall per cache load.
Tom Lane [Mon, 22 Aug 2005 19:40:37 +0000 (19:40 +0000)]
Cause ALTER INDEX OWNER to generate a warning and do nothing, rather than
erroring out as it has done for the last couple weeks. Document that this
form is now ignored because indexes can't usefully have different owners
from their parent tables. Fix pg_dump to not generate ALTER OWNER commands
for indexes.
Tom Lane [Mon, 22 Aug 2005 17:38:20 +0000 (17:38 +0000)]
Fix unwanted denial of ALTER OWNER rights to superusers. There was some
discussion of getting around this by relaxing the checks made for regular
users, but I'm disinclined to toy with the security model right now,
so just special-case it for superusers where needed.
Bruce Momjian [Mon, 22 Aug 2005 16:59:47 +0000 (16:59 +0000)]
Improve xid wraparound message (the server isn't really shut down, just
not accepting queries).
errmsg("database is not accepting queries to avoid
wraparound data loss in database \"%s\"",
errhint("Stop the postmaster and use a standalone
backend to VACUUM database \"%s\".",
Tom Lane [Mon, 22 Aug 2005 16:27:36 +0000 (16:27 +0000)]
Use an initdb-time test to see if the local version of getaddrinfo()
chokes on IPv6 addresses, and comment out the IPv6 entry in the default
pg_hba.conf if so. Per Andrew Dunstan.
Tom Lane [Mon, 22 Aug 2005 00:41:28 +0000 (00:41 +0000)]
Fix some inconsistent choices of datatypes in xlog.c. Make buffer
indexes all be int, rather than variously int, uint16 and uint32;
add some casts where necessary to support large buffer arrays.
Tom Lane [Sun, 21 Aug 2005 03:39:37 +0000 (03:39 +0000)]
Minor GUC cleanups: document krb_server_hostname and custom_variable_classes
in postgresql.conf.sample, mark custom_variable_classes as SIGHUP not
POSTMASTER to agree with the documentation (I can't see a reason it has
to be POSTMASTER so I think the docs are right).
Tom Lane [Sat, 20 Aug 2005 23:26:37 +0000 (23:26 +0000)]
Convert the arithmetic for shared memory size calculation from 'int'
to 'Size' (that is, size_t), and install overflow detection checks in it.
This allows us to remove the former arbitrary restrictions on NBuffers
etc. It won't make any difference in a 32-bit machine, but in a 64-bit
machine you could theoretically have terabytes of shared buffers.
(How efficiently we could manage 'em remains to be seen.) Similarly,
num_temp_buffers, work_mem, and maintenance_work_mem can be set above
2Gb on a 64-bit machine. Original patch from Koichi Suzuki, additional
work by moi.
Tom Lane [Sat, 20 Aug 2005 19:19:21 +0000 (19:19 +0000)]
Invoke mksafefunc and mkunsafefunc with :: decoration. This seems a good
idea on consistency grounds, whether or not it really fixes bug #1831.
Michael Fuhr
Tom Lane [Sat, 20 Aug 2005 00:40:32 +0000 (00:40 +0000)]
Repair problems with VACUUM destroying t_ctid chains too soon, and with
insufficient paranoia in code that follows t_ctid links. (We must do both
because even with VACUUM doing it properly, the intermediate state with
a dangling t_ctid link is visible concurrently during lazy VACUUM, and
could be seen afterwards if either type of VACUUM crashes partway through.)
Also try to improve documentation about what's going on. Patch is a bit
bulky because passing the XMAX information around required changing the
APIs of some low-level heapam.c routines, but it's not conceptually very
complicated. Per trouble report from Teodor and subsequent analysis.
This needs to be back-patched, but I'll do that after 8.1 beta is out.
Tom Lane [Thu, 18 Aug 2005 17:51:12 +0000 (17:51 +0000)]
Fix up LIMIT/OFFSET planning so that we cope with non-constant LIMIT
or OFFSET clauses by using estimate_expression_value(). The main advantage
of this is that if the expression is a Param and we have a value for the
Param, we'll use that value rather than defaulting. Also, fix some
thinkos in the logic for combining LIMIT/OFFSET with an externally
supplied tuple fraction (this covers cases like EXISTS(...LIMIT...)).
And make sure the results of all this are shown by EXPLAIN. Per a
gripe from Merlin Moncure.
Bruce Momjian [Thu, 18 Aug 2005 04:37:08 +0000 (04:37 +0000)]
Fix to_char(interval) to return proper year and century values.
Fix to_char(interval) to return large year/month/day/hour values that
are larger than possible timestamp values.
Prevent to_char(interval) format specifications that make no sense, like
Month.
Clean up formatting.c code to more logically handle return lengths.