specify / specify7

Specify 7
https://www.specifysoftware.org/products/specify-7/
GNU General Public License v2.0
62 stars 36 forks source link

Error when saving new agent #4188

Closed pashiav closed 10 months ago

pashiav commented 10 months ago

Describe the bug When saving a new Agent in Data Entry, an error is created.

To Reproduce Steps to reproduce the behavior:

  1. Go to: Data Entry ⇒ Agent (https://archireef-edge.test.specifysystems.org/specify/view/agent/new/)
  2. Add any inputs into any fields
    • inputs in screenshot:
      • Agent Type: Person
      • Last Name: Issue
      • First Name: Testt
      • Middle Initial: T
      • Email: testissue@email.com
  3. Click Save
  4. See error Specify 7 Crash Report - 2023-11-02T15_08_42.464Z.txt

Expected behavior Should save agent without error pop up

Screenshots Screen Shot 2023-11-02 at 10 14 18 AM

Desktop:

Database Name: archireef (6.8.03)

melton-jason commented 10 months ago

Duplicate of #3874

This issue should only be specific to the archireef database.

Looking at the server, their database has a malformed spdataset table:

MariaDB [archireef]> desc spdataset;
+--------------------+--------------+------+-----+---------+----------------+
| Field              | Type         | Null | Key | Default | Extra          |
+--------------------+--------------+------+-----+---------+----------------+
| id                 | int(11)      | NO   | PRI | NULL    | auto_increment |
| name               | varchar(256) | NO   |     | NULL    |                |
| columns            | longtext     | NO   |     | NULL    |                |
| uploadplan         | longtext     | YES  |     | NULL    |                |
| uploadresult       | longtext     | YES  |     | NULL    |                |
| collection_id      | int(11)      | NO   | MUL | NULL    |                |
| specifyuser_id     | int(11)      | NO   | MUL | NULL    |                |
| visualorder        | longtext     | YES  |     | NULL    |                |
| importedfilename   | longtext     | YES  |     | NULL    |                |
| remarks            | longtext     | YES  |     | NULL    |                |
| timestampcreated   | datetime(6)  | NO   |     | NULL    |                |
| timestampmodified  | datetime(6)  | NO   |     | NULL    |                |
| createdbyagent_id  | int(11)      | YES  | MUL | NULL    |                |
| modifiedbyagent_id | int(11)      | YES  | MUL | NULL    |                |
+--------------------+--------------+------+-----+---------+----------------+
14 rows in set (0.002 sec)

Compare this to the spdataset table on the fwri database:

MariaDB [fwri]> desc spdataset;
+--------------------+--------------+------+-----+---------+----------------+
| Field              | Type         | Null | Key | Default | Extra          |
+--------------------+--------------+------+-----+---------+----------------+
| id                 | int(11)      | NO   | PRI | NULL    | auto_increment |
| name               | varchar(256) | NO   |     | NULL    |                |
| columns            | longtext     | NO   |     | NULL    |                |
| data               | longtext     | NO   |     | NULL    |                |
| uploadplan         | longtext     | YES  |     | NULL    |                |
| uploaderstatus     | longtext     | YES  |     | NULL    |                |
| uploadresult       | longtext     | YES  |     | NULL    |                |
| rowresults         | longtext     | YES  |     | NULL    |                |
| collection_id      | int(11)      | NO   | MUL | NULL    |                |
| specifyuser_id     | int(11)      | NO   | MUL | NULL    |                |
| visualorder        | longtext     | YES  |     | NULL    |                |
| importedfilename   | longtext     | YES  |     | NULL    |                |
| remarks            | longtext     | YES  |     | NULL    |                |
| timestampcreated   | datetime(6)  | NO   |     | NULL    |                |
| timestampmodified  | datetime(6)  | NO   |     | NULL    |                |
| createdbyagent_id  | int(11)      | YES  | MUL | NULL    |                |
| modifiedbyagent_id | int(11)      | YES  | MUL | NULL    |                |
+--------------------+--------------+------+-----+---------+----------------+
17 rows in set (0.001 sec)

archireef is missing three very important columns in the spdataset table: data, uploaderstatus, and rowresults.

Even accessing the datasets via the Workbench button from the Navigation Menu results in an error archireef_spdataset

I made sure this was not a problem on databases that were configured as Specify expects. To test this you can:

  • Create a WorkBench dataset (Any Base Table)
  • (should be optional) upload the dataset
  • Try and merge the agent who created the Dataset

From https://github.com/specify/specify7/issues/3874#issuecomment-1659219000

To prevent this issue from popping up again, I have added the three missing columns to the spdataset table:

You should no longer receive this error from that database!