Re: [GENERAL] NOT NULL with CREATE TYPE

2009-06-08 Thread Merlin Moncure
On Mon, Jun 8, 2009 at 2:18 PM, Jeff Davis wrote: > On Sat, 2009-06-06 at 15:03 -0400, Merlin Moncure wrote: >> sql functions are pretty inflexible...even with recent even with >> recent advancements like varargs and default parameters they are >> designed to do a very particular thing...and insert

Re: [GENERAL] NOT NULL with CREATE TYPE

2009-06-08 Thread Jeff Davis
On Sat, 2009-06-06 at 15:03 -0400, Merlin Moncure wrote: > sql functions are pretty inflexible...even with recent even with > recent advancements like varargs and default parameters they are > designed to do a very particular thing...and insert/update tend to be > fairly generic in how they operate

Re: [GENERAL] NOT NULL with CREATE TYPE

2009-06-06 Thread Merlin Moncure
On Fri, Jun 5, 2009 at 1:58 PM, Jean Hoderd wrote: > > 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

Re: [GENERAL] NOT NULL with CREATE TYPE

2009-06-05 Thread Jeff Davis
On Fri, 2009-06-05 at 10:58 -0700, Jean Hoderd wrote: > 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 retur

Re: [GENERAL] NOT NULL with CREATE TYPE

2009-06-05 Thread Jean Hoderd
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.

Re: [GENERAL] NOT NULL with CREATE TYPE

2009-06-05 Thread Tom Lane
Jean Hoderd writes: > I have tried the following, but it's not accepted: > create type result as (name text not null, age int4 not null); Frankly, the notion that a "not null" condition might be associated with a SQL data type is simply a bad idea. The SQL committee let this happen for domains i

[GENERAL] NOT NULL with CREATE TYPE

2009-06-05 Thread Jean Hoderd
Dear list, Here's the situation: I want to create a functional API to a Postgresql database, in such a way that instead of issuing raw SQL commands (SELECT, INSERT, etc), the client will only invoke functions from this API. For example, to get all people in the database, the client will invoke f