Inserts with incomplete rows... NOT NULL constraints

Поиск
Список
Период
Сортировка
От Lars Erik Thorsplass
Тема Inserts with incomplete rows... NOT NULL constraints
Дата
Msg-id 7eeb33a040811053563894d7b@mail.gmail.com
обсуждение исходный текст
Ответы Re: Inserts with incomplete rows... NOT NULL constraints  (Peter Eisentraut <peter_e@gmx.net>)
Re: Inserts with incomplete rows... NOT NULL constraints  (Richard Huxton <dev@archonet.com>)
Список pgsql-sql
Am trying to migrate some old data to a new database schema. I have
dumped the old data as SQL statements. The new datastructure just
contains some added fields to a few tables.

My plan was to just create a new database with the new structure, dump
the content only as SQL insert statements. And just run the statements
contained in the dump on the new database.

The problem am now facing is that postgres will try to insert a NULL
value for fields not specified in the insert query and that are
defined as NOT NULL in the table structure. Is this the correct
behaviour?

I would expect NULL fields not specified in the insert to get NULL
inserted automatically. But that fields which are NOT NULL in the
table structure gets inserted a NULL value too seems odd.

Am loosing my mind in this heat but, you should be able to insert just
half the fields of a table record if the datastructure would allow it?
Wouldnt you?

I feel like a such a noob :(

Please advise..

-- 
L.E.Thorsplass


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Philippe Lang"
Дата:
Сообщение: Re: function expression in FROM may not refer to other relations of same query level
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Inserts with incomplete rows... NOT NULL constraints