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

Alter table with TEXT DEFAULT '' misbehaves #15363

Closed
patsib opened this issue Jun 28, 2019 · 3 comments
Closed

Alter table with TEXT DEFAULT '' misbehaves #15363

patsib opened this issue Jun 28, 2019 · 3 comments
Assignees
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
Milestone

Comments

@patsib
Copy link

patsib commented Jun 28, 2019

Changing the default value of a field with type TEXT to nothing (empty string), adds two quotes as a new default.

Given a table 'test' with a field 'content' as TEXT.

Reproduce v1:

  • open table structure view
  • click on CHANGE for field 'content'
  • change field settings to DEFAULT 'As defined' and leave default value blank.

Reproduce v2:

  • go to SQL and
  • ALTER TABLE `test` CHANGE `content` `content` TEXT NOT NULL DEFAULT '';

Expected:

  • In the structure view, the default value should be empty and not show '' (compare to type varchar).
  • INSERT form should not add '' to the text field but rather leave it empty.

Environment:

  • Operating system: Win10
  • Web server: Apache/2.4.39 (Win64) OpenSSL/1.1.1c
  • Database version: 10.3.15-MariaDB
  • PHP version: PHP/7.3.6
  • phpMyAdmin version: 4.9.0.1
  • Browser: Any
  • Operating system: Any

Verified the problem with a completely different linux environment, but i don't have the specs right now.

@patsib patsib changed the title Alter table with TEXT DEFAULT '' fails Alter table with TEXT DEFAULT '' misbehaves Jun 28, 2019
@williamdes williamdes added the Bug A problem or regression with an existing feature label Jun 28, 2019
@williamdes williamdes added this to Needs triage in issues via automation Jun 28, 2019
@patsib
Copy link
Author

patsib commented Jun 28, 2019

image

image

image

image

@williamdes williamdes moved this from Needs triage to to be fixed soon in issues Jul 10, 2019
@nunoperalta
Copy link

Just reproduced this and I was going to open an issue!

@williamdes williamdes self-assigned this Aug 15, 2019
@williamdes williamdes added this to the 4.9.1 milestone Aug 15, 2019
@williamdes
Copy link
Member

williamdes commented Aug 15, 2019

Test table:

CREATE TABLE `issue-15363` (
  `id` int(11) DEFAULT NULL,
  `empty text` text DEFAULT '',
  `empty varchar` varchar(25) NOT NULL DEFAULT '',
  `really empty string` varchar(25) NOT NULL DEFAULT '''''',
  `really empty text` text NOT NULL DEFAULT '\'\'',
  `l'eau dans un varchar` varchar(25) NOT NULL DEFAULT 'l''eau ',
  `l'eau 2` text NOT NULL DEFAULT 'l\'eau',
  `l'eau dans un texte` text NOT NULL DEFAULT 'l\'eau',
  `l'eau` varchar(25) NOT NULL DEFAULT 'l''eau \\n \\n \\t l''eau',
  `l'eau 3` text NOT NULL DEFAULT 'l\'eau \\n \\n \\t l\'eau'
) ENGINE=InnoDB;

@williamdes williamdes added the has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete label Aug 20, 2019
williamdes added a commit that referenced this issue Aug 20, 2019
Fixes: #15363
Pull-request: #15409

Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit that referenced this issue Aug 20, 2019
Signed-off-by: William Desportes <williamdes@wdes.fr>
issues automation moved this from to be fixed soon to Closed Aug 20, 2019
williamdes added a commit that referenced this issue Aug 20, 2019
Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit that referenced this issue Aug 22, 2019
Signed-off-by: William Desportes <williamdes@wdes.fr>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
issues
  
Closed
Development

No branches or pull requests

3 participants