Re: [BUGS] BUG #8385: greek symbols as function name

2013-08-18 Thread Kevin Grittner
kol...@hotmail.com kol...@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


Re: [BUGS] BUG #8385: greek symbols as function name

2013-08-18 Thread Kevin Grittner
Kevin Grittner kgri...@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


Re: [BUGS] BUG #8385: greek symbols as function name

2013-08-18 Thread Tom Lane
Kevin Grittner kgri...@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


Re: [BUGS] BUG #8385: greek symbols as function name

2013-08-18 Thread Kevin Grittner
Tom Lane t...@sss.pgh.pa.us wrote:
 Kevin Grittner kgri...@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


[BUGS] BUG #8385: greek symbols as function name

2013-08-16 Thread kolmyk
The following bug has been logged on the website:

Bug reference:  8385
Logged by:  Alessio
Email address:  kol...@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