Re: [GENERAL] Is this logical?

2006-09-10 Thread Lincoln Yeoh
At 01:12 AM 9/10/2006 +0330, Behrang Saeedzadeh wrote: Hi, Shouldn't this create statement trigger an error? create table bar (col1 int not null default null); No. Shouldn't I be forbidden to insert null values into a non null column? Yes. Use "not null default null" when you want to f

Re: [GENERAL] Is this logical?

2006-09-10 Thread Sim Zacks
If there is no default statement, then the default (by default) is null. What you are suggesting is that every field that is not null should require a default value. Behrang Saeedzadeh wrote: Stephan, But "not null" is in contradiction with "default null" so the create statement should not pr

Re: [GENERAL] Is this logical?

2006-09-09 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Behrang Saeedzadeh wrote: > Stephan, > > But "not null" is in contradiction with "default null" so the create > statement should not proceed successfuly IMHO. I see your point, but those are run-time (i.e. DML) operations, not DDL statements. Added

Re: [GENERAL] Is this logical?

2006-09-09 Thread Tom Lane
"Behrang Saeedzadeh" <[EMAIL PROTECTED]> writes: > Actually I read in a blog that this works in PostgreSQL (the author > expected this) and not in MySQL. But to me, the way MySQL is handling > this looks more reasonable. MySQL's way of doing things is seldom reasonable. In the example given, they

Re: [GENERAL] Is this logical?

2006-09-09 Thread Behrang Saeedzadeh
Hi, Actually I read in a blog that this works in PostgreSQL (the author expected this) and not in MySQL. But to me, the way MySQL is handling this looks more reasonable. You may want to read the blog here: http://www.redhillconsulting.com.au/blogs/simon/archives/000347.html Regards, Behi On 9/

Re: [GENERAL] Is this logical?

2006-09-09 Thread Behrang Saeedzadeh
Stephan, But "not null" is in contradiction with "default null" so the create statement should not proceed successfuly IMHO. Regards, Behi On 9/10/06, Stephan Szabo <[EMAIL PROTECTED]> wrote: On Sun, 10 Sep 2006, Behrang Saeedzadeh wrote: > Shouldn't this create statement trigger an error? >

Re: [GENERAL] Is this logical?

2006-09-09 Thread Stephan Szabo
On Sun, 10 Sep 2006, Behrang Saeedzadeh wrote: > But "not null" is in contradiction with "default null" so the create > statement should not proceed successfuly IMHO. The fact that the default value isn't going to pass a constraint means that it's invalid to not provide a value or use default, y

Re: [GENERAL] Is this logical?

2006-09-09 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > On Sun, 10 Sep 2006, Behrang Saeedzadeh wrote: >> Shouldn't this create statement trigger an error? >> create table bar (col1 int not null default null); > I think it should forbid it when the default actually comes into play like > on insert or update,

Re: [GENERAL] Is this logical?

2006-09-09 Thread Stephan Szabo
On Sun, 10 Sep 2006, Behrang Saeedzadeh wrote: > Shouldn't this create statement trigger an error? > > create table bar (col1 int not null default null); > > Shouldn't I be forbidden to insert null values into a non null column? I think it should forbid it when the default actually comes into p

Re: [GENERAL] Is this logical?

2006-09-09 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Behrang Saeedzadeh wrote: > Hi, > > Shouldn't this create statement trigger an error? > > create table bar (col1 int not null default null); > > Shouldn't I be forbidden to insert null values into a non null column? What happens when you actually

[GENERAL] Is this logical?

2006-09-09 Thread Behrang Saeedzadeh
Hi, Shouldn't this create statement trigger an error? create table bar (col1 int not null default null); Shouldn't I be forbidden to insert null values into a non null column? Regards, Behi -- "We can only see a short distance ahead, but we can see plenty there that needs to be done." - Alan