Closed (duplicate)
Project:
Page Title
Version:
6.x-2.2
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
21 Aug 2009 at 18:22 UTC
Updated:
9 Feb 2010 at 10:45 UTC
Jump to comment: Most recent file
If you replace any occurence of "node" inside the queries with \'node\' then PostgreSQL can execute the query.
"node" will not be trated as text but as column name and thus the query fails.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | page_title.patch | 2.94 KB | valthebald |
Comments
Comment #1
valthebaldHere's patch for 6.x-2.2 - replace " with \'
works fine on my Postgres installation
Comment #2
mclin commentedYou missed one on line 350. Oh my, I hope this gets fixed.
Comment #3
jonathanpglick commentedWhy not just switch the single and double quotes on the query strings so no escaping needs to be done?
"DELETE FROM {page_title} WHERE type = 'node' AND id = %d"
as opposed to the suggested:
'DELETE FROM {page_title} WHERE type = \'node\' AND id = %d'
or the original:
'DELETE FROM {page_title} WHERE type = "node" AND id = %d'
Comment #4
valthebaldJust because of general recommendation to use single quotes in case there are no variables inside the string - single quoted strings are processed faster.
Comment #5
nicholasthompsonMarking as Duplicate as this fix has been applied in #622928: PostgreSQL compatibility... Although in fairness, I think this was opened first :)
Valthebald is correct - I used single quotes before for two reasons: (1) They are processed faster and (2) I was using double quotes in the content and it saved me escaping them. My fix in #622928: PostgreSQL compatibility is actually to switch the quotes around. I dont think the performance impact is worth worrying about when you weigh it against code readability. I find escaped quotes incredibly ugly.