Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
PostgreSQL for Data Architects

You're reading from   PostgreSQL for Data Architects Discover how to design, develop, and maintain your database application effectively with PostgreSQL

Arrow left icon
Product type Paperback
Published in Mar 2015
Publisher
ISBN-13 9781783288601
Length 272 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Jayadevan M Jayadevan M
Author Profile Icon Jayadevan M
Jayadevan M
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Installing PostgreSQL FREE CHAPTER 2. Server Architecture 3. PostgreSQL – Object Hierarchy and Roles 4. Working with Transactions 5. Data Modeling with SQL Power Architect 6. Client Tools 7. SQL Tuning 8. Server Tuning 9. Tools to Move Data in and out of PostgreSQL 10. Scaling, Replication, and Backup and Recovery 11. PostgreSQL – Troubleshooting 12. PostgreSQL – Extras Index

Working with extensions

We have so far initialized the database cluster. However, we made quite a few extensions available using the world option. What about them? We can list the installed extensions using the dx (describe extension) command at the psql prompt:

postgres=# \dx
                 List of installed extensions
  Name   | Version |   Schema   |         Description          
---------+---------+------------+------------------------------
plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
(1 row)

To get a list of available extensions, we can query the pg_available_extensions view, as shown here:

postgres=# SELECT name,comment  FROM pg_available_extensions limit 5;
   name   |                           comment                         
----------+--------------------------------------------------------------
dblink   | connect to other PostgreSQL databases from within a database
isn      | data types for international product numbering standards
file_fdw | foreign-data wrapper for flat file access
tsearch2 | compatibility package for pre-8.3 text search functions
unaccent | text search dictionary that removes accents
(5 rows)

Let's try installing one extension and then see the list of installed extensions again:

postgres=# CREATE EXTENSION dblink ;
CREATE EXTENSION
postgres=# \dx
                         List of installed extensions
  Name   | Version |   Schema   |                         Description
---------+---------+------------+--------------------------------------------------------------
dblink  | 1.1     | public     | connect to other PostgreSQL databases from within a database
plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
(2 rows)

The dblink extension has been added to the list of installed extensions. To remove it, just drop it:

postgres=# DROP EXTENSION dblink ;
DROP EXTENSION
postgres=# \dx
                 List of installed extensions
  Name   | Version |   Schema   |         Description          
---------+---------+------------+------------------------------
plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
(1 row)

Tip

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You have been reading a chapter from
PostgreSQL for Data Architects
Published in: Mar 2015
Publisher:
ISBN-13: 9781783288601
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 $19.99/month. Cancel anytime