|
1 | 1 | <!--
|
2 |
| -$PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.386 2005/10/03 13:52:28 momjian Exp $ |
| 2 | +$PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.387 2005/10/03 16:04:13 tgl Exp $ |
3 | 3 |
|
4 | 4 | Typical markup:
|
5 | 5 |
|
@@ -393,61 +393,62 @@ pg_[A-Za-z0-9_] <application>
|
393 | 393 |
|
394 | 394 | <listitem>
|
395 | 395 | <para>
|
396 |
| - Add proper sequence function dependencies for <command> |
397 |
| - DEFAULT</> clauses (Tom) |
| 396 | + Add proper dependencies for arguments of sequence functions (Tom) |
398 | 397 | </para>
|
399 | 398 | <para>
|
400 |
| - In previous releases, <function>nextval()</>, |
401 |
| - <function>currval</>, and <function>setval()</> recorded sequence |
402 |
| - names as simple text strings, meaning that renaming or dropping a |
403 |
| - sequence used in a <command>DEFAULT</> clause made the clause |
| 399 | + In previous releases, sequence names passed to <function>nextval()</>, |
| 400 | + <function>currval()</>, and <function>setval()</> were stored as |
| 401 | + simple text strings, meaning that renaming or dropping a |
| 402 | + sequence used in a <literal>DEFAULT</> clause made the clause |
404 | 403 | invalid. This release stores all newly-created sequence function
|
405 |
| - arguments as internal OIDs, allowing them to handle sequence |
| 404 | + arguments as internal OIDs, allowing them to track sequence |
406 | 405 | renaming, and adding dependency information that prevents
|
407 |
| - improper sequence removal. It also makes <command>DEFAULT</> |
408 |
| - clauses immune to schema search path changes, and allows schema |
409 |
| - renaming. |
| 406 | + improper sequence removal. It also makes such <literal>DEFAULT</> |
| 407 | + clauses immune to schema renaming and search path changes. |
410 | 408 | </para>
|
411 | 409 | <para>
|
412 |
| - Some applications might rely on the old text-based behavior of |
| 410 | + Some applications might rely on the old behavior of |
413 | 411 | run-time lookup for sequence names. This can still be done by
|
414 |
| - casting the argument to <type>text</>, for example |
| 412 | + explicitly casting the argument to <type>text</>, for example |
415 | 413 | <literal>nextval('myseq'::text)</>.
|
416 | 414 | </para>
|
417 | 415 | <para>
|
418 |
| - Pre-8.1 schemas loaded into 8.1 will use the previous, text-based |
| 416 | + Pre-8.1 database dumps loaded into 8.1 will use the old text-based |
419 | 417 | representation and therefore will not have the features of
|
420 |
| - OID-stored arguments. However, it is possible to upgrade a |
421 |
| - database loaded with pre-8.1 schemas. First, save this query into |
422 |
| - a file, such as <filename>fixseq.sql</>: |
| 418 | + OID-stored arguments. However, it is possible to update a |
| 419 | + database containing text-based <literal>DEFAULT</> clauses. |
| 420 | + First, save this query into a file, such as <filename>fixseq.sql</>: |
423 | 421 | <programlisting>
|
424 | 422 | SELECT 'ALTER TABLE ' ||
|
425 | 423 | pg_catalog.quote_ident(n.nspname) || '.' ||
|
426 | 424 | pg_catalog.quote_ident(c.relname) ||
|
427 | 425 | ' ALTER COLUMN ' || pg_catalog.quote_ident(a.attname) ||
|
428 | 426 | ' SET DEFAULT ' ||
|
429 |
| - regexp_replace(d.adsrc, '(nextval\\(''[^'']*'')::text', '\\1', 'g') || |
| 427 | + regexp_replace(d.adsrc, |
| 428 | + $$val\(\(('[^']*')::text\)::regclass$$, |
| 429 | + $$val\(\1$$, |
| 430 | + 'g') || |
430 | 431 | ';'
|
431 | 432 | FROM pg_namespace n, pg_class c, pg_attribute a, pg_attrdef d
|
432 | 433 | WHERE n.oid = c.relnamespace AND
|
433 | 434 | c.oid = a.attrelid AND
|
434 | 435 | a.attrelid = d.adrelid AND
|
435 | 436 | a.attnum = d.adnum AND
|
436 |
| - d.adsrc ~ '.*nextval\\(''[^'']*''::text'; |
| 437 | + d.adsrc ~ $$val\(\('[^']*'::text\)::regclass$$; |
437 | 438 | </programlisting>
|
438 | 439 | Next, run the query against a database to find what
|
439 | 440 | adjustments are required, like this for database <literal>db1</>:
|
440 | 441 | <programlisting>
|
441 |
| -psql -aT -f fixseq.sql db1 |
| 442 | +psql -t -f fixseq.sql db1 |
442 | 443 | </programlisting>
|
443 | 444 | This will show the <command>ALTER TABLE</> commands needed to
|
444 | 445 | convert the database to the newer OID-based representation.
|
445 |
| - Finally, run this to update the database: |
| 446 | + If the commands look reasonable, run this to update the database: |
446 | 447 | <programlisting>
|
447 |
| -psql -aT -f fixseq.sql db1 | psql -e db1 |
| 448 | +psql -t -f fixseq.sql db1 | psql -e db1 |
448 | 449 | </programlisting>
|
449 |
| - This process should be done for each database loaded with pre-8.1 |
450 |
| - schemas. |
| 450 | + This process must be repeated in each database to be updated. |
| 451 | + </para> |
451 | 452 | </listitem>
|
452 | 453 |
|
453 | 454 | <listitem>
|
@@ -2060,7 +2061,7 @@ psql -aT -f fixseq.sql db1 | psql -e db1
|
2060 | 2061 |
|
2061 | 2062 | <note>
|
2062 | 2063 | <title>Release date</title>
|
2063 |
| - <simpara>2005-09-??</simpara> |
| 2064 | + <simpara>2005-10-04</simpara> |
2064 | 2065 | </note>
|
2065 | 2066 |
|
2066 | 2067 | <para>
|
@@ -4836,7 +4837,7 @@ typedefs (Michael)</para></listitem>
|
4836 | 4837 |
|
4837 | 4838 | <note>
|
4838 | 4839 | <title>Release date</title>
|
4839 |
| - <simpara>2005-09-??</simpara> |
| 4840 | + <simpara>2005-10-04</simpara> |
4840 | 4841 | </note>
|
4841 | 4842 |
|
4842 | 4843 | <para>
|
@@ -7463,7 +7464,7 @@ DROP SCHEMA information_schema CASCADE;
|
7463 | 7464 |
|
7464 | 7465 | <note>
|
7465 | 7466 | <title>Release date</title>
|
7466 |
| - <simpara>2005-09-??</simpara> |
| 7467 | + <simpara>2005-10-04</simpara> |
7467 | 7468 | </note>
|
7468 | 7469 |
|
7469 | 7470 | <para>
|
|
0 commit comments