I am sorry, I tried to break it down to the simplest test. It was on the
not null that it was failing. When I reconstructed the test in the
database, I went down the path of thinking it was a timestamp issue not a
default issue.
Here is the issue again.
-- It appears that default values are no longer working in 9.3.1.
-- This is the version that I am running:
-- "PostgreSQL 9.3.1 on x86_64-apple-darwin, compiled by
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build
5658) (LLVM build 2336.9.00), 64-bit"
-- Test Case
drop table default_test;
create table default_test
(
userId varchar(20) default 'test' not null,
date1 timestamp default now() not null,
date2 timestamp default current_timestamp not null,
date3 timestamp default localtimestamp not null
);
insert into default_test
( userId, date1, date2, date3 )
values
( null, null, null, null );
select * from default_test;
ERROR: null value in column "userid" violates not-null constraint
DETAIL: Failing row contains (null, null, null, null).
********** Error **********
ERROR: null value in column "userid" violates not-null constraint
SQL state: 23502
Detail: Failing row contains (null, null, null, null).
On Mon, Feb 3, 2014 at 5:31 PM, Marko Tiikkaja <marko@joh.to> wrote:
> On 2/3/14, 11:23 PM, plademan@comcast.net wrote:
>
>> It appears that default values are no longer working in 9.3.1.
>>
>> insert into default_test
>> ( userId, date1, date2, date3 )
>> values
>> ( null, null, null, null );
>>
>> select * from default_test;
>>
>
> This wouldn't have worked in previous versions either. You want:
>
> INSERT INTO default_test (userid, date1, date2, date) VALUES (DEFAULT,
> DEFAULT, DEFAULT, DEFAULT)
>
> or perhaps
>
> INSERT INTO default_test DEFAULT VALUES;
>
>
> Regards,
> Marko Tiikkaja
>
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>