Welcome Guest, Not a member yet? Register   Sign In
A little bug DB_active_rec.php function _compile_select for postgresql
#1

[eluser]czarft[/eluser]
Hello
my db postgresql 8.1.4.

cannot query like this

Code:
SELECT * FROM ("employee") WHERE "username" = 'cz' AND "pass" = 'd41d8cd98f00b204e9800998ecf8427e';

then i fix it with if statement

Code:
if (count($this->ar_from) > 1)
        {
            $sql .= "\nFROM ";
            $sql .= '(' . implode(', ', $this->ar_from) . ')';
        }
        else if (count($this->ar_from) == 1)
        {

            $sql .= "\nFROM ";
            $sql .= implode(', ', $this->ar_from) ;
        }



Suggestion me if i wrong?

Thank you
ps my english not good
#2

[eluser]James Gifford[/eluser]
I just switched to the final 1.6.0 release and I have also noticed an error with queries using a PostgreSQL database.

CI is now putting parentheses around the tables in the FROM clause like this:
Code:
SELECT * FROM ("posts") ORDER BY "date_created" LIMIT 20

The parenthesis don't seem to be proper Postgres syntax as the query will work fine without them. Also, I don't remember CI putting quotes around the field names before, but this is not causing problems with the query.

EDIT:
Changing line 489 in postgre_driver.php from this:
Code:
return '('.implode(', ', $tables).')';
to this:
Code:
return implode(', ', $tables);

fixed the problem.
#3

[eluser]Derek Allard[/eluser]
OK, second report. I've fixed it in the SNV. Apologies for the inconvenience gents!




Theme © iAndrew 2016 - Forum software by © MyBB