From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Shekar Tippur <ctippur(at)gmail(dot)com> |
Cc: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Postgres CTE issues |
Date: | 2015-05-26 17:56:13 |
Message-ID: | CAKFQuwYhbj38hijcYaTm0h_8pWPuExD-naJGZAqExX54L8d7_A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Tue, May 26, 2015 at 10:40 AM, Shekar Tippur <ctippur(at)gmail(dot)com> wrote:
> Marc,
>
> I have changed the table C:
>
> create table C (
>
> "id" SERIAL PRIMARY KEY,
>
> name varchar(40)
>
> , b_id integer references B(id) DEFERRABLE INITIALLY DEFERRED NOT NULL);
>
>
> I still get the same error:
>
> insert into A (var1, var2) values ('Hello1', 'World1');
>
> ERROR: null value in column "b_id" violates not-null constraint
>
> DETAIL: Failing row contains (2, World1, null).
>
> CONTEXT: SQL statement "INSERT INTO C (name, b_id) VALUES (NEW.var2,
> b_id)"
>
> PL/pgSQL function fn_test() line 17 at SQL statement
>
Because you cannot defer a NOT NULL constraint.
http://www.postgresql.org/docs/9.4/static/sql-set-constraints.html
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Shekar Tippur | 2015-05-26 17:58:58 | Re: Postgres CTE issues |
Previous Message | Shekar Tippur | 2015-05-26 17:40:59 | Re: Postgres CTE issues |