Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 7ADE79FB1F8 for ; Mon, 27 Nov 2006 11:16:59 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 90657-05 for ; Mon, 27 Nov 2006 11:16:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) by postgresql.org (Postfix) with ESMTP id 81F189FB1CE for ; Mon, 27 Nov 2006 11:16:53 -0400 (AST) Received: from kingfisher.intern.logix-tt.com (84-72-188-217.dclient.hispeed.ch [84.72.188.217]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id CA8766403E; Mon, 27 Nov 2006 16:19:41 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 1F89A18148C92; Mon, 27 Nov 2006 16:16:36 +0100 (CET) Message-ID: <456B0153.3010603@logix-tt.com> Date: Mon, 27 Nov 2006 16:16:35 +0100 From: Markus Schaber Reply-To: pgsql-sql@postgresql.org Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Thunderbird 1.5.0.7 (X11/20060927) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Cc: Bart Degryse Subject: Re: UNICODE and PL/PGSQL References: <456AD17A020000300000FB60@webaccess.indicator.be><1164638251.270 70.45.camel@localhost.localdomain> <456B0A47020000300000FC1E@webaccess.indicator.be> In-Reply-To: <456B0A47020000300000FC1E@webaccess.indicator.be> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/257 X-Sequence-Number: 26909 Hi, Bart, Bart Degryse wrote: > I suppose your statement > test=# select '\x'||'65'; > is done on some command line interface. I don't have that. I can only > use some client program. All versions of PostgreSQL I know are shipped with "psql" as command line interface. (It's a client program, actually. :-) > I'm using EMS SQL Manager 2007 and pgAdmin III 1.3 > None of them accepts your statement. I just tried with pgAdmin III 1.4.3, and it worked fine. > When I try to do the same for a range of hex values ( FOR i IN 101..101 > LOOP charset := charset || '\x' || to_hex(i); ) it is not longer a > bunch of hex values that get stored but a series of varchars. The problem is that the \x escaping is done in the parser, so in your first function, the query engine actually sees "charset := charset || 'e';" In the second function, the '\x' string is parsed as is, and converted to the String 'x' instead of being rejected as broken \x sequence, I think for compatibility reasons. Then, the engine sees: "charset := charset || 'x' || to_hex(i);" Maybe you can change it to (ASCII version): "charset := charset || chr(i);" or (256-bit version): "charset := charset || decode(to_hex(i),'hex'); HTH, Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in Europe! www.ffii.org www.nosoftwarepatents.org