Re: Update with last known location?

From: Daniel Staal <DStaal(at)usa(dot)net>
To: James David Smith <james(dot)david(dot)smith(at)gmail(dot)com>, PGSQL-Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Update with last known location?
Date: 2014-01-28 17:18:15
Message-ID: BCEA4C28269BB2ECF410A7E3@[192.168.1.50]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

--As of January 28, 2014 5:07:16 PM +0000, James David Smith is alleged to
have said:

>> If it's strictly a one-time thing, I personally would write it in Perl,
>> not SQL. ;) (Or whatever your scripting language of choice is.)
>>
>> Which would allow you to change step 3 to 'If the_geom is blank, take
>> stored recent value for ppid and fill, then insert back into database.
>> Else, overwrite the_geom for this ppid.' (A bit less convoluted than
>> yours, and avoids the problems with multiple nulls in a row, as well as
>> allowing you to only sort by point_time.)
>>
>>
>> Daniel T. Staal
>
> Hi Daniel,
>
> Given the data is so large I don't want to be taking the data out to a
> CSV or whatever and then loading it back in. I'd like to do this
> within the database using SQL. I thought I would be able to do this
> using a LOOP to be honest.

--As for the rest, it is mine.

I haven't played with LOOP, it might be able to do what you need. But I'm
not saying pull the data into a CSV or anything: Perl's DBI has the ability
to iterate over a result set, pulling each value out of the database as
needed. I'm sure other scripting languages have something similar.

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message avpro avpro 2014-01-28 18:00:54 time with timezone for PostgreSql
Previous Message James David Smith 2014-01-28 17:07:16 Re: Update with last known location?