From: | Ragnar <gnari(at)hive(dot)is> |
---|---|
To: | Bart Degryse <Bart(dot)Degryse(at)indicator(dot)be> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: UNICODE and PL/PGSQL |
Date: | 2006-11-27 15:57:10 |
Message-ID: | 1164643030.27070.55.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On mán, 2006-11-27 at 15:54 +0100, Bart Degryse wrote:
> Hi gnari,
> 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. I'm using EMS SQL Manager 2007 and pgAdmin
> III 1.3
> None of them accepts your statement.
> My point is that in my first version of the function ( charset :=
> charset || '\x65'; ) a unicode hex value for the letter e is stored
> in charset.
my point was that '\x65' as a literal
is read as 'e', but '\\x' || '65' is
just the concatation of 2 2-char varchars
> 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); )
you might be able to do what you want with
set_byte() and encode().
CREATE OR REPLACE FUNCTION myfunction()
RETURNS varchar AS
$x$
DECLARE x bytea := ' ';
BEGIN
FOR i in 101..105 LOOP
x:=set_byte(x,i-101,i);
END LOOP;
RETURN encode(x,''escape'');
END;
$x$
LANGUAGE 'plpgsql';
select myfunction();
gnari
From | Date | Subject | |
---|---|---|---|
Next Message | Bart Degryse | 2006-11-27 16:05:19 | Re: UNICODE and PL/PGSQL |
Previous Message | atrentacost | 2006-11-27 15:54:27 | Auto-Response: Re: UNICODE and PL/PGSQL |