From: | pginfo <pginfo(at)t1(dot)unisoftbg(dot)com> |
---|---|
To: | Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: pg and number of parameters by insert |
Date: | 2002-12-04 09:10:22 |
Message-ID: | 3DEDC67E.B0F14B81@t1.unisoftbg.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I do not think so.
Realy I will to have NULL value in my table.
The problem is that it can be syntax error (for example I forgot to rewrite
all my functions after
adding new filed to my table).
In this case I have syntax error in my code!
And I think the pg need to report it.
If I write
insert into table_1 (field_1,field_2) values ('f1_value',10);
and field_3 is not declared as NOT NULL it will be correct for pg to execute
it without any massage.
Is it so?
regards,
ivan.
Jean-Christian Imbeault wrote:
> pginfo wrote:
> >
> > For example if :
> >
> > create table table_1 ( filed _1 name, field_2 int, field_3 name);
> >
> > And if I try to execute:
> >
> > insert into table_1 values ('f1_value',10);
> >
> > I do not get any error from pg !!!
>
> The reason is that you did not declare the fields to be "NOT NULL". The
> default is to allow null values into the fields unless you specifically
> create the columns with the constraint "NOT NULL".
>
> If you want an error to be thrown you need to create your table liek this:
>
> create table table_1 (
> filed _1 text NOT NULL,
> field_2 int NOT NULL,
> field_3 text NOT NULL
> );
>
> Jc
From | Date | Subject | |
---|---|---|---|
Next Message | Shridhar Daithankar | 2002-12-04 09:17:08 | Re: Postgresql -- initial impressions and comments |
Previous Message | Frank van Vugt | 2002-12-04 09:01:23 | Re: Segmentation fault in 7.3 |