mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 12:51:24 +08:00
FIX: Importing with pgbouncer failed
Checking if all records have been imported uses a temp table in PostgreSQL. This fails when pgbouncer is used unless the temp table is created inside a transaction.
This commit is contained in:
@ -219,6 +219,8 @@ class ImportScripts::Base
|
|||||||
def all_records_exist?(type, import_ids)
|
def all_records_exist?(type, import_ids)
|
||||||
return false if import_ids.empty?
|
return false if import_ids.empty?
|
||||||
|
|
||||||
|
ActiveRecord::Base.transaction do
|
||||||
|
begin
|
||||||
connection = ActiveRecord::Base.connection.raw_connection
|
connection = ActiveRecord::Base.connection.raw_connection
|
||||||
connection.exec('CREATE TEMP TABLE import_ids(val text PRIMARY KEY)')
|
connection.exec('CREATE TEMP TABLE import_ids(val text PRIMARY KEY)')
|
||||||
|
|
||||||
@ -238,6 +240,8 @@ class ImportScripts::Base
|
|||||||
ensure
|
ensure
|
||||||
connection.exec('DROP TABLE import_ids') unless connection.nil?
|
connection.exec('DROP TABLE import_ids') unless connection.nil?
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def created_user(user)
|
def created_user(user)
|
||||||
# override if needed
|
# override if needed
|
||||||
|
Reference in New Issue
Block a user