CodePudding user response:
Can use dynamic SQL statements in the PL/pgSQL:create table A_2019_06_29 int (id);
Do $$
Declare
SQLSTR text;
The begin
SQLSTR:='drop table A_' | | to_char (current_date - 1, 'YYYY_MM_DD');
The execute SQLSTR;
End $$;
CodePudding user response:
Can use dynamic SQL statements in the PL/pgSQL:create table A_2019_06_29 int (id);
Do $$
Declare
SQLSTR text;
The begin
SQLSTR:='drop table A_' | | to_char (current_date - 1, 'YYYY_MM_DD');
The execute SQLSTR;
End $$;