Re: Insert via Select Problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tara Pierkowski <tara(at)vilaj(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Insert via Select Problem
Date: 2000-11-06 16:36:15
Message-ID: 6545.973528575@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tara Pierkowski <tara(at)vilaj(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jonathan Arrien 2000-11-06 17:04:59 initdb
Previous Message Tara Pierkowski 2000-11-06 15:43:42 Insert via Select Problem