Re: Insert question null/not null serial, etc.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Russ Schneider <russ(at)sugapablo(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Insert question null/not null serial, etc.
Date: 2004-01-31 23:15:32
Message-ID: 8888.1075590932@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Russ Schneider <russ(at)sugapablo(dot)com> writes:
> insert into nuke_referer values (NULL,'whatever');

> Which gives me the error: "Warning: pg_exec(): Query failed: ERROR:
> ExecAppend: Fail to add null value in not null attribute rid"

Sounds like they are expecting NULL to get replaced with the column
default, which is shall we say a rather surprising reading of the SQL
spec (and yeah, I know which other database acts that way).

> Since nowhere in the 3000 files of PHP-Nuke do they actually name columns
> for insert commands, does anyone have any suggestions? Can NULL be
> replaced with anything?

In the last PG release or two you could write DEFAULT instead of NULL
and get the desired behavior.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Michel POURE 2004-01-31 23:24:57 Using PostgreSQL to store ip traffic information
Previous Message Tom Lane 2004-01-31 23:10:16 Re: Sorting is ignoring spaces