[SQL] Calling Functions in RULEs

From: rahul143 <rk204885(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: [SQL] Calling Functions in RULEs
Date: 2012-12-03 05:20:40
Message-ID: 1354512040555-5734657.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

-----

--
View this message in context: http://postgresql.1045698.n5.nabble.com/SQL-Calling-Functions-in-RULEs-tp5734657.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Browse pgsql-general by date

  From Date Subject
Next Message Dhiraj Gupta 2012-12-03 05:35:31 Database schema
Previous Message rahul143 2012-12-03 05:18:57 Exception Handling in C-Language Functions?