Re: select all rows where any column is NULL

From: "David Johnston" <polobo(at)yahoo(dot)com>
To: "'Nathan Boley'" <npboley(at)gmail(dot)com>, "'PostgreSQL general'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: select all rows where any column is NULL
Date: 2011-07-26 19:45:07
Message-ID: 00c301cc4bcc$86445ae0$92cd10a0$@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Copy and paste the column names from the "CREATE TABLE" statement...

You can try using information schema and building a dynamic SQL query inside
a function...

If you let people know WHAT you are trying to accomplish you may find you
get alternative suggestions that you never considered.

SQL itself is designed for a variable/unknown numbers of rows but a
fixed/known number of columns. The only way around that is to use a "table
of column names" to identify the columns and then dynamically create a query
with those "fixed/known" columns and "EXECUTE" it within a PL/PGSQL
function.

David J.

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Nathan Boley
Sent: Tuesday, July 26, 2011 3:09 PM
To: PostgreSQL general
Subject: [GENERAL] select all rows where any column is NULL

Does anyone have a concise way of doing $SUBJECT?

Best,
Nathan

--
Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org) To make
changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Radosław Smogura 2011-07-26 19:48:14 Re: variant column type
Previous Message Nathan Boley 2011-07-26 19:08:56 select all rows where any column is NULL