[Cdash] Postgres / MySQL functions

Chris J. Garrett chris.garrett at calgaryscientific.com
Thu Dec 18 15:41:02 EST 2008


Hi, 
I've found a bug in viewUpdate.php when using Postgres. I'm using 1.3.0(trunk). The query is using MySQL specific functions. The simple work around for me was to write/copy the equivalent functions. Maybe you can add them to the install step or something...
HTH
Chris


CREATE OR REPLACE FUNCTION REVERSE(text) RETURNS TEXT AS
'
DECLARE reversed_string text;
incoming alias for $1;
BEGIN
reversed_string = '''';
for i in reverse char_length(incoming)..1 loop
reversed_string = reversed_string || substring(incoming from i for 1);
end loop;
return reversed_string;
END'
LANGUAGE PLPGSQL;

CREATE OR REPLACE FUNCTION LOCATE(text,text) RETURNS INT AS
'SELECT STRPOS($2, $1)'
LANGUAGE SQL;

CREATE OR REPLACE FUNCTION RIGHT(text,int) RETURNS TEXT AS
'SELECT SUBSTR($1, LENGTH($1)-$2+1)'
LANGUAGE SQL;




More information about the Cdash mailing list