Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
3bb79875
Commit
3bb79875
authored
Jan 15, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support PostgreSQL 10
parent
04edbb5f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
1 deletion
+54
-1
changelogs/unreleased/42047-pg-10-support.yml
changelogs/unreleased/42047-pg-10-support.yml
+5
-0
config/initializers/ar5_pg_10_support.rb
config/initializers/ar5_pg_10_support.rb
+48
-0
doc/install/requirements.md
doc/install/requirements.md
+1
-1
No files found.
changelogs/unreleased/42047-pg-10-support.yml
0 → 100644
View file @
3bb79875
---
title
:
Support PostgreSQL
10
merge_request
:
16471
author
:
type
:
added
config/initializers/ar5_pg_10_support.rb
0 → 100644
View file @
3bb79875
raise
"Vendored ActiveRecord 5 code! Delete
#{
__FILE__
}
!"
if
ActiveRecord
::
VERSION
::
MAJOR
>=
5
require
'active_record/connection_adapters/postgresql/schema_statements'
#
# Monkey-patch the refused Rails 4.2 patch at https://github.com/rails/rails/pull/31330
#
# Updates sequence logic to support PostgreSQL 10.
#
# rubocop:disable all
module
ActiveRecord
module
ConnectionAdapters
module
PostgreSQL
module
SchemaStatements
# Resets the sequence of a table's primary key to the maximum value.
def
reset_pk_sequence!
(
table
,
pk
=
nil
,
sequence
=
nil
)
#:nodoc:
unless
pk
and
sequence
default_pk
,
default_sequence
=
pk_and_sequence_for
(
table
)
pk
||=
default_pk
sequence
||=
default_sequence
end
if
@logger
&&
pk
&&
!
sequence
@logger
.
warn
"
#{
table
}
has primary key
#{
pk
}
with no default sequence"
end
if
pk
&&
sequence
quoted_sequence
=
quote_table_name
(
sequence
)
max_pk
=
select_value
(
"SELECT MAX(
#{
quote_column_name
pk
}
) FROM
#{
quote_table_name
(
table
)
}
"
)
if
max_pk
.
nil?
if
postgresql_version
>=
100000
minvalue
=
select_value
(
"SELECT seqmin FROM pg_sequence WHERE seqrelid =
#{
quote
(
quoted_sequence
)
}
::regclass"
)
else
minvalue
=
select_value
(
"SELECT min_value FROM
#{
quoted_sequence
}
"
)
end
end
select_value
<<-
end_sql
,
'SCHEMA'
SELECT setval(
#{
quote
(
quoted_sequence
)
}
,
#{
max_pk
?
max_pk
:
minvalue
}
,
#{
max_pk
?
true
:
false
}
)
end_sql
end
end
end
end
end
end
# rubocop:enable all
doc/install/requirements.md
View file @
3bb79875
...
...
@@ -121,7 +121,7 @@ Existing users using GitLab with MySQL/MariaDB are advised to
### PostgreSQL Requirements
As of GitLab 10.0, PostgreSQL 9.6 or newer
(but less than 10)
is required, and earlier versions are
As of GitLab 10.0, PostgreSQL 9.6 or newer is required, and earlier versions are
not supported. We highly recommend users to use PostgreSQL 9.6 as this
is the PostgreSQL version used for development and testing.
...
...
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