pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedCustomised Encoding
4+ messages / 2 participants
[nested] [flat]
* Customised Encoding
@ 2004-04-27 06:54 kumar <sgnerd@yahoo.com.sg>
2004-04-27 12:09 ` Re: Customised Encoding Richard Huxton <dev@archonet.com>
0 siblings, 1 reply; 4+ messages in thread
From: kumar @ 2004-04-27 06:54 UTC (permalink / raw)
To: pgsql-sql
Dear Friends,
Postgres 7.3.2 Runing on Linux 7.2
I would like to convert any values in between 1 to 2^16 into a single charactor. And decode that single char to get back the numeric value again. Any function to do that in Postgres SQL Server.
Please shed some light.
Thanks
Kumar
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Customised Encoding
2004-04-27 06:54 Customised Encoding kumar <sgnerd@yahoo.com.sg>
@ 2004-04-27 12:09 ` Richard Huxton <dev@archonet.com>
2004-04-27 13:16 ` Re: Customised Encoding Richard Huxton <dev@archonet.com>
0 siblings, 1 reply; 4+ messages in thread
From: Richard Huxton @ 2004-04-27 12:09 UTC (permalink / raw)
To: kumar <sgnerd@yahoo.com.sg>; pgsql-sql
On Tuesday 27 April 2004 07:54, kumar wrote:
> Dear Friends,
>
> Postgres 7.3.2 Runing on Linux 7.2
>
> I would like to convert any values in between 1 to 2^16 into a single
> charactor. And decode that single char to get back the numeric value again.
> Any function to do that in Postgres SQL Server.
You could use unicode (e.g. UTF-8) encoding. I don't see what it gains you
though. What do you hope to achieve by storing numerical data as characters?
--
Richard Huxton
Archonet Ltd
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Customised Encoding
2004-04-27 06:54 Customised Encoding kumar <sgnerd@yahoo.com.sg>
2004-04-27 12:09 ` Re: Customised Encoding Richard Huxton <dev@archonet.com>
@ 2004-04-27 13:16 ` Richard Huxton <dev@archonet.com>
2004-04-28 06:18 ` Re: Customised Encoding kumar <sgnerd@yahoo.com.sg>
0 siblings, 1 reply; 4+ messages in thread
From: Richard Huxton @ 2004-04-27 13:16 UTC (permalink / raw)
To: kumar <sgnerd@yahoo.com.sg>; +Cc: pgsql-sql
On Tuesday 27 April 2004 13:55, kumar wrote:
> Hi Richar,
Kumar - try to make sure you reply to the list.
> It didnt work for me.
>
> select encode('65536'::bytea,'UTF-8')
> ERROR: Cannot cast type integer to bytea
>
> select encode('65536'::bytea,'UTF-8')
> ERROR: No such encoding as 'UTF-8'
I think you're using the encode() function wrongly. The second parameter is
supposed to be something like "base64" or "hex". I'm not sure it makes sense
to try and cast an integer to a bytea either.
Can you say what you're trying to achieve here?
--
Richard Huxton
Archonet Ltd
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Customised Encoding
2004-04-27 06:54 Customised Encoding kumar <sgnerd@yahoo.com.sg>
2004-04-27 12:09 ` Re: Customised Encoding Richard Huxton <dev@archonet.com>
2004-04-27 13:16 ` Re: Customised Encoding Richard Huxton <dev@archonet.com>
@ 2004-04-28 06:18 ` kumar <sgnerd@yahoo.com.sg>
0 siblings, 0 replies; 4+ messages in thread
From: kumar @ 2004-04-28 06:18 UTC (permalink / raw)
To: Richard Huxton <dev@archonet.com>; +Cc: pgsql-sql
The idea is I wanna store any number from 1 to 2^16 in 2 strings only - This
is the requirement.
Since in Unicode a 16 bit is represented in a Single chararctor.
So i wanna convert any number into a 32 bit and then convert each 16 bit
into one char and stored it in database.
So I wanna know how to convert any 16 bit to a single charactor.
Is there any function to do that in Postgres.
Thanks
Kumar
----- Original Message -----
From: "Richard Huxton" <dev@archonet.com>
To: "kumar" <sgnerd@yahoo.com.sg>
Cc: <pgsql-sql@postgresql.org>
Sent: Tuesday, April 27, 2004 9:16 AM
Subject: Re: [SQL] Customised Encoding
> On Tuesday 27 April 2004 13:55, kumar wrote:
> > Hi Richar,
>
> Kumar - try to make sure you reply to the list.
>
> > It didnt work for me.
> >
> > select encode('65536'::bytea,'UTF-8')
> > ERROR: Cannot cast type integer to bytea
> >
> > select encode('65536'::bytea,'UTF-8')
> > ERROR: No such encoding as 'UTF-8'
>
> I think you're using the encode() function wrongly. The second parameter
is
> supposed to be something like "base64" or "hex". I'm not sure it makes
sense
> to try and cast an integer to a bytea either.
>
> Can you say what you're trying to achieve here?
>
> --
> Richard Huxton
> Archonet Ltd
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2004-04-28 06:18 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-04-27 06:54 Customised Encoding kumar <sgnerd@yahoo.com.sg>
2004-04-27 12:09 ` Richard Huxton <dev@archonet.com>
2004-04-27 13:16 ` Richard Huxton <dev@archonet.com>
2004-04-28 06:18 ` kumar <sgnerd@yahoo.com.sg>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox