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