]> granicus.if.org Git - postgresql/blob - doc/TODO
Add URL:
[postgresql] / doc / TODO
1 PostgreSQL TODO List
2 ====================
3 Current maintainer:     Bruce Momjian (bruce@momjian.us)
4 Last updated:           Mon Mar 24 12:11:17 EDT 2008
5
6 The most recent version of this document can be viewed at
7 http://www.postgresql.org/docs/faqs.TODO.html.
8
9 #A hyphen, "-", marks changes that will appear in the upcoming 8.3 release.#
10 #A percent sign, "%", marks items that are easier to implement.#
11
12 Bracketed items, "[]", have more detail.
13
14 This list contains all known PostgreSQL bugs and feature requests. If
15 you would like to work on an item, please read the Developer's FAQ
16 first.  There is also a developer's wiki at
17 http://developer.postgresql.org.
18
19
20 Administration
21 ==============
22
23 * Allow administrators to safely terminate individual sessions either
24   via an SQL function or SIGTERM
25
26   Lock table corruption following SIGTERM of an individual backend
27   has been reported in 8.0.  A possible cause was fixed in 8.1, but
28   it is unknown whether other problems exist.  This item mostly
29   requires additional testing rather than of writing any new code.
30
31   http://archives.postgresql.org/pgsql-hackers/2006-08/msg00174.php
32   http://archives.postgresql.org/pgsql-hackers/2007-04/msg00218.php
33
34 * Check for unreferenced table files created by transactions that were
35   in-progress when the server terminated abruptly
36
37   http://archives.postgresql.org/pgsql-patches/2006-06/msg00096.php
38
39 * Set proper permissions on non-system schemas during db creation
40
41   Currently all schemas are owned by the super-user because they are copied
42   from the template1 database.  However, since all objects are inherited
43   from the template database, it is not clear that setting schemas to the db
44   owner is correct.
45
46 * Add function to report the time of the most recent server reload
47 * Allow statistics collector information to be pulled from the collector
48   process directly, rather than requiring the collector to write a
49   filesystem file twice a second?
50 * Reduce file system activity overhead of statistics file pgstat.stat
51
52   http://archives.postgresql.org/pgsql-general/2007-12/msg00106.php
53
54 * Allow statistics last vacuum/analyze execution times to be displayed
55   without requiring stats_row_level to be enabled
56
57   http://archives.postgresql.org/pgsql-docs/2007-04/msg00028.php
58
59 * Allow log_min_messages to be specified on a per-module basis
60
61   This would allow administrators to see more detailed information from
62   specific sections of the backend, e.g. checkpoints, autovacuum, etc.
63   Another idea is to allow separate configuration files for each module,
64   or allow arbitrary SET commands to be passed to them.
65
66 * Simplify ability to create partitioned tables
67
68   This would allow creation of partitioned tables without requiring
69   creation of triggers or rules for INSERT/UPDATE/DELETE, and constraints
70   for rapid partition selection.  Options could include range and hash
71   partition selection.
72
73   http://archives.postgresql.org/pgsql-hackers/2007-03/msg00375.php
74   http://archives.postgresql.org/pgsql-hackers/2007-04/msg00151.php
75   http://archives.postgresql.org/pgsql-hackers/2008-01/msg00028.php
76   http://archives.postgresql.org/pgsql-hackers/2008-01/msg00248.php
77   http://archives.postgresql.org/pgsql-hackers/2008-01/msg00387.php
78   http://archives.postgresql.org/pgsql-hackers/2008-01/msg00413.php
79
80 * Allow auto-selection of partitioned tables for min/max() operations
81 * Allow more complex user/database default GUC settings
82
83   Currently ALTER USER and ALTER DATABASE support per-user and
84   per-database defaults.  Consider adding per-user-and-database
85   defaults so things like search_path can be defaulted for a
86   specific user connecting to a specific database.
87
88 * Allow custom variable classes that can restrict who can set the values
89
90   http://archives.postgresql.org/pgsql-hackers/2006-11/msg00911.php
91
92 * Implement the SQL standard mechanism whereby REVOKE ROLE revokes only
93   the privilege granted by the invoking role, and not those granted
94   by other roles
95
96   http://archives.postgresql.org/pgsql-bugs/2007-05/msg00010.php
97
98 * Allow SSL authentication/encryption over unix domain sockets
99
100   http://archives.postgresql.org/pgsql-hackers/2007-12/msg00924.php
101
102 * Allow SSL key file permission checks to be optionally disabled when
103   sharing SSL keys with other applications
104
105   http://archives.postgresql.org/pgsql-bugs/2007-12/msg00069.php
106
107 * Allow client certificate names to be checked against the client
108   hostname
109
110   This is already implemented in
111   libpq/fe-secure.c::verify_peer_name_matches_certificate() but the code
112   is commented out.
113
114 * Configuration files
115
116         o Allow pg_hba.conf to specify host names along with IP addresses
117
118           Host name lookup could occur when the postmaster reads the
119           pg_hba.conf file, or when the backend starts.  Another
120           solution would be to reverse lookup the connection IP and
121           check that hostname against the host names in pg_hba.conf.
122           We could also then check that the host name maps to the IP
123           address.
124
125         o %Allow postgresql.conf file values to be changed via an SQL
126           API, perhaps using SET GLOBAL
127         o Allow the server to be stopped/restarted via an SQL API
128         o Issue a warning if a change-on-restart-only postgresql.conf value
129           is modified  and the server config files are reloaded
130         o Consider normalizing fractions in postgresql.conf, perhaps
131           using '%'
132
133           http://archives.postgresql.org/pgsql-hackers/2007-06/msg00550.php
134
135         o Allow Kerberos to disable stripping of realms so we can
136           check the username@realm against multiple realms
137
138           http://archives.postgresql.org/pgsql-hackers/2007-11/msg00009.php
139
140
141 * Tablespaces
142
143         o Allow a database in tablespace t1 with tables created in
144           tablespace t2 to be used as a template for a new database created
145           with default tablespace t2
146
147           Currently all objects in the default database tablespace must
148           have default tablespace specifications. This is because new
149           databases are created by copying directories. If you mix default
150           tablespace tables and tablespace-specified tables in the same
151           directory, creating a new database from such a mixed directory
152           would create a new database with tables that had incorrect
153           explicit tablespaces.  To fix this would require modifying
154           pg_class in the newly copied database, which we don't currently
155           do.
156
157         o Allow reporting of which objects are in which tablespaces
158
159           This item is difficult because a tablespace can contain objects
160           from multiple databases. There is a server-side function that
161           returns the databases which use a specific tablespace, so this
162           requires a tool that will call that function and connect to each
163           database to find the objects in each database for that tablespace.
164
165         o Allow WAL replay of CREATE TABLESPACE to work when the directory
166           structure on the recovery computer is different from the original
167
168         o Allow per-tablespace quotas
169
170
171 * Point-In-Time Recovery (PITR)
172
173         o Allow a warm standby system to also allow read-only statements
174           [pitr]
175
176           http://archives.postgresql.org/pgsql-hackers/2007-03/msg00050.php
177
178         o %Create dump tool for write-ahead logs for use in determining
179           transaction id for point-in-time recovery
180
181           This is useful for checking PITR recovery.
182
183         o Allow recovery.conf to support the same syntax as
184           postgresql.conf, including quoting
185
186           http://archives.postgresql.org/pgsql-hackers/2006-12/msg00497.php
187
188         o Fix server restart problem when the server was shutdown during
189           a PITR backup
190
191           http://archives.postgresql.org/pgsql-hackers/2007-11/msg00800.php
192
193         o Recreate pg_xlog/archive_status/ if it doesn't exist after
194           restoring from a PITR backup
195
196           http://archives.postgresql.org/pgsql-hackers/2007-12/msg00487.php
197
198
199 Data Types
200 ==========
201
202 * Change NUMERIC to enforce the maximum precision
203 * Reduce storage space for small NUMERICs
204
205   http://archives.postgresql.org/pgsql-hackers/2007-02/msg01331.php
206   http://archives.postgresql.org/pgsql-patches/2007-02/msg00505.php
207   http://archives.postgresql.org/pgsql-hackers/2007-06/msg00715.php
208
209 * Fix data types where equality comparison isn't intuitive, e.g. box
210 * Add support for public SYNONYMs
211
212   http://archives.postgresql.org/pgsql-hackers/2006-03/msg00519.php
213
214 * Fix CREATE CAST on DOMAINs
215
216   http://archives.postgresql.org/pgsql-hackers/2006-05/msg00072.php
217   http://archives.postgresql.org/pgsql-hackers/2006-09/msg01681.php
218
219 * Allow domains to be cast
220
221   http://archives.postgresql.org/pgsql-hackers/2003-06/msg01206.php
222   http://archives.postgresql.org/pgsql-hackers/2007-08/msg00289.php
223
224 * Add support for SQL-standard GENERATED/IDENTITY columns
225
226   http://archives.postgresql.org/pgsql-hackers/2006-07/msg00543.php
227   http://archives.postgresql.org/pgsql-hackers/2006-08/msg00038.php
228   http://archives.postgresql.org/pgsql-hackers/2007-05/msg00344.php
229   http://archives.postgresql.org/pgsql-patches/2007-05/msg00076.php
230   http://archives.postgresql.org/pgsql-hackers/2008-02/msg00604.php
231
232 * Improve XML support
233
234   http://developer.postgresql.org/index.php/XML_Support
235
236 * Consider placing all sequences in a single table, or create a system
237   view
238
239   http://archives.postgresql.org/pgsql-hackers/2008-03/msg00008.php
240
241 * Allow the UUID type to accept non-standard formats
242
243   http://archives.postgresql.org/pgsql-hackers/2008-02/msg01214.php
244
245 * Allow text search dictionary to filter out only stop words
246
247   http://archives.postgresql.org/pgsql-patches/2007-11/msg00081.php
248
249 * Consider a function-based API for '@@' full text searches
250
251   http://archives.postgresql.org/pgsql-hackers/2007-11/msg00511.php
252
253 * Improve text search error messages
254
255   http://archives.postgresql.org/pgsql-hackers/2007-10/msg00966.php
256   http://archives.postgresql.org/pgsql-hackers/2007-11/msg01146.php
257
258 * Consider a special data type for regular expressions
259
260   http://archives.postgresql.org/pgsql-hackers/2007-08/msg01067.php
261
262 * Reduce BIT data type overhead using short varlena headers
263
264   http://archives.postgresql.org/pgsql-general/2007-12/msg00273.php
265
266
267 * Dates and Times
268
269         o Allow infinite dates and intervals just like infinite timestamps
270         o Merge hardwired timezone names with the TZ database; allow either
271           kind everywhere a TZ name is currently taken
272         o Allow TIMESTAMP WITH TIME ZONE to store the original timezone
273           information, either zone name or offset from UTC [timezone]
274
275           If the TIMESTAMP value is stored with a time zone name, interval
276           computations should adjust based on the time zone rules.
277
278         o Fix SELECT '0.01 years'::interval, '0.01 months'::interval
279         o Add a GUC variable to allow output of interval values in ISO8601
280           format
281         o Have timestamp subtraction not call justify_hours()?
282
283           http://archives.postgresql.org/pgsql-sql/2006-10/msg00059.php
284
285         o Improve timestamptz subtraction to be DST-aware
286
287           Currently subtracting one date from another that crosses a
288           daylight savings time adjustment can return '1 day 1 hour', but
289           adding that back to the first date returns a time one hour in
290           the future.  This is caused by the adjustment of '25 hours' to
291           '1 day 1 hour', and '1 day' is the same time the next day, even
292           if daylight savings adjustments are involved.
293
294         o Fix interval display to support values exceeding 2^31 hours
295         o Add overflow checking to timestamp and interval arithmetic
296         o Extend timezone code to allow 64-bit values so we can
297           represent years beyond 2038
298
299           http://archives.postgresql.org/pgsql-hackers/2006-09/msg01363.php
300
301         o Use LC_TIME for localized weekday/month names, rather than
302           LC_MESSAGES
303
304           http://archives.postgresql.org/pgsql-hackers/2006-11/msg00390.php
305
306         o Add ISO INTERVAL handling
307
308                   http://archives.postgresql.org/pgsql-hackers/2006-01/msg00250.php
309                   http://archives.postgresql.org/pgsql-bugs/2006-04/msg00248.php
310
311                 o Support ISO INTERVAL syntax if units cannot be determined from
312                   the string, and are supplied after the string
313
314                   The SQL standard states that the units after the string
315                   specify the units of the string, e.g. INTERVAL '2' MINUTE
316                   should return '00:02:00'. The current behavior has the units
317                   restrict the interval value to the specified unit or unit
318                   range, INTERVAL '70' SECOND returns '00:00:10'.
319
320                   For syntax that isn't uniquely ISO or PG syntax, like '1' or
321                   '1:30', treat as ISO if there is a range specification clause,
322                   and as PG if there no clause is present, e.g. interpret '1:30'
323                   MINUTE TO SECOND as '1 minute 30 seconds', and interpret
324                   '1:30' as '1 hour, 30 minutes'.
325
326                   This makes common cases like SELECT INTERVAL '1' MONTH
327                   SQL-standard results. The SQL standard supports a limited
328                   number of unit combinations and doesn't support unit names in
329                   the string. The PostgreSQL syntax is more flexible in the
330                   range of units supported, e.g. PostgreSQL supports '1 year 1
331                   hour', while the SQL standard does not.
332
333                 o Add support for year-month syntax, INTERVAL '50-6' YEAR
334                   TO MONTH
335                 o Interpret INTERVAL '1 year' MONTH as CAST (INTERVAL '1
336                   year' AS INTERVAL MONTH), and this should return '12 months'
337                 o Round or truncate values to the requested precision, e.g.
338                   INTERVAL '11 months' AS YEAR should return one or zero
339                 o Support precision, CREATE TABLE foo (a INTERVAL MONTH(3))
340
341
342 * Arrays
343
344         o Delay resolution of array expression's data type so assignment
345           coercion can be performed on empty array expressions
346         o Add support for arrays of domains
347
348           http://archives.postgresql.org/pgsql-patches/2007-05/msg00114.php
349
350         o Allow single-byte header storage for array elements
351
352
353 * Binary Data
354
355         o Improve vacuum of large objects, like contrib/vacuumlo?
356         o Add security checking for large objects
357         o Auto-delete large objects when referencing row is deleted
358
359           contrib/lo offers this functionality.
360
361         o Allow read/write into TOAST values like large objects
362
363           This requires the TOAST column to be stored EXTERNAL.
364
365         o Add API for 64-bit large object access
366
367           http://archives.postgresql.org/pgsql-hackers/2005-09/msg00781.php
368
369 * MONEY data type
370
371         * Add locale-aware MONEY type, and support multiple currencies
372
373           http://archives.postgresql.org/pgsql-general/2005-08/msg01432.php
374           http://archives.postgresql.org/pgsql-hackers/2007-03/msg01181.php
375
376         * MONEY dumps in a locale-specific format making it difficult to
377           restore to a system with a different locale
378         * Allow MONEY to be easily cast to/from other numeric data types
379
380
381 Functions
382 =========
383
384 * Allow INET subnet tests using non-constants to be indexed
385 * Allow to_date() and to_timestamp() accept localized month names
386 * Fix to_date()-related functions to consistently issue errors
387
388   http://archives.postgresql.org/pgsql-hackers/2007-02/msg00915.php
389
390 * Add missing parameter handling in to_char()
391
392   http://archives.postgresql.org/pgsql-hackers/2005-12/msg00948.php
393
394 * Allow substring/replace() to get/set bit values
395 * Allow to_char() on interval values to accumulate the highest unit
396   requested
397
398   Some special format flag would be required to request such
399   accumulation.  Such functionality could also be added to EXTRACT.
400   Prevent accumulation that crosses the month/day boundary because of
401   the uneven number of days in a month.
402
403         o to_char(INTERVAL '1 hour 5 minutes', 'MI') => 65
404         o to_char(INTERVAL '43 hours 20 minutes', 'MI' ) => 2600
405         o to_char(INTERVAL '43 hours 20 minutes', 'WK:DD:HR:MI') => 0:1:19:20
406         o to_char(INTERVAL '3 years 5 months','MM') => 41
407
408 * Implement inlining of set-returning functions defined in SQL
409 * Allow SQL-language functions to return results from RETURNING queries
410
411   http://archives.postgresql.org/pgsql-hackers/2006-10/msg00665.php
412
413 * Allow SQL-language functions to reference parameters by parameter name
414
415   Currently SQL-language functions can only refer to dollar parameters,
416   e.g. $1
417
418 * Add SPI_gettypmod() to return the typemod for a TupleDesc
419 * Enforce typmod for function inputs, function results and parameters for
420   spi_prepare'd statements called from PLs
421
422   http://archives.postgresql.org/pgsql-hackers/2007-01/msg01403.php
423
424 * Allow holdable cursors in SPI
425 * Tighten function permission checks
426
427   http://archives.postgresql.org/pgsql-hackers/2006-12/msg00568.php
428
429 * Fix IS OF so it matches the ISO specification, and add documentation
430
431   http://archives.postgresql.org/pgsql-patches/2003-08/msg00060.php
432   http://archives.postgresql.org/pgsql-hackers/2007-02/msg00060.php
433
434 * Add missing operators for geometric data types
435
436   Some geometric types do not have the full suite of geometric operators,
437   e.g. box @> point
438
439 * Implement Boyer-Moore searching in strpos()
440
441   http://archives.postgresql.org/pgsql-patches/2007-08/msg00012.php
442
443 * Prevent malicious functions from being executed with the permissions
444   of unsuspecting users
445
446   Index functions are safe, so VACUUM and ANALYZE are safe too. 
447   Triggers, CHECK and DEFAULT expressions, and rules are still vulnerable.
448   http://archives.postgresql.org/pgsql-hackers/2008-01/msg00268.php
449
450 * Reduce memory usage of aggregates in set returning functions
451
452   http://archives.postgresql.org/pgsql-performance/2008-01/msg00031.php
453
454 * Add temporal versions of generate_series()
455
456   http://archives.postgresql.org/pgsql-hackers/2007-04/msg01180.php
457
458 * Add array_accum() and array_to_set() functions for arrays
459
460   The standards specify array_agg() and UNNEST.
461   http://archives.postgresql.org/pgsql-hackers/2007-08/msg00464.php
462
463 * Fix /contrib/ltree operator
464
465   http://archives.postgresql.org/pgsql-bugs/2007-11/msg00044.php
466
467 * Fix inconsistent precedence of =, >, and < compared to <>, >=, and <=
468
469   http://archives.postgresql.org/pgsql-bugs/2007-12/msg00145.php
470
471
472
473 Multi-Language Support
474 ======================
475
476 * Add NCHAR (as distinguished from ordinary varchar),
477 * Allow locale to be set at database creation
478
479   Currently locale can only be set during initdb.  No global tables have
480   locale-aware columns.  However, the database template used during
481   database creation might have locale-aware indexes.  The indexes would
482   need to be reindexed to match the new locale.
483
484 * Allow encoding on a per-column basis optionally using the ICU library:
485
486   Right now only one encoding is allowed per database.  [locale]
487
488   http://archives.postgresql.org/pgsql-hackers/2005-03/msg00932.php
489   http://archives.postgresql.org/pgsql-patches/2005-08/msg00309.php
490   http://archives.postgresql.org/pgsql-patches/2006-03/msg00233.php
491   http://archives.postgresql.org/pgsql-hackers/2006-09/msg00662.php
492
493 * Add CREATE COLLATE?  [locale]
494 * Support multiple simultaneous character sets, per SQL92
495 * Improve UTF8 combined character handling?
496 * Add octet_length_server() and octet_length_client()
497 * Make octet_length_client() the same as octet_length()?
498 * Fix problems with wrong runtime encoding conversion for NLS message files
499 * Add URL to more complete multi-byte regression tests
500
501   http://archives.postgresql.org/pgsql-hackers/2005-07/msg00272.php
502
503 * Fix ILIKE and regular expressions to handle case insensitivity
504   properly in multibyte encodings
505
506   http://archives.postgresql.org/pgsql-bugs/2005-10/msg00001.php
507   http://archives.postgresql.org/pgsql-patches/2005-11/msg00173.php
508
509 * Set client encoding based on the client operating system encoding
510
511   Currently client_encoding is set in postgresql.conf, which
512   defaults to the server encoding.
513   http://archives.postgresql.org/pgsql-hackers/2006-08/msg01696.php
514
515 * Change memory allocation for multi-byte functions so memory is
516   allocated inside conversion functions
517
518   Currently we preallocate memory based on worst-case usage.
519
520
521
522 Views / Rules
523 =============
524
525 * Automatically create rules on views so they are updateable, per SQL99
526
527   We can only auto-create rules for simple views.  For more complex
528   cases users will still have to write rules manually.
529
530   http://archives.postgresql.org/pgsql-hackers/2006-03/msg00586.php
531   http://archives.postgresql.org/pgsql-patches/2006-08/msg00255.php
532
533 * Add the functionality for WITH CHECK OPTION clause of CREATE VIEW
534 * Allow NOTIFY in rules involving conditionals
535 * Allow VIEW/RULE recompilation when the underlying tables change
536
537   Another issue is whether underlying table changes should be reflected
538   in the view, e.g. should SELECT * show additional columns if they
539   are added after the view is created.
540
541 * Make it possible to use RETURNING together with conditional DO INSTEAD
542   rules, such as for partitioning setups
543
544   http://archives.postgresql.org/pgsql-hackers/2007-09/msg00577.php
545
546 * Add the ability to automatically create materialized views
547
548   Right now materialized views require the user to create triggers on the
549   main table to keep the summary table current.  SQL syntax should be able
550   to manager the triggers and summary table automatically.  A more
551   sophisticated implementation would automatically retrieve from the
552   summary table when the main table is referenced, if possible.
553
554
555
556 SQL Commands
557 ============
558
559 * Add CORRESPONDING BY to UNION/INTERSECT/EXCEPT
560 * Add ROLLUP, CUBE, GROUPING SETS options to GROUP BY
561 * %Allow SET CONSTRAINTS to be qualified by schema/table name
562 * %Add a separate TRUNCATE permission
563
564   Currently only the owner can TRUNCATE a table because triggers are not
565   called, and the table is locked in exclusive mode.
566
567 * Allow PREPARE of cursors
568 * Allow finer control over the caching of prepared query plans
569
570   Currently queries prepared via the libpq API are planned on first
571   execute using the supplied parameters --- allow SQL PREPARE to do the
572   same.  Also, allow control over replanning prepared queries either
573   manually or automatically when statistics for execute parameters
574   differ dramatically from those used during planning.
575
576 * Improve logging of prepared transactions recovered during startup
577
578   http://archives.postgresql.org/pgsql-hackers/2006-11/msg00092.php
579
580 * Allow LISTEN/NOTIFY to store info in memory rather than tables?
581
582   Currently LISTEN/NOTIFY information is stored in pg_listener. Storing
583   such information in memory would improve performance.
584
585 * Add optional textual message to NOTIFY
586
587   This would allow an informational message to be added to the notify
588   message, perhaps indicating the row modified or other custom
589   information.
590
591 * Allow multiple identical NOTIFY events to always be communicated to the
592   client, rather than sent as a single notification to the listener
593
594   http://archives.postgresql.org/pgsql-general/2008-01/msg00057.php
595
596 * Add a GUC variable to warn about non-standard SQL usage in queries
597 * Add SQL-standard MERGE command, typically used to merge two tables
598   [merge]
599
600   This is similar to UPDATE, then for unmatched rows, INSERT.
601   Whether concurrent access allows modifications which could cause
602   row loss is implementation independent.
603
604 * Add REPLACE or UPSERT command that does UPDATE, or on failure, INSERT
605   [merge]
606
607   To implement this cleanly requires that the table have a unique index
608   so duplicate checking can be easily performed.  It is possible to
609   do it without a unique index if we require the user to LOCK the table
610   before the MERGE.
611
612   http://archives.postgresql.org/pgsql-hackers/2005-11/msg00501.php
613   http://archives.postgresql.org/pgsql-hackers/2005-11/msg00536.php
614
615 * Add NOVICE output level for helpful messages like automatic sequence/index
616   creation
617 * Add GUC to issue notice about statements that use unjoined tables
618 * Allow EXPLAIN to identify tables that were skipped because of
619   constraint_exclusion
620 * Allow EXPLAIN output to be more easily processed by scripts, perhaps XML
621 * Enable standard_conforming_strings
622 * Make standard_conforming_strings the default in 8.5?
623
624   When this is done, backslash-quote should be prohibited in non-E''
625   strings because of possible confusion over how such strings treat
626   backslashes.  Basically, '' is always safe for a literal single
627   quote, while \' might or might not be based on the backslash
628   handling rules.
629
630 * Simplify dropping roles that have objects in several databases
631 * Allow COMMENT ON to accept an expression rather than just a string
632 * Allow the count returned by SELECT, etc to be represented as an int64
633   to allow a higher range of values
634 * Add SQL99 WITH clause to SELECT
635 * Add SQL:2003 WITH RECURSIVE (hierarchical) queries to SELECT
636
637   http://archives.postgresql.org/pgsql-hackers/2007-01/msg01375.php
638   http://archives.postgresql.org/pgsql-hackers/2008-02/msg00642.php
639   http://archives.postgresql.org/pgsql-patches/2007-03/msg00139.php
640   http://archives.postgresql.org/pgsql-hackers/2007-11/msg01334.php
641
642 * Add DEFAULT .. AS OWNER so permission checks are done as the table
643   owner
644
645   This would be useful for SERIAL nextval() calls and CHECK constraints.
646
647 * Allow DISTINCT to work in multiple-argument aggregate calls
648 * Add column to pg_stat_activity that shows the progress of long-running
649   commands like CREATE INDEX and VACUUM
650 * Implement SQL:2003 window functions
651 * Improve failure message when DROP DATABASE is used on a database that
652   has prepared transactions
653 * Allow INSERT/UPDATE ... RETURNING inside a SELECT 'FROM' clause
654
655   http://archives.postgresql.org/pgsql-general/2006-09/msg00803.php
656   http://archives.postgresql.org/pgsql-hackers/2006-10/msg00693.php
657
658 * Increase locking when DROPing objects so dependent objects cannot
659   get dropped while the DROP operation is happening
660
661   http://archives.postgresql.org/pgsql-hackers/2007-01/msg00937.php
662
663 * -Allow AS in "SELECT col AS label" to be optional in certain cases
664
665 * Allow INSERT ... DELETE ... RETURNING, namely allow the DELETE ...
666   RETURNING to supply values to the INSERT
667   http://archives.postgresql.org/pgsql-hackers/2008-02/thrd2.php#00979
668
669 * Add comments on system tables/columns using the information in
670   catalogs.sgml
671
672   Ideally the information would be pulled from the SGML file
673   automatically.
674
675 * Improve reporting of UNION type mismatches
676
677   http://archives.postgresql.org/pgsql-hackers/2007-04/msg00944.php
678   http://archives.postgresql.org/pgsql-hackers/2008-03/msg00597.php
679
680
681 * CREATE
682
683         o Allow CREATE TABLE AS to determine column lengths for complex
684           expressions like SELECT col1 || col2
685
686         o Have WITH CONSTRAINTS also create constraint indexes
687
688           http://archives.postgresql.org/pgsql-patches/2007-04/msg00149.php
689
690         o Have CONSTRAINT cname NOT NULL record the contraint name
691
692           Right now pg_attribute.attnotnull records the NOT NULL status
693           of the column, but does not record the contraint name
694
695
696
697 * UPDATE
698         o Allow UPDATE tab SET ROW (col, ...) = (SELECT...)
699
700           http://archives.postgresql.org/pgsql-hackers/2006-07/msg01306.php
701           http://archives.postgresql.org/pgsql-hackers/2007-03/msg00865.php
702           http://archives.postgresql.org/pgsql-patches/2007-04/msg00315.php
703           http://archives.postgresql.org/pgsql-patches/2008-03/msg00237.php
704
705         o Research self-referential UPDATEs that see inconsistent row versions
706           in read-committed mode
707
708           http://archives.postgresql.org/pgsql-hackers/2007-05/msg00507.php
709           http://archives.postgresql.org/pgsql-hackers/2007-06/msg00016.php
710
711         o Allow GLOBAL temporary tables to exist as empty by default in
712           all sessions
713
714           http://archives.postgresql.org/pgsql-hackers/2007-07/msg00006.php
715
716
717 * ALTER
718
719         o Have ALTER TABLE RENAME rename SERIAL sequence names
720
721           http://archives.postgresql.org/pgsql-hackers/2008-03/msg00008.php
722
723         o Have ALTER SEQUENCE RENAME rename the sequence name stored
724           in the sequence table
725
726           http://archives.postgresql.org/pgsql-bugs/2007-09/msg00092.php
727           http://archives.postgresql.org/pgsql-bugs/2007-10/msg00007.php
728           http://archives.postgresql.org/pgsql-hackers/2008-03/msg00008.php
729
730         o Add ALTER DOMAIN to modify the underlying data type
731         o %Allow ALTER TABLE ... ALTER CONSTRAINT ... RENAME
732
733           http://archives.postgresql.org/pgsql-patches/2006-02/msg00168.php
734
735         o %Allow ALTER TABLE to change constraint deferrability and actions
736         o Add missing object types for ALTER ... SET SCHEMA
737         o Allow ALTER TABLESPACE to move to different directories
738         o Allow databases to be moved to different tablespaces
739         o Allow moving system tables to other tablespaces, where possible
740
741           Currently non-global system tables must be in the default database
742           tablespace. Global system tables can never be moved.
743
744         o Prevent parent tables from altering or dropping constraints
745           like CHECK that are inherited by child tables unless CASCADE
746           is used
747         o %Prevent child tables from altering or dropping constraints
748           like CHECK that were inherited from the parent table
749         o Have ALTER INDEX update the name of a constraint using that index
750         o Add ALTER TABLE RENAME CONSTRAINT, update index name also
751         o Allow column display reordering by recording a display,
752           storage, and permanent id for every column?
753
754           http://archives.postgresql.org/pgsql-hackers/2006-12/msg00782.php
755
756
757
758 * CLUSTER
759
760         o Automatically maintain clustering on a table
761
762           This might require some background daemon to maintain clustering
763           during periods of low usage. It might also require tables to be only
764           partially filled for easier reorganization.  Another idea would
765           be to create a merged heap/index data file so an index lookup would
766           automatically access the heap data too.  A third idea would be to
767           store heap rows in hashed groups, perhaps using a user-supplied
768           hash function.
769           http://archives.postgresql.org/pgsql-performance/2004-08/msg00349.php
770
771         o %Add default clustering to system tables
772
773           To do this, determine the ideal cluster index for each system
774           table and set the cluster setting during initdb.
775
776         o %Add VERBOSE option to report tables as they are processed,
777           like VACUUM VERBOSE
778
779
780 * COPY
781
782         o Allow COPY to report error lines and continue
783
784           This requires the use of a savepoint before each COPY line is
785           processed, with ROLLBACK on COPY failure.
786           http://archives.postgresql.org/pgsql-hackers/2007-12/msg00572.php
787
788         o Allow COPY on a newly-created table to skip WAL logging
789
790           On crash recovery, the table involved in the COPY would
791           be removed or have its heap and index files truncated.  One
792           issue is that no other backend should be able to add to
793           the table at the same time, which is something that is
794           currently allowed.  This currently is done if the table is
795           created inside the same transaction block as the COPY because
796           no other backends can see the table.
797
798         o Consider using a ring buffer for COPY FROM
799
800           http://archives.postgresql.org/pgsql-patches/2008-02/msg00140.php
801           http://archives.postgresql.org/pgsql-hackers/2008-02/msg01080.php
802
803         o Allow COPY FROM to create index entries in bulk
804
805           http://archives.postgresql.org/pgsql-hackers/2008-02/msg00811.php
806
807         o Allow COPY in CSV mode to control whether a quoted zero-length
808           string is treated as NULL
809
810           Currently this is always treated as a zero-length string,
811           which generates an error when loading into an integer column
812           http://archives.postgresql.org/pgsql-hackers/2007-07/msg00905.php
813
814
815
816 * GRANT/REVOKE
817
818         o Allow column-level privileges
819         o %Allow GRANT/REVOKE permissions to be applied to all schema objects
820           with one command
821
822           The proposed syntax is:
823                 GRANT SELECT ON ALL TABLES IN public TO phpuser;
824                 GRANT SELECT ON NEW TABLES IN public TO phpuser;
825
826         o Allow GRANT/REVOKE permissions to be inherited by objects based on
827           schema permissions
828
829         o Allow SERIAL sequences to inherit permissions from the base table?
830
831
832 * CURSOR
833
834         o Prevent DROP TABLE from dropping a row referenced by its own open
835           cursor?
836
837
838 * INSERT
839
840         o Allow INSERT/UPDATE of the system-generated oid value for a row
841         o In rules, allow VALUES() to contain a mixture of 'old' and 'new'
842           references
843
844
845 * SHOW/SET
846
847         o Add SET PERFORMANCE_TIPS option to suggest INDEX, VACUUM, VACUUM
848           ANALYZE, and CLUSTER
849
850
851
852 Referential Integrity
853 =====================
854
855 * Add MATCH PARTIAL referential integrity
856 * Change foreign key constraint for array -> element to mean element
857   in array?
858 * Fix problem when cascading referential triggers make changes on
859   cascaded tables, seeing the tables in an intermediate state
860
861   http://archives.postgresql.org/pgsql-hackers/2005-09/msg00174.php
862   http://archives.postgresql.org/pgsql-hackers/2005-09/msg00174.php
863
864 * Allow DEFERRABLE and end-of-statement UNIQUE constraints?
865
866   This would allow UPDATE tab SET col = col + 1 to work if col has
867   a unique index.  Currently, uniqueness checks are done while the
868   command is being executed, rather than at the end of the statement
869   or transaction.
870   http://people.planetpostgresql.org/greg/index.php?/archives/2006/06/10.html
871   http://archives.postgresql.org/pgsql-hackers/2006-09/msg01458.php
872
873 * Optimize referential integrity checks
874
875   http://archives.postgresql.org/pgsql-performance/2005-10/msg00458.php
876   http://archives.postgresql.org/pgsql-hackers/2007-04/msg00744.php
877
878
879 Server-Side Languages
880 =====================
881
882 * PL/pgSQL
883         o Fix RENAME to work on variables other than OLD/NEW
884
885           http://archives.postgresql.org/pgsql-hackers/2002-03/msg00591.php
886           http://archives.postgresql.org/pgsql-hackers/2007-01/msg01615.php
887           http://archives.postgresql.org/pgsql-hackers/2007-01/msg01587.php
888
889         o Allow function parameters to be passed by name,
890           get_employee_salary(12345 AS emp_id, 2001 AS tax_year)
891         o Allow handling of %TYPE arrays, e.g. tab.col%TYPE[]
892         o Allow listing of record column names, and access to
893           record columns via variables, e.g. columns := r.(*),
894           tval2 := r.(colname)
895
896           http://archives.postgresql.org/pgsql-patches/2005-07/msg00458.php
897           http://archives.postgresql.org/pgsql-patches/2006-05/msg00302.php
898           http://archives.postgresql.org/pgsql-patches/2006-06/msg00031.php
899
900         o Add support for SCROLL cursors
901         o Add support for WITH HOLD cursors
902         o Allow row and record variables to be set to NULL constants,
903           and allow NULL tests on such variables
904
905           Because a row is not scalar, do not allow assignment
906           from NULL-valued scalars.
907
908           http://archives.postgresql.org/pgsql-hackers/2006-10/msg00070.php
909
910         o Review handling of MOVE and FETCH
911
912           http://archives.postgresql.org/pgsql-patches/2007-04/msg00527.php
913
914         o Improve logic of determining if an identifier is a a
915           variable or column name
916
917           http://archives.postgresql.org/pgsql-hackers/2007-07/msg00436.php
918
919
920 * Other
921         o Add table function support to pltcl, plpythonu
922         o Add support for polymorphic arguments and return types to
923           languages other than PL/PgSQL
924         o Add capability to create and call PROCEDURES
925         o Add support for OUT and INOUT parameters to languages other
926           than PL/PgSQL
927         o Add PL/PythonU tracebacks
928
929           http://archives.postgresql.org/pgsql-patches/2006-02/msg00288.php
930
931         o Allow data to be passed in native language formats, rather
932           than only text
933
934           http://archives.postgresql.org/pgsql-hackers/2007-05/msg00289.php
935
936
937
938 Clients
939 =======
940
941 * Have pg_ctl look at PGHOST in case it is a socket directory?
942 * Allow pg_ctl to work properly with configuration files located outside
943   the PGDATA directory
944
945   pg_ctl can not read the pid file because it isn't located in the
946   config directory but in the PGDATA directory.  The solution is to
947   allow pg_ctl to read and understand postgresql.conf to find the
948   data_directory value.
949
950 * Add a function like pg_get_indexdef() that report more detailed index
951   information
952
953   http://archives.postgresql.org/pgsql-bugs/2007-12/msg00166.php
954
955 * Prefix command-line utilities like createuser with 'pg_'
956
957   http://archives.postgresql.org/pgsql-hackers/2007-06/msg00025.php
958
959
960 * psql
961         o Have psql show current values for a sequence
962         o Move psql backslash database information into the backend, use
963           mnemonic commands? [psql]
964
965           This would allow non-psql clients to pull the same information out
966           of the database as psql.
967
968         o Fix psql's \d commands more consistent
969
970           http://archives.postgresql.org/pgsql-hackers/2004-11/msg00014.php
971           http://archives.postgresql.org/pgsql-hackers/2004-11/msg00014.php
972
973         o Consistently display privilege information for all objects in psql
974         o Add auto-expanded mode so expanded output is used if the row
975           length is wider than the screen width.
976
977           Consider using auto-expanded mode for backslash commands like \df+.
978
979         o Prevent tab completion of SET TRANSACTION from querying the
980           database and therefore preventing the transaction isolation
981           level from being set.
982
983           Currently SET <tab> causes a database lookup to check all
984           supported session variables.  This query causes problems
985           because setting the transaction isolation level must be the
986           first statement of a transaction.
987
988         o Add a \set variable to control whether \s displays line numbers
989
990           Another option is to add \# which lists line numbers, and
991           allows command execution.
992
993           http://archives.postgresql.org/pgsql-hackers/2006-12/msg00255.php
994
995         o Prevent escape string warnings when object names have
996           backslashes
997
998           http://archives.postgresql.org/pgsql-hackers/2008-01/msg00227.php
999
1000         o Have \d show foreign keys that reference a table's primary key
1001
1002           http://archives.postgresql.org/pgsql-hackers/2007-04/msg00424.php
1003
1004         o Have \d show child tables that inherit from the specified parent
1005         o Have \l+ show database size, if permissions allow
1006
1007           Ideally it will not generate an error for invalid permissions
1008
1009         o Include the symbolic SQLSTATE name in verbose error reports
1010
1011           http://archives.postgresql.org/pgsql-general/2007-09/msg00438.php
1012
1013
1014 * pg_dump / pg_restore
1015         o %Add dumping of comments on index columns and composite type columns
1016         o %Add full object name to the tag field.  eg. for operators we need
1017           '=(integer, integer)', instead of just '='.
1018         o Add pg_dumpall custom format dumps?
1019         o Allow selection of individual object(s) of all types, not just
1020           tables
1021         o In a selective dump, allow dumping of an object and all its
1022           dependencies
1023         o Add options like pg_restore -l and -L to pg_dump
1024         o Stop dumping CASCADE on DROP TYPE commands in clean mode
1025         o Allow pg_dump --clean to drop roles that own objects or have
1026           privileges
1027         o Change pg_dump so that a comment on the dumped database is
1028           applied to the loaded database, even if the database has a
1029           different name.  This will require new backend syntax, perhaps
1030           COMMENT ON CURRENT DATABASE.
1031         o Remove unnecessary function pointer abstractions in pg_dump source
1032           code
1033         o Allow pg_dump to utilize multiple CPUs and I/O channels by dumping
1034           multiple objects simultaneously
1035
1036           The difficulty with this is getting multiple dump processes to
1037           produce a single dump output file.  It also would require
1038           several sessions to share the same snapshot.
1039           http://archives.postgresql.org/pgsql-hackers/2008-02/msg00205.php
1040
1041         o Allow pg_restore to utilize multiple CPUs and I/O channels by
1042           restoring multiple objects simultaneously
1043
1044           This might require a pg_restore flag to indicate how many
1045           simultaneous operations should be performed.  Only pg_dump's
1046           -Fc format has the necessary dependency information.
1047           http://archives.postgresql.org/pgsql-hackers/2008-02/msg00963.php
1048
1049         o To better utilize resources, allow pg_restore to check foreign
1050           keys simultaneously, where possible
1051         o Allow pg_restore to create all indexes of a table
1052           concurrently, via a single heap scan
1053
1054           This requires a pg_dump -Fc file because that format contains
1055           the required dependency information.
1056           http://archives.postgresql.org/pgsql-general/2007-05/msg01274.php
1057
1058         o Allow pg_restore to load different parts of the COPY data
1059           simultaneously
1060         o Prevent pg_dump/pg_restore from being affected by
1061           statement_timeout
1062
1063           Using psql to restore a pg_dump dump is also affected.
1064
1065         o Remove pre-7.3 pg_dump code that assumes pg_depend does not exit
1066         o Allow pre/data/post files when schema and data are dumped
1067           separately, for performance reasons
1068
1069           http://archives.postgresql.org/pgsql-hackers/2008-02/msg00205.php
1070
1071
1072
1073 * ecpg
1074         o Docs
1075
1076           Document differences between ecpg and the SQL standard and
1077           information about the Informix-compatibility module.
1078
1079         o Solve cardinality > 1 for input descriptors / variables?
1080         o Add a semantic check level, e.g. check if a table really exists
1081         o fix handling of DB attributes that are arrays
1082         o Use backend PREPARE/EXECUTE facility for ecpg where possible
1083         o Implement SQLDA
1084         o Fix nested C comments
1085         o %sqlwarn[6] should be 'W' if the PRECISION or SCALE value specified
1086         o Make SET CONNECTION thread-aware, non-standard?
1087         o Allow multidimensional arrays
1088         o Add internationalized message strings
1089         o Implement COPY FROM STDIN
1090
1091
1092 * libpq
1093         o Add PQescapeIdentifierConn()
1094         o Prevent PQfnumber() from lowercasing unquoted the column name
1095
1096           PQfnumber() should never have been doing lowercasing, but
1097           historically it has so we need a way to prevent it
1098
1099         o Allow statement results to be automatically batched to the client
1100
1101           Currently all statement results are transferred to the libpq
1102           client before libpq makes the results available to the
1103           application.  This feature would allow the application to make
1104           use of the first result rows while the rest are transferred, or
1105           held on the server waiting for them to be requested by libpq.
1106           One complexity is that a statement like SELECT 1/col could error
1107           out mid-way through the result set.
1108
1109         o Consider disallowing multiple queries in PQexec() as an
1110           additional barrier to SQL injection attacks
1111
1112           http://archives.postgresql.org/pgsql-hackers/2007-01/msg00184.php
1113
1114         o Add PQexecf() that allows complex parameter substitution
1115
1116           http://archives.postgresql.org/pgsql-hackers/2007-03/msg01803.php
1117
1118         o Add SQLSTATE severity to PGconn return status
1119
1120           http://archives.postgresql.org/pgsql-interfaces/2007-11/msg00015.php
1121
1122
1123 Triggers
1124 ========
1125
1126 * Add deferred trigger queue file
1127
1128   Right now all deferred trigger information is stored in backend
1129   memory.  This could exhaust memory for very large trigger queues.
1130   This item involves dumping large queues into files.
1131
1132 * Allow triggers to be disabled in only the current session.
1133
1134   This is currently possible by starting a multi-statement transaction,
1135   modifying the system tables, performing the desired SQL, restoring the
1136   system tables, and committing the transaction.  ALTER TABLE ...
1137   TRIGGER requires a table lock so it is not ideal for this usage.
1138
1139 * With disabled triggers, allow pg_dump to use ALTER TABLE ADD FOREIGN KEY
1140
1141   If the dump is known to be valid, allow foreign keys to be added
1142   without revalidating the data.
1143
1144 * Allow statement-level triggers to access modified rows
1145 * Support triggers on columns
1146
1147   http://archives.postgresql.org/pgsql-patches/2005-07/msg00107.php
1148
1149 * Allow AFTER triggers on system tables
1150
1151   System tables are modified in many places in the backend without going
1152   through the executor and therefore not causing triggers to fire. To
1153   complete this item, the functions that modify system tables will have
1154   to fire triggers.
1155
1156 * Tighten trigger permission checks
1157
1158   http://archives.postgresql.org/pgsql-hackers/2006-12/msg00564.php
1159
1160 * Allow BEFORE INSERT triggers on views
1161
1162   http://archives.postgresql.org/pgsql-general/2007-02/msg01466.php
1163
1164 * Add ability to trigger on TRUNCATE
1165
1166   http://archives.postgresql.org/pgsql-sql/2008-01/msg00050.php
1167
1168
1169
1170 Indexes
1171 =======
1172
1173 * Add UNIQUE capability to non-btree indexes
1174 * Prevent index uniqueness checks when UPDATE does not modify the column
1175
1176   Uniqueness (index) checks are done when updating a column even if the
1177   column is not modified by the UPDATE.
1178
1179 * Allow the creation of on-disk bitmap indexes which can be quickly
1180   combined with other bitmap indexes
1181
1182   Such indexes could be more compact if there are only a few distinct values.
1183   Such indexes can also be compressed.  Keeping such indexes updated can be
1184   costly.
1185
1186   http://archives.postgresql.org/pgsql-patches/2005-07/msg00512.php
1187   http://archives.postgresql.org/pgsql-hackers/2006-12/msg01107.php
1188
1189 * Allow accurate statistics to be collected on indexes with more than
1190   one column or expression indexes, perhaps using per-index statistics
1191
1192   http://archives.postgresql.org/pgsql-performance/2006-10/msg00222.php
1193   http://archives.postgresql.org/pgsql-hackers/2007-03/msg01131.php
1194
1195 * Consider increasing the number of default statistics target, and
1196   reduce statistics target overhead
1197
1198   Also consider having a larger statistics target for indexed columns
1199   and expression indexes
1200   http://archives.postgresql.org/pgsql-general/2007-05/msg01228.php
1201   http://archives.postgresql.org/pgsql-general/2007-06/msg00542.php
1202   http://archives.postgresql.org/pgsql-hackers/2008-01/msg01066.php
1203
1204 * Consider compressing indexes by storing key values duplicated in
1205   several rows as a single index entry
1206
1207   http://archives.postgresql.org/pgsql-hackers/2006-12/msg00341.php
1208   http://archives.postgresql.org/pgsql-hackers/2007-02/msg01264.php
1209   http://archives.postgresql.org/pgsql-hackers/2007-03/msg00465.php
1210   http://archives.postgresql.org/pgsql-patches/2007-03/msg00163.php
1211
1212 * Add REINDEX CONCURRENTLY, like CREATE INDEX CONCURRENTLY
1213
1214   This is difficult because you must upgrade to an exclusive table lock
1215   to replace the existing index file.  CREATE INDEX CONCURRENTLY does not
1216   have this complication.  This would allow index compaction without
1217   downtime.
1218   http://archives.postgresql.org/pgsql-performance/2007-08/msg00289.php
1219
1220 * Allow multiple indexes to be created concurrently, ideally via a
1221   single heap scan, and have pg_restore use it
1222
1223
1224
1225 * Inheritance
1226
1227         o Allow inherited tables to inherit indexes, UNIQUE constraints,
1228           and primary/foreign keys
1229         o Honor UNIQUE INDEX on base column in INSERTs/UPDATEs
1230           on inherited table, e.g.  INSERT INTO inherit_table
1231           (unique_index_col) VALUES (dup) should fail
1232
1233           The main difficulty with this item is the problem of
1234           creating an index that can span multiple tables.
1235
1236         o Allow SELECT ... FOR UPDATE on inherited tables
1237         o Require all CHECK constraints to be inherited
1238
1239           http://archives.postgresql.org/pgsql-bugs/2007-04/msg00026.php
1240
1241         o Add checks to prevent a CREATE RULE views on inherited tables
1242
1243           http://archives.postgresql.org/pgsql-general/2008-02/msg01420.php
1244           http://archives.postgresql.org/pgsql-general/2008-03/msg00077.php
1245
1246
1247 * GIST
1248
1249         o Add more GIST index support for geometric data types
1250         o Allow GIST indexes to create certain complex index types, like
1251           digital trees (see Aoki)
1252
1253
1254 * Hash
1255
1256           http://archives.postgresql.org/pgsql-hackers/2007-09/msg00051.php
1257
1258         o Pack hash index buckets onto disk pages more efficiently
1259
1260           Currently only one hash bucket can be stored on a page. Ideally
1261           several hash buckets could be stored on a single page and greater
1262           granularity used for the hash algorithm.
1263
1264           http://archives.postgresql.org/pgsql-hackers/2004-06/msg00168.php
1265
1266         o Consider sorting hash buckets so entries can be found using a
1267           binary search, rather than a linear scan
1268         o In hash indexes, consider storing the hash value with or instead
1269           of the key itself
1270         o Add WAL logging for crash recovery
1271         o Allow multi-column hash indexes
1272         o -During index creation, pre-sort the tuples to improve build speed
1273
1274
1275
1276 Fsync
1277 =====
1278
1279 * Determine optimal fdatasync/fsync, O_SYNC/O_DSYNC options
1280
1281   Ideally this requires a separate test program that can be run
1282   at initdb time or optionally later.  Consider O_SYNC when
1283   O_DIRECT exists.
1284
1285 * Add program to test if fsync has a delay compared to non-fsync
1286 * Consider sorting writes during checkpoint
1287
1288   http://archives.postgresql.org/pgsql-hackers/2007-06/msg00541.php
1289
1290
1291
1292 Cache Usage
1293 ===========
1294
1295 * Speed up COUNT(*)
1296
1297   We could use a fixed row count and a +/- count to follow MVCC
1298   visibility rules, or a single cached value could be used and
1299   invalidated if anyone modifies the table.  Another idea is to
1300   get a count directly from a unique index, but for this to be
1301   faster than a sequential scan it must avoid access to the heap
1302   to obtain tuple visibility information.
1303
1304 * Provide a way to calculate an "estimated COUNT(*)"
1305
1306   Perhaps by using the optimizer's cardinality estimates or random
1307   sampling.
1308
1309   http://archives.postgresql.org/pgsql-hackers/2005-11/msg00943.php
1310
1311 * Allow data to be pulled directly from indexes
1312
1313   Currently indexes do not have enough tuple visibility information
1314   to allow data to be pulled from the index without also accessing
1315   the heap.  One way to allow this is to set a bit on index tuples
1316   to indicate if a tuple is currently visible to all transactions
1317   when the first valid heap lookup happens.  This bit would have to
1318   be cleared when a heap tuple is expired.
1319
1320   Another idea is to maintain a bitmap of heap pages where all rows
1321   are visible to all backends, and allow index lookups to reference
1322   that bitmap to avoid heap lookups, perhaps the same bitmap we might
1323   add someday to determine which heap pages need vacuuming.  Frequently
1324   accessed bitmaps would have to be stored in shared memory.  One 8k
1325   page of bitmaps could track 512MB of heap pages.
1326
1327   A third idea would be for a heap scan to check if all rows are visible
1328   and if so set a per-table flag which can be checked by index scans. 
1329   Any change to the table would have to clear the flag.  To detect
1330   changes during the heap scan a counter could be set at the start and
1331   checked at the end --- if it is the same, the table has not been
1332   modified --- any table change would increment the counter.
1333
1334 * Consider automatic caching of statements at various levels:
1335
1336         o Parsed query tree
1337         o Query execute plan
1338         o Query results
1339
1340 * Consider increasing internal areas when shared buffers is increased
1341
1342   http://archives.postgresql.org/pgsql-hackers/2005-10/msg01419.php
1343
1344 * Consider decreasing the amount of memory used by PrivateRefCount
1345
1346   http://archives.postgresql.org/pgsql-hackers/2006-11/msg00797.php
1347   http://archives.postgresql.org/pgsql-hackers/2007-01/msg00752.php
1348
1349 * Consider allowing higher priority queries to have referenced buffer
1350   cache pages stay in memory longer
1351
1352   http://archives.postgresql.org/pgsql-hackers/2007-11/msg00562.php
1353
1354
1355
1356 Vacuum
1357 ======
1358
1359 * Improve speed with indexes
1360
1361   For large table adjustments during VACUUM FULL, it is faster to cluster
1362   or reindex rather than update the index.  Also, index updates can bloat
1363   the index.
1364
1365   http://archives.postgresql.org/pgsql-hackers/2007-03/msg00024.php
1366   http://archives.postgresql.org/pgsql-performance/2007-05/msg00296.php
1367   http://archives.postgresql.org/pgsql-hackers/2007-08/msg00307.php
1368
1369 * Auto-fill the free space map by scanning the buffer cache or by
1370   checking pages written by the background writer
1371
1372   http://archives.postgresql.org/pgsql-hackers/2006-02/msg01125.php
1373   http://archives.postgresql.org/pgsql-hackers/2006-03/msg00011.php
1374
1375 * Create a bitmap of pages that need vacuuming
1376
1377   Instead of sequentially scanning the entire table, have the background
1378   writer or some other process record pages that have expired rows, then
1379   VACUUM can look at just those pages rather than the entire table.  In
1380   the event of a system crash, the bitmap would probably be invalidated.
1381   One complexity is that index entries still have to be vacuumed, and
1382   doing this without an index scan (by using the heap values to find the
1383   index entry) might be slow and unreliable, especially for user-defined
1384   index functions.
1385
1386   http://archives.postgresql.org/pgsql-hackers/2006-12/msg01188.php
1387   http://archives.postgresql.org/pgsql-hackers/2007-01/msg00121.php
1388
1389 * Allow FSM to return free space toward the beginning of the heap file,
1390   in hopes that empty pages at the end can be truncated by VACUUM
1391 * Allow FSM page return free space based on table clustering, to assist
1392   in maintaining clustering?
1393 * Improve dead row detection during multi-statement transactions usage
1394
1395   http://archives.postgresql.org/pgsql-patches/2007-03/msg00358.php
1396
1397 * Consider a more compact data representation for dead tuples
1398
1399   http://archives.postgresql.org/pgsql-patches/2007-05/msg00143.php
1400
1401
1402 * Auto-vacuum
1403
1404         o %Issue log message to suggest VACUUM FULL if a table is nearly
1405           empty?
1406         o Improve control of auto-vacuum
1407
1408           http://archives.postgresql.org/pgsql-hackers/2006-12/msg00876.php
1409
1410         o Prevent long-lived temporary tables from causing frozen-xid
1411           advancement starvation
1412
1413           The problem is that autovacuum cannot vacuum them to set frozen xids;
1414           only the session that created them can do that.
1415           http://archives.postgresql.org/pgsql-general/2007-06/msg01645.php
1416
1417         o Store per-table autovacuum settings in pg_class.reloptions.
1418
1419           http://archives.postgresql.org/pgsql-hackers/2007-02/msg01440.php
1420           http://archives.postgresql.org/pgsql-hackers/2008-01/msg00724.php
1421
1422         o Prevent autovacuum from running if an old transaction is still
1423           running from the last vacuum
1424
1425           http://archives.postgresql.org/pgsql-hackers/2007-11/msg00899.php
1426
1427
1428
1429 Locking
1430 =======
1431
1432 * Fix priority ordering of read and write light-weight locks (Neil)
1433
1434   http://archives.postgresql.org/pgsql-hackers/2004-11/msg00893.php
1435   http://archives.postgresql.org/pgsql-hackers/2004-11/msg00905.php
1436
1437 * Fix problem when multiple subtransactions of the same outer transaction
1438   hold different types of locks, and one subtransaction aborts
1439
1440   http://archives.postgresql.org/pgsql-hackers/2006-11/msg01011.php
1441   http://archives.postgresql.org/pgsql-hackers/2006-12/msg00001.php
1442   http://archives.postgresql.org/pgsql-hackers/2007-02/msg00435.php
1443   http://archives.postgresql.org/pgsql-hackers/2007-05/msg00773.php
1444
1445 * Allow UPDATEs on only non-referential integrity columns not to conflict
1446   with referential integrity locks
1447
1448   http://archives.postgresql.org/pgsql-hackers/2007-02/msg00073.php
1449
1450 * Add idle_in_transaction_timeout GUC so locks are not held for long
1451   periods of time
1452
1453 * Improve deadlock detection when a page cleaning lock conflicts
1454   with a shared buffer that is pinned
1455
1456   http://archives.postgresql.org/pgsql-bugs/2008-01/msg00138.php
1457   http://archives.postgresql.org/pgsql-hackers/2008-01/msg00873.php
1458   http://archives.postgresql.org/pgsql-committers/2008-01/msg00365.php
1459
1460
1461
1462
1463 Startup Time Improvements
1464 =========================
1465
1466 * Experiment with multi-threaded backend for backend creation [thread]
1467
1468   This would prevent the overhead associated with process creation. Most
1469   operating systems have trivial process creation time compared to
1470   database startup overhead, but a few operating systems (Win32,
1471   Solaris) might benefit from threading.  Also explore the idea of
1472   a single session using multiple threads to execute a statement faster.
1473
1474
1475
1476 Write-Ahead Log
1477 ===============
1478
1479 * Eliminate need to write full pages to WAL before page modification [wal]
1480
1481   Currently, to protect against partial disk page writes, we write
1482   full page images to WAL before they are modified so we can correct any
1483   partial page writes during recovery.  These pages can also be
1484   eliminated from point-in-time archive files.
1485
1486         o  When off, write CRC to WAL and check file system blocks
1487            on recovery
1488
1489            If CRC check fails during recovery, remember the page in case
1490            a later CRC for that page properly matches.
1491
1492         o  Write full pages during file system write and not when
1493            the page is modified in the buffer cache
1494
1495            This allows most full page writes to happen in the background
1496            writer.  It might cause problems for applying WAL on recovery
1497            into a partially-written page, but later the full page will be
1498            replaced from WAL.
1499
1500 * Allow WAL traffic to be streamed to another server for stand-by
1501   replication
1502 * Reduce WAL traffic so only modified values are written rather than
1503   entire rows
1504
1505   http://archives.postgresql.org/pgsql-hackers/2007-03/msg01589.php
1506
1507 * Allow WAL information to recover corrupted pg_controldata
1508
1509   http://archives.postgresql.org/pgsql-patches/2006-06/msg00025.php
1510
1511 * Find a way to reduce rotational delay when repeatedly writing
1512   last WAL page
1513
1514   Currently fsync of WAL requires the disk platter to perform a full
1515   rotation to fsync again. One idea is to write the WAL to different
1516   offsets that might reduce the rotational delay.
1517
1518 * Allow WAL logging to be turned off for a table, but the table
1519   might be dropped or truncated during crash recovery [walcontrol]
1520
1521   Allow tables to bypass WAL writes and just fsync() dirty pages on
1522   commit.  This should be implemented using ALTER TABLE, e.g. ALTER
1523   TABLE PERSISTENCE [ DROP | TRUNCATE | DEFAULT ].  Tables using
1524   non-default logging should not use referential integrity with
1525   default-logging tables.  A table without dirty buffers during a
1526   crash could perhaps avoid the drop/truncate.
1527
1528 * Allow WAL logging to be turned off for a table, but the table would
1529   avoid being truncated/dropped [walcontrol]
1530
1531   To do this, only a single writer can modify the table, and writes
1532   must happen only on new pages so the new pages can be removed during
1533   crash recovery.  Readers can continue accessing the table.  Such
1534   tables probably cannot have indexes.  One complexity is the handling
1535   of indexes on TOAST tables.
1536
1537 * Speed WAL recovery by allowing more than one page to be prefetched
1538
1539   This should be done utilizing the same infrastructure used for
1540   prefetching in general to avoid introducing complex error-prone code
1541   in WAL replay.
1542   http://archives.postgresql.org/pgsql-general/2007-12/msg00683.php
1543   http://archives.postgresql.org/pgsql-hackers/2007-12/msg00497.php
1544   http://archives.postgresql.org/pgsql-hackers/2008-02/msg01279.php
1545
1546 * Improve WAL concurrency by increasing lock granularity
1547
1548   http://archives.postgresql.org/pgsql-hackers/2008-02/msg00556.php
1549
1550
1551
1552 Optimizer / Executor
1553 ====================
1554
1555 * Improve selectivity functions for geometric operators
1556 * Precompile SQL functions to avoid overhead
1557 * Create utility to compute accurate random_page_cost value
1558 * Improve ability to display optimizer analysis using OPTIMIZER_DEBUG
1559 * Have EXPLAIN ANALYZE issue NOTICE messages when the estimated and
1560   actual row counts differ by a specified percentage
1561 * Consider using hash buckets to do DISTINCT, rather than sorting
1562
1563   This would be beneficial when there are few distinct values.  This is
1564   already used by GROUP BY.
1565
1566 * Log statements where the optimizer row estimates were dramatically
1567   different from the number of rows actually found?
1568 * Consider compressed annealing to search for query plans
1569
1570   This might replace GEQO, http://sixdemonbag.org/Djinni.
1571
1572 * Improve merge join performance by allowing mark/restore of
1573   tuple sources
1574
1575   http://archives.postgresql.org/pgsql-hackers/2007-01/msg00096.php
1576
1577 * Consider using a hash for joining to a large IN (VALUES ...) list
1578
1579   http://archives.postgresql.org/pgsql-hackers/2007-05/msg00450.php
1580
1581
1582
1583 Background Writer
1584 =================
1585
1586 * Consider having the background writer update the transaction status
1587   hint bits before writing out the page
1588
1589   Implementing this requires the background writer to have access to system
1590   catalogs and the transaction status log.
1591
1592 * Consider adding buffers the background writer finds reusable to the
1593   free list 
1594
1595   http://archives.postgresql.org/pgsql-hackers/2007-04/msg00781.php
1596
1597 * Automatically tune bgwriter_delay based on activity rather then using a
1598   fixed interval
1599
1600   http://archives.postgresql.org/pgsql-hackers/2007-04/msg00781.php
1601
1602 * Consider wither increasing BM_MAX_USAGE_COUNT improves performance
1603
1604   http://archives.postgresql.org/pgsql-hackers/2007-06/msg01007.php
1605
1606 * Test to see if calling PreallocXlogFiles() from the background writer
1607   will help with WAL segment creation latency
1608
1609   http://archives.postgresql.org/pgsql-patches/2007-06/msg00340.php
1610
1611
1612
1613 Miscellaneous Performance
1614 =========================
1615
1616 * Do async I/O for faster random read-ahead of data
1617
1618   Async I/O allows multiple I/O requests to be sent to the disk with
1619   results coming back asynchronously.
1620
1621   http://archives.postgresql.org/pgsql-hackers/2006-10/msg00820.php
1622   http://archives.postgresql.org/pgsql-performance/2007-09/msg00255.php
1623   http://archives.postgresql.org/pgsql-hackers/2007-12/msg00027.php
1624   http://archives.postgresql.org/pgsql-patches/2008-01/msg00170.php
1625
1626 * Use mmap() rather than SYSV shared memory or to write WAL files?
1627
1628   This would remove the requirement for SYSV SHM but would introduce
1629   portability issues. Anonymous mmap (or mmap to /dev/zero) is required
1630   to prevent I/O overhead.
1631
1632 * Consider mmap()'ing files into a backend?
1633
1634   Doing I/O to large tables would consume a lot of address space or
1635   require frequent mapping/unmapping.  Extending the file also causes
1636   mapping problems that might require mapping only individual pages,
1637   leading to thousands of mappings.  Another problem is that there is no
1638   way to _prevent_ I/O to disk from the dirty shared buffers so changes
1639   could hit disk before WAL is written.
1640
1641 * Add a script to ask system configuration questions and tune postgresql.conf
1642 * Consider ways of storing rows more compactly on disk
1643
1644         o Reduce the row header size?
1645         o Consider reducing on-disk varlena length from four bytes to
1646           two because a heap row cannot be more than 64k in length
1647
1648 * Consider increasing NUM_CLOG_BUFFERS
1649
1650   http://archives.postgresql.org/pgsql-hackers/2007-08/msg00030.php
1651   http://archives.postgresql.org/pgsql-performance/2007-08/msg00024.php
1652
1653 * Allow user configuration of TOAST thresholds
1654
1655   http://archives.postgresql.org/pgsql-hackers/2007-02/msg00213.php
1656   http://archives.postgresql.org/pgsql-hackers/2007-08/msg00082.php
1657
1658 * Allow configuration of backend priorities via the operating system
1659
1660   Though backend priorities make priority inversion during lock
1661   waits possible, research shows that this is not a huge problem.
1662
1663   http://archives.postgresql.org/pgsql-general/2007-02/msg00493.php
1664
1665 * Experiment with multi-threaded backend better I/O utilization
1666
1667   This would allow a single query to make use of multiple I/O channels
1668   simultaneously.  One idea is to create a background reader that can
1669   pre-fetch sequential and index scan pages needed by other backends.
1670   This could be expanded to allow concurrent reads from multiple devices
1671   in a partitioned table.
1672
1673 * Experiment with multi-threaded backend better CPU utilization
1674
1675   This would allow several CPUs to be used for a single query, such as
1676   for sorting or query execution.
1677
1678 * Consider increasing the minimum allowed number of shared buffers
1679
1680   http://archives.postgresql.org/pgsql-bugs/2008-02/msg00157.php
1681
1682 * Expire published xmin for read-only and idle transactions
1683
1684   http://archives.postgresql.org/pgsql-hackers/2007-09/msg00343.php
1685
1686 * Consider if CommandCounterIncrement() can avoid its
1687   AcceptInvalidationMessages() call
1688
1689   http://archives.postgresql.org/pgsql-committers/2007-11/msg00585.php
1690
1691 * Improve performance of shared invalidation queue for multiple CPUs
1692
1693   http://archives.postgresql.org/pgsql-performance/2008-01/msg00023.php
1694
1695 * Consider Cartesian joins when both relations are needed to form an
1696   indexscan qualification for a third relation
1697
1698   http://archives.postgresql.org/pgsql-performance/2007-12/msg00090.php
1699
1700 * Consider not storing a NULL bitmap on disk if all the NULLs are
1701   trailing
1702
1703   http://archives.postgresql.org/pgsql-hackers/2007-12/msg00624.php
1704   http://archives.postgresql.org/pgsql-patches/2007-12/msg00109.php
1705
1706 * Sort large UPDATE/DELETEs so it is done in heap order
1707
1708   http://archives.postgresql.org/pgsql-hackers/2008-01/msg01119.php
1709
1710 * Avoid tuple some tuple copying in sort routines
1711
1712   http://archives.postgresql.org/pgsql-hackers/2008-02/msg01206.php
1713   http://archives.postgresql.org/pgsql-patches/2008-02/msg00176.php
1714
1715
1716
1717 Source Code
1718 ===========
1719
1720 * Add use of 'const' for variables in source tree
1721 * Move some things from contrib into main tree
1722 * %Remove warnings created by -Wcast-align
1723 * Move platform-specific ps status display info from ps_status.c to ports
1724 * Add optional CRC checksum to heap and index pages
1725 * Improve documentation to build only interfaces (Marc)
1726 * Remove or relicense modules that are not under the BSD license, if possible
1727 * Acquire lock on a relation before building a relcache entry for it
1728 * Allow cross-compiling by generating the zic database on the target system
1729 * Improve NLS maintenance of libpgport messages linked onto applications
1730 * Clean up casting in contrib/isn
1731
1732   http://archives.postgresql.org/pgsql-hackers/2006-11/msg00245.php
1733
1734 * Use UTF8 encoding for NLS messages so all server encodings can
1735   read them properly
1736 * Update Bonjour to work with newer cross-platform SDK
1737
1738   http://archives.postgresql.org/pgsql-hackers/2006-09/msg02238.php
1739   http://archives.postgresql.org/pgsql-patches/2006-10/msg00048.php
1740
1741 * Consider detoasting keys before sorting
1742 * Consider GnuTLS if OpenSSL license becomes a problem
1743
1744   http://archives.postgresql.org/pgsql-patches/2006-05/msg00040.php
1745   http://archives.postgresql.org/pgsql-hackers/2006-12/msg01213.php
1746
1747 * Consider changing documentation format from SGML to XML
1748
1749   http://archives.postgresql.org/pgsql-docs/2006-12/msg00152.php
1750
1751 * Consider making NAMEDATALEN more configurable in future releases
1752 * Update our code to handle 64-bit timezone files to match the zic
1753   source code, which now uses them
1754 * Have configure choose integer datetimes by default
1755
1756   http://archives.postgresql.org/pgsql-patches/2007-05/msg00046.php
1757
1758 * Support scoped IPv6 addresses
1759
1760   http://archives.postgresql.org/pgsql-bugs/2007-05/msg00111.php
1761
1762 * Consider allowing 64-bit integers and floats to be passed by value on
1763   64-bit platforms
1764
1765   Also change 32-bit floats (float4) to be passed by value at the same
1766   time.
1767
1768 * Research use of signals and sleep wake ups
1769
1770   http://archives.postgresql.org/pgsql-hackers/2007-07/msg00003.php
1771
1772 * Add automated check for invalid C++ source code constructs
1773
1774   http://archives.postgresql.org/pgsql-patches/2007-07/msg00056.php
1775
1776 * Consider simplifying how memory context resets handle child contexts
1777
1778   http://archives.postgresql.org/pgsql-patches/2007-08/msg00067.php
1779
1780 * Remove use of MAKE_PTR and MAKE_OFFSET macros
1781
1782   http://archives.postgresql.org/pgsql-general/2007-08/msg01510.php
1783
1784 * Convert single quotes to apostrophes in the PDF documentation
1785
1786   http://archives.postgresql.org/pgsql-docs/2007-12/msg00059.php
1787
1788
1789
1790 * Win32
1791
1792         o Remove configure.in check for link failure when cause is found
1793         o Remove readdir() errno patch when runtime/mingwex/dirent.c rev
1794           1.4 is released
1795         o Remove psql newline patch when we find out why mingw outputs an
1796           extra newline
1797         o Allow psql to use readline once non-US code pages work with
1798           backslashes
1799         o Fix problem with shared memory on the Win32 Terminal Server
1800         o Diagnose problem where shared memory can sometimes not be
1801           attached by postmaster children
1802
1803           http://archives.postgresql.org/pgsql-general/2007-08/msg01377.php
1804
1805         o Improve signal handling
1806
1807           http://archives.postgresql.org/pgsql-patches/2005-06/msg00027.php
1808
1809         o Convert MSVC build system to remove most batch files
1810
1811           http://archives.postgresql.org/pgsql-hackers/2007-08/msg00961.php
1812
1813         o Prevent SSL from sending network packets to avoid interference
1814           with Win32 signal emulation
1815
1816           http://archives.postgresql.org/pgsql-hackers/2007-12/msg00455.php
1817
1818         o Support pgxs when using MSVC
1819
1820         o Fix MSVC NLS support, like for to_char()
1821
1822           http://archives.postgresql.org/pgsql-hackers/2008-02/msg00485.php
1823           http://archives.postgresql.org/pgsql-patches/2008-02/msg00038.php
1824
1825
1826
1827 * Wire Protocol Changes
1828
1829         o Allow dynamic character set handling
1830         o Add decoded type, length, precision
1831         o Use compression?
1832         o Update clients to use data types, typmod, schema.table.column names
1833           of result sets using new statement protocol
1834
1835
1836 Exotic Features
1837 ===============
1838
1839 * Add pre-parsing phase that converts non-ISO syntax to supported
1840   syntax
1841
1842   This could allow SQL written for other databases to run without
1843   modification.
1844
1845 * Allow plug-in modules to emulate features from other databases
1846 * Add features of Oracle-style packages  (Pavel)
1847
1848   A package would be a schema with session-local variables,
1849   public/private functions, and initialization functions.  It
1850   is also possible to implement these capabilities
1851   in any schema and not use a separate "packages"
1852   syntax at all.
1853
1854   http://archives.postgresql.org/pgsql-hackers/2006-08/msg00384.php
1855
1856 * Consider allowing control of upper/lower case folding of unquoted
1857   identifiers
1858
1859   http://archives.postgresql.org/pgsql-hackers/2004-04/msg00818.php
1860   http://archives.postgresql.org/pgsql-hackers/2006-10/msg01527.php
1861
1862 * Add autonomous transactions
1863
1864   http://archives.postgresql.org/pgsql-hackers/2008-01/msg00893.php
1865
1866
1867
1868 Features We Do _Not_ Want
1869 =========================
1870
1871 * All backends running as threads in a single process (not wanted)
1872
1873   This eliminates the process protection we get from the current setup.
1874   Thread creation is usually the same overhead as process creation on
1875   modern systems, so it seems unwise to use a pure threaded model.
1876
1877 * Optimizer hints (not wanted)
1878
1879   Optimizer hints are used to work around problems in the optimizer.  We
1880   would rather have the problems reported and fixed.
1881
1882   http://archives.postgresql.org/pgsql-hackers/2006-08/msg00506.php
1883   http://archives.postgresql.org/pgsql-hackers/2006-10/msg00517.php
1884   http://archives.postgresql.org/pgsql-hackers/2006-10/msg00663.php
1885
1886
1887   Because we support postfix operators, it isn't possible to make AS
1888   optional and continue to use bison.
1889   http://archives.postgresql.org/pgsql-hackers/2003-04/msg00436.php
1890
1891   http://archives.postgresql.org/pgsql-sql/2006-08/msg00164.php
1892
1893 * Embedded server (not wanted)
1894
1895   While PostgreSQL clients runs fine in limited-resource environments, the
1896   server requires multiple processes and a stable pool of resources to
1897   run reliabily and efficiently.  Stripping down the PostgreSQL server
1898   to run in the same process address space as the client application
1899   would add too much complexity and failure cases.