Search Postgresql Archives

Postgresql string parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Folks,
I'm looking for the fatest way to parse string in a postgresql function and insert each parsed chunk in a table. Something like that:

CREATE FUNCTION parse_and_insert(text) RETURNS integer AS '

     DECLARE
     my_string   ALIAS FOR $1;

    -- empty string, do nothing
     IF my_string IS NULL THEN
        -- split my_string at each new line char '\n', '\r\n' or '\r'

        -- loop for each founded chunk, and simply insert it
        INSERT INTO tableX (data) VALUES (chunk);

     return 1;
     END IF;

    -- empty string, do nothing
    return 0;

   END;
' LANGUAGE 'plpgsql';

My be there is exists complety different and fasted method?

Thanks in advance guys

/Youn



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux