Re: Sending messages inside a function - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: Sending messages inside a function
Date
Msg-id 8583.1133288898@sss.pgh.pa.us
Whole thread Raw
In response to Sending messages inside a function  (Chris Campbell <chris@bignerdranch.com>)
Responses Re: Sending messages inside a function  (Chris Campbell <chris@bignerdranch.com>)
List pgsql-interfaces
Chris Campbell <chris@bignerdranch.com> writes:
> I'm trying to write a set of C functions that mimic the COPY TO and  
> COPY FROM SQL commands so I can use them to stream binary data to/ 
> from the client.

You cannot control the FE/BE protocol from inside a user function.

> This seems more efficient to me than passing BYTEAs back and forth.  

Why?  A byte is a byte.  There is no possible way that you will ever
save enough microseconds from this to repay the development time you
will waste trying to kluge the system to do it.

If it's the overhead of parsing the SELECT you are unhappy with,
you could look at using the "fast path" function call protocol
to invoke your functions.
        regards, tom lane


pgsql-interfaces by date:

Previous
From: Chris Campbell
Date:
Subject: Sending messages inside a function
Next
From: Chris Campbell
Date:
Subject: Re: Sending messages inside a function