nhost icon indicating copy to clipboard operation
nhost copied to clipboard

Missing validation for new table's name

Open robertkasza opened this issue 9 months ago • 4 comments

Describe the bug When creating a table the dashboard does not validate the length of the new table's name and it causes the metadata request to fail because the table was created with a shortened name.

To Reproduce Steps to reproduce the behavior:

  1. Go to one of your projects' database page
  2. Click on the New table button
  3. Add a very looooooooooooooooooooooooooooooong name for the new table
  4. Finish creating the table
  5. Click on save
  6. See the following error:

Error: Inconsistent object: no such table/view exists in source: "a_very_loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_table_naaaaaaaaaaaaaaaame"

Expected behavior The form should validate the length of the table's name and should show an error and prevent the table from being created.

Screenshots

Image

Additional context Also the error message is pushing out the clear button from the error box.

Payload when creating the table:

{
  "args": [
    {
      "type": "run_sql",
      "args": {
        "cascade": true,
        "read_only": false,
        "source": "default",
        "sql": "CREATE TABLE public.a_very_loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_table_naaaaaaaaaaaaaaaame (id uuid NOT NULL, PRIMARY KEY (id));"
      }
    }
  ],
  "type": "bulk",
  "version": 1
}

Payload for metadata request:

{
  "args": [
    {
      "args": {
        "source": "default",
        "table": {
          "schema": "public",
          "name": "a_very_loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_table_naaaaaaaaaaaaaaaame"
        }
      },
      "type": "pg_track_table"
    }
  ],
  "type": "bulk",
  "source": "default",
  "version": 1
}

robertkasza avatar Mar 18 '25 08:03 robertkasza

Can I work on this issue??

yash15-exe avatar Apr 10 '25 07:04 yash15-exe

Hi, @yash15-exe! Feel free to start working on it and let me know if you need anything.

robertkasza avatar Apr 10 '25 08:04 robertkasza

@robertkasza Sure

yash15-exe avatar Apr 10 '25 09:04 yash15-exe

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 07 '25 12:10 stale[bot]