agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: basuraspam - <basuraspam0@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Database views metadata always nullable columns
Date: Fri, 02 Jun 2017 10:21:30 -0400
Message-ID: <12456.1496413290@sss.pgh.pa.us> (raw)
In-Reply-To: <CAAMZiXCo2PdDXBB0b+uCfdNMk+meGa_7J1y_qm5eumFc9zV-5Q@mail.gmail.com>
References: <CAAMZiXCo2PdDXBB0b+uCfdNMk+meGa_7J1y_qm5eumFc9zV-5Q@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

basuraspam - <basuraspam0@gmail.com> writes:
>    Doing some automatic metadata parsing job against postgresql schema I
> just find that database views always shown all its column as nullable, it
> doesn't matter what are the constraints in the original table columns used
> as source to create the view.
> I just checked it against infomation_schema and pg_attribute with the same
> result.

regression=# create table foo (f1 int, f2 int not null);
CREATE TABLE
regression=# select column_name, is_nullable from information_schema.columns where table_name = 'foo';
 column_name | is_nullable 
-------------+-------------
 f1          | YES
 f2          | NO
(2 rows)

regression=# select attname,attnotnull from pg_attribute where attrelid = 'foo'::regclass and attnum > 0;
 attname | attnotnull 
---------+------------
 f1      | f
 f2      | t
(2 rows)

So I don't see anything particularly broken here.  Maybe you should
provide some concrete examples rather than making sweeping claims.

			regards, tom lane


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



view thread (6+ messages)  latest in thread

Message-ID: <12456.1496413290@sss.pgh.pa.us>
Permalink:  ../12456.1496413290@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12456.1496413290@sss.pgh.pa.us

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, basuraspam0@gmail.com
  Subject: Re: Database views metadata always nullable columns
  In-Reply-To: <12456.1496413290@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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