Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-44862

Postgres dbport is discarded when dbsocket is used, it should not

    XMLWordPrintable

Details

    • MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • MOODLE_25_STABLE, MOODLE_26_STABLE
    • W14_MDL-44862_m27_pgsocket
    • Hide

      test pg connections by running phpunit tests with following:
      1/ standard port using port
      2/ non-standard port using port
      3/ standard port using socket
      4/ non-standard port using socket

      Show
      test pg connections by running phpunit tests with following: 1/ standard port using port 2/ non-standard port using port 3/ standard port using socket 4/ non-standard port using socket

    Description

      It seems that current connection in the postgresql driver is unable to handle both dbsocket and dbport at the same time.

      And this is needed if you run a postgres instance, accepting socket connections in an non-standard port, because the socket file is named, always:

      dbsocket/.s.PGSQL.dbport

      So it works perfectly if using the standard 5432 port, because php find the file, but not if the port is different, because we don't pass the " port=5433" to the connection when using dbsockets.

      I discovered this while creating different postgresql instances to run by CI servers. There I performed multiple "initdb" executions, every one using a different port 5432, 5433... and in every case, the socket became named as specified above.

      I know that I could be using -h 127.0.0.1 -p 5433, but in this case I prefer to keep any "host" connection rejected and only enable sockets.

      I think this is easy to fix and will allow those non-standard port sites using sockets to work without a problem, straight from config.php, without having to be forced to use host access.

      Note this is not a problem with mysql because we pass the socket file to the connection. Problem in postgresql is that we pass the directory and the port and php / postgres uses both to determine the socket file. I know it's idiot to mix sockets and ports but php / postgres does it for naming purposes and I've not been able to find a way to specify the socket file, it's always directory and port (initdb, psql, php's->connect()...).

      Ciao

      Attachments

        Issue Links

          Activity

            People

              skodak Petr Skoda
              stronk7 Eloy Lafuente (stronk7)
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Marina Glancy Marina Glancy
              Andrew Lyons Andrew Lyons
              David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                12/May/14