1)如何升级postgres扩展名?
2)如何安装特定的扩展版本?
在生产中,hstore的版本已过期。
=> select * from pg_available_extensions where name ='hstore';
name | default_version | installed_version | comment
--------+-----------------+-------------------+--------------------------------------------------
hstore | 1.3 | 1.1 | data type for storing sets of (key, value) pairs
所有其他环境hstore已经是1.3,所以我没办法测试create extension hstore;
是否是我需要的。
我想首先测试升级并通过Docker运行Postgres 9.4.4
docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres:9.4.4
docker run -it --rm --link some-postgres:postgres postgres:9.4.4 psql -h postgres -U postgres
但是hstore 1.3是默认版本
name | default_version | installed_version | comment
--------+-----------------+-------------------+--------------------------------------------------
hstore | 1.3 | 1.3 | data type for storing sets of (key, value) pairs
答案 0 :(得分:3)
升级postgres扩展程序
ALTER EXTENSION hstore UPDATE;
SELECT * FROM pg_available_extension_versions WHERE name ='hstore';
ALTER EXTENSION hstore WITH VERSION '1.3';
安装早于默认版本的特定版本
wget --directory-prefix /usr/share/postgresql/9.4/extension/ \
https://raw.githubusercontent.com/postgres/postgres/REL9_2_STABLE/contrib/hstore/hstore--1.1.sql
SELECT * FROM pg_available_extension_versions WHERE name ='hstore';
CREATE EXTENSION hstore WITH VERSION '1.1';