pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
(no subject)
2+ messages / 2 participants
[nested] [flat]

* (no subject)
@ 2003-03-21 18:50 Mario Alberto Soto Cordones <mario_soto@compuall.cl>
  2003-03-21 20:13 ` Re: Stephan Szabo <sszabo@megazone23.bigpanda.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Mario Alberto Soto Cordones @ 2003-03-21 18:50 UTC (permalink / raw)
  To: pgsql-sql

HI, i have a following function., but not work.



CREATE or replace FUNCTION get_nombre(numeric,numeric,text) RETURNS setof
cumaalu AS '
     SELECT cunomalu,cuappalu,cuapmalu FROM cumaalu
WHERE siempalu = $1 and
      cusesalu = $2 and
      curutalu = $3;
 ' LANGUAGE SQL;


the error say

PostgreSQL ha dicho: ERROR: function declared to return cumaalu does not
SELECT the right number of columns (49)
Your query:
CREATE FUNCTION get_nombre(numeric,numeric,text) RETURNS setof cumaalu AS '
SELECT cunomalu,cuappalu,cuapmalu FROM cumaalu
WHERE siempalu = $1 and
cusesalu = $2 and
curutalu = $3;
' LANGUAGE SQL


please any idea., i can&#7787;'t use select * becose the table its very long.

thank








^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re:
  2003-03-21 18:50 (no subject) Mario Alberto Soto Cordones <mario_soto@compuall.cl>
@ 2003-03-21 20:13 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Stephan Szabo @ 2003-03-21 20:13 UTC (permalink / raw)
  To: Mario Alberto Soto Cordones <mario_soto@compuall.cl>; +Cc: pgsql-sql


On Fri, 21 Mar 2003, Mario Alberto Soto Cordones wrote:

> CREATE or replace FUNCTION get_nombre(numeric,numeric,text) RETURNS setof
> cumaalu AS '
>      SELECT cunomalu,cuappalu,cuapmalu FROM cumaalu
> WHERE siempalu = $1 and
>       cusesalu = $2 and
>       curutalu = $3;
>  ' LANGUAGE SQL;
>
>
> the error say
>
> PostgreSQL ha dicho: ERROR: function declared to return cumaalu does not
> SELECT the right number of columns (49)
> Your query:
> CREATE FUNCTION get_nombre(numeric,numeric,text) RETURNS setof cumaalu AS '
> SELECT cunomalu,cuappalu,cuapmalu FROM cumaalu
> WHERE siempalu = $1 and
> cusesalu = $2 and
> curutalu = $3;
> ' LANGUAGE SQL
>
>
> please any idea., i can&#7787;'t use select * becose the table its very long.


If you really want to return just three of the 49 columns, make a
composite type (see CREATE TYPE AS (...) ) and return a set of that type.




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-03-21 20:13 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-03-21 18:50  Mario Alberto Soto Cordones <mario_soto@compuall.cl>
2003-03-21 20:13 ` Re: Stephan Szabo <sszabo@megazone23.bigpanda.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox