0001-drop-tables-sequencially-to-avoid-max_locks_per_tran.patch
wcs_olap/feeder.py | ||
---|---|---|
315 | 315 |
def do_schema(self): |
316 | 316 |
self.ex('SET search_path = public') |
317 | 317 |
self.logger.debug('dropping schema %s', self.schema + '_temp') |
318 |
self.drop_tables_sequencially() |
|
318 | 319 |
self.ex('DROP SCHEMA IF EXISTS {schema_temp} CASCADE') |
319 | 320 |
self.logger.debug('creating schema %s', self.schema) |
320 | 321 |
self.ex('CREATE SCHEMA {schema_temp}') |
321 | 322 |
self.ex('SET search_path = {schema_temp},public') |
322 | 323 | |
324 |
def drop_tables_sequencially(self): |
|
325 |
""" |
|
326 |
Drop tables one by one in order to avoid reaching max_locks_per_transaction |
|
327 |
""" |
|
328 |
self.ex("SELECT tablename FROM pg_tables WHERE schemaname = '{schema_temp}'") |
|
329 |
for table in self.cur.fetchall(): |
|
330 |
tablename = '%s%s.%s' % (self.schema, '_temp', table[0]) |
|
331 |
self.ex('DROP TABLE IF EXISTS %s CASCADE;' % tablename) |
|
332 | ||
323 | 333 |
def do_dates_table(self): |
324 | 334 |
# test if public.dates exists |
325 | 335 |
self.ex("SELECT * FROM information_schema.tables WHERE table_name = 'dates' AND" |
326 |
- |