Re: Unable to create a PL/PGSL function : Did I miss something ? - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Unable to create a PL/PGSL function : Did I miss something ?
Date
Msg-id 20040208011359.GA27476@svana.org
Whole thread Raw
In response to Unable to create a PL/PGSL function : Did I miss something ?  ("Bruno BAGUETTE" <pgsql-ml@baguette.net>)
List pgsql-general
On Sun, Feb 08, 2004 at 01:47:51AM +0100, Bruno BAGUETTE wrote:
> Hello,
>
> I'm trying to build a PL/PGSQL function that will be called by a trigger
> which will update a table named 'mview_contacts'. That table plays the
> role of a materialized view.
>
> The 'plpgsql' language is installed on that database (there are already
> several functions inside) but I don't understand why I can't store that
> function in the database.

You forgot to escape some quotes:

> quote_literal('people') || '',''
                ^      ^
>                 || quote_ident('cnt_initial') || '' = ''
                                               ^           ^
> || quote_literal('LOWER(SUBSTR(NEW.org_name, 1, 1))')
                   ^                                 ^

>                 || quote_ident('cnt_name') || '' = '' ||
> quote_literal('NEW.org_name') || '',''
>                 || quote_ident('cnt_type') || '' = '' ||
> quote_literal('organization') || '',''
>                 || quote_ident('cnt_initial') || '' = ''
> || quote_literal('LOWER(SUBSTR(NEW.org_name, 1, 1))')

Several in there

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> (... have gone from d-i being barely usable even by its developers
> anywhere, to being about 20% done. Sweet. And the last 80% usually takes
> 20% of the time, too, right?) -- Anthony Towns, debian-devel-announce

Attachment

pgsql-general by date:

Previous
From: "Bruno BAGUETTE"
Date:
Subject: Unable to create a PL/PGSL function : Did I miss something ?
Next
From: Josh Berkus
Date:
Subject: Fwd: Favorite DB poll on ORA