pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #8385: greek symbols as function name
5+ messages / 3 participants
[nested] [flat]

* BUG #8385: greek symbols as function name
@ 2013-08-16 09:02 kolmyk@hotmail.com
  2013-08-18 14:51 ` Re: BUG #8385: greek symbols as function name Kevin Grittner <kgrittn@ymail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: kolmyk@hotmail.com @ 2013-08-16 09:02 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      8385
Logged by:          Alessio
Email address:      kolmyk@hotmail.com
PostgreSQL version: 9.2.3
Operating system:   Windows 8
Description:        

create or replace function α(β int, ξ int, μ float) returns float as $$
select (β + ξ) * μ $$ language sql;
select α(1, 2, 0.1);
-- it works
select ascii(proname), * from pg_proc where length(proname) = 1;
-- return code 60536 although select ascii('α') retruns 945
select * from pg_proc where proname = 'α';
-- returns nothing




-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #8385: greek symbols as function name
  2013-08-16 09:02 BUG #8385: greek symbols as function name kolmyk@hotmail.com
@ 2013-08-18 14:51 ` Kevin Grittner <kgrittn@ymail.com>
  2013-08-18 18:19   ` Re: BUG #8385: greek symbols as function name Kevin Grittner <kgrittn@ymail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Kevin Grittner @ 2013-08-18 14:51 UTC (permalink / raw)
  To: kolmyk@hotmail.com <kolmyk@hotmail.com>; pgsql-bugs

"kolmyk@hotmail.com" <kolmyk@hotmail.com> wrote:

> Operating system:  Windows 8

> create or replace function α(β int, ξ int, μ float) returns float as $$
> select (β + ξ) * μ $$ language sql;
> select α(1, 2, 0.1);
> -- it works
> select ascii(proname), * from pg_proc where length(proname) = 1;
> -- return code 60536 although select ascii('α') retruns 945
> select * from pg_proc where proname = 'α';
> -- returns nothing

Here's what I get on Ubuntu 12.10.  The bug is likely to be
Windows-specific.  Whether it is a bug in Windows or in PostgreSQL
character-handling under Windows I can say myself, since I haven't
had any reason to use Windows for years.

test=# create or replace function α(β int, ξ int, μ float) returns float as $$
select (β + ξ) * μ $$ language sql;
CREATE FUNCTION
test=# \df+
                                                                              List of functions
 Schema | Name | Result data type |              Argument data types               |  Type  | Security | Volatility |  Owner  | Language |     Source code     | Description
--------+------+------------------+------------------------------------------------+--------+----------+------------+---------+----------+---------------------+-------------
 public | α    | double precision | "β" integer, "ξ" integer, "μ" double precision | normal | invoker  | volatile   | kgrittn | sql      |                    +|
        |      |                  |                                                |        |          |            |         |          | select (β + ξ) * μ  |
(1 row)

test=# select α(1, 2, 0.1);
  α  
-----
 0.3
(1 row)

test=# select ascii(proname), proname from pg_proc where length(proname) = 1;
 ascii | proname
-------+---------
   945 | α
(1 row)

test=# select ascii('α');
 ascii
-------
   945
(1 row)

test=# select proname from pg_proc where proname = 'α';
 proname
---------
 α
(1 row)

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #8385: greek symbols as function name
  2013-08-16 09:02 BUG #8385: greek symbols as function name kolmyk@hotmail.com
  2013-08-18 14:51 ` Re: BUG #8385: greek symbols as function name Kevin Grittner <kgrittn@ymail.com>
@ 2013-08-18 18:19   ` Kevin Grittner <kgrittn@ymail.com>
  2013-08-18 18:40     ` Re: BUG #8385: greek symbols as function name Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Kevin Grittner @ 2013-08-18 18:19 UTC (permalink / raw)
  To: Kevin Grittner <kgrittn@ymail.com>; kolmyk@hotmail.com <kolmyk@hotmail.com>; pgsql-bugs

Kevin Grittner <kgrittn@ymail.com> wrote:

> Whether it is a bug in Windows or in PostgreSQL character-
> handling under Windows I can say myself, since I haven't
> had any reason to use Windows for years.

Er, that should have been I *can't* say.

>> create or replace function α(β int, ξ int, μ float) returns
float as $$
>> select (β + ξ) * μ $$ language sql;
>> select α(1, 2, 0.1);
>> -- it works
>> select ascii(proname), * from pg_proc where length(proname) = 1;
>> -- return code 60536 although select ascii('α') retruns 945
>> select * from pg_proc where proname = 'α';
>> -- returns nothing

It occurs to me that the behavior you are seeing would be
consistent with 945 being considered an uppercase letter, with
60536 being considered its lowercase form.  Normal PostgreSQL
case-folding of identifiers would then cause exactly the symptoms
you are seeing.  You could test this theory by quoting its use as
an identifier:

create or replace function "α"(β int, ξ int, μ float) returns float
as $$
  select (β + ξ) * μ $$ language sql;
select "α"(1, 2, 0.1);
select ascii(proname), * from pg_proc where length(proname) = 1;
select * from pg_proc where proname = 'α';

If that behaves correctly, you need to sort out what about your
environment is causing the odd case-folding.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #8385: greek symbols as function name
  2013-08-16 09:02 BUG #8385: greek symbols as function name kolmyk@hotmail.com
  2013-08-18 14:51 ` Re: BUG #8385: greek symbols as function name Kevin Grittner <kgrittn@ymail.com>
  2013-08-18 18:19   ` Re: BUG #8385: greek symbols as function name Kevin Grittner <kgrittn@ymail.com>
@ 2013-08-18 18:40     ` Tom Lane <tgl@sss.pgh.pa.us>
  2013-08-18 20:48       ` Re: BUG #8385: greek symbols as function name Kevin Grittner <kgrittn@ymail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Tom Lane @ 2013-08-18 18:40 UTC (permalink / raw)
  To: Kevin Grittner <kgrittn@ymail.com>; +Cc: kolmyk@hotmail.com <kolmyk@hotmail.com>; pgsql-bugs

Kevin Grittner <kgrittn@ymail.com> writes:
> It occurs to me that the behavior you are seeing would be
> consistent with 945 being considered an uppercase letter, with
> 60536 being considered its lowercase form.  Normal PostgreSQL
> case-folding of identifiers would then cause exactly the symptoms
> you are seeing.

Hmm ... identifier case-folding isn't really supposed to do anything to
multibyte characters.  I wonder if this isn't a variant of the issue
recently fixed in commit d535136b5d60b19f7ffa777b97ed301739c15a9d.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #8385: greek symbols as function name
  2013-08-16 09:02 BUG #8385: greek symbols as function name kolmyk@hotmail.com
  2013-08-18 14:51 ` Re: BUG #8385: greek symbols as function name Kevin Grittner <kgrittn@ymail.com>
  2013-08-18 18:19   ` Re: BUG #8385: greek symbols as function name Kevin Grittner <kgrittn@ymail.com>
  2013-08-18 18:40     ` Re: BUG #8385: greek symbols as function name Tom Lane <tgl@sss.pgh.pa.us>
@ 2013-08-18 20:48       ` Kevin Grittner <kgrittn@ymail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Kevin Grittner @ 2013-08-18 20:48 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: kolmyk@hotmail.com <kolmyk@hotmail.com>; pgsql-bugs

Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Kevin Grittner <kgrittn@ymail.com> writes:
>> It occurs to me that the behavior you are seeing would be
>> consistent with 945 being considered an uppercase letter, with
>> 60536 being considered its lowercase form.  Normal PostgreSQL
>> case-folding of identifiers would then cause exactly the symptoms
>> you are seeing.
>
> Hmm ... identifier case-folding isn't really supposed to do anything to
> multibyte characters.  I wonder if this isn't a variant of the issue
> recently fixed in commit d535136b5d60b19f7ffa777b97ed301739c15a9d.

Maybe.  I notice that if you interpret the first byte as a Unicode
code point (as opposed to the first byte of a UTF-8 encoded
character), it is an uppercase letter.  But I can't quite see how
that gets to the decimal 60536 value.  Also, going to a commit
prior to the referenced fix I still don't see any problem on my
machine.  That doesn't rule out a platform-specific manifestation
of the issue, though.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2013-08-18 20:48 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-08-16 09:02 BUG #8385: greek symbols as function name kolmyk@hotmail.com
2013-08-18 14:51 ` Kevin Grittner <kgrittn@ymail.com>
2013-08-18 18:19   ` Kevin Grittner <kgrittn@ymail.com>
2013-08-18 18:40     ` Tom Lane <tgl@sss.pgh.pa.us>
2013-08-18 20:48       ` Kevin Grittner <kgrittn@ymail.com>

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