| От | Jean-Christian Imbeault |
|---|---|
| Тема | Re: pg and number of parameters by insert |
| Дата | |
| Msg-id | 3DEDD696.8030501@mega-bucks.co.jp обсуждение исходный текст |
| Ответ на | pg and number of parameters by insert (pginfo <pginfo@t1.unisoftbg.com>) |
| Список | pgsql-general |
pginfo wrote:
>
> 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?
That's right. If you do not declare the column with a constraint of NOT
NULL, then it is not an error to do:
insert into table_1 (field_1,field_2) values ('f1_value',10);
Why should this query throw an error? You are asking the DB to insert
values into a row. There are no constraints on any of the columns so the
DB is quite happy to do what you ask.
If you want to make it mandatory for an insert to specify a value for a
column then you MUST have a constraint on that column of NOT NULL.
Jc
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера