Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkdMg-0003Jo-8b for pgsql-odbc@arkaria.postgresql.org; Wed, 14 May 2014 17:53:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WkdMf-0005bY-MI for pgsql-odbc@arkaria.postgresql.org; Wed, 14 May 2014 17:53:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkaBz-0007lx-Nr for pgsql-odbc@postgresql.org; Wed, 14 May 2014 14:29:59 +0000 Received: from mail-by2on0146.outbound.protection.outlook.com ([207.46.100.146] helo=na01-by2-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkaBt-0007q0-AA for pgsql-odbc@postgresql.org; Wed, 14 May 2014 14:29:59 +0000 Received: from BY2PR08MB282.namprd08.prod.outlook.com (10.242.237.148) by BY2PR08MB013.namprd08.prod.outlook.com (10.242.35.11) with Microsoft SMTP Server (TLS) id 15.0.944.11; Wed, 14 May 2014 14:29:49 +0000 Received: from BY2PR08MB281.namprd08.prod.outlook.com (10.242.237.145) by BY2PR08MB282.namprd08.prod.outlook.com (10.242.237.148) with Microsoft SMTP Server (TLS) id 15.0.939.12; Wed, 14 May 2014 14:29:48 +0000 Received: from BY2PR08MB281.namprd08.prod.outlook.com ([169.254.7.145]) by BY2PR08MB281.namprd08.prod.outlook.com ([169.254.7.145]) with mapi id 15.00.0939.000; Wed, 14 May 2014 14:29:48 +0000 From: Barry Bell To: Adrian Klaver , Hiroshi Saito , Michael Paquier , "Hiroshi Inoue" CC: Heikki Linnakangas , Anna Gershnik , "pgsql-odbc@postgresql.org" Subject: Re: psqlODBC text length with no records Thread-Topic: [ODBC] psqlODBC text length with no records Thread-Index: Ac9uszh7MQJ/2SP6QOaa9NAxMqce9AAWBOuAABmcwZAAAJz2AAAAaKCQAABwCgAAAA7PoAAA5BUAAAAcmYAAAM7XAAAAFtnw Date: Wed, 14 May 2014 14:29:48 +0000 Message-ID: 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> <53737AAC.9060201@aklaver.com> In-Reply-To: <53737AAC.9060201@aklaver.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [63.95.64.254] x-forefront-prvs: 0211965D06 x-forefront-antispam-report: SFV:NSPM; SFS:(10019001)(6009001)(428001)(51704005)(38414003)(479174003)(189002)(199002)(377454003)(24454002)(13464003)(50986999)(99396002)(20776003)(99286001)(101416001)(19580395003)(33646001)(76176999)(54356999)(81542001)(80022001)(74662001)(81342001)(74316001)(74502001)(2656002)(19580405001)(66066001)(21056001)(4396001)(76576001)(87936001)(92566001)(83322001)(31966008)(77982001)(46102001)(86362001)(79102001)(64706001)(76482001)(83072002)(85852003)(24736002); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR08MB282; H:BY2PR08MB281.namprd08.prod.outlook.com; FPR:; MLV:sfv; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (: hartehanks.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Barry.Bell@hartehanks.com; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hartehanks.com X-Pg-Spam-Score: -1.9 (-) 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 Behavior seems different if you get the text from table vs fixed value. The select 'ABCDE' from dual return a text(longchar, memo), The select initcap(varcharfield) from varchartable returns varchar The select initcap(varcharfield) from varchartable where 1=3D0 returns tex= t(longchar, memo), 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 -----Original Message----- From: Adrian Klaver [mailto:adrian.klaver@aklaver.com]=20 Sent: Wednesday, May 14, 2014 10:16 AM To: Barry Bell; Hiroshi Saito; Michael Paquier; Hiroshi Inoue Cc: Heikki Linnakangas; Anna Gershnik; pgsql-odbc@postgresql.org Subject: Re: [ODBC] psqlODBC text length with no records 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 d= river. 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 tex= t 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 cas= t the output of initcap to varchar: Example 1 "Try it yourself with this sql statement: SELECT initcap('ABCDEF') vv FROM dual WHERE 1=3D0 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=3D0 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 --=20 Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc