mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-13 09:57:02 +08:00
@ -12,7 +12,7 @@
|
||||
<BODY bgcolor="#ffffff" text="#000000" link="#ff0000" vlink="#a00000" alink="#0000ff">
|
||||
<H1>������ �� ����� ���������� ������� �� PostgreSQL</H1>
|
||||
|
||||
<P>���� ���������� ����������: ����������� 18 ���� 15:33:25 EDT 2006</P>
|
||||
<P>���� ���������� ����������: ������� 26 ������� 14:59:45 EDT 2007</P>
|
||||
|
||||
<P>���������� ������� ������������: ���� ������ (Bruce Momjian) (<A href=
|
||||
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR>
|
||||
@ -22,10 +22,10 @@
|
||||
</P>
|
||||
|
||||
<P>����� ������ ���������� ������ ��������� ����� ����� ��
|
||||
<A href="http://www.postgresql.org/files/documentation/faqs/FAQ.html">http://www.PostgreSQL.org/files/documentation/faqs/FAQ.html</A>.</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>
|
||||
<A href="http://www.postgresql.org/docs/faq/">http://www.postgresql.org/docs/faq/</A>.</P>
|
||||
<HR>
|
||||
|
||||
<H2 align="center">����� �������</H2>
|
||||
@ -44,7 +44,8 @@
|
||||
<A href="#item1.12">1.12</A>) ��� ��� ��������� ����������� ��� ������������� � ������� �������������?<BR>
|
||||
<A href="#item1.13">1.13</A>) ��� �������� PostgreSQL � �������
|
||||
<SMALL>����</SMALL>?<BR>
|
||||
|
||||
<A href="#item1.14">1.14</A>) ����� �� PostgreSQL �������� � ���������� �����������, � ������ �������,
|
||||
����������� �������� �������?<BR>
|
||||
|
||||
<H2 align="center">������� ������������� �� ���������� �����</H2>
|
||||
<A href="#item2.1">2.1</A>) ����� ���������� ���� ��� PostgreSQL?<BR>
|
||||
@ -87,9 +88,9 @@
|
||||
<A href="#item4.8">4.8</A>) ��� ��� ��������� ����� ����������� ���������
|
||||
� ����� ����������� �� �������� ���� ����� ����������� ���������?
|
||||
��� ��� ������������ ������ ��� ������ ������������ �� �������� ����?<BR>
|
||||
<A href="#item4.9">4.9</A>) ��� ��� ����������, ��� �������� ���� �����
|
||||
<SMALL>NULL</SMALL> � �����-���� �������? ���� � ������������� ����
|
||||
<SMALL>NULL</SMALL> ��� ���?<BR>
|
||||
<A href="#item4.9">4.9</A>) ��� ��� ����������, ��� �������� ���� � �����-����
|
||||
������� ����� <SMALL>NULL</SMALL>? ��� ��� ��������� ���������
|
||||
<SMALL>NULL</SMALL>? ���� � ����������� ���� <SMALL>NULL</SMALL> ��� ���?<BR>
|
||||
<A href="#item4.10">4.10</A>) ������ ������� ����� ������� �����������
|
||||
������?<BR>
|
||||
<A href="#item4.11.1">4.11.1</A>) ��� ��� ������� ���� serial/�-����-�����������?<BR>
|
||||
@ -117,7 +118,7 @@
|
||||
�� ����������", ����� ���������� � ��������� �������� � �������� PL/PgSQL?<BR>
|
||||
<A href="#item4.20">4.20</A>) ����� ���� ������� ��� ����������?<BR>
|
||||
<A href="#item4.21">4.21</A>) ������ ����� ������� � ������� ��
|
||||
������������ � � �ϣ� �������?<BR>
|
||||
������������ � � �ϣ� �������? ������ �� ����������� ��������� �����?<BR>
|
||||
|
||||
<HR>
|
||||
|
||||
@ -126,9 +127,9 @@
|
||||
<H3><A name="item1.1">1.1</A>) ��� ����� PostgreSQL? ��� ������������ ��� ��������?</H3>
|
||||
|
||||
<P>PostgreSQL ������������ <I>Post-Gres-Q-L (����-����-���-��)</I>,
|
||||
����� ������ ������� ������ <I>Postgres</I>. �� ������ �������� ���
|
||||
��� ������������ � ������� ����������, ������� �������� �
|
||||
<A href="http://www.postgresql.org/files/postgresql.mp3">������� MP3</A>.
|
||||
����� ������� � ������ <I>Postgres</I>, �������� ��� ���������.
|
||||
(��� ����� ��������������� ��� ����������� "PostgreSQL", ����������
|
||||
<A href="http://www.postgresql.org/files/postgresql.mp3">�����-����</A>).
|
||||
</P>
|
||||
|
||||
<P>PostgreSQL - ��� ��������-����������� ������� ���������� ������
|
||||
@ -141,8 +142,8 @@
|
||||
�� ����� ���� � ��������� ����� ��������. ���������� ��������
|
||||
������������ �������� � �� ����������� �����-���� ���������.
|
||||
����������� �������� � FAQ ��� �������������,
|
||||
<A href="http://www.postgresql.org/files/documentation/faqs/FAQ_DEV.html">
|
||||
http://www.PostgreSQL.org/files/documentation/faqs/FAQ_DEV.html</A>
|
||||
<A href="http://www.postgresql.org/docs/faqs.FAQ_DEV.html">
|
||||
http://www.postgresql.org/docs/faqs.FAQ_DEV.html</A>
|
||||
</P>
|
||||
|
||||
<H3><A name="item1.2">1.2</A>) ��� ��������� PostgreSQL?</H3>
|
||||
@ -168,7 +169,7 @@
|
||||
|
||||
<P>������� ���������� ������ ������ PostgreSQL</P>
|
||||
|
||||
<P>Portions copyright (c) 1996-2006, PostgreSQL Global Development
|
||||
<P>Portions copyright (c) 1996-2007, PostgreSQL Global Development
|
||||
Group Portions Copyright (c) 1994-1996 Regents of the University of
|
||||
California</P>
|
||||
|
||||
@ -201,7 +202,7 @@
|
||||
� ������� ������ ������ ������.</P>
|
||||
|
||||
<P>PostgreSQL ����� �������� �� ������������ �������� Microsoft
|
||||
Windows, ���������� �� NT, ����� ��� Win2000, WinXP � Win2003.
|
||||
Windows, ���������� �� NT, ����� ��� Win2000 SP4, WinXP � Win2003.
|
||||
����� ������������ �������� �� ������
|
||||
<A href="http://pgfoundry.org/projects/pginstaller">
|
||||
http://pgfoundry.org/projects/pginstaller</A>. ������ Windows,
|
||||
@ -218,12 +219,12 @@
|
||||
|
||||
<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>
|
||||
<A href="ftp://ftp.PostgreSQL.org/pub/">ftp://ftp.postgresql.org/pub/</A>.</P>
|
||||
|
||||
|
||||
<H3><A name="item1.6">1.6</A>) ����� ������ �������� ������?</H3>
|
||||
|
||||
<P>��������� ������ PostgreSQL - ��� ������ 8.1.4</P>
|
||||
<P>��������� ������ PostgreSQL - ��� ������ 8.2.5</P>
|
||||
|
||||
<P>�� ��������� ��������� ����� ������� ������ ������ ���,
|
||||
� ������� ������ ������ ��������� �������.</P>
|
||||
@ -243,12 +244,13 @@
|
||||
������������, �� ������ ������������ � Unix ����� ���������
|
||||
<code>irc -c '#postgresql' "$USER" irc.freenode.net</code> ���
|
||||
����� ������ IRC ������. �� ���� �� ������� ���������� ������ ��
|
||||
��������� (<I>#postgresql-es</I>) � ����������� (<I>#postgresqlfr</I>)
|
||||
������. ����� ���������� ����� �� PostgreSQL �� ������� EFNet.</P>
|
||||
��������� (<I>#postgresql-es</I>), ����������� (<I>#postgresqlfr</I>)
|
||||
� ����������� (<I>#postgresql-br</I>) ������. ����� ���������� �����
|
||||
�� PostgreSQL �� ������� EFNet.</P>
|
||||
|
||||
<P>������ ������������ ��������� �������� �������� ��
|
||||
<A href="http://techdocs.postgresql.org/companies.php">
|
||||
http://techdocs.postgresql.org/companies.php</A>.</P>
|
||||
<A href="http://www.postgresql.org/support/professional_support">
|
||||
http://www.postgresql.org/support/professional_support</A>.</P>
|
||||
|
||||
|
||||
<H3><A name="item1.8">1.8</A>) ��� ��� �������� �� ������?</H3>
|
||||
@ -259,7 +261,7 @@
|
||||
http://www.postgresql.org/support/submitbug</A>.
|
||||
����� ��������� ������� ����� ������ ������ PostgreSQL �� �����
|
||||
FTP ����� <A href="ftp://ftp.postgresql.org/pub/">
|
||||
ftp://ftp.PostgreSQL.org/pub/</A>.</P>
|
||||
ftp://ftp.postgresql.org/pub/</A>.</P>
|
||||
|
||||
<P>�� ������, ����������� � ������� ���� ������� ����� �����������
|
||||
����� ��� ������������ � �����-���� ������ �������� PostgreSQL,
|
||||
@ -337,7 +339,7 @@
|
||||
�������� ������������ ����������� man � ��������� ��������� ��������
|
||||
�������. �������� � ������� <I>/doc</I>. �� ����� ������ �������������
|
||||
������������ � �������� �� ������ <A href="http://www.postgresql.org/docs">
|
||||
http://www.PostgreSQL.org/docs</A>.</P>
|
||||
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>
|
||||
@ -345,9 +347,9 @@
|
||||
���� ��������� ���� �� 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>
|
||||
<a href="http://www.postgresql.org/docs/books/">http://www.postgresql.org/docs/books/</a>.
|
||||
����� ����, �� ������ <a href="http://www.postgresql.org/docs/techdocs">http://www.postgresql.org/docs/techdocs</a>
|
||||
�� ������ ����� ��������� ����������� ������, ����������� PostgreSQL.</P>
|
||||
|
||||
<P>������ ��������� ������ <I>psql</I> ����� ��������� ������ \d ���
|
||||
����������� ���������� �� �����, ����������, ��������, ��������� � �.�. -
|
||||
@ -359,11 +361,7 @@
|
||||
<H3><A name="item1.11">1.11</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>
|
||||
@ -453,7 +451,14 @@
|
||||
</DD>
|
||||
</DL>
|
||||
|
||||
<H3><A name="item1.14">1.14</A>) ����� �� PostgreSQL �������� �
|
||||
���������� �����������, � ������ �������, ����������� �������� �������?</H3>
|
||||
|
||||
<P>��������� � ���������� �������� ������� � ��� �������� � PostgreSQL ������
|
||||
8.0.[4+] � �� ��� ��������� �������, �������� � 8.1. ��������� �� ������
|
||||
� �������� ��������� �������� � 8.0.[10+], 8.1.[6+] � ��� ���������
|
||||
�������. ������� PostgreSQL �� 8.0 ���������� ���������� � ����������
|
||||
�������� ������� �� ���� ������ ��������� ��� � ������������ �������.</p>
|
||||
<HR>
|
||||
|
||||
<H3 align="center">������� ������������� �� ���������� �����</H3>
|
||||
@ -544,7 +549,7 @@
|
||||
|
||||
<DD>��������� ��������� � <I>postgresql.conf</I> ������ ��
|
||||
������������������. ��������� ������ ������ ��������� ��. �
|
||||
<A href="http://www.postgresql.org/docs/current/static/runtime.html">
|
||||
<A href="http://www.postgresql.org/docs/current/static/runtime-config.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>
|
||||
@ -556,11 +561,12 @@
|
||||
<DT><B>����� "������" - ����������� �����������</B></DT>
|
||||
|
||||
<DD>������� "������" �� ������������������ �������� ������� �
|
||||
<A href="http://momjian.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>
|
||||
http://www.powerpostgresql.com/PerfList/</A> �
|
||||
<A href="http://momjian.us/main/writings/pgsql/hw_performance/index.html">
|
||||
http://momjian.us/main/writings/pgsql/hw_performance/index.html</A>.
|
||||
<BR>
|
||||
<BR>
|
||||
</DD>
|
||||
</DL>
|
||||
|
||||
@ -576,33 +582,19 @@
|
||||
<H3><A name="item3.5">3.5</A>) ������ � ������� ��������� <I>"Sorry, too
|
||||
many clients"</I> ����� ������� ������������ � ����?</H3>
|
||||
|
||||
<P>�� �������� �������������� �� ��������� ����������� �� 100 ������
|
||||
����������� � ���� ������. ��� ���������� ��������� ���
|
||||
<I>postmaster</I> ����� �� ���������� ������������ backend ���������,
|
||||
<P>�� �������� �������������� �� ��������� ����������� � 100 ������
|
||||
����������� � ���� ������. ��� ���������� ��������� ����� �� ����������
|
||||
������������ backend ��������� ��� ������ ������� ��,
|
||||
������� �������� <I>max_connections</I> � ����� <I>postgresql.conf</I>
|
||||
� �������������� <I>postmaster</I>.</P>
|
||||
� �������������� ������ ��.</P>
|
||||
|
||||
|
||||
<H3><A name="item3.6">3.6</A>) ��� ��������� ���������� PostgreSQL?</H3>
|
||||
|
||||
<P>����� ������������, ������������ PostgreSQL ������ ������ �����������
|
||||
������. ����� ������� ���������� � ������ 7.4.8 �� 7.4.9 �� �������
|
||||
���������� dump � restore; ���������� ���������� ������, ����������
|
||||
�����̣���� ����� ���� � ��������� ������.</P>
|
||||
|
||||
<P>��� ������������ ������ �� ����������� �� �������� ������ ���������
|
||||
��� ������ ��� ����� ��������. � �� ����� ��� ������ ����������
|
||||
������������� ��������� ����, ��������� PostgreSQL ��������������� ������
|
||||
��� ����������� ����� ������ � ����������� ������. ����� �������, ���
|
||||
���� ������ ������ � ����� �����������.</P>
|
||||
|
||||
|
||||
<P>��� ������ ���������� �������
|
||||
(�.�. ��� ���������� ��������, � 7.3 �� 7.4) ����� �������� ����������
|
||||
������ ��������� ������ � ������ ������. ��� ��������� ����� �����
|
||||
������� ��������, ��� ��� �� �� ����������� ��������
|
||||
������������� ��� ������ ������. � ���� ������� ��� ���������� ����
|
||||
������ ��������� ��������� dump/restore.</P>
|
||||
<P>��. ���������� �� ���������� � <a
|
||||
href="http://www.postgresql.org/support/versioning">http://www.postgresql.org/support/versioning</a>
|
||||
� ����������� ���������� � <a href="http://www.postgresql.org/docs/current/static/install-upgrading.html">
|
||||
http://www.postgresql.org/docs/current/static/install-upgrading.html</a>.</P>
|
||||
|
||||
|
||||
<H3><A name="item3.7">3.7</A>) ����� ������������ "������" � ������
|
||||
@ -745,9 +737,9 @@
|
||||
������� ����� ����� � ��������� ��������. ��� ���� ����� ������,
|
||||
� �������, ���������� 20 ����. ������ �������� ����� �������� 2.8 MB.
|
||||
������ ���� PostgreSQL, ���������� ��� �� ������ �������� ��������������
|
||||
5.6 MB �� �������:</P>
|
||||
5.2 MB �� �������:</P>
|
||||
<PRE>
|
||||
28 ����: �� ������ ��������� ������ � ������� (��������������)
|
||||
24 ����: �� ������ ��������� ������ � ������� (��������������)
|
||||
+ 24 �����: ���� ���� � ������������� ����� � ���� ��������� ����
|
||||
+ 4 �����: ��������� �� �������� ��� ���� ��������� ������
|
||||
----------------------------------------
|
||||
@ -756,14 +748,14 @@
|
||||
������ �������� ������ � PostgreSQL ���������� 8192 ���� (8 KB), ��� ���:
|
||||
|
||||
8192 ���� �� ��������
|
||||
--------------------- = 146 ����� � ������� �� �������� �� (�����̣���)
|
||||
56 ���� �� ������ � �������
|
||||
--------------------- = 158 ����� � ������� �� �������� �� (�����̣���)
|
||||
52 ���� �� ������ � �������
|
||||
|
||||
100000 ����� ������
|
||||
----------------------- = 685 ������� � �� (�����̣���)
|
||||
146 ����� � ������� �� ��������
|
||||
----------------------- = 633 ������� � �� (�����̣���)
|
||||
158 ����� � ������� �� ��������
|
||||
|
||||
685 ������� �� * 8192 ���� �� �������� = 5,611,520 ���� (5.6 MB)
|
||||
633 ������� �� * 8192 ���� �� �������� = 5,185,536 ���� (5.2 MB)
|
||||
</PRE>
|
||||
|
||||
<P>������� �� ������� ��� �����, �� ��������� ��� ��������� ���
|
||||
@ -822,13 +814,10 @@
|
||||
<i>C</i>, ������ ��� �� ���������� ����������� ������ ��������� ����������
|
||||
������ ��� ��-C ������. �� ������ ��� ����� ������� ������� �����������
|
||||
������ <CODE>text_pattern_ops</CODE> ������� �������� ������ ���
|
||||
<SMALL>LIKE</SMALL> ��������������.</LI>
|
||||
<SMALL>LIKE</SMALL> ��������������. ��� ������ ���� ����� �����
|
||||
������������ �������������� ������.</LI>
|
||||
</UL>
|
||||
|
||||
<P>� �������� �� ������ 8.0, ������� ����� ������ ���� ������������,
|
||||
���� ���� ������ ����� �� ��������� � ���������� ������ �������. ���
|
||||
�������� �������� int2, int8 � numeric �������� �������.</P>
|
||||
|
||||
<H3><A name="item4.7">4.7</A>) ��� ���������� �� ��, ��� ����������� ���������
|
||||
��� ������?</H3>
|
||||
|
||||
@ -863,9 +852,9 @@
|
||||
������ � ������̣���� ��������, ����������� �����������
|
||||
<SMALL>CHECK</SMALL> ��� �������� ����� �������.</P>
|
||||
|
||||
<H3><A name="item4.9">4.9</A>) ��� ��� ����������, ��� �������� ���� �����
|
||||
<SMALL>NULL</SMALL> � �����-���� �������? ���� � ������������� ����
|
||||
<SMALL>NULL</SMALL> ��� ���?</H3>
|
||||
<H3><A name="item4.9">4.9</A>) ��� ��� ����������, ��� �������� ���� � �����-����
|
||||
������� ����� <SMALL>NULL</SMALL>? ��� ��� ��������� ���������
|
||||
<SMALL>NULL</SMALL>? ���� � ����������� ���� <SMALL>NULL</SMALL> ��� ���?</H3>
|
||||
|
||||
<P>�� ������ ����������� �������� � <SMALL>IS NULL</SMALL> �
|
||||
<SMALL>IS NOT NULL</SMALL>, ��� �����:</P>
|
||||
@ -875,6 +864,13 @@
|
||||
WHERE col IS NULL;
|
||||
</PRE>
|
||||
|
||||
<P>����� ��������� � ���������� ���������� <SMALL>NULL</SMALL>, �����������
|
||||
<I>COALESCE()</I> ��� �����:</P>
|
||||
<PRE>
|
||||
SELECT COALESCE(col1, '') || COALESCE(col2, '')
|
||||
FROM tab
|
||||
</PRE>
|
||||
|
||||
<P>����� ������������� ������ �� �������� <NULL> ����������� ������������
|
||||
<SMALL>IS NULL</SMALL> � <SMALL>IS NOT NULL</SMALL> � ���������
|
||||
<SMALL>ORDER BY</SMALL>. ����� ��� ����� ������������ ��������
|
||||
@ -967,37 +963,27 @@
|
||||
);
|
||||
</PRE>
|
||||
|
||||
<P>������������� ��������� ������������������ ����� ��� ����
|
||||
<<I>�������</I>>_<<I>�������_serial</I>>_<I>seq</I>, ���
|
||||
<I>�������</I> � <I>�������_serial</I> - ��� �������������� �����
|
||||
������� � ������� � ����� <SMALL>SERIAL</SMALL>.
|
||||
�������� ����������� � ������������������� �� �������� �����������
|
||||
����������� <I>create_sequence</I>.
|
||||
����������� <I>create_sequence</I>.</P>
|
||||
|
||||
<H3><A name="item4.11.2">4.11.2</A>) ��� ��� �������� �������� ��� �������
|
||||
<SMALL>SERIAL</SMALL>?</H3>
|
||||
|
||||
<P>���� �� �������� ������� � ��������� ���������� ��������
|
||||
<SMALL>SERIAL</SMALL> �� ������� sequence � ������� �������
|
||||
<I>nextval()</I> <I>�����</I> �������� � ����� ��������� ��� ��������
|
||||
����. ����������� �������-������ � <A href="#item4.11.1">4.11.1</A>, ������
|
||||
� ����������� ������� ��� ��� ��������:</P>
|
||||
<P>���������� ������ �������� ����������� �������� <SMALL>SERIAL</SMALL>
|
||||
��� ������������ <SMALL>RETURNING</SMALL>. ��������� ��� ������� ������� � <A
|
||||
href="#item4.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')");
|
||||
INSERT INTO person (name) VALUES ('Blaise Pascal') RETURNING id;
|
||||
</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>
|
||||
�� ����� ������ ������� <I>nextval()</I> � ������������ ��� �������� �
|
||||
<SMALL>INSERT</SMALL> ��� ������� <I>currval()</I> <I>�����</I>
|
||||
<SMALL>INSERT</SMALL>.
|
||||
|
||||
|
||||
<H3><A name="item4.11.3">4.11.3</A>) �� ����� �� ���������� ���, ���
|
||||
@ -1020,15 +1006,15 @@
|
||||
<H3><A name="item4.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-� �������� ����� �����.
|
||||
<P>���� ������� ������� � <SMALL>WITH OIDS</SMALL>, �� ������ ������
|
||||
�������� ���������� �������������� <SMALL>OID</SMALL>.
|
||||
O<SMALL>ID</SMALL> - ��� ������������� ����������� ���������� 4-�
|
||||
�������� ����� �����, ������� ��������� ��� ���� ������������� ����.
|
||||
������, ����� ���� ��� ��� �������� �������� 4 ���������, ��������
|
||||
O<SMALL>ID</SMALL> �������� �������������. PostgreSQL ����������
|
||||
<SMALL>OID</SMALL> ��� ���������� ����� ���������� ������.</P>
|
||||
|
||||
<P>��� ���������� �������� � �������� ������� ������������, ������
|
||||
<P>��� ����������� �������� � ������� ������� ������������, ������
|
||||
�������� �������� ������������� <SMALL>SERIAL</SMALL> ������
|
||||
O<SMALL>ID</SMALL>, ������ ��� ������������������ <SMALL>SERIAL</SMALL>
|
||||
��������� ������ ������ ������� � ����� ������� ������ ����������
|
||||
@ -1047,7 +1033,7 @@
|
||||
|
||||
<P>���������������� � ��� ����������� ����������� ������
|
||||
��� ��� ���� ���� ����� ��������� ����� �� ������������ �������.
|
||||
����������� ����� �������� <I>postmaster</I> ��������� ���������
|
||||
����������� ����� �������� ������� �� ��������� ���������
|
||||
�������:</P>
|
||||
<PRE>
|
||||
ulimit -d 262144
|
||||
@ -1115,22 +1101,24 @@ CREATE TABLE test (x int, modtime TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
|
||||
<H3><A name="item4.18">4.18</A>) ��� ��� ������� �� ������� ��������� ����� �������?</H3>
|
||||
|
||||
<P>�� ������ ����� ������������ �������, ������������ ������,
|
||||
<A href="http://techdocs.postgresql.org/guides/SetReturningFunctions">
|
||||
http://techdocs.postgresql.org/guides/SetReturningFunctions</A>.</P>
|
||||
<A href="http://www.postgresql.org/docs/techdocs.17">
|
||||
http://www.postgresql.org/docs/techdocs.17</A>.</P>
|
||||
|
||||
|
||||
<H3><A name="item4.19">4.19</A>) ������ � ������� ������ "relation with OID ####
|
||||
�� ����������", ����� ���������� � ��������� �������� � �������� PL/PgSQL?</H3>
|
||||
|
||||
<P>PL/PgSQL �������� �������� ������� � ���� �� ���������� �������� �����
|
||||
������� � ���, ��� ���� ������� PL/PgSQL ���������� � ��������� �������
|
||||
� ��� ������� ������� ��������� � �������������, � ������� ����� ����������
|
||||
�����, �� �� ����� �������� � ������, ������ ��� ������������� ����������
|
||||
������� �������� ��������� �� ������ ��������� �������. ����� ������ ���
|
||||
��������, ����������� <SMALL>EXECUTE</SMALL> ��� ������� � ���������
|
||||
<P>� PostgreSQL �� ������ 8.3, PL/PgSQL �������� �������� ������� � ���� ��
|
||||
���������� �������� ����� ������� � ���, ��� ���� ������� PL/PgSQL ����������
|
||||
� ��������� ������� � ��� ������� ������� ��������� � �������������, � �������
|
||||
����� ���������� �����, �� �� ����� �������� � ������, ������ ��� �������������
|
||||
���������� ������� �������� ��������� �� ������ ��������� �������. ����� ������
|
||||
��� ��������, ����������� <SMALL>EXECUTE</SMALL> ��� ������� � ���������
|
||||
�������� � PL/PgSQL. ������������� ����� ��������� �������� ������
|
||||
������������������ ������ ���.</P>
|
||||
|
||||
<P>� PostgreSQL 8.3 � �������, ���� �������� ���.</p>
|
||||
|
||||
|
||||
<H3><A name="item4.20">4.20</a>) ����� ���� ������� ��� ����������?</H3>
|
||||
|
||||
@ -1142,7 +1130,7 @@ CREATE TABLE test (x int, modtime TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
|
||||
(slave) ������� ����� ����������� ������ �������
|
||||
������/<SMALL>SELECT</SMALL>. �������� ���������� �������� ��� ����������
|
||||
master-slave � PostgreSQL ��������
|
||||
<A href="http://gborg.postgresql.org/project/slony1/projdisplay.php">
|
||||
<A href="http://main.slony.info/">
|
||||
Slony-I</A>.</P>
|
||||
|
||||
<P>���������� Multi-master ��������� ��������� ������� ������/������
|
||||
@ -1150,15 +1138,15 @@ CREATE TABLE test (x int, modtime TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
|
||||
����� �������� � ������ ������������������, ������ ��� ����������
|
||||
������������� ��������� ����� ����������� ���������. ��������
|
||||
���������� �������� ��� ����� ���������� � PostgreSQL ��������
|
||||
<A href="http://pgfoundry.org/projects/pgcluster/">Pgcluster</A>.
|
||||
<A href="http://pgfoundry.org/projects/pgcluster/">PGcluster</A>.
|
||||
|
||||
<H3><A name="item4.21">4.21</A>) ������ ����� ������� � ������� ��
|
||||
������������ � � �ϣ� �������?</H3>
|
||||
������������ � � �ϣ� �������? ������ �� ����������� ��������� �����?</H3>
|
||||
|
||||
<P>�������� ����� ��� ���������� ��-�� ������������� ������� ������� �
|
||||
<P>�������� ����� ����� �������������� ��-�� ������������� ������� ������� �
|
||||
����� ������� ��� ������� ��� �������� �������. ��� ������������� �������
|
||||
�������, ��� ������� � ������� (������� �������� ����������������)
|
||||
����������� � <A href="http://www.postgresql.org/docs/8.0/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS">
|
||||
����������� � <A href="http://www.postgresql.org/docs/current/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS">
|
||||
��������-��������� ����</A>; ��� ��������, ��� �� ������ ������������
|
||||
������� �������, ����� ���������� ��� ����� � �������. ���������
|
||||
����������, ����� ��� pgAdmin, �� ����� �������� ������� ���������
|
||||
|
||||
Reference in New Issue
Block a user