Re: [GENERAL] function with different return type depending on parameter?

2014-02-12 Thread Rémi Cura
Hey http://www.postgresql.org/docs/9.3/static/plpgsql-declarations.html at anyelement. Cheers Rémi-C 2014-02-12 10:20 GMT+01:00 James Harper : > is it possible to have a function that can return a different type > depending on the parameters? Eg (approximately) > > if param = "one" then return

[GENERAL] Toast and slice of toast

2014-02-16 Thread Rémi Cura
Hey Dear List, could somebody point me to some ressources about getting only parts of toasted data? I have a very big custom type and I would like to take blocks of it (like byte A to B then byte C to D then... ). I found a function in http://doxygen.postgresql.org/tuptoaster_8c.html#called toas

Re: [GENERAL] Toast and slice of toast

2014-02-17 Thread Rémi Cura
Thanks everybody ! Cheers, Rémi-C 2014-02-17 10:37 GMT+01:00 Andres Freund : > On 2014-02-17 14:16:33 +1100, Haribabu Kommi wrote: > > On Sun, Feb 16, 2014 at 9:38 PM, Rémi Cura wrote: > > > > > Hey Dear List, > > > could somebody point me to some resso

Re: [postgis-users] [GENERAL] postgis in postgresql apt and upgrades

2014-02-20 Thread Rémi Cura
Hey, could you please explain what you mean by "Congrats on the availability of postgis in de postgresql apt reporsitory"? It would be very great, but I can't find postgis package in http://apt.postgresql.org/pub/repos/apt/dists/ Thanks, Rémi-C 2014-02-20 16:45 GMT+01:00 Willy-Bas Loos : > Hi,

Re: [postgis-users] [GENERAL] postgis in postgresql apt and upgrades

2014-02-20 Thread Rémi Cura
So cool ^^ Going to simplify a lot install and upgrades ! Cheers, Rémi-C 2014-02-20 17:47 GMT+01:00 Willy-Bas Loos : > On Thu, Feb 20, 2014 at 4:45 PM, Willy-Bas Loos wrote: > >> Since the package names are equal to those in debian and ubuntu >> (postgresql-x.x-postgis), how will new versions

Re: [GENERAL] Synchronizing a table that is two different databases : Need to dump a table a insert from db1 and change the insert statements into UPDATE statements

2014-03-27 Thread Rémi Cura
Hey, it seems to be a very classical problem call "upsert" You'll find a lot of answer on hte web, See for example http://www.the-art-of-web.com/sql/upsert/ Cheers, Rémi-C 2014-03-27 11:16 GMT+01:00 Khangelani Gama : > Hi all > > > > Synchronizing a *table* that is in two different databases(e

Re: [GENERAL] Synchronizing a table that is in two different databases : Need to dump a table as inserts from db1 and change the insert statements into UPDATE statements

2014-03-28 Thread Rémi Cura
Not sure, but maybe update foo set br_desc = bar.br_desc , br_active = bar.br_active (rest of columns) where br_cde = bar.br_cde; Anyway it seem sto be terribly bad idea to give those kind of names ! Cheers, Rémi-C

[GENERAL] Re: [postgis-users] design question: how to geocode multiple dynamic "city, country"?

2014-04-11 Thread Rémi Cura
Hey, my 2 cents : If you give write access, beware of the sql injections http://en.wikipedia.org/wiki/SQL_injection Cheers, Rémi-C 2014-04-10 21:48 GMT+02:00 zach cruise : > i accept multiple "city, country" from users on-the-fly, and want to > dynamically map them. > > i could create a table

[GENERAL] efficient way to do "fuzzy" join

2014-04-11 Thread Rémi Cura
Hey dear List, I'm looking for some advice about the best way to perform a "fuzzy" join, that is joining two table based on approximate matching. It is about temporal matching given a table A with rows containing data and a control_time (for instance 1 ; 5; 6; .. sec, not necessarly rounded of e

Re: [GENERAL] efficient way to do "fuzzy" join

2014-04-11 Thread Rémi Cura
olson : > On 4/11/2014 7:50 AM, Rémi Cura wrote: > >> Hey dear List, >> >> I'm looking for some advice about the best way to perform a "fuzzy" >> join, that is joining two table based on approximate matching. >> >> It is about tempor

Re: [GENERAL] efficient way to do "fuzzy" join

2014-04-11 Thread Rémi Cura
t, (select t from a where a.t < b.t order by a.t desc limit 1) as maxt from b ) as tmp ) as tmp2 inner join a on (tmp2.t2 = a.t) inner join b on (tmp2.t = b.t) 2014-04-11 19:16 GMT+02:00 Andy Colson : &g

Re: [GENERAL] efficient way to do "fuzzy" join

2014-04-12 Thread Rémi Cura
e a.t < b.t order by a.t desc limit 1) as maxt from b ) as tmp ) as tmp2 inner join a on (tmp2.t2 = a.t) inner join b on (tmp2.t = b.t) --- Thanks again, Rémi-C 2014-04-11 20:18 GMT+02:00 Rémi Cura

Re: [GENERAL] efficient way to do "fuzzy" join

2014-04-14 Thread Rémi Cura
2014-04-12 15:04 GMT+02:00 Andy Colson : > On 04/12/2014 06:29 AM, Rémi Cura wrote: > >> (please note that this random string function is NOT the good way to >> do it, i should random int then use it as index to an array >> containing all the letter) >> >> T

Re: [GENERAL] efficient way to do "fuzzy" join

2014-04-15 Thread Rémi Cura
A little related bonus : when doing the time-join, the next step is to interpolate to have a more accurate estimation : --- DROP FUNCTION IF EXISTS range_interpolate(nr anyrange,obs anyelement) ; CREATE OR

Re: [GENERAL] About Large object Storage

2014-04-23 Thread Rémi Cura
Hey, about your backup, you must have use plain text backup, writing in ascii to represent binary data is costly (and pointless?). You can use compressed version of it. About the size of your database, maybe you can try a vacuum full before measuring the size? Cheers, Rémi-C 2014-04-23 15:22 GMT

Re: [GENERAL] importing a messy text file

2014-04-30 Thread Rémi Cura
Hey, with latest version 9.3 you can use a copy from with a programm as argument. I had a similar problem (an extra space at the end of each line), so I used sed in a pipeline to remove it before feeding it to database. You can use the unix | pipe for most of the stuff. If you have an older versi

Re: [GENERAL] Re: any psql \copy tricks for default-value columns without source data?

2014-05-07 Thread Rémi Cura
Hey, you may want to have a look at pg_bulkload ( http://pgbulkload.projects.pgfoundry.org/). Using filter you could get the function you want. Another solution is pgloader (http://pgloader.tapoueh.org) , but I don't know if it is as fast as copy. Cheers, Rémi-C 2014-05-06 23:04 GMT+02:00 David

<    1   2