pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: kumar <sgnerd@yahoo.com.sg>
To: pgsql <pgsql-sql@postgresql.org>
Subject: Encoding and result string length
Date: Thu, 8 Apr 2004 15:02:07 +0530
Message-ID: <025001c41d4c$5db0bbc0$7502a8c0@hdsc.com> (raw)

Dear Friends,

Postgres 7.3.2 on Linux 8

I would like to fetch the datas from a table in a encoded format. 

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;

ERROR:  Function encode(integer, "unknown") does not exist
 Unable to identify a function that satisfies the given argument types
 You may need to add explicit typecasts

So i  tried
    select encode('c1','base64') from encodeco;
    
I got a result as
    1     YzE=

But this is the encoded value for 'c1' and not for the value 10000. 

Please shed some light.

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

Thanks
Kumar

view thread (2+ messages)  latest in thread

Message-ID: <025001c41d4c$5db0bbc0$7502a8c0@hdsc.com>
Permalink:  ../025001c41d4c$5db0bbc0$7502a8c0@hdsc.com/
Also on:    postgresql.org/message-id/025001c41d4c$5db0bbc0$7502a8c0@hdsc.com

 · 

reply

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: sgnerd@yahoo.com.sg
  Subject: Re: Encoding and result string length
  In-Reply-To: <025001c41d4c$5db0bbc0$7502a8c0@hdsc.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