Commit d8d051df authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo
Browse files

perf scripts python: export-to-postgresql.py: Fix DROP VIEW power_events_view



PostgreSQL can error if power_events_view is not dropped before its
dependent tables e.g.

  Exception: Query failed: ERROR:  cannot drop table mwait because other
  objects depend on it
  DETAIL:  view power_events_view depends on table mwait

Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Fixes: aba44287 ("perf scripts python: export-to-postgresql.py: Export Intel PT power and ptwrite events")
Link: http://lkml.kernel.org/r/20190708055232.5032-2-adrian.hunter@intel.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent ceb75476
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -898,11 +898,11 @@ def trace_end():
	if is_table_empty("ptwrite"):
	if is_table_empty("ptwrite"):
		drop("ptwrite")
		drop("ptwrite")
	if is_table_empty("mwait") and is_table_empty("pwre") and is_table_empty("exstop") and is_table_empty("pwrx"):
	if is_table_empty("mwait") and is_table_empty("pwre") and is_table_empty("exstop") and is_table_empty("pwrx"):
		do_query(query, 'DROP VIEW power_events_view');
		drop("mwait")
		drop("mwait")
		drop("pwre")
		drop("pwre")
		drop("exstop")
		drop("exstop")
		drop("pwrx")
		drop("pwrx")
		do_query(query, 'DROP VIEW power_events_view');
		if is_table_empty("cbr"):
		if is_table_empty("cbr"):
			drop("cbr")
			drop("cbr")