Commit 2de7ebe9 authored by Bruce Momjian's avatar Bruce Momjian

Remove FAQ about database terms.

parent 2ccf79a6
Frequently Asked Questions (FAQ) for PostgreSQL Frequently Asked Questions (FAQ) for PostgreSQL
Last updated: Mon Jan 31 20:41:21 EST 2005 Last updated: Mon Jan 31 21:31:39 EST 2005
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us) Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
...@@ -68,19 +68,18 @@ ...@@ -68,19 +68,18 @@
4.11.3) Why aren't my sequence numbers reused on transaction abort? 4.11.3) Why aren't my sequence numbers reused on transaction abort?
Why are there gaps in the numbering of my sequence/SERIAL column? Why are there gaps in the numbering of my sequence/SERIAL column?
4.12) What is an OID? What is a TID? 4.12) What is an OID? What is a TID?
4.13) What is the meaning of some of the terms used in PostgreSQL? 4.13) Why do I get the error "ERROR: Memory exhausted in
4.14) Why do I get the error "ERROR: Memory exhausted in
AllocSetAlloc()"? AllocSetAlloc()"?
4.15) How do I tell what PostgreSQL version I am running? 4.14) How do I tell what PostgreSQL version I am running?
4.16) Why does my large-object operations get "invalid large obj 4.15) Why does my large-object operations get "invalid large obj
descriptor"? descriptor"?
4.17) How do I create a column that will default to the current time? 4.16) How do I create a column that will default to the current time?
4.18) How do I perform an outer join? 4.17) How do I perform an outer join?
4.19) How do I perform queries using multiple databases? 4.18) How do I perform queries using multiple databases?
4.20) How do I return multiple rows or columns from a function? 4.19) How do I return multiple rows or columns from a function?
4.21) Why can't I reliably create/drop temporary tables in PL/PgSQL 4.20) Why can't I reliably create/drop temporary tables in PL/PgSQL
functions? functions?
4.22) What encryption options are available? 4.21) What encryption options are available?
Extending PostgreSQL Extending PostgreSQL
...@@ -394,6 +393,7 @@ ...@@ -394,6 +393,7 @@
properly. First, by running configure with the --enable-cassert properly. First, by running configure with the --enable-cassert
option, many assert()s monitor the progress of the backend and halt option, many assert()s monitor the progress of the backend and halt
the program when something unexpected occurs. the program when something unexpected occurs.
The postmaster has a -d option that allows even more detailed The postmaster has a -d option that allows even more detailed
information to be reported. The -d option takes a number that information to be reported. The -d option takes a number that
specifies the debug level. Be warned that high debug level values specifies the debug level. Be warned that high debug level values
...@@ -517,12 +517,14 @@ ...@@ -517,12 +517,14 @@
4.4) What is the maximum size for a row, a table, and a database? 4.4) What is the maximum size for a row, a table, and a database?
These are the limits: These are the limits:
Maximum size for a database? unlimited (32 TB databases exist) Maximum size for a database? unlimited (32 TB databases exist)
Maximum size for a table? 32 TB Maximum size for a table? 32 TB
Maximum size for a row? 1.6TB Maximum size for a row? 1.6TB
Maximum size for a field? 1 GB Maximum size for a field? 1 GB
Maximum number of rows in a table? unlimited Maximum number of rows in a table? unlimited
Maximum number of columns in a table? 250-1600 depending on column types Maximum number of columns in a table? 250-1600 depending on column
types
Maximum number of indexes on a table? unlimited Maximum number of indexes on a table? unlimited
Of course, these are not actually unlimited, but limited to available Of course, these are not actually unlimited, but limited to available
...@@ -611,15 +613,15 @@ ...@@ -611,15 +613,15 @@
* The search string can not start with a character class, e.g. * The search string can not start with a character class, e.g.
[a-e]. [a-e].
* Case-insensitive searches such as ILIKE and ~* do not utilize * Case-insensitive searches such as ILIKE and ~* do not utilize
indexes. Instead, use functional indexes, which are described in indexes. Instead, use expression indexes, which are described in
section 4.10. section 4.8.
* The default C locale must be used during initdb because it is not * The default C locale must be used during initdb because it is not
possible to know the next-greater character in a non-C locale. You possible to know the next-greatest character in a non-C locale.
can create a special text_pattern_ops index for such cases that You can create a special text_pattern_ops index for such cases
work only for LIKE indexing. that work only for LIKE indexing.
In pre-8.0 releases, indexes often can not be used unless the data In pre-8.0 releases, indexes often can not be used unless the data
types exactly match the index's column types. This is particularly types exactly match the index's column types. This was particularly
true of int2, int8, and numeric column indexes. true of int2, int8, and numeric column indexes.
4.7) How do I see how the query optimizer is evaluating my query? 4.7) How do I see how the query optimizer is evaluating my query?
...@@ -640,7 +642,7 @@ ...@@ -640,7 +642,7 @@
WHERE lower(col) = 'abc'; WHERE lower(col) = 'abc';
This will not use an standard index. However, if you create a This will not use an standard index. However, if you create a
functional index, it will be used: expresssion index, it will be used:
CREATE INDEX tabindex ON tab (lower(col)); CREATE INDEX tabindex ON tab (lower(col));
4.9) In a query, how do I detect if a field is NULL? 4.9) In a query, how do I detect if a field is NULL?
...@@ -649,13 +651,12 @@ ...@@ -649,13 +651,12 @@
4.10) What is the difference between the various character types? 4.10) What is the difference between the various character types?
Type Internal Name Notes Type Internal Name Notes
-------------------------------------------------- VARCHAR(n) varchar size specifies maximum length, no padding
VARCHAR(n) varchar size specifies maximum length, no padding CHAR(n) bpchar blank padded to the specified fixed length
CHAR(n) bpchar blank padded to the specified fixed length TEXT text no specific upper limit on length
TEXT text no specific upper limit on length BYTEA bytea variable-length byte array (null-byte safe)
BYTEA bytea variable-length byte array (null-byte safe) "char" char one character
"char" char one character
You will see the internal name when examining system catalogs and in You will see the internal name when examining system catalogs and in
some error messages. some error messages.
...@@ -692,9 +693,7 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -692,9 +693,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
); );
See the create_sequence manual page for more information about See the create_sequence manual page for more information about
sequences. You can also use each row's OID field as a unique value. sequences.
However, if you need to dump and reload the database, you need to use
pg_dump's -o option or COPY WITH OIDS option to preserve the OIDs.
4.11.2) How do I get the value of a SERIAL insert? 4.11.2) How do I get the value of a SERIAL insert?
...@@ -716,16 +715,10 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -716,16 +715,10 @@ BYTEA bytea variable-length byte array (null-byte safe)
execute("INSERT INTO person (name) VALUES ('Blaise Pascal')"); execute("INSERT INTO person (name) VALUES ('Blaise Pascal')");
new_id = execute("SELECT currval('person_id_seq')"); new_id = execute("SELECT currval('person_id_seq')");
Finally, you could use the OID returned from the INSERT statement to
look up the default value, though this is probably the least portable
approach, and the oid value will wrap around when it reaches 4
billion. In Perl, using DBI with the DBD::Pg module, the oid value is
made available via $sth->{pg_oid_status} after $sth->execute().
4.11.3) Doesn't currval() lead to a race condition with other users? 4.11.3) Doesn't currval() lead to a race condition with other users?
No. currval() returns the current value assigned by your backend, not No. currval() returns the current value assigned by your session, not
by all users. by all sessions.
4.11.4) Why aren't my sequence numbers reused on transaction abort? Why are 4.11.4) Why aren't my sequence numbers reused on transaction abort? Why are
there gaps in the numbering of my sequence/SERIAL column? there gaps in the numbering of my sequence/SERIAL column?
...@@ -751,25 +744,7 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -751,25 +744,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
values. TIDs change after rows are modified or reloaded. They are used values. TIDs change after rows are modified or reloaded. They are used
by index entries to point to physical rows. by index entries to point to physical rows.
4.13) What is the meaning of some of the terms used in PostgreSQL? 4.13) Why do I get the error "ERROR: Memory exhausted in AllocSetAlloc()"?
Some of the source code and older documentation use terms that have
more common usage. Here are some:
* table, relation, class
* row, record, tuple
* column, field, attribute
* retrieve, select
* replace, update
* append, insert
* OID, serial value
* portal, cursor
* range variable, table name, table alias
A list of general database terms can be found at:
http://hea-www.harvard.edu/MST/simul/software/docs/pkgs/pgsql/glossary
/glossary.html
4.14) Why do I get the error "ERROR: Memory exhausted in AllocSetAlloc()"?
You probably have run out of virtual memory on your system, or your You probably have run out of virtual memory on your system, or your
kernel has a low limit for certain resources. Try this before starting kernel has a low limit for certain resources. Try this before starting
...@@ -784,11 +759,11 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -784,11 +759,11 @@ BYTEA bytea variable-length byte array (null-byte safe)
problem with the SQL client because the backend is returning too much problem with the SQL client because the backend is returning too much
data, try it before starting the client. data, try it before starting the client.
4.15) How do I tell what PostgreSQL version I am running? 4.14) How do I tell what PostgreSQL version I am running?
From psql, type SELECT version(); From psql, type SELECT version();
4.16) Why does my large-object operations get "invalid large obj 4.15) Why does my large-object operations get "invalid large obj
descriptor"? descriptor"?
You need to put BEGIN WORK and COMMIT around any use of a large object You need to put BEGIN WORK and COMMIT around any use of a large object
...@@ -803,12 +778,12 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -803,12 +778,12 @@ BYTEA bytea variable-length byte array (null-byte safe)
If you are using a client interface like ODBC you may need to set If you are using a client interface like ODBC you may need to set
auto-commit off. auto-commit off.
4.17) How do I create a column that will default to the current time? 4.16) How do I create a column that will default to the current time?
Use CURRENT_TIMESTAMP: Use CURRENT_TIMESTAMP:
CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP ); CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
4.18) How do I perform an outer join? 4.17) How do I perform an outer join?
PostgreSQL supports outer joins using the SQL standard syntax. Here PostgreSQL supports outer joins using the SQL standard syntax. Here
are two examples: are two examples:
...@@ -838,7 +813,7 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -838,7 +813,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2) WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2)
ORDER BY col1 ORDER BY col1
4.19) How do I perform queries using multiple databases? 4.18) How do I perform queries using multiple databases?
There is no way to query a database other than the current one. There is no way to query a database other than the current one.
Because PostgreSQL loads database-specific system catalogs, it is Because PostgreSQL loads database-specific system catalogs, it is
...@@ -848,12 +823,12 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -848,12 +823,12 @@ BYTEA bytea variable-length byte array (null-byte safe)
course, a client can make simultaneous connections to different course, a client can make simultaneous connections to different
databases and merge the results on the client side. databases and merge the results on the client side.
4.20) How do I return multiple rows or columns from a function? 4.19) How do I return multiple rows or columns from a function?
In 7.3, you can easily return multiple rows or columns from a In 7.3, you can easily return multiple rows or columns from a
function, http://techdocs.postgresql.org/guides/SetReturningFunctions. function, http://techdocs.postgresql.org/guides/SetReturningFunctions.
4.21) Why can't I reliably create/drop temporary tables in PL/PgSQL 4.20) Why can't I reliably create/drop temporary tables in PL/PgSQL
functions? functions?
PL/PgSQL caches function contents, and an unfortunate side effect is PL/PgSQL caches function contents, and an unfortunate side effect is
...@@ -864,7 +839,7 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -864,7 +839,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
table access in PL/PgSQL. This will cause the query to be reparsed table access in PL/PgSQL. This will cause the query to be reparsed
every time. every time.
4.22) What encryption options are available? 4.21) What encryption options are available?
* contrib/pgcrypto contains many encryption functions for use in SQL * contrib/pgcrypto contains many encryption functions for use in SQL
queries. queries.
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
alink="#0000ff"> alink="#0000ff">
<H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1> <H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1>
<P>Last updated: Mon Jan 31 20:41:21 EST 2005</P> <P>Last updated: Mon Jan 31 21:31:39 EST 2005</P>
<P>Current maintainer: Bruce Momjian (<A href= <P>Current maintainer: Bruce Momjian (<A href=
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>) "mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)
...@@ -101,24 +101,22 @@ ...@@ -101,24 +101,22 @@
my sequence/SERIAL column?<BR> my sequence/SERIAL column?<BR>
<A href="#4.12">4.12</A>) What is an <SMALL>OID</SMALL>? What is a <A href="#4.12">4.12</A>) What is an <SMALL>OID</SMALL>? What is a
<SMALL>TID</SMALL>?<BR> <SMALL>TID</SMALL>?<BR>
<A href="#4.13">4.13</A>) What is the meaning of some of the terms <A href="#4.12">4.13</A>) Why do I get the error <I>"ERROR: Memory
used in PostgreSQL?<BR>
<A href="#4.14">4.14</A>) Why do I get the error <I>"ERROR: Memory
exhausted in AllocSetAlloc()"</I>?<BR> exhausted in AllocSetAlloc()"</I>?<BR>
<A href="#4.15">4.15</A>) How do I tell what PostgreSQL version I <A href="#4.14">4.14</A>) How do I tell what PostgreSQL version I
am running?<BR> am running?<BR>
<A href="#4.16">4.16</A>) Why does my large-object operations get <A href="#4.15">4.15</A>) Why does my large-object operations get
<I>"invalid large obj descriptor"</I>?<BR> <I>"invalid large obj descriptor"</I>?<BR>
<A href="#4.17">4.17</A>) How do I create a column that will <A href="#4.16">4.16</A>) How do I create a column that will
default to the current time?<BR> default to the current time?<BR>
<A href="#4.18">4.18</A>) How do I perform an outer join?<BR> <A href="#4.17">4.17</A>) How do I perform an outer join?<BR>
<A href="#4.19">4.19</A>) How do I perform queries using multiple <A href="#4.18">4.18</A>) How do I perform queries using multiple
databases?<BR> databases?<BR>
<A href="#4.20">4.20</A>) How do I return multiple rows or columns <A href="#4.19">4.19</A>) How do I return multiple rows or columns
from a function?<BR> from a function?<BR>
<A href="#4.21">4.21</A>) Why can't I reliably create/drop <A href="#4.20">4.20</A>) Why can't I reliably create/drop
temporary tables in PL/PgSQL functions?<BR> temporary tables in PL/PgSQL functions?<BR>
<A href="#4.22">4.22</A>) What encryption options are available?<BR> <A href="#4.21">4.21</A>) What encryption options are available?<BR>
<H2 align="center">Extending PostgreSQL</H2> <H2 align="center">Extending PostgreSQL</H2>
...@@ -531,7 +529,7 @@ ...@@ -531,7 +529,7 @@
option, many <I>assert()</I>s monitor the progress of the backend option, many <I>assert()</I>s monitor the progress of the backend
and halt the program when something unexpected occurs.</P> and halt the program when something unexpected occurs.</P>
The <I>postmaster</I> has a <I>-d</I> option that allows even more <P>The <I>postmaster</I> has a <I>-d</I> option that allows even more
detailed information to be reported. The <I>-d</I> option takes a detailed information to be reported. The <I>-d</I> option takes a
number that specifies the debug level. Be warned that high debug number that specifies the debug level. Be warned that high debug
level values generate large log files.</P> level values generate large log files.</P>
...@@ -567,7 +565,7 @@ ...@@ -567,7 +565,7 @@
<H4><A name="3.5">3.5</A>) Why do I get <I>"Sorry, too many <H4><A name="3.5">3.5</A>) Why do I get <I>"Sorry, too many
clients"</I> when trying to connect?</H4> clients"</I> when trying to connect?</H4>
You have reached the default limit is 100 database sessions. You <P>You have reached the default limit is 100 database sessions. You
need to increase the <I>postmaster</I>'s limit on how many need to increase the <I>postmaster</I>'s limit on how many
concurrent backend processes it can start by changing the concurrent backend processes it can start by changing the
<I>max_connections</I> value in <I>postgresql.conf</I> and <I>max_connections</I> value in <I>postgresql.conf</I> and
...@@ -672,19 +670,25 @@ ...@@ -672,19 +670,25 @@
table, and a database?</H4> table, and a database?</H4>
<P>These are the limits:</P> <P>These are the limits:</P>
<PRE> <CENTER>
Maximum size for a database? unlimited (32 TB databases exist) <TABLE BORDER=1>
Maximum size for a table? 32 TB <TR><TD>Maximum size for a database?</TD><TD>unlimited (32 TB databases
Maximum size for a row? 1.6TB exist)</TD></TR>
Maximum size for a field? 1 GB <TR><TD>Maximum size for a table?</TD><TD>32 TB</TD></TR>
Maximum number of rows in a table? unlimited <TR><TD>Maximum size for a row?</TD><TD>1.6TB</TD></TR>
Maximum number of columns in a table? 250-1600 depending on column types <TR><TD>Maximum size for a field?</TD><TD>1 GB</TD></TR>
Maximum number of indexes on a table? unlimited <TR><TD>Maximum number of rows in a table?</TD><TD>unlimited</TD></TR>
</PRE> <TR><TD>Maximum number of columns in a table?</TD><TD>250-1600 depending
on column types</TD></TR>
Of course, these are not actually unlimited, but limited to <TR><TD>Maximum number of indexes on a
table?</TD><TD>unlimited</TD></TR>
</TABLE>
</CENTER>
<BR>
<P>Of course, these are not actually unlimited, but limited to
available disk space and memory/swap space. Performance may suffer available disk space and memory/swap space. Performance may suffer
when these values get unusually large. when these values get unusually large.</P>
<P>The maximum table size of 32 TB does not require large file <P>The maximum table size of 32 TB does not require large file
support from the operating system. Large tables are stored as support from the operating system. Large tables are stored as
...@@ -781,10 +785,10 @@ ...@@ -781,10 +785,10 @@
<LI>The search string can not start with a character class, <LI>The search string can not start with a character class,
e.g. [a-e].</LI> e.g. [a-e].</LI>
<LI>Case-insensitive searches such as <SMALL>ILIKE</SMALL> and <LI>Case-insensitive searches such as <SMALL>ILIKE</SMALL> and
<I>~*</I> do not utilize indexes. Instead, use functional <I>~*</I> do not utilize indexes. Instead, use expression
indexes, which are described in section <a href="#4.10">4.10</a>.</LI> indexes, which are described in section <a href="#4.8">4.8</a>.</LI>
<LI>The default <I>C</I> locale must be used during <LI>The default <I>C</I> locale must be used during
<i>initdb</i> because it is not possible to know the next-greater <i>initdb</i> because it is not possible to know the next-greatest
character in a non-C locale. You can create a special character in a non-C locale. You can create a special
<CODE>text_pattern_ops</CODE> index for such cases that work only <CODE>text_pattern_ops</CODE> index for such cases that work only
for <SMALL>LIKE</SMALL> indexing. for <SMALL>LIKE</SMALL> indexing.
...@@ -792,7 +796,7 @@ ...@@ -792,7 +796,7 @@
</UL> </UL>
<P>In pre-8.0 releases, indexes often can not be used unless the data <P>In pre-8.0 releases, indexes often can not be used unless the data
types exactly match the index's column types. This is particularly types exactly match the index's column types. This was particularly
true of int2, int8, and numeric column indexes.</P> true of int2, int8, and numeric column indexes.</P>
<H4><A name="4.7">4.7</A>) How do I see how the query optimizer is <H4><A name="4.7">4.7</A>) How do I see how the query optimizer is
...@@ -818,7 +822,7 @@ ...@@ -818,7 +822,7 @@
</PRE> </PRE>
This will not use an standard index. However, if you create a This will not use an standard index. However, if you create a
functional index, it will be used: expresssion index, it will be used:
<PRE> <PRE>
CREATE INDEX tabindex ON tab (lower(col)); CREATE INDEX tabindex ON tab (lower(col));
</PRE> </PRE>
...@@ -831,16 +835,20 @@ ...@@ -831,16 +835,20 @@
<H4><A name="4.10">4.10</A>) What is the difference between the <H4><A name="4.10">4.10</A>) What is the difference between the
various character types?</H4> various character types?</H4>
<PRE> <CENTER>
Type Internal Name Notes <TABLE BORDER=1>
-------------------------------------------------- <TR><TH>Type</TH><TH>Internal Name</TH><TH>Notes</TH></TR>
VARCHAR(n) varchar size specifies maximum length, no padding <TR><TD>VARCHAR(n)</TD><TD>varchar</TD><TD>size specifies maximum
CHAR(n) bpchar blank padded to the specified fixed length length, no padding</TD></TR>
TEXT text no specific upper limit on length <TR><TD>CHAR(n)</TD><TD>bpchar</TD><TD>blank padded to the specified
BYTEA bytea variable-length byte array (null-byte safe) fixed length</TD></TR>
"char" char one character <TR><TD>TEXT</TD><TD>text</TD><TD>no specific upper limit on
</PRE> length</TD></TR>
<TR><TD>BYTEA</TD><TD>bytea</TD><TD>variable-length byte array
(null-byte safe)</TD></TR>
<TR><TD>"char"</TD><TD>char</TD><TD>one character</TD></TR>
</TABLE>
</CENTER>
<P>You will see the internal name when examining system catalogs <P>You will see the internal name when examining system catalogs
and in some error messages.</P> and in some error messages.</P>
...@@ -884,10 +892,7 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -884,10 +892,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
</PRE> </PRE>
See the <I>create_sequence</I> manual page for more information See the <I>create_sequence</I> manual page for more information
about sequences. You can also use each row's <I>OID</I> field as a about sequences.
unique value. However, if you need to dump and reload the database,
you need to use <I>pg_dump</I>'s <I>-o</I> option or <SMALL>COPY
WITH OIDS</SMALL> option to preserve the <SMALL>OID</SMALL>s.
<H4><A name="4.11.2">4.11.2</A>) How do I get the value of a <H4><A name="4.11.2">4.11.2</A>) How do I get the value of a
<SMALL>SERIAL</SMALL> insert?</H4> <SMALL>SERIAL</SMALL> insert?</H4>
...@@ -918,19 +923,11 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -918,19 +923,11 @@ BYTEA bytea variable-length byte array (null-byte safe)
new_id = execute("SELECT currval('person_id_seq')"); new_id = execute("SELECT currval('person_id_seq')");
</PRE> </PRE>
<P>Finally, you could use the <A href="#4.12"><SMALL>OID</SMALL></A>
returned from the <SMALL>INSERT</SMALL> statement to look up the
default value, though this is probably the least portable approach,
and the oid value will wrap around when it reaches 4 billion.
In Perl, using DBI with the DBD::Pg module, the oid value is made
available via <I>$sth-&gt;{pg_oid_status}</I> after
<I>$sth-&gt;execute()</I>.</P>
<H4><A name="4.11.3">4.11.3</A>) Doesn't <I>currval()</I> <H4><A name="4.11.3">4.11.3</A>) Doesn't <I>currval()</I>
lead to a race condition with other users?</H4> lead to a race condition with other users?</H4>
<P>No. <I>currval()</I> returns the current value assigned by your <P>No. <I>currval()</I> returns the current value assigned by your
backend, not by all users.</P> session, not by all sessions.</P>
<H4><A name="4.11.4">4.11.4</A>) Why aren't my sequence numbers <H4><A name="4.11.4">4.11.4</A>) Why aren't my sequence numbers
reused on transaction abort? Why are there gaps in the numbering of reused on transaction abort? Why are there gaps in the numbering of
...@@ -964,36 +961,7 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -964,36 +961,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
are modified or reloaded. They are used by index entries to point are modified or reloaded. They are used by index entries to point
to physical rows.</P> to physical rows.</P>
<H4><A name="4.13">4.13</A>) What is the meaning of some of the <H4><A name="4.13">4.13</A>) Why do I get the error <I>"ERROR:
terms used in PostgreSQL?</H4>
<P>Some of the source code and older documentation use terms that
have more common usage. Here are some:</P>
<UL>
<LI>table, relation, class</LI>
<LI>row, record, tuple</LI>
<LI>column, field, attribute</LI>
<LI>retrieve, select</LI>
<LI>replace, update</LI>
<LI>append, insert</LI>
<LI><SMALL>OID</SMALL>, serial value</LI>
<LI>portal, cursor</LI>
<LI>range variable, table name, table alias</LI>
</UL>
<P>A list of general database terms can be found at: <A href=
"http://hea-www.harvard.edu/MST/simul/software/docs/pkgs/pgsql/glossary/glossary.html">http://hea-www.harvard.edu/MST/simul/software/docs/pkgs/pgsql/glossary/glossary.html</A></P>
<H4><A name="4.14">4.14</A>) Why do I get the error <I>"ERROR:
Memory exhausted in AllocSetAlloc()"</I>?</H4> Memory exhausted in AllocSetAlloc()"</I>?</H4>
<P>You probably have run out of virtual memory on your system, <P>You probably have run out of virtual memory on your system,
...@@ -1012,12 +980,12 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -1012,12 +980,12 @@ BYTEA bytea variable-length byte array (null-byte safe)
backend is returning too much data, try it before starting the backend is returning too much data, try it before starting the
client. client.
<H4><A name="4.15">4.15</A>) How do I tell what PostgreSQL version <H4><A name="4.14">4.14</A>) How do I tell what PostgreSQL version
I am running?</H4> I am running?</H4>
<P>From <I>psql</I>, type <CODE>SELECT version();</CODE></P> <P>From <I>psql</I>, type <CODE>SELECT version();</CODE></P>
<H4><A name="4.16">4.16</A>) Why does my large-object operations <H4><A name="4.15">4.15</A>) Why does my large-object operations
get <I>"invalid large obj descriptor"</I>?</H4> get <I>"invalid large obj descriptor"</I>?</H4>
<P>You need to put <CODE>BEGIN WORK</CODE> and <CODE>COMMIT</CODE> <P>You need to put <CODE>BEGIN WORK</CODE> and <CODE>COMMIT</CODE>
...@@ -1033,7 +1001,7 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -1033,7 +1001,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
<P>If you are using a client interface like <SMALL>ODBC</SMALL> you <P>If you are using a client interface like <SMALL>ODBC</SMALL> you
may need to set <CODE>auto-commit off.</CODE></P> may need to set <CODE>auto-commit off.</CODE></P>
<H4><A name="4.17">4.17</A>) How do I create a column that will <H4><A name="4.16">4.16</A>) How do I create a column that will
default to the current time?</H4> default to the current time?</H4>
<P>Use <I>CURRENT_TIMESTAMP</I>:</P> <P>Use <I>CURRENT_TIMESTAMP</I>:</P>
...@@ -1041,7 +1009,7 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -1041,7 +1009,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP ); CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
</PRE> </PRE>
<H4><A name="4.18">4.18</A>) How do I perform an outer join?</H4> <H4><A name="4.17">4.17</A>) How do I perform an outer join?</H4>
<P>PostgreSQL supports outer joins using the SQL standard syntax. <P>PostgreSQL supports outer joins using the SQL standard syntax.
Here are two examples:</P> Here are two examples:</P>
...@@ -1081,7 +1049,7 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -1081,7 +1049,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
ORDER BY col1 ORDER BY col1
</PRE> </PRE>
<H4><A name="4.19">4.19</A>) How do I perform queries using <H4><A name="4.18">4.18</A>) How do I perform queries using
multiple databases?</H4> multiple databases?</H4>
<P>There is no way to query a database other than the current one. <P>There is no way to query a database other than the current one.
...@@ -1093,7 +1061,7 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -1093,7 +1061,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
connections to different databases and merge the results on the connections to different databases and merge the results on the
client side.</P> client side.</P>
<H4><A name="4.20">4.20</A>) How do I return multiple rows or <H4><A name="4.19">4.19</A>) How do I return multiple rows or
columns from a function?</H4> columns from a function?</H4>
<P>In 7.3, you can easily return multiple rows or columns from a <P>In 7.3, you can easily return multiple rows or columns from a
...@@ -1101,7 +1069,7 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -1101,7 +1069,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
<a href="http://techdocs.postgresql.org/guides/SetReturningFunctions"> <a href="http://techdocs.postgresql.org/guides/SetReturningFunctions">
http://techdocs.postgresql.org/guides/SetReturningFunctions</a>. http://techdocs.postgresql.org/guides/SetReturningFunctions</a>.
<H4><A name="4.21">4.21</A>) Why can't I reliably create/drop <H4><A name="4.20">4.20</A>) Why can't I reliably create/drop
temporary tables in PL/PgSQL functions?</H4> temporary tables in PL/PgSQL functions?</H4>
<P>PL/PgSQL caches function contents, and an unfortunate side effect <P>PL/PgSQL caches function contents, and an unfortunate side effect
is that if a PL/PgSQL function accesses a temporary table, and that is that if a PL/PgSQL function accesses a temporary table, and that
...@@ -1111,7 +1079,7 @@ BYTEA bytea variable-length byte array (null-byte safe) ...@@ -1111,7 +1079,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
<SMALL>EXECUTE</SMALL> for temporary table access in PL/PgSQL. This <SMALL>EXECUTE</SMALL> for temporary table access in PL/PgSQL. This
will cause the query to be reparsed every time.</P> will cause the query to be reparsed every time.</P>
<H4><A name="4.22">4.22</A>) What encryption options are available? <H4><A name="4.21">4.21</A>) What encryption options are available?
</H4> </H4>
<UL> <UL>
<LI><I>contrib/pgcrypto</I> contains many encryption functions for <LI><I>contrib/pgcrypto</I> contains many encryption functions for
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment