X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C227DD1B55B for ; Fri, 14 Nov 2003 16:29:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 09886-10 for ; Fri, 14 Nov 2003 12:28:55 -0400 (AST) Received: from smtpzilla2.xs4all.nl (smtpzilla2.xs4all.nl [194.109.127.138]) by svr1.postgresql.org (Postfix) with ESMTP id 9477ED1B544 for ; Fri, 14 Nov 2003 12:28:47 -0400 (AST) Received: from xs1.xs4all.nl (xs1.xs4all.nl [194.109.21.2]) by smtpzilla2.xs4all.nl (8.12.9/8.12.9) with ESMTP id hAEGSe4o035428; Fri, 14 Nov 2003 17:28:45 +0100 (CET) Received: from xs1.xs4all.nl (jtv@localhost.xs4all.nl [127.0.0.1]) by xs1.xs4all.nl (8.12.10/8.12.9) with ESMTP id hAEGSexE023244; Fri, 14 Nov 2003 17:28:40 +0100 (CET) (envelope-from jtv@xs4all.nl) Received: (from jtv@localhost) by xs1.xs4all.nl (8.12.10/8.12.9/Submit) id hAEGSec7023243; Fri, 14 Nov 2003 17:28:40 +0100 (CET) (envelope-from jtv) Date: Fri, 14 Nov 2003 17:28:40 +0100 From: "Jeroen T. Vermeulen" To: Jan Klostermann Cc: pgsql-interfaces@postgresql.org Subject: Re: Parameterized queries Message-ID: <20031114162840.GC9538@xs4all.nl> Mail-Followup-To: Jan Klostermann , pgsql-interfaces@postgresql.org References: <001b01c3aac9$2a7d77c0$f564a8c0@BARCELONA> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <001b01c3aac9$2a7d77c0$f564a8c0@BARCELONA> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/25 X-Sequence-Number: 4583 On Fri, Nov 14, 2003 at 05:05:46PM +0100, Jan Klostermann wrote: > > I would like to know, if there exists a way in PostgreSQL to insert data > not exclusively via the SQL-query-string but using a direct data > interface, thus avoiding parsing the data into string and then back into > binary data representation (e.g. Double). You could use binary cursors. > What I would like to use is a query like this: INSERT INTO table > (number1, number2) VALUES (?,?) > Before executing the query the command structure would be fill with the > parameters for the 2 values (e.g. 3.33 and 5.555) and then there would > follow the execution, where the query parser would replace the "?" with > the current data of the parameters and execute the appopriate query. Wouldn't it be easier in this case to skip the SQL altogether and just use the COPY command to pump data into the table with minimal processing? You'd still go through the parsing, but that may end up saving you trouble anyway if you ever need to run the server and the client on different machines--and I wouldn't be surprised if going through SQL is costing you more than the value parsing anyway.