pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Calling Functions in RULEs
2+ messages / 2 participants
[nested] [flat]

* Calling Functions in RULEs
@ 2005-05-22 09:24 Jan B. <jan@monso.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Jan B. @ 2005-05-22 09:24 UTC (permalink / raw)
  To: pgsql-sql

Hello,

I would like to call multiple PL/pgSQL procedures (i.e. functions 
returning void) from INSERT, UPDATE and DELETE RULEs.

Using "SELECT some_procedure();" is a possible way to do that, but it 
causes a dummy result table to be delivered to the application invoking 
the INSERT/UPDATE/DELETE. When using multiple SELECTs to call multiple 
functions inside the RULE, multiple result tables will be delivered to 
the application, which is very unhandy and causes trouble especially 
when using asynchronous command processing. Though "psql" does only show 
the last result table, all dummy result tables have to be fetched by 
PGgetResult(), when using asynchronous mode with libpq.

Is there any tidy way to call a void-function inside a RULE without 
creating a result table that is passed to the application?
Using a command like "UPDATE dummy_table SET dummy=1 WHERE 
some_procedure() NOTNULL;" would work, but that would be very dirty.

Does a command like "PERFORM" (from PG/pgSQL) exist in SQL too, which 
discards the (void) result of the function call?


Thanks for helping

Jan Behrens
||



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

* Re: Calling Functions in RULEs
@ 2005-05-23 10:01 KÖPFERL Robert <robert.koepferl@sonorys.at>
  0 siblings, 0 replies; 2+ messages in thread

From: KÖPFERL Robert @ 2005-05-23 10:01 UTC (permalink / raw)
  To: pgsql-sql

Hi,

I had no try wheter this solves your problem, but have you conciddered using
an array or a self-written fcn which dicards your results
i.E.  SELECT my_discard_but_last( q1(), q2(), q3());
or   SELECT ARRAY[ q1(), q2(), q3() ];
or  SELECT ROW(q1(), q2(), q3()) as my_tripel_type;

Have you considdered CASTs?

These are just ideas

|-----Original Message-----
|From: Jan B. [mailto:jan@monso.de]
|Sent: Sonntag, 22. Mai 2005 11:24
|To: pgsql-sql@postgresql.org
|Subject: [SQL] Calling Functions in RULEs
|
|
|Hello,
|
|I would like to call multiple PL/pgSQL procedures (i.e. functions 
|returning void) from INSERT, UPDATE and DELETE RULEs.
|
|Using "SELECT some_procedure();" is a possible way to do that, but it 
|causes a dummy result table to be delivered to the application 
|invoking 
|the INSERT/UPDATE/DELETE. When using multiple SELECTs to call multiple 
|functions inside the RULE, multiple result tables will be delivered to 
|the application, which is very unhandy and causes trouble especially 
|when using asynchronous command processing. Though "psql" does 
|only show 
|the last result table, all dummy result tables have to be fetched by 
|PGgetResult(), when using asynchronous mode with libpq.
|
|Is there any tidy way to call a void-function inside a RULE without 
|creating a result table that is passed to the application?
|Using a command like "UPDATE dummy_table SET dummy=1 WHERE 
|some_procedure() NOTNULL;" would work, but that would be very dirty.
|
|Does a command like "PERFORM" (from PG/pgSQL) exist in SQL too, which 
|discards the (void) result of the function call?
|
|
|Thanks for helping
|
|Jan Behrens
|||
|
|---------------------------(end of 
|broadcast)---------------------------
|TIP 2: you can get off all lists at once with the unregister command
|    (send "unregister YourEmailAddressHere" to 
|majordomo@postgresql.org)
|



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


end of thread, other threads:[~2005-05-23 10:01 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-05-22 09:24 Calling Functions in RULEs Jan B. <jan@monso.de>
2005-05-23 10:01 Re: Calling Functions in RULEs KÖPFERL Robert <robert.koepferl@sonorys.at>

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