Re: ECPG: non-integer constant in group by

Поиск
Список
Период
Сортировка
От Andrew - Supernews
Тема Re: ECPG: non-integer constant in group by
Дата
Msg-id slrnegl1v4.2ea3.andrew+nonews@atlantis.supernews.net
обсуждение исходный текст
Ответ на ECPG: non-integer constant in group by  (Poul Jensen <flyvholm@gfy.ku.dk>)
Список pgsql-general
On 2006-09-15, Poul Jensen <flyvholm@gfy.ku.dk> wrote:
> 2) The code below was meant to find the # of distinct elements for many
> columns, but fails with the message
>     sql error 'non-integer constant in GROUP BY'
>     thrown at the EXEC SQL EXECUTE statement. What is the problem?

>   char dbnm[50], *stmt = "SELECT ? FROM beamdata GROUP BY ?;";

That statement is not legal - parameters can only be used to substitute
_data_, not identifiers or syntax.

You would have to interpolate the column name directly into the query
(remembering to quote it with "" if needed) rather than use a parameter
for it.

--
Andrew, Supernews
http://www.supernews.com - individual and corporate NNTP services

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

Предыдущее
От: Achilleas Mantzios
Дата:
Сообщение: Postgresql 7.4 migration to (partially) new disks
Следующее
От: nuggets72@free.fr
Дата:
Сообщение: Installation with sources or with packages