fpiraneo / oclife

Tagging and getting extended document informations on ownCloud
GNU General Public License v3.0
18 stars 17 forks source link

Postgresql mixed-case tablename mishandling without proper quoting #15

Closed sp1d3rb0y closed 9 years ago

sp1d3rb0y commented 10 years ago

Hi,

First of all, great work you did there.

I'd like to point out the fact that postgresql doesn't handle mixed-case tablenames (such as CamelCase tablenames, 'humanReadable' and 'docTags' in our case) when they are not properly quoted (as you can see here for example); without quotes, everything is lowercased. As a result, your app does not work properly in my case (Owncloud 7 + psql backend), throwing a 'relation oclife_humanreadable does not exist' error. I would kindly suggest you either :

$sql = "SELECT `tagid` FROM `*PREFIX*oclife_humanReadable` WHERE `lang`=? AND `descr`=?";

This patch follows the documentation and seemed to do the trick in my case.

Best regards,

fpiraneo commented 9 years ago

I'm going to escape all table name on the SQL statements, I think is more practical. Thank you for the clue. Question: For psql I have to escape also column names or just table names? Just to do the work once.

sp1d3rb0y commented 9 years ago

Hi, Column names also have to be escaped, but I think you got it pretty much covered (at least in libs/hTags.php).

fpiraneo commented 9 years ago

Should be fixed now! All tables names are between ticks.