Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learn PostgreSQL - Second Edition

You're reading from  Learn PostgreSQL - Second Edition

Product type Book
Published in Oct 2023
Publisher Packt
ISBN-13 9781837635641
Pages 744 pages
Edition 2nd Edition
Languages
Authors (2):
Luca Ferrari Luca Ferrari
Profile icon Luca Ferrari
Enrico Pirozzi Enrico Pirozzi
Profile icon Enrico Pirozzi
View More author details

Table of Contents (22) Chapters

Preface Introduction to PostgreSQL Getting to Know Your Cluster Managing Users and Connections Basic Statements Advanced Statements Window Functions Server-Side Programming Triggers and Rules Partitioning Users, Roles, and Database Security Transactions, MVCC, WALs, and Checkpoints Extending the Database – the Extension Ecosystem Query Tuning, Indexes, and Performance Optimization Logging and Auditing Backup and Restore Configuration and Monitoring Physical Replication Logical Replication Useful Tools and Extensions Other Books You May Enjoy
Index

Exploring functions and languages

PostgreSQL is capable of executing server-side code. There are many ways to provide PostgreSQL with the code to be executed. For example, the user can create functions in different programming languages. The main languages supported by PostgreSQL are as follows:

  • SQL
  • PL/pgSQL
  • C

These listed languages are the built-in languages; there are also other languages that PostgreSQL can manage, but before using them, we need to install them on our system. Some of these other supported languages are as follows:

  • PL/Python
  • PL/Perl
  • PL/tcl
  • PL/Java

In this section, we’ll talk about SQL and PL/pgSQL functions.

Functions

The command structure with which a function is defined is as follows:

CREATE FUNCTION function_name(p1 type, p2 type,p3 type, ....., pn type)
 RETURNS type AS
BEGIN
 -- function logic
END;
LANGUAGE language_name

The following steps always apply to any type...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}