Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id C17012E33CB for ; Wed, 16 Jan 2008 12:20:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 39833-06 for ; Wed, 16 Jan 2008 12:20:52 -0400 (AST) Received: from brama.com (brama.com [208.67.225.160]) by postgresql.org (Postfix) with ESMTP id 0C8722E3389 for ; Wed, 16 Jan 2008 12:20:51 -0400 (AST) Received: from brama.com (localhost.localdomain [127.0.0.1]) by brama.com (8.12.11.20060308/8.12.11) with ESMTP id m0GGGgZj017581 for ; Wed, 16 Jan 2008 11:16:42 -0500 Received: from localhost (pyz@localhost) by brama.com (8.12.11.20060308/8.12.11/Submit) with ESMTP id m0GGGfI8017576 for ; Wed, 16 Jan 2008 11:16:41 -0500 Date: Wed, 16 Jan 2008 11:16:41 -0500 (EST) From: Max Pyziur To: pgsql-interfaces@postgresql.org Subject: DBD-Pg Placeholder usage in v 1.49 Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Brama-MailScanner-Information: Please contact the ISP for more information X-Brama-MailScanner: Found to be clean X-Brama-MailScanner-SpamCheck: not spam, SpamAssassin (score=2.4, required 5, BAYES_44 2.40) X-Brama-MailScanner-SpamScore: ss X-MailScanner-From: pyz@brama.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/11 X-Sequence-Number: 6689 Greetings, After having used DBD-PG-1.31 on Fedora Core 2 w/ perl 5.8.3 for a number of years, I've begun porting my work to both Fedora 8 and Ubuntu where the DBD-Pg versions are 1.49. I've run into the seemingly often-visited placeholder issue. Reviewing the README file, there is the following: ############## To change your queries, make sure that the type of each placholder can be determined by the PostgreSQL parser. So instead of: SELECT ? use something like: SELECT ?::int To turn off server-side prepares completely (with a loss of some performance and features), do this at the top of your scripts: $dbh->{pg_server_prepare} = 0; This can also be set for individual queries at the statment handle level: see the documentation for more details. ############## I would like to follow the first recommendation rather than the first one. To that end, how would the following be modified, where the first placeholder is a text type, the second a date type, the third an integer type, and the fourth a date type. FROM prices aa, oi_vol_tmp bb WHERE aa.pr_date = bb.pr_date AND symbol = ? AND aa.pr_date BETWEEN date ? - integer ? AND ? I've tried using: AND aa.pr_date BETWEEN date ?::date - integer ?::int AND ?::date with no success. I've also tried looking for the appropriate documentation and haven't found any yet. I would appreciate suggestions as to where to look. Max Pyziur pyz@brama.com