From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | John Wells <jb(at)sourceillustrated(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: pl/pgsql frustration |
Date: | 2005-08-14 04:01:09 |
Message-ID: | 20050814040109.GA47579@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sat, Aug 13, 2005 at 11:19:25PM -0400, John Wells wrote:
> I'm trying to write a simple function that will return a table's actual
> row count on PostgreSQL 7.4. I've tried two different versions (see
> below), both with the same result:
>
> "ERROR: syntax error at or near "select" at character 127"
You're having quoting problems; see "Handling of Quotation Marks"
in the "Tips for Developing in PL/pgSQL" section of the documentation:
http://www.postgresql.org/docs/7.4/interactive/plpgsql-development-tips.html
PostgreSQL 8.0 simplifies quoting issues by allowing an alternate
style known as "dollar quoting":
http://www.postgresql.org/docs/8.0/interactive/plpgsql-development-tips.html
In addition, the functions you posted have "quote_ident" misspelled
and they don't have RETURN statements. You might also want to
create the functions as STRICT (aka RETURNS NULL ON NULL INPUT).
See the CREATE FUNCTION documentation for more info:
http://www.postgresql.org/docs/7.4/interactive/sql-createfunction.html
--
Michael Fuhr
From | Date | Subject | |
---|---|---|---|
Next Message | Kostas Karadamoglou | 2005-08-14 09:43:05 | Design problem About application related with cached rows |
Previous Message | John Wells | 2005-08-14 03:38:07 | Re: pl/pgsql frustration |