pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Calling void functions
5+ messages / 5 participants
[nested] [flat]

* Calling void functions
@ 2007-04-02 08:02 Peter Eisentraut <peter_e@gmx.net>
  2007-04-02 12:52 ` Re: Calling void functions Daniel Caune <daniel.caune@ubisoft.com>
  2007-04-02 16:44 ` Re: Calling void functions Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 5+ messages in thread

From: Peter Eisentraut @ 2007-04-02 08:02 UTC (permalink / raw)
  To: pgsql-sql

I'm informed that the last statement of a function that returns void cannot be 
a SELECT.  How else is one supposed to call another function which also 
returns void?

E.g.,

CREATE FUNCTION foo (a int, b int) RETURNS void
	LANGUAGE plpgsql
	AS $$ do important things $$;

CREATE FUNCTION foo (a int) RETURNS void
	LANGUAGE sql
	AS $$ SELECT foo($1, default-value); $$;

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



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

* Re: Calling void functions
  2007-04-02 08:02 Calling void functions Peter Eisentraut <peter_e@gmx.net>
@ 2007-04-02 12:52 ` Daniel Caune <daniel.caune@ubisoft.com>
  2007-04-02 13:31   ` Re: Calling void functions A. Kretschmer <andreas.kretschmer@schollglas.com>
  1 sibling, 1 reply; 5+ messages in thread

From: Daniel Caune @ 2007-04-02 12:52 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; pgsql-sql

> I'm informed that the last statement of a function that returns void
> cannot be
> a SELECT.  How else is one supposed to call another function which
also
> returns void?
> 

PERFORM 



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

* Re: Calling void functions
  2007-04-02 08:02 Calling void functions Peter Eisentraut <peter_e@gmx.net>
  2007-04-02 12:52 ` Re: Calling void functions Daniel Caune <daniel.caune@ubisoft.com>
@ 2007-04-02 13:31   ` A. Kretschmer <andreas.kretschmer@schollglas.com>
  2007-04-02 23:08     ` Re: Calling void functions Daniel CAUNE <d.caune@free.fr>
  0 siblings, 1 reply; 5+ messages in thread

From: A. Kretschmer @ 2007-04-02 13:31 UTC (permalink / raw)
  To: pgsql-sql

am  Mon, dem 02.04.2007, um  8:52:09 -0400 mailte Daniel Caune folgendes:
> > I'm informed that the last statement of a function that returns void
> > cannot be
> > a SELECT.  How else is one supposed to call another function which
> also
> > returns void?
> > 
> 
> PERFORM 

PERFORM works only in plpgsql, Peter wrote a pl/sql-function...


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net



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

* Re: Calling void functions
  2007-04-02 08:02 Calling void functions Peter Eisentraut <peter_e@gmx.net>
  2007-04-02 12:52 ` Re: Calling void functions Daniel Caune <daniel.caune@ubisoft.com>
  2007-04-02 13:31   ` Re: Calling void functions A. Kretschmer <andreas.kretschmer@schollglas.com>
@ 2007-04-02 23:08     ` Daniel CAUNE <d.caune@free.fr>
  0 siblings, 0 replies; 5+ messages in thread

From: Daniel CAUNE @ 2007-04-02 23:08 UTC (permalink / raw)
  To: 'A. Kretschmer' <andreas.kretschmer@schollglas.com>; pgsql-sql

> PERFORM works only in plpgsql, Peter wrote a pl/sql-function...
> 

Oups, sorry!  I missed the point.




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

* Re: Calling void functions
  2007-04-02 08:02 Calling void functions Peter Eisentraut <peter_e@gmx.net>
@ 2007-04-02 16:44 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 5+ messages in thread

From: Tom Lane @ 2007-04-02 16:44 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-sql

Peter Eisentraut <peter_e@gmx.net> writes:
> I'm informed that the last statement of a function that returns void cannot be 
> a SELECT.  How else is one supposed to call another function which also 
> returns void?

Hmm, seems like the best answer is to rejigger the order of the tests in
check_sql_fn_retval.  I think that logic was designed before we had an
idea of VOID-returning functions.

			regards, tom lane



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


end of thread, other threads:[~2007-04-02 23:08 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-04-02 08:02 Calling void functions Peter Eisentraut <peter_e@gmx.net>
2007-04-02 12:52 ` Daniel Caune <daniel.caune@ubisoft.com>
2007-04-02 13:31   ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2007-04-02 23:08     ` Daniel CAUNE <d.caune@free.fr>
2007-04-02 16:44 ` Tom Lane <tgl@sss.pgh.pa.us>

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