📄 release.sgml
字号:
<para> Currently <productname>PostgreSQL</productname> processes a backslash in a string literal as introducing a special escape sequence, e.g. <literal>\n</> or <literal>\010</>. While this allows easy entry of special values, it is nonstandard and makes porting of applications from other databases more difficult. For this reason, the <productname>PostgreSQL</productname> project is planning to remove the special meaning of backslashes in strings. For backward compatibility and for users who want special backslash processing, a new string syntax has been created. This new string syntax is formed by writing an <literal>E</> immediately preceding the single quote that starts the string, e.g. <literal>E'hi\n'</>. While this release does not change the handling of backslashes in strings, it does add new configuration parameters to help users migrate applications for future releases: </para> <itemizedlist> <listitem> <para> <varname>standard_conforming_strings</> — does this release treat backslashes literally in ordinary strings? </para> </listitem> <listitem> <para> <varname>escape_string_warning</> — warn about backslashes in ordinary (non-E) strings </para> </listitem> </itemizedlist> <para> The <varname>standard_conforming_strings</> value is read-only. Applications can retrieve the value to know how backslashes are processed. (Presence of the parameter can also be taken as an indication that <literal>E''</> string syntax is supported.) In a future release, <varname>standard_conforming_strings</> will be true, meaning backslashes will be treated literally in non-E strings. To prepare for this change, use <literal>E''</> strings in places that need special backslash processing, and turn on <varname>escape_string_warning</> to find additional strings that need to be converted to use <literal>E''</>. Also, use two single-quotes (<literal>''</>) to embed a literal single-quote in a string, rather than the <productname>PostgreSQL</productname>-supported syntax of backslash single-quote (<literal>\'</>). The former is standards-conforming and does not require the use of the <literal>E''</> string syntax. You can also use the <literal>$$</> string syntax, which does not treat backslashes specially. </para> </listitem> <listitem> <para> Make <command>REINDEX DATABASE</> reindex all indexes in the database (Tom) </para> <para> Formerly, <command>REINDEX DATABASE</> reindexed only system tables. This new behavior seems more intuitive. A new command <command>REINDEX SYSTEM</> provides the old functionality of reindexing just the system tables. </para> </listitem> <listitem> <para> Read-only large object descriptors now obey MVCC snapshot semantics </para> <para> When a large object is opened with <literal>INV_READ</> (and not <literal>INV_WRITE</>), the data read from the descriptor will now reflect a <quote>snapshot</> of the large object's state at the time of the transaction snapshot in use by the query that called <function>lo_open()</>. To obtain the old behavior of always returning the latest committed data, include <literal>INV_WRITE</> in the mode flags for <function>lo_open()</>. </para> </listitem> <listitem> <para> Add proper dependencies for arguments of sequence functions (Tom) </para> <para> In previous releases, sequence names passed to <function>nextval()</>, <function>currval()</>, and <function>setval()</> were stored as simple text strings, meaning that renaming or dropping a sequence used in a <literal>DEFAULT</> clause made the clause invalid. This release stores all newly-created sequence function arguments as internal OIDs, allowing them to track sequence renaming, and adding dependency information that prevents improper sequence removal. It also makes such <literal>DEFAULT</> clauses immune to schema renaming and search path changes. </para> <para> Some applications might rely on the old behavior of run-time lookup for sequence names. This can still be done by explicitly casting the argument to <type>text</>, for example <literal>nextval('myseq'::text)</>. </para> <para> Pre-8.1 database dumps loaded into 8.1 will use the old text-based representation and therefore will not have the features of OID-stored arguments. However, it is possible to update a database containing text-based <literal>DEFAULT</> clauses. First, save this query into a file, such as <filename>fixseq.sql</>:<programlisting>SELECT 'ALTER TABLE ' || pg_catalog.quote_ident(n.nspname) || '.' || pg_catalog.quote_ident(c.relname) || ' ALTER COLUMN ' || pg_catalog.quote_ident(a.attname) || ' SET DEFAULT ' || regexp_replace(d.adsrc, $$val\(\(('[^']*')::text\)::regclass$$, $$val(\1$$, 'g') || ';'FROM pg_namespace n, pg_class c, pg_attribute a, pg_attrdef dWHERE n.oid = c.relnamespace AND c.oid = a.attrelid AND a.attrelid = d.adrelid AND a.attnum = d.adnum AND d.adsrc ~ $$val\(\('[^']*'::text\)::regclass$$;</programlisting> Next, run the query against a database to find what adjustments are required, like this for database <literal>db1</>:<programlisting>psql -t -f fixseq.sql db1</programlisting> This will show the <command>ALTER TABLE</> commands needed to convert the database to the newer OID-based representation. If the commands look reasonable, run this to update the database:<programlisting>psql -t -f fixseq.sql db1 | psql -e db1</programlisting> This process must be repeated in each database to be updated. </para> </listitem> <listitem> <para> In <application>psql</application>, treat unquoted <literal>\{digit}+</> sequences as octal (Bruce) </para> <para> In previous releases, <literal>\{digit}+</> sequences were treated as decimal, and only <literal>\0{digit}+</> were treated as octal. This change was made for consistency. </para> </listitem> <listitem> <para> Remove grammar productions for prefix and postfix <literal>%</> and <literal>^</> operators (Tom) </para> <para> These have never been documented and complicated the use of the modulus operator (<literal>%</>) with negative numbers. </para> </listitem> <listitem> <para> Make <literal>&<</> and <literal>&></> for polygons consistent with the box "over" operators (Tom) </para> </listitem> <listitem> <para> <command>CREATE LANGUAGE</> may ignore the provided arguments in favor of information from <structname>pg_pltemplate</> (Tom) </para> <para> A new system catalog <structname>pg_pltemplate</> has been defined to carry information about the preferred definitions of procedural languages (such as whether they have validator functions). When an entry exists in this catalog for the language being created, <command>CREATE LANGUAGE</> will ignore all its parameters except the language name and instead use the catalog information. This measure was taken because of increasing problems with obsolete language definitions being loaded by old dump files. As of 8.1, <application>pg_dump</> will dump procedural language definitions as just <command>CREATE LANGUAGE <replaceable>name</></command>, relying on a template entry to exist at load time. We expect this will be a more future-proof representation. </para> </listitem> <listitem> <para> Make <function>pg_cancel_backend(int)</function> return a <type>boolean</type> rather than an <type>integer</type> (Neil) </para> </listitem> <listitem> <para> Some users are having problems loading UTF-8 data into 8.1.X. This is because previous versions allowed invalid UTF-8 byte sequences to be entered into the database, and this release properly accepts only valid UTF-8 sequences. One way to correct a dumpfile is to run the command <command>iconv -c -f UTF-8 -t UTF-8 -o cleanfile.sql dumpfile.sql</>. The <literal>-c</> option removes invalid character sequences. A diff of the two files will show the sequences that are invalid. <command>iconv</> reads the entire input file into memory so it might be necessary to use <application>split</> to break up the dump into multiple smaller files for processing. </para> </listitem> </itemizedlist> </sect2> <sect2> <title>Additional Changes</title> <para> Below you will find a detailed account of the additional changes between <productname>PostgreSQL</productname> 8.1 and the previous major release. </para> <sect3> <title>Performance Improvements</title> <itemizedlist> <listitem> <para> Improve GiST and R-tree index performance (Neil) </para> </listitem> <listitem> <para> Improve the optimizer, including auto-resizing of hash joins (Tom) </para> </listitem> <listitem> <para> Overhaul internal API in several areas </para> </listitem> <listitem> <para> Change WAL record CRCs from 64-bit to 32-bit (Tom) </para> <para> We determined that the extra cost of computing 64-bit CRCs was significant, and the gain in reliability too marginal to justify it. </para> </listitem> <listitem> <para> Prevent writing large empty gaps in WAL pages (Tom) </para> </listitem> <listitem> <para> Improve spinlock behavior on SMP machines, particularly Opterons (Tom) </para> </listitem> <listitem> <para> Allow nonconsecutive index columns to be used in a multicolumn index (Tom) </para> <para> For example, this allows an index on columns a,b,c to be used in a query with <command>WHERE a = 4 and c = 10</>. </para> </listitem> <listitem> <para> Skip WAL logging for <command>CREATE TABLE AS</> / <command>SELECT INTO</> (Simon) </para> <para> Since a crash during <command>CREATE TABLE AS</> would cause the table to be dropped during recovery, there is no reason to WAL log as the table is loaded. (Logging still happens if WAL archiving is enabled, however.) </para> </listitem> <listitem> <para> Allow concurrent GIST index access (Teodor, Oleg) </para> </listitem> <listitem> <para> Add configuration parameter <varname>full_page_writes</> to control writing full pages to WAL (Bruce) </para> <para> To prevent partial disk writes from corrupting the database, <productname>PostgreSQL</productname> writes a complete copy of each database disk page to WAL the first time it is modified after a checkpoint. This option turns off that functionality for more speed. This is safe to use with battery-backed disk caches where partial page writes cannot happen. </para> </listitem> <listitem> <para> Use <literal>O_DIRECT</> if available when using <literal>O_SYNC</> for <varname>wal_sync_method</varname> (Itagaki Takahiro) </para> <para> <literal>O_DIRECT</> causes disk writes to bypass the kernel cache, and for WAL writes, this improves performance. </para> </listitem> <listitem> <para> Improve <command>COPY FROM</> performance (Alon Goldshuv) </para> <para> This was accomplished by reading <command>COPY</> input in larger chunks, rather than character by character. </para> </listitem> <listitem> <para> Improve the performance of <function>COUNT()</function>, <function>SUM</function>, <function>AVG()</function>, <function>STDDEV()</function>, and <function>VARIANCE()</function> (Neil, Tom) </para> </listitem> </itemizedlist> </sect3> <sect3> <title>Server Changes</title> <itemizedlist> <listitem> <para> Prevent problems due to transaction ID (XID) wraparound (Tom) </para> <para> The server will now warn when the transaction counter approaches the wraparound point. If the counter becomes too close to wraparound, the server will stop accepting queries. This ensures that data is not lost before needed vacuuming is performed. </para> </listitem> <listitem> <para> Fix problems with object IDs (OIDs) conflicting with existing system objects after the OID counter has wrapped around (Tom) </para> </listitem> <listitem> <para> Add warning about the need to increase <varname>max_fsm_relations</> and <varname>max_fsm_pages</> during <command>VACUUM</> (Ron Mayer) </para> </listitem> <listitem> <para> Add <varname>temp_buffers</> configuration parameter to allow users to determine the size of the local buffer area for temporary table access (Tom) </para>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -