From a8220b539aeb5525d2d1fb7b935c98d049df0710 Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt Date: Fri, 12 Aug 2011 21:05:46 +0000 Subject: [PATCH] Use WITH statement instead of a temporary table --- dak/rm.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/dak/rm.py b/dak/rm.py index 0583755b..0a07ce6f 100755 --- a/dak/rm.py +++ b/dak/rm.py @@ -126,16 +126,11 @@ def reverse_depends_check(removals, suite, arches=None, session=None): params['arch_id'] = get_architecture(architecture, session).arch_id statement = ''' - create temp table suite_binaries ( - id integer primary key, - package text, - source integer, - file integer); - insert into suite_binaries - select b.id, b.package, b.source, b.file + WITH suite_binaries AS + (select b.id, b.package, b.source, b.file from binaries b WHERE b.id in (SELECT bin FROM bin_associations WHERE suite = :suite_id) - AND b.architecture in (:arch_id, :arch_all_id); + AND b.architecture in (:arch_id, :arch_all_id)) SELECT b.id, b.package, s.source, c.name as component, bmd.value as depends, bmp.value as provides FROM suite_binaries b -- 2.39.5