Re: [HACKERS] (stupid) bug in agg_select_candidate

Поиск
Список
Период
Сортировка
От Thomas G. Lockhart
Тема Re: [HACKERS] (stupid) bug in agg_select_candidate
Дата
Msg-id 3680950B.6C7E98BB@alumni.caltech.edu
обсуждение исходный текст
Ответ на (stupid) bug in agg_select_candidate  (David Sauer <davids@iol.cz>)
Список pgsql-hackers
>   I'm trying postgres 6.4.1 and I have problem with select command:
> > create table t( text_column text );
> > select sum( text_column ) from t;
> This command makes no sense, but causes crash in backend:

Thanks for finding this. It was in new code for automatic type matching
and coersion on aggregate functions to help implement aggregates for the
string types.

I've enclosed a simple patch which fixes the problem, and which at the
same time makes a nicer warning message as a result:

postgres=> select sum(c) from cc;
ERROR:  Unable to select an aggregate function sum(bpchar)
postgres=> select min(c) from cc;
min
----------
abc
(1 row)

Will commit to the cvs tree sometime soon; let me know if you have any
continuing problems. Good luck.

                      - Tom*** ../src/backend/parser/parse_func.c.orig    Sun Dec 20 17:35:27 1998
--- ../src/backend/parser/parse_func.c    Wed Dec 23 06:50:44 1998
***************
*** 225,231 ****
              }
          }
          /* otherwise, don't bother keeping this one around... */
!         else
          {
              last_candidate->next = NULL;
          }
--- 225,231 ----
              }
          }
          /* otherwise, don't bother keeping this one around... */
!         else if (last_candidate != NULL)
          {
              last_candidate->next = NULL;
          }
***************
*** 399,406 ****
                  }
                  else
                  {
!                     elog(ERROR,"Unable to select an aggregate function for type '%s'",
!                          typeidTypeName(basetype));
                  }
              }

--- 399,406 ----
                  }
                  else
                  {
!                     elog(ERROR,"Unable to select an aggregate function %s(%s)",
!                          funcname, typeidTypeName(basetype));
                  }
              }


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Thomas G. Lockhart"
Дата:
Сообщение: Re: [HACKERS] Problems on NUMERIC
Следующее
От: David Sauer
Дата:
Сообщение: Re: [HACKERS] (stupid) bug in agg_select_candidate