pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
query on multiple tables in schema
2+ messages / 2 participants
[nested] [flat]

* query on multiple tables in schema
@ 2004-09-28 21:19  Angus Berry <angus.berry@elken.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Angus Berry @ 2004-09-28 21:19 UTC (permalink / raw)
  To: pgsql-admin

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

I'd appreciate any advice.




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: query on multiple tables in schema
@ 2004-10-01 18:30  Bruno Wolff III <bruno@wolff.to>
  parent: Angus Berry <angus.berry@elken.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Bruno Wolff III @ 2004-10-01 18:30 UTC (permalink / raw)
  To: Angus Berry <angus.berry@elken.com>; +Cc: pgsql-admin

On Tue, Sep 28, 2004 at 17:19:20 -0400,
  Angus Berry <angus.berry@elken.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.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-10-01 18:30 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-09-28 21:19 query on multiple tables in schema Angus Berry <angus.berry@elken.com>
2004-10-01 18:30 ` Bruno Wolff III <bruno@wolff.to>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox