Commit 142ebe85 authored by Sam Morris's avatar Sam Morris Committed by Max Kanat-Alexander

Bug 616981: Make whine.pl work with PostgreSQL 8.4+ by fixing sql_string_until

r=mkanat, a=mkanat
parent f843497f
......@@ -192,6 +192,18 @@ sub sql_string_concat {
return '(CAST(' . join(' AS text) || CAST(', @params) . ' AS text))';
}
sub sql_string_until {
my ($self, $string, $substring) = @_;
# PostgreSQL does not permit a negative substring length; therefore we
# use CASE to only perform the SUBSTRING operation when $substring can
# be found withing $string.
return "CASE WHEN " . $self->sql_position($substring, $string)
. " != 0 THEN SUBSTRING($string FROM 1 FOR "
. $self->sql_position($substring, $string) . " - 1)"
. " ELSE $string END";
}
# Tell us whether or not a particular sequence exists in the DB.
sub bz_sequence_exists {
my ($self, $seq_name) = @_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment