#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    58
    Rep Power
    11

    Post Cannot use plpgsql


    I try to create a function using clause LANGUAGE 'plpgsql', but an error occurs: Language plpgsql does not exist.

    I think that maybe need to configure plpgsql support, but I don't know what to do.

    I appreciate some help.

    Best Regards
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Poland
    Posts
    57
    Rep Power
    11
    RTFM!
    CREATE FUNCTION plpgsql() RETURNS language_handler AS '$libdir/plpgsql';
    CREATE LANGUAGE plpgsql HANDLER plpgsql();

    I'm not sure that it's right so RTFM
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    58
    Rep Power
    11

    Installing plpgsql


    You're right this is syntax I followed from psql:

    CREATE FUNCTION plpgsql_call_handler()
    RETURNS language_handler AS
    '/usr/local/postgresql/lib/plpgsql'
    LANGUAGE C;

    CREATE LANGUAGE plpgsql
    HANDLER plpgsql_call_handler;


    Regards
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Poland
    Posts
    57
    Rep Power
    11
    but you know, that $libdir is a postgres variable and you can use it instead /usr/local/postgresql/lib (to make your applications more flexible).
  8. #5
  9. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    61
    You can also do that from the command line with the 'createlang' command, the same way you create a new database:

    createlang plpgsql [databasename]
    The real n-tier system:

    FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL

    Amazon wishlist -- rycamor (at) gmail.com

IMN logo majestic logo threadwatch logo seochat tools logo