From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | Dan Libby <dan(at)libby(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: text to point conversion not working. ( cannot cast |
Date: | 2006-09-28 12:07:32 |
Message-ID: | 20060928050022.K48861@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, 27 Sep 2006, Dan Libby wrote:
> Background:
>
> I have a hierarchical table where I have coordinate data for only the leaf
> nodes. I therefore want to find the center of all the leaf nodes under a
> given parent node, and set the parent node coordinate to that center point.
>
> I can calcululate that center point using aggregate functions (min, max) to
> find the necessary x,y values. So my query would look something like this:
>
> update parent_table set col =
> (select (max(pnt[0])-min(pnt[0]))/2+min(pnt[0]) || ',' ||
> max(pnt[1])-max(pnt[1])/2+min(pnt[1]) from point_tmp where condition)
> where condition2 ;
>
> Where point_tmp.tmp is defined as a point column.
>
> However, when I try to do it, I get a similar error:
>
> column "col" is of type point but expression is of type text
>
> If the above task can be performed some other way, perhaps I don't require
> string concatenation....
I don't have 8.0.x to check, but there's likely a
point(double precision, double precision) function you can use.
From | Date | Subject | |
---|---|---|---|
Next Message | David Cressey | 2006-09-28 12:20:49 | Re: cyclical redundancy checksum algorithm(s)? |
Previous Message | A. Kretschmer | 2006-09-28 10:46:50 | Re: Definition of return types for own functions? |