Re: [HACKERS] (stupid) bug in agg_select_candidate

Поиск
Список
Период
Сортировка
Искать

Re: [HACKERS] (stupid) bug in agg_select_candidate

От:
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
Дата:
>   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));
  				}
  			}
  

(stupid) bug in agg_select_candidate

От:
David Sauer <davids@iol.cz>
Дата:

Re: [HACKERS] (stupid) bug in agg_select_candidate

От:
David Sauer <davids@iol.cz>
Дата:
FAQ