mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-52511 dml: add support for PostgreSQL 9.5
The default definition behaviour has changed for some int values.
This commit is contained in:
parent
9d5d9c64ff
commit
267ac1b9eb
@ -478,7 +478,14 @@ class pgsql_native_moodle_database extends moodle_database {
|
||||
$info->scale = null;
|
||||
$info->not_null = ($rawcolumn->attnotnull === 't');
|
||||
if ($info->has_default) {
|
||||
$info->default_value = trim($rawcolumn->adsrc, '()');
|
||||
// PG 9.5+ uses ::<TYPE> syntax for some defaults.
|
||||
$parts = explode('::', $rawcolumn->adsrc);
|
||||
if (count($parts) > 1) {
|
||||
$info->default_value = reset($parts);
|
||||
} else {
|
||||
$info->default_value = $rawcolumn->adsrc;
|
||||
}
|
||||
$info->default_value = trim($info->default_value, "()'");
|
||||
} else {
|
||||
$info->default_value = null;
|
||||
}
|
||||
@ -496,7 +503,14 @@ class pgsql_native_moodle_database extends moodle_database {
|
||||
$info->not_null = ($rawcolumn->attnotnull === 't');
|
||||
$info->has_default = ($rawcolumn->atthasdef === 't');
|
||||
if ($info->has_default) {
|
||||
$info->default_value = trim($rawcolumn->adsrc, '()');
|
||||
// PG 9.5+ uses ::<TYPE> syntax for some defaults.
|
||||
$parts = explode('::', $rawcolumn->adsrc);
|
||||
if (count($parts) > 1) {
|
||||
$info->default_value = reset($parts);
|
||||
} else {
|
||||
$info->default_value = $rawcolumn->adsrc;
|
||||
}
|
||||
$info->default_value = trim($info->default_value, "()'");
|
||||
} else {
|
||||
$info->default_value = null;
|
||||
}
|
||||
@ -514,7 +528,14 @@ class pgsql_native_moodle_database extends moodle_database {
|
||||
$info->not_null = ($rawcolumn->attnotnull === 't');
|
||||
$info->has_default = ($rawcolumn->atthasdef === 't');
|
||||
if ($info->has_default) {
|
||||
$info->default_value = trim($rawcolumn->adsrc, '()');
|
||||
// PG 9.5+ uses ::<TYPE> syntax for some defaults.
|
||||
$parts = explode('::', $rawcolumn->adsrc);
|
||||
if (count($parts) > 1) {
|
||||
$info->default_value = reset($parts);
|
||||
} else {
|
||||
$info->default_value = $rawcolumn->adsrc;
|
||||
}
|
||||
$info->default_value = trim($info->default_value, "()'");
|
||||
} else {
|
||||
$info->default_value = null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user