Re: [GENERAL] return two elements

2005-06-15 Thread Alvaro Herrera
On Fri, Jun 10, 2005 at 02:24:40PM +0200, Rodríguez Rodríguez, Pere wrote: I don't know that it happens with my email I will change the email of my subscription. The examples are very interesting for my, and Alvaro Herrera's comments too. In reference to INOUT/OUT params and return a set I

Re: [GENERAL] return two elements

2005-06-10 Thread Rodríguez Rodríguez, Pere
Title: RE: [GENERAL] return two elements I don't know that it happens with my email I will change the email of my subscription. The examples are very interesting for my, and Alvaro Herrera's comments too. In reference to INOUT/OUT params and return a set I have a doubt: I will be able

Re: [GENERAL] return two elements

2005-06-08 Thread Rodríguez Rodríguez, Pere
Title: RE: [GENERAL] return two elements For my it would be sufficient that I could return a basic type in OUT/INOUT parameters, if in addition I could return a set fantastic! -Mensaje original- De: Alvaro Herrera [mailto:[EMAIL PROTECTED]] Enviado el: martes 7 de junio de 2005

Re: [GENERAL] return two elements

2005-06-08 Thread Michael Fuhr
On Wed, Jun 08, 2005 at 01:28:56AM -0400, Tom Lane wrote: Alvaro Herrera [EMAIL PROTECTED] writes: Hmm, be aware that you can't return a set if you have OUT/INOUT parameters. ? News to me --- what are you worried about exactly? It's surely possible that our idea of what this means is

Re: [GENERAL] return two elements

2005-06-08 Thread Alvaro Herrera
I dropped [EMAIL PROTECTED] from the Cc: because that account has serious issues. On Wed, Jun 08, 2005 at 08:16:32AM -0600, Michael Fuhr wrote: On Wed, Jun 08, 2005 at 01:28:56AM -0400, Tom Lane wrote: Alvaro Herrera [EMAIL PROTECTED] writes: Hmm, be aware that you can't return a set if you

Re: [GENERAL] return two elements

2005-06-07 Thread Rodríguez Rodríguez, Pere
Title: RE: [GENERAL] return two elements In future releases is planned to incorporate IN/OUT declaration in parameters of user functions? -Mensaje original- De: Tom Lane [mailto:[EMAIL PROTECTED]] Enviado el: lunes 6 de junio de 2005 17:10 Para: Rodríguez Rodríguez, Pere CC: pgsql

Re: [GENERAL] return two elements

2005-06-07 Thread Michael Fuhr
On Tue, Jun 07, 2005 at 09:00:28AM +0200, Rodríguez Rodríguez, Pere wrote: In future releases is planned to incorporate IN/OUT declaration in parameters of user functions? Yes -- it's already in the development code.

Re: [GENERAL] return two elements

2005-06-07 Thread Rodríguez Rodríguez, Pere
Title: RE: [GENERAL] return two elements Ok, :) I suppose that IN/OUT declaration also will use with procedural language (PL/pgSQL), it's correct? -Mensaje original- De: Michael Fuhr [mailto:[EMAIL PROTECTED]] Enviado el: martes 7 de junio de 2005 09:30 Para: Rodríguez Rodríguez

Re: [GENERAL] return two elements

2005-06-07 Thread Michael Fuhr
On Tue, Jun 07, 2005 at 10:08:27AM +0200, Rodríguez Rodríguez, Pere wrote: I suppose that IN/OUT declaration also will use with procedural language (PL/pgSQL), it's correct? Yes; INOUT is also supported. The following link has examples of PL/pgSQL functions that use OUT:

Re: [GENERAL] return two elements

2005-06-07 Thread Alvaro Herrera
On Tue, Jun 07, 2005 at 07:45:03AM -0600, Michael Fuhr wrote: On Tue, Jun 07, 2005 at 10:08:27AM +0200, Rodríguez Rodríguez, Pere wrote: I suppose that IN/OUT declaration also will use with procedural language (PL/pgSQL), it's correct? Yes; INOUT is also supported. Hmm, be aware that

Re: [GENERAL] return two elements

2005-06-07 Thread Tom Lane
Alvaro Herrera [EMAIL PROTECTED] writes: Hmm, be aware that you can't return a set if you have OUT/INOUT parameters. ? News to me --- what are you worried about exactly? It's surely possible that our idea of what this means is different from Oracle's, but we ought to take a close look before

[GENERAL] return two elements

2005-06-06 Thread Rodríguez Rodríguez, Pere
Title: return two elements Hello, how can I write a function that return two or more elements? I try to return a record but after I don't know how to assign returned value to a variable. For example, CREATE OR REPLACE FUNCTION test1() RETURNS record AS ' declare rec record; begin

Re: [GENERAL] return two elements

2005-06-06 Thread Franco Bruno Borghesi
You could use your own type, since it seems you know what values you'll be storing there. You can create it like this: CREATE TYPE MyResult AS ( dt_inici DATE, dt_fi DATE ); Then you must change your functions as follows: CREATE OR REPLACE FUNCTION test1() RETURNS MyResult AS '

Re: [GENERAL] return two elements

2005-06-06 Thread Tom Lane
=?ISO-8859-1?Q?=22Rodr=EDguez_Rodr=EDguez=2C_Pere=22?= [EMAIL PROTECTED] writes: how can I write a function that return two or more elements? In existing releases the best way to do this is to create a named composite type and have the function return that, not RECORD.

Re: [GENERAL] return two elements

2005-06-06 Thread Franco Bruno Borghesi
You could use your own type, since it seems you know what values you'll be storing there. You can create it like this: CREATE TYPE MyResult AS ( dt_inici DATE, dt_fi DATE ); Then you must change your functions as follows: CREATE OR REPLACE FUNCTION test1() RETURNS MyResult AS '