| От | Tino Wildenhain |
|---|---|
| Тема | Re: insert into ... select ... and column order |
| Дата | |
| Msg-id | 478CA6D1.5080806@wildenhain.de обсуждение |
| Ответ на | insert into ... select ... and column order (Tore Halset <halset@pvv.ntnu.no>) |
| Список | pgsql-general |
Tore Halset wrote: > Hello. > > One of our users tried a "insert into ... select ..." that gave a > strange error message. After digging into the issue, the problem seem to > be that the order of the columns in the select statement must match the > table definition. Here is a way to reproduce this case. ... > > Why does the column order matter when the subselect has all the correct > column names? When I noticed this long ago I just blamed it to SQL standards ;) I do admit I never checked with the documentation. And yes the names of the columns do not matter, just use the correct order - either default or better: INSERT INTO ... ( a,b,c ) SELECT a,b,c FROM .... since new columns or reorder would not disturb your insert. Regards Tino
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера