Hope Rule Is Willing To Discard Result Sets

Hope Rule Is Willing To Discard Result Sets

Post by CN LIO » Sat, 11 Jan 2003 16:59:19



Hi!

Pgsql complains the result returned by the called function being not used:

CREATE RULE MyRule AS ON INSERT TO MyTable DO SELECT MyFunction(NEW.c1)

It also suggests PERFORM if the returned value wants to be discarded.  However, there is no such syntax as:

CREATE RULE MyRule AS ON INSERT TO MyTable DO PERFORM MyFunction(NEW.c1)

I know the following combination of function and trigger achieves my goal:

CREATE FUNCTION tf() RETURNS TRIGGER AS '
BEGIN
  PERFORM MyFunction(NEW.c1);
  RETURN NEW;
END' LANGUAGE 'plpgsql'

CREATE TRIGGER MyTrigger AFTER INSERT ON MyTable FOR EACH ROW EXECUTE PROCEDURE tf();

Rule would be more concise than trigger + function in this case if it accepted unused result set.  This is only a better-to-have feature, I presume.

Regards,

CN
--
_______________________________________________
Get your free email from http://www.graffiti.net

Powered by Outblaze

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

 
 
 

1. make cursor out of second result set and discard the rest

When processing the results of some stored procedures, the
desired results may be in the second or third result set.  
I would like to be able to turn one or all of the result
sets into cursors within a stored procedure of my own
creation.  The cursor syntax seems to want a select
statement, so I can insert data from the first returned
result set into a temporary table and then turn a select
statement on the temporary table into a cursor.  This
method only allows data from the first returned result set
to be used.  

A related problem is discarding the data sets that are not
needed so the user only receives one final result.  I
believe this problem can be solved by putting all the
possible result sets into cursors that may or may not be
used, but a more elegant solution is desired.

2. Sync with backup? Help!

3. why there is cost when I am running with RULE hint or optimizer_goal=RULE

4. Typing productivity shareware

5. Discarding Results from Within a Stored Procedure

6. Retix

7. Result Sets vs copying result sets into memory.

8. NY-Midtown --> DBA Oracle Permanent Job

9. Hope beyond hope for info

10. Receiving results of a SP result set

11. [Querying A Subset of Results in a Result Set]

12. OBDB Result size <> ISQL Result Set

13. Comparing Result Set to Result Table