-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Pg schema #24999
Pg schema #24999
Conversation
@alikon Do you think this is a new feature for 4.0, or is it a bug fix for 3.9? |
quite a greyzone it dependes on how you feel that, so up to the Production Lead |
schema.php
Outdated
@@ -0,0 +1,23 @@ | |||
<?php |
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.
Please remove this file from your PR since it is only for testing this PR, so it should not be checked into the Joomla CMS source code. You have that code already in the testing instructions.
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.
It would be better to convert it into a real test and integrated it into the test suite.
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.
Sure, that would be best. If the author of this PR feels not being able to do that, we can do that later with a new PR or help him here. But anyway this files as it is should be removed from this PR.
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.
Now file 'schema.php' simply deleted
@@ -406,6 +406,11 @@ public function getTableColumns($table, $typeOnly = true) | |||
$result = array(); | |||
|
|||
$tableSub = $this->replacePrefix($table); | |||
$fn = explode('.', $tableSub); |
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.
Code style error reported by Drone for lines 409 to 413: Tabs must be used to indent lines; spaces are not allowed
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.
fixed
@@ -406,6 +406,11 @@ public function getTableColumns($table, $typeOnly = true) | |||
$result = array(); | |||
|
|||
$tableSub = $this->replacePrefix($table); | |||
$fn = explode('.', $tableSub); | |||
if (count($fn) == 2) { |
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.
Mind the Joomla CMS code style rules or check the Drone report.
An "if" with "else" should look as follows, where "..." means some code:
if (...)
{
...
}
else
{
...
}
Please correct that to make Drone happy.
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.
P.S. And indent with tabs
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.
Fixed
@HLeithner Do you think this PR is a bug fix for 3.9 or a new feature for 4.0? From my point of view it is a bug fix since it is not good practice to use the public schema for everything in PostgreSQL, as far as I know, like it has to be without this PR. But I might be wrong, so I'd like to know your opinion, and @alikon 's, too, because he is doing much with PostgreSQL. |
@@ -427,7 +432,7 @@ public function getTableColumns($table, $typeOnly = true) | |||
WHERE a.attrelid = | |||
(SELECT oid FROM pg_catalog.pg_class WHERE relname=' . $this->quote($tableSub) . ' | |||
AND relnamespace = (SELECT oid FROM pg_catalog.pg_namespace WHERE | |||
nspname = \'public\') | |||
nspname = \'' . $schema . '\') |
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.
Use $this->quote() for quoting please.
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.
Fixed
It's a bugfix. |
to me too it's a bugfix |
@pviolette-fr please test > https://docs.joomla.org/Testing_Joomla!_patches |
My PR isn't only bug-fix. It's a feature request for a future version of Joomla. |
I'm not sure what you mean with "Simple RDBS (not supported schemas, such as MySQL)" is the schema support of MySQL different then the support form PostgresSQL? |
Using the term 'schema' completely different in other systems.
In more powerful RDBMS (Oracle, SQL Server, PostgreSQL ) a schema is essentially a namespace. |
$tableSub = $this->replacePrefix($table); | ||
$fn = explode('.', $tableSub); | ||
if (count($fn) == 2) |
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.
if (count($fn) == 2) | |
if (count($fn) == 2) |
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.
fixed
$fn = explode('.', $tableSub); | ||
if (count($fn) == 2) | ||
{ | ||
$schema = $fn[0]; |
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.
Indent lines 411, 412, and 416.
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.
Fixed
@@ -391,7 +391,7 @@ public function getTableCreate($tables) | |||
/** | |||
* Retrieves field information about a given table. | |||
* | |||
* @param string $table The name of the database table. | |||
* @param string $table The name of the database table. For PostgreSQL may starting with a schema |
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.
* @param string $table The name of the database table. For PostgreSQL may starting with a schema | |
* @param string $table The name of the database table. For PostgreSQL may start with a schema. |
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.
Fixed
ok thx, anyway in this case it's only a bugfix because it's should handle this and don't break. |
I have tested this item ✅ successfully on d16b754 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/24999. |
@softarius I've changed the "Actual result" in your testing instructions to the value from the issue. I guess that was a copy and paste thing from "Expected result", so it was the same as that, and in the issue it was correct, right? |
@HLeithner I can fully confirm @softarius 's explanations above. |
I have tested this item ✅ successfully on d16b754 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/24999. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/24999. |
@alikon Have there ever been discussions in past about full db schema support in Joomla, i.e. you can specify a schema like you can specify user and database names when installing on PostgreSQL, so Joomla can be installed using a different schema than "Public"? If so, what was the result of these discussions? |
For the one who will merge: Drone failure is not related to this PR. |
Yes. |
not that i'm aware of |
Co-Authored-By: SharkyKZ <sharkykz@gmail.com>
I have tested this item ✅ successfully on 3da16d1 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/24999. |
thx |
Pull Request for Issue #24998 .
Summary of Changes
Method getTableColumns of JDatabaseDriverPostgresql class
Testing Instructions
Expected result
Array with fields of a table
Actual result
Empty array
Documentation Changes Required
Added to param $table
For PostgreSQL may starting with a schema