pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedWhy must the function that a trigger calls return "opaque" ???
3+ messages / 3 participants
[nested] [flat]
* Why must the function that a trigger calls return "opaque" ???
@ 2002-08-29 15:35 Greg Patnude <GPatnude@adelphia.net>
2002-08-29 18:05 ` Re: [SQL] Why must the function that a trigger calls return "opaque" ??? Josh Berkus <josh@agliodbs.com>
2002-09-03 14:56 ` Re: Why must the function that a trigger calls return Darren Ferguson <darren@crystalballinc.com>
0 siblings, 2 replies; 3+ messages in thread
From: Greg Patnude @ 2002-08-29 15:35 UTC (permalink / raw)
To: pgsql-general@postgresql.org; pgsql-sql
This seem rather limiting... Suppose I want a trigger that after insert,
returns the currval(sequence) of the newly inserted row automatically
without having to run another query ???
GP
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [SQL] Why must the function that a trigger calls return "opaque" ???
2002-08-29 15:35 Why must the function that a trigger calls return "opaque" ??? Greg Patnude <GPatnude@adelphia.net>
@ 2002-08-29 18:05 ` Josh Berkus <josh@agliodbs.com>
1 sibling, 0 replies; 3+ messages in thread
From: Josh Berkus @ 2002-08-29 18:05 UTC (permalink / raw)
To: Greg Patnude <GPatnude@adelphia.net>; pgsql-general@postgresql.org; pgsql-sql
Greg,
> This seem rather limiting... Suppose I want a trigger that after insert,
> returns the currval(sequence) of the newly inserted row automatically
> without having to run another query ???
Because you can't capture the return value of a trigger. The trigger is
returning the new/altered/deleted row.
If you want a function to return a value, don't use a trigger.
--
-Josh Berkus
Aglio Database Solutions
San Francisco
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Why must the function that a trigger calls return
2002-08-29 15:35 Why must the function that a trigger calls return "opaque" ??? Greg Patnude <GPatnude@adelphia.net>
@ 2002-09-03 14:56 ` Darren Ferguson <darren@crystalballinc.com>
1 sibling, 0 replies; 3+ messages in thread
From: Darren Ferguson @ 2002-09-03 14:56 UTC (permalink / raw)
To: Greg Patnude <GPatnude@adelphia.net>; +Cc: pgsql-sql
What would the trigger return the value too. You did not call the trigger
the system called the trigger. Also triggers are not meant for use in this
way they are meant for data manipulation before or after a table is
inserted,updated or deleted.
You would have to run select currval('seq_name') as the next query.
On Thu, 29 Aug 2002, Greg Patnude wrote:
> This seem rather limiting... Suppose I want a trigger that after insert,
> returns the currval(sequence) of the newly inserted row automatically
> without having to run another query ???
>
> GP
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
--
Darren Ferguson
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2002-09-03 14:56 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-08-29 15:35 Why must the function that a trigger calls return "opaque" ??? Greg Patnude <GPatnude@adelphia.net>
2002-08-29 18:05 ` Josh Berkus <josh@agliodbs.com>
2002-09-03 14:56 ` Re: Why must the function that a trigger calls return Darren Ferguson <darren@crystalballinc.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