the latest update doesn't work in postgres.

The delta field is a string (varchar) so cannot be referred to as in integer.
There's SELECT statements using double quotes for a string (SQL needs single quotes).

patch attached to fix both.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

AlexisWilke’s picture

Status: Needs review » Reviewed & tested by the community

Shiny,

Cool! Thank you for the patches. Ran in the same problem here.

Alexis

nileshgr’s picture

Ehehehe, I was thinking of filing this bug report. Surprised to see that PG users are increasing.
And of course with patches.

AlexisWilke’s picture

There is the same problem in the print_mail module for those who use it. See attached.

Thank you.
Alexis

jcnventura’s picture

Status: Reviewed & tested by the community » Fixed

Hi,

Thanks for the patch (next time remember print_mail :P)!

I try to create and test pg compatible SQL, but I have to say that I usually test only the runtime code of the module in the alternate platform. My bad.

I've committed it to CVS.

João

nileshgr’s picture

There's just one error you made everywhere repeatedly.
Let's say, a & b are integer & character respectively.

SELECT a, b where a = 0 and b = 0; - this works in mysql but not in pgsql
SELECT a, b where a = 0 and b = "0"; - this works in mysql but not in pgsql
SELECT a, b where a = 0 and b = '0'; - this works in both

So the thing is, you need to use single quotes while comparing a string column.
Just keep that in mind while writing future code.

AlexisWilke’s picture

Yes. In PostgreSQL the double quotes are used to escape "strange" column names. For instance, I saw a table with a "timestamp" which is also a type in PostgreSQL and to handle that column, you must use double quotes to make sure it works in all cases:

INSERT INTO some_table ("timestamp") VALUES (%d);

If I'm correct, MySQL uses backward quotes as in `int` to handle this special case. Each database uses a different scheme because it is not defined in the SQL92 specs...

Thank you.
Alexis

nileshgr’s picture

PostgreSQL strictly follows ANSI SQL for commands in DDL, DCL, TCL & DML categories (limited only to ANSI, there are some additions to it for handing postgre's features). It is MySQL which violates the standards.

jcnventura’s picture

And this is the reason why I'm really happy that Drupal 7 abstracts the database layer.. :)

nileshgr’s picture

There's no guarantee that there will be no bugs in it either? :D
So, a general theorem: Know SQL & PHP well if you plan to use Drupal & PostgreSQL :D

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.