Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkZym-0002zs-TC for pgsql-odbc@arkaria.postgresql.org; Wed, 14 May 2014 14:16:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WkZym-0006rX-9A for pgsql-odbc@arkaria.postgresql.org; Wed, 14 May 2014 14:16:20 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkZyl-0006rO-G7 for pgsql-odbc@postgresql.org; Wed, 14 May 2014 14:16:19 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkZyi-0000DF-74 for pgsql-odbc@postgresql.org; Wed, 14 May 2014 14:16:18 +0000 Received: from compute6.internal (compute6.nyi.mail.srv.osa [10.202.2.46]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 9924020BDF for ; Wed, 14 May 2014 10:16:14 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Wed, 14 May 2014 10:16:14 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h= message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; s=mesmtp; bh=WUJDMOhXjjjgkIi5i4R4l4f+ClQ=; b=m67+8cSTvyxClBKKDE3SXmrXmCLD 0mDM4DluPwBd0MoPgdA5f4ihwcaepN1lb3vpJe1d2E93O8lb1wTgIH7lSQtY4QTp IdqVXovZwlR3dVrxJTw3gbVUvHEYGP1inE/5CKMzAgFoBxMBG18mhkbXY5P13qnr AeDUqrkJksCQNBI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; s=smtpout; bh=WUJDMOhXjjjgkIi5i4R4l4 f+ClQ=; b=Ry6oY2SDunp0hHomzfVjW/eqXoHQaaV3Kbge/36eYsmxGHkmAvzED6 fy78ycZ32mfAxai6NkxCPuQ+fdFzUg4D8+jYxG28OZxPa4jHXv13BXeD1PL5bbkH FHvVuctbox/bADpvSdKPMUnxZECAxHvj7lN2SfPKrFFZUiCDH9o3I= X-Sasl-enc: xeY29lR3IFiSaDYHNAI6bdKKzxueH0yxbfeFDePxriZ1 1400076974 Received: from panda.site (unknown [65.102.186.57]) by mail.messagingengine.com (Postfix) with ESMTPA id 932C3C00005; Wed, 14 May 2014 10:16:13 -0400 (EDT) Message-ID: <53737AAC.9060201@aklaver.com> Date: Wed, 14 May 2014 07:16:12 -0700 From: Adrian Klaver User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Barry Bell , Hiroshi Saito , Michael Paquier , Hiroshi Inoue CC: Heikki Linnakangas , Anna Gershnik , "pgsql-odbc@postgresql.org" Subject: Re: psqlODBC text length with no records References: <152de38c9c2544b9b61f9a2f77e9aa3d@BY2PR08MB281.namprd08.prod.outlook.com> <5372B875.3010407@aklaver.com> <3fca930240554b80bc4174911fb49400@BY2PR08MB281.namprd08.prod.outlook.com> <53736874.2090905@aklaver.com> <53736E22.4090506@aklaver.com> <53737480.6070808@aklaver.com> <14cee66c2d5d444a8ec0c4c773f20d5b@BY2PR08MB281.namprd08.prod.outlook.com> In-Reply-To: <14cee66c2d5d444a8ec0c4c773f20d5b@BY2PR08MB281.namprd08.prod.outlook.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org On 05/14/2014 06:56 AM, Barry Bell wrote: > My issue is with the output of the ODBC driver. The ODBC driver does not exist in isolation, it depends on information from the input end and outputs depending on configuration and the end point. > The data type of the output of the ODBC driver changes if you do not have records. That is the core issue and the one I am trying to narrow down the cause. > > You answers are the data type out of postgres directly without the ODBC driver. Yet it already revealed information. When you ran initcap() without a cast the ODBC driver did what it was supposed to and took a returned type of text and turned it into a memo. Knowing what Postgres returned for initcap led to the cast to varchar which solved that particular problem. I understand that may not be workable for the entire code, but at least it shed light on what is going on. > > You need the run the sql through the ODBC driver (which you said you are not). > > Can someone else try the test sql through the ODBC driver? > SELECT initcap(vcharfield) vv FROM table (returns varchar) Actually, from your previous examples it does not unless you explicitly cast the output of initcap to varchar: Example 1 "Try it yourself with this sql statement: SELECT initcap('ABCDEF') vv FROM dual WHERE 1=0 Will return the a sqlongvarchar(Memo,CLOB)" Example 2 "SELECT initcap('ABCDEF')::varchar vv FROM dual Works, returns varchar" > vs > SELECT initcap(vcharfield) vv FROM table WHERE 1=0 > Returns text > > Barry Bell > Senior Developer/Analyst > Logistics > Harte Hanks > 1525 NW 3rd ST > Deerfield Beach FL, 33442 > 954-429-3771 Ext 267 office > 954-281-1464 fax > > hartehanks.com / linkedin / twitter / facebook > -- Adrian Klaver adrian.klaver@aklaver.com -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc