problem with coalesce

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

problem with coalesce

Oleg Bartunov
Hi there,

I don't understand why this select doesn't works:

regression=# select coalesce(
  tp_rewrite_substitute(ARRAY[query, test.target, test.sample]),
  query)
      from test,to_tsquery('new2 & york2 & hotel') as query
      where query @ test.target;

ERROR:  column "query.query" must appear in the GROUP BY clause or be used in an aggregate function

as a workaround I could explicitly specify query, but this doesn't looks
nice

regression=# select coalesce(
  tp_rewrite_substitute(ARRAY[query, test.target, test.sample]),
  to_tsquery('new2 & york2 & hotel'))
      from test,to_tsquery('new2 & york2 & hotel') as query
      where query @ test.target;


  Regards,
  Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [hidden email], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org
Reply | Threaded
Open this post in threaded view
|

Re: problem with coalesce

Josh berkus
Oleg,

> ERROR:  column "query.query" must appear in the GROUP BY clause or be
> used in an aggregate function

Apparently the parser thinks you have an aggregate function in there.   Do
you?

--
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org