X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3BB23537A4 for ; Fri, 8 Apr 2005 20:12:05 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15455-05 for ; Fri, 8 Apr 2005 19:12:00 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id AAF3553758 for ; Fri, 8 Apr 2005 20:11:59 +0100 (BST) 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 j38JBnLF016222; Fri, 8 Apr 2005 15:11:50 -0400 (EDT) To: Vlad Cc: Brandon Metcalf , dbdpg-general@gborg.postgresql.org, pgsql-interfaces@postgresql.org Subject: Re: [Dbdpg-general] benchmarking old Pg and DBD::Pg In-reply-to: References: Comments: In-reply-to Vlad message dated "Fri, 08 Apr 2005 14:40:04 -0400" Date: Fri, 08 Apr 2005 15:11:49 -0400 Message-ID: <16221.1112987509@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/34 X-Sequence-Number: 5450 Vlad writes: > Ideallly a programmer doesn't need to care to specify column type when > putting a code like this (assuming C is of an "int" type ): > my $sth = $dbh->prepare_cached( "select A from B where C=?"); > $sth->execute( 123 ); > ... > and DBD::Pg would guess (don't ask me how) the column types and pass > it to postgresql so the query executed in most efficient way. DBD::Pg shouldn't need to do any such thing --- the backend can do it a whole lot better than DBD::Pg could. What should be happening here is that if DBD::Pg hasn't been told a specific type for the parameter, it should pass the parameter type to the backend as "UNKNOWN" (yes, there is such a type ID) and let the backend try to infer the type. There are cases where there's not enough information to infer the type, and then the programmer has to provide it, either by writing a cast in the query text or by passing the info to bind_param. It sounds like bind_param could do with some work too ... but 80% of this issue would go away if UNKNOWN were being used correctly. regards, tom lane