Bug 11389 - re-enable PostgreSQL as a database scheme that Koha can connect to
Summary: re-enable PostgreSQL as a database scheme that Koha can connect to
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Galen Charlton
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 7365
  Show dependency treegraph
 
Reported: 2013-12-12 23:49 UTC by Galen Charlton
Modified: 2014-12-07 20:07 UTC (History)
0 users

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 11389: reenable Pg as a DB scheme that Koha can connect to (4.53 KB, patch)
2013-12-13 00:07 UTC, Galen Charlton
Details | Diff | Splinter Review
Bug 11389: reenable Pg as a DB scheme that Koha can connect to (4.79 KB, patch)
2014-01-01 07:18 UTC, Chris Cormack
Details | Diff | Splinter Review
[PASSED QA] Bug 11389: reenable Pg as a DB scheme that Koha can connect to (5.45 KB, patch)
2014-01-12 15:21 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Galen Charlton 2013-12-12 23:49:33 UTC
Bug 7188 (rightly) simplified C4::Context::db_scheme2dbi so that it always returns "mysql".  Now that PostgreSQL is starting to become a realistic option, Pg should be added back as a valid choice for the DBD driver.
Comment 1 Galen Charlton 2013-12-13 00:07:46 UTC Comment hidden (obsolete)
Comment 2 Chris Cormack 2014-01-01 07:18:14 UTC Comment hidden (obsolete)
Comment 3 Katrin Fischer 2014-01-12 15:21:01 UTC
Created attachment 24212 [details] [review]
[PASSED QA] Bug 11389: reenable Pg as a DB scheme that Koha can connect to

This patch restores the ability to request a DBI database handle
or a DBIx::Class schema object connected to a PostgreSQL database.

To address the concerns raised in bug 7188, only "mysql" and "Pg"
are recognized as valid DB schemes.  If anything else is passed
to C4::Context::db_scheme2dbi or set as the db_scheme in the Koha
configuration file, the DBD driver to load is assumed to be "mysql".

Note that this patch drops any pretense of Oracle support.

To test:

[1] Apply patch, and verify that the database-dependent tests
    pass when run against a MySQL Koha database.
[2] To test against PostgreSQL, create a Pg database and
    edit koha-conf.xml to set db_scheme to Pg (and adjust
    the other DB connection parameters appropriately).  The
    following tests should pass, at minimum:

    t/Context.t
    t/db_dependent/Koha_Database.t

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, some additional notes:

- Installed Postgres following
  http://wiki.ubuntuusers.de/PostgreSQL
- Created a database user koha
- Created a database koha
- Changed the koha-conf.xml file
    <db_scheme>Pg</db_scheme>
    <database>koha</database>
    <hostname>localhost</hostname>
    <port>5432</port>
    <user>koha</user>
    <pass>xxxx</pass>
- Installed libdbd-pg-perl
- Ran the web installer until step 3 everything looked ok
  Step 3 complains:
    Password for user koha: psql: fe_sendauth: no password supplied
- Both t/Context.t and t/db_dependent/Koha_Database.t pass
Comment 4 Galen Charlton 2014-01-13 22:02:04 UTC
Pushed to master.