Postgres has an 'ascii' function that converts
characters to ascii, values, but it appears to be a
one way street. I can't find a way to convert ascii
values to characters, like 'chr' in Oracle. Anyone
know how to do this? 

-Alex

__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/

Sat, 16 Sep 2000 19:11:17 -0700 (PDT)
Alex Sokoloff <alex_sokoloff@yahoo.com>
ascii to character conversion in postgres

On Sat, 16 Sep 2000, Alex Sokoloff wrote:

> Postgres has an 'ascii' function that converts
> characters to ascii, values, but it appears to be a
> one way street. I can't find a way to convert ascii
> values to characters, like 'chr' in Oracle. Anyone
> know how to do this? 

 Interesting for me, I try explore (or write) it next week :-)

 By the way, the Oracle has more interesting fuction that can 
season DB's users life and I mean that for porting from rich
Oracle to great PostgreSQL we need it....

				Karel 


Sun, 17 Sep 2000 14:27:38 +0200 (CEST)
Karel Zak <zakkr@zf.jcu.cz>
Re: ascii to character conversion in postgres
>> Postgres has an 'ascii' function that converts
>> characters to ascii, values, but it appears to be a
>> one way street. I can't find a way to convert ascii
>> values to characters, like 'chr' in Oracle. Anyone
>> know how to do this? 

ichar().  Since that's part of the "oracle_compatibility" file,
I'd assumed the function name spelling was the same as Oracle's.
Not so?

			regards, tom lane

Sun, 17 Sep 2000 14:18:54 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: ascii to character conversion in postgres 

On Sun, 17 Sep 2000, Tom Lane wrote:

> >> Postgres has an 'ascii' function that converts
> >> characters to ascii, values, but it appears to be a
> >> one way street. I can't find a way to convert ascii
> >> values to characters, like 'chr' in Oracle. Anyone
> >> know how to do this? 
> 
> ichar().  Since that's part of the "oracle_compatibility" file,
> I'd assumed the function name spelling was the same as Oracle's.
> Not so?

 Not documented (from oracle_compat.c) in PG documentation:

	btrim()
	ascii()
	ichar()
	repeat()

 and about ichar() is nothing in Oracle documentation, it's knows chr() 
only...

Directly rename it, or add "alias" entry to the pg_proc? 

Or ignore? :-)

				Karel


Mon, 18 Sep 2000 08:18:16 +0200 (CEST)
Karel Zak <zakkr@zf.jcu.cz>
Re: ascii to character conversion in postgres 
Karel Zak <zakkr@zf.jcu.cz> writes:
>  Not documented (from oracle_compat.c) in PG documentation:
> 	btrim()
> 	ascii()
> 	ichar()
> 	repeat()
>  and about ichar() is nothing in Oracle documentation, it's knows chr() 
> only...

Sounds to me like calling it ichar() was an error, then.  Should be chr().

> Directly rename it, or add "alias" entry to the pg_proc? 

The alias would only be useful to people who had been using it as
"ichar()" --- which is not many people, since it's undocumented ;-)
Furthermore, now that I look, it looks like ichar() was new in
contrib/odbc in 7.0 and has only recently been moved into the main
code.

I vote for just renaming it to chr().  Any objections?

			regards, tom lane

Mon, 18 Sep 2000 11:21:47 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: ascii to character conversion in postgres 
On Mon, 18 Sep 2000, Tom Lane wrote:

> Karel Zak <zakkr@zf.jcu.cz> writes:
> >  Not documented (from oracle_compat.c) in PG documentation:
> > 	btrim()
> > 	ascii()
> > 	ichar()
> > 	repeat()
> >  and about ichar() is nothing in Oracle documentation, it's knows chr() 
> > only...
> 
> Sounds to me like calling it ichar() was an error, then.  Should be chr().
> 
> > Directly rename it, or add "alias" entry to the pg_proc? 
> 
> The alias would only be useful to people who had been using it as
> "ichar()" --- which is not many people, since it's undocumented ;-)
> Furthermore, now that I look, it looks like ichar() was new in
> contrib/odbc in 7.0 and has only recently been moved into the main
> code.
> 
> I vote for just renaming it to chr().  Any objections?

first thing off the top of my head ... was there a reason why it was added
to contrib/odbc?  ignoring the "oracle documentation", is it something
that is/was needed for ODBC?

Marc G. Fournier                   ICQ#7615664               IRC Nick: Scrappy
Systems Administrator @ hub.org 
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org 


Mon, 18 Sep 2000 12:41:06 -0300 (ADT)
The Hermit Hacker <scrappy@hub.org>
Re: ascii to character conversion in postgres 
The Hermit Hacker <scrappy@hub.org> writes:
>> I vote for just renaming it to chr().  Any objections?

> first thing off the top of my head ... was there a reason why it was added
> to contrib/odbc?  ignoring the "oracle documentation", is it something
> that is/was needed for ODBC?

Now that I look, it seems ODBC specifies the function as "char()",
which means contrib/odbc is wrong on that score too :-(

New proposal: forget ichar(), give the function two entries chr() and
char().

			regards, tom lane

Mon, 18 Sep 2000 12:20:35 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: ascii to character conversion in postgres 
On Mon, 18 Sep 2000, Tom Lane wrote:

> The Hermit Hacker <scrappy@hub.org> writes:
> >> I vote for just renaming it to chr().  Any objections?
> 
> > first thing off the top of my head ... was there a reason why it was added
> > to contrib/odbc?  ignoring the "oracle documentation", is it something
> > that is/was needed for ODBC?
> 
> Now that I look, it seems ODBC specifies the function as "char()",
> which means contrib/odbc is wrong on that score too :-(
> 
> New proposal: forget ichar(), give the function two entries chr() and
> char().

sounds good to me ... chr() == char(), I take it?  is there a reason for
having both vs just changing char() to chr() in the odbc stuff?



Mon, 18 Sep 2000 13:36:32 -0300 (ADT)
The Hermit Hacker <scrappy@hub.org>
Re: ascii to character conversion in postgres 
The Hermit Hacker <scrappy@hub.org> writes:
> sounds good to me ... chr() == char(), I take it?  is there a reason for
> having both vs just changing char() to chr() in the odbc stuff?

We don't control the ODBC specification ...

			regards, tom lane

Mon, 18 Sep 2000 13:38:42 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: ascii to character conversion in postgres 
On Mon, 18 Sep 2000, Tom Lane wrote:

> The Hermit Hacker <scrappy@hub.org> writes:
> > sounds good to me ... chr() == char(), I take it?  is there a reason for
> > having both vs just changing char() to chr() in the odbc stuff?
> 
> We don't control the ODBC specification ...

okay, granted, but, other then ODBC, do we need the char() type?  could it
not be an internal translation in the ODBC driver itself?



Mon, 18 Sep 2000 14:48:24 -0300 (ADT)
The Hermit Hacker <scrappy@hub.org>
Re: ascii to character conversion in postgres 
Tom Lane writes:

> ichar().  Since that's part of the "oracle_compatibility" file,
> I'd assumed the function name spelling was the same as Oracle's.
> Not so?

ichar() is for ODBC compliance. chr() could probably be an alias to it.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


Mon, 18 Sep 2000 21:57:03 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: ascii to character conversion in postgres
I wrote:

> ichar() is for ODBC compliance. chr() could probably be an alias to it.

Ignore that. Probably "char()" had some parsing or overloading problems.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


Mon, 18 Sep 2000 22:05:24 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: ascii to character conversion in postgres

> New proposal: forget ichar(), give the function two entries chr() and
> char().

 OK, I will send patch for this and send domumentation for all 
oracle_compat.c routines...

 I don't want make some changes to contrib/odbc, because it's out of
me... but I have a question, Why in the contrib/odbc/odbc.c are total
same function as in oracle_compat.c (like ascii(), ichar(), repeat())?  

Is it anything specific for ODBC?

					Karel 



Tue, 19 Sep 2000 09:29:31 +0200 (CEST)
Karel Zak <zakkr@zf.jcu.cz>
odbc (was: Re: ascii to character conversion in postgres)
Karel Zak <zakkr@zf.jcu.cz> writes:
>  I don't want make some changes to contrib/odbc, because it's out of
> me... but I have a question, Why in the contrib/odbc/odbc.c are total
> same function as in oracle_compat.c (like ascii(), ichar(), repeat())?  

contrib/odbc was a quick hack just before 7.0 release; we had already
frozen the system catalogs for 7.0, and didn't want to force another
initdb for beta testers.  It's not supposed to survive into 7.1 --- most
or all of what's in there should be, or perhaps already has been, merged
into the main code.

Thomas did the work on that originally, and might remember more about
whether any of the ODBC compatibility functions ought *not* go into
the main tree.

			regards, tom lane

Tue, 19 Sep 2000 11:26:52 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: odbc (was: Re: ascii to character conversion in postgres) 
Karel Zak writes:

>  I don't want make some changes to contrib/odbc, because it's out of
> me... but I have a question, Why in the contrib/odbc/odbc.c are total
> same function as in oracle_compat.c (like ascii(), ichar(), repeat())?  

The odbc.c file is for installing the set of ODBC compatibility functions
into a pre-7.0 server.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


Tue, 19 Sep 2000 20:37:04 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: odbc (was: Re: ascii to character conversion in postgres)