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

current_timestamp() stringified on INSERT #16892

Closed
Simbiat opened this issue May 9, 2021 · 8 comments · Fixed by #16924
Closed

current_timestamp() stringified on INSERT #16892

Simbiat opened this issue May 9, 2021 · 8 comments · Fixed by #16924
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

@Simbiat
Copy link
Contributor

Simbiat commented May 9, 2021

Describe the bug

When using "Insert" page on a table, which has columns with default value of current_timestamp() this function is treated as a string value both in "Preview SQL" and when actually inserting rows.

To Reproduce

Steps to reproduce the behavior:

  1. Create a table with a date/datetime column with default value current_timestamp()
  2. Try to insert a row into it using myAdmin'a special page
  3. Check "Preview SQL" to see value of 'current_timestamp()' instead of current_timestamp()
  4. Try running it to get error, that data got truncated (and get 0 date).

Expected behavior

Function is used as is, not as a string value

Screenshots

N/A

Server configuration

  • Operating system: Windows 10
  • Web server: Apache 2.4.46-win64-VS16
  • Database version: mariaDB 10.5.9
  • PHP version: 8.0.3
  • phpMyAdmin version: 5.1

Client configuration

  • Browser: MS Edge
  • Operating system: Windows 10

Additional context

N/A

@williamdes williamdes added the Bug A problem or regression with an existing feature label May 10, 2021
@williamdes williamdes added this to the 5.1.1 milestone May 10, 2021
@williamdes williamdes added this to Needs triage in issues via automation May 10, 2021
@williamdes williamdes moved this from Needs triage to to be fixed soon in issues May 10, 2021
@williamdes
Copy link
Member

Hi @Simbiat
Thank you for the report !

Hi @shucon
Could you please have a look ?

@shucon
Copy link
Contributor

shucon commented May 12, 2021

Sure

@williamdes
Copy link
Member

I can not reproduce this issue on MariaDB 10.4 or 10.5

INSERT INTO `test` (`id`, `str`, `decimal_number`, `json`, `ct`) VALUES ('2', '2', '2', '2', current_timestamp());

@williamdes williamdes modified the milestones: 5.1.1, 5.1.2 May 14, 2021
@Simbiat
Copy link
Contributor Author

Simbiat commented May 14, 2021

@williamdes, is this a manual INSERT you created, or the one, that myAdmin generated on INSERT page? The one like index.php?route=/table/change&db=dbname&table=tablename

@williamdes
Copy link
Member

@williamdes, is this a manual INSERT you created, or the one, that myAdmin generated on INSERT page? The one like index.php?route=/table/change&db=dbname&table=tablename

I copied the query from the box after an insert from the page

@Simbiat
Copy link
Contributor Author

Simbiat commented May 14, 2021

https://www.youtube.com/watch?v=0_7nit6ilrI (just realized I could have used nVidia's Shadowplay or whatever, not my phone).
For me it's replicable on both 10.2.38 and 10.5.9

@williamdes
Copy link
Member

https://www.youtube.com/watch?v=0_7nit6ilrI (just realized I could have used nVidia's Shadowplay or whatever, not my phone).
For me it's replicable on both 10.2.38 and 10.5.9

Awesome!
I will try to replicate this, thanks for the good video

@shucon
Copy link
Contributor

shucon commented May 27, 2021

Hey @Simbiat, thanks for the video. I was able to replicate the issue and will try to fix it.

shucon added a commit to shucon/phpmyadmin that referenced this issue May 27, 2021
… date field

Signed-off-by: Saksham Gupta <shucon01@gmail.com>
shucon added a commit to shucon/phpmyadmin that referenced this issue May 27, 2021
… date field

Signed-off-by: Saksham Gupta <shucon01@gmail.com>

Add tests and fix condition

Signed-off-by: Saksham Gupta <shucon01@gmail.com>
@williamdes williamdes modified the milestones: 5.1.2, 5.1.1 May 27, 2021
@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 May 27, 2021
MauricioFauth added a commit that referenced this issue May 27, 2021
Fixes #16892: current_timestamp() stringified on INSERT for date field
@MauricioFauth MauricioFauth self-assigned this May 27, 2021
MauricioFauth added a commit that referenced this issue May 27, 2021
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
issues automation moved this from to be fixed soon to Closed May 27, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 28, 2022
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

Successfully merging a pull request may close this issue.

4 participants