Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0007793
TypeCategorySeverityReproducibilityDate SubmittedLast Update
backport[Openbravo ERP] A. Platformminoralways2009-02-06 12:042012-02-20 11:41
ReporterdalsasuaView Statuspublic 
Assigned Toshuehner 
PrioritynormalResolutionout of dateFixed in Version
StatusclosedFix in branch2.40Fixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSLinux 32 bitDatabasePostgreSQLJava version1.6.0_11
OS VersionrPath LinuxDatabase version8.3.5Ant version1.7.1
Product VersionpiSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0007793: substr overloading for postgresql not working

DescriptionIn the Oracle native substr function, when an index of 0 is received as first position of the string, it turns it to a 1. In postgresql, if a 0 is received, then no value is returned as first character, so there exists a function called substr in OpenbravoERP that tries to emulate this behavior:

-- Function: substr(character varying, numeric, numeric)
CREATE OR REPLACE FUNCTION substr(character varying, numeric, numeric)
  RETURNS character varying AS
$BODY$
BEGIN
return substr($1,CAST((CASE $2 WHEN 0 THEN 1 ELSE $2 END) AS INTEGER), CAST($3 AS INTEGER));
END;
$BODY$
  LANGUAGE 'plpgsql' IMMUTABLE
  COST 100;

Actually, this is not working, because when a substr function is invoked, then the postgresql native one is executed. The difference between both functions is in the parameter types:

The one in Openbravo ERP:
substr(character varying, numeric, numeric)

Included in Postgresql catalog:
substr(text, integer, integer)
as well as
substr(bytea, integer)
substr(text, integer)
substr(bytea, integer, integer)

substr function must be re-defined
Steps To ReproduceIn Oracle:

select substr('123',0,2) from dual; -> 12
select substr('123',0,1) from dual; -> 1

In Postgresql:

select substr('123',0,2); -> 1
select substr('123',0,1); -> <empty string>
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
blocks design defect 0007412 acknowledgedAugustoMauch substr overloading for postgresql not working 

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2009-02-24 12:10 psarobe Type defect => backport
2009-02-24 12:10 psarobe fix_in_branch => 2.40
2009-02-24 12:11 psarobe Assigned To pjuvara => shuehner
2012-02-20 11:41 shuehner Status scheduled => closed
2012-02-20 11:41 shuehner Resolution open => out of date


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker