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