Re: Insert via Select Problem
| От | Tom Lane |
|---|---|
| Тема | Re: Insert via Select Problem |
| Дата | |
| Msg-id | 6545.973528575@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Insert via Select Problem (Tara Pierkowski <tara@vilaj.com>) |
| Список | pgsql-general |
Tara Pierkowski <tara@vilaj.com> writes:
> In essence, what I have found is that if I execute a somewhat lengthy query
> and dump the output to the screen I get a result set that is different than
> if I execute the exact same query but use the query as the source for an
> insert command.
You didn't show us the data types of the source table, but I'll bet that
one of the GROUP BY columns has a different type than the column you are
trying to INSERT it into. This is a known bug in 7.0.* (and all earlier
releases) --- the type coercion is done at the wrong time, and the GROUP
operator gets confused because it's expecting to see a different
datatype than what it actually gets.
It's fixed for 7.1, but in the meantime you can work around it by
explicitly coercing the SELECT-list item to the destination column type.
regards, tom lane
В списке pgsql-general по дате отправления: