Roland Szabo ([EMAIL PROTECTED]) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Special character pervents psql from parsing?

Long Description
Consider the two expressions in the example code. They are almost the same, the only 
difference is, that string constant 'Hibás' (faulty, that is, in  hungarian) is 
terminated with '' in the same line in example #1, and in a new line in example #2. 
#1 doesn't work.
Our guess is that special character 'á' prevents psql from finding the string 
delimiters. CR seems to make it recover at the end of line, and that way (ex.#2) it 
does find the string terminator.

We're using 7.0.3, but same problem occurs in earlier versions too. We have 
'LANG=hu_HU' and 'PGDATASTYLE=ISO' environment variables set to warn postgres about 
the presence of hungarian chars.

We also tried escaping the special character by having \á in the statement. That 
resulted in a command error.

Sample Code
#1 The faulty expression:
CREATE FUNCTION "iiftext" (bool,bpchar,bpchar ) RETURNS bpchar AS '
begin
 if $1 then
   return $2;
 else
   RETURN $3;
 end if;
end;
' LANGUAGE 'plpgsql';
CREATE FUNCTION "hibasnev" (bool ) RETURNS bpchar AS '
select iiftext( $1, '''', ''Hibás'');
' LANGUAGE 'SQL';
---cut---
CREATE
ERROR:  Unterminated quoted string
ERROR:  parser: parse error at or near "'"

#2 Similar expression, but this one works:
CREATE FUNCTION "iiftext" (bool,bpchar,bpchar ) RETURNS bpchar AS '
begin
 if $1 then
   return $2;
 else
   RETURN $3;
 end if;
end;
' LANGUAGE 'plpgsql';
CREATE FUNCTION "hibasnev" (bool ) RETURNS bpchar AS '
select iiftext( $1, '''', ''Hibás
'');
' LANGUAGE 'SQL';


No file was uploaded with this report

Reply via email to