mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-11-21 03:13:05 +08:00
HISTORY file update.
This commit is contained in:
parent
ba63dcd6a6
commit
30b2d287fb
49
HISTORY
49
HISTORY
@ -1,8 +1,9 @@
|
||||
PostgreSQL 6.4 Tue Sep 1 21:18:17 EDT 1998
|
||||
PostgreSQL 6.4 Sat Oct 24 00:41:35 EDT 1998
|
||||
=========================================================
|
||||
|
||||
A dump/restore is required for those wishing to migrate data from
|
||||
previous releases of PostgreSQL.
|
||||
previous releases of PostgreSQL. You may also use the new pg_upgrade
|
||||
utility to avoid a dump/reload.
|
||||
|
||||
Bug Fixes
|
||||
---------
|
||||
@ -21,12 +22,13 @@ Fix a bug in the oracle compatibility functions btrim() ltrim() and rtrim()
|
||||
Fix for usernames longer than eight characters(Tom)
|
||||
Fix for shared invalidation cache overflow(Massimo)
|
||||
Prevent file descriptor leaks in failed COPY's(Bruce)
|
||||
Fix problem with username/passwords over 8 characters(Tom)
|
||||
|
||||
Enhancements
|
||||
------------
|
||||
Upgrade ECPG to 2.0, see src/interfaces/ecpc/ChangeLog(Michael)
|
||||
Upgrade ecpg and ecpglib,see src/interfaces/ecpc/ChangeLog(Michael)
|
||||
Show the index used in an explain(Zeugswetter)
|
||||
Multi-byte awareness of many data data types and functions(Tatsuo)
|
||||
Multi-byte awareness of many data types and functions, via configure(Tatsuo)
|
||||
New configure --with-mb option(Tatsuo)
|
||||
New initdb --pgencoding option(Tatsuo)
|
||||
New createdb -E multibyte option(Tatsuo)
|
||||
@ -64,6 +66,7 @@ Pg_hba.conf now has a sameuser option in the database field
|
||||
Make lo_unlink take oid param, not int4
|
||||
New DISABLE_COMPLEX_MACRO for compilers that can't handle our macros(Bruce)
|
||||
Libpgtcl now gets async notifies from libpq(Tom)
|
||||
libpgtcl cleanups(Tom)
|
||||
New locale patch, see docs/README/locale(Oleg)
|
||||
Fix for pg_dump so CONSTRAINT and CHECK syntax is correct(ccb)
|
||||
New contrib/lo code for large object orphan removal(Peter)
|
||||
@ -74,8 +77,9 @@ Libpq can now be compiled on win32(Magnus)
|
||||
Add PQsetdbLogin() in libpq
|
||||
Two styles we agreed upon for database descriptors(Thomas)
|
||||
New 8-byte integer type, checked by configure for OS support(Thomas)
|
||||
Better support for quited table/column names(Thomas)
|
||||
Surround table and column names with double-quotes(Thomas) in generated
|
||||
sql code to preserve case (SQL92 syntax)(Thomas)
|
||||
sql code to preserve case (SQL92 syntax)(Thomas)
|
||||
New libpqrequestCancel(Tom)
|
||||
PQreset() now works with passwords(Tom)
|
||||
Handle case of GROUP BY target list column number out of range(David)
|
||||
@ -118,9 +122,13 @@ New rewrite system fixes many problems with rules and views(Jan)
|
||||
* Rules and views inherit the permissions on the creator
|
||||
* No rules at the column level
|
||||
* No UPDATE NEW/OLD rules
|
||||
* New pg_rule and pg_view system views
|
||||
* New pg_tables, pg_indexes, pg_rules and pg_views system views
|
||||
* Only a single action on SELECT rules
|
||||
* Total rewrite overhaul, perhaps for 6.5
|
||||
* handle subselects
|
||||
* handle aggregates on views
|
||||
* handle insert into select from view works
|
||||
*
|
||||
|
||||
System indexes are now multi-key(Bruce)
|
||||
Oidint2, oidint4, and oidname types are removed(Bruce)
|
||||
@ -133,9 +141,27 @@ New setval() command to set sequence value(Massimo)
|
||||
Auto-remove unix socket file on startup if no postmaster running(Massimo)
|
||||
Conditional trace package(Massimo)
|
||||
New UNLISTEN command(Massimo)
|
||||
Psql now compiles under win32 using win32.mak(Magnus)
|
||||
Psql and libpq now compile under win32 using win32.mak(Magnus)
|
||||
Lo_read no longer stores trailing NULL(Bruce)
|
||||
Identifiers are now truncated to 31 characters internally(Bruce)
|
||||
Createuser options now availble on the command line
|
||||
PL/pgSQL backend programming language(Jan)
|
||||
Code for 64-bit integer supported added, configure tested, int8 type(Thomas)
|
||||
Prevent file descriptor leaf from failed COPY(Bruce)
|
||||
New pg_upgrade command(Bruce)
|
||||
Updated /contrib directories(Massimo)
|
||||
New CREATE TABLE DEFAULT VALUES statement available(Thomas)
|
||||
New INSERT INTO TABLE DEFAULT VALUES statement available(Thomas)
|
||||
New DECLARE and FETCH feature(Thomas)
|
||||
libpq's internal structures now not exported(Tom)
|
||||
Allow up to 8 key indexes(Bruce)
|
||||
Remove ARCHIVE keyword, that is no longer used(Thomas)
|
||||
pg_dump -n flag to supress quotes around indentifiers
|
||||
disable system columns for views(Jan)
|
||||
net INET and CIDR types for network addresses(TomH, Paul)
|
||||
no more double quotes in psql output
|
||||
pg_dump now dumps views(Terry)
|
||||
new SET QUERY_LIMIT(Tatsuo,Jan)
|
||||
|
||||
Source Tree Changes
|
||||
-------------------
|
||||
@ -155,11 +181,18 @@ Update backend flowchart in tools/backend(Bruce)
|
||||
Change atttypmod from int16 to int32(Bruce, Tom)
|
||||
Getrusage() fix for platforms that do not have it(Tom)
|
||||
Add PGUSER to libpq man page
|
||||
Ns32k platform fixes(Phil Nelson)
|
||||
NS32K platform fixes(Phil Nelson, John Buller)
|
||||
Sco 7/UnixWare 2.x fixes(Billy,others)
|
||||
Sparc/Solaris 2.5 fixes(Ryan)
|
||||
Pgbuiltin.3 is obsolete, move to doc files(Thomas)
|
||||
Even more documention(Thomas)
|
||||
Nextstep support(Jacek)
|
||||
Aix support(David)
|
||||
pginterface manual page(Bruce)
|
||||
shared libraries all have version numbers
|
||||
merged all OS-specific shared library defines into one file
|
||||
smarter TCL/TK configuration checking(Billy)
|
||||
smarter perl configuration(Brook)
|
||||
|
||||
|
||||
|
||||
|
272
doc/FAQ
272
doc/FAQ
@ -1,7 +1,7 @@
|
||||
|
||||
Frequently Asked Questions (FAQ) for PostgreSQL
|
||||
|
||||
Last updated: Sun Aug 30 00:01:22 EDT 1998
|
||||
Last updated: Sat Oct 24 00:12:23 EDT 1998
|
||||
|
||||
Current maintainer: Bruce Momjian (maillist@candle.pha.pa.us)
|
||||
|
||||
@ -15,10 +15,8 @@
|
||||
http://postgreSQL.org/docs/faq-irix.shtml.
|
||||
_________________________________________________________________
|
||||
|
||||
Questions answered:
|
||||
|
||||
1) General questions
|
||||
|
||||
General questions
|
||||
|
||||
1.1) What is PostgreSQL?
|
||||
1.2) What does PostgreSQL run on?
|
||||
1.3) Where can I get PostgreSQL?
|
||||
@ -37,8 +35,8 @@ Questions answered:
|
||||
1.14) How can I learn SQL?
|
||||
1.15) What languages are available to communicate with PostgreSQL?
|
||||
|
||||
2) Installation/Configuration questions
|
||||
|
||||
Installation/Configuration questions
|
||||
|
||||
2.1) initdb doesn't run
|
||||
2.2) when I start up the postmaster, I get "FindBackend: could not
|
||||
find a backend to execute..." "postmaster: could not find backend to
|
||||
@ -54,17 +52,17 @@ Questions answered:
|
||||
change?
|
||||
2.8) How do I prevent other hosts from accessing my PostgreSQL
|
||||
database?
|
||||
2.9) I can't access the database as the 'root' user.
|
||||
2.9) I can't access the database as the root user.
|
||||
2.10) All my servers crash under concurrent table access. Why?
|
||||
2.11) How do I tune the database engine for better performance?
|
||||
2.12) What debugging features are available in PostgreSQL?
|
||||
2.13) How do I enable more than 64 concurrent backends? 2.14) What
|
||||
non-unix ports are available?
|
||||
2.13) How do I enable more than 64 concurrent backends?
|
||||
2.14) What non-unix ports are available?
|
||||
|
||||
3) Operational questions
|
||||
|
||||
Operational questions
|
||||
|
||||
3.1) Does PostgreSQL support nested subqueries?
|
||||
3.2) How can I write client applications to PostgreSQL?
|
||||
3.2) How can I write client applications for PostgreSQL?
|
||||
3.3) How do I set up a pg_group?
|
||||
3.4) What is the exact difference between binary cursors and normal
|
||||
cursors?
|
||||
@ -82,13 +80,13 @@ Questions answered:
|
||||
3.13) How do I create a serial/auto-incrementing field?
|
||||
3.14) What are the pg_psort.XXX files in my database directory?
|
||||
3.15) Why can't I connect to my database from another machine?
|
||||
3.16) How do I find out what indexes or operations are defined in the
|
||||
3.16) How do I find out what indices or operations are defined in the
|
||||
database?
|
||||
3.17) What is an oid? What is a tid?
|
||||
3.18) What is the meaning of some of the terms used in PostgreSQL?
|
||||
3.19) What is Genetic Query Optimization?
|
||||
3.20) How do you remove a column from a table?
|
||||
3.21) How do SELECT only the first few rows of a query?
|
||||
3.21) How do I select only the first few rows of a query?
|
||||
3.22) How much database disk space is required to store data from a
|
||||
typical flat file?
|
||||
3.23) How do I get a list of tables, or other things I can see in
|
||||
@ -97,8 +95,8 @@ Questions answered:
|
||||
exhausted?"
|
||||
3.25) How do I tell what PostgreSQL version I am running?
|
||||
|
||||
4) Questions about extending PostgreSQL
|
||||
|
||||
Questions about extending PostgreSQL
|
||||
|
||||
4.1) I wrote a user-defined function and when I run it in psql, it
|
||||
dumps core.
|
||||
4.2) I get messages of the type NOTICE:PortalHeapMemoryFree:
|
||||
@ -106,8 +104,8 @@ Questions answered:
|
||||
4.3) I've written some nifty new types and functions for PostgreSQL.
|
||||
4.4) How do I write a C function to return a tuple?
|
||||
|
||||
5) Bugs
|
||||
|
||||
Bugs
|
||||
|
||||
5.1) How do I make a bug report?
|
||||
_________________________________________________________________
|
||||
|
||||
@ -146,7 +144,7 @@ Section 1: General Questions
|
||||
* aix - IBM on AIX 3.2.5 or 4.x
|
||||
* alpha - DEC Alpha AXP on Digital Unix 2.0, 3.2, 4.0
|
||||
* BSD44_derived - OSs derived from 4.4-lite BSD (NetBSD, FreeBSD)
|
||||
* bsdi - BSD/OS 2.0, 2.01, 2.1, 3.0
|
||||
* bsdi - BSD/OS 2.x, 3.x, 4.x
|
||||
* dgux - DG/UX 5.4R4.11
|
||||
* hpux - HP PA-RISC on HP-UX 9.0, 10
|
||||
* i386_solaris - i386 Solaris
|
||||
@ -159,9 +157,6 @@ Section 1: General Questions
|
||||
* svr4 - Intel x86 on Intel SVR4 and MIPS
|
||||
* ultrix4 - DEC MIPS on Ultrix 4.4
|
||||
|
||||
The following platforms have known problems/bugs:
|
||||
* nextstep - Motorola MC68K or Intel x86 on NeXTSTEP 3.2
|
||||
|
||||
1.3) Where can I get PostgreSQL?
|
||||
|
||||
The primary anonymous ftp site for PostgreSQL is:
|
||||
@ -203,9 +198,8 @@ Section 1: General Questions
|
||||
|
||||
1.5) Support for PostgreSQL
|
||||
|
||||
There is no official support for PostgreSQL from the original
|
||||
maintainers or from University of California, Berkeley. It is
|
||||
maintained through volunteer effort only.
|
||||
There is no official support for PostgreSQL from the University of
|
||||
California, Berkeley. It is maintained through volunteer effort.
|
||||
|
||||
The main mailing list is: pgsql-general@postgreSQL.org. It is
|
||||
available for discussion of matters pertaining to PostgreSQL, For info
|
||||
@ -247,7 +241,7 @@ Section 1: General Questions
|
||||
|
||||
1.6) Latest release of PostgreSQL
|
||||
|
||||
The latest release of PostgreSQL is version 6.4 beta.
|
||||
The latest release of PostgreSQL is version 6.4.
|
||||
|
||||
We plan to have major releases every four months.
|
||||
|
||||
@ -255,32 +249,31 @@ Section 1: General Questions
|
||||
|
||||
Illustra Information Technology (a wholly owned subsidiary of Informix
|
||||
Software, Inc.) sells an object-relational DBMS called Illustra that
|
||||
was originally based on postgres. Illustra has cosmetic similarities
|
||||
to PostgreSQL but has more features, is more robust, performs better,
|
||||
and offers real support. On the flip side, it costs money. For more
|
||||
information, contact sales@illustra.com
|
||||
was originally based on Postgres. For more information, contact
|
||||
sales@illustra.com
|
||||
|
||||
1.8) What documentation is available for PostgreSQL?
|
||||
|
||||
Several manuals, manual pages, and some small test examples are
|
||||
included in the distribution. See the /doc directory. The pgintro,
|
||||
sql, and pgbuiltin manual pages are particularly important. pgintro
|
||||
contains a list of all available manual pages.
|
||||
included in the distribution. See the /doc directory.
|
||||
|
||||
psql has some nice \d commands to show information about types,
|
||||
operators, functions, aggregates, etc.
|
||||
|
||||
The www page contains pointers to an implementation guide and five
|
||||
papers written about Postgres design concepts and features.
|
||||
The web page contains even more documentation.
|
||||
|
||||
1.9) What version of SQL does PostgreSQL use?
|
||||
|
||||
PostgreSQL supports an extended subset of SQL-92.
|
||||
|
||||
It is Y2K compliant.
|
||||
|
||||
1.10) Does PostgreSQL work with databases from earlier versions of
|
||||
PostgreSQL?
|
||||
|
||||
Upgrading to 6.4 from earlier releases requires a dump and restore.
|
||||
Upgrading to 6.4 from release 6.3.* can be accomplished using the new
|
||||
pg_upgrade utility. Those upgrading from earlier releases require a
|
||||
dump and restore.
|
||||
|
||||
Those ugrading from versions earlier than 1.09 must upgrade to 1.09
|
||||
first without a dump/reload, then dump the data from 1.09, and then
|
||||
@ -313,9 +306,9 @@ Section 1: General Questions
|
||||
PHP is great for simple stuff, but for more complex stuff, some still
|
||||
use the perl interface and CGI.pm.
|
||||
|
||||
An WWW gatway based on WDB using perl can be downloaded from:
|
||||
* http://www.eol.ists.ca/~dunlop/wdb -p95
|
||||
|
||||
An WWW gatway based on WDB using perl can be downloaded from
|
||||
http://www.eol.ists.ca/~dunlop/wdb-p95
|
||||
|
||||
1.13) Does PostgreSQL have a graphical user interface? A report generator? A
|
||||
embedded query language interface?
|
||||
|
||||
@ -323,8 +316,8 @@ Section 1: General Questions
|
||||
shipped as part of the distribtion. Pgaccess also has a report
|
||||
generator.
|
||||
|
||||
We also have ecpg, which is an embedded SQL query language interface
|
||||
for C. This is also included.
|
||||
The web page is http://www.flex.ro/pgaccess We also include ecpg,
|
||||
which is an embedded SQL query language interface for C.
|
||||
|
||||
1.14) How can I learn SQL?
|
||||
|
||||
@ -354,17 +347,15 @@ Section 2: Installation Questions
|
||||
2.1) initdb doesn't run
|
||||
|
||||
* check that you don't have any of the previous version's binaries
|
||||
in your path
|
||||
in your path (If you see the message WARN:heap_modifytuple: repl
|
||||
is \ 9, this is the problem.)
|
||||
* check to see that you have the proper paths set
|
||||
* check that the 'postgres' user owns all the right files
|
||||
* ensure that there are files in $PGDATA/files, and that they are
|
||||
non-empty. If they aren't, then "gmake install" failed for some
|
||||
reason
|
||||
* check that the postgres user owns the proper files
|
||||
|
||||
2.2) when I start up the postmaster, I get "FindBackend: could not find a
|
||||
backend to execute..." "postmaster: could not find backend to execute..."
|
||||
|
||||
You probably do not have the right path set up. The 'postgres'
|
||||
You probably do not have the right path set up. The postgres
|
||||
executable needs to be in your path.
|
||||
|
||||
2.3) The system seems to be confused about commas, decimal points, and date
|
||||
@ -383,7 +374,7 @@ Section 2: Installation Questions
|
||||
|
||||
It could be a variety of problems, but first check to see that you
|
||||
have system V extensions installed on your kernel. PostgreSQL requires
|
||||
kernel support for shared memory.
|
||||
kernel support for shared memory and semaphores.
|
||||
|
||||
2.6) When I try to start the postmaster, I get IpcMemoryCreate errors.
|
||||
|
||||
@ -396,16 +387,16 @@ Section 2: Installation Questions
|
||||
2.7) I have changed a source file, but a recompile does not see the change?
|
||||
|
||||
The Makefiles do not have the proper dependencies for include files.
|
||||
You have to do a 'make clean' and then another 'make'.
|
||||
You have to do a make clean and then another make.
|
||||
|
||||
2.8) How do I prevent other hosts from accessing my PostgreSQL database?
|
||||
|
||||
By default, PostgreSQL only allows connections from the local machine
|
||||
using unix domain. You must add the -i flag to the postmaster, and
|
||||
enable host-based authentication by modifying the file $PGDATA/pg_hba
|
||||
accordingly.
|
||||
using unix domain sockets. You must add the -i flag to the postmaster,
|
||||
and enable host-based authentication by modifying the file
|
||||
$PGDATA/pg_hba accordingly.
|
||||
|
||||
2.9) I can't access the database as the 'root' user.
|
||||
2.9) I can't access the database as the root user.
|
||||
|
||||
You should not create database users with user id 0(root). They will
|
||||
be unable to access the database. This is a security precaution
|
||||
@ -419,28 +410,32 @@ Section 2: Installation Questions
|
||||
|
||||
2.11) How do I tune the database engine for better performance?
|
||||
|
||||
If you are doing a lot of INSERTs, consider doing them in a large
|
||||
batch using the COPY command. This is much faster than single
|
||||
individual INSERTs. Second, statements not in a BEGIN WORK/COMMIT
|
||||
Certainly, indices can speed up queries. The explain command allows
|
||||
you to see how PostgreSQL is interpreting your query, and which
|
||||
indices are being used.
|
||||
|
||||
If you are doing a lot of inserts, consider doing them in a large
|
||||
batch using the copy command. This is much faster than single
|
||||
individual inserts. Second, statements not in a begin work/commit
|
||||
transaction block are considered to be their in their own transaction.
|
||||
Consider performing several statements in a single transaction block.
|
||||
This reduces the transaction overhead. Also consider dropping and
|
||||
recreating indexes when making large data changes.
|
||||
recreating indices when making large data changes.
|
||||
|
||||
There are several tuning things that can be done. You can disable
|
||||
fsync() by starting the postmaster with a '-o -F' option. This will
|
||||
fsync() by starting the postmaster with a -o -F option. This will
|
||||
prevent fsync()'s from flushing to disk after every transaction.
|
||||
|
||||
You can also use the postmaster -B option to increase the number of
|
||||
shared memory buffers shared among the backend processes. If you make
|
||||
this parameter too high, the process will not start or crash
|
||||
unexpectedly. Each buffer is 8K and the defualt is 64 buffers.
|
||||
shared memory buffers used by the backend processes. If you make this
|
||||
parameter too high, the backends will not start or crash unexpectedly.
|
||||
Each buffer is 8K and the default is 64 buffers.
|
||||
|
||||
You can also use the postgres -S option to increase the maximum amount
|
||||
of memory used by each backend process for temporary sorts. Each
|
||||
buffer is 1K and the defualt is 512 buffers.
|
||||
|
||||
You can also use the CLUSTER command to group data in base tables to
|
||||
You can also use the cluster command to group data in base tables to
|
||||
match an index. See the cluster(l) manual page for more details.
|
||||
|
||||
2.12) What debugging features are available in PostgreSQL?
|
||||
@ -460,14 +455,14 @@ Section 2: Installation Questions
|
||||
./bin/postmaster >server.log 2>&1 &
|
||||
|
||||
This will put a server.log file in the top-level PostgreSQL directory.
|
||||
This file can contain useful information about problems or errors
|
||||
This file contains useful information about problems or errors
|
||||
encountered by the server. Postmaster has a -d option that allows even
|
||||
more detailed information to be reported. The -d option takes a number
|
||||
1-3 that specifies the debug level. Be warned that a debug level of 3
|
||||
that specifies the debug level. Be warned that high debug level values
|
||||
generates large log files.
|
||||
|
||||
You can actuall run the postgres backend from the command line, and
|
||||
type your SQL statement directly. This is recommended ONLY for
|
||||
You can actually run the postgres backend from the command line, and
|
||||
type your SQL statement directly. This is recommended only for
|
||||
debugging purposes. Note that a newline terminates the query, not a
|
||||
semicolon. If you have compiled with debugging symbols, you can use a
|
||||
debugger to see what is happening. Because the backend was not started
|
||||
@ -484,9 +479,6 @@ Section 2: Installation Questions
|
||||
pgsql/data/base/dbname directory. The client profile file will be put
|
||||
in the current directory.
|
||||
|
||||
The EXPLAIN command (see this FAQ) allows you to see how PostgreSQL is
|
||||
interpreting your query.
|
||||
|
||||
2.13) How do I enable more than 64 concurrent backends?
|
||||
|
||||
Edit include/storage/sinvaladt.h, and change the value of
|
||||
@ -503,24 +495,22 @@ Section 2: Installation Questions
|
||||
A file win32.mak is included in the distributiion for making a Win32
|
||||
libpq library and psql.
|
||||
|
||||
People have attempted to port our PostgreSQL database server to
|
||||
Windows NT using the Cygnus Unix/NT porting library, but no one has
|
||||
succeeded yet.
|
||||
Someone is attempting to port our PostgreSQL database server to
|
||||
Windows NT using the Cygnus Unix/NT porting library. He has gotten it
|
||||
compiled, but initdb is currently failing.
|
||||
_________________________________________________________________
|
||||
|
||||
Section 3: PostgreSQL Features
|
||||
|
||||
3.1) Does PostgreSQL support nested subqueries?
|
||||
|
||||
Yes.
|
||||
Yes, fully supported, but only in the where clause, not in the target
|
||||
list.
|
||||
|
||||
3.2) How can I write client applications to PostgreSQL?
|
||||
3.2) How can I write client applications for PostgreSQL?
|
||||
|
||||
PostgreSQL supports a C-callable library interface called libpq as
|
||||
well as many others. See the /src/interfaces directory.
|
||||
|
||||
Others have contributed a perl interface and a WWW gateway to
|
||||
PostgreSQL. See the PostgreSQL home pages for more details.
|
||||
well as many others. See the above list of supported languages.
|
||||
|
||||
3.3) How do I set up a pg_group?
|
||||
|
||||
@ -552,7 +542,7 @@ Section 3: PostgreSQL Features
|
||||
handle range searches. A B-tree index only handles range searches in a
|
||||
single dimension. R-tree's can handle multi-dimensional data. For
|
||||
example, if an R-tree index can be built on an attribute of type
|
||||
'point', the system can more efficient answer queries like select all
|
||||
point, the system can more efficient answer queries like select all
|
||||
points within a bounding rectangle.
|
||||
|
||||
The canonical paper that describes the original R-Tree design is:
|
||||
@ -582,23 +572,19 @@ Section 3: PostgreSQL Features
|
||||
3.7) I defined indices but my queries don't seem to make use of them. Why?
|
||||
|
||||
PostgreSQL does not automatically maintain statistics. One has to make
|
||||
an explicit 'vacuum' call to update the statistics. After statistics
|
||||
are updated, the optimizer has a better shot at using indices. Note
|
||||
that the optimizer is limited and does not use indices in some
|
||||
circumstances (such as OR clauses). For column-specific optimization
|
||||
statistics, use 'vacuum analyze'.
|
||||
an explicit vacuum call to update the statistics. After statistics are
|
||||
updated, the optimizer knows how many rows in the table, and can
|
||||
better decide if it should use indices. Note that the optimizer does
|
||||
not use indices in cases when the table is small because a sequentail
|
||||
scan would be faster. For column-specific optimization statistics, use
|
||||
vacuum analyze.
|
||||
|
||||
If the system still does not see the index, it is probably because you
|
||||
have created an index on a field with the improper *_ops type. For
|
||||
example, you have created a CHAR(4) field, but have specified a
|
||||
char_ops index type_class.
|
||||
Indexes are not used for order by operations.
|
||||
|
||||
See the create_index manual page for information on what type classes
|
||||
are available. It must match the field type.
|
||||
|
||||
PostgreSQL does not warn the user when the improper index is created.
|
||||
|
||||
Indexes not used for ORDER BY operations.
|
||||
When using wildcard operators like LIKE or ~, indices can only be used
|
||||
if the beginning of the search is anchored to the start of the string.
|
||||
So, to use indices, LIKE searches can should not begin with %, and
|
||||
~(regular expression searches) should start with ^.
|
||||
|
||||
3.8) How do I do regular expression searches? case-insensitive regexp
|
||||
searching?
|
||||
@ -623,11 +609,11 @@ BYTEA bytea variable-length array of bytes
|
||||
You need to use the internal name when doing internal operations.
|
||||
|
||||
The last four types above are "varlena" types (i.e. the first four
|
||||
bytes are the length, followed by the data). CHAR(#) allocates the
|
||||
bytes are the length, followed by the data). char(#) allocates the
|
||||
maximum number of bytes no matter how much data is stored in the
|
||||
field. TEXT, VARCHAR(#), and BYTEA all have variable length on the
|
||||
field. text, varchar(#), and bytea all have variable length on the
|
||||
disk, and because of this, there is a small performance penalty for
|
||||
using them. Specifically, the penalty is for access to any columns
|
||||
using them. Specifically, the penalty is for access to all columns
|
||||
after the first column of this type.
|
||||
|
||||
3.11) In a query, how do I detect if a field is NULL?
|
||||
@ -640,39 +626,17 @@ BYTEA bytea variable-length array of bytes
|
||||
|
||||
3.13) How do I create a serial/auto-incrementing field?
|
||||
|
||||
PostgreSQL does not allow the user to specifiy a user column as type
|
||||
SERIAL. Instead, you can use each row's oid field as a unique value.
|
||||
However, if you need to dump and reload the database, you need to use
|
||||
pgdump's -o option or COPY's WITH OIDS option to preserver the oids.
|
||||
|
||||
We also have a SEQUENCE function that is very similar to SERIAL. See
|
||||
the create_sequence manual page.
|
||||
|
||||
Another valid way of doing this is to create a function:
|
||||
|
||||
create table my_oids (f1 int4);
|
||||
insert into my_oids values (1);
|
||||
create function new_oid () returns int4 as
|
||||
'update my_oids set f1 = f1 + 1; select f1 from my_oids; '
|
||||
language 'sql';
|
||||
|
||||
then:
|
||||
|
||||
create table my_stuff (my_key int4, value text);
|
||||
insert into my_stuff values (new_oid(), 'hello');
|
||||
|
||||
However, keep in mind there is a race condition here where one server
|
||||
could do the update, then another one do an update, and they both
|
||||
could select the same new id. This statement should be performed
|
||||
within a transaction.
|
||||
|
||||
Yet another way is to use general trigger function autoinc() from
|
||||
contrib/spi/autoinc.c.
|
||||
PostgreSQL supports a serial data type. It auto-creates a sequence and
|
||||
index on the column. See the create_sequence manual page for more
|
||||
information about sequences. You can also use each row's oid field as
|
||||
a unique value. However, if you need to dump and reload the database,
|
||||
you need to use pgdump's -o option or copy with oids option to
|
||||
preserve the oids.
|
||||
|
||||
3.14) What are the pg_psort.XXX files in my database directory?
|
||||
|
||||
They are temporary sort files generated by the query executor. For
|
||||
example, if a sort needs to be done to satisfy an ORDER BY, some temp
|
||||
example, if a sort needs to be done to satisfy an order by, some temp
|
||||
files are generated as a result of the sort.
|
||||
|
||||
If you have no transactions or sorts running at the time, it is safe
|
||||
@ -685,28 +649,27 @@ BYTEA bytea variable-length array of bytes
|
||||
postmaster -i option You need to add a host entry to the file
|
||||
pgsql/data/pg_hba. See the pg_hba.conf manual page.
|
||||
|
||||
3.16) How do I find out what indexes or operations are defined in the
|
||||
3.16) How do I find out what indices or operations are defined in the
|
||||
database?
|
||||
|
||||
psql has a variety of backslash commands to show such information. Use
|
||||
\? to see them.
|
||||
|
||||
Also try the file pgsql/src/tutorial/syscat.source. It illustrates
|
||||
many of the 'select's needed to get information out of the database
|
||||
many of the selects needed to get information out of the database
|
||||
system tables.
|
||||
|
||||
3.17) What is an oid? What is a tid?
|
||||
|
||||
Oids are PostgreSQL's answer to unique row ids or serial columns.
|
||||
Every row that is created in PostgreSQL gets a unique oid. All oids
|
||||
generated by initdb are less than 16384 (from
|
||||
backend/access/transam.h). All post-initdb (user-created) oids are
|
||||
equal or greater that this. By default, all these oids are unique not
|
||||
only within a table, or database, but unique within the entire
|
||||
PostgreSQL installation.
|
||||
Oids are PostgreSQL's answer to unique row ids. Every row that is
|
||||
created in PostgreSQL gets a unique oid. All oids generated during
|
||||
initdb are less than 16384 (from backend/access/transam.h). All
|
||||
user-created oids are equal or greater that this. By default, all
|
||||
these oids are unique not only within a table, or database, but unique
|
||||
within the entire PostgreSQL installation.
|
||||
|
||||
PostgreSQL uses oids in its internal system tables to link rows in
|
||||
separate tables. These oids can be used to identify specific user rows
|
||||
PostgreSQL uses oids in its internal system tables to link rows
|
||||
between tables. These oids can be used to identify specific user rows
|
||||
and used in joins. It is recommended you use column type oid to store
|
||||
oid values. See the sql(l) manual page to see the other internal
|
||||
columns. You can create an index on the oid field for faster access.
|
||||
@ -720,8 +683,7 @@ BYTEA bytea variable-length array of bytes
|
||||
|
||||
Tids are used to indentify specific physical rows with block and
|
||||
offset values. Tids change after rows are modified or reloaded. They
|
||||
are used by index entries to point to physical rows. They can not be
|
||||
accessed through sql.
|
||||
are used by index entries to point to physical rows.
|
||||
|
||||
3.18) What is the meaning of some of the terms used in PostgreSQL?
|
||||
|
||||
@ -737,8 +699,6 @@ BYTEA bytea variable-length array of bytes
|
||||
* portal, cursor
|
||||
* range variable, table name, table alias
|
||||
|
||||
Please let me know if you think of any more.
|
||||
|
||||
3.19) What is Genetic Query Optimization?
|
||||
|
||||
The GEQO module in PostgreSQL is intended to solve the query
|
||||
@ -750,7 +710,7 @@ BYTEA bytea variable-length array of bytes
|
||||
|
||||
3.20) How do you remove a column from a table?
|
||||
|
||||
We do not support ALTER TABLE DROP COLUMN, but do this:
|
||||
We do not support alter table drop column, but do this:
|
||||
|
||||
SELECT ... -- select all columns but the one you want to remove
|
||||
INTO TABLE new_table
|
||||
@ -758,15 +718,14 @@ BYTEA bytea variable-length array of bytes
|
||||
DROP TABLE old_table;
|
||||
ALTER TABLE new_table RENAME TO old_table;
|
||||
|
||||
3.21) How do SELECT only the first few rows of a query?
|
||||
3.21) How do I select only the first few rows of a query?
|
||||
|
||||
See the fetch manual page.
|
||||
|
||||
This only prevents all row results from being transfered to the
|
||||
client. The entire query must be evaluated, even if you only want just
|
||||
the first few rows. Consider a query that has and an ORDER BY. There
|
||||
is no way to return any rows until the entire query is evaluated and
|
||||
sorted.
|
||||
the first few rows. Consider a query that has an order by. There is no
|
||||
way to return any rows until the entire query is evaluated and sorted.
|
||||
|
||||
3.22)How much database disk space is required to store data from a typical
|
||||
flat file?
|
||||
@ -812,10 +771,10 @@ being indexed, so they can be large also.
|
||||
|
||||
Depending on your shell, only one of these may succeed, but it will
|
||||
set your process data segment limit much higher and perhaps allow the
|
||||
query to complete. This command applies the current process, and all
|
||||
subprocesses created after the command is run. If are having a problem
|
||||
with the SQL client because the backend is returning too much data,
|
||||
try it before starting the client.
|
||||
query to complete. This command applies to the current process, and
|
||||
all subprocesses created after the command is run. If are having a
|
||||
problem with the SQL client because the backend is returning too much
|
||||
data, try it before starting the client.
|
||||
|
||||
3.25) How do I tell what PostgreSQL version I am running?
|
||||
|
||||
@ -848,9 +807,8 @@ Section 4: Extending PostgreSQL
|
||||
|
||||
4.4) How do I write a C function to return a tuple?
|
||||
|
||||
This requires extreme wizardry, so extreme that the authors have not
|
||||
ever tried it, though in principle it can be done. The short answer is
|
||||
... you can't. This capability is forthcoming in the future.
|
||||
This requires extreme wizardry so extreme that the authors have not
|
||||
ever tried it, though in principle it can be done.
|
||||
_________________________________________________________________
|
||||
|
||||
Section 5: Bugs
|
||||
@ -860,9 +818,7 @@ Section 5: Bugs
|
||||
Check the current FAQ at http://postgreSQL.org
|
||||
|
||||
Also check out our ftp site ftp://ftp.postgreSQL.org/pub to see if
|
||||
there is a more recent PostgreSQL version.
|
||||
there is a more recent PostgreSQL version or patches.
|
||||
|
||||
You can also fill out the "bug-template" file and send it to:
|
||||
* bugs@postgreSQL.org
|
||||
|
||||
This is the address of the developers mailing list.
|
||||
bugs@postgreSQL.org
|
||||
|
377
doc/FAQ_DEV
377
doc/FAQ_DEV
@ -1,35 +1,40 @@
|
||||
Developer's Frequently Asked Questions (FAQ) for PostgreSQL
|
||||
|
||||
Last updated: Wed Feb 11 20:23:01 EST 1998
|
||||
|
||||
Current maintainer: Bruce Momjian (maillist@candle.pha.pa.us)
|
||||
|
||||
The most recent version of this document can be viewed at the postgreSQL Web
|
||||
site, http://postgreSQL.org.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Questions answered:
|
||||
|
||||
1) What tools are available for developers?
|
||||
2) What books are good for developers?
|
||||
3) Why do we use palloc() and pfree() to allocate memory?
|
||||
4) Why do we use Node and List to make data structures?
|
||||
5) How do I add a feature or fix a bug?
|
||||
6) How do I download/update the current source tree?
|
||||
7) How do I test my changes?
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
1) What tools are available for developers?
|
||||
|
||||
Aside from the User documentation mentioned in the regular FAQ, there
|
||||
are several development tools available. First, all the files in the
|
||||
pgsql/src/tools directory are designed for developers.
|
||||
|
||||
Developer's Frequently Asked Questions (FAQ) for PostgreSQL
|
||||
|
||||
Last updated: Fri Oct 2 15:21:32 EDT 1998
|
||||
|
||||
Current maintainer: Bruce Momjian (maillist@candle.pha.pa.us)
|
||||
|
||||
The most recent version of this document can be viewed at the
|
||||
postgreSQL Web site, http://postgreSQL.org.
|
||||
_________________________________________________________________
|
||||
|
||||
Questions
|
||||
|
||||
1) What tools are available for developers?
|
||||
2) What books are good for developers?
|
||||
3) Why do we use palloc() and pfree() to allocate memory?
|
||||
4) Why do we use Node and List to make data structures?
|
||||
5) How do I add a feature or fix a bug?
|
||||
6) How do I download/update the current source tree?
|
||||
7) How do I test my changes?
|
||||
7) I just added a field to a structure. What else should I do?
|
||||
8) Why are table, column, type, function, view names sometimes
|
||||
referenced as Name or NameData, and sometimes as char *?
|
||||
9) How do I efficiently access information in tables from the backend
|
||||
code?
|
||||
10) What is elog()?
|
||||
_________________________________________________________________
|
||||
|
||||
1) What tools are available for developers?
|
||||
|
||||
Aside from the User documentation mentioned in the regular FAQ, there
|
||||
are several development tools available. First, all the files in the
|
||||
/tools directory are designed for developers.
|
||||
RELEASE_CHANGES changes we have to make for each release
|
||||
SQL_keywords standard SQL'92 keywords
|
||||
backend web flowchart of the backend directories
|
||||
backend description/flowchart of the backend directorie
|
||||
s
|
||||
ccsym find standard defines made by your compiler
|
||||
entab converts tabs to spaces, used by pgindent
|
||||
find_static finds functions that could be made static
|
||||
@ -42,104 +47,230 @@ pgsql/src/tools directory are designed for developers.
|
||||
mkldexport create AIX exports file
|
||||
pgindent indents C source files
|
||||
|
||||
Let me note some of these. If you point your browser at the
|
||||
pgsql/src/tools/backend directory, you will see all the backend
|
||||
components in a flow chart. You can click on any one to see a
|
||||
description. If you then click on the directory name, you will be taken
|
||||
to the source directory, to browse the actual source code behind it. We
|
||||
also have several README files in some source directories to describe
|
||||
the function of the module. The browser will display these when you
|
||||
enter the directory also. The pgsql/src/tools/backend directory is also
|
||||
contained on our web page under the title Backend Flowchart.
|
||||
Let me note some of these. If you point your browser at the
|
||||
file:/usr/local/src/pgsql/src/tools/backend/index.html directory, you
|
||||
will see few paragraphs describing the data flow, the backend
|
||||
components in a flow chart, and a description of the shared memory
|
||||
area. You can click on any flowchart box to see a description. If you
|
||||
then click on the directory name, you will be taken to the source
|
||||
directory, to browse the actual source code behind it. We also have
|
||||
several README files in some source directories to describe the
|
||||
function of the module. The browser will display these when you enter
|
||||
the directory also. The tools/backend directory is also contained on
|
||||
our web page under the title How PostgreSQL Processes a Query.
|
||||
|
||||
Second, you really should have an editor that can handle tags, so you
|
||||
can tag a function call to see the function definition, and then tag
|
||||
inside that function to see an even lower-level function, and then
|
||||
back out twice to return to the original function. Most editors
|
||||
support this via tags or etags files.
|
||||
|
||||
Third, you need to get mkid from ftp.postgresql.org. By running
|
||||
tools/make_mkid, an archive of source symbols can be created that can
|
||||
be rapidly queried like grep or edited.
|
||||
|
||||
make_diff has tools to create patch diff files that can be applied to
|
||||
the distribution.
|
||||
|
||||
pgindent will format source files to match our standard format, which
|
||||
has four-space tabs, and an indenting format specified by flags to the
|
||||
your operating system's utility indent.
|
||||
|
||||
pgindent is run on all source files just before each beta test period.
|
||||
It auto-formats all source files to make them consistent. Comment
|
||||
blocks that need specific line breaks should be formatted as block
|
||||
comments, where the comment starts as /*------. These comments will
|
||||
not be reformatted in any way.
|
||||
|
||||
2) What books are good for developers?
|
||||
|
||||
I have four good books, An Introduction to Database Systems, by C.J.
|
||||
Date, Addison, Wesley, A Guide to the SQL Standard, by C.J. Date, et.
|
||||
al, Addison, Wesley, Fundamentals of Database Systems, by Elmasri and
|
||||
Navathe, and Transaction Processing, by Jim Gray, Morgan, Kaufmann
|
||||
|
||||
There is also a database performance site, with a handbook on-line
|
||||
written by Jim Gray at http://www.benchmarkresources.com.
|
||||
|
||||
3) Why do we use palloc() and pfree() to allocate memory?
|
||||
|
||||
palloc() and pfree() are used in place of malloc() and free() because
|
||||
we automatically free all memory allocated when a transaction
|
||||
completes. This makes it easier to make sure we free memory that gets
|
||||
allocated in one place, but only freed much later. There are several
|
||||
contexts that memory can be allocated in, and this controls when the
|
||||
allocated memory is automatically freed by the backend.
|
||||
|
||||
4) Why do we use Node and List to make data structures?
|
||||
|
||||
We do this because this allows a consistent way to pass data inside
|
||||
the backend in a flexible way. Every node has a NodeTag which
|
||||
specifies what type of data is inside the Node. Lists are lists of
|
||||
Nodes. lfirst(), lnext(), and foreach() are used to get, skip, and
|
||||
traverse through Lists.
|
||||
|
||||
You can print nodes easily inside gdb. First, to disable output
|
||||
truncation:
|
||||
|
||||
Second, you really should have an editor that can handle tags, so you can
|
||||
tag a function call to see the function definition, and then tag inside that
|
||||
function to see an even lower-level function, and then back out twice to
|
||||
return to the original function. Most editors support this via tags or etags
|
||||
files.
|
||||
(gdb) set print elements 0
|
||||
|
||||
Third, you need to get mkid from ftp.postgresql.org. By running
|
||||
tools/make_mkid, an archive of source symbols can be created that can be
|
||||
rapidly queried like grep or edited.
|
||||
You may then use either of the next two commands to print out List,
|
||||
Node, and structure contents. The first prints in a short format, and
|
||||
the second in a long format:
|
||||
|
||||
make_diff has tools to create patch diff files that can be applied to the
|
||||
distribution.
|
||||
(gdb) call print(any_pointer)
|
||||
(gdb) call pprint(any_pointer)
|
||||
|
||||
pgindent will format source files to match our standard format, which has
|
||||
four-space tabs, and an indenting format specified by flags to the your
|
||||
operating system's utility indent.
|
||||
5) How do I add a feature or fix a bug?
|
||||
|
||||
The source code is over 250,000 lines. Many problems/features are
|
||||
isolated to one specific area of the code. Others require knowledge of
|
||||
much of the source. If you are confused about where to start, ask the
|
||||
hackers list, and they will be glad to assess the complexity and give
|
||||
pointers on where to start.
|
||||
|
||||
Another thing to keep in mind is that many fixes and features can be
|
||||
added with surprisingly little code. I often start by adding code,
|
||||
then looking at other areas in the code where similar things are done,
|
||||
and by the time I am finished, the patch is quite small and compact.
|
||||
|
||||
When adding code, keep in mind that it should use the existing
|
||||
facilities in the source, for performance reasons and for simplicity.
|
||||
Often a review of existing code doing similar things is helpful.
|
||||
|
||||
6) How do I download/update the current source tree?
|
||||
|
||||
There are several ways to obtain the source tree. Occasional
|
||||
developers can just get the most recent source tree snapshot from
|
||||
ftp.postgresql.org. For regular developers, you can use CVS. CVS
|
||||
allows you to download the source tree, then occasionally update your
|
||||
copy of the source tree with any new changes. Using CVS, you don't
|
||||
have to download the entire source each time, only the changed files.
|
||||
Anonymous CVS does not allows developers to update the remote source
|
||||
tree, though privileged developers can do this. There is a CVS FAQ on
|
||||
our web site that describes how to use remote CVS. You can also use
|
||||
CVSup, which has similarly functionality, and is available from
|
||||
ftp.postgresql.org.
|
||||
|
||||
To update the source tree, there are two ways. You can generate a
|
||||
patch against your current source tree, perhaps using the make_diff
|
||||
tools mentioned above, and send them to the patches list. They will be
|
||||
reviewed, and applied in a timely manner. If the patch is major, and
|
||||
we are in beta testing, the developers may wait for the final release
|
||||
before applying your patches.
|
||||
|
||||
For hard-core developers, Marc(scrappy@postgresql.org) will give you a
|
||||
Unix shell account on postgresql.org, so you can use CVS to update the
|
||||
main source tree, or you can ftp your files into your account, patch,
|
||||
and cvs install the changes directly into the source tree.
|
||||
|
||||
6) How do I test my changes?
|
||||
|
||||
First, use psql to make sure it is working as you expect. Then run
|
||||
src/test/regress and get the output of src/test/regress/checkresults
|
||||
with and without your changes, to see that your patch does not change
|
||||
the regression test in unexpected ways. This practice has saved me
|
||||
many times. The regression tests test the code in ways I would never
|
||||
do, and has caught many bugs in my patches. By finding the problems
|
||||
now, you save yourself a lot of debugging later when things are
|
||||
broken, and you can't figure out when it happened.
|
||||
|
||||
7) I just added a field to a structure. What else should I do?
|
||||
|
||||
The structures passing around from the parser, rewrite, optimizer, and
|
||||
executor require quite a bit of support. Most structures have support
|
||||
routines in src/backend/nodes used to create, copy, read, and output
|
||||
those structures. Make sure you add support for your new field to
|
||||
these files. Find any other places the structure may need code for
|
||||
your new field. mkid is helpful with this (see above).
|
||||
|
||||
8) Why are table, column, type, function, view names sometimes referenced as
|
||||
Name or NameData, and sometimes as char *?
|
||||
|
||||
Table, column, type, function, and view names are stored in system
|
||||
tables in columns of type Name. Name is a fixed-length,
|
||||
null-terminated type of NAMEDATALEN bytes. (The default value for
|
||||
NAMEDATALEN is 32 bytes.)
|
||||
typedef struct nameData
|
||||
{
|
||||
char data[NAMEDATALEN];
|
||||
} NameData;
|
||||
typedef NameData *Name;
|
||||
|
||||
2) What books are good for developers?
|
||||
Table, column, type, function, and view names that come in to the
|
||||
backend via user queries are stored as variable-length,
|
||||
null-terminated character strings.
|
||||
|
||||
Many functions are called with both types of names, ie. heap_open().
|
||||
Because the Name type is null-terminated, it is safe to pass it to a
|
||||
function expecting a char *. Because there are many cases where
|
||||
on-disk names(Name) are compared to user-supplied names(char *), there
|
||||
are many cases where Name and char * are used interchangeably.
|
||||
|
||||
9) How do I efficiently access information in tables from the backend code?
|
||||
|
||||
You first need to find the tuples(rows) you are interested in. There
|
||||
are two ways. First, SearchSysCacheTuple() and related functions allow
|
||||
you to query the system catalogs. This is the preferred way to access
|
||||
system tables, because the first call to the cache loads the needed
|
||||
rows, and future requests can return the results without accessing the
|
||||
base table. Some of the caches use system table indexes to look up
|
||||
tuples. A list of available caches is located in
|
||||
src/backend/utils/cache/syscache.c.
|
||||
src/backend/utils/cache/lsyscache.c contains many column-specific
|
||||
cache lookup functions.
|
||||
|
||||
The rows returned are cached-owned versions of the heap rows. They are
|
||||
invalidated when the base table changes. Because the cache is local to
|
||||
each backend, you may use the pointer returned from the cache for
|
||||
short periods without making a copy of the tuple. If you send the
|
||||
pointer into a large function that will be doing its own cache
|
||||
lookups, it is possible the cache entry may be flushed, so you should
|
||||
use SearchSysCacheTupleCopy() in these cases, and pfree() the tuple
|
||||
when you are done.
|
||||
|
||||
If you can't use the system cache, you will need to retrieve the data
|
||||
directly from the heap table, using the buffer cache that is shared by
|
||||
all backends. The backend automatically takes care of loading the rows
|
||||
into the buffer cache.
|
||||
|
||||
Open the table with heap_open(). You can then start a table scan with
|
||||
heap_beginscan(), then use heap_getnext() and continue as long as
|
||||
HeapTupleIsValid() returns true. Then do a heap_endscan(). Keys can be
|
||||
assigned to the scan. No indexes are used, so all rows are going to be
|
||||
compared to the keys, and only the valid rows returned.
|
||||
|
||||
You can also use heap_fetch() to fetch rows by block number/offset.
|
||||
While scans automatically lock/unlock rows from the buffer cache, with
|
||||
heap_fetch(), you must pass a Buffer pointer, and ReleaseBuffer() it
|
||||
when completed. Once you have the row, you can get data that is common
|
||||
to all tuples, like t_ctid and t_oid, by mererly accessing the
|
||||
HeapTuple structure entries. If you need a table-specific column, you
|
||||
should take the HeapTuple pointer, and use the GETSTRUCT() macro to
|
||||
access the table-specific start of the tuple. You then cast the
|
||||
pointer as a Form_pg_proc pointer if you are accessing the pg_proc
|
||||
table, or TypeTupleForm if you are accessing pg_type. You can then
|
||||
access the columns by using a structure pointer:
|
||||
|
||||
I have three good books, An Introduction to Database Systems, by C.J. Date,
|
||||
Addison, Wesley, A Guide to the SQL Standard, by C.J. Date, et. al,
|
||||
Addison, Wesley, and Transaction Processing: Concepts and Techniques,
|
||||
by Jim Gray and Andreas Reuter, Morgan, Kaufmann.
|
||||
((Form_pg_class) GETSTRUCT(tuple))->relnatts
|
||||
|
||||
3) Why do we use palloc() and pfree() to allocate memory?
|
||||
|
||||
palloc() and pfree() are used in place of malloc() and free() because we
|
||||
automatically free all memory allocated when a transaction completes. This
|
||||
makes it easier to make sure we free memory that gets allocated in one
|
||||
place, but only freed much later. There are several contexts that memory can
|
||||
be allocated in, and this controls when the allocated memory is
|
||||
automatically freed by the backend.
|
||||
|
||||
4) Why do we use Node and List to make data structures?
|
||||
|
||||
We do this because this allows a consistent way to pass data inside the
|
||||
backend in a flexible way. Every node has a NodeTag which specifies what
|
||||
type of data is inside the Node. Lists are lists of Nodes. lfirst(),
|
||||
lnext(), and foreach() are used to get, skip, and traverse through Lists.
|
||||
|
||||
5) How do I add a feature or fix a bug?
|
||||
|
||||
The source code is over 250,000 lines. Many problems/features are isolated
|
||||
to one specific area of the code. Others require knowledge of much of the
|
||||
source. If you are confused about where to start, ask the hackers list, and
|
||||
they will be glad to assess the complexity and give pointers on where to
|
||||
start.
|
||||
|
||||
Another thing to keep in mind is that many fixes and features can be added
|
||||
with surprisingly little code. I often start by adding code, then looking at
|
||||
other areas in the code where similar things are done, and by the time I am
|
||||
finished, the patch is quite small and compact.
|
||||
|
||||
When adding code, keep in mind that it should use the existing facilities in
|
||||
the source, for performance reasons and for simplicity. Often a review of
|
||||
existing code doing similar things is helpful.
|
||||
|
||||
6) How do I download/update the current source tree?
|
||||
|
||||
There are several ways to obtain the source tree. Occasional developers can
|
||||
just get the most recent source tree snapshot from ftp.postgresql.org. For
|
||||
regular developers, you can use CVSup, which is available from
|
||||
ftp.postgresql.org too. CVSup allows you to download the source tree, then
|
||||
occasionally update your copy of the source tree with any new changes. Using
|
||||
CVSup, you don't have to download the entire source each time, only the
|
||||
changed files. CVSup does not allow developers to update the source tree.
|
||||
|
||||
Anonymous CVS is available too. See the doc/FAQ_CVS file for more
|
||||
information.
|
||||
|
||||
To update the source tree, there are two ways. You can generate a patch
|
||||
against your current source tree, perhaps using the make_diff tools
|
||||
mentioned above, and send them to the patches list. They will be reviewed,
|
||||
and applied in a timely manner. If the patch is major, and we are in beta
|
||||
testing, the developers may wait for the final release before applying your
|
||||
patches.
|
||||
|
||||
For hard-core developers, Marc(scrappy@postgresql.org) will give you a Unix
|
||||
shell account on postgresql.org, and you can ftp your files into your
|
||||
account, patch, and cvs install the changes directly into the source tree.
|
||||
|
||||
6) How do I test my changes?
|
||||
|
||||
First, use psql to make sure it is working as you expect. Then run
|
||||
src/test/regress and get the output of src/test/regress/checkresults with
|
||||
and without your changes, to see that your patch does not change the
|
||||
regression test in unexpected ways. This practice has saved me many times.
|
||||
The regression tests test the code in ways I would never do, and has caught
|
||||
many bugs in my patches. By finding the problems now, you save yourself a
|
||||
lot of debugging later when things are broken, and you can't figure out when
|
||||
it happened.
|
||||
You should not directly change live tuples in this way. The best way
|
||||
is to use heap_tuplemodify() and pass it your palloc'ed tuple, and the
|
||||
values you want changed. It returns another palloc'ed tuple, which you
|
||||
pass to heap_replace(). You can delete tuples by passing the tuple's
|
||||
t_ctid to heap_destroy(). Remember, tuples can be either system cache
|
||||
versions, which may go away soon after you get them, buffer cache
|
||||
version, which will go away when you heap_getnext(), heap_endscan, or
|
||||
ReleaseBuffer(), in the heap_fetch() case. Or it may be a palloc'ed
|
||||
tuple, that you must pfree() when finished.
|
||||
|
||||
10) What is elog()?
|
||||
|
||||
elog() is used to send messages to the front-end, and optionally
|
||||
terminate the current query being processed. The first parameter is an
|
||||
elog level of NOTICE, DEBUG, ERROR, or FATAL. NOTICE prints on the
|
||||
user's terminal and the postmaster logs. DEBUG prints only in the
|
||||
postmaster logs. ERROR prints in both places, and terminates the
|
||||
current query, never returning from the call. FATAL terminates the
|
||||
backend process. The remaining parameters of elog are a printf-style
|
||||
set of parameters to print.
|
||||
|
88
doc/TODO
88
doc/TODO
@ -1,6 +1,6 @@
|
||||
TODO list for PostgreSQL
|
||||
========================
|
||||
Last updated: Sat Aug 29 17:43:10 EDT 1998
|
||||
Last updated: Sat Oct 24 00:11:58 EDT 1998
|
||||
|
||||
Current maintainer: Bruce Momjian (maillist@candle.pha.pa.us)
|
||||
|
||||
@ -19,18 +19,13 @@ Developers who have claimed items are:
|
||||
* Bryan is Bryan Henderson<bryanh@giraffe.netgate.net>
|
||||
* D'Arcy is D'Arcy J.M. Cain <darcy@druid.net>
|
||||
* Dan is Dan McGuirk <mcguirk@indirect.com>
|
||||
* Daniel is Daniel Kalchev <daniel@digsys.bg>
|
||||
* Darren is Darren King <darrenk@insightdist.com>
|
||||
* David is David Hartwig <daveh@insightdist.com>
|
||||
* Edmund is Edmund Mergl <E.Mergl@bawue.de>
|
||||
* Erich Stamberger <eberger@gewi.kfunigraz.ac.at>
|
||||
* Gerhard is Gerhard Reithofer <gerhardr@tech-edv.co.at>
|
||||
* Goran is Goran Thyni <goran@bildbasen.se>
|
||||
* Henry is Henry B. Hotz <hotz@jpl.nasa.gov>
|
||||
* Igor is Igor <igor@sba.miami.edu>
|
||||
* Jan is Jan Wieck <wieck@sapserv.debis.de>
|
||||
* Jun is Jun Kuwamura <juk@rccm.co.jp>
|
||||
* Kurt is "Kurt J. Lidl" <lidl@va.pubnix.com>
|
||||
* Maarten is Maarten Boekhold <maartenb@dutepp0.et.tudelft.nl>
|
||||
* Marc is Marc Fournier <scrappy@hub.org>
|
||||
* Martin is Martin S. Utesch <utesch@aut.tu-freiberg.de>
|
||||
@ -38,20 +33,17 @@ Developers who have claimed items are:
|
||||
* Michael is Michael Meskes <meskes@debian.org>
|
||||
* Oleg is Oleg Bartunov <oleg@sai.msu.su>
|
||||
* Paul is Paul M. Aoki <aoki@CS.Berkeley.EDU>
|
||||
* Patrick is Patrick van Kleef <pvk@pobox.com>
|
||||
* Peter is Peter T Mount <peter@retep.org.uk>
|
||||
* Phil is Phil Thompson <phil@river-bank.demon.co.uk>
|
||||
* Raymond is Raymond Toy <toy@rtp.ericsson.se>
|
||||
* Ryan is Ryan Kirkpatrick <rkirkpat@nag.cs.colorado.edu>
|
||||
* Soo-Ho Ok <shok@detc.dongeui-tc.ac.kr>
|
||||
* Stefan Simkovics <ssimkovi@rainbow.studorg.tuwien.ac.at>
|
||||
* Sven is Sven Verdoolaege <skimo@breughel.ufsia.ac.be>
|
||||
* Tatsuo is Tatsuo Ishii <t-ishii@sra.co.jp>
|
||||
* Tom is Tom Lane <tgl@sss.pgh.pa.us>
|
||||
* Thomas is Thomas Lockhart <tgl@mythos.jpl.nasa.gov>
|
||||
* Todd is Todd Brandys is <brandys@eng3.hep.uiuc.edu>
|
||||
* TomH is Tom I Helbekkmo <tih@Hamartun.Priv.NO>
|
||||
* Vadim is "Vadim B. Mikheev" <vadim@sable.krasnoyarsk.su>
|
||||
* Vivek is Vivek Khera <khera@kci.kciLink.com>
|
||||
|
||||
Additional 6.4 developers include:
|
||||
---------------------------------
|
||||
@ -63,13 +55,15 @@ Additional 6.4 developers include:
|
||||
* Aldrin L. <aldrin@americasnet.com>
|
||||
* Pascal ANDRE <andre@via.ecp.fr>
|
||||
* Magnus Hagander <mha@edu.sollentuna.se>
|
||||
* Robert Bruccoleri <bruc@pluto.njcc.com>
|
||||
* Paul A Vixie <paul@vix.com>
|
||||
* Jacek Lasecki <jacek@sound.eti.pg.gda.pl>
|
||||
|
||||
RELIABILITY
|
||||
-----------
|
||||
* Overhaul mdmgr/smgr to fix double unlinking and double opens, cleanup
|
||||
* Overhaul bufmgr/lockmgr/transaction manager
|
||||
* Remove EXTEND?
|
||||
* -CREATE VIEW requires super-user priviledge
|
||||
* Can lo_export()/lo_import() read/write anywhere, causing a security problem?
|
||||
* Tables that start with xinv confused to be large objects
|
||||
* Two and three dimmensional arrays display improperly, missing {}
|
||||
@ -78,7 +72,6 @@ RELIABILITY
|
||||
* SELECT * FROM table WHERE int4_column = '1' fails
|
||||
* SELECT a[1] FROM test fails, it needs test.a[1]
|
||||
* UPDATE table SET table.value = 3 fails
|
||||
* -Make pg_dump preserve inheritance column order, do non-inherits first
|
||||
* User who can create databases can modify pg_database table
|
||||
* optimizer memory exhaustion with many OR's
|
||||
* elog() does not free all its memory(Jan)
|
||||
@ -89,7 +82,6 @@ RELIABILITY
|
||||
* allow UPDATE using aggregate to affect all rows, not just one
|
||||
* computations in views fail:
|
||||
create view test as select usesysid * usesysid from pg_shadow;
|
||||
* select upper(usename), count(usesysid) from pg_shadow group by 1 fails
|
||||
|
||||
ENHANCEMENTS
|
||||
------------
|
||||
@ -99,9 +91,7 @@ ENHANCEMENTS
|
||||
* Allow transaction commits with rollback with no-fsync performance
|
||||
* More access control over who can create tables and access the database
|
||||
* Add full ANSI SQL capabilities
|
||||
* -Implement HAVING clause(Stephan)
|
||||
* add OUTER joins, left and right (Thomas)
|
||||
* -make VIEWs updateable where possible(use Rules)
|
||||
* add INTERSECTS, SUBTRACTS(Stephan)
|
||||
* add temporary tables
|
||||
* add sql3 recursive unions
|
||||
@ -111,8 +101,6 @@ ENHANCEMENTS
|
||||
* DOMAIN capability
|
||||
* Allow compression of large fields or a compressed field type
|
||||
* Fix the rules system(Jan,Soo-Ho)
|
||||
* -robust
|
||||
* -making INSTEAD rules work
|
||||
* add CONSTRAINT
|
||||
* Full set of text operations and functions
|
||||
* word searches, concat,max() on text, char
|
||||
@ -126,10 +114,8 @@ ENHANCEMENTS
|
||||
* Make MONEY/DECIMAL have a defined precision
|
||||
* Fix tables >2G, or report error when 2G size reached
|
||||
(fix lseek()/off_t, mdextend()/RELSEG_SIZE)
|
||||
* -Allow libpq to cancel query requests
|
||||
* Add REGEX internationalization
|
||||
* allow row re-use without vacuum, maybe?(Vadim)
|
||||
* -Remove restriction that ORDER BY field must be in SELECT list(David)
|
||||
* Add word index for text fields, maybe with trigrams, i.e.:
|
||||
* ' (cat | dog) & ! fox ' meaning text has cat aor dog, but not fox
|
||||
* Populate backend status area and write program to dump status data
|
||||
@ -186,19 +172,29 @@ ENHANCEMENTS
|
||||
* allow creation of functional indexes to use default types
|
||||
* put sort files, large objects in their on directory
|
||||
* CREATE VIEW myview (name) AS SELECT lname FROM wages fails
|
||||
* do autocommit so always in a transaction block
|
||||
* add SIMILAR TO to allow character classes, 'pg_[a-c]%'
|
||||
* allow function isnull(val,'string') to return string if value is null
|
||||
* multi-verion concurrency control(Vadim)
|
||||
* improve reporting of syntax errors by showing location of error in query
|
||||
* allow chaining of pages to allow >8k tuples
|
||||
* no min/max for oid type
|
||||
* remove un-needed conversion functions
|
||||
|
||||
PERFORMANCE
|
||||
-----------
|
||||
* Use indexes in ORDER BY for restrictive data sets, min(), max()
|
||||
* Allow LIMIT ability on single-table queries that have no ORDER BY or
|
||||
a matching index
|
||||
* Pull requested data directly from indexes, bypassing heap data
|
||||
* Prevent psort() usage when query already using index matching ORDER BY
|
||||
* Optimizing disjunctive queries
|
||||
* Fix bushy-plans
|
||||
* Other optimizer bugs
|
||||
* Prevent fsync in SELECT-only queries
|
||||
* Cache most recent query plan(s?)
|
||||
* Shared catalog cache, reduce lseek()'s by caching table size in shared area
|
||||
* Allow compression of log and meta data
|
||||
* Add FILLFACTOR to index creation
|
||||
* -Allow indexes to be used with OR clauses(Bruce)
|
||||
* update pg_statistic table to remove operator column
|
||||
* make index creation use psort code, because it is now faster(Vadim)
|
||||
* remove fork()/exec() of backend and make it just fork()
|
||||
@ -213,15 +209,15 @@ PERFORMANCE
|
||||
* use mmap() rather than SYSV shared memory(?)
|
||||
* use index to restrict rows returned by multi-key index when used with
|
||||
non-consecutive keys or OR clauses, so fewer heap accesses
|
||||
* use index with constants on functions
|
||||
|
||||
DOCUMENTATION
|
||||
-------------
|
||||
* Update usermanual source(many)
|
||||
* added features used in grammer but not in docs, like :: and CAST
|
||||
* update libpq++ and pginterface manual page
|
||||
* Add keyword list to documentation, already in /tools
|
||||
* Add 'man pgsql' to show all manual page names
|
||||
|
||||
* Add use of 'const' for varibles in source tree
|
||||
|
||||
|
||||
=============================================================================
|
||||
@ -246,12 +242,13 @@ Fix a bug in the oracle compatibility functions btrim() ltrim() and rtrim()
|
||||
Fix for usernames longer than eight characters(Tom)
|
||||
Fix for shared invalidation cache overflow(Massimo)
|
||||
Prevent file descriptor leaks in failed COPY's(Bruce)
|
||||
Fix problem with username/passwords over 8 characters(Tom)
|
||||
|
||||
Enhancements
|
||||
------------
|
||||
Upgrade ECPG to 2.0, see src/interfaces/ecpc/ChangeLog(Michael)
|
||||
Upgrade ecpg and ecpglib,see src/interfaces/ecpc/ChangeLog(Michael)
|
||||
Show the index used in an explain(Zeugswetter)
|
||||
Multi-byte awareness of many data data types and functions(Tatsuo)
|
||||
Multi-byte awareness of many data types and functions, via configure(Tatsuo)
|
||||
New configure --with-mb option(Tatsuo)
|
||||
New initdb --pgencoding option(Tatsuo)
|
||||
New createdb -E multibyte option(Tatsuo)
|
||||
@ -289,6 +286,8 @@ Pg_hba.conf now has a sameuser option in the database field
|
||||
Make lo_unlink take oid param, not int4
|
||||
New DISABLE_COMPLEX_MACRO for compilers that can't handle our macros(Bruce)
|
||||
Libpgtcl now gets async notifies from libpq(Tom)
|
||||
libpgtcl cleanups(Tom)
|
||||
|
||||
New locale patch, see docs/README/locale(Oleg)
|
||||
Fix for pg_dump so CONSTRAINT and CHECK syntax is correct(ccb)
|
||||
New contrib/lo code for large object orphan removal(Peter)
|
||||
@ -299,8 +298,9 @@ Libpq can now be compiled on win32(Magnus)
|
||||
Add PQsetdbLogin() in libpq
|
||||
Two styles we agreed upon for database descriptors(Thomas)
|
||||
New 8-byte integer type, checked by configure for OS support(Thomas)
|
||||
Better support for quited table/column names(Thomas)
|
||||
Surround table and column names with double-quotes(Thomas) in generated
|
||||
sql code to preserve case (SQL92 syntax)(Thomas)
|
||||
sql code to preserve case (SQL92 syntax)(Thomas)
|
||||
New libpqrequestCancel(Tom)
|
||||
PQreset() now works with passwords(Tom)
|
||||
Handle case of GROUP BY target list column number out of range(David)
|
||||
@ -343,9 +343,13 @@ New rewrite system fixes many problems with rules and views(Jan)
|
||||
* Rules and views inherit the permissions on the creator
|
||||
* No rules at the column level
|
||||
* No UPDATE NEW/OLD rules
|
||||
* New pg_rule and pg_view system views
|
||||
* New pg_tables, pg_indexes, pg_rules and pg_views system views
|
||||
* Only a single action on SELECT rules
|
||||
* Total rewrite overhaul, perhaps for 6.5
|
||||
* handle subselects
|
||||
* handle aggregates on views
|
||||
* handle insert into select from view works
|
||||
*
|
||||
|
||||
System indexes are now multi-key(Bruce)
|
||||
Oidint2, oidint4, and oidname types are removed(Bruce)
|
||||
@ -358,9 +362,27 @@ New setval() command to set sequence value(Massimo)
|
||||
Auto-remove unix socket file on startup if no postmaster running(Massimo)
|
||||
Conditional trace package(Massimo)
|
||||
New UNLISTEN command(Massimo)
|
||||
Psql now compiles under win32 using win32.mak(Magnus)
|
||||
Psql and libpq now compile under win32 using win32.mak(Magnus)
|
||||
Lo_read no longer stores trailing NULL(Bruce)
|
||||
Identifiers are now truncated to 31 characters internally(Bruce)
|
||||
Createuser options now availble on the command line
|
||||
PL/pgSQL backend programming language(Jan)
|
||||
Code for 64-bit integer supported added, configure tested, int8 type(Thomas)
|
||||
Prevent file descriptor leaf from failed COPY(Bruce)
|
||||
New pg_upgrade command(Bruce)
|
||||
Updated /contrib directories(Massimo)
|
||||
New CREATE TABLE DEFAULT VALUES statement available(Thomas)
|
||||
New INSERT INTO TABLE DEFAULT VALUES statement available(Thomas)
|
||||
New DECLARE and FETCH feature(Thomas)
|
||||
libpq's internal structures now not exported(Tom)
|
||||
Allow up to 8 key indexes(Bruce)
|
||||
Remove ARCHIVE keyword, that is no longer used(Thomas)
|
||||
pg_dump -n flag to supress quotes around indentifiers
|
||||
disable system columns for views(Jan)
|
||||
net INET and CIDR types for network addresses(TomH, Paul)
|
||||
no more double quotes in psql output
|
||||
pg_dump now dumps views(Terry)
|
||||
new SET QUERY_LIMIT(Tatsuo,Jan)
|
||||
|
||||
Source Tree Changes
|
||||
-------------------
|
||||
@ -380,8 +402,16 @@ Update backend flowchart in tools/backend(Bruce)
|
||||
Change atttypmod from int16 to int32(Bruce, Tom)
|
||||
Getrusage() fix for platforms that do not have it(Tom)
|
||||
Add PGUSER to libpq man page
|
||||
Ns32k platform fixes(Phil Nelson)
|
||||
NS32K platform fixes(Phil Nelson, John Buller)
|
||||
Sco 7/UnixWare 2.x fixes(Billy,others)
|
||||
Sparc/Solaris 2.5 fixes(Ryan)
|
||||
Pgbuiltin.3 is obsolete, move to doc files(Thomas)
|
||||
Even more documention(Thomas)
|
||||
Nextstep support(Jacek)
|
||||
Aix support(David)
|
||||
pginterface manual page(Bruce)
|
||||
shared libraries all have version numbers
|
||||
merged all OS-specific shared library defines into one file
|
||||
smarter TCL/TK configuration checking(Billy)
|
||||
smarter perl configuration(Brook)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user