Re: query on multiple tables in schema

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Angus Berry <angus(dot)berry(at)elken(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: query on multiple tables in schema
Date: 2004-10-01 18:30:59
Message-ID: 20041001183059.GB20624@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Tue, Sep 28, 2004 at 17:19:20 -0400,
Angus Berry <angus(dot)berry(at)elken(dot)com> wrote:
> Hi, I wonder if anyone can help.
>
> I'd like to execute a SQL query that performs an action on all the
> (unrelated) tables that I select. The following query doesn't work, but
> the subselect (which works) shows what I'm trying to do. All tables have
> an identical column called id_num.
>
> delete from
> (select tablename from pg_tables where schemaname = 'public')
> where id_num = null

id_num = null will always return NULL which is not TRUE so that no rows
will be selected for deletion. Try using IS NULL instead.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Steve Crawford 2004-10-01 19:08:18 Re: PLEASE GOD HELP US!
Previous Message Uwe C. Schroeder 2004-10-01 16:48:52 Re: PLEASE GOD HELP US!