PostgreSQL: Export serial as serial, not nextval()

This commit is contained in:
Jakub Vrana
2026-03-01 18:39:24 +01:00
parent 11234ef939
commit 5754b32693
2 changed files with 6 additions and 0 deletions

View File

@@ -6,6 +6,7 @@
- Foreign key: Display new field in case of an error
- PostgreSQL: Order NULL last
- PostgreSQL: Display all SQL command warnings and only once
- PostgreSQL: Export serial as serial, not nextval()
- PostgreSQL: Export schema in nextval()
- PostgreSQL: Export schema in REFERENCES
- Editor: Display tinyint(1) as checkbox (bug #1246, regression from 5.4.2)

View File

@@ -946,6 +946,11 @@ AND typelem = 0"
// fields' definitions
foreach ($fields as $field) {
if ($field['default'] == "nextval('$status[Name]_$field[field]_seq')") {
$field['default'] = null;
$field['full_type'] = preg_replace('~int(eger)?~', 'serial', $field['full_type']);
}
$part = idf_escape($field['field']) . ' ' . $field['full_type']
. preg_replace('~(nextval\(\')([^.\']+\')~', '\1' . str_replace("'", "''", $status['nspname']) . '.\2', default_value($field))
. ($field['null'] ? "" : " NOT NULL");