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