Skip to content

Commit f7e514d

Browse files
committed
Update FAQ by eliminating non-frequent items like large objects and
extending questions. Update wording of various entries.
1 parent 48e7a19 commit f7e514d

File tree

2 files changed

+66
-185
lines changed

2 files changed

+66
-185
lines changed

doc/FAQ

Lines changed: 28 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Frequently Asked Questions (FAQ) for PostgreSQL
33

4-
Last updated: Sat Apr 23 14:59:01 EDT 2005
4+
Last updated: Sat Apr 23 16:49:43 EDT 2005
55

66
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
77

@@ -67,29 +67,17 @@
6767
4.11.3) Doesn't currval() lead to a race condition with other users?
6868
4.11.4) Why aren't my sequence numbers reused on transaction abort?
6969
Why are there gaps in the numbering of my sequence/SERIAL column?
70-
4.12) What is an OID? What is a TID?
70+
4.12) What is an OID? What is a CTID?
7171
4.13) Why do I get the error "ERROR: Memory exhausted in
7272
AllocSetAlloc()"?
7373
4.14) How do I tell what PostgreSQL version I am running?
74-
4.15) Why does my large-object operations get "invalid large obj
75-
descriptor"?
76-
4.16) How do I create a column that will default to the current time?
77-
4.17) How do I perform an outer join?
78-
4.18) How do I perform queries using multiple databases?
79-
4.19) How do I return multiple rows or columns from a function?
80-
4.20) Why do I get "relation with OID ##### does not exist" errors
74+
4.15) How do I create a column that will default to the current time?
75+
4.16) How do I perform an outer join?
76+
4.17) How do I perform queries using multiple databases?
77+
4.18) How do I return multiple rows or columns from a function?
78+
4.19) Why do I get "relation with OID ##### does not exist" errors
8179
when accessing temporary tables in PL/PgSQL functions?
82-
4.21) What encryption options are available?
83-
84-
Extending PostgreSQL
85-
86-
5.1) I wrote a user-defined function. When I run it in psql, why does
87-
it dump core?
88-
5.2) How can I contribute some nifty new types and functions to
89-
PostgreSQL?
90-
5.3) How do I write a C function to return a tuple?
91-
5.4) I have changed a source file. Why does the recompile not see the
92-
change?
80+
4.20) What encryption options are available?
9381
_________________________________________________________________
9482

9583
General Questions
@@ -529,8 +517,8 @@
529517
LIMIT 1;
530518

531519
If you believe the optimizer is incorrect in choosing a sequential
532-
scan, use SET enable_seqscan TO 'off' and run tests to see if an index
533-
scan is indeed faster.
520+
scan, use SET enable_seqscan TO 'off' and run query again to see if an
521+
index scan is indeed faster.
534522

535523
When using wild-card operators such as LIKE or ~, indexes can only be
536524
used in certain circumstances:
@@ -576,13 +564,13 @@
576564
4.9) In a query, how do I detect if a field is NULL? How can I sort on
577565
whether a field is NULL or not?
578566

579-
You test the column with IS NULL and IS NOT NULL.
567+
You test the column with IS NULL and IS NOT NULL, like this:
580568
SELECT *
581569
FROM tab
582570
WHERE col IS NULL;
583571

584572
To sort by the NULL status, use the IS NULL and IS NOT NULL modifiers
585-
in your WHERE clause. Things that are true will sort higher than
573+
in your ORDER BY clause. Things that are true will sort higher than
586574
things that are false, so the following will put NULL entries at the
587575
top of the resulting list:
588576
SELECT *
@@ -603,9 +591,9 @@
603591

604592
The first four types above are "varlena" types (i.e., the first four
605593
bytes on disk are the length, followed by the data). Thus the actual
606-
space used is slightly greater than the declared size. However, these
607-
data types are also subject to compression or being stored out-of-line
608-
by TOAST, so the space on disk might also be less than expected.
594+
space used is slightly greater than the declared size. However, long
595+
values are also subject to compression, so the space on disk might
596+
also be less than expected.
609597
VARCHAR(n) is best when storing variable-length strings and it limits
610598
how long a string can be. TEXT is for strings of unlimited length,
611599
with a maximum of one gigabyte.
@@ -647,8 +635,8 @@
647635
You would then also have the new value stored in new_id for use in
648636
other queries (e.g., as a foreign key to the person table). Note that
649637
the name of the automatically created SEQUENCE object will be named
650-
<table>_<serialcolumn>_seq, where table and serialcolumn are the names
651-
of your table and your SERIAL column, respectively.
638+
<table>_< serialcolumn>_seq, where table and serialcolumn are the
639+
names of your table and your SERIAL column, respectively.
652640

653641
Alternatively, you could retrieve the assigned SERIAL value with the
654642
currval() function after it was inserted by default, e.g.,
@@ -667,7 +655,7 @@
667655
transactions as needed and are not locked until the transaction
668656
completes. This causes gaps in numbering from aborted transactions.
669657

670-
4.12) What is an OID? What is a TID?
658+
4.12) What is an OID? What is a CTID?
671659

672660
Every row that is created in PostgreSQL gets a unique OID unless
673661
created WITHOUT OIDS. OIDs are autotomatically assigned unique 4-byte
@@ -680,9 +668,9 @@
680668
single table. and are therefore less likely to overflow. SERIAL8 is
681669
available for storing eight-byte sequence values.
682670

683-
TIDs are used to identify specific physical rows with block and offset
684-
values. TIDs change after rows are modified or reloaded. They are used
685-
by index entries to point to physical rows.
671+
CTIDs are used to identify specific physical rows with block and
672+
offset values. CTIDs change after rows are modified or reloaded. They
673+
are used by index entries to point to physical rows.
686674

687675
4.13) Why do I get the error "ERROR: Memory exhausted in AllocSetAlloc()"?
688676

@@ -703,26 +691,12 @@
703691

704692
From psql, type SELECT version();
705693

706-
4.15) Why does my large-object operations get "invalid large obj descriptor"?
707-
708-
You need to put BEGIN WORK and COMMIT around any use of a large object
709-
handle, that is, surrounding lo_open ... lo_close.
710-
711-
Currently PostgreSQL enforces the rule by closing large object handles
712-
at transaction commit. So the first attempt to do anything with the
713-
handle will draw invalid large obj descriptor. So code that used to
714-
work (at least most of the time) will now generate that error message
715-
if you fail to use a transaction.
716-
717-
If you are using a client interface like ODBC you may need to set
718-
auto-commit off.
719-
720-
4.16) How do I create a column that will default to the current time?
694+
4.15) How do I create a column that will default to the current time?
721695

722696
Use CURRENT_TIMESTAMP:
723697
CREATE TABLE test (x int, modtime TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
724698

725-
4.17) How do I perform an outer join?
699+
4.16) How do I perform an outer join?
726700

727701
PostgreSQL supports outer joins using the SQL standard syntax. Here
728702
are two examples:
@@ -740,7 +714,7 @@
740714
is assumed in LEFT, RIGHT, and FULL joins. Ordinary joins are called
741715
INNER joins.
742716

743-
4.18) How do I perform queries using multiple databases?
717+
4.17) How do I perform queries using multiple databases?
744718

745719
There is no way to query a database other than the current one.
746720
Because PostgreSQL loads database-specific system catalogs, it is
@@ -750,13 +724,13 @@
750724
course, a client can also make simultaneous connections to different
751725
databases and merge the results on the client side.
752726

753-
4.19) How do I return multiple rows or columns from a function?
727+
4.18) How do I return multiple rows or columns from a function?
754728

755729
It is easy using set-returning functions,
756730
http://techdocs.postgresql.org/guides/SetReturningFunctions
757731
.
758732

759-
4.20) Why do I get "relation with OID ##### does not exist" errors when
733+
4.19) Why do I get "relation with OID ##### does not exist" errors when
760734
accessing temporary tables in PL/PgSQL functions?
761735

762736
PL/PgSQL caches function scripts, and an unfortunate side effect is
@@ -767,7 +741,7 @@
767741
table access in PL/PgSQL. This will cause the query to be reparsed
768742
every time.
769743

770-
4.21) What encryption options are available?
744+
4.20) What encryption options are available?
771745

772746
* contrib/pgcrypto contains many encryption functions for use in SQL
773747
queries.
@@ -779,33 +753,4 @@
779753
or ssh, rather than PostgreSQL's native SSL connections.)
780754
* Database user passwords are automatically encrypted when stored in
781755
the system tables.
782-
* The server can run using an encrypted file system.
783-
_________________________________________________________________
784-
785-
Extending PostgreSQL
786-
787-
5.1) I wrote a user-defined function. When I run it in psql, why does it dump
788-
core?
789-
790-
The problem could be a number of things. Try testing your user-defined
791-
function in a stand-alone test program first.
792-
793-
5.2) How can I contribute some nifty new types and functions to PostgreSQL?
794-
795-
Send your extensions to the pgsql-hackers mailing list, and they will
796-
eventually end up in the contrib/ subdirectory.
797-
798-
5.3) How do I write a C function to return a tuple?
799-
800-
In versions of PostgreSQL beginning with 7.3, table-returning
801-
functions are fully supported in C, PL/PgSQL, and SQL. See the
802-
Programmer's Guide for more information. An example of a
803-
table-returning function defined in C can be found in
804-
contrib/tablefunc.
805-
806-
5.4) I have changed a source file. Why does the recompile not see the change?
807-
808-
The Makefiles do not have the proper dependencies for include files.
809-
You have to do a make clean and then another make. If you are using
810-
GCC you can use the --enable-depend option of configure to have the
811-
compiler compute the dependencies automatically.
756+
* The server can also run using an encrypted file system.

0 commit comments

Comments
 (0)