Re: Fw: How to FindNearest

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: paallen(at)attglobal(dot)net
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Fw: How to FindNearest
Date: 2006-10-04 04:11:50
Message-ID: 20061004041150.GA30862@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, Oct 03, 2006 at 17:35:55 +0000,
paallen(at)attglobal(dot)net wrote:
>
> My function will take all the above info about the hole and down_hole_survey tables, and sample.hole_id and sample.depth_meters and will calculate the coordinates. I need to put these coordinates into sample.x , sample.y and sample.z .
>
> What I used to do was have one function that would return 3 values (x,y,z). Then create 3 more functions that would call call the main function and pull out the 3 values seperately to update the 3 seperate columns. It works fine but I have to call the main function 3 times which produces a slow performance.
>
> I hope that I explained it better this time.

If they are in the same table you can update all there in the same
update statement using syntax something like the following:
UPDATE sample SET x=(some expression), y=(some expression), z=(some expression)
WHERE some condition;

Probably the simplest place to start is having your function do the update
rather than return the three values.
I think in 8.2 there will be an easier way to use the result of a function that
returns a row to update multiple columns in an update statement. (That
doesn't resu;t in calling the function three times.)

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Markus Schaber 2006-10-04 09:07:40 Re: Assigning a timestamp without timezone to a timestamp
Previous Message ljb 2006-10-04 01:35:36 Re: timestamps over the web - suggestions