No database schema updates for PGSQL

matreides - June 11, 2009 - 16:37
Project:Page Title
Version:6.x-2.2
Component:Code
Category:bug report
Priority:critical
Assigned:nicholasThompson
Status:needs review
Description

I am fairly new to drupal, and this was working in page_title-6.x-2.0 after updating the mod I get this error:

warning: pg_query() [function.pg-query]: Query failed: ERROR: column "node" does not exist LINE 1: SELECT page_title FROM page_title WHERE type = "node" AND id... ^ in /usr/local/www/apache22/drupal.techally.com/public/includes/database.pgsql.inc on line 139.
user warning: query: SELECT page_title FROM page_title WHERE type = "node" AND id = 2 in /usr/local/www/apache22/drupal.techally.com/public/sites/all/modules/page_title/page_title.module on line 302.

I included a screen shot just in case.

AttachmentSize
page_title_error.png36.77 KB

#1

porcelaindev - June 12, 2009 - 13:00
Version:6.x-2.1» 5.x-2.1

I'm having exactly the same problem but on D5. When I de-activate page_title module the error goes away. Any ideas?

#2

nicholasThompson - June 12, 2009 - 15:22
Title:page_title-6.x-2.1 node does not exist» No database schema updates for PGSQL
Version:5.x-2.1» 6.x-2.x-dev
Priority:normal» critical
Assigned to:Anonymous» nicholasThompson
Status:active» needs work

Ah this would be my fault as I've not included an upgrade path for PGSQL (completely forgot about that! Sorry!)...

Does anyone have any experience with PGSQL? I've never used it and the syntax looks a little different to MySQL. I believe it's update 5203 and 6200 which do the MySQL updating...

#3

xzilla - June 18, 2009 - 19:28

The problem is that MySQL uses non-standard quoting, so your SQL won't work on Postgres. For Postgres, you need to quote identifiers (table names,column names,view names,etc...) using ", and literal values (text,timestamps,etc...) using '. So your above query should look like this:

SELECT page_title FROM page_title WHERE type = 'node' AND id = 2;

Note: I believe there is a way to get MySQL to accept the standard quoting, but don't recall off-hand how it's done. HTH.

#4

LUTi - June 19, 2009 - 09:36

xzilla, what do you mean by "The problem is that MySQL uses non-standard quoting..."?

As much as I know, it is just fine for MySQL to query:
SELECT page_title FROM page_title WHERE type = "node" AND id = 2
or
SELECT page_title FROM page_title WHERE type = 'node' AND id = 2

Both shall work well, and return the same result.

You shall of course switch the whole query sentence from single quotes to double quotes, to make a difference... ;-)

#5

valthebald - June 24, 2009 - 11:05
Status:needs work» needs review

Problem is caused by the fact PostgreSQL distincts ' from "
Attached (very small) patch fixes the problem

AttachmentSize
page_title.patch 494 bytes

#6

jianingy - July 1, 2009 - 01:56

PostgreSQL uses quotes for only field names.
Attached patch fixes this problem not only for SELECT query but also INSERT and DELETEs.

AttachmentSize
page_title_pgsql_quote.patch 1.44 KB

#7

madler - July 2, 2009 - 17:35
Version:6.x-2.x-dev» 6.x-2.2

Like valthebald said, postgres makes a distinction between single-quotes and double-quotes. Second Problem is with column "type" which is a reserved word in postgres.

So I made a patch against page_title version 6.x-2.2 featuring :
- "type" as a column name should always be double-quoted just to make sure
- 'node' / 'user' / 'term' as a plain string must be single-quoted

Hopefully, I didn't miss something,
Cheers

AttachmentSize
page_title_pgsql_quote.patch 3.28 KB

#8

gugrim - August 14, 2009 - 11:36

The double quoted string values does not work with MySQL either if it is configured to accept ANSI SQL. I'm having the same problem with MySQL and the page_title module.

 
 

Drupal is a registered trademark of Dries Buytaert.