From: Richard Huxton <dev@archonet.com>
To: kumar <sgnerd@yahoo.com.sg>
To: pgsql <pgsql-sql@postgresql.org>
Subject: Re: Encoding and result string length
Date: Thu, 8 Apr 2004 12:00:16 +0100
Message-ID: <200404081200.16962.dev@archonet.com> (raw)
In-Reply-To: <025001c41d4c$5db0bbc0$7502a8c0@hdsc.com>
References: <025001c41d4c$5db0bbc0$7502a8c0@hdsc.com>
On Thursday 08 April 2004 10:32, kumar wrote:
>
> create table encodeco(c1 int4, c2 int4);
> insert into encodeco values(10000, 20000);
> select * from encodeco;
>
> So I want to encode the data while selecting.
> select encode(c1,'base64') from encodeco;
> So i tried
> select encode('c1','base64') from encodeco;
Not quite:
SELECT encode(c1::text, 'base64') FROM encodeco;
or
SELECT encode(CAST(c1 AS text), 'base64') FROM encodeco;
> Also is it possible to get the encoded values with only 2 charactors,
> irrespective of the values of c1 ranging from 100 to 10 million
You could write such a coding so long as you don't mind having ten-thousand
characters in your character-set. Of course, character does not equal byte
like this, but that's true in the various unicode systems anyway.
--
Richard Huxton
Archonet Ltd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dev@archonet.com, sgnerd@yahoo.com.sg
Subject: Re: Encoding and result string length
In-Reply-To: <200404081200.16962.dev@archonet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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