Ticket #774 (closed Patch: invalid)
Join Table Error in Postgresql
| Reported by: | Jeffrey04 | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 2.2.1 |
| Component: | Libraries:Database | Version: | 2.2 Release |
| Keywords: | Cc: |
Description
I am currently using postgresql 8.3 with Kohana 2.2. While playing around with ORM, I found out that the join table clause was not being generated properly.
Instead of something like
SELECT "role".*
FROM role JOIN "users_roles" ON ("users_roles"."rid" = "role"."rid")
WHERE "users_roles"."uid" = '1'
ORDER BY "rid" ASC
I am getting (notice the bracket/parenthesis in the joined table name)...
SELECT "role".*
FROM role JOIN ("users_roles") ON ("users_roles"."rid" = "role"."rid")
WHERE "users_roles"."uid" = '1'
ORDER BY "rid" ASC
I am not sure whether this is intended (??) but after changing the code in SYSPATH . /libraries/drivers/Database/Pgsql.php line 178
$sql .= ' '.$database['join']['type'].'JOIN ('.implode(', ', $database['join']['tables']).') ON '.implode(' AND ', $database['join']['conditions']);
to
$sql .= ' '.$database['join']['type'].'JOIN '.implode(', ', $database['join']['tables']).' ON '.implode(' AND ', $database['join']['conditions']);
then everything works
Change History
Note: See
TracTickets for help on using
tickets.
