X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 87D629DCC8E for ; Tue, 29 Nov 2005 14:28:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15036-05 for ; Tue, 29 Nov 2005 14:28:22 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id D894E9DCBBF for ; Tue, 29 Nov 2005 14:28:20 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jATISI1H008584; Tue, 29 Nov 2005 13:28:18 -0500 (EST) To: Chris Campbell cc: pgsql-interfaces@postgresql.org Subject: Re: Sending messages inside a function In-reply-to: <06AA7287-656A-4E49-B1B5-68ACCC03741B@bignerdranch.com> References: <06AA7287-656A-4E49-B1B5-68ACCC03741B@bignerdranch.com> Comments: In-reply-to Chris Campbell message dated "Tue, 29 Nov 2005 10:44:11 -0500" Date: Tue, 29 Nov 2005 13:28:18 -0500 Message-ID: <8583.1133288898@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.004 required=5 tests=[AWL=0.004] X-Spam-Score: 0.004 X-Spam-Level: X-Archive-Number: 200511/70 X-Sequence-Number: 5866 Chris Campbell 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