View Issue Details

IDProjectCategoryView StatusLast Update
189Composrcore_database_driverspublic2010-07-15 18:41
ReporterGuest Assigned ToChris Graham  
PrioritynormalSeveritymajor 
Status resolvedResolutionfixed 
Summary189: Issued non postgresql friendly sql in installation
DescriptionInstall error:

Unfortunately a query has failed [SELECT t_is_open,t_pt_from,t_pt_to,t_forum_id,t_cache_last_member_id,t_cache_first_title FROM cms4_f_topics WHERE (id LIKE '1') LIMIT 1] [ERROR: operator does not exist: integer ~~ unknown LINE 1: ...,t_cache_first_title FROM cms4_f_topics WHERE (id LIKE '1') ... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.]
Additional InformationIn sources/database/postgresql.php you have

    function db_string_equal_to($attribute,$compare)
    {
        return $attribute." LIKE '".$this->db_escape_string($compare)."'";
    }

Change to

    function db_string_equal_to($attribute,$compare)
    {
        return $attribute." = '".$this->db_escape_string($compare)."'";
    }

Unless the db_escape_string() function adds some wildcards it should be fine.

Otherwise you may need to distinguish which fields are text strings (where LIKE) is fine, and which are not, like INTEGER.

In which case things get a little more complicated, because you need to know the column type the $attribute refers to.

The change did allow installation to proceed.
TagsNo tags attached.
Attach Tags
Time estimation (hours)
Sponsorship open

Sponsor

Date Added Member Amount Sponsored

Activities

Chris Graham

2010-07-15 18:40

administrator   ~58

Working blind, I think this must actually due to the auto-increment coming back as a string instead of an integer.
Fix is changing:
                return $seq_array[0];
to:
                return intval($seq_array[0]);
in the driver.

Chris Graham

2010-07-15 18:41

administrator   ~59

LIKE was probably required for comparisons on blob fields or something like that at the time of the driver development, so I'd prefer to keep that. But regardless Composr tries to be type-strict, so shouldn't be doing a string compare anyway.

Issue History

Date Modified Username Field Change