mysql table: decimal number default 0 - mysql

After I typed 13,10 into the value box as shown in the image1, it comes up with decimal(13,0). What's the problem?
Thanks.

You might be seeing the effect of this bug, which exists with version 4.6.4 and will be fixed with the upcoming version 4.6.5. You can also apply the patch yourself.

The preview may be incorrect, but try saving it and see if that is correct. In my testing this is working, but we may be on different versions. Also, if it saves incorrectly (if there is a bug in phpMyAdmin) you can always do an alter (Change button) and see if that block of code handles it correctly. If all else fails, there's always the command line to sort it out.

Related

Know the result of 'insertIgnore' with Jetbrains Exposed

I'm using Jetbrains Exposed to interact with my MySQL 5.7 database.
The problem I have is with insertIgnore.
As I see it, there is no way of knowing the result of the statement. MySQL itself will return either 1 if a row was inserted, or 0 if it was ignored because of an error (in my case, duplicate key error).
But I can't see any way to see that from the result of the insert.
My code is basically just:
transaction(database) {
MyTable.insertIgnore {
it[uniqueColumn] = "foo"
}
}
Executed twice where uniqueColumn is unique. There is no difference in the results, although the first time is successful and the second time isn't.
It seems like an easy thing to have the resulted rows of that statement be represented somewhere, but I couldn't find anything myself or when googling.
I had a similar problem and I solved it using IntIdTable instead of Table
And insertIgnoreAndGetId instead of insertIgnore
Maybe it will help anyone

useLegacyAuth=1 in MySQL Workbench 6.3 (Win x64) fails with Wrong type passed, expected sql::SQLString

There's no way to make this work.
I tried all kind of combinations, all failing.
useLegacyAuth=1
useLegacyAuth="1"
useLegacyAuth='1'
useLegacyAuth=`1`
Old one but still useful, figured I would update with what I know.
if you put quotes around the whole thing it should work.
"useLegacyAuth=1"

A SQL query that used to work does not work anymore

I have an SQL query that works on older version of MySQL4 but won't work on my current version of 5.5
I'm hoping someone can see what I can't see with this.
select tblprefix_groups_permissions.permission_name
from tblprefix_groups_permissions, tblprefix_users, tblprefix_permissions
where tblprefix_groups_permissions.permission_name = tblprefix_permissions.permission_name
and tblprefix_groups_permissions.group_id = tblprefix_users.group_id
and (tblprefix_users.user_id = '==NUMERIC ID=='
and (tblprefix_permissions.permission_name = 'ADMIN::SETTINGS::VIEW'
or tblprefix_permissions.permission_name = 'ALL'))
The SQL statement should be pretty self explanitory as to what it does, I don't see where the hangup could be. It is suppost to return a list if it returns nothing then the user is rejected.
It looks like you have wrongly placed the quotes here:
ADMIN::SETTINGS::VIEW''
Anyway... are you sure that works in MySQL 4?
BTW, you can remove the outer brackets.
The statement is correct, I overlooked the fact that the statement also checks to make sure the Permission is in the Master Permissions table ie: tblprefix_permissions.permission_name I had not put the permission into the Master Permissions table yet
So that makes me stupid or just tired LOL sorry guys, good work though and thanks for the quick responses

How do you add comments to MySQL queries, so they show in logs?

I want to be able to add a little note, at the beginning of each query, so when I see it in the processlist, or "mytop", I can tell where it’s running.
Is something like this possible?
I am not sure this would work, but it is worth trying.
Simply add "/* some comment or tag */ " before whatever SQL query is sent normally.
It is possible that MySQL server will remove this comment as part of its query analysis/preparation, but it may just leave it as well, so it shows as such in logs and other monitoring tools.
In case the comments get stripped away, and assuming SELECT queries, a slight variation on the above would be to add a calculated column as the first thing after SELECT, something like
SELECT IF('some comment/tag' = '', 1, 0) AS BogusMarker, here-start-the-original-select-list
-- or
SELECT 'some [short] comment/tag' AS QueryID, here-start-the-original-select-list
This approach has the drawback of introducing an extra column value, with each of the results row. The latter form, actually uses the "comment/tag" value as this value, which may be helpful for debugging purposes.
I discovered this today:
MySQL supports the strange syntax:
/*!<min-version> code here */
to embed code that will only be interpreted by MySQL, and only MySQL of a specified minimum version.
This is documented at 9.7 Comments (used by mysqldump, for example).
Such comments will not be parsed out, and included in the processlist, unlike normal ones, and that even if the code is not actually executed.
So you can do something like
/*!999999 comment goes here */ select foo from bla;
to have a comment that will show up in the processlist, but not alter the code. (Until MySQL developers decide to bloat their release numbering and release a version numbered over 99.99.99, in which case you will just have to add another digit.)

MySQL 5.1 command line problem: delete last char doesn't work

I can't delete the last character in a given line in the MySQL CLI, if I press "END", it will jump on the character and if I press "DEL", it will delete the char before that (like backspace).
Does anybody know a fix for that issue?
I use MySQL 5.1.31-1ubuntu2-log with normal shell access.
Thank you for assistance!
The problem appears different on Linux/Windows.
Our solution was to add this line to ~/.editrc
bind -e
to see how editrc works:
https://www.mirbsd.org/htman/i386/man5/editrc.htm
Erm ... Use cursor keys?
I heard recently that Shift-Del or Shift-Backspace works on some systems (mainly Mac), perhaps it can be used as a workaround for Ubuntu too?
Update: Does the End + Del/BS work normally when you're not inside MySQL prompt?