Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 9EAA99FA2A7 for ; Wed, 17 Jan 2007 09:05:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 04984-01 for ; Wed, 17 Jan 2007 09:04:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id A2E4A9FB256 for ; Wed, 17 Jan 2007 09:04:32 -0400 (AST) Received: from server3.office.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 53B517454A; Wed, 17 Jan 2007 13:04:29 +0000 (GMT) Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id 0292E2742B8; Wed, 17 Jan 2007 13:04:28 +0000 (GMT) Message-ID: <45AE1EDC.7090005@archonet.com> Date: Wed, 17 Jan 2007 13:04:28 +0000 From: Richard Huxton User-Agent: IceDove 1.5.0.9 (X11/20061220) MIME-Version: 1.0 To: Andrew Sullivan Cc: pgsql-sql@postgresql.org Subject: Re: Postgresql & Oracle Heteregenous services - strange behaviour References: <20070117125857.GD19527@phlogiston.dyndns.org> In-Reply-To: <20070117125857.GD19527@phlogiston.dyndns.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/69 X-Sequence-Number: 27221 Andrew Sullivan wrote: > On Wed, Jan 17, 2007 at 01:52:25PM +0100, Marcin St?pnicki wrote: >> I see this in postgresql logs: >> >> [6210] DEBUG: query: select * from "zew_patients" >> [6210] DEBUG: query: SELECT "A1"."p_nr_pesel" FROM "zew_patients" >> "A1" WHERE ("A1"."p_patient_id" = 19300) >> >> The point is, I don't why oh why the first select is issued (some cache?), > > > > I bet it's getting the column list from the table or some such thing. > This is a lousy way to do it (the information_schema would be more > correct, although maybe no faster). That'd be my guess. And then it's not fetching any rows, expecting cursor-like behaviour. Of course we fetch all the rows before returning any results. The real solution would be to add "LIMIT 0" or "LIMIT 1" to the column-finding query, but I doubt that's possible with the Oracle plugin. Perhaps check if there's a "fetch N rows at a time" option for the ODBC setup that might help you. -- Richard Huxton Archonet Ltd