Thread: plpgsql won't work

plpgsql won't work

From
Infodine
Date:
Hi,

Using PGAdminII I created the plpgsql_call_handler function pointing it to
the plpgsql.dll file.

Then I created the language pointing it to the handler, clicked off trusted.

I then created a very simple procedure:

-- Function: sales_tax(float4)
CREATE FUNCTION "sales_tax"("float4") RETURNS "float4" AS ' DECLARE
subtotal ALIAS FOR $1; BEGIN return subtotal * 0.06; END; ' LANGUAGE 'plpgsql';

Then I called it using an sql window:

select sales_tax(45);

When I execute the statement the main window says executing query, a few
seconds go by and then it says executing query...Done.  and I get
this error:

An error has occured in pgAdmin II:frmSQLInput.cmdExecute_Click:
Number : -2147467259
Description: Error while executing query;
No response from backend;
Error while reading from the socket

Any ideas? I execute a plain 'sql' function and it runs fine. plpgsql won't
run.

Any help would be appreciated, I don't know if it is a windows problem so I
posted here first.

Thanks,

Warren


Re: plpgsql won't work

From
Dave Page
Date:

> -----Original Message-----
> From: Infodine [mailto:infodine@infodine.com]
> Sent: 29 April 2002 19:30
> To: pgsql-cygwin@postgresql.org
> Subject: [CYGWIN] plpgsql won't work
>
>
> Hi,
>
> Using PGAdminII I created the plpgsql_call_handler function
> pointing it to
> the plpgsql.dll file.
>
> Then I created the language pointing it to the handler,
> clicked off trusted.
>
> I then created a very simple procedure:
>
> -- Function: sales_tax(float4)
> CREATE FUNCTION "sales_tax"("float4") RETURNS "float4" AS ' DECLARE
> subtotal ALIAS FOR $1; BEGIN return subtotal * 0.06; END; '
> LANGUAGE 'plpgsql';
>
> Then I called it using an sql window:
>
> select sales_tax(45);
>
> When I execute the statement the main window says executing
> query, a few
> seconds go by and then it says executing query...Done.  and I
> get this error:
>
> An error has occured in pgAdmin
> II:frmSQLInput.cmdExecute_Click: Number : -2147467259
> Description: Error while executing query;
> No response from backend;
> Error while reading from the socket
>
> Any ideas? I execute a plain 'sql' function and it runs fine.
> plpgsql won't
> run.
>
> Any help would be appreciated, I don't know if it is a
> windows problem so I
> posted here first.

It works OK here on Cygwin/Win XP Pro with pgAdmin II 1.3.38. What happens
if you run it from psql?

Regards, Dave.

Re: plpgsql won't work

From
Jason Tishler
Date:
Warren,

On Mon, Apr 29, 2002 at 12:29:54PM -0600, Infodine wrote:
> Any ideas?

Unfortunately no.  All that I can offer is that the plpgsql regression
test passes.  Sorry, but I have never used plpgsql under Cygwin or any
other platform for that matter.

Jason

Re: plpgsql won't work

From
Dave Page
Date:
Please keep replies on list...

All I can suggest is to try running the regression tests to check your
installation. It sounds like the problem lies there somewhere...

Regards, Dave.

> -----Original Message-----
> From: Infodine [mailto:infodine@infodine.com]
> Sent: 29 April 2002 22:59
> To: Dave Page
> Subject: RE: [CYGWIN] plpgsql won't work
>
>
> Hi,
>
> I tried it on the server and the same thing happens. I call
> the function and I hear the scsi drives pound for about 5-6
> seconds then I get the error and it closes the connection not
> returning any result.
>
> So does the plpgsql.dll file process the function? I can't
> figure out why it isn't working. The handler points to the
> file so it shouldn't matter where it is. In the cygwin shell
> it is located in /usr/lib/plpgsql.dll
>
> why would it pound the drives?... it is a simple function for
> sales tax and it should return a value....
>
> Hmm, I see the handler function is set up as a "C" Language
> function. I then look at the language C and it has no handler
> but says in the comments that /bin/cc ..... cc is the C
> compiler? If my cygwin doesn't have cc then no functions
> relying on C will work... correct?
>
> Warren
>
>
>
>
> At 08:10 PM 4/29/2002 +0100, you wrote:
>
>
> > > -----Original Message-----
> > > From: Infodine [mailto:infodine@infodine.com]
> > > Sent: 29 April 2002 19:30
> > > To: pgsql-cygwin@postgresql.org
> > > Subject: [CYGWIN] plpgsql won't work
> > >
> > >
> > > Hi,
> > >
> > > Using PGAdminII I created the plpgsql_call_handler
> function pointing
> > > it to the plpgsql.dll file.
> > >
> > > Then I created the language pointing it to the handler,
> clicked off
> > > trusted.
> > >
> > > I then created a very simple procedure:
> > >
> > > -- Function: sales_tax(float4)
> > > CREATE FUNCTION "sales_tax"("float4") RETURNS "float4" AS
> ' DECLARE
> > > subtotal ALIAS FOR $1; BEGIN return subtotal * 0.06; END;
> ' LANGUAGE
> > > 'plpgsql';
> > >
> > > Then I called it using an sql window:
> > >
> > > select sales_tax(45);
> > >
> > > When I execute the statement the main window says
> executing query, a
> > > few seconds go by and then it says executing query...Done.  and I
> > > get this error:
> > >
> > > An error has occured in pgAdmin
> > > II:frmSQLInput.cmdExecute_Click: Number : -2147467259
> > > Description: Error while executing query;
> > > No response from backend;
> > > Error while reading from the socket
> > >
> > > Any ideas? I execute a plain 'sql' function and it runs fine.
> > > plpgsql won't run.
> > >
> > > Any help would be appreciated, I don't know if it is a windows
> > > problem so I posted here first.
> >
> >It works OK here on Cygwin/Win XP Pro with pgAdmin II 1.3.38. What
> >happens if you run it from psql?
> >
> >Regards, Dave.
>