PostgreSQLによる全てのカラムがNULLでないデータの抽出方法
with inf as (select
table_schema, table_name, column_name::text
from
information_schema.columns
where
table_catalog='データベース名'
and
table_schema='スキーマ名'
and
table_name='テーブル名'
and
is_nullable='YES'
and
column_name != 'NULLかどうかは無視するカラム'
order by
ordinal_position)
select 'select * from ' || table_schema || '.' || table_name || ' where (' ||
ARRAY_TO_STRING(ARRAY(select column_name from inf), ',')
|| ') is not null'
from inf limit 1