Book Image

PostgreSQL Server Programming - Second Edition

Book Image

PostgreSQL Server Programming - Second Edition

Overview of this book

Table of Contents (21 chapters)
PostgreSQL Server Programming Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 8. Using Unrestricted Languages

You may have noticed, that some of the PLs in PostgreSQL can be declared as untrusted. They all end in the letter u to remind you that they are untrusted each time you use them to create a function. Unrestricted languages allow you to do things that restricted or trusted languages are not allowed to do; for example, interacting with the environment and creating files and opening sockets. In this chapter, we will look at some examples in detail.

This untrustedness brings up many questions:

  • Does being untrusted mean that such languages are somehow inferior to trusted ones?

  • Can I still write an important function in an untrusted language?

  • Will they silently eat my data and corrupt the database?

The answers are no, yes, and maybe respectively. Let's now discuss these questions in order.