[MDEV-20687] [SOLVED] "select field1,field2,fieldN" always return zero, but not "select *" Created: 2019-09-27 Updated: 2019-09-27 Resolved: 2019-09-27 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Information Schema, N/A |
| Affects Version/s: | 10.4.8 |
| Fix Version/s: | 10.4.8 |
| Type: | Bug | Priority: | Major |
| Reporter: | anovsiradj | Assignee: | Anel Husakovic |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | Compatibility, mysql | ||
| Environment: |
ubuntu = 1604 xenial / |
||
| Attachments: |
|
| Description |
|
[SOLVED] after replace "USING(...)" with explicit "JOIN ... ON(...)" all good. after migrating to mariadb yesterday, i just noticed that some of my storedprocedures suddenly stop working. its related to "information_schema", for retreiving a table primary/foreign key column(s). when using "select" syntax, if i listing column(s) name, the result is always zero. ######################### SELECT * /* WORKING */ FROM `information_schema`.`table_constraints` WHERE `table_schema` = database() AND `table_name` = 'something' ORDER BY `constraint_type` DESC, `column_name` ASC; ######################### i have trying to run that sql from CLI, still not working (only "*" that work). if running that sql on phpmyadmin/pma, it will always result nothing (using "*" or not). there is something strange with "database()" too. (sorry for my english) |
| Comments |
| Comment by Anel Husakovic [ 2019-09-27 ] | |
|
Hi anovsiradj, | |
| Comment by anovsiradj [ 2019-09-27 ] | |
|
yes. ######################### working sql: SELECT * ORDER BY `constraint_type` DESC, `column_name` ASC; ######################### not working sql: SELECT `column_name`,`constraint_type` FROM `information_schema`.`table_constraints` WHERE `table_schema` = database() AND `table_name` = 'your_table_name' ORDER BY `constraint_type` DESC, `column_name` ASC; | |
| Comment by Anel Husakovic [ 2019-09-27 ] | |
|
Sorry, you updated your question with [SOLVED] does it mean we can close this MDEV ? And yes you should specify which database you are using with
clause. | |
| Comment by anovsiradj [ 2019-09-27 ] | |
|
yes, you can close this mdev. for reference, i have upload a screencast. |