New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement initial port support for PostgreSQL driver #19466
Conversation
FWIW the Framework handled this a bit differently, see joomla/joomla-framework#141 for the PR adding it (implementation is basically still the same now). And no, I don't think you need the same type of detection as the MySQLi driver. That honestly seems really verbose for reasons I don't understand without getting into the commit logs. |
if (!$this->options['port']) | ||
{ | ||
// Port is empty or not set via options, check for port annotation (:) in the host string | ||
$tmp = substr(strstr($this->options['host'], ':'), 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do explode(':', $this->options['host'])
. Then $tmp[0]
will be the domain and $tmp[1]
will be the port if provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have used the code from here: https://github.com/joomla-framework/database/blob/master/src/Postgresql/PostgresqlDriver.php so i think we should fix it in the source first can you send a PR with the needed changes?
@@ -119,7 +155,7 @@ public function connect() | |||
$dsn .= "host={$this->options['host']} "; | |||
} | |||
|
|||
$dsn .= "dbname={$this->options['database']} user={$this->options['user']} password={$this->options['password']}"; | |||
$dsn .= "dbname={$this->options['database']} port={$this->options['port']} user={$this->options['user']} password={$this->options['password']}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure but if you always adding port=... then you will always force connection by TCP/IP and remove option to connect by unix socket, which usual faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok i'm going to move the port setting up to the host so if the host is not set we try without host &port for a socket Connection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry took longer than expected but it is done now :)
What is holding us back from testing and merging this thing or should this just be closed as the interest is gone? |
Finding the 3 people who actually use Joomla with PostgreSQL support and getting their feedback? |
i've tested successully on not default port like 5444 |
I have tested this item ✅ successfully on de3d104 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19466. |
…s into postgressqlPortSupport
I can not find a port number field in the System -> Global configuration -> Server -> Database Settings form. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19466. |
@twister65 You can append the port to the Host eg. |
I have tested this item ✅ successfully on 2111f2f This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19466. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19466. |
Pull Request for Issue #18578 cc: @irbian
Summary of Changes
Add the port option to the PostgreSQL driver
Testing Instructions
Steps to reproduce the issue
Have a connection on a port different than the default and try to make a query on it
Expected result
I expect to work
Actual result
"Error connecting to PGSQL database."
Open Points