diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2010-02-01 21:48:03 +0100 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-02-01 21:48:03 +0100 |
commit | 39af8fd0f459790feaf57d6f65075e823faa343d (patch) | |
tree | cccf0a4c266ff48668088ec1c0f1645392e163f5 /Bugzilla | |
parent | 26426fe87683c76702a2340bf852e8bb0eca7626 (diff) | |
download | bugzilla-39af8fd0f459790feaf57d6f65075e823faa343d.tar.gz bugzilla-39af8fd0f459790feaf57d6f65075e823faa343d.tar.xz |
Bug 533363: [PostgreSQL] Using "Bug ID contains foo" in boolean charts or "Exclude bug numbered" charts crash PostgreSQL 8.3 and newer (non-character data types are no longer automatically cast to TEXT)
Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/DB/Pg.pm | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Bugzilla/DB/Pg.pm b/Bugzilla/DB/Pg.pm index 585c0884b..b31d186bb 100644 --- a/Bugzilla/DB/Pg.pm +++ b/Bugzilla/DB/Pg.pm @@ -100,13 +100,25 @@ sub sql_group_concat { return "array_to_string(array_accum($text), $separator)"; } +sub sql_istring { + my ($self, $string) = @_; + + return "LOWER(${string}::text)"; +} + +sub sql_position { + my ($self, $fragment, $text) = @_; + + return "POSITION($fragment IN ${text}::text)"; +} + sub sql_regexp { my ($self, $expr, $pattern, $nocheck, $real_pattern) = @_; $real_pattern ||= $pattern; $self->bz_check_regexp($real_pattern) if !$nocheck; - return "$expr ~* $pattern"; + return "${expr}::text ~* $pattern"; } sub sql_not_regexp { @@ -115,7 +127,7 @@ sub sql_not_regexp { $self->bz_check_regexp($real_pattern) if !$nocheck; - return "$expr !~* $pattern" + return "${expr}::text !~* $pattern" } sub sql_limit { |