X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D6BB7DA810 for ; Mon, 21 Nov 2005 21:41:26 -0400 (AST) 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 41146-04 for ; Tue, 22 Nov 2005 01:41:29 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sapo.pt (relay3.ptmail.sapo.pt [212.55.154.23]) by svr1.postgresql.org (Postfix) with SMTP id C560BDA80C for ; Mon, 21 Nov 2005 21:41:23 -0400 (AST) Received: (qmail 18834 invoked by uid 0); 22 Nov 2005 01:41:26 -0000 Received: from unknown (HELO sapo.pt) (10.134.35.151) by relay3 with SMTP; 22 Nov 2005 01:41:26 -0000 Received: (qmail 14838 invoked from network); 22 Nov 2005 01:41:23 -0000 X-AntiVirus: PTMail-AV 0.3.87.1 X-Virus-Status: Clean (0.00428 seconds) Received: from unknown (HELO hmv02) (hmv@[82.155.146.16]) (envelope-sender ) by mta1 (qmail-ldap-1.03) with SMTP for ; 22 Nov 2005 01:41:23 -0000 Message-ID: <002a01c5ef05$da3bbc30$6200a8c0@hmv02> From: =?Windows-1252?Q?H=E9lder_M._Vieira?= To: References: <000901c5ee99$c275e380$580bfea9@hmv02> <1719.1132585425@sss.pgh.pa.us> Subject: Re: max() unexpected type conversion Date: Tue, 22 Nov 2005 01:40:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2670 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.591 required=5 tests=[AWL=-0.329, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.591 X-Spam-Level: * X-Archive-Number: 200511/186 X-Sequence-Number: 23437 > This is true of just about everything, not only max() -- there are *no* > functions yielding varchar in recent PG releases Thanks for the information. I added an explicit cast to the max() output and it works fine. Anyway, for those using VB, this is potentially hazardous. Knowing that the underlying data is of type 'varchar', one has to be always very cautious about the 'text' conversion, otherwise all readings after the first will return null instead of valid data. Helder M. Vieira