Moodle

Postgresql connection can be simplified in install.php

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9
  • Fix Version/s: 2.0
  • Component/s: Installation
  • Labels:
    None
  • Environment:
    PostgreSQL 8.2, Moodle 1.9.3
  • Database:
    PostgreSQL
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

There is currently a hack that makes a custom string to pass on to the adodb layer, "aggregating" the username, password, host and dbname, for postgresql. This is not necessary, as the adbodb doc at http://phplens.com/lens/adodb/docs-adodb.htm#connect_ex explicitly states that pgsql 7 & 8 support connecting using the "four arguments".

This actually corrects a bug, occuring when the connection fails, and the user comes back to the database setup screen, with all fields empty, except for the "host", which contains the aggregated information.

Along is a patch fixing this.

As this seems to be historical (August 2004), Martin, can you confirm that it's alright to remove these lines? I tested on pgsql 8.2, but I don't have access to any older version.

  1. patch-pgsql.txt
    12/Dec/07 11:17 AM
    0.9 kB
    Mathieu Petit-Clair
  2. patch-pgsql-2.txt
    12/Dec/07 12:20 PM
    0.9 kB
    Mathieu Petit-Clair

Activity

Hide
Mathieu Petit-Clair added a comment -

The prefix is necessary, but everything else can be simplified a bit more.

Show
Mathieu Petit-Clair added a comment - The prefix is necessary, but everything else can be simplified a bit more.
Hide
Eloy Lafuente (stronk7) added a comment -

Hi Mathieu,

if I'm not wrong that hack is there, to be applied only when the PG server is running in the same server that the WEB server (localhost or 127.0.0.1). And the cause for the hack is that, if you leave the host undefined, then the connection will be stabilised over local Unix sockets, instead of using TCP/IP stack. And that will cause some improvements in the PG use.

Anyway... if you can confirm what happens with Adodb if you leave the host blank and it works... then I think you can safely delete the hack as suggested. If leaving the host blank causes AdoDB not to connect... to PG then the hack should remain there IMO.

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Hi Mathieu, if I'm not wrong that hack is there, to be applied only when the PG server is running in the same server that the WEB server (localhost or 127.0.0.1). And the cause for the hack is that, if you leave the host undefined, then the connection will be stabilised over local Unix sockets, instead of using TCP/IP stack. And that will cause some improvements in the PG use. Anyway... if you can confirm what happens with Adodb if you leave the host blank and it works... then I think you can safely delete the hack as suggested. If leaving the host blank causes AdoDB not to connect... to PG then the hack should remain there IMO. Ciao
Hide
Mathieu Petit-Clair added a comment -

Hmm.. will reactivate my postgres server here and test this out...

Show
Mathieu Petit-Clair added a comment - Hmm.. will reactivate my postgres server here and test this out...
Hide
Mathieu Petit-Clair added a comment -

Just tested this, with and without the patch: it works just the same (minus the bug that this patch fixes). The connect-on-socket behavior is actually in php function pg_connect, not in adodb.

Will wait 'till Eloy wakes up before committing. Should this go in head only, or should it be in 1.9 too?

Show
Mathieu Petit-Clair added a comment - Just tested this, with and without the patch: it works just the same (minus the bug that this patch fixes). The connect-on-socket behavior is actually in php function pg_connect, not in adodb. Will wait 'till Eloy wakes up before committing. Should this go in head only, or should it be in 1.9 too?
Hide
Aaron Barnes added a comment -

+1, had problems with this also and the above patch works great

Show
Aaron Barnes added a comment - +1, had problems with this also and the above patch works great
Hide
Petr Škoda (skodak) added a comment -

My +1 to be more conservative and change this in 2.0 only, the installer was rewritten there already and we would have enough time to test this properly

Show
Petr Škoda (skodak) added a comment - My +1 to be more conservative and change this in 2.0 only, the installer was rewritten there already and we would have enough time to test this properly
Hide
Petr Škoda (skodak) added a comment -

new "unix socket" option now in 2.0 installer
thanks for the report

Show
Petr Škoda (skodak) added a comment - new "unix socket" option now in 2.0 installer thanks for the report

Dates

  • Created:
    Updated:
    Resolved: