Re: NOT NULL with CREATE TYPE - Mailing list pgsql-general

From Jean Hoderd
Subject Re: NOT NULL with CREATE TYPE
Date
Msg-id 885024.81977.qm@web30404.mail.mud.yahoo.com
Whole thread Raw
In response to NOT NULL with CREATE TYPE  (Jean Hoderd <jhoderd@yahoo.com>)
Responses Re: NOT NULL with CREATE TYPE
Re: NOT NULL with CREATE TYPE
List pgsql-general
Hi,

> So I don't recommend you try to do this.  What is the actual problem
> you are trying to solve?  Why do you want the client library to be
> concerned with attnotnull at all?

In general the client library needs to check attnotnull to make sure
that the client is not making a type mistake.  If for example a field
is "int null", but the client program treats it as "int not null" (ie,
forgetting to check for the null case), then the client program is
wrong and the compiler should issue a warning.  This is basic, essential,
functionality.  But I'm curious: how else could this be done?...

> ... or even more to the point, why do you think the above is a good
> idea to begin with?  It looks more like the kind of bad design that
> is frequently committed by people who basically don't like SQL, and
> try to ensure that no one else will like it either.

The above example was absurdly simple, but in the real world the query
is complex enough that instead of being just a SELECT is actually the
return of a PL/PGSQL function.  I just want a way to tell the client
which fields from the return type are actually, really, nullable...

Any other ideas?

Cheers,
Jean





pgsql-general by date:

Previous
From: Eric Schwarzenbach
Date:
Subject: Re: Schema, database, or tables in different folders?
Next
From: Ivan Sergio Borgonovo
Date:
Subject: Re: why dropping a trigger may cause a deadlock