just a quick question i couldn't find the answer too after searching...

i want to use postgres as the db. however, a lot of the modules i want to use have prepared sql text files for mysql only.

i take it that if i rewrite these files for postgres, the modules will call through drupal and therefore the postgres interfacing without any probs? or is there a chance they've been written for solely for mysql?

any advice would be much appreciated,

thanks.

Comments

benshell’s picture

The drupal core is setup to use mysql or postgres, so even if some modules don't work at first, it shouldn't be too hard to fix them. One of my contributions, the Shoutbox module, wasn't setup to use postgres because I don't have postgres, but someone got it working and now I've added their pgsql and module patch to the repository. In this case, the only thing that wasn't postgres compatible (besides the lack of the pgsql file) was that I was inserting NULLs into a autonumbered field. Apparently it works fine in both mysql and postgres by just leaving off autonumbered fields in an insert query. Now that I know that, I'll code that way in the future.

Please post a follow up if there are other things I should be aware of regarding postgres.

cjm’s picture

thanks for that benshell.

i'm going setup a test server with postgres and will try out the modules today.

working from your answer, i take it that modules in drupal do not take advantage of PEAR DB?

does drupal not provide guidlines for implementing non-specific db modules? if not, it would be great if they could.

any other info/opinions very welcome.

benshell’s picture

Drupal does not use PEAR, but it does have a database abstraction layer. Modules should be calling functions like db_query() instead of mysql_query(). Like I was saying, it's still possible for modules to do things in a way that aren't postgres compatible, but ideally everything should non-database specific.