]> granicus.if.org Git - postgresql/blob - doc/TODO
Update:
[postgresql] / doc / TODO
1
2 PostgreSQL TODO List
3 ====================
4 Current maintainer:     Bruce Momjian (pgman@candle.pha.pa.us)
5 Last updated:           Wed Dec  7 12:29:08 EST 2005
6
7 The most recent version of this document can be viewed at
8 http://www.postgresql.org/docs/faqs.TODO.html.
9
10 #A hyphen, "-", marks changes that will appear in the upcoming 8.2 release.#
11 #A percent sign, "%", marks items that are easier to implement.#
12
13 Bracketed items, "[]", have more detail.
14
15 This list contains all known PostgreSQL bugs and feature requests. If
16 you would like to work on an item, please read the Developer's FAQ
17 first.
18
19
20 Administration
21 ==============
22
23 * %Remove behavior of postmaster -o after making postmaster/postgres
24   flags unique
25 * %Allow pooled connections to list all prepared queries
26
27   This would allow an application inheriting a pooled connection to know
28   the queries prepared in the current session.
29
30 * Allow major upgrades without dump/reload, perhaps using pg_upgrade 
31   [pg_upgrade]
32 * Check for unreferenced table files created by transactions that were
33   in-progress when the server terminated abruptly
34 * Allow administrators to safely terminate individual sessions either
35   via an SQL function or SIGTERM 
36
37   Lock table corruption following SIGTERM of an individual backend
38   has been reported in 8.0.  A possible cause was fixed in 8.1, but
39   it is unknown whether other problems exist.  This item mostly
40   requires additional testing rather than of writing any new code.
41
42 * %Set proper permissions on non-system schemas during db creation
43
44   Currently all schemas are owned by the super-user because they are
45   copied from the template1 database.
46
47 * Support table partitioning that allows a single table to be stored
48   in subtables that are partitioned based on the primary key or a WHERE
49   clause
50 * Add function to report the time of the most recent server reload
51 * Add GUC variable to run a command on database panic or
52   smart/fast/immediate shutdown
53
54
55 * Improve replication solutions
56
57         o Load balancing
58
59           You can use any of the master/slave replication servers to use a
60           standby server for data warehousing. To allow read/write queries to
61           multiple servers, you need multi-master replication like pgcluster.
62
63         o Allow replication over unreliable or non-persistent links
64
65
66 * Configuration files
67
68         o %Add "include file" functionality in postgresql.conf
69         o %Allow commenting of variables in postgresql.conf to restore them
70           to defaults
71
72           Currently, if a variable is commented out, it keeps the
73           previous uncommented value until a server restarted.
74
75         o %Allow pg_hba.conf settings to be controlled via SQL
76
77           This would add a function to load the SQL table from
78           pg_hba.conf, and one to writes its contents to the flat file.
79           The table should have a line number that is a float so rows
80           can be inserted between existing rows, e.g. row 2.5 goes
81           between row 2 and row 3.
82
83         o %Allow postgresql.conf file values to be changed via an SQL
84           API, perhaps using SET GLOBAL
85         o Allow the server to be stopped/restarted via an SQL API
86         o Issue a warning if a change-on-restart-only postgresql.conf value
87           is modified  and the server config files are reloaded
88         o Mark change-on-restart-only values in postgresql.conf
89
90
91 * Tablespaces
92
93         * Allow a database in tablespace t1 with tables created in
94           tablespace t2 to be used as a template for a new database created
95           with default tablespace t2
96
97           All objects in the default database tablespace must have default
98           tablespace specifications. This is because new databases are
99           created by copying directories. If you mix default tablespace
100           tables and tablespace-specified tables in the same directory,
101           creating a new database from such a mixed directory would create a
102           new database with tables that had incorrect explicit tablespaces.
103           To fix this would require modifying pg_class in the newly copied
104           database, which we don't currently do.
105
106         * Allow reporting of which objects are in which tablespaces
107
108           This item is difficult because a tablespace can contain objects
109           from multiple databases. There is a server-side function that
110           returns the databases which use a specific tablespace, so this
111           requires a tool that will call that function and connect to each
112           database to find the objects in each database for that tablespace.
113
114         o %Add a GUC variable to control the tablespace for temporary objects
115           and sort files
116
117           It could start with a random tablespace from a supplied list and
118           cycle through the list.
119
120         o Allow WAL replay of CREATE TABLESPACE to work when the directory
121           structure on the recovery computer is different from the original
122
123         o Allow per-tablespace quotas
124
125
126 * Point-In-Time Recovery (PITR)
127
128           o Allow point-in-time recovery to archive partially filled
129             write-ahead logs [pitr]
130
131             Currently only full WAL files are archived. This means that the
132             most recent transactions aren't available for recovery in case
133             of a disk failure. This could be triggered by a user command or
134             a timer.
135
136           o Automatically force archiving of partially-filled WAL files when
137             pg_stop_backup() is called or the server is stopped
138
139             Doing this will allow administrators to know more easily when
140             the archive contins all the files needed for point-in-time
141             recovery.
142
143           o %Create dump tool for write-ahead logs for use in determining
144             transaction id for point-in-time recovery
145           o Allow a warm standby system to also allow read-only queries
146             [pitr]
147
148             This is useful for checking PITR recovery.
149
150           o Allow the PITR process to be debugged and data examined
151
152
153 Monitoring
154 ==========
155
156 * Allow server log information to be output as INSERT statements
157
158   This would allow server log information to be easily loaded into
159   a database for analysis.
160
161 * %Add ability to monitor the use of temporary sort files
162 * Allow server logs to be remotely read and removed using SQL commands
163 * Allow protocol-level BIND parameter values to be logged
164
165
166 Data Types
167 ==========
168
169 * Improve the MONEY data type
170
171   Change the MONEY data type to use DECIMAL internally, with special
172   locale-aware output formatting.
173
174 * Change NUMERIC to enforce the maximum precision
175 * Add NUMERIC division operator that doesn't round?
176
177   Currently NUMERIC _rounds_ the result to the specified precision.  
178   This means division can return a result that multiplied by the 
179   divisor is greater than the dividend, e.g. this returns a value > 10:
180
181     SELECT (10::numeric(2,0) / 6::numeric(2,0))::numeric(2,0) * 6;
182
183   The positive modulus result returned by NUMERICs might be considered
184   inaccurate, in one sense.
185
186 * %Disallow changing default expression of a SERIAL column?
187 * Fix data types where equality comparison isn't intuitive, e.g. box
188 * %Prevent INET cast to CIDR if the unmasked bits are not zero, or
189   zero the bits
190 * %Prevent INET cast to CIDR from droping netmask, SELECT '1.1.1.1'::inet::cidr
191 * Allow INET + INT4 to increment the host part of the address, or
192   throw an error on overflow
193 * %Add 'tid != tid ' operator for use in corruption recovery
194 * Allow user-defined types to specify a type modifier at table creation
195   time
196
197
198 * Dates and Times
199
200         o Allow infinite dates just like infinite timestamps
201         o Merge hardwired timezone names with the TZ database; allow either 
202           kind everywhere a TZ name is currently taken
203         o Allow customization of the known set of TZ names (generalize the
204           present australian_timezones hack)
205         o Allow TIMESTAMP WITH TIME ZONE to store the original timezone
206           information, either zone name or offset from UTC [timezone]
207
208           If the TIMESTAMP value is stored with a time zone name, interval 
209           computations should adjust based on the time zone rules.
210
211         o Fix SELECT '0.01 years'::interval, '0.01 months'::interval
212         o Fix SELECT INTERVAL '1' MONTH
213         o Add a GUC variable to allow output of interval values in ISO8601 
214           format
215         o Improve timestamptz subtraction to be DST-aware
216
217           Currently, subtracting one date from another that crosses a
218           daylight savings time adjustment can return '1 day 1 hour', but
219           adding that back to the first date returns a time one hour in
220           the future.  This is caused by the adjustment of '25 hours' to
221           '1 day 1 hour', and '1 day' is the same time the next day, even
222           if daylight savings adjustments are involved.
223
224         o Fix interval display to support values exceeding 2^31 hours
225         o Add overflow checking to timestamp and interval arithmetic    
226         o Add ISO INTERVAL handling
227                 o Add support for day-time syntax, INTERVAL '1 2:03:04' DAY TO 
228                   SECOND
229                 o Add support for year-month syntax, INTERVAL '50-6' YEAR TO MONTH
230                 o For syntax that isn't uniquely ISO or PG syntax, like '1:30' or
231                   '1', treat as ISO if there is a range specification clause,
232                   and as PG if there no clause is present, e.g. interpret 
233                           '1:30' MINUTE TO SECOND as '1 minute 30 seconds', and 
234                           interpret '1:30' as '1 hour, 30 minutes'
235                 o Interpret INTERVAL '1 year' MONTH as CAST (INTERVAL '1 year' AS
236                   INTERVAL MONTH), and this should return '12 months'
237                 o Round or truncate values to the requested precision, e.g.
238                   INTERVAL '11 months' AS YEAR should return one or zero
239                 o Support precision, CREATE TABLE foo (a INTERVAL MONTH(3))
240
241
242 * Arrays
243
244         o -Allow NULLs in arrays
245         o Delay resolution of array expression's data type so assignment
246           coercion can be performed on empty array expressions
247
248
249 * Binary Data
250
251         o Improve vacuum of large objects, like /contrib/vacuumlo?
252         o Add security checking for large objects
253         o Auto-delete large objects when referencing row is deleted
254
255           /contrib/lo offers this functionality.
256
257         o Allow read/write into TOAST values like large objects
258
259           This requires the TOAST column to be stored EXTERNAL.
260
261
262 Functions
263 =========
264
265 * Allow INET subnet tests using non-constants to be indexed
266 * Add transaction_timestamp(), statement_timestamp(), clock_timestamp()
267   functionality
268
269   Current CURRENT_TIMESTAMP returns the start time of the current
270   transaction, and gettimeofday() returns the wallclock time. This will
271   make time reporting more consistent and will allow reporting of
272   the statement start time.
273
274 * %Add pg_get_acldef(), pg_get_typedefault(), and pg_get_attrdef()
275 * Allow to_char() to print localized month names
276 * Allow functions to have a schema search path specified at creation time
277 * Allow substring/replace() to get/set bit values
278 * Allow to_char() on interval values to accumulate the highest unit
279   requested
280
281   Some special format flag would be required to request such
282   accumulation.  Such functionality could also be added to EXTRACT. 
283   Prevent accumulation that crosses the month/day boundary because of
284   the uneven number of days in a month.
285
286         o to_char(INTERVAL '1 hour 5 minutes', 'MI') => 65
287         o to_char(INTERVAL '43 hours 20 minutes', 'MI' ) => 2600 
288         o to_char(INTERVAL '43 hours 20 minutes', 'WK:DD:HR:MI') => 0:1:19:20
289         o to_char(INTERVAL '3 years 5 months','MM') => 41
290
291 * Add sleep() function, remove from regress.c
292 * Allow user-defined functions retuning a domain value to enforce domain
293   constraints
294 * Add SPI_gettypmod() to return the typemod for a TupleDesc
295
296
297 Multi-Language Support
298 ======================
299
300 * Add NCHAR (as distinguished from ordinary varchar),
301 * Allow locale to be set at database creation
302
303   Currently locale can only be set during initdb.  No global tables have
304   locale-aware columns.  However, the database template used during
305   database creation might have locale-aware indexes.  The indexes would
306   need to be reindexed to match the new locale.
307
308 * Allow encoding on a per-column basis
309
310   Right now only one encoding is allowed per database.
311
312 * Support multiple simultaneous character sets, per SQL92
313 * Improve UTF8 combined character handling?
314 * Add octet_length_server() and octet_length_client()
315 * Make octet_length_client() the same as octet_length()?
316 * Fix problems with wrong runtime encoding conversion for NLS message files
317
318
319 Views / Rules
320 =============
321
322 * %Automatically create rules on views so they are updateable, per SQL99
323
324   We can only auto-create rules for simple views.  For more complex
325   cases users will still have to write rules.
326
327 * Add the functionality for WITH CHECK OPTION clause of CREATE VIEW
328 * Allow NOTIFY in rules involving conditionals
329 * Allow VIEW/RULE recompilation when the underlying tables change
330
331   Another issue is whether underlying table changes should be reflected
332   in the view, e.g. should SELECT * show additional columns if they
333   are added after the view is created.
334
335
336 SQL Commands
337 ============
338
339 * Change LIMIT/OFFSET and FETCH/MOVE to use int8
340 * Add CORRESPONDING BY to UNION/INTERSECT/EXCEPT
341 * Add ROLLUP, CUBE, GROUPING SETS options to GROUP BY
342 * %Allow SET CONSTRAINTS to be qualified by schema/table name
343 * %Allow TRUNCATE ... CASCADE/RESTRICT
344
345   This is like DELETE CASCADE, but truncates.
346
347 * %Add a separate TRUNCATE permission
348
349   Currently only the owner can TRUNCATE a table because triggers are not
350   called, and the table is locked in exclusive mode.
351
352 * Allow PREPARE of cursors
353 * Allow PREPARE to automatically determine parameter types based on the SQL
354   statement
355 * Allow finer control over the caching of prepared query plans
356
357   Currently, queries prepared via the libpq API are planned on first
358   execute using the supplied parameters --- allow SQL PREPARE to do the
359   same.  Also, allow control over replanning prepared queries either
360   manually or automatically when statistics for execute parameters
361   differ dramatically from those used during planning.
362
363 * Allow LISTEN/NOTIFY to store info in memory rather than tables?
364
365   Currently LISTEN/NOTIFY information is stored in pg_listener. Storing
366   such information in memory would improve performance.
367
368 * Add optional textual message to NOTIFY
369
370   This would allow an informational message to be added to the notify
371   message, perhaps indicating the row modified or other custom
372   information.
373
374 * Add a GUC variable to warn about non-standard SQL usage in queries
375 * Add SQL-standard MERGE command, typically used to merge two tables
376   [merge]
377
378   This is similar to UPDATE, then for unmatched rows, INSERT.
379   Whether concurrent access allows modifications which could cause
380   row loss is implementation independent.
381
382 * Add REPLACE or UPSERT command that does UPDATE, or on failure, INSERT
383   [merge]
384
385   To implement this cleanly requires that the table have a unique index
386   so duplicate checking can be easily performed.  It is possible to
387   do it without a unique index if we require the user to LOCK the table
388   before the MERGE.
389
390 * Add NOVICE output level for helpful messages like automatic sequence/index
391   creation
392 * %Add COMMENT ON for all cluster global objects (roles, databases
393   and tablespaces)
394 * %Make row-wise comparisons work per SQL spec
395 * Add RESET CONNECTION command to reset all session state
396
397   This would include resetting of all variables (RESET ALL), dropping of
398   temporary tables, removing any NOTIFYs, cursors, open transactions,
399   prepared queries, currval()s, etc.  This could be used  for connection
400   pooling.  We could also change RESET ALL to have this functionality.  
401   The difficult of this features is allowing RESET ALL to not affect 
402   changes made by the interface driver for its internal use.  One idea 
403   is for this to be a protocol-only feature.  Another approach is to 
404   notify the protocol when a RESET CONNECTION command is used.
405
406 * Add GUC to issue notice about queries that use unjoined tables
407 * Allow EXPLAIN to identify tables that were skipped because of 
408   constraint_exclusion
409 * Allow EXPLAIN output to be more easily processed by scripts
410 * Eventually enable escape_string_warning and standard_conforming_strings
411 * Simplify dropping roles that have objects in several databases
412 * Allow COMMENT ON to accept an expression rather than just a string
413
414
415 * CREATE
416
417         o Allow CREATE TABLE AS to determine column lengths for complex
418           expressions like SELECT col1 || col2
419         o Use more reliable method for CREATE DATABASE to get a consistent
420           copy of db?
421         o Add ON COMMIT capability to CREATE TABLE AS ... SELECT
422
423
424 * UPDATE
425         o Allow UPDATE to handle complex aggregates [update]?
426         o Allow an alias to be provided for the target table in
427           UPDATE/DELETE
428
429           This is not SQL-spec but many DBMSs allow it.
430
431         o Allow UPDATE tab SET ROW (col, ...) = (...) for updating multiple
432           columns
433
434
435 * ALTER
436
437         o %Have ALTER TABLE RENAME rename SERIAL sequence names
438         o Add ALTER DOMAIN to modify the underlying data type
439         o %Allow ALTER TABLE ... ALTER CONSTRAINT ... RENAME
440         o %Allow ALTER TABLE to change constraint deferrability and actions
441         o Add missing object types for ALTER ... SET SCHEMA
442         o Allow ALTER TABLESPACE to move to different directories
443         o Allow databases to be moved to different tablespaces
444         o Allow moving system tables to other tablespaces, where possible
445
446           Currently non-global system tables must be in the default database
447           tablespace. Global system tables can never be moved.
448
449         o %Disallow dropping of an inherited constraint
450         o %Prevent child tables from altering or dropping constraints 
451           like CHECK that were inherited from the parent table
452         o Have ALTER INDEX update the name of a constraint using that index
453         o Add ALTER TABLE RENAME CONSTRAINT, update index name also
454
455
456 * CLUSTER
457
458         o Automatically maintain clustering on a table
459
460           This might require some background daemon to maintain clustering
461           during periods of low usage. It might also require tables to be only
462           paritally filled for easier reorganization.  Another idea would
463           be to create a merged heap/index data file so an index lookup would
464           automatically access the heap data too.  A third idea would be to
465           store heap rows in hashed groups, perhaps using a user-supplied
466           hash function.
467
468         o %Add default clustering to system tables
469
470           To do this, determine the ideal cluster index for each system
471           table and set the cluster setting during initdb.
472
473
474 * COPY
475
476         o Allow COPY to report error lines and continue
477
478           This requires the use of a savepoint before each COPY line is
479           processed, with ROLLBACK on COPY failure.
480
481         o %Have COPY return the number of rows loaded/unloaded?
482         o Allow COPY on a newly-created table to skip WAL logging
483
484           On crash recovery, the table involved in the COPY would
485           be removed or have its heap and index files truncated.  One
486           issue is that no other backend should be able to add to 
487           the table at the same time, which is something that is 
488           currently allowed.
489
490         o Allow COPY to output from views
491
492           Another idea would be to allow actual SELECT queries in a COPY.
493
494
495 * GRANT/REVOKE
496
497         o Allow column-level privileges
498         o %Allow GRANT/REVOKE permissions to be applied to all schema objects
499           with one command
500
501           The proposed syntax is:
502                 GRANT SELECT ON ALL TABLES IN public TO phpuser;
503                 GRANT SELECT ON NEW TABLES IN public TO phpuser;
504
505         * Allow GRANT/REVOKE permissions to be inherited by objects based on
506           schema permissions
507
508
509 * CURSOR
510
511         o Allow UPDATE/DELETE WHERE CURRENT OF cursor
512
513           This requires using the row ctid to map cursor rows back to the
514           original heap row. This become more complicated if WITH HOLD cursors
515           are to be supported because WITH HOLD cursors have a copy of the row
516           and no FOR UPDATE lock.
517
518         o Prevent DROP TABLE from dropping a row referenced by its own open
519           cursor?
520
521         o %Allow pooled connections to list all open WITH HOLD cursors
522
523           Because WITH HOLD cursors exist outside transactions, this allows
524           them to be listed so they can be closed.
525
526
527 * INSERT
528
529         o Allow INSERT/UPDATE of the system-generated oid value for a row
530         o Allow INSERT INTO tab (col1, ..) VALUES (val1, ..), (val2, ..)
531         o Allow INSERT/UPDATE ... RETURNING new.col or old.col
532
533           This is useful for returning the auto-generated key for an INSERT.
534           One complication is how to handle rules that run as part of
535           the insert.
536
537
538 * SHOW/SET
539
540         o Add SET PERFORMANCE_TIPS option to suggest INDEX, VACUUM, VACUUM
541           ANALYZE, and CLUSTER
542         o Add SET PATH for schemas?
543
544           This is basically the same as SET search_path.
545
546
547 * Server-Side Languages
548
549         o Fix PL/pgSQL RENAME to work on variables other than OLD/NEW
550         o Allow function parameters to be passed by name,
551           get_employee_salary(emp_id => 12345, tax_year => 2001)
552         o Add Oracle-style packages
553         o Add table function support to pltcl, plpython
554         o Add capability to create and call PROCEDURES
555         o Allow PL/pgSQL to handle %TYPE arrays, e.g. tab.col%TYPE[]
556         o Allow function argument names to be queries from PL/PgSQL
557         o Add MOVE to PL/pgSQL
558         o Add support for polymorphic arguments and return types to
559           languages other than PL/PgSQL
560         o Add support for OUT and INOUT parameters to languages other 
561           than PL/PgSQL
562         o Add single-step debugging of PL/PgSQL functions
563         o Allow PL/PgSQL to support WITH HOLD cursors
564
565
566 Clients
567 =======
568
569 * Have initdb set the input DateStyle (MDY or DMY) based on locale?
570 * Have pg_ctl look at PGHOST in case it is a socket directory?
571 * Allow pg_ctl to work properly with configuration files located outside
572   the PGDATA directory
573
574   pg_ctl can not read the pid file because it isn't located in the
575   config directory but in the PGDATA directory.  The solution is to
576   allow pg_ctl to read and understand postgresql.conf to find the
577   data_directory value.
578
579
580 * psql
581
582         o Have psql show current values for a sequence
583         o Move psql backslash database information into the backend, use
584           mnemonic commands? [psql]
585
586           This would allow non-psql clients to pull the same information out
587           of the database as psql.
588
589         o Fix psql's display of schema information (Neil)
590         o Allow psql \pset boolean variables to set to fixed values, rather
591           than toggle
592         o Consistently display privilege information for all objects in psql
593         o Improve psql's handling of multi-line queries
594
595           Currently, while \e saves a single query as one entry, interactive
596           queries are saved one line at a time.  Ideally all queries
597           whould be saved like \e does.
598
599         o Allow multi-line column values to align in the proper columns
600
601           If the second output column value is 'a\nb', the 'b' should appear
602           in the second display column, rather than the first column as it
603           does now.
604
605         o Display IN, INOUT, and OUT parameters in \df+
606
607           It probably requires psql to output newlines in the proper
608           column, which is already on the TODO list.
609
610         o Add auto-expanded mode so expanded output is used if the row
611           length is wider than the screen width.  
612
613           Consider using auto-expanded mode for backslash commands like \df+.
614
615
616 * pg_dump
617
618         o %Have pg_dump use multi-statement transactions for INSERT dumps
619         o %Allow pg_dump to use multiple -t and -n switches [pg_dump]
620         o %Add dumping of comments on index columns and composite type columns
621         o %Add full object name to the tag field.  eg. for operators we need
622           '=(integer, integer)', instead of just '='.
623         o Add pg_dumpall custom format dumps?
624         o %Add CSV output format
625         o Update pg_dump and psql to use the new COPY libpq API (Christopher)
626         o Remove unnecessary function pointer abstractions in pg_dump source
627           code
628         o Allow selection of individual object(s) of all types, not just
629           tables
630         o In a selective dump, allow dumping of an object and all its 
631           dependencies
632         o Add options like pg_restore -l and -L to pg_dump
633         o Stop dumping CASCADE on DROP TYPE commands in clean mode
634         o Allow pg_dump --clean to drop roles that own objects or have
635           privileges
636         o Add -f to pg_dumpall
637
638
639 * ecpg
640
641         o Docs
642
643           Document differences between ecpg and the SQL standard and
644           information about the Informix-compatibility module.
645
646         o Solve cardinality > 1 for input descriptors / variables?
647         o Add a semantic check level, e.g. check if a table really exists
648         o fix handling of DB attributes that are arrays
649         o Use backend PREPARE/EXECUTE facility for ecpg where possible
650         o Implement SQLDA
651         o Fix nested C comments
652         o %sqlwarn[6] should be 'W' if the PRECISION or SCALE value specified
653         o Make SET CONNECTION thread-aware, non-standard?
654         o Allow multidimensional arrays
655         o Add internationalized message strings
656
657
658 libpq
659
660         o Add a function to support Parse/DescribeStatement capability
661         o Add PQescapeIdentifier()
662         o Prevent PQfnumber() from lowercasing unquoted the column name
663
664           PQfnumber() should never have been doing lowercasing, but 
665           historically it has so we need a way to prevent it
666
667         o Allow query results to be automatically batched to the client
668
669           Currently, all query results are transfered to the libpq
670           client before libpq makes the results available to the 
671           application.  This feature would allow the application to make
672           use of the first result rows while the rest are transfered, or
673           held on the server waiting for them to be requested by libpq.
674           One complexity is that a query like SELECT 1/col could error
675           out mid-way through the result set.
676
677
678 Referential Integrity
679 =====================
680
681 * Add MATCH PARTIAL referential integrity
682 * Add deferred trigger queue file
683
684   Right now all deferred trigger information is stored in backend
685   memory.  This could exhaust memory for very large trigger queues.
686   This item involves dumping large queues into files.
687
688 * Change foreign key constraint for array -> element to mean element
689   in array?
690 * Allow DEFERRABLE UNIQUE constraints?
691 * Allow triggers to be disabled in only the current session.
692
693   This is currently possible by starting a multi-statement transaction,
694   modifying the system tables, performing the desired SQL, restoring the
695   system tables, and committing the transaction.  ALTER TABLE ...
696   TRIGGER requires a table lock so it is not ideal for this usage.
697
698 * With disabled triggers, allow pg_dump to use ALTER TABLE ADD FOREIGN KEY
699
700   If the dump is known to be valid, allow foreign keys to be added
701   without revalidating the data.
702
703 * Allow statement-level triggers to access modified rows
704 * Support triggers on columns (Greg Sabino Mullane)
705 * Enforce referential integrity for system tables
706 * Allow AFTER triggers on system tables
707
708   System tables are modified in many places in the backend without going
709   through the executor and therefore not causing triggers to fire. To
710   complete this item, the functions that modify system tables will have
711   to fire triggers.
712
713
714 Dependency Checking
715 ===================
716
717 * Flush cached query plans when the dependent objects change
718 * Track dependencies in function bodies and recompile/invalidate
719
720   This is particularly important for references to temporary tables
721   in PL/PgSQL because PL/PgSQL caches query plans.  The only workaround
722   in PL/PgSQL is to use EXECUTE.  One complexity is that a function
723   might itself drop and recreate dependent tables, causing it to
724   invalidate its own query plan.
725
726
727 Exotic Features
728 ===============
729
730 * Add SQL99 WITH clause to SELECT
731 * Add SQL99 WITH RECURSIVE to SELECT
732 * Add pre-parsing phase that converts non-ISO syntax to supported
733   syntax
734
735   This could allow SQL written for other databases to run without
736   modification.
737
738 * Allow plug-in modules to emulate features from other databases
739 * SQL*Net listener that makes PostgreSQL appear as an Oracle database
740   to clients
741 * Allow queries across databases or servers with transaction
742   semantics
743
744   This can be done using dblink and two-phase commit.
745
746 * Add the features of packages
747
748         o  Make private objects accessable only to objects in the same schema
749         o  Allow current_schema.objname to access current schema objects
750         o  Add session variables
751         o  Allow nested schemas
752
753
754 Indexes
755 =======
756
757 * Allow inherited tables to inherit index, UNIQUE constraint, and primary
758   key, foreign key
759 * UNIQUE INDEX on base column not honored on INSERTs/UPDATEs from
760   inherited table:  INSERT INTO inherit_table (unique_index_col) VALUES
761   (dup) should fail
762
763   The main difficulty with this item is the problem of creating an index
764   that can span more than one table.
765
766 * Allow SELECT ... FOR UPDATE on inherited tables
767 * Add UNIQUE capability to non-btree indexes
768 * Prevent index uniqueness checks when UPDATE does not modify the column
769
770   Uniqueness (index) checks are done when updating a column even if the
771   column is not modified by the UPDATE.
772
773 * Allow the creation of on-disk bitmap indexes which can be quickly
774   combined with other bitmap indexes
775
776   Such indexes could be more compact if there are only a few distinct values.
777   Such indexes can also be compressed.  Keeping such indexes updated can be
778   costly.
779
780 * Allow use of indexes to search for NULLs
781
782   One solution is to create a partial index on an IS NULL expression.
783
784 * Allow accurate statistics to be collected on indexes with more than
785   one column or expression indexes, perhaps using per-index statistics
786 * Add fillfactor to control reserved free space during index creation
787 * Allow the creation of indexes with mixed ascending/descending specifiers
788 * Allow constraint_exclusion to work for UNIONs like it does for
789   inheritance, allow it to work for UPDATE and DELETE queries, and allow
790   it to be used for all queries with little performance impact
791 * Allow CREATE INDEX to take an additional parameter for use with
792   special index types
793 * Consider compressing indexes by storing key values duplicated in
794   several rows as a single index entry
795
796   This is difficult because it requires datatype-specific knowledge.
797
798
799 * GIST
800
801         o Add more GIST index support for geometric data types
802         o Allow GIST indexes to create certain complex index types, like
803           digital trees (see Aoki)
804
805 * Hash
806
807         o Pack hash index buckets onto disk pages more efficiently
808
809           Currently only one hash bucket can be stored on a page. Ideally
810           several hash buckets could be stored on a single page and greater
811           granularity used for the hash algorithm.
812
813         o Consider sorting hash buckets so entries can be found using a
814           binary search, rather than a linear scan
815
816         o In hash indexes, consider storing the hash value with or instead
817           of the key itself
818
819         o Add WAL logging for crash recovery
820         o Allow multi-column hash indexes
821
822
823 Fsync
824 =====
825
826 * Improve commit_delay handling to reduce fsync()
827 * Determine optimal fdatasync/fsync, O_SYNC/O_DSYNC options
828
829   Ideally this requires a separate test program that can be run
830   at initdb time or optionally later.  Consider O_SYNC when
831   O_DIRECT exists.
832
833 * %Add an option to sync() before fsync()'ing checkpoint files
834 * Add program to test if fsync has a delay compared to non-fsync
835
836
837 Cache Usage
838 ===========
839
840 * Allow free-behind capability for large sequential scans, perhaps using
841   posix_fadvise()
842
843   Posix_fadvise() can control both sequential/random file caching and
844   free-behind behavior, but it is unclear how the setting affects other
845   backends that also have the file open, and the feature is not supported
846   on all operating systems.
847
848 * Speed up COUNT(*)
849
850   We could use a fixed row count and a +/- count to follow MVCC
851   visibility rules, or a single cached value could be used and
852   invalidated if anyone modifies the table.  Another idea is to
853   get a count directly from a unique index, but for this to be
854   faster than a sequential scan it must avoid access to the heap
855   to obtain tuple visibility information.
856
857 * Add estimated_count(*) to return an estimate of COUNT(*)
858
859   This would use the planner ANALYZE statistatics to return an estimated
860   count.
861
862 * Allow data to be pulled directly from indexes
863
864   Currently indexes do not have enough tuple visibility information 
865   to allow data to be pulled from the index without also accessing 
866   the heap.  One way to allow this is to set a bit on index tuples 
867   to indicate if a tuple is currently visible to all transactions 
868   when the first valid heap lookup happens.  This bit would have to 
869   be cleared when a heap tuple is expired.  
870
871   Another idea is to maintain a bitmap of heap pages where all rows
872   are visible to all backends, and allow index lookups to reference 
873   that bitmap to avoid heap lookups, perhaps the same bitmap we might
874   add someday to determine which heap pages need vacuuming.  Frequently
875   accessed bitmaps would have to be stored in shared memory.  One 8k
876   page of bitmaps could track 512MB of heap pages.
877
878 * Consider automatic caching of queries at various levels:
879
880         o Parsed query tree
881         o Query execute plan
882         o Query results
883
884 * Allow sequential scans to take advantage of other concurrent
885   sequentiqal scans, also called "Synchronised Scanning"
886
887   One possible implementation is to start sequential scans from the lowest
888   numbered buffer in the shared cache, and when reaching the end wrap
889   around to the beginning, rather than always starting sequential scans
890   at the start of the table.
891
892
893 Vacuum
894 ======
895
896 * Improve speed with indexes
897
898   For large table adjustements during VACUUM FULL, it is faster to 
899   reindex rather than update the index.
900
901 * Reduce lock time during VACUUM FULL by moving tuples with read lock,
902   then write lock and truncate table
903
904   Moved tuples are invisible to other backends so they don't require a
905   write lock. However, the read lock promotion to write lock could lead
906   to deadlock situations.
907
908 * Auto-fill the free space map by scanning the buffer cache or by
909   checking pages written by the background writer
910 * Create a bitmap of pages that need vacuuming
911
912   Instead of sequentially scanning the entire table, have the background
913   writer or some other process record pages that have expired rows, then
914   VACUUM can look at just those pages rather than the entire table.  In
915   the event of a system crash, the bitmap would probably be invalidated.
916   One complexity is that index entries still have to be vacuumed, and
917   doing this without an index scan (by using the heap values to find the
918   index entry) might be slow and unreliable, especially for user-defined
919   index functions.
920
921 * %Add system view to show free space map contents
922
923
924 * Auto-vacuum
925
926         o Use free-space map information to guide refilling
927         o %Issue log message to suggest VACUUM FULL if a table is nearly
928           empty?
929         o Improve xid wraparound detection by recording per-table rather
930           than per-database
931         o Consider logging activity either to the logs or a system view
932
933
934 Locking
935 =======
936
937 * Fix priority ordering of read and write light-weight locks (Neil)
938
939
940 Startup Time Improvements
941 =========================
942
943 * Experiment with multi-threaded backend [thread]
944
945   This would prevent the overhead associated with process creation. Most
946   operating systems have trivial process creation time compared to
947   database startup overhead, but a few operating systems (WIn32,
948   Solaris) might benefit from threading.  Also explore the idea of
949   a single session using multiple threads to execute a query faster.
950
951 * Add connection pooling
952
953   It is unclear if this should be done inside the backend code or done
954   by something external like pgpool. The passing of file descriptors to
955   existing backends is one of the difficulties with a backend approach.
956
957
958 Write-Ahead Log
959 ===============
960
961 * Eliminate need to write full pages to WAL before page modification [wal]
962
963   Currently, to protect against partial disk page writes, we write
964   full page images to WAL before they are modified so we can correct any
965   partial page writes during recovery.  These pages can also be
966   eliminated from point-in-time archive files.
967
968         o  When off, write CRC to WAL and check file system blocks
969            on recovery
970
971            If CRC check fails during recovery, remember the page in case
972            a later CRC for that page properly matches.
973
974         o  Write full pages during file system write and not when
975            the page is modified in the buffer cache
976
977            This allows most full page writes to happen in the background
978            writer.  It might cause problems for applying WAL on recovery
979            into a partially-written page, but later the full page will be
980            replaced from WAL.
981
982 * Allow WAL traffic to be streamed to another server for stand-by
983   replication
984 * Reduce WAL traffic so only modified values are written rather than
985   entire rows?
986 * Allow the pg_xlog directory location to be specified during initdb
987   with a symlink back to the /data location
988 * Allow WAL information to recover corrupted pg_controldata
989 * Find a way to reduce rotational delay when repeatedly writing
990   last WAL page
991
992   Currently fsync of WAL requires the disk platter to perform a full
993   rotation to fsync again. One idea is to write the WAL to different
994   offsets that might reduce the rotational delay.
995
996 * Allow buffered WAL writes and fsync
997
998   Instead of guaranteeing recovery of all committed transactions, this
999   would provide improved performance by delaying WAL writes and fsync
1000   so an abrupt operating system restart might lose a few seconds of
1001   committed transactions but still be consistent.  We could perhaps
1002   remove the 'fsync' parameter (which results in an an inconsistent
1003   database) in favor of this capability.
1004
1005
1006 Optimizer / Executor
1007 ====================
1008
1009 * Add missing optimizer selectivities for date, r-tree, etc
1010 * Allow ORDER BY ... LIMIT # to select high/low value without sort or
1011   index using a sequential scan for highest/lowest values
1012
1013   Right now, if no index exists, ORDER BY ... LIMIT # requires we sort
1014   all values to return the high/low value.  Instead The idea is to do a 
1015   sequential scan to find the high/low value, thus avoiding the sort.
1016   MIN/MAX already does this, but not for LIMIT > 1.
1017
1018 * Precompile SQL functions to avoid overhead
1019 * Create utility to compute accurate random_page_cost value
1020 * Improve ability to display optimizer analysis using OPTIMIZER_DEBUG
1021 * Have EXPLAIN ANALYZE highlight poor optimizer estimates
1022 * Consider using hash buckets to do DISTINCT, rather than sorting
1023
1024   This would be beneficial when there are few distinct values.  This is
1025   already used by GROUP BY.
1026
1027 * Log queries where the optimizer row estimates were dramatically
1028   different from the number of rows actually found?
1029
1030
1031 Miscellaneous Performance
1032 =========================
1033
1034 * Do async I/O for faster random read-ahead of data
1035
1036   Async I/O allows multiple I/O requests to be sent to the disk with
1037   results coming back asynchronously.
1038
1039 * Use mmap() rather than SYSV shared memory or to write WAL files?
1040
1041   This would remove the requirement for SYSV SHM but would introduce
1042   portability issues. Anonymous mmap (or mmap to /dev/zero) is required
1043   to prevent I/O overhead.
1044
1045 * Consider mmap()'ing files into a backend?
1046
1047   Doing I/O to large tables would consume a lot of address space or
1048   require frequent mapping/unmapping.  Extending the file also causes
1049   mapping problems that might require mapping only individual pages,
1050   leading to thousands of mappings.  Another problem is that there is no
1051   way to _prevent_ I/O to disk from the dirty shared buffers so changes
1052   could hit disk before WAL is written.
1053
1054 * Add a script to ask system configuration questions and tune postgresql.conf
1055 * Merge xmin/xmax/cmin/cmax back into three header fields
1056
1057   Before subtransactions, there used to be only three fields needed to
1058   store these four values. This was possible because only the current
1059   transaction looks at the cmin/cmax values. If the current transaction
1060   created and expired the row the fields stored where xmin (same as
1061   xmax), cmin, cmax, and if the transaction was expiring a row from a
1062   another transaction, the fields stored were xmin (cmin was not
1063   needed), xmax, and cmax. Such a system worked because a transaction
1064   could only see rows from another completed transaction. However,
1065   subtransactions can see rows from outer transactions, and once the
1066   subtransaction completes, the outer transaction continues, requiring
1067   the storage of all four fields. With subtransactions, an outer
1068   transaction can create a row, a subtransaction expire it, and when the
1069   subtransaction completes, the outer transaction still has to have
1070   proper visibility of the row's cmin, for example, for cursors.
1071
1072   One possible solution is to create a phantom cid which represents a
1073   cmin/cmax pair and is stored in local memory.  Another idea is to
1074   store both cmin and cmax only in local memory.
1075
1076 * Research storing disk pages with no alignment/padding
1077
1078
1079 Source Code
1080 ===========
1081
1082 * Add use of 'const' for variables in source tree
1083 * Rename some /contrib modules from pg* to pg_*
1084 * Move some things from /contrib into main tree
1085 * Move some /contrib modules out to their own project sites
1086 * %Remove warnings created by -Wcast-align
1087 * Move platform-specific ps status display info from ps_status.c to ports
1088 * Add optional CRC checksum to heap and index pages
1089 * Improve documentation to build only interfaces (Marc)
1090 * Remove or relicense modules that are not under the BSD license, if possible
1091 * %Remove memory/file descriptor freeing before ereport(ERROR)
1092 * Acquire lock on a relation before building a relcache entry for it
1093 * %Promote debug_query_string into a server-side function current_query()
1094 * %Allow the identifier length to be increased via a configure option
1095 * Allow cross-compiling by generating the zic database on the target system
1096 * Improve NLS maintenace of libpgport messages linked onto applications
1097 * Allow ecpg to work with MSVC and BCC
1098 * Add xpath_array() to /contrib/xml2 to return results as an array
1099 * Allow building in directories containing spaces
1100
1101   This is probably not possible because 'gmake' and other compiler tools
1102   do not fully support quoting of paths with spaces.
1103
1104 * Allow installing to directories containing spaces
1105
1106   This is possible if proper quoting is added to the makefiles for the
1107   install targets.  Because PostgreSQL supports relocatable installs, it
1108   is already possible to install into a directory that doesn't contain 
1109   spaces and then copy the install to a directory with spaces.
1110
1111 * Fix sgmltools so PDFs can be generated with bookmarks
1112 * %Clean up compiler warnings (especially with gcc version 4)
1113 * Use UTF8 encoding for NLS messages so all server encodings can
1114   read them properly
1115 * Update Bonjour to work with newer cross-platform SDK
1116 * Remove BeOS and QNX-specific code
1117
1118
1119 * Win32
1120
1121         o Remove configure.in check for link failure when cause is found
1122         o Remove readdir() errno patch when runtime/mingwex/dirent.c rev
1123           1.4 is released
1124         o Remove psql newline patch when we find out why mingw outputs an
1125           extra newline
1126         o Allow psql to use readline once non-US code pages work with
1127           backslashes
1128         o Re-enable timezone output on log_line_prefix '%t' when a
1129           shorter timezone string is available
1130         o Fix problem with shared memory on the Win32 Terminal Server
1131         o Improve signal handling,
1132           http://archives.postgresql.org/pgsql-patches/2005-06/msg00027.php
1133         o Add long file support for binary pg_dump output
1134
1135           While Win32 supports 64-bit files, the MinGW API does not,
1136           meaning we have to build an fseeko replacement on top of the
1137           Win32 API, and we have to make sure MinGW handles it.  Another
1138           option is to wait for the MinGW project to fix it, or use the
1139           code from the LibGW32C project as a guide.
1140
1141
1142 * Wire Protocol Changes
1143
1144         o Allow dynamic character set handling
1145         o Add decoded type, length, precision
1146         o Use compression?
1147         o Update clients to use data types, typmod, schema.table.column names
1148           of result sets using new query protocol
1149
1150
1151 ---------------------------------------------------------------------------
1152
1153
1154 Developers who have claimed items are:
1155 --------------------------------------
1156 * Alvaro is Alvaro Herrera <alvherre@dcc.uchile.cl>
1157 * Andrew is Andrew Dunstan <andrew@dunslane.net>
1158 * Bruce is Bruce Momjian <pgman@candle.pha.pa.us> of Software Research Assoc.
1159 * Christopher is Christopher Kings-Lynne <chriskl@familyhealth.com.au> of
1160     Family Health Network
1161 * Claudio is Claudio Natoli <claudio.natoli@memetrics.com>
1162 * D'Arcy is D'Arcy J.M. Cain <darcy@druid.net> of The Cain Gang Ltd.
1163 * Fabien is Fabien Coelho <coelho@cri.ensmp.fr>
1164 * Gavin is Gavin Sherry <swm@linuxworld.com.au> of Alcove Systems Engineering
1165 * Greg is Greg Sabino Mullane <greg@turnstep.com>
1166 * Hiroshi is Hiroshi Inoue <Inoue@tpf.co.jp>
1167 * Jan is Jan Wieck <JanWieck@Yahoo.com> of Afilias, Inc.
1168 * Joe is Joe Conway <mail@joeconway.com>
1169 * Karel is Karel Zak <zakkr@zf.jcu.cz>
1170 * Magnus is Magnus Hagander <mha@sollentuna.net>
1171 * Marc is Marc Fournier <scrappy@hub.org> of PostgreSQL, Inc.
1172 * Matthew T. O'Connor <matthew@zeut.net>
1173 * Michael is Michael Meskes <meskes@postgresql.org> of Credativ
1174 * Neil is Neil Conway <neilc@samurai.com>
1175 * Oleg is Oleg Bartunov <oleg@sai.msu.su>
1176 * Peter is Peter Eisentraut <peter_e@gmx.net>
1177 * Philip is Philip Warner <pjw@rhyme.com.au> of Albatross Consulting Pty. Ltd.
1178 * Rod is Rod Taylor <pg@rbt.ca>
1179 * Simon is Simon Riggs <simon@2ndquadrant.com>
1180 * Stephan is Stephan Szabo <sszabo@megazone23.bigpanda.com>
1181 * Tatsuo is Tatsuo Ishii <t-ishii@sra.co.jp> of Software Research Assoc.
1182 * Tom is Tom Lane <tgl@sss.pgh.pa.us> of Red Hat