respond to code review comment
[xtuple] / enyo-client / database / source / wipe_views.sql
1 do $$
2  /* Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3      See www.xm.ple.com/CPAL for the full text of the software license. */
4 declare
5   sqlstring text;
6 begin
7   select string_agg('drop view ' || t.oid::regclass || ' cascade;', ' ') into sqlstring
8     from pg_class t
9     join pg_namespace n on n.oid = relnamespace
10    where relkind = 'v'
11      and nspname in ('xm','sys', 'xt');
12   if length(sqlstring) > 0 then
13     execute sqlstring;
14   end if;
15 end
16 $$;