2021-12-12, 06:02 PM
The primary part of
https://github.com/mybb/mybb/blob/mybb_1...1286-L1293
https://github.com/mybb/mybb/blob/mybb_1...#L482-L487
As in the above code, there might be at least two issues:
1. The variable
2. The query SQL to
3. The query SQL to find any sequences that are still linked to the current table is wrong. The view that has sequence information is
About the sequence's add/drop:
- In PostgreSQL 8.2 and later,
- But in PostgreSQL 8.1 and previous versions, the
DROP TABLE
should work fine but the following DROP SEQUENCE
part may not work:https://github.com/mybb/mybb/blob/mybb_1...1286-L1293
https://github.com/mybb/mybb/blob/mybb_1...#L482-L487
As in the above code, there might be at least two issues:
1. The variable
$table
in the query doesn't have $table_prefix
.2. The query SQL to
DROP SEQUENCE
is using single quotes so the variables in it won't get expanded.3. The query SQL to find any sequences that are still linked to the current table is wrong. The view that has sequence information is
information_schema.sequences
but not information_schema.constraint_column_usage
which is used for constraints and keys.About the sequence's add/drop:
- In PostgreSQL 8.2 and later,
CREATE SEQUENCE ... OWNED BY ...
is allowed. Thus, when a table is dropped any sequences owned by it will also get dropped, created by either the serial
data type or CREATE SEQUENCE ... OWNED BY ...
.- But in PostgreSQL 8.1 and previous versions, the
OWNED BY
clause hasn't been supported yet. MyBB officially supports PostgreSQL >= 8.1, so we have to maintain this code.