Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
9c873828
Commit
9c873828
authored
Oct 03, 2005
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix procedure for updating nextval() defaults so that it actually works.
Update release dates for pending back-branch releases.
parent
8c73dfcc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
27 deletions
+28
-27
doc/src/sgml/release.sgml
doc/src/sgml/release.sgml
+28
-27
No files found.
doc/src/sgml/release.sgml
View file @
9c873828
<!--
<!--
$PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.38
6 2005/10/03 13:52:28 momjian
Exp $
$PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.38
7 2005/10/03 16:04:13 tgl
Exp $
Typical markup:
Typical markup:
...
@@ -393,61 +393,62 @@ pg_[A-Za-z0-9_] <application>
...
@@ -393,61 +393,62 @@ pg_[A-Za-z0-9_] <application>
<listitem>
<listitem>
<para>
<para>
Add proper sequence function dependencies for <command>
Add proper dependencies for arguments of sequence functions (Tom)
DEFAULT</> clauses (Tom)
</para>
</para>
<para>
<para>
In previous releases, <function>nextval()</>,
In previous releases,
sequence names passed to
<function>nextval()</>,
<function>currval
</>, and <function>setval()</> recorded sequence
<function>currval
()</>, and <function>setval()</> were stored as
names as
simple text strings, meaning that renaming or dropping a
simple text strings, meaning that renaming or dropping a
sequence used in a <
command
>DEFAULT</> clause made the clause
sequence used in a <
literal
>DEFAULT</> clause made the clause
invalid. This release stores all newly-created sequence function
invalid. This release stores all newly-created sequence function
arguments as internal OIDs, allowing them to
handle
sequence
arguments as internal OIDs, allowing them to
track
sequence
renaming, and adding dependency information that prevents
renaming, and adding dependency information that prevents
improper sequence removal. It also makes <command>DEFAULT</>
improper sequence removal. It also makes such <literal>DEFAULT</>
clauses immune to schema search path changes, and allows schema
clauses immune to schema renaming and search path changes.
renaming.
</para>
</para>
<para>
<para>
Some applications might rely on the old
text-based
behavior of
Some applications might rely on the old behavior of
run-time lookup for sequence names. This can still be done by
run-time lookup for sequence names. This can still be done by
casting the argument to <type>text</>, for example
explicitly
casting the argument to <type>text</>, for example
<literal>nextval('myseq'::text)</>.
<literal>nextval('myseq'::text)</>.
</para>
</para>
<para>
<para>
Pre-8.1
schemas loaded into 8.1 will use the previous,
text-based
Pre-8.1
database dumps loaded into 8.1 will use the old
text-based
representation and therefore will not have the features of
representation and therefore will not have the features of
OID-stored arguments. However, it is possible to up
grad
e a
OID-stored arguments. However, it is possible to up
dat
e a
database
loaded with pre-8.1 schemas. First, save this query into
database
containing text-based <literal>DEFAULT</> clauses.
a file, such as <filename>fixseq.sql</>:
First, save this query into
a file, such as <filename>fixseq.sql</>:
<programlisting>
<programlisting>
SELECT 'ALTER TABLE ' ||
SELECT 'ALTER TABLE ' ||
pg_catalog.quote_ident(n.nspname) || '.' ||
pg_catalog.quote_ident(n.nspname) || '.' ||
pg_catalog.quote_ident(c.relname) ||
pg_catalog.quote_ident(c.relname) ||
' ALTER COLUMN ' || pg_catalog.quote_ident(a.attname) ||
' ALTER COLUMN ' || pg_catalog.quote_ident(a.attname) ||
' SET DEFAULT ' ||
' SET DEFAULT ' ||
regexp_replace(d.adsrc, '(nextval\\(''[^'']*'')::text', '\\1', 'g') ||
regexp_replace(d.adsrc,
$$val\(\(('[^']*')::text\)::regclass$$,
$$val\(\1$$,
'g') ||
';'
';'
FROM pg_namespace n, pg_class c, pg_attribute a, pg_attrdef d
FROM pg_namespace n, pg_class c, pg_attribute a, pg_attrdef d
WHERE n.oid = c.relnamespace AND
WHERE n.oid = c.relnamespace AND
c.oid = a.attrelid AND
c.oid = a.attrelid AND
a.attrelid = d.adrelid AND
a.attrelid = d.adrelid AND
a.attnum = d.adnum AND
a.attnum = d.adnum AND
d.adsrc ~
'.*nextval\\(''[^'']*''::text'
;
d.adsrc ~
$$val\(\('[^']*'::text\)::regclass$$
;
</programlisting>
</programlisting>
Next, run the query against a database to find what
Next, run the query against a database to find what
adjustments are required, like this for database <literal>db1</>:
adjustments are required, like this for database <literal>db1</>:
<programlisting>
<programlisting>
psql -
aT
-f fixseq.sql db1
psql -
t
-f fixseq.sql db1
</programlisting>
</programlisting>
This will show the <command>ALTER TABLE</> commands needed to
This will show the <command>ALTER TABLE</> commands needed to
convert the database to the newer OID-based representation.
convert the database to the newer OID-based representation.
Finally
, run this to update the database:
If the commands look reasonable
, run this to update the database:
<programlisting>
<programlisting>
psql -
aT
-f fixseq.sql db1 | psql -e db1
psql -
t
-f fixseq.sql db1 | psql -e db1
</programlisting>
</programlisting>
This process
should be done for each database loaded with pre-8.1
This process
must be repeated in each database to be updated.
schemas.
</para>
</listitem>
</listitem>
<listitem>
<listitem>
...
@@ -2060,7 +2061,7 @@ psql -aT -f fixseq.sql db1 | psql -e db1
...
@@ -2060,7 +2061,7 @@ psql -aT -f fixseq.sql db1 | psql -e db1
<note>
<note>
<title>Release date</title>
<title>Release date</title>
<simpara>2005-
09-??
</simpara>
<simpara>2005-
10-04
</simpara>
</note>
</note>
<para>
<para>
...
@@ -4836,7 +4837,7 @@ typedefs (Michael)</para></listitem>
...
@@ -4836,7 +4837,7 @@ typedefs (Michael)</para></listitem>
<note>
<note>
<title>Release date</title>
<title>Release date</title>
<simpara>2005-
09-??
</simpara>
<simpara>2005-
10-04
</simpara>
</note>
</note>
<para>
<para>
...
@@ -7463,7 +7464,7 @@ DROP SCHEMA information_schema CASCADE;
...
@@ -7463,7 +7464,7 @@ DROP SCHEMA information_schema CASCADE;
<note>
<note>
<title>Release date</title>
<title>Release date</title>
<simpara>2005-
09-??
</simpara>
<simpara>2005-
10-04
</simpara>
</note>
</note>
<para>
<para>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment