| От | Tom Lane |
|---|---|
| Тема | Re: Count(*) throws error |
| Дата | |
| Msg-id | 3405.1184190163@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Count(*) throws error ("Jasbinder Singh Bali" <jsbali@gmail.com>) |
| Список | pgsql-general |
"Jasbinder Singh Bali" <jsbali@gmail.com> writes:
> I'm using the following statement in my plpgsql function
> SELECT INTO no_rows COUNT(*) FROM tbl_concurrent;
> I have decalred no_rows int4 and initialized it to zero
> Running the function throws the following error:
> ERROR: syntax error at or near "(" at character 13
> QUERY: SELECT $1 (*) FROM tbl_concurrent
I'll bet a nickel you have a local variable named "count" in that
function, and plpgsql is blindly trying to substitute its value into
the SQL query. The replacement of "COUNT" by " $1 " in the query
text is the tip-off.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера