Skip site navigation (1) Skip section navigation (2)

Re: Line length in pl/pgsql function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David Olbersen" <DOlbersen(at)stbernard(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Line length in pl/pgsql function
Date: 2004-03-17 20:03:01
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
"David Olbersen" <DOlbersen(at)stbernard(dot)com> writes:
> The errors from psql are attached as psql-errors.txt
> The file with the function is attached as =
> test_ratedby_category_lang.plsql
> The postgresql.conf and current postmaster.opts are attached as well.

Hate to tell you this, but it's just pilot error.  You've got comments
like these embedded in the plpgsql function:

            ELSIF cat = ''none'' THEN
                -- none,none = don't show the languages, or categories (whaaat?)
                FOR result IN 

That quote in "don't" has to be doubled.  Remember this whole thing is a
giant string literal as far as the outer CREATE FUNCTION syntax is
concerned.  The fact that the quote is within a comment in terms of the
plpgsql syntax doesn't mean a thing to the outer string-literal parser.

This'll all get a *lot* easier in 7.5 when you can use dollar-quoting
instead of having to double quote marks in function bodies ...

			regards, tom lane

PS: note to hackers: Fabien's new error localization code does a pretty
decent job of fingering the problem.  When I loaded this test file into
CVS tip I got

psql:test_ratedby_category_lang.plsql:95: ERROR:  syntax error at or near "t" at character 3419
psql:test_ratedby_category_lang.plsql:95: LINE 81:                 -- none,everything = don't show the language...
psql:test_ratedby_category_lang.plsql:95:                                                   ^

In response to

pgsql-sql by date

Next:From: David OlbersenDate: 2004-03-17 20:07:14
Subject: Re: Line length in pl/pgsql function
Previous:From: David OlbersenDate: 2004-03-17 19:52:05
Subject: Re: Line length in pl/pgsql function

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group