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