From sgnerd@yahoo.com.sg Tue Apr 27 06:54:02 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 685AFD1B8C8 for ; Tue, 27 Apr 2004 03:54:02 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 40298-08 for ; Tue, 27 Apr 2004 03:54:02 -0300 (ADT) Received: from chn-dns.primus-india.net (chn-dns.primus-india.net [203.196.153.7]) by svr1.postgresql.org (Postfix) with ESMTP id D163BD1B575 for ; Tue, 27 Apr 2004 03:53:58 -0300 (ADT) Received: from ivesia67 (ptil-138-190-chn.primus-india.net [203.196.190.138] (may be forged)) by chn-dns.primus-india.net (8.12.8/8.12.8) with SMTP id i3R5nutj005533 for ; Tue, 27 Apr 2004 11:20:09 +0530 Message-ID: <00f501c42c24$7c16f2a0$7502a8c0@hdsc.com> From: "kumar" To: "pgsql" Subject: Customised Encoding Date: Tue, 27 Apr 2004 02:54:03 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00F2_01C42C02.E60B8D50" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.2 tagged_above=0.0 required=5.0 tests=HTML_50_60, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200404/292 X-Sequence-Number: 17667 This is a multi-part message in MIME format. ------=_NextPart_000_00F2_01C42C02.E60B8D50 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 chara= ctor. 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 ------=_NextPart_000_00F2_01C42C02.E60B8D50 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Dear Friends,
 
Postgres 7.3.2 Runing on Linux 7.2<= /DIV>
 
I would like to convert any values in betw= een 1 to=20 2^16 into a single charactor. And decode that single char to get back=20 the numeric value again. Any function to do that in Postgres SQL=20 Server.
 
Please shed some light.
 
Thanks
Kumar
------=_NextPart_000_00F2_01C42C02.E60B8D50-- From dev@archonet.com Tue Apr 27 12:09:57 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E4E5FD1B45E for ; Tue, 27 Apr 2004 09:09:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 56230-01 for ; Tue, 27 Apr 2004 09:09:57 -0300 (ADT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by svr1.postgresql.org (Postfix) with ESMTP id AB03AD1B897 for ; Tue, 27 Apr 2004 09:09:53 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-35.mail.demon.net with esmtp (Exim 3.35 #1) id 1BIRPQ-000NXn-0Z; Tue, 27 Apr 2004 13:09:56 +0100 Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id B1A7715977; Tue, 27 Apr 2004 13:09:55 +0100 (BST) From: Richard Huxton To: "kumar" , "pgsql" Subject: Re: Customised Encoding Date: Tue, 27 Apr 2004 13:09:55 +0100 User-Agent: KMail/1.5 References: <00f501c42c24$7c16f2a0$7502a8c0@hdsc.com> In-Reply-To: <00f501c42c24$7c16f2a0$7502a8c0@hdsc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200404271309.55818.dev@archonet.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200404/298 X-Sequence-Number: 17673 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 From dev@archonet.com Tue Apr 27 13:16:16 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3AAD4D1B897 for ; Tue, 27 Apr 2004 10:16:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 72732-10 for ; Tue, 27 Apr 2004 10:16:17 -0300 (ADT) Received: from anchor-post-37.mail.demon.net (anchor-post-36.mail.demon.net [194.217.242.86]) by svr1.postgresql.org (Postfix) with ESMTP id BFE00D1B53B for ; Tue, 27 Apr 2004 10:16:13 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-37.mail.demon.net with esmtp (Exim 3.35 #1) id 1BISRd-000KjE-0b; Tue, 27 Apr 2004 14:16:17 +0100 Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 290E01593E; Tue, 27 Apr 2004 14:16:16 +0100 (BST) From: Richard Huxton To: "kumar" Subject: Re: Customised Encoding Date: Tue, 27 Apr 2004 14:16:16 +0100 User-Agent: KMail/1.5 References: <00f501c42c24$7c16f2a0$7502a8c0@hdsc.com> <200404271309.55818.dev@archonet.com> <020c01c42c56$ec39b130$7502a8c0@hdsc.com> In-Reply-To: <020c01c42c56$ec39b130$7502a8c0@hdsc.com> Cc: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200404271416.16156.dev@archonet.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200404/301 X-Sequence-Number: 17676 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 From sgnerd@yahoo.com.sg Wed Apr 28 06:18:23 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id B07DBD1B43A for ; Wed, 28 Apr 2004 03:18:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 86867-10 for ; Wed, 28 Apr 2004 03:18:21 -0300 (ADT) Received: from chn-dns.primus-india.net (chn-dns.primus-india.net [203.196.153.7]) by svr1.postgresql.org (Postfix) with ESMTP id BE4DED1B472 for ; Wed, 28 Apr 2004 03:18:16 -0300 (ADT) Received: from ivesia67 (ptil-138-190-chn.primus-india.net [203.196.190.138] (may be forged)) by chn-dns.primus-india.net (8.12.8/8.12.8) with SMTP id i3S5EGtj007729; Wed, 28 Apr 2004 10:44:18 +0530 Message-ID: <006601c42ce8$a9cee580$7502a8c0@hdsc.com> From: "kumar" To: "Richard Huxton" Cc: References: <00f501c42c24$7c16f2a0$7502a8c0@hdsc.com> <200404271309.55818.dev@archonet.com> <020c01c42c56$ec39b130$7502a8c0@hdsc.com> <200404271416.16156.dev@archonet.com> Subject: Re: Customised Encoding Date: Wed, 28 Apr 2004 02:18:43 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200404/309 X-Sequence-Number: 17684 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" To: "kumar" Cc: 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