Re: SET syntax in INSERT

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: SET syntax in INSERT
Дата
Msg-id 20090825190253.GJ12604@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: SET syntax in INSERT  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Список pgsql-hackers
Heikki Linnakangas escribió:

> I do understand the point, though - it's much easier to edit and debug
> long statements when the value is close to the column name. I find that
> the INSERT .. SELECT makes that a lot nicer:
> 
> INSERT INTO t
> (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15)
> SELECT 'val1' AS col1,
>        'val2' AS col2,

This example lists the columns twice, which is lame (you have to keep
both in sync) -- and if you take the first list out it works, but the
values can end up in the wrong places if they are not in the same order
as the columns in the table.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: SET syntax in INSERT
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: We should Axe /contrib/start-scripts