- PostgreSQL for Data Architects
- Jayadevan Maymala
- 304字
- 2021-07-23 19:41:24
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.
- Python for Secret Agents:Volume II
- 架構(gòu)不再難(全5冊(cè))
- 算法基礎(chǔ):打開(kāi)程序設(shè)計(jì)之門(mén)
- Vue.js 3.x從入門(mén)到精通(視頻教學(xué)版)
- HTML5+CSS3網(wǎng)站設(shè)計(jì)教程
- Java 11 Cookbook
- iOS開(kāi)發(fā)實(shí)戰(zhàn):從入門(mén)到上架App Store(第2版) (移動(dòng)開(kāi)發(fā)叢書(shū))
- Node.js:來(lái)一打 C++ 擴(kuò)展
- Natural Language Processing with Java and LingPipe Cookbook
- 基于SpringBoot實(shí)現(xiàn):Java分布式中間件開(kāi)發(fā)入門(mén)與實(shí)戰(zhàn)
- Django實(shí)戰(zhàn):Python Web典型模塊與項(xiàng)目開(kāi)發(fā)
- Scratch·愛(ài)編程的藝術(shù)家
- OpenCV with Python Blueprints
- OpenCV Android Programming By Example
- C# 7.0本質(zhì)論