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