From 0b72ebdc0c89c7cd76a6f6b7d3888326fe8463ec Mon Sep 17 00:00:00 2001
From: Bruce Momjian
Date: Sat, 15 Jan 2005 05:19:01 +0000
Subject: [PATCH] Merge query of system objects FAQ items.
---
doc/FAQ | 126 +++++++++++++++++++++++-------------------------
doc/src/FAQ/FAQ.html | 133 +++++++++++++++++++++++++--------------------------
2 files changed, 125 insertions(+), 134 deletions(-)
diff --git a/doc/FAQ b/doc/FAQ
index b13d16e361..be4b73bbb2 100644
--- a/doc/FAQ
+++ b/doc/FAQ
@@ -1,7 +1,7 @@
Frequently Asked Questions (FAQ) for PostgreSQL
- Last updated: Sun Jan 9 14:44:04 EST 2005
+ Last updated: Sat Jan 15 00:18:38 EST 2005
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
@@ -60,43 +60,42 @@
4.1) What is the difference between binary cursors and normal cursors?
4.2) How do I SELECT only the first few rows of a query? A random row?
- 4.3) How do I get a list of tables or other things I can see in psql?
+ 4.3) How do I find out what tables, indexes, databases, and users are
+ defined? How do I see the queries used by psql to display them?
4.4) How do you remove a column from a table, or change it's data
type?
4.5) What is the maximum size for a row, a table, and a database?
4.6) How much database disk space is required to store data from a
typical text file?
- 4.7) How do I find out what tables, indexes, databases, and users are
- defined?
- 4.8) My queries are slow or don't make use of the indexes. Why?
- 4.9) How do I see how the query optimizer is evaluating my query?
- 4.10) What is an R-tree index?
- 4.11) What is the Genetic Query Optimizer?
- 4.12) How do I perform regular expression searches and
+ 4.7) My queries are slow or don't make use of the indexes. Why?
+ 4.8) How do I see how the query optimizer is evaluating my query?
+ 4.9) What is an R-tree index?
+ 4.10) What is the Genetic Query Optimizer?
+ 4.11) How do I perform regular expression searches and
case-insensitive regular expression searches? How do I use an index
for case-insensitive searches?
- 4.13) In a query, how do I detect if a field is NULL?
- 4.14) What is the difference between the various character types?
- 4.15.1) How do I create a serial/auto-incrementing field?
- 4.15.2) How do I get the value of a SERIAL insert?
- 4.15.3) Doesn't currval() lead to a race condition with other users?
- 4.15.4) Why aren't my sequence numbers reused on transaction abort?
+ 4.12) In a query, how do I detect if a field is NULL?
+ 4.13) What is the difference between the various character types?
+ 4.14.0) How do I create a serial/auto-incrementing field?
+ 4.14.1) How do I get the value of a SERIAL insert?
+ 4.14.2) Doesn't currval() lead to a race condition with other users?
+ 4.14.3) Why aren't my sequence numbers reused on transaction abort?
Why are there gaps in the numbering of my sequence/SERIAL column?
- 4.16) What is an OID? What is a TID?
- 4.17) What is the meaning of some of the terms used in PostgreSQL?
- 4.18) Why do I get the error "ERROR: Memory exhausted in
+ 4.15) What is an OID? What is a TID?
+ 4.16) What is the meaning of some of the terms used in PostgreSQL?
+ 4.17) Why do I get the error "ERROR: Memory exhausted in
AllocSetAlloc()"?
- 4.19) How do I tell what PostgreSQL version I am running?
- 4.20) Why does my large-object operations get "invalid large obj
+ 4.18) How do I tell what PostgreSQL version I am running?
+ 4.19) Why does my large-object operations get "invalid large obj
descriptor"?
- 4.21) How do I create a column that will default to the current time?
- 4.22) Why are my subqueries using IN so slow?
- 4.23) How do I perform an outer join?
- 4.24) How do I perform queries using multiple databases?
- 4.25) How do I return multiple rows or columns from a function?
- 4.26) Why can't I reliably create/drop temporary tables in PL/PgSQL
+ 4.20) How do I create a column that will default to the current time?
+ 4.21) Why are my subqueries using IN so slow?
+ 4.22) How do I perform an outer join?
+ 4.23) How do I perform queries using multiple databases?
+ 4.24) How do I return multiple rows or columns from a function?
+ 4.25) Why can't I reliably create/drop temporary tables in PL/PgSQL
functions?
- 4.27) What encryption options are available?
+ 4.26) What encryption options are available?
Extending PostgreSQL
@@ -659,7 +658,8 @@ log_*
ORDER BY random()
LIMIT 1;
- 4.3) How do I get a list of tables or other things I can see in psql?
+ 4.3) How do I find out what tables, indexes, databases, and users are
+ defined? How do I see the queries used by psql to display them?
Use the \dt command to see tables in psql. For a complete list of
commands inside psql you can use \?. Alternatively you can read the
@@ -667,9 +667,16 @@ log_*
contains SQL commands that generate the output for psql's backslash
commands. You can also start psql with the -E option so it will print
out the queries it uses to execute the commands you give. PostgreSQL
- also provides an SQLi compliant INFORMATION SCHEMA interface you can
+ also provides an SQL compliant INFORMATION SCHEMA interface you can
query to get information about the database.
+ There are also system tables beginning with pg_ that describe these
+ too. Use psql -l will list all databases.
+
+ Also try the file pgsql/src/tutorial/syscat.source. It illustrates
+ many of the SELECTs needed to get information from the database system
+ tables.
+
4.4) How do you remove a column from a table, or change its data type?
DROP COLUMN functionality was added in release 7.3 with ALTER TABLE
@@ -749,18 +756,7 @@ log_*
NULLs are stored as bitmaps, so they use very little space.
- 4.7) How do I find out what tables, indexes, databases, and users are
- defined?
-
- psql has a variety of backslash commands to show such information. Use
- \? to see them. There are also system tables beginning with pg_ that
- describe these too. Also, psql -l will list all databases.
-
- Also try the file pgsql/src/tutorial/syscat.source. It illustrates
- many of the SELECTs needed to get information from the database system
- tables.
-
- 4.8) My queries are slow or don't make use of the indexes. Why?
+ 4.7) My queries are slow or don't make use of the indexes. Why?
Indexes are not automatically used by every query. Indexes are only
used if the table is larger than a minimum size, and the query selects
@@ -802,7 +798,7 @@ log_*
[a-e].
* Case-insensitive searches such as ILIKE and ~* do not utilise
indexes. Instead, use functional indexes, which are described in
- section 4.12.
+ section 4.11.
* 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
can create a special
@@ -815,11 +811,11 @@ LIKE
types exactly match the index's column types. This is particularly
true of int2, int8, and numeric column indexes.
- 4.9) How do I see how the query optimizer is evaluating my query?
+ 4.8) How do I see how the query optimizer is evaluating my query?
See the EXPLAIN manual page.
- 4.10) What is an R-tree index?
+ 4.9) What is an R-tree index?
An R-tree index is used for indexing spatial data. A hash index can't
handle range searches. A B-tree index only handles range searches in a
@@ -842,13 +838,13 @@ LIKE
extending R-trees requires a bit of work and we don't currently have
any documentation on how to do it.
- 4.11) What is the Genetic Query Optimizer?
+ 4.10) What is the Genetic Query Optimizer?
The GEQO module speeds query optimization when joining many tables by
means of a Genetic Algorithm (GA). It allows the handling of large
join queries through nonexhaustive search.
- 4.12) How do I perform regular expression searches and case-insensitive
+ 4.11) How do I perform regular expression searches and case-insensitive
regular expression searches? How do I use an index for case-insensitive
searches?
@@ -865,11 +861,11 @@ LIKE
functional index, it will be used:
CREATE INDEX tabindex ON tab (lower(col));
- 4.13) In a query, how do I detect if a field is NULL?
+ 4.12) In a query, how do I detect if a field is NULL?
You test the column with IS NULL and IS NOT NULL.
- 4.14) What is the difference between the various character types?
+ 4.13) What is the difference between the various character types?
Type Internal Name Notes
--------------------------------------------------
@@ -897,7 +893,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
particularly values that include NULL bytes. All the types described
here have similar performance characteristics.
- 4.15.1) How do I create a serial/auto-incrementing field?
+ 4.14.1) How do I create a serial/auto-incrementing field?
PostgreSQL supports a SERIAL data type. It auto-creates a sequence.
For example, this:
@@ -918,11 +914,11 @@ BYTEA bytea variable-length byte array (null-byte safe)
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.15.2) How do I get the value of a SERIAL insert?
+ 4.14.2) How do I get the value of a SERIAL insert?
One approach is to retrieve the next SERIAL value from the sequence
object with the nextval() function before inserting and then insert it
- explicitly. Using the example table in 4.15.1, an example in a
+ explicitly. Using the example table in 4.14.1, an example in a
pseudo-language would look like this:
new_id = execute("SELECT nextval('person_id_seq')");
execute("INSERT INTO person (id, name) VALUES (new_id, 'Blaise Pascal')");
@@ -944,19 +940,19 @@ BYTEA bytea variable-length byte array (null-byte safe)
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.15.3) Doesn't currval() lead to a race condition with other users?
+ 4.14.3) Doesn't currval() lead to a race condition with other users?
No. currval() returns the current value assigned by your backend, not
by all users.
- 4.15.4) Why aren't my sequence numbers reused on transaction abort? Why are
+ 4.14.4) Why aren't my sequence numbers reused on transaction abort? Why are
there gaps in the numbering of my sequence/SERIAL column?
To improve concurrency, sequence values are given out to running
transactions as needed and are not locked until the transaction
completes. This causes gaps in numbering from aborted transactions.
- 4.16) What is an OID? What is a TID?
+ 4.15) What is an OID? What is a TID?
OIDs are PostgreSQL's answer to unique row ids. Every row that is
created in PostgreSQL gets a unique OID. All OIDs generated during
@@ -989,7 +985,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
values. TIDs change after rows are modified or reloaded. They are used
by index entries to point to physical rows.
- 4.17) What is the meaning of some of the terms used in PostgreSQL?
+ 4.16) What is the meaning of some of the terms used in PostgreSQL?
Some of the source code and older documentation use terms that have
more common usage. Here are some:
@@ -1007,7 +1003,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
http://hea-www.harvard.edu/MST/simul/software/docs/pkgs/pgsql/glossary
/glossary.html
- 4.18) Why do I get the error "ERROR: Memory exhausted in AllocSetAlloc()"?
+ 4.17) Why do I get the error "ERROR: Memory exhausted in AllocSetAlloc()"?
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
@@ -1022,11 +1018,11 @@ BYTEA bytea variable-length byte array (null-byte safe)
problem with the SQL client because the backend is returning too much
data, try it before starting the client.
- 4.19) How do I tell what PostgreSQL version I am running?
+ 4.18) How do I tell what PostgreSQL version I am running?
From psql, type SELECT version();
- 4.20) Why does my large-object operations get "invalid large obj
+ 4.19) Why does my large-object operations get "invalid large obj
descriptor"?
You need to put BEGIN WORK and COMMIT around any use of a large object
@@ -1041,12 +1037,12 @@ BYTEA bytea variable-length byte array (null-byte safe)
If you are using a client interface like ODBC you may need to set
auto-commit off.
- 4.21) How do I create a column that will default to the current time?
+ 4.20) How do I create a column that will default to the current time?
Use CURRENT_TIMESTAMP:
CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
- 4.22) Why are my subqueries using IN so slow?
+ 4.21) Why are my subqueries using IN so slow?
In versions prior to 7.4, subqueries were joined to outer queries by
sequentially scanning the result of the subquery for each row of the
@@ -1067,7 +1063,7 @@ CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
In version 7.4 and later, IN actually uses the same sophisticated join
techniques as normal queries, and is prefered to using EXISTS.
- 4.23) How do I perform an outer join?
+ 4.22) How do I perform an outer join?
PostgreSQL supports outer joins using the SQL standard syntax. Here
are two examples:
@@ -1097,7 +1093,7 @@ CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2)
ORDER BY col1
- 4.24) How do I perform queries using multiple databases?
+ 4.23) How do I perform queries using multiple databases?
There is no way to query a database other than the current one.
Because PostgreSQL loads database-specific system catalogs, it is
@@ -1107,12 +1103,12 @@ CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
course, a client can make simultaneous connections to different
databases and merge the results on the client side.
- 4.25) How do I return multiple rows or columns from a function?
+ 4.24) How do I return multiple rows or columns from a function?
In 7.3, you can easily return multiple rows or columns from a
function, http://techdocs.postgresql.org/guides/SetReturningFunctions.
- 4.26) Why can't I reliably create/drop temporary tables in PL/PgSQL
+ 4.25) Why can't I reliably create/drop temporary tables in PL/PgSQL
functions?
PL/PgSQL caches function contents, and an unfortunate side effect is
@@ -1123,7 +1119,7 @@ CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
table access in PL/PgSQL. This will cause the query to be reparsed
every time.
- 4.27) What encryption options are available?
+ 4.26) What encryption options are available?
* contrib/pgcrypto contains many encryption functions for use in SQL
queries.
diff --git a/doc/src/FAQ/FAQ.html b/doc/src/FAQ/FAQ.html
index eb3730cbce..cb909c8ed5 100644
--- a/doc/src/FAQ/FAQ.html
+++ b/doc/src/FAQ/FAQ.html
@@ -10,7 +10,7 @@
alink="#0000ff">
Frequently Asked Questions (FAQ) for PostgreSQL
- Last updated: Sun Jan 9 14:44:04 EST 2005
+ Last updated: Sat Jan 15 00:18:38 EST 2005
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
@@ -86,60 +86,59 @@
cursors and normal cursors?
4.2) How do I SELECT only the
first few rows of a query? A random row?
- 4.3) How do I get a list of tables or other
- things I can see in psql?
+ 4.3) How do I find out what tables, indexes,
+ databases, and users are defined? How do I see the queries used
+ by psql to display them?
4.4) How do you remove a column from a
table, or change it's data type?
4.5) What is the maximum size for a row, a
table, and a database?
4.6) How much database disk space is required
to store data from a typical text file?
- 4.7) How do I find out what tables, indexes,
- databases, and users are defined?
- 4.8) My queries are slow or don't make use of
+ 4.7) My queries are slow or don't make use of
the indexes. Why?
- 4.9) How do I see how the query optimizer is
+ 4.8) How do I see how the query optimizer is
evaluating my query?
- 4.10) What is an R-tree index?
- 4.11) What is the Genetic Query Optimizer?
- 4.12) How do I perform regular expression
+ 4.9) What is an R-tree index?
+ 4.10) What is the Genetic Query Optimizer?
+ 4.11) How do I perform regular expression
searches and case-insensitive regular expression searches? How do I
use an index for case-insensitive searches?
- 4.13) In a query, how do I detect if a field
+ 4.12) In a query, how do I detect if a field
is NULL?
- 4.14) What is the difference between the
+ 4.13) What is the difference between the
various character types?
- 4.15.1) How do I create a
+ 4.14.0) How do I create a
serial/auto-incrementing field?
- 4.15.2) How do I get the value of a
+ 4.14.1) How do I get the value of a
SERIAL insert?
- 4.15.3) Doesn't currval()
+ 4.14.2) Doesn't currval()
lead to a race condition with other users?
- 4.15.4) Why aren't my sequence numbers
+ 4.14.3) Why aren't my sequence numbers
reused on transaction abort? Why are there gaps in the numbering of
my sequence/SERIAL column?
- 4.16) What is an OID? What is a
+ 4.15) What is an OID? What is a
TID?
- 4.17) What is the meaning of some of the terms
+ 4.16) What is the meaning of some of the terms
used in PostgreSQL?
- 4.18) Why do I get the error "ERROR: Memory
+ 4.17) Why do I get the error "ERROR: Memory
exhausted in AllocSetAlloc()"?
- 4.19) How do I tell what PostgreSQL version I
+ 4.18) How do I tell what PostgreSQL version I
am running?
- 4.20) Why does my large-object operations get
+ 4.19) Why does my large-object operations get
"invalid large obj descriptor"?
- 4.21) How do I create a column that will
+ 4.20) How do I create a column that will
default to the current time?
- 4.22) Why are my subqueries using
+ 4.21) Why are my subqueries using
IN
so slow?
- 4.23) How do I perform an outer join?
- 4.24) How do I perform queries using multiple
+ 4.22) How do I perform an outer join?
+ 4.23) How do I perform queries using multiple
databases?
- 4.25) How do I return multiple rows or columns
+ 4.24) How do I return multiple rows or columns
from a function?
- 4.26) Why can't I reliably create/drop
+ 4.25) Why can't I reliably create/drop
temporary tables in PL/PgSQL functions?
- 4.27) What encryption options are available?
+ 4.26) What encryption options are available?
Extending PostgreSQL
@@ -831,8 +830,9 @@
LIMIT 1;
- 4.3) How do I get a list of tables or other
- things I can see in psql?
+ 4.3) How do I find out what tables, indexes,
+ databases, and users are defined? How do I see the queries used
+ by psql to display them?
Use the \dt command to see tables in psql. For a complete list of
commands inside psql you can use \?. Alternatively you can read the source
@@ -840,10 +840,17 @@
contains SQL commands that generate the output for
psql's backslash commands. You can also start psql with the
-E option so it will print out the queries it uses to execute the
- commands you give. PostgreSQL also provides an SQLi compliant
+ commands you give. PostgreSQL also provides an SQL compliant
INFORMATION SCHEMA interface you can query to get information about the
database.
+ There are also system tables beginning with pg_ that describe
+ these too. Use psql -l will list all databases.
+
+ Also try the file pgsql/src/tutorial/syscat.source. It
+ illustrates many of the SELECTs needed to get
+ information from the database system tables.
+
4.4) How do you remove a column from a
table, or change its data type?
@@ -935,19 +942,7 @@
NULLs are stored as bitmaps, so they
use very little space.
- 4.7) How do I find out what tables, indexes,
- databases, and users are defined?
-
- psql has a variety of backslash commands to show such
- information. Use \? to see them. There are also system tables
- beginning with pg_ that describe these too. Also, psql
- -l will list all databases.
-
- Also try the file pgsql/src/tutorial/syscat.source. It
- illustrates many of the SELECTs needed to get
- information from the database system tables.
-
- 4.8) My queries are slow or don't make use of
+ 4.7) My queries are slow or don't make use of
the indexes. Why?
Indexes are not automatically used by every query. Indexes are only
@@ -998,7 +993,7 @@
e.g. [a-e].
Case-insensitive searches such as ILIKE and
~* do not utilise indexes. Instead, use functional
- indexes, which are described in section 4.12.
+ indexes, which are described in section 4.11.
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 can create a special
@@ -1011,12 +1006,12 @@
types exactly match the index's column types. This is particularly
true of int2, int8, and numeric column indexes.
- 4.9) How do I see how the query optimizer is
+ 4.8) How do I see how the query optimizer is
evaluating my query?
See the EXPLAIN manual page.
- 4.10) What is an R-tree index?
+ 4.9) What is an R-tree index?
An R-tree index is used for indexing spatial data. A hash index
can't handle range searches. A B-tree index only handles range
@@ -1041,7 +1036,7 @@
practice, extending R-trees requires a bit of work and we don't
currently have any documentation on how to do it.
- 4.11) What is the Genetic Query
+ 4.10) What is the Genetic Query
Optimizer?
The GEQO module speeds query optimization when
@@ -1049,7 +1044,7 @@
the handling of large join queries through nonexhaustive
search.
- 4.12) How do I perform regular expression
+ 4.11) How do I perform regular expression
searches and case-insensitive regular expression searches? How do I
use an index for case-insensitive searches?
@@ -1072,13 +1067,13 @@
CREATE INDEX tabindex ON tab (lower(col));
- 4.13) In a query, how do I detect if a field
+ 4.12) In a query, how do I detect if a field
is NULL?
You test the column with IS NULL and IS
NOT NULL.
- 4.14) What is the difference between the
+ 4.13) What is the difference between the
various character types?
Type Internal Name Notes
@@ -1110,7 +1105,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
particularly values that include NULL bytes. All the
types described here have similar performance characteristics.
- 4.15.1) How do I create a
+ 4.14.1) How do I create a
serial/auto-incrementing field?
PostgreSQL supports a SERIAL data type. It
@@ -1138,13 +1133,13 @@ BYTEA bytea variable-length byte array (null-byte safe)
you need to use pg_dump's -o option or COPY
WITH OIDS option to preserve the OIDs.
-
4.15.2) How do I get the value of a
+ 4.14.2) How do I get the value of a
SERIAL insert?
One approach is to retrieve the next SERIAL value
from the sequence object with the nextval() function
before inserting and then insert it explicitly. Using the
- example table in 4.15.1, an example in a
+ example table in 4.14.1, an example in a
pseudo-language would look like this:
new_id = execute("SELECT nextval('person_id_seq')");
@@ -1167,7 +1162,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
new_id = execute("SELECT currval('person_id_seq')");
- Finally, you could use the OID
+
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.
@@ -1175,13 +1170,13 @@ BYTEA bytea variable-length byte array (null-byte safe)
available via $sth->{pg_oid_status} after
$sth->execute().
- 4.15.3) Doesn't currval()
+ 4.14.3) Doesn't currval()
lead to a race condition with other users?
No. currval() returns the current value assigned by your
backend, not by all users.
- 4.15.4) Why aren't my sequence numbers
+ 4.14.4) Why aren't my sequence numbers
reused on transaction abort? Why are there gaps in the numbering of
my sequence/SERIAL column?
@@ -1190,7 +1185,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
completes. This causes gaps in numbering from aborted
transactions.
- 4.16) What is an OID? What is
+ 4.15) What is an OID? What is
a TID?
OIDs are PostgreSQL's answer to unique row ids.
@@ -1230,7 +1225,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
are modified or reloaded. They are used by index entries to point
to physical rows.
- 4.17) What is the meaning of some of the
+ 4.16) What is the meaning of some of the
terms used in PostgreSQL?
Some of the source code and older documentation use terms that
@@ -1259,7 +1254,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
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.18) Why do I get the error "ERROR:
+ 4.17) Why do I get the error "ERROR:
Memory exhausted in AllocSetAlloc()"?
You probably have run out of virtual memory on your system,
@@ -1278,12 +1273,12 @@ BYTEA bytea variable-length byte array (null-byte safe)
backend is returning too much data, try it before starting the
client.
-
4.19) How do I tell what PostgreSQL version
+ 4.18) How do I tell what PostgreSQL version
I am running?
From psql, type SELECT version();
- 4.20) Why does my large-object operations
+ 4.19) Why does my large-object operations
get "invalid large obj descriptor"?
You need to put BEGIN WORK
and COMMIT
@@ -1299,7 +1294,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
If you are using a client interface like ODBC you
may need to set auto-commit off.
- 4.21) How do I create a column that will
+ 4.20) How do I create a column that will
default to the current time?
Use CURRENT_TIMESTAMP:
@@ -1308,7 +1303,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
- 4.22) Why are my subqueries using
+ 4.21) Why are my subqueries using
IN
so slow?
In versions prior to 7.4, subqueries were joined to outer queries
@@ -1332,7 +1327,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
sophisticated join techniques as normal queries, and is prefered
to using EXISTS
.
-
4.23) How do I perform an outer join?
+ 4.22) How do I perform an outer join?
PostgreSQL supports outer joins using the SQL standard syntax.
Here are two examples:
@@ -1372,7 +1367,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
ORDER BY col1
- 4.24) How do I perform queries using
+ 4.23) How do I perform queries using
multiple databases?
There is no way to query a database other than the current one.
@@ -1384,7 +1379,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
connections to different databases and merge the results on the
client side.
- 4.25) How do I return multiple rows or
+ 4.24) How do I return multiple rows or
columns from a function?
In 7.3, you can easily return multiple rows or columns from a
@@ -1392,7 +1387,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
http://techdocs.postgresql.org/guides/SetReturningFunctions.
-
4.26) Why can't I reliably create/drop
+ 4.25) Why can't I reliably create/drop
temporary tables in PL/PgSQL functions?
PL/PgSQL caches function contents, and an unfortunate side effect
is that if a PL/PgSQL function accesses a temporary table, and that
@@ -1402,7 +1397,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
EXECUTE for temporary table access in PL/PgSQL. This
will cause the query to be reparsed every time.
- 4.27) What encryption options are available?
+ 4.26) What encryption options are available?
- contrib/pgcrypto contains many encryption functions for
--
2.11.0