From: | Kevin Grittner <kgrittn(at)ymail(dot)com> |
---|---|
To: | rohtodeveloper <rohtodeveloper(at)outlook(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: How to use the 'char() ' as data type and a function name in the same time. |
Date: | 2014-06-23 15:06:54 |
Message-ID: | 1403536014.12781.YahooMailNeo@web122301.mail.ne1.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
rohtodeveloper <rohtodeveloper(at)outlook(dot)com> wrote:
> When I use the pg_catalog.char(integer) function in the
> postgres, I can only use it like these:
> select pg_catalog.char(65); select "char"(65);
>
> But I want to use the function by the following way.
> select char(1);
Try using the chr() function.
What you are running into is a result of the fact that besides the
char datatype, PostgreSQL has a "char" datatype, with a completely
different implementation. While that may not have been the best
decision, there is enough working code that depends on both of
these types that it is unlikely to change.
http://www.postgresql.org/docs/current/interactive/datatype-character.html
Be careful, though; I would not generally recommend the use of
either char or "char" in application tables or code. The char type
is only included for standard compliance, and has surprising
semantics and generally poorer performance than the alternatives.
The "char" type is only intended for use in the system catalogs; if
you are considering using it elsewhere, you should consider an enum
instead.
--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2014-06-23 15:06:59 | Re: JSON and Postgres Variable Queries |
Previous Message | Robert Haas | 2014-06-23 15:03:56 | Re: replication commands and log_statements |