1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-12 17:44:07 +02:00

PostgreSQL: Add IF EXISTS to DROP SEQUENCE in export (bug #595)

This commit is contained in:
Jakub Vrana
2018-02-09 22:11:27 +01:00
parent daa19b0a6e
commit 879963dec1
2 changed files with 2 additions and 1 deletions

View File

@@ -715,7 +715,7 @@ AND typelem = 0"
? "SELECT *, cache_size AS cache_value FROM pg_sequences WHERE schemaname = current_schema() AND sequencename = " . q($sequence_name)
: "SELECT * FROM $sequence_name"
));
$sequences[] = ($style == "DROP+CREATE" ? "DROP SEQUENCE $sequence_name;\n" : "")
$sequences[] = ($style == "DROP+CREATE" ? "DROP SEQUENCE IF EXISTS $sequence_name;\n" : "")
. "CREATE SEQUENCE $sequence_name INCREMENT $sq[increment_by] MINVALUE $sq[min_value] MAXVALUE $sq[max_value] START " . ($auto_increment ? $sq['last_value'] : 1) . " CACHE $sq[cache_value];";
}
}