6

I have heard that one in PostgreSQL can write stored procedures in Ruby.

But I haven't been able to find more information about it teaching one how to actually do it.

Could someone recommend good sources for that.

Thanks

1
  • Sadly, it appears that the PL/Ruby project is no longer being maintained. Commented Apr 7, 2013 at 20:46

2 Answers 2

7

Obviously, you need to install PL/Ruby. After that, you can write:

CREATE FUNCTION ruby_max(int4, int4) RETURNS int4 AS '
    if args[0].to_i > args[1].to_i
        return args[0]
    else
        return args[1]
    end
' LANGUAGE 'plruby';

Check its GitHub repository for installation instructions.

Sign up to request clarification or add additional context in comments.

1 Comment

Some information regarding installation: stackoverflow.com/questions/617600/…
2

Check this website: http://moulon.inra.fr/ruby/plruby.html , it has some nice examples.

1 Comment

The site referenced above appears to have gone dark.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.