pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Chris Campbell <chris@bignerdranch.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: Sending messages inside a function
Date: Tue, 29 Nov 2005 13:28:18 -0500
Message-ID: <8583.1133288898@sss.pgh.pa.us> (raw)
In-Reply-To: <06AA7287-656A-4E49-B1B5-68ACCC03741B@bignerdranch.com>
References: <06AA7287-656A-4E49-B1B5-68ACCC03741B@bignerdranch.com>

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



view thread (3+ messages)  latest in thread

Message-ID: <8583.1133288898@sss.pgh.pa.us>
Permalink:  ../8583.1133288898@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8583.1133288898@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, chris@bignerdranch.com
  Subject: Re: Sending messages inside a function
  In-Reply-To: <8583.1133288898@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox