[MDEV-3171] LP:881710 - Column name PID returns NULL when called via SP Created: 2011-10-25 Updated: 2012-10-04 Resolved: 2012-10-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Robert (Inactive) | Assignee: | Unassigned |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
I have a very simple table like this: CREATE TABLE `path` ( And a SP: create procedure test(path VARCHAR(2000)) DECLARE pid INT UNSIGNED; SELECT PID FROM path LIMIT 1; end| Calling the procedure test() returns NULL. Upper and lower case doesn't matter. Renaming the column to something different like alter table path change PID id int unsigned; returns the correct result. |
| Comments |
| Comment by Elena Stepanova [ 2012-06-01 ] |
|
Re: Column name PID returns NULL when called via SP Is it still a problem? From what I see in your code, you redefine pid in your procedure (without assigning a value to it), so PID in the SELECT is the variable name, not the column name. When you rename the column into something else, it is not masked any longer, so a value from the table is returned. Alternatively, you could provide the full name in SELECT (SELECT path.PID FROM path LIMIT 1). Do you have a reason to expect different behavior? |
| Comment by Rasmus Johansson (Inactive) [ 2012-06-01 ] |
|
Launchpad bug id: 881710 |