Good morning,
Is there a command to drop tables whose name begins a specific string?
For example, all backup tables begins with backup_2007:
Drop table where tableName like 'backup_2007%'?
Thanks a lot!
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your
Emi Lu [EMAIL PROTECTED] writes:
Is there a command to drop tables whose name begins a specific string?
No. The standard answer to this type of problem is to write a little
plpgsql function that scans the appropriate catalog and issues commands
constructed with EXECUTE.
for r in select
Tom Lane wrote:
Note that the above is overly simplistic --- it doesn't pay attention
to schemas, for example.
These are what I use.
BEGIN;
CREATE SCHEMA util;
CREATE OR REPLACE FUNCTION util.exec_all(objtype name, schname name,
objname name, cmd TEXT) RETURNS text AS $$
DECLARE