Re: BUG #2451: Short column names return no values within function
От | Michael Fuhr |
---|---|
Тема | Re: BUG #2451: Short column names return no values within function |
Дата | |
Msg-id | 20060523155118.GA51120@winnie.fuhr.org обсуждение исходный текст |
Ответ на | BUG #2451: Short column names return no values within function ("Alex Weslowski" <aweslowski@rpa.com>) |
Список | pgsql-bugs |
On Tue, May 23, 2006 at 03:27:01AM +0000, Alex Weslowski wrote: > Below is code for duplicating this error. Fields "Peg" and "Rs03" and "Rs12" > are absent from returned record (either Record or Cursor) even though the > values in the table are not null. The function declares variables with the same names as table columns; that makes queries like "SELECT Symbol, RS03, RS12, Peg ..." ambiguous because it's not clear whether those names refer to columns or to variables. > Problem might be related to type conversion (NULL converts to '' which has > no meaning to INT or NUMERIC). > > Problem is fixed by renaming columns to "Peg_Ratio" and "RS03RS" and > "RS12RS". So, there is something more going on here, related to length of > column name. Type conversion and label length aren't relevant -- the problem is due to using the same label to refer to multiple things. Use different names for the variables or qualify the column names in the query ("SELECT t.symbol, t.rs03, t.rs12, t.peg FROM testbug AS t ..."). -- Michael Fuhr
В списке pgsql-bugs по дате отправления: