Chapter 5. Data types, Functions, and Operators
PostgreSQL supports the workhorse data types of any database: numerics, strings, dates, times, and booleans. PostgreSQL sprints ahead by adding support for arrays, time zone−aware datetimes, time intervals, ranges, multiranges, JSON, XML, and many more. If that’s not enough, you can invent custom types or add a gazillion more with extensions.
In this chapter, we won’t cover every data type. For that, there’s always the manual. We showcase commonly-used data types that are unique to PostgreSQL and nuances in how PostgreSQL handles common data types.
No data type is useful without supporting functions and operators. PostgreSQL has plenty of them. We’ll cover the more popular ones in this chapter.
Tip
When we use the term function, we’re talking about something of the form
f(x). When we use the term operator,
we’re talking about something that’s symbolic and either unary
(having one argument) or binary (having two arguments) such as
+, -, *, :: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access