User tests: Successful: Unsuccessful:
go to the Redirect manager and create a new link and Save
the redirect link is saved
SQL ERROR not null constraint violation
PostgreSQL 9.3.5
Joomla 3.4.0
added a sanity check for NOT NULL FIELDS
fix #6349
Labels |
Added:
?
|
let me disagree
when you add a new redirect link from the Redirect manager component in the backend and save data
that plugin event is not triggered
so if you don't set $this->referer = '';
you get this error
Save failed with the following error:
SQL=INSERT INTO "scaku_redirect_links" ("old_url","new_url","comment","published","created_date","modified_date") VALUES ('aaaa','aaaaaaa','',1,'2015-03-07 18:03:54','2015-03-07 18:03:54')
In the case where you manually add a new link there is no referring URL of course. So surely that's another reason to remove the NOT NULL
in the database?
Category | ⇒ | Postgresql |
in my opinion the best thing to do is a complete review of our data model , if we change our constraints on spot
we are going to loose the overall picture
#6265 (comment)
@test issue confirmed on pg and the fix resolves that
I've tested this one successfully, however I would like to make one quick change suggestion to this PR.
I noticed above in your comment on March 7 you mentioned setting the referer to an empty string, but in the PR it looks like you're setting it to a string containing a single space.
At first I thought the space was needed for some reason but I tested with an empty string and that appeared to work just fine so I think there just may be a typo in the PR.
If that's updated I have no objections on this one and it does fix the issue.
(Just for clarity, my test was performed on Postgres to confirm the error and fix and then I tried it also in MySQL, which isn't exhibiting the issue currently, but applying the fix doesn't introduce any issues on the MySQL end).
Additionally:
Another possible solution for this sort of problem (which could potentially be tackled in the future, I still approve the current fix for this issue proposed by @alikon) would be to make greater use of the information that the getTableColumns() methods can return in our database drivers and use that to automatically set empty string values for these types of columns when they are detected (so instead of the additional code being needed in the JTable class, it could potentially be fixed at the database driver level within the insertObject() method used by the JTable classes).
tested again still works
Status | Pending | ⇒ | Ready to Commit |
Setting RTC
Labels |
Added:
?
|
Milestone |
Added: |
Milestone |
Added: |
@Kubik-Rubik is there a reason to let this PR open?
Or did you comment on the wrong itm?
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-07-09 08:14:01 |
Closed_By | ⇒ | Kubik-Rubik |
Labels |
Removed:
?
|
This is one of the cases where the field should be able to be nullable (this condition can actually be seen really easily - https://github.com/joomla/joomla-cms/blob/staging/plugins/system/redirect/redirect.php#L122). If
$_SERVER['HTTP_REFERER']
is empty we set it to be an empty string and as we know that's null in non-mysql db's