Adding an extension in PostgreSQL

From EN Ikoula wiki
Revision as of 17:11, 24 September 2021 by Cbrochot1072d (talk | contribs)
⧼vector-jumptonavigation⧽ ⧼vector-jumptosearch⧽

ro:Adăugarea unei extensii în PostgreSQL ru:Добавление расширения в PostgreSQL pl:Dodawanie rozszerzeń w PostgreSQL ja:PostgreSQLでの拡張機能の追加 zh:在PostgreSQL中添加一个扩展 de:Hinzufügen einer Erweiterung in PostgreSQL nl:Een extensie toevoegen in PostgreSQL it:Aggiungere un'estensione in PostgreSQL pt:Acrescentar uma extensão no PostgreSQL es:Añadir una extensión en PostgreSQL fr:Ajouter une extension en PostgreSQL
This article has been created by an automatic translation software. You can view the article source here.

Introduction

This page deals with adding an extension to a PostgreSQL database.

Connecting to PostgreSQL

We switch to the postgres user and then connect to the PostgreSQL database test:

# su - postgres
postgres@vm-postgres:~$ psql -d test
psql (9.1.24lts2)
Saisissez « help » pour l aide.

test=#

We check the extensions currently present:

test=# \dx
                          Liste des extensions installées
    Nom    | Version |   Schéma   |                   Description
-----------+---------+------------+-------------------------------------------------
 plpgsql   | 1.0     | pg_catalog | PL/pgSQL procedural language
(1 ligne)

Adding an extension

We will, for example, add the extension unaccent (a function that allows, among other things, to remove accents):

test=# CREATE EXTENSION IF NOT EXISTS "unaccent";
CREATE EXTENSION

We check that it is in place:

test=# \dx
                          Liste des extensions installées
    Nom    | Version |   Schéma   |                   Description
-----------+---------+------------+-------------------------------------------------
 plpgsql   | 1.0     | pg_catalog | PL/pgSQL procedural language
 unaccent  | 1.0     | public     | text search dictionary that removes accents
(2 lignes)

We can also check that it is functional, for example:

test=# SELECT unaccent('Hôtel');
 unaccent
----------
 Hotel
(1 ligne)

The word Hotel is returned without a circumflex accent.




Cet article vous a semblé utile ?

0



You are not allowed to post comments.