Re: Sending messages inside a function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chris Campbell <chris(at)bignerdranch(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Sending messages inside a function
Date: 2005-11-29 18:28:18
Message-ID: 8583.1133288898@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Chris Campbell <chris(at)bignerdranch(dot)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

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Chris Campbell 2005-11-29 19:10:08 Re: Sending messages inside a function
Previous Message Chris Campbell 2005-11-29 15:44:11 Sending messages inside a function