Select Git revision
FAQ_russian.html
FAQ_russian.html 46.61 KiB
<!DOCTYPE html PUBLIC "-//W3C//DTD html 4.01 transitional//EN">
<HTML>
<!-- DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN" -->
<HEAD>
<META name="generator" content="HTML Tidy, see www.w3.org">
<META http-equiv="Content-Type" content="text/html; charset=koi8-r">
<TITLE>PostgreSQL FAQ</TITLE>
</HEAD>
<BODY bgcolor="#ffffff" text="#000000" link="#ff0000" vlink="#a00000" alink="#0000ff">
<H1> PostgreSQL</H1>
<P> : 30 09:11:03 EDT 2005</P>
<P> : (Bruce Momjian) (<A href=
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR>
</P>
<P>ף : (<A href=
"mailto:corochoone@perm.ru">corochoone@perm.ru</A>)<BR>
</P>
<P>
<A href="http://www.postgresql.org/files/documentation/faqs/FAQ.html">http://www.PostgreSQL.org/files/documentation/faqs/FAQ.html</A>.</P>
<P>
<A href="http://www.postgresql.org/docs/faq/">http://www.PostgreSQL.org/docs/faq/</A>.</P>
<HR>
<H2 align="center"> </H2>
<A href="#1.1">1.1</A>) PostgreSQL? ?<BR>
<A href="#1.2">1.2</A>) PostgreSQL?<BR>
<A href="#1.3">1.3</A>) PostgreSQL?<BR>
<A href="#1.4">1.4</A>) PostgreSQL?<BR>
<A href="#1.5">1.5</A>) ?<BR>
<A href="#1.6">1.6</A>) ?<BR>
<A href="#1.7">1.7</A>) ?<BR>
<A href="#1.8">1.8</A>) ?<BR>
<A href="#1.9">1.9</A>)
?<BR>
<A href="#1.10">1.10</A>) <SMALL>SQL</SMALL>?<BR>
<A href="#1.11">1.11</A>) ?<BR>
<A href="#1.12">1.12</A>) PostgreSQL
<SMALL></SMALL>?<BR>
<A href="#1.13">1.13</A>) PostgreSQL?<BR>
<H2 align="center"> </H2>
<A href="#2.1">2.1</A>) PostgreSQL?<BR>
<A href="#2.2">2.2</A>)
PostgreSQL Web?<BR>
<A href="#2.3">2.3</A>) PostgreSQL
?<BR>
<H2 align="center"> </H2>
<A href="#3.1">3.1</A>) PostgreSQL
<I>/usr/local/pgsql</I>?<BR>
<A href="#3.2">3.2</A>)
?<BR>
<A href="#3.3">3.3</A>)
?<BR>
<A href="#3.4">3.4</A>) ?<BR>
<A href="#3.5">3.5</A>) <I>"Sorry, too many
clients"</I> ?<BR>
<A href="#3.6">3.6</A>) dump restore
PostgreSQL?<BR>
<A href="#3.7">3.7</A>) ""
?<BR>
<H2 align="center"> </H2>
<A href="#4.1">4.1</A>) <SMALL>SELECT</SMALL>
? ?<BR>
<A href="#4.2">4.2</A>) , ,
? ,
<I>psql</I> ?<BR>
<A href="#4.3">4.3</A>) ?<BR>
<A href="#4.4">4.4</A>) ,
?<BR>
<A href="#4.5">4.5</A>)
?<BR>
<A href="#4.6">4.6</A>) ?
?<BR>
<A href="#4.7">4.7</A>) ,
?<BR>
<A href="#4.8">4.8</A>)
?
?<BR>
<A href="#4.9">4.9</A>) ,
<SMALL>NULL</SMALL> - ?
<SMALL>NULL</SMALL> ?<BR>
<A href="#4.10">4.10</A>)
?<BR>
<A href="#4.11.1">4.11.1</A>) serial/--?<BR>
<A href="#4.11.2">4.11.2</A>)
<SMALL>SERIAL</SMALL>?<BR>
<A href="#4.11.3">4.11.3</A>) ,
<I>currval()</I> <I>nextval()</I>
?<BR>
<A href="#4.11.4">4.11.4</A>)
?
, /SERIAL?<BR>
<A href="#4.12">4.12</A>) <SMALL>OID</SMALL>?
<SMALL>CTID</SMALL>?<BR>
<A href="#4.13">4.13</A>) <I>"ERROR: Memory
exhausted in AllocSetAlloc()"</I>?<BR>
<A href="#4.14">4.14</A>) , PostgreSQL
?<BR>
<A href="#4.15">4.15</A>)
?<BR>
<A href="#4.16">4.16</A>) ?<BR>
<A href="#4.17">4.17</A>) ,
?<BR>
<A href="#4.18">4.18</A>) ?<BR>
<A href="#4.19">4.19</A>) "relation with OID ####
", PL/PgSQL?<BR>
<A href="#4.20">4.20</A>) ?<BR>
<HR>
<H2 align="center"> </H2>
<H3><A name="1.1">1.1</A>) PostgreSQL? ?</H3>
<P>PostgreSQL <I>Post-Gres-Q-L (---)</I>,
<I>Postgres</I>.</P>
<P>PostgreSQL - -
(),
<small></small> , <small></small>
. PostgreSQL -
.</P>
<P> PostgreSQL ,
.
- .
FAQ ,
<A href="http://www.postgresql.org/files/documentation/faqs/FAQ_DEV.html"> http://www.PostgreSQL.org/files/documentation/faqs/FAQ_DEV.html</A>
</P>
<H3><A name="1.2">1.2</A>) PostgreSQL?</H3>
<P>PostgreSQL BSD.
,
. ţ
.</P>
<P> BSD, :</P>
<P> PostgreSQL</P>
<P>Portions copyright (c) 1996-2005, PostgreSQL Global Development
Group Portions Copyright (c) 1994-1996 Regents of the University of
California</P>
<P> , ,
, - ,
,
.</P>
<P>
, ,
,
,
.</P>
<P>
, , :
.
" "
, , , .</P>
<H3><A name="1.3">1.3</A>) PostgreSQL?</H3>
<P>, PostgreSQL
Unix. ,
, PostgreSQL
.</P>
<P>PostgreSQL Microsoft
Windows, NT, Win2000, WinXP Win2003.
<A href="http://pgfoundry.org/projects/pginstaller">
http://pgfoundry.org/projects/pginstaller</A>. Windows,
MS-DOS (Win95, Win98, WinMe)
PostgreSQL Cygwin.</P>
<P> Novell Netware 6
<A href="http://forge.novell.com/">http://forge.novell.com</A>,
OS/2 (eComStation)
<A href="http://hobbes.nmsu.edu/cgi-bin/h-search?sh=1&button=Search&key=postgreSQL&stype=all&sort=type&dir=%2F">
http://hobbes.nmsu.edu/cgi-bin/h-search?sh=1&button=Search&key=postgreSQL&stype=all&sort=type&dir=%2F</A>.</P>
<H3><A name="1.4">1.4</A>) PostgreSQL?</H3>
<P> , <a href="http://www.postgresql.org/ftp/">
http://www.postgresql.org/ftp/</a> ftp,
<A href="ftp://ftp.PostgreSQL.org/pub/">ftp://ftp.PostgreSQL.org/pub/</A>.</P>
<H3><A name="1.5">1.5</A>) ?</H3>
<P> PostgreSQL
E-mail. web- E-mail : <A href="http://www.postgresql.org/community/lists/">
http://www.postgresql.org/community/lists/</A>.
, <i>general</i>
( ) <i>bugs</i> ().</P>
<P> IRC <I>#postgreql</I>,
Freenode (<I>irc.freenode.net</I>).
, Unix
<code>irc -c '#postgresql' "$USER" irc.freenode.net</code>
IRC .
(<I>#postgresql-es</I>) (<I>#postgresqlfr</I>)
. PostgreSQL EFNet.</P>
<P>
<A href="http://techdocs.postgresql.org/companies.php">
http://techdocs.postgresql.org/companies.php</A>.</P>
<H3><A name="1.6">1.6</A>) ?</H3>
<P> ޣ
PostgreSQL :
<A HREF="http://www.postgresql.org/support/submitbug">
http://www.postgresql.org/support/submitbug</A>.</P>
<P> PostgreSQL
FTP <A href="ftp://ftp.postgresql.org/pub/">
ftp://ftp.PostgreSQL.org/pub/</A>.
<H3><A name="1.7">1.7</A>) ?</H3>
<P> PostgreSQL - 8.0.2</P>
<P> ,
.</P>
<H3><A name="1.8">1.8</A>) ?</H3>
<P>PostgreSQL , ,
man
. <I>/doc</I>.
<A href="http://www.postgresql.org/docs">
http://www.PostgreSQL.org/docs</A>.</P>
<P> PostgreSQL <A href=
"http://www.PostgreSQL.org/docs/books/awbook.html">http://www.PostgreSQL.org/docs/books/awbook.html</A>
<a href="http://www.commandprompt.com/ppbook/">http://www.commandprompt.com/ppbook/</a>.
PostgreSQL, .
(Korry Douglas).
<a href="http://techdocs.postgresql.org/techdocs/bookreviews.php">http://techdocs.postgresql.org/techdocs/bookreviews.php</a>.
, <a href="http://techdocs.postgresql.org">http://techdocs.PostgreSQL.org/</a>
PostgreSQL.</P>
<P> <I>psql</I> \d
, , , .. -
\? .</P>
<P> .</P>
<H3><A name="1.9">1.9</A>)
?</H3>
<P>PostgreSQL <SMALL>SQL</SMALL>-92.
<A href="http://www.postgresql.org/docs/faqs.TODO.html">TODO</A>
,
.</P>
<H3><A name="1.10">1.10</A>) <SMALL>SQL</SMALL>?</H3>
<P>-, PostgreSQL,
. - "Teach Yourself SQL in 21 Days,
Second Edition" ( SQL 21 , )
<A href="http://members.tripod.com/er4ebus/sql/index.htm">
http://members.tripod.com/er4ebus/sql/index.htm</A>.
<I>The Practical SQL Handbook</I>,
Bowman, Judith S., et al., Addison-Wesley. <I>The
Complete Reference SQL</I>, Groff et al., McGraw-Hill.</P>
<A href=
"http://www.intermedia.net/support/sql/sqltut.shtm">http://www.intermedia.net/support/sql/sqltut.shtm,</A>
<A href="http://ourworld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM">
http://ourworld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM,</A>
<A href="http://sqlcourse.com/">http://sqlcourse.com.</A></P>
<H3><A name="1.11">1.11</A>) ?</H3>
<P> <a href="http://www.postgresql.org/docs/faqs.FAQ_DEV.html">
FAQ </A>.</P>
<H3><A name="1.12">1.12</A>) PostgreSQL
<SMALL></SMALL>?</H3>
<P>
:
, , , .</P>
<DL>
<DT><B></B></DT>
<DD>PostgreSQL
<SMALL></SMALL>, : ,
, , ,
. ,
: , ,
,
.<BR>
<BR>
</DD>
<DT><B></B></DT>
<DD> PostgreSQL
. - ,
- . +/-10%
.
<BR>
</DD>
<DT><B></B></DT>
<DD> , <SMALL></SMALL>
. ,
, .
-
, ,
. , ,
.<BR>
<BR>
</DD>
<DT><B></B></DT>
<DD>
, . , -
, <SMALL></SMALL>
. ,
,
PostgreSQL <SMALL></SMALL>.
,
. ( <A href="#1.5"> 1.5</A>.)<BR>
<BR>
</DD>
<DT><B></B></DT>
<DD> ,
.
, ,
BSD, .<BR>
<BR>
</DD>
</DL>
<H3><A name="1.13">1.13</A>) PostgreSQL?</H3>
<P> - ,
, --- .
, CVS,
,
.
,
. ӣ --
. (
PostgreSQL
<a href="http://www.postgresql.org/docs/faqs.FAQ_DEV.html">
FAQ </A>.)</P>
<HR>
<H3 align="center"> </H3>
<H3><A name="2.1">2.1</A>) PostgreSQL?</H3>
<P> PostgreSQL <small>C</small>
(embedded) <small>C</small> .
;
.</P>
<P> , <small>PHP</small>
PostgreSQL.
Perl, <small>TCL</small>, Python ,
<A href="http://gborg.postgresql.org">http://gborg.postgresql.org</A>
<i>Drivers/Interfaces</I>, .</P>
<H3><A name="2.2">2.2</A>)
PostgreSQL Web?</H3>
<P> Web :
<A href="http://www.webreview.com">http://www.webreview.com</A></P>
<P> Web, PHP <A href="http://www.php.net">
http://www.php.net</A> .</P>
<P> , Perl DBD::Pg CGI.pm
mod_perl.</P>
<H3><A name="2.3">2.3</A>) PostgreSQL
?</H3>
<P>, <a href="http://techdocs.postgresql.org/guides/GUITools">
http://techdocs.postgresql.org/guides/GUITools</A>.</P>
<HR>
<H2 align="center"> </H2>
<H3><A name="3.1">3.1</A>) PostgreSQL
<I>/usr/local/pgsql</I>?</H3>
<P> <I>--prefix</I> <I>configure</I>.</P>
<H3><A name="3.2">3.2</A>)
?</H3>
<P> , PostgreSQL
Unix TCP/IP . ,
<I>listen_addresses</I> <I>postgresql.conf</I>,
host- <I>$PGDATA/pg_hba.conf</I>
.</P>
<H3><A name="3.3">3.3</A>)
?</H3>
<P> ,
:</P>
<DL>
<DT><B> </B></DT>
<DD>
:
<UL>
<LI> , </LI>
<LI> COPY <small>INSERT</small></LI>
<LI>
</LI>
<LI> <small>CLUSTER</small>, ң
</LI>
<LI> <small>LIMIT</small> ,
</LI>
<LI> (Prepared) </LI>
<LI> <small>ANALYZE</small>
</LI>
<LI> <small>VACUUM</small> <I>pg_autovacuum</I></LI>
<LI> </LI>
</UL>
<BR><BR>
</DD>
<DT><B> </B></DT>
<DD> <I>postgresql.conf</I>
. .
<A href="http://www.postgresql.org/docs/current/static/runtime.html">
Administration Guide/Server Run-time Environment/Run-time Configuration</A>,
. <A href="http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html">
http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html</A>
<A href="http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html">
http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html</A>.
<BR><BR>
</DD>
<DT><B> "" - </B></DT>
<DD> ""
<A href="http://candle.pha.pa.us/main/writings/pgsql/hw_performance/index.html">
http://candle.pha.pa.us/main/writings/pgsql/hw_performance/index.html</A>
<A href="http://www.powerpostgresql.com/PerfList/">
http://www.powerpostgresql.com/PerfList/</A>.
<BR><BR>
</DD> </DL>
<H3><A name="3.4">3.4</A>)
?</H3>
<P> ,
<code>log_*</code>,
,
.</P>
<H3><A name="3.5">3.5</A>) <I>"Sorry, too
many clients"</I> ?</H3>
<P> 100
.
<I>postmaster</I> backend ,
<I>max_connections</I> <I>postgresql.conf</I>
<I>postmaster</I>.</P>
<H3><A name="3.6">3.6</A>) dump restore
PostgreSQL?</H3>
<P> PostgreSQL
. 7.4.0 7.4.1
dump restore.
(.. , 7.3 7.4)
.
,
. dump
,
.</P>
<P> , ,
<i>pg_upgrade</i>
dump/restore.
<i>pg_upgrade</i> .</P>
<H3><A name="3.7">3.7</A>) ""
?</H3>
<P> ""
, , ""
. . ECC, SCSI
ģ ,
"". PostgreSQL "",
ģ ,
"". ""
.</P>
<HR>
<H2 align="center"> </H2>
<H3><A name="4.1">4.1</A>) <SMALL>SELECT</SMALL>
? ?</H3>
<P> ,
<SMALL>SELECT</SMALL> <SMALL>LIMIT</SMALL>.</P>
- , <SMALL>ORDER BY</SMALL>,
, .
<SMALL>SELECT</SMALL>,
<SMALL>FETCH</SMALL>.</P>
<P>To <small>SELECT</small> a random row, use:</P>
<PRE> SELECT col
FROM tab
ORDER BY random() LIMIT 1;
</PRE>
<H3><A name="4.2">4.2</A>) , ,
? ,
<I>psql</I> ?</H3>
<P> <I>psql</I>, \dt.
<I>psql</I> , \?.
, <I>psql</I>
<I>pgsql/src/bin/psql/describe.c</I>.
<SMALL>SQL</SMALL> <I>psql</I> ,
.
<I>psql</I> <I>-E</I> ,
,
. PostgreSQL <SMALL>SQL</SMALL>
INFORMATION SCHEMA , ,
.</P>
<P> , <I>pg_</I>.</P>
<P> <I>psql -l</I> .</P>
<P> <I>pgsql/src/tutorial/syscat.source</I>.
<SMALL>SELECT</SMALL>
.</P>
<H3><A name="4.3">4.3</A>) ?</H3>
<P> 8.0 ,
<SMALL>ALTER TABLE ALTER COLUMN TYPE</SMALL>.</P>
<P> :</P>
<PRE>
BEGIN;
ALTER TABLE tab ADD COLUMN new_col <i>new_data_type</i>;
UPDATE tab SET new_col = CAST(old_col AS <i>new_data_type</i>);
ALTER TABLE tab DROP COLUMN old_col;
COMMIT;
</PRE>
<H3><A name="4.4">4.4</A>) ,
?</H3>
<P> :</P>
<BLOCKQUOTE>
<TABLE>
<TR>
<TD> ?</TD>
<TD> ( 32 TB)</TD>
</TR>
<TR>
<TD> ?</TD>
<TD>32 TB</TD>
</TR>
<TR>
<TD> ?</TD>
<TD>1.6 TB</TD>
</TR>
<TR>
<TD> ?</TD>
<TD>1 GB</TD>
</TR>
<TR>
<TD> ?</TD>
<TD></TD>
</TR>
<TR> <TD> ?</TD>
<TD>250-1600 </TD>
</TR>
<TR>
<TD> ?</TD>
<TD></TD>
</TR>
</TABLE>
</BLOCKQUOTE>
<BR>
<P>, ""
/.
,
.</P>
<P> 32 TB
.
1 GB, ,
.</P>
<P>
,
32k.</P>
<H3><A name="4.5">4.5</A>)
?</H3>
<P> PostgreSQL 5
.</P>
<P> , 100,000 ,
. ,
, 20 . 2.8 MB.
PostgreSQL,
6.4 MB :</P>
<PRE>
32 : ()
+ 24 :
+ 4 :
----------------------------------------
60
PostgreSQL 8192 (8 KB), :
8192
--------------------- = 136 (̣)
60
100000
----------------------- = 735 (̣)
128
735 * 8192 = 6,021,120 (6 MB)
</PRE>
<P> ,
, .</P>
<P> <small>NULL</small>
.
</P>
<H3><A name="4.6">4.6</A>) ?
?</H3>
<P> .
. ,
, .</P>
<P> -
, PostgreSQL .
<SMALL>VACUUM ANALYZE</SMALL>
<SMALL>ANALYZE</SMALL>. ,
, .
.
.</P>
<P> <SMALL>ORDER BY</SMALL>
.
, .
, <SMALL>ORDER BY</SMALL> <SMALL>LIMIT</SMALL>
,
. MAX() MIN()
,
<SMALL>ORDER BY</SMALL> <SMALL>LIMIT</SMALL>:
<PRE>
SELECT col
FROM tab
ORDER BY col [ DESC ]
LIMIT 1;
</PRE>
<P> ,
, <CODE>SET enable_seqscan TO 'off'</CODE>
, ,
.
</P>
<P> , <SMALL>LIKE</SMALL>
<I>~</I>, :</P>
<UL>
<LI> , ..:
<UL>
<LI><small>LIKE</small> <i>%.</i>.</LI>
<LI><i>~</i> <i>^</i>.</LI>
</UL></LI>
<LI> , .. [a-e].</LI>
<LI> , <small>ILIKE</small>
<i>~*</i> . ,
, <A href="#4.8">4.8</A>.</LI>
<LI> <i>initdb</i>
<i>C</i>,
-C .
<CODE>text_pattern_ops</CODE>
<SMALL>LIKE</SMALL> .</LI>
</UL>
<P> 8.0, ,
.
int2, int8 numeric .</P>
<H3><A name="4.7">4.7</A>) ,
?</H3>
<P> <SMALL>EXPLAIN</SMALL>.</P>
<H3><A name="4.8">4.8</A>)
?
?</H3>
<P> <I>~</I> ,
<I>~*</I>
. <SMALL>LIKE</SMALL>
<SMALL>ILIKE</SMALL>.</P>
<P> :</P>
<PRE>
SELECT *
FROM tab
WHERE lower(col) = 'abc';
</PRE>
. ,
, :
<PRE>
CREATE INDEX tabindex ON tab (lower(col));
</PRE>
<H3><A name="4.9">4.9</A>) ,
<SMALL>NULL</SMALL> - ?
<SMALL>NULL</SMALL> ?</H3>
<P> <SMALL>IS NULL</SMALL>
<SMALL>IS NOT NULL</SMALL>, :</P>
<PRE>
SELECT *
FROM tab
WHERE col IS NULL;
</PRE>
<P> <NULL>
<SMALL>IS NULL</SMALL> <SMALL>IS NOT NULL</SMALL>
<SMALL>ORDER BY</SMALL>.
<I></I>, ,
<I></I>, NULL :</P>
<PRE>
SELECT *
FROM tab
ORDER BY (col IS NOT NULL);
</PRE>
<H3><A name="4.10">4.10</A>)
?</H3>
<BLOCKQUOTE>
<TABLE>
<TR>
<TH></TH>
<TH> </TH>
<TH></TH>
</TR>
<TR>
<TD>VARCHAR(n)</TD>
<TD>varchar</TD>
<TD> , </TD>
</TR>
<TR>
<TD>CHAR(n)</TD>
<TD>bpchar</TD>
<TD> </TD>
</TR>
<TR>
<TD>TEXT</TD>
<TD>text</TD>
<TD> </TD>
</TR>
<TR>
<TD>BYTEA</TD>
<TD>bytea</TD>
<TD> ( null- )</TD>
</TR>
<TR>
<TD>"char"</TD>
<TD>char</TD> <TD> </TD>
</TR>
</TABLE>
</BLOCKQUOTE>
<P> ,
.</P>
<P> "varlena" (..,
, ).
, ,
. , ,
,
.</P>
<SMALL>VARCHAR(n)</SMALL> - ,
, .
<SMALL>TEXT</SMALL> - ,
1 .
<P><SMALL>CHAR(n)</SMALL> - ,
. <SMALL>CHAR(n)</SMALL>
, <SMALL>VARCHAR(n)</SMALL>
, .
<SMALL>BYTEA</SMALL> ,
<SMALL>NULL</SMALL> .
, .</P>
<H3><A name="4.11.1">4.11.1</A>)
serial/--?</H3>
<P>PostgreSQL <SMALL>SERIAL</SMALL>.
. :</P>
<PRE>
CREATE TABLE person (
id SERIAL,
name TEXT
);
</PRE>
:
<PRE>
CREATE SEQUENCE person_id_seq;
CREATE TABLE person (
id INT4 NOT NULL DEFAULT nextval('person_id_seq'),
name TEXT
);
</PRE>
<I>create_sequence</I>.
<H3><A name="4.11.2">4.11.2</A>)
<SMALL>SERIAL</SMALL>?</H3>
<P>
<SMALL>SERIAL</SMALL> sequence
<I>nextval()</I> <I></I>
. - <A href="#4.11.1">4.11.1</A>,
:</P>
<PRE>
new_id = execute("SELECT nextval('person_id_seq')");
execute("INSERT INTO person (id, name) VALUES (new_id, 'Blaise Pascal')");
</PRE>
<CODE>new_id</CODE> (
<CODE>person</CODE>). ,
<SMALL>SEQUENCE</SMALL>
<<I>table</I>>_<<I>serialcolumn</I>>_<I>seq</I>,
<I>table</I> <I>serialcolumn</I> <SMALL>SERIAL</SMALL>.
<P> ,
<SMALL>SERIAL</SMALL> <I>currval()</I>
<I></I> , </P>
<PRE>
execute("INSERT INTO person (name) VALUES ('Blaise Pascal')");
new_id = execute("SELECT currval('person_id_seq')");
</PRE>
<H3><A name="4.11.3">4.11.3</A>) ,
<I>currval()</I> <I>nextval()</I>
?</H3>
<P>. <i>currval()</i> ,
, .</P>
<H3><A name="4.11.4">4.11.4</A>)
?
, /SERIAL?</H3>
<P> , ,
.
.</P>
<H3><A name="4.12">4.12</A>) <SMALL>OID</SMALL>?
<SMALL>CTID</SMALL>?</H3>
<P>, PostgreSQL ,
<SMALL>OID</SMALL>
<SMALL>WITHOUT OIDS</SMALL>. O<SMALL>ID</SMALL> -
4- .
, 4 ,
O<SMALL>ID</SMALL> . PostgreSQL
<SMALL>OID</SMALL> .</P>
<P> ,
<SMALL>SERIAL</SMALL>
O<SMALL>ID</SMALL>, <SMALL>SERIAL</SMALL>
. 8-
<SMALL>SERIAL8</SMALL>.
<P>C<SMALL>TID</SMALL>
offset . C<SMALL>TID</SMALL>
.
<P>T<SMALL>ID</SMALL>
.</P>
<H3><A name="4.13">4.13</A>) <I>"ERROR: Memory
exhausted in AllocSetAlloc()"</I>?</H3>
<P>
.
<I>postmaster</I>
:</P>
<PRE>
ulimit -d 262144
limit datasize 256m
</PRE>
shell,
,
.
,
ţ . <SMALL>SQL</SMALL> , backend ,
.
<H3><A name="4.14">4.14</A>) , PostgreSQL
?</H3>
<P> <I>psql</I>, <CODE>SELECT version();</CODE></P>
<H3><A name="4.15">4.15</A>)
?</H3>
<P> <I>CURRENT_TIMESTAMP</I>:</P>
<PRE>
CREATE TABLE test (x int, modtime TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
</PRE>
<H3><A name="4.16">4.16</A>) ?</H3>
<P>PostgreSQL ,
SQL. :</P>
<PRE>
SELECT *
FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col);
</PRE>
<PRE>
SELECT *
FROM t1 LEFT OUTER JOIN t2 USING (col);
</PRE>
<P> t1.col t2.col,
t1 ( t2).
<SMALL>RIGHT</SMALL>
t2. <SMALL>FULL</SMALL>
t1 t2. <SMALL>OUTER</SMALL>
<SMALL>LEFT</SMALL>,
<SMALL>RIGHT</SMALL> <SMALL>FULL</SMALL> .
<SMALL>INNER</SMALL> .</P>
<H3><A name="4.17">4.17</A>) ,
?</H3>
<P> .
PostgreSQL
, , .</P>
<P><I>contrib/dblink</I> ,
. ,
.</P>
<H3><A name="4.18">4.18</A>) ?</H3>
<P> , ,
<A href="http://techdocs.postgresql.org/guides/SetReturningFunctions">
http://techdocs.postgresql.org/guides/SetReturningFunctions</A>.</P>
<H3><A name="4.19">4.19</A>) "relation with OID ####
", PL/PgSQL?</H3>
<P>PL/PgSQL
, PL/PgSQL
,
, ,
.
, <SMALL>EXECUTE</SMALL>
PL/PgSQL. .</P>
<H3><A name="4.20">4.20</a>) ?</H3>
<P> "" -- ,
.</P>
<P> Master/slave (master)
/, Σ
(slave)
/<SMALL>SELECT</SMALL>.
master-slave PostgreSQL
<A href="http://gborg.postgresql.org/project/slony1/projdisplay.php">
Slony-I</A>.</P>
<P> Multi-master /
, .
,
.
PostgreSQL
<A href="http://pgfoundry.org/projects/pgcluster/">Pgcluster</A>.
</BODY>
</HTML>