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