From mail at joeconway.com Wed Feb 1 20:35:36 2012 From: mail at joeconway.com (Joe Conway) Date: Wed, 01 Feb 2012 12:35:36 -0800 Subject: [Plr-general] Windows 32 and 64 bit plr.dll for PostgreSQL 9.1.x Message-ID: <4F29A218.5070004@joeconway.com> Someone recently pointed out that I never posted PL/R binaries compiled against PostgreSQL 9.1.x. They are now available in the usual place: http://www.joeconway.com/plr/ Sorry for the delay. Joe -- Joe Conway credativ LLC: http://www.credativ.us Linux, PostgreSQL, and general Open Source Training, Service, Consulting, & 24x7 Support From mail at joeconway.com Wed Feb 1 20:37:41 2012 From: mail at joeconway.com (Joe Conway) Date: Wed, 01 Feb 2012 12:37:41 -0800 Subject: [Plr-general] Windows 32 and 64 bit plr.dll for PostgreSQL 9.1.x In-Reply-To: <4F29A218.5070004@joeconway.com> References: <4F29A218.5070004@joeconway.com> Message-ID: <4F29A295.2090703@joeconway.com> On 02/01/2012 12:35 PM, Joe Conway wrote: > Someone recently pointed out that I never posted PL/R binaries compiled > against PostgreSQL 9.1.x. They are now available in the usual place: > > http://www.joeconway.com/plr/ Oops -- to be more specific PL/R *Windows* binaries. I have not posted any Linux or Mac binaries, but hopefully most people can easily compile PL/R on those platforms. Joe -- Joe Conway credativ LLC: http://www.credativ.us Linux, PostgreSQL, and general Open Source Training, Service, Consulting, & 24x7 Support From ben at ausvet.com.au Fri Feb 10 10:50:44 2012 From: ben at ausvet.com.au (Ben Madin) Date: Fri, 10 Feb 2012 18:50:44 +0800 Subject: [Plr-general] in place update of plr Message-ID: G'day all, Need a bit of help - we have inadvertently updated R, and now none of our plr_module functions are calling the right R functions from the plr_modules table. and we are getting parse errors like : SQLSTATE[22000]: Data exception: 7 ERROR: R interpreter parse error DETAIL: R parse error caught in "output.17 <- function (blah blah) but the function called was : SELECT r_output_226($$blah blah$$) and looks like : Schema | Name | Result data type | Argument data types | Type | Volatility | Owner | Language | Source code | Description ---------+-------------+------------------+--------------------------------+--------+------------+-------+----------+-------------------------+------------- outputs | r_output_226 | text | q text, o text, d text, c text | normal | volatile | ben | plr | output.226(q, o, d, c) | in fact, it doesn't matter which source code is referenced in the function, it always tries to call output.17()! Do we need to drop extension plr, recompile it and add it again. And when we drop extension plr cascade; we are getting errors about missing function numbers... is there a way to force this to work (since cascade doesn't seem to be forcing it). or is the entire drop / reinstall going down the wrong path? ( pg 9.1.2, R 2.14.1 (upgraded from 2.14.0) and plr 8.3.0.13 ) cheers Ben -- Ben Madin t : +61 8 6102 5535 m : +61 448 887 220 e : ben at ausvet.com.au AusVet Animal Health Services P.O. Box 5467 Broome WA 6725 Australia AusVet's website: http://www.ausvet.com.au This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please delete it and notify the sender. The contents of this email are the opinion of the writer only and are not endorsed by AusVet Animal Health Services unless expressly stated otherwise. Although AusVet uses virus scanning software we do not accept liability for viruses or similar in any attachments. Thanks for reading. From mail at joeconway.com Fri Feb 10 16:59:30 2012 From: mail at joeconway.com (Joe Conway) Date: Fri, 10 Feb 2012 08:59:30 -0800 Subject: [Plr-general] in place update of plr In-Reply-To: References: Message-ID: <4F354CF2.4030207@joeconway.com> On 02/10/2012 02:50 AM, Ben Madin wrote: > in fact, it doesn't matter which source code is referenced in the > function, it always tries to call output.17()! > > Do we need to drop extension plr, recompile it and add it again. > > And when we drop extension plr cascade; we are getting errors about > missing function numbers... is there a way to force this to work > (since cascade doesn't seem to be forcing it). > > or is the entire drop / reinstall going down the wrong path? Hmm, I don't know how the R upgrade could cause this, and I cannot imagine how reinstalling PL/R could possibly fix it. A few thoughts/questions: 1) Did you restart postgres after upgrading R? 2) Did you try to recreate one of the functions, i.e.: CREATE OR REPLACE FUNCTION r_output_226(...) AS ... 3) With your upgraded R installation, do the underlying functions (ones from plr_modules) work if created and called from an R session (e.g. all needed libraries still load, etc) HTH, Joe -- Joe Conway credativ LLC: http://www.credativ.us Linux, PostgreSQL, and general Open Source Training, Service, Consulting, & 24x7 Support From mail at joeconway.com Mon Feb 13 06:49:40 2012 From: mail at joeconway.com (Joe Conway) Date: Sun, 12 Feb 2012 22:49:40 -0800 Subject: [Plr-general] in place update of plr In-Reply-To: <0A75BECB-9AB3-4F7A-801B-21598F6F415E@remoteinformation.com.au> References: <4F354CF2.4030207@joeconway.com> <0A75BECB-9AB3-4F7A-801B-21598F6F415E@remoteinformation.com.au> Message-ID: <4F38B284.1000105@joeconway.com> On 02/12/2012 10:38 PM, Ben Madin wrote: > Changing the offending line in the SQL to : > > $$ || replace(rcode, E\'\\r\', \' \') || $$ > > has fixed this. > > The cognitive problem I suspect was that these were all working fine > after the upgrade - because they all had already been entered into the > plr_modules table correctly. It was only when users started updating > query definitions and the queries were reconstructed (there is a > standard loader for each function) that the new bits were incorrectly > handled. Strange problem -- but good to know you got it figured out :-) Joe -- Joe Conway credativ LLC: http://www.credativ.us Linux, PostgreSQL, and general Open Source Training, Service, Consulting, & 24x7 Support From lists at remoteinformation.com.au Mon Feb 13 06:38:14 2012 From: lists at remoteinformation.com.au (Ben Madin) Date: Mon, 13 Feb 2012 14:38:14 +0800 Subject: [Plr-general] in place update of plr In-Reply-To: <4F354CF2.4030207@joeconway.com> References: <4F354CF2.4030207@joeconway.com> Message-ID: <0A75BECB-9AB3-4F7A-801B-21598F6F415E@remoteinformation.com.au> G'day Joe, after some more fiddling, I've discovered that if I delete the row with output.17 from plr_modules, I get something like : =# select * from reload_plr_modules(); ERROR: R interpreter parse error DETAIL: R parse error caught in "output.26 <- function (query, output="table", directory="/usr/local/www/apache22/data/tmp", copynotice=" C 2012") { dat <- dbGetQuery(db,query) if(length(dat) == 0) { It would appear that the code which creates the entries in the table was (after the upgrade to 9.1) incorrectly using escape codes, and so \r were not being removed. the reload plr modules was detecting this, not the function execution. Changing the offending line in the SQL to : $$ || replace(rcode, E\'\\r\', \' \') || $$ has fixed this. The cognitive problem I suspect was that these were all working fine after the upgrade - because they all had already been entered into the plr_modules table correctly. It was only when users started updating query definitions and the queries were reconstructed (there is a standard loader for each function) that the new bits were incorrectly handled. Thank you (as always) for your prompt reply. cheers Ben On 11/02/2012, at 12:59 AM, Joe Conway wrote: > On 02/10/2012 02:50 AM, Ben Madin wrote: >> in fact, it doesn't matter which source code is referenced in the >> function, it always tries to call output.17()! >> >> Do we need to drop extension plr, recompile it and add it again. >> >> And when we drop extension plr cascade; we are getting errors about >> missing function numbers... is there a way to force this to work >> (since cascade doesn't seem to be forcing it). >> >> or is the entire drop / reinstall going down the wrong path? > > Hmm, I don't know how the R upgrade could cause this, and I cannot > imagine how reinstalling PL/R could possibly fix it. A few > thoughts/questions: > > 1) Did you restart postgres after upgrading R? > 2) Did you try to recreate one of the functions, i.e.: > > CREATE OR REPLACE FUNCTION r_output_226(...) AS ... > > 3) With your upgraded R installation, do the underlying functions (ones > from plr_modules) work if created and called from an R session (e.g. all > needed libraries still load, etc) > > HTH, > > Joe > > -- > Joe Conway > credativ LLC: http://www.credativ.us > Linux, PostgreSQL, and general Open Source > Training, Service, Consulting, & 24x7 Support > _______________________________________________ > Plr-general mailing list > Plr-general at pgfoundry.org > http://pgfoundry.org/mailman/listinfo/plr-general From balazs.klein at gmail.com Tue Feb 21 09:32:48 2012 From: balazs.klein at gmail.com (Balazs Klein) Date: Tue, 21 Feb 2012 10:32:48 +0100 Subject: [Plr-general] save R data from plr to a specified directory Message-ID: Hi all, I would like to save R data from plr to a specified directory. Its probably something trivial I miss here but I couldn't find out how to do this. filename="somefile.R" save(var_name, file=filename) creates a file in /var/lib/postgresql/9.0/main I use the saves as a cache and I need to delete those files from time to time from the application. Messing in the main pg directory gives me the creeps. How can I change this into a subdirectory 'pg_rdata' or even better to an arbitrary other directory? For filename I tried filename='/var/lib/postgresql/9.0/main/pg_rdata/somefile.R' or filename='/pg_rdata/somefile.R' save(var_name, file=filename) but didn't have success. I have also tried using setwd('/var/lib/postgresql/9.0/main/pg_rdata') but if I do that spi_exec('someSQL') gives me an error because it won't find the main pg data directory. Thanks for the help. Balazs. From mail at joeconway.com Thu Feb 23 23:31:35 2012 From: mail at joeconway.com (Joe Conway) Date: Fri, 24 Feb 2012 07:31:35 +0800 Subject: [Plr-general] save R data from plr to a specified directory In-Reply-To: References: Message-ID: <4F46CC57.7000305@joeconway.com> On 02/21/2012 05:32 PM, Balazs Klein wrote: > I would like to save R data from plr to a specified directory. > Its probably something trivial I miss here but I couldn't find out how > to do this. > I have also tried using > > setwd('/var/lib/postgresql/9.0/main/pg_rdata') > > but if I do that > > spi_exec('someSQL') > > gives me an error because it won't find the main pg data directory. Try save the current working dir to saved-loc setwd('archive-loc') save file setwd(saved-loc) Joe -- Joe Conway credativ LLC: http://www.credativ.us Linux, PostgreSQL, and general Open Source Training, Service, Consulting, & 24x7 Support