Skip to content
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

fix: Escape single quote properly and when updating single select default value #7197

Merged
merged 3 commits into from
Dec 12, 2023

Conversation

pranavxc
Copy link
Member

Change Summary

Change type

  • feat: (new feature for the user, not a new feature for build script)
  • fix: (bug fix for the user, not a fix to a build script)
  • docs: (changes to the documentation)
  • style: (formatting, missing semi colons, etc; no production code change)
  • refactor: (refactoring production code, eg. renaming a variable)
  • test: (adding missing tests, refactoring tests; no production code change)
  • chore: (updating grunt tasks etc; no production code change)

Test/ Verification

Provide summary of changes.

Additional information / screenshots (optional)

Anything for maintainers to be made aware of

…ing the col object

Signed-off-by: Pranav C <pranavxc@gmail.com>
@pranavxc pranavxc requested a review from dstala December 11, 2023 09:14
…ing the col object

Signed-off-by: Pranav C <pranavxc@gmail.com>
Signed-off-by: Pranav C <pranavxc@gmail.com>
Copy link
Contributor

github-actions bot commented Dec 11, 2023

Uffizzi Preview deployment-42511 was deleted.

Copy link
Member

@dstala dstala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works for general scenarios : 'abc'
Failed for a'a''a

[Nest] 45560  - 12/12/2023, 11:58:09 AM   ERROR [GlobalExceptionFilter] Cannot read properties of undefined (reading 'base_id')
TypeError: Cannot read properties of undefined (reading 'base_id')
    at ViewsService.viewList (/Users/rajuudava/NocoDB/nocodb/packages/nocodb/src/services/views.service.ts:80:21)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ViewsController.viewList (/Users/rajuudava/NocoDB/nocodb/packages/nocodb/src/controllers/views.controller.ts:34:7)
ALTER TABLE `nc_gojj___Features` 
    ADD
    COLUMN `select` set('ab','bc','''de''') NULL
    DEFAULT '\'de\'';
╔══════════════════════════════════════════════════════════════════════════════╗║                                                                              ║║   EXCEPTION OCCURED!! in MysqlClient @ tableUpdate                           ║║   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -    ║║   - - - - - - - - - - - - - - - - - - - - - -                                ║║   MESSAGE:                                                                   ║║   ALTER TABLE `nc_gojj___Features`                                           ║║   ADD                                                                        ║║   COLUMN `title6` enum('a''a''''a','abc','abcd') NULL                        ║║   DEFAULT 'a\'\'a\'\'\'\'a'; - Invalid default value for 'title6'            ║║                                                                              ║║   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -    ║║   - - - - - - - - - - - - - - - - - - - - - -                                ║║   CODE:                                                                      ║║   ER_INVALID_DEFAULT                                                         ║║                                                                              ║║   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -    ║║   - - - - - - - - - - - - - - - - - - - - - -                                ║║   STACK:                                                                     ║║   Error: ALTER TABLE `nc_gojj___Features`                                    ║║   ADD                                                                        ║║   COLUMN `title6` enum('a''a''''a','abc','abcd') NULL                        ║║   DEFAULT 'a\'\'a\'\'\'\'a'; - Invalid default value for 'title6'            ║║   at Packet.asError (/Users/rajuudava/NocoDB/nocodb/node_modules/.pnpm/mys   ║║   ql2@3.6.5/node_modules/mysql2/lib/packets/packet.js:728:17)                ║║   at Query.execute (/Users/rajuudava/NocoDB/nocodb/node_modules/.pnpm/mysq   ║║   l2@3.6.5/node_modules/mysql2/lib/commands/command.js:29:26)                ║║   at Connection.handlePacket (/Users/rajuudava/NocoDB/nocodb/node_modules/   ║║   .pnpm/mysql2@3.6.5/node_modules/mysql2/lib/connection.js:478:34)           ║║   at PacketParser.onPacket (/Users/rajuudava/NocoDB/nocodb/node_modules/.p   ║║   npm/mysql2@3.6.5/node_modules/mysql2/lib/connection.js:97:12)              ║║   at PacketParser.executeStart (/Users/rajuudava/NocoDB/nocodb/node_module   ║║   s/.pnpm/mysql2@3.6.5/node_modules/mysql2/lib/packet_parser.js:75:16)       ║║   at Socket.<anonymous> (/Users/rajuudava/NocoDB/nocodb/node_modules/.pnpm   ║║   /mysql2@3.6.5/node_modules/mysql2/lib/connection.js:104:25)                ║║   at Socket.emit (node:events:513:28)                                        ║║   at Socket.emit (node:domain:489:12)                                        ║║   at addChunk (node:internal/streams/readable:324:12)                        ║║   at readableAddChunk (node:internal/streams/readable:297:9)                 ║║                                                                              ║║   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -    ║║   - - - - - - - - - - - - - - - - - - - - - -                                ║║                                                                              ║║                                                                              ║╚══════════════════════════════════════════════════════════════════════════════╝
Error: ALTER TABLE `nc_gojj___Features` 
    ADD
    COLUMN `title6` enum('a''a''''a','abc','abcd') NULL
    DEFAULT 'a\'\'a\'\'\'\'a'; - Invalid default value for 'title6'
    at Packet.asError (/Users/rajuudava/NocoDB/nocodb/node_modules/.pnpm/mysql2@3.6.5/node_modules/mysql2/lib/packets/packet.js:728:17)
    at Query.execute (/Users/rajuudava/NocoDB/nocodb/node_modules/.pnpm/mysql2@3.6.5/node_modules/mysql2/lib/commands/command.js:29:26)
    at Connection.handlePacket (/Users/rajuudava/NocoDB/nocodb/node_modules/.pnpm/mysql2@3.6.5/node_modules/mysql2/lib/connection.js:478:34)
    at PacketParser.onPacket (/Users/rajuudava/NocoDB/nocodb/node_modules/.pnpm/mysql2@3.6.5/node_modules/mysql2/lib/connection.js:97:12)
    at PacketParser.executeStart (/Users/rajuudava/NocoDB/nocodb/node_modules/.pnpm/mysql2@3.6.5/node_modules/mysql2/lib/packet_parser.js:75:16)
    at Socket.<anonymous> (/Users/rajuudava/NocoDB/nocodb/node_modules/.pnpm/mysql2@3.6.5/node_modules/mysql2/lib/connection.js:104:25)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9) {
  code: 'ER_INVALID_DEFAULT',
  errno: 1067,
  sqlState: '42000',
  sqlMessage: "Invalid default value for 'title6'",
  sql: 'ALTER TABLE `nc_gojj___Features` \n' +
    '    ADD\n' +
    "    COLUMN `title6` enum('a''a''''a','abc','abcd') NULL\n" +
    "    DEFAULT 'a\\'\\'a\\'\\'\\'\\'a';"
}
[Nest] 45560  - 12/12/2023, 11:59:04 AM   ERROR [GlobalExceptionFilter] ALTER TABLE `nc_gojj___Features` 
    ADD
    COLUMN `title6` enum('a''a''''a','abc','abcd') NULL
    DEFAULT 'a\'\'a\'\'\'\'a'; - Invalid default value for 'title6'

@dstala dstala merged commit d516664 into develop Dec 12, 2023
22 checks passed
@dstala dstala deleted the fix/select-default-value branch December 12, 2023 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Bug: [MySQL] unable to use set select field with single quotes as default value
2 participants