Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
5e655777
Commit
5e655777
authored
Jul 12, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 578197: [PostgreSQL] Properly associate sequences that had no
column association r=mkanat, a=mkanat (module owner)
parent
d873b53d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
Pg.pm
Bugzilla/DB/Pg.pm
+21
-0
No files found.
Bugzilla/DB/Pg.pm
View file @
5e655777
...
...
@@ -278,6 +278,27 @@ END
$self
->
do
(
"ALTER TABLE fielddefs ALTER COLUMN id
SET DEFAULT NEXTVAL('fielddefs_id_seq')"
);
}
# Certain sequences got upgraded before we required Pg 8.3, and
# so they were not properly associated with their columns.
my
@tables
=
$self
->
bz_table_list_real
;
foreach
my
$table
(
@tables
)
{
my
@columns
=
$self
->
bz_table_columns_real
(
$table
);
foreach
my
$column
(
@columns
)
{
# All our SERIAL pks have "id" in their name at the end.
next
unless
$column
=~
/id$/
;
my
$sequence
=
"${table}_${column}_seq"
;
if
(
$self
->
bz_sequence_exists
(
$sequence
))
{
my
$is_associated
=
$self
->
selectrow_array
(
'SELECT pg_get_serial_sequence(?,?)'
,
undef
,
$table
,
$column
);
next
if
$is_associated
;
print
"Fixing $sequence to be associated"
.
" with $table.$column...\n"
;
$self
->
do
(
"ALTER SEQUENCE $sequence OWNED BY $table.$column"
);
}
}
}
}
# Renames things that differ only in case.
...
...
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