Обсуждение: Re Problem with new function

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

Re Problem with new function

От
Grzegorz Przeździecki
Дата:
I write to you few minuts ego.

I show you two files

-----------------------------------1---------------------------------
--/***************************************************************************/

--! 23.09.1999  Warszawa
--% Grzegorz Przezdziecki
--@ grzegorz_przezdziecki@crn.pl;gprzezdz@elektron.elka.pw.edu.pl
--# CREATE FUNCTION fu_idklienci() RETURNS OPAQUE AS'
--$ funkcja bedzie wywololywana przez triger w momencie dodania nowego
telefonu
--$ do tablei telefonow klienta
--/***************************************************************************/



--/***************************************************************************/

--                    FUNKCJA PRZED INSERTEM DO TABELI telefon klienta
--/***************************************************************************/

CREATE FUNCTION fu_idklienci() RETURNS OPAQUE AS'               DECLARE                       id int4;
BEGIN

--SPRAWDZAMY FIRME
                       IF NEW.firma ISNULL THEN                               RAISE EXCEPTION ''Pole firma musi
posiadac wartosc'';                       END IF;                       SELECT id_firmy INTO id  FROM tb_firmy WHERE
id_firmy = NEW.id_firma;                       IF NOT FOUND  THEN                               RAISE EXCEPTION ''Brak
firmynumer
 
%'',NEW.id_firma;                       END If;

                       NEW.ID_klienci:=nextval(''se_idklienci'');                       RETURN NEW;               END;'
             LANGUAGE 'plpgsql';
 
--/***************************************************************************/

--/***************************************************************************/

this file makes errors
pqReadData() -- backend closed the channel unexpectedly.       This probably means the backend terminated abnormally
  before or while processing the request.
 
We have lost the connection to the backend, so further processing is
impossible. Terminating.
and in log file :
Sep 23 11:00:14 Databases logger: FATAL 1:  btree: cannot split if start
(2) >=
maxoff (2)

second file is OK
------------------------------------------2------------------------------------------

--/***************************************************************************/

--! 23.09.1999  Warszawa
--% Grzegorz Przezdziecki
--@ grzegorz_przezdziecki@crn.pl;gprzezdz@elektron.elka.pw.edu.pl
--# CREATE FUNCTION fu_idklienci() RETURNS OPAQUE AS'
--$ funkcja bedzie wywololywana przez triger w momencie dodania nowego
telefonu
--$ do tablei telefonow klienta
--/***************************************************************************/



--/***************************************************************************/

--                    FUNKCJA PRZED INSERTEM DO TABELI telefon klienta
--/***************************************************************************/

CREATE FUNCTION fu_idklienci() RETURNS OPAQUE AS'               DECLARE                       id int4;
BEGIN

                       IF NEW.firma ISNULL THEN                               RAISE EXCEPTION ''Pole firma musi
posiadac wartosc'';                       END IF;                       SELECT id_firmy INTO id  FROM tb_firmy WHERE
id_firmy = NEW.id_firma;                       IF NOT FOUND  THEN                               RAISE EXCEPTION ''Brak
firmynumer
 
%'',NEW.id_firma;                       END If;

                       NEW.ID_klienci:=nextval(''se_idklienci'');                       RETURN NEW;               END;'
             LANGUAGE 'plpgsql';
 
--/***************************************************************************/

--/***************************************************************************/



Diference is in line

--SPRAWDZAMY FIRME

I use
Zed editor
[PostgreSQL 6.5.1 on i686-pc-linux-gnu, compiled by gcc 2.7.2.3]
on Debian
kernel 2.0.36

What is means this error
Sep 23 11:00:14 Databases logger: FATAL 1:  btree: cannot split if start
(2) >=
maxoff (2)

Best regards



Re: [HACKERS] Re Problem with new function

От
Thomas Lockhart
Дата:
> Diference is in line
> --SPRAWDZAMY FIRME
> What is means this error
> Sep 23 11:00:14 Databases logger: FATAL 1:  btree: cannot split
>   if start (2) >= maxoff (2)

I'm guessing that you have exceeded the requirement that a tuple
(index tuples only? but I don't know why this would be indexed) must
fit on half of a page. Try taking out more whitespace (in particular
the large spaced indents), and perhaps you can put the comment back
in.
                    - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California