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.

CommentFileSizeAuthor
#1 page_title.patch2.94 KBvalthebald

Comments

valthebald’s picture

Status: Needs work » Needs review
StatusFileSize
new2.94 KB

Here's patch for 6.x-2.2 - replace " with \'
works fine on my Postgres installation

mclin’s picture

You missed one on line 350. Oh my, I hope this gets fixed.

jonathanpglick’s picture

Why 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'

valthebald’s picture

Just because of general recommendation to use single quotes in case there are no variables inside the string - single quoted strings are processed faster.

nicholasthompson’s picture

Status: Needs review » Closed (duplicate)

Marking 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.