Re: pregunta sobre postgresql 8.0 para windows

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Roberto C(dot) Farías <robertofarias(at)tutopia(dot)com>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: pregunta sobre postgresql 8.0 para windows
Date: 2004-08-31 21:29:05
Message-ID: 20040831212905.GF6895@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On Wed, Aug 25, 2004 at 09:26:56PM -0300, Roberto C. Farías wrote:

> 2)Cómo defino una función que necesite devolver sólo algunos campos de
> una tabla, (no todos), y cómo se define en la cláusula RETURNS?

Puedes crear un tipo con CREATE TYPE AS (f1 int, f2 text, ...) y usar
RETURNS SETOF <nombre-del-tipo>.

O bien puedes usar RETURNS SETOF RECORD y luego al llamar la funcion con
SELECT nombre-funcion(params, ...) AS (f1 int, f2 text, ...)

Suerte,

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"In fact, the basic problem with Perl 5's subroutines is that they're not
crufty enough, so the cruft leaks out into user-defined code instead, by
the Conservation of Cruft Principle." (Larry Wall, Apocalypse 6)

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message wilhelmtg@cantv.net 2004-08-31 23:20:12 Funciona la Lista
Previous Message tgutierrez 2004-08-31 21:26:13 Re: ayuda- memoria ram-swap