Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-interfaces by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group