Обсуждение: Troubles with PL/Perl in PgSQL

Поиск
Список
Период
Сортировка

Troubles with PL/Perl in PgSQL

От
Vladimir D Belousov
Дата:
Hallo!

I'm new in PgSQL and I try to migrate from InterBase (Firebird) to PgSQL.

I have a trouble with call ANY plperl function.
I have the very simple function:
---------------------

CREATE FUNCTION myint(integer) RETURNS integer AS $$
  my $result = $_[0];
  return $result;
$$ LANGUAGE plperl;
---------------------

And when I try to call this function, I got the error:
---------------------
$ psql test
Welcome to psql 8.0.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
     \h for help with SQL commands
     \? for help with psql commands
     \g or terminate with semicolon to execute query
     \q to quit

test=# select * from myint(5);
server closed the connection unexpectedly
      This probably means the server terminated abnormally
      before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!>
---------------------
 From the /var/log/messages
Jul 27 18:17:24 ibserver postgres[57180]: [5-1] FATAL:  the database
system is in recovery mode

I use FreeBSD 5.4 with PostgreSQL 8.0.3.
PgSQL was builded from sources with --with-perl option. Other options
have defaults values.

Thanks for any replies!




Re: Troubles with PL/Perl in PgSQL

От
"Jeff Eckermann"
Дата:
"Vladimir D Belousov" <pg-maillist@klarnet.ru> wrote in message
news:42E79EC3.6040407@klarnet.ru...
> Hallo!
>
> I'm new in PgSQL and I try to migrate from InterBase (Firebird) to PgSQL.
>
> I have a trouble with call ANY plperl function.
> I have the very simple function:
> ---------------------
>
> CREATE FUNCTION myint(integer) RETURNS integer AS $$
>  my $result = $_[0];
>  return $result;
> $$ LANGUAGE plperl;
> ---------------------
>
> And when I try to call this function, I got the error:
> ---------------------
> $ psql test
> Welcome to psql 8.0.3, the PostgreSQL interactive terminal.
>
> Type:  \copyright for distribution terms
>     \h for help with SQL commands
>     \? for help with psql commands
>     \g or terminate with semicolon to execute query
>     \q to quit
>
> test=# select * from myint(5);

This syntax is appropriate for set-returning functions.  For functions
returning a single value, use "select myint(5);"

> server closed the connection unexpectedly
>      This probably means the server terminated abnormally
>      before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.
> !>
> ---------------------
> From the /var/log/messages
> Jul 27 18:17:24 ibserver postgres[57180]: [5-1] FATAL:  the database
> system is in recovery mode
>
> I use FreeBSD 5.4 with PostgreSQL 8.0.3.
> PgSQL was builded from sources with --with-perl option. Other options have
> defaults values.
>
> Thanks for any replies!
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>               http://archives.postgresql.org
>



Re: Troubles with PL/Perl in PgSQL

От
Vladimir D Belousov
Дата:
Jeff Eckermann wrote:

>"Vladimir D Belousov" <pg-maillist@klarnet.ru> wrote in message
>news:42E79EC3.6040407@klarnet.ru...
>
>
>>Hallo!
>>
>>I'm new in PgSQL and I try to migrate from InterBase (Firebird) to PgSQL.
>>
>>I have a trouble with call ANY plperl function.
>>I have the very simple function:
>>---------------------
>>
>>CREATE FUNCTION myint(integer) RETURNS integer AS $$
>> my $result = $_[0];
>> return $result;
>>$$ LANGUAGE plperl;
>>---------------------
>>
>>And when I try to call this function, I got the error:
>>---------------------
>>$ psql test
>>Welcome to psql 8.0.3, the PostgreSQL interactive terminal.
>>
>>Type:  \copyright for distribution terms
>>    \h for help with SQL commands
>>    \? for help with psql commands
>>    \g or terminate with semicolon to execute query
>>    \q to quit
>>
>>test=# select * from myint(5);
>>
>>
>
>This syntax is appropriate for set-returning functions.  For functions
>returning a single value, use "select myint(5);"
>
>
I see, thank you!
But when I try
select myint(5) from test;
(table test exists but has no records), I got the same error.

And here that I have noticed:  on a home computer this truoble is not
present.
However on the server and my home PC - the kernel and the system
environment are
almost absolutely identical - FreeBSD 5.4 (cvsup on Tue Jul 26 21:24:24
MSD 2005).
(except SMP support in the kernel and two options sysctl - for
hypertrading on the server).
SysV IPC options are identical too.

Possibly, I've gape any bug report about a problem using SMP kernel?

>
>
>>server closed the connection unexpectedly
>>     This probably means the server terminated abnormally
>>     before or while processing the request.
>>The connection to the server was lost. Attempting reset: Failed.
>>!>
>>---------------------
>From the /var/log/messages
>>Jul 27 18:17:24 ibserver postgres[57180]: [5-1] FATAL:  the database
>>system is in recovery mode
>>
>>I use FreeBSD 5.4 with PostgreSQL 8.0.3.
>>PgSQL was builded from sources with --with-perl option. Other options have
>>defaults values.
>>
>>Thanks for any replies!
>>
>>
>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 4: Have you searched our list archives?
>>
>>              http://archives.postgresql.org
>>
>>
>>
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Have you searched our list archives?
>
>               http://archives.postgresql.org
>
>


Re: Troubles with PL/Perl in PgSQL

От
Jeff Eckermann
Дата:
--- Vladimir D Belousov <pg-maillist@klarnet.ru>
wrote:

> Jeff Eckermann wrote:
>
> >"Vladimir D Belousov" <pg-maillist@klarnet.ru>
> wrote in message
> >news:42E79EC3.6040407@klarnet.ru...
> >
> >
> >>Hallo!
> >>
> >>I'm new in PgSQL and I try to migrate from
> InterBase (Firebird) to PgSQL.
> >>
> >>I have a trouble with call ANY plperl function.
> >>I have the very simple function:
> >>---------------------
> >>
> >>CREATE FUNCTION myint(integer) RETURNS integer AS
> $$
> >> my $result = $_[0];
> >> return $result;
> >>$$ LANGUAGE plperl;
> >>---------------------
> >>
> >>And when I try to call this function, I got the
> error:
> >>---------------------
> >>$ psql test
> >>Welcome to psql 8.0.3, the PostgreSQL interactive
> terminal.
> >>
> >>Type:  \copyright for distribution terms
> >>    \h for help with SQL commands
> >>    \? for help with psql commands
> >>    \g or terminate with semicolon to execute
> query
> >>    \q to quit
> >>
> >>test=# select * from myint(5);
> >>
> >>
> >
> >This syntax is appropriate for set-returning
> functions.  For functions
> >returning a single value, use "select myint(5);"
> >
> >
> I see, thank you!
> But when I try
> select myint(5) from test;

PostgreSQL does not require a from clause; as long as
the select list can be evaluated in some way, you will
get values returned.  The syntax that you have used
will (should) cause the return value to be output once
for every record in the table.

> (table test exists but has no records), I got the
> same error.
>
> And here that I have noticed:  on a home computer
> this truoble is not
> present.
> However on the server and my home PC - the kernel
> and the system
> environment are
> almost absolutely identical - FreeBSD 5.4 (cvsup on
> Tue Jul 26 21:24:24
> MSD 2005).
> (except SMP support in the kernel and two options
> sysctl - for
> hypertrading on the server).
> SysV IPC options are identical too.
>
> Possibly, I've gape any bug report about a problem
> using SMP kernel?

AFAIK there should be no problem with using SMP.  But
someone else will have to suggest answers for this
problem.

>
> >
> >
> >>server closed the connection unexpectedly
> >>     This probably means the server terminated
> abnormally
> >>     before or while processing the request.
> >>The connection to the server was lost. Attempting
> reset: Failed.
> >>!>
> >>---------------------
> >>From the /var/log/messages
> >>Jul 27 18:17:24 ibserver postgres[57180]: [5-1]
> FATAL:  the database
> >>system is in recovery mode
> >>
> >>I use FreeBSD 5.4 with PostgreSQL 8.0.3.
> >>PgSQL was builded from sources with --with-perl
> option. Other options have
> >>defaults values.
> >>
> >>Thanks for any replies!
> >>
> >>
> >>
> >>
> >>---------------------------(end of
> broadcast)---------------------------
> >>TIP 4: Have you searched our list archives?
> >>
> >>              http://archives.postgresql.org
> >>
> >>
> >>
> >
> >
> >
> >---------------------------(end of
> broadcast)---------------------------
> >TIP 4: Have you searched our list archives?
> >
> >               http://archives.postgresql.org
> >
> >
>
>




____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs


Re: Troubles with PL/Perl in PgSQL

От
Michael Fuhr
Дата:
On Wed, Jul 27, 2005 at 06:48:35PM +0400, Vladimir D Belousov wrote:
> test=# select * from myint(5);
> server closed the connection unexpectedly
>      This probably means the server terminated abnormally
>      before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.

Did you get a core dump?  In released versions of PostgreSQL core
dumps are usually under $PGDATA/base/<database oid>, although some
systems can be configured to put them elsewhere (e.g., by using
FreeBSD's kern.corefile sysctl setting).  If you got a core dump
then it might be useful to see a stack trace.  If you didn't get a
core dump then you might need to change the coredumpsize resource
setting so you do get one.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/