Re: ERROR: domain domain1 does not allow null values

From: Richard Huxton <dev(at)archonet(dot)com>
To: "Igor V(dot) Youdytsky" <Pitcher(at)bk(dot)ru>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: ERROR: domain domain1 does not allow null values
Date: 2007-06-01 12:50:26
Message-ID: 46601612.7000800@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Igor V. Youdytsky wrote:
> Hello.
> I've found unexpected behavior of PostgreSQL 8.2.3
>
> CREATE DOMAIN "public"."domain1" AS integer NOT NULL;
>
> CREATE TABLE "public"."table1" ("field1" "public"."domain1") WITH OIDS;

OK, so you can't have nulls in anything of type "domain1" and that's the
type of public.table1.field1

> CREATE OR REPLACE FUNCTION "public"."function1" () RETURNS text AS
> $body$
> declare
> a public.table1%ROWTYPE;

> ERROR: domain domain1 does not allow null values
> CONTEXT: PL/pgSQL function "function1" line 3 at block variables
> initialization
>
> I think it is insane.
> Any comments welcome...

What should happen when you try to violate a NOT NULL constraint?
Or are you saying "a" should be initialised with some randomly valid values?

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2007-06-01 12:53:13 Re: Geographic data sources, queries and questions
Previous Message Gregory Stark 2007-06-01 12:34:47 Re: invalid memory alloc after insert with c trigger function