Thread: Returning back a resultset from a stored function

Returning back a resultset from a stored function

From
Daniel Daoust
Date:
Hi,

I am looking at ways to return a resultset from a
stored function through ODBC.
My background is in Oracle and I have to implement a
new VB6 system using PostgreSQL.

I have found that "psqlodbc" does not support the
refcursor type.
I also investigated the following form: " select *
from somefunc(); ", but realized that this worked only
inside "PL/pgSQL", therefore could not be used
directly from SQL.

First: Are my assumptions correct?
Second: Does anyone know a way to accomplish what I am
trying to do?

I would appreciate any thoughts on the subject.

Thank you,
Daniel


______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca

Re: Returning back a resultset from a stored function

From
Peter Eisentraut
Date:
Daniel Daoust wrote:
> I have found that "psqlodbc" does not support the
> refcursor type.
> I also investigated the following form: " select *
> from somefunc(); ", but realized that this worked only
> inside "PL/pgSQL", therefore could not be used
> directly from SQL.

"select * from somefunc();" is certainly SQL, so what is the problem?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: Returning back a resultset from a stored function

From
Daniel Daoust
Date:
>
> "select * from somefunc();" is certainly SQL, so
> what is the problem?
>

Then, could you help me understand why I am getting
the following message 'ERROR:  parser: parse error at
or near "(" ' when I run the select from 'psql'.

Thanks,
Daniel

______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca

Re: Returning back a resultset from a stored function

From
Joe Conway
Date:
Daniel Daoust wrote:
>>"select * from somefunc();" is certainly SQL, so
>>what is the problem?
>
> Then, could you help me understand why I am getting
> the following message 'ERROR:  parser: parse error at
> or near "(" ' when I run the select from 'psql'.

What version of Postgres? If it is prior to 7.3, table functions are not
supported.

Joe

Re: Returning back a resultset from a stored function

From
Daniel Daoust
Date:
Sorry, I should have included that information in the
beginning. We are using 7.2.1, however we will update
to 7.4 in the coming days.

What about postgreSQL 8.0, should we consider it or
wait until it is stable. We will be in development
mode for some time and won't be using any of the new
features for a little while.

Thanks again,
Daniel

______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca

Re: Returning back a resultset from a stored function

From
Peter Eisentraut
Date:
Daniel Daoust wrote:
> What about postgreSQL 8.0, should we consider it or
> wait until it is stable. We will be in development
> mode for some time and won't be using any of the new
> features for a little while.

It's probably a bit too early to think about 8.0.  I wouldn't expect a
release until November.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: Returning back a resultset from a stored function

From
Tom Lane
Date:
Peter Eisentraut <peter_e@gmx.net> writes:
> Daniel Daoust wrote:
>> What about postgreSQL 8.0, should we consider it or
>> wait until it is stable. We will be in development
>> mode for some time and won't be using any of the new
>> features for a little while.

> It's probably a bit too early to think about 8.0.  I wouldn't expect a
> release until November.

However, if they plan to be in development mode through, say, the end of
the year, then 8.0 would be a good option.  I think it is plenty stable
enough for development work.

            regards, tom lane