pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Error with functions
6+ messages / 4 participants
[nested] [flat]

* Error with functions
@ 2003-09-20 06:24  shyamperi@davlin.co.in
  0 siblings, 2 replies; 6+ messages in thread

From: shyamperi@davlin.co.in @ 2003-09-20 06:24 UTC (permalink / raw)
  To: pgsql-admin@postgresql.org

Hey,
create or replace function sample(varchar,int) returns varchar as'
declare
        data alias for $1;
        size alias for $2;
begin
        return  substr(data,(length(data)-size)+1,length(data));
end;
' language 'plpgsql';
____________________________
WARNING:  plpgsql: ERROR during compile of sample near line 2
ERROR:  parse error at or near ";"

Can any body tell me why is this error coming
-----
Warm Regards
Shÿam Peri

II Floor, Punja Building,
M.G.Road,
Ballalbagh,
Mangalore-575003 
Ph : 91-824-2451001/5
Fax : 91-824-2451050 


DISCLAIMER: This message contains privileged and confidential information and is
intended only for the individual named.If you are not the intended
recipient you should not disseminate,distribute,store,print, copy or
deliver this message.Please notify the sender immediately by e-mail if
you have received this e-mail by mistake and delete this e-mail from
your system.

Attachments:

Untitled1 (text/html, 1.2K) download <head></head><body marginwidth=4 marginheight=4 topmargin=4 leftmargin=4><P><FONT face=verdana size=2>Hey,<BR>create or replace function sample(varchar,int) returns varchar as'<BR>declare<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data alias for $1;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; size alias for $2;<BR>begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return&nbsp; substr(data,(length(data)-size)+1,length(data));<BR>end;<BR>' language 'plpgsql';</FONT></P> <P><FONT face=verdana size=2>____________________________<BR>WARNING:&nbsp; plpgsql: ERROR during compile of sample near line 2<BR>ERROR:&nbsp; parse error at or near ";"<BR><BR>Can any body tell me why is this error coming</FONT></P><PRE>----- Warm Regards Shÿam Peri II Floor, Punja Building, M.G.Road, Ballalbagh, Mangalore-575003 Ph : 91-824-2451001/5 Fax : 91-824-2451050 </PRE></body><br><br><b> DISCLAIMER: This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.</b>
^ permalink raw reply [nested|flat] 6+ messages in thread

* Re: Error with functions
@ 2003-09-20 06:58  Tomasz Myrta <jasiek@klaster.net>
  parent: shyamperi@davlin.co.in
  1 sibling, 0 replies; 6+ messages in thread

From: Tomasz Myrta @ 2003-09-20 06:58 UTC (permalink / raw)
  To: shyamperi@davlin.co.in; +Cc: pgsql-sql

> Hey,
> create or replace function sample(varchar,int) returns varchar as'
> declare
>         data alias for $1;
>         size alias for $2;
> begin
>         return  substr(data,(length(data)-size)+1,length(data));
> end;
> ' language 'plpgsql';
> ____________________________
> WARNING:  plpgsql: ERROR during compile of sample near line 2
> ERROR:  parse error at or near ";"
> 
> Can any body tell me why is this error coming

Really?
I got no error and select sample('nothing',3) gave mi 'ing'
What is your postgresql version?

Regards,
Tomasz Myrta




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Error with functions
@ 2003-09-20 07:00  shyamperi@davlin.co.in
  0 siblings, 0 replies; 6+ messages in thread

From: shyamperi@davlin.co.in @ 2003-09-20 07:00 UTC (permalink / raw)
  To: shyamperi@davlin.co.in; +Cc: pgsql-sql

Hey,
PostgreSQL 7.3 on i686-pc-linux-gnu, compiled by GCC 2.96

But, I am getting error when I am using the alias key word. 
And also when I try to create a C function for the same and excute I am getting the following error
ERROR:  Memory exhausted in AllocSetAlloc(677865842)
And, I am allocating memory using the "palloc"
-----
Warm Regards
Shÿam Peri

II Floor, Punja Building,
M.G.Road,
Ballalbagh,
Mangalore-575003 
Ph : 91-824-2451001/5
Fax : 91-824-2451050 





----------------Original Message------------------

> Hey,
> create or replace function sample(varchar,int) returns varchar as'
> declare
>         data alias for $1;
>         size alias for $2;
> begin
>         return  substr(data,(length(data)-size)+1,length(data));
> end;
> ' language 'plpgsql';
> ____________________________
> WARNING:  plpgsql: ERROR during compile of sample near line 2
> ERROR:  parse error at or near ";"
> 
> Can any body tell me why is this error coming

Really?
I got no error and select sample('nothing',3) gave mi 'ing'
What is your postgresql version?

Regards,
Tomasz Myrta


DISCLAIMER: This message contains privileged and confidential information and is
intended only for the individual named.If you are not the intended
recipient you should not disseminate,distribute,store,print, copy or
deliver this message.Please notify the sender immediately by e-mail if
you have received this e-mail by mistake and delete this e-mail from
your system.

Attachments:

Untitled1 (text/html, 1.6K) download <head></head><body marginwidth=4 marginheight=4 topmargin=4 leftmargin=4><P>Hey,</P> <P>PostgreSQL 7.3 on i686-pc-linux-gnu, compiled by GCC 2.96<BR><BR>But, I am getting error when I am using the alias key word. <BR>And also when I try to create a C function for the same and excute I am getting the following error</P> <P>ERROR:&nbsp; Memory exhausted in AllocSetAlloc(677865842)</P> <P>And, I am allocating memory using the "palloc"</P><PRE>----- Warm Regards Shÿam Peri II Floor, Punja Building, M.G.Road, Ballalbagh, Mangalore-575003 Ph : 91-824-2451001/5 Fax : 91-824-2451050 </PRE><BR><BR>----------------Original Message------------------<BR><PRE>&gt; Hey, &gt; create or replace function sample(varchar,int) returns varchar as' &gt; declare &gt; data alias for $1; &gt; size alias for $2; &gt; begin &gt; return substr(data,(length(data)-size)+1,length(data)); &gt; end; &gt; ' language 'plpgsql'; &gt; ____________________________ &gt; WARNING: plpgsql: ERROR during compile of sample near line 2 &gt; ERROR: parse error at or near ";" &gt; &gt; Can any body tell me why is this error coming Really? I got no error and select sample('nothing',3) gave mi 'ing' What is your postgresql version? Regards, Tomasz Myrta</PRE></body><br><br><b> DISCLAIMER: This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.</b>
^ permalink raw reply [nested|flat] 6+ messages in thread

* Re: Error with functions
@ 2003-09-20 07:29  Jean-Michel Chabanne <jeanmichel.chabanne@free.fr>
  parent: shyamperi@davlin.co.in
  1 sibling, 0 replies; 6+ messages in thread

From: Jean-Michel Chabanne @ 2003-09-20 07:29 UTC (permalink / raw)
  To: shyamperi@davlin.co.in; +Cc: pgsql-admin@postgresql.org; pgsql-sql

shyamperi@davlin.co.in a écrit :

>Hey,
>create or replace function sample(varchar,int) returns varchar as'
>declare
>        data alias for $1;
>        size alias for $2;
>begin
>        return  substr(data,(length(data)-size)+1,length(data));
>end;
>' language 'plpgsql';
>____________________________
>WARNING:  plpgsql: ERROR during compile of sample near line 2
>ERROR:  parse error at or near ";"
>
>Can any body tell me why is this error coming
>-----
>Warm Regards
>Shÿam Peri
>
>II Floor, Punja Building,
>M.G.Road,
>Ballalbagh,
>Mangalore-575003 
>Ph : 91-824-2451001/5
>Fax : 91-824-2451050 
>
>
>DISCLAIMER: This message contains privileged and confidential information and is
>intended only for the individual named.If you are not the intended
>recipient you should not disseminate,distribute,store,print, copy or
>deliver this message.Please notify the sender immediately by e-mail if
>you have received this e-mail by mistake and delete this e-mail from
>your system.
>
>
> ------------------------------------------------------------------------
>
> Hey,
> create or replace function sample(varchar,int) returns varchar as'
> declare
>         data alias for $1;
>         size alias for $2;
> begin
>         return  substr(data,(length(data)-size)+1,length(data));
> end;
> ' language 'plpgsql';
>
> ____________________________
> WARNING:  plpgsql: ERROR during compile of sample near line 2
> ERROR:  parse error at or near ";"
>
> Can any body tell me why is this error coming
>
>-----
>Warm Regards
>Shÿam Peri
>
>II Floor, Punja Building,
>M.G.Road,
>Ballalbagh,
>Mangalore-575003 
>Ph : 91-824-2451001/5
>Fax : 91-824-2451050 
>
>
>  
>
>
>
> * DISCLAIMER: This message contains privileged and confidential 
> information and is intended only for the individual named.If you are 
> not the intended recipient you should not 
> disseminate,distribute,store,print, copy or deliver this 
> message.Please notify the sender immediately by e-mail if you have 
> received this e-mail by mistake and delete this e-mail from your system.*
>
>------------------------------------------------------------------------
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>  
>
Hi,

I juste did a copy/paste of your sample on my test DB. I didn't get any 
error message and the function works fine.

I run PostgreSQL 7.3.3



-- 
Jean-Michel Chabanne
77450 MONTRY (FRANCE)
48" 54' N - 2" 49' E
Powered by Linux





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Error with functions
@ 2003-09-20 11:16  shyamperi@davlin.co.in
  0 siblings, 1 reply; 6+ messages in thread

From: shyamperi@davlin.co.in @ 2003-09-20 11:16 UTC (permalink / raw)
  To: jeanmichel.chabanne@free.fr; +Cc: pgsql-admin@postgresql.org

5:08p
Dear All,
When I am executing any function with parameter.. I am unable to access them. So, I would be thankful if, anyone can help me in teaching this aspect.

CREATE FUNCTION add_one (integer) RETURNS INTEGER AS '
    BEGIN
        RETURN $1 + 1;
    END;
' LANGUAGE 'plpgsql';
The expected ouput of the above function should be 11 when we pass the 10 to it.... but it returns 1.
Thank you in advance

-----
Warm Regards
Shÿam Peri

II Floor, Punja Building,
M.G.Road,
Ballalbagh,
Mangalore-575003 
Ph : 91-824-2451001/5
Fax : 91-824-2451050 





----------------Original Message------------------

shyamperi@davlin.co.in a écrit :

>Hey,
>create or replace function sample(varchar,int) returns varchar as'
>declare
>        data alias for $1;
>        size alias for $2;
>begin
>        return  substr(data,(length(data)-size)+1,length(data));
>end;
>' language 'plpgsql';
>____________________________
>WARNING:  plpgsql: ERROR during compile of sample near line 2
>ERROR:  parse error at or near ";"
>
>Can any body tell me why is this error coming
>-----
>Warm Regards
>Shÿam Peri
>
>II Floor, Punja Building,
>M.G.Road,
>Ballalbagh,
>Mangalore-575003 
>Ph : 91-824-2451001/5
>Fax : 91-824-2451050 
>
>
>DISCLAIMER: This message contains privileged and confidential
information and is
>intended only for the individual named.If you are not the intended
>recipient you should not disseminate,distribute,store,print, copy or
>deliver this message.Please notify the sender immediately by e-mail
if
>you have received this e-mail by mistake and delete this e-mail from
>your system.
>
>
>
------------------------------------------------------------------------
>
> Hey,
> create or replace function sample(varchar,int) returns varchar as'
> declare
>         data alias for $1;
>         size alias for $2;
> begin
>         return  substr(data,(length(data)-size)+1,length(data));
> end;
> ' language 'plpgsql';
>
> ____________________________
> WARNING:  plpgsql: ERROR during compile of sample near line 2
> ERROR:  parse error at or near ";"
>
> Can any body tell me why is this error coming
>
>-----
>Warm Regards
>Shÿam Peri
>
>II Floor, Punja Building,
>M.G.Road,
>Ballalbagh,
>Mangalore-575003 
>Ph : 91-824-2451001/5
>Fax : 91-824-2451050 
>
>
>  
>
>
>
> * DISCLAIMER: This message contains privileged and confidential 
> information and is intended only for the individual named.If you are

> not the intended recipient you should not 
> disseminate,distribute,store,print, copy or deliver this 
> message.Please notify the sender immediately by e-mail if you have 
> received this e-mail by mistake and delete this e-mail from your
system.*
>
>------------------------------------------------------------------------
>
>
>---------------------------(end of
broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to
majordomo@postgresql.org
>  
>
Hi,

I juste did a copy/paste of your sample on my test DB. I didn't get
any 
error message and the function works fine.

I run PostgreSQL 7.3.3



-- 
Jean-Michel Chabanne
77450 MONTRY (FRANCE)
48" 54' N - 2" 49' E
Powered by Linux


DISCLAIMER: This message contains privileged and confidential information and is
intended only for the individual named.If you are not the intended
recipient you should not disseminate,distribute,store,print, copy or
deliver this message.Please notify the sender immediately by e-mail if
you have received this e-mail by mistake and delete this e-mail from
your system.

Attachments:

Untitled1 (text/html, 3.9K) download <head></head><body marginwidth=4 marginheight=4 topmargin=4 leftmargin=4><P>5:08p<BR>Dear All,<BR>When I am executing any function with parameter.. I am unable to access them. So, I would be thankful if, anyone can help me in teaching this aspect.<BR><BR>CREATE FUNCTION add_one (integer) RETURNS INTEGER AS '<BR>&nbsp;&nbsp;&nbsp; BEGIN<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RETURN $1 + 1;<BR>&nbsp;&nbsp;&nbsp; END;<BR>' LANGUAGE 'plpgsql';</P> <P>The expected ouput of the above function should be 11 when we pass the 10 to it.... but it returns 1.<BR>Thank you in advance<BR></P><PRE>----- Warm Regards Shÿam Peri II Floor, Punja Building, M.G.Road, Ballalbagh, Mangalore-575003 Ph : 91-824-2451001/5 Fax : 91-824-2451050 </PRE><BR><BR>----------------Original Message------------------<BR><PRE>shyamperi@davlin.co.in a écrit : &gt;Hey, &gt;create or replace function sample(varchar,int) returns varchar as' &gt;declare &gt; data alias for $1; &gt; size alias for $2; &gt;begin &gt; return substr(data,(length(data)-size)+1,length(data)); &gt;end; &gt;' language 'plpgsql'; &gt;____________________________ &gt;WARNING: plpgsql: ERROR during compile of sample near line 2 &gt;ERROR: parse error at or near ";" &gt; &gt;Can any body tell me why is this error coming &gt;----- &gt;Warm Regards &gt;Shÿam Peri &gt; &gt;II Floor, Punja Building, &gt;M.G.Road, &gt;Ballalbagh, &gt;Mangalore-575003 &gt;Ph : 91-824-2451001/5 &gt;Fax : 91-824-2451050 &gt; &gt; &gt;DISCLAIMER: This message contains privileged and confidential information and is &gt;intended only for the individual named.If you are not the intended &gt;recipient you should not disseminate,distribute,store,print, copy or &gt;deliver this message.Please notify the sender immediately by e-mail if &gt;you have received this e-mail by mistake and delete this e-mail from &gt;your system. &gt; &gt; &gt; ------------------------------------------------------------------------ &gt; &gt; Hey, &gt; create or replace function sample(varchar,int) returns varchar as' &gt; declare &gt; data alias for $1; &gt; size alias for $2; &gt; begin &gt; return substr(data,(length(data)-size)+1,length(data)); &gt; end; &gt; ' language 'plpgsql'; &gt; &gt; ____________________________ &gt; WARNING: plpgsql: ERROR during compile of sample near line 2 &gt; ERROR: parse error at or near ";" &gt; &gt; Can any body tell me why is this error coming &gt; &gt;----- &gt;Warm Regards &gt;Shÿam Peri &gt; &gt;II Floor, Punja Building, &gt;M.G.Road, &gt;Ballalbagh, &gt;Mangalore-575003 &gt;Ph : 91-824-2451001/5 &gt;Fax : 91-824-2451050 &gt; &gt; &gt; &gt; &gt; &gt; &gt; * DISCLAIMER: This message contains privileged and confidential &gt; information and is intended only for the individual named.If you are &gt; not the intended recipient you should not &gt; disseminate,distribute,store,print, copy or deliver this &gt; message.Please notify the sender immediately by e-mail if you have &gt; received this e-mail by mistake and delete this e-mail from your system.* &gt; &gt;------------------------------------------------------------------------ &gt; &gt; &gt;---------------------------(end of broadcast)--------------------------- &gt;TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org &gt; &gt; Hi, I juste did a copy/paste of your sample on my test DB. I didn't get any error message and the function works fine. I run PostgreSQL 7.3.3 -- Jean-Michel Chabanne 77450 MONTRY (FRANCE) 48" 54' N - 2" 49' E Powered by Linux </PRE></body><br><br><b> DISCLAIMER: This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.</b>
^ permalink raw reply [nested|flat] 6+ messages in thread

* Re: Error with functions
@ 2003-09-20 16:02  Tom Lane <tgl@sss.pgh.pa.us>
  parent: shyamperi@davlin.co.in
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2003-09-20 16:02 UTC (permalink / raw)
  To: shyamperi@davlin.co.in; +Cc: jeanmichel.chabanne@free.fr; pgsql-admin@postgresql.org; pgsql-sql

shyamperi@davlin.co.in writes:
> CREATE FUNCTION add_one (integer) RETURNS INTEGER AS '
>     BEGIN
>         RETURN $1 + 1;
>     END;
> ' LANGUAGE 'plpgsql';
> The expected ouput of the above function should be 11 when we pass the 10 t=
> o it.... but it returns 1.

Works fine for me:

regression=# CREATE FUNCTION add_one (integer) RETURNS INTEGER AS '
regression'#     BEGIN
regression'#         RETURN $1 + 1;
regression'#     END;
regression'# ' LANGUAGE 'plpgsql';
CREATE FUNCTION
regression=# select add_one(10);
 add_one
---------
      11
(1 row)

Perhaps you should show us exactly what you did.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2003-09-20 16:02 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-09-20 06:24 Error with functions shyamperi@davlin.co.in
2003-09-20 06:58 ` Tomasz Myrta <jasiek@klaster.net>
2003-09-20 07:29 ` Jean-Michel Chabanne <jeanmichel.chabanne@free.fr>
2003-09-20 07:00 Re: Error with functions shyamperi@davlin.co.in
2003-09-20 11:16 Re: Error with functions shyamperi@davlin.co.in
2003-09-20 16:02 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox