OSX Postgres PL/Perl Problem with Finance::Quote/Options

From: Peter Pan <ganbaru83(at)hotmail(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: OSX Postgres PL/Perl Problem with Finance::Quote/Options
Date: 2011-03-29 15:41:16
Message-ID: BAY157-w458CB0BB7BD5EC07709440A8BD0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi(at)all,

I have a weird problem on dev server (using a Mac Mini 2010 Edt., 10.6.7 OSX).

I use two Perl modules Finance::Quote and Finance::QuoteOptions in a stored PL/Perl procedure which run without problems on a standard LINUX environment (currently in production on CentOS5). Unfortunately on OSX it seems not to be able to properly connect and retrieve the data from Yahoo.

Using the same code in a local perl file (under db user) it works without problems, but fails in the stored procedure. I don't get any compilation errors during import or execution and also no exceptions while the code is executed. As mentioned, the same function works fine under Linux.

Environment:
- OSX 10.6.7
- Postgres 9.0.2 (compiled from source / config options --with-openssl --with-perl --with-libraries=/opt/local/lib --with-includes=/opt/local/include / readline was installed via ports)
- Perl 5.12.3 (compled from source under /usr/local/ linked via enviromentable variables in .profile / config options ./configure.gnu -des -Duseshrplib --prefix=/usr/local/perl5)

I guess this is some weird behaviour under OSX (one of many) and hopefully somebody stumbled over this already in the past.

Thank you in advance!

cheers,
Alex

Here is a condensed version of the function to illustrate the problem:

CREATE FUNCTION func_test() RETURNS SETOF maxpain AS $$

use strict;
#use warnings;
use Finance::Quote;
use Finance::QuoteOptions;
use Time::localtime;

elog(INFO, "Starting Yahoo data retrieval for: C;");

# YAHOO! DATA RETRIEVAL & PREPARATION
# Variables
my @work_array; # Main work array filled with final & calculated values

my $_stock_symbol = 'C';

# Get Quote Information
my $q = Finance::Quote->new();
my %data = $q->fetch('nyse', 'C');
if (!defined %data) { elog(INFO, "Quote conn. error;");
#return_next({status=>3});
return undef;
}

# Get Quote Options (Put OI, Call OI, Strike Put/Call etc.)
my $qf=Finance::QuoteOptions->new('C');
if (!$qf->retrieve) { elog(INFO, "QuoteOptions conn. errors");
return undef;
}
$$ LANGUAGE plperlu;

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2011-03-29 15:48:53 Re: foreign data wrappers
Previous Message Hans C. Poo 2011-03-29 15:36:57 Script perl para eliminar constraints duplicados