Re: Question about functions - Mailing list pgadmin-support

From Dave Page
Subject Re: Question about functions
Date
Msg-id FED2B709E3270E4B903EB0175A49BCB1293342@dogbert.vale-housing.co.uk
Whole thread Raw
List pgadmin-support
> -----Original Message-----
> From: Manley, Jim [mailto:JMANLEY@Trnsworld.com]
> Sent: 03 April 2002 17:01
> To: 'dpage@pgadmin.org'
> Subject: Question about functions
>
>
> Hi Dave,

Hi Jim,

Please use the pgadmin-support@postgresql.org list for future support
issues.

> I am having a problem developing advanced functions in
> pgAdmin. I want to do something like this:
>
> CREATE FUNCTION get_city (varchar) RETURNS varchar
> AS '
>
> DECLARE
>
>  vLastName  ALIAS FOR $1;
>  vCity VARCHAR;
>
> BEGIN
>  SELECT city INTO vCity
> FROM customer
> WHERE last_name = vLastName;
>
> END; '
>
> language 'sql';
            ^^^

Your code is plpgsql so the parser doesn't understand it when you specify it
as sql (kinda like writing C++ in Microsoft Visual Basic).

Specify plpgsql as the language and you should be OK (note, this isn't
installed by default with PostgreSQL, you may need to run the createlang
script on your server).

Regards, Dave.

pgadmin-support by date:

Previous
From: Dave Page
Date:
Subject: Re: SQL query editor
Next
From: "Tim Finch, FosterFinch Ltd"
Date:
Subject: Re: SQL query editor