Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id E375C9FA2F5 for ; Mon, 27 Nov 2006 08:36:16 -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 51352-03 for ; Mon, 27 Nov 2006 08:36:05 -0400 (AST) X-Greylist: delayed 01:43:23.957813 by SQLgrey-1.7.4 Received: from interscan.indicator.com (mail.indicator.be [193.121.199.3]) by postgresql.org (Postfix) with ESMTP id 76D279FA2C7 for ; Mon, 27 Nov 2006 08:36:03 -0400 (AST) Received: from DOMEXT-MTA by webaccess.indicator.bewith Novell_GroupWise; Mon, 27 Nov 2006 11:52:37 +0100 Message-Id: <456AD17A020000300000FB60@webaccess.indicator.be> X-Mailer: Novell GroupWise Internet Agent 7.0.1 Date: Mon, 27 Nov 2006 11:52:26 +0100 From: "Bart Degryse" To: Subject: UNICODE and PL/PGSQL Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=__PartFEDADC7A.0__=" X-imss-version: 2.044 X-imss-result: Passed X-imss-approveListMatch: *@indicator.be X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/253 X-Sequence-Number: 26905 --=__PartFEDADC7A.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Dear all, This works: SELECT '\x65'; =3D> it returns the letter 'e'. When I do the following in PL/PGSQL it returns the same letter 'e' (as = might be expected); =20 CREATE OR REPLACE FUNCTION "public"."myfunction" (out result varchar) = RETURNS varchar AS $body$ DECLARE charset varchar :=3D ''; BEGIN charset :=3D charset || '\x65'; result :=3D charset; RETURN; END; $body$ LANGUAGE 'plpgsql' IMMUTABLE RETURNS NULL ON NULL INPUT SECURITY INVOKER; =20 However, when I compose charset dynamically it doesn't work anymore. = Following function returns 'x65' instead of 'e'.=20 Can anyone tell me why that is and how to make it work? The target is of = course to change the values in the FOR control structure. =20 CREATE OR REPLACE FUNCTION "public"."myfunction" (out result varchar) = RETURNS varchar AS $body$ DECLARE charset varchar :=3D ''; BEGIN FOR i IN 101..101 LOOP charset :=3D charset || '\x' || to_hex(i); END LOOP; result :=3D charset; RETURN; END; $body$ LANGUAGE 'plpgsql' IMMUTABLE RETURNS NULL ON NULL INPUT SECURITY INVOKER; =20 Thanks for any help. Bart =20 --=__PartFEDADC7A.0__= Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Description: HTML
Dear all,
This works: SELECT '\x65'; =3D> it returns the letter 'e'.
When I do the following in PL/PGSQL it returns the same letter 'e' = (as might be expected);
 
CREATE OR REPLACE FUNCTION "public"."myfunction" (out result = varchar) RETURNS varchar AS
$body$
DECLARE
  charset varchar = :=3D '';
BEGIN
  charset :=3D charset || '\x65';
 &= nbsp;result :=3D charset;
  RETURN;
END;
$body$
LANGU= AGE 'plpgsql' IMMUTABLE RETURNS NULL ON NULL INPUT SECURITY INVOKER;
 
However, when I compose charset dynamically it doesn't work anymore. = Following function returns 'x65' instead of 'e'.
Can anyone tell me why that is and how to make it work? The = target is of course to change the values in the FOR control structure.
 
CREATE OR REPLACE FUNCTION "public"."myfunction" (out result = varchar) RETURNS varchar AS
$body$
DECLARE
  charset varchar = :=3D '';
BEGIN
  FOR i IN 101..101 LOOP
   = charset :=3D charset || '\x' || to_hex(i);
  END LOOP;
  result :=3D charset;
 = ; RETURN;
END;
$body$
LANGUAGE 'plpgsql' IMMUTABLE RETURNS NULL = ON NULL INPUT SECURITY INVOKER;
 
Thanks for any help.
Bart
 
--=__PartFEDADC7A.0__=--