准备 rust 与 pgrx

编译 Rust 扩展需要安装 Rust 与 pgrx ,这里是配置说明与扩展编译的清单与手册。

安装Rust

如果需要构建 Rust 扩展,需要安装 rustpgrx

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"

安装 pgrx,注意 版本

cargo install --locked cargo-pgrx@${PGRX_VER-'0.12.7'} # <--- 
cargo install --locked cargo-pgrx@${PGRX_VER-'0.11.3'}
cargo install --locked cargo-pgrx@${PGRX_VER-'0.10.2'}
cargo pgrx init
配置 Rust Cargo 使用中国镜像(可选)
mkdir -vp ${CARGO_HOME:-$HOME/.cargo};
cat > ${CARGO_HOME:-$HOME/.cargo}/config << EOF
[source.crates-io]
replace-with = 'mirror'

[source.mirror]
registry = "sparse+https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/"
EOF
env RUSTUP_DIST_SERVER=https://mirrors.tuna.tsinghua.edu.cn/rustup rustup install stable


Rust扩展清单

Vendor Name Version PGRX License PG Ver Deps
Supabase pg_graphql v1.5.9 v0.12.5 Apache-2.0 17,16,15
Supabase pg_jsonschema v0.3.2 v0.12.5 Apache-2.0 17,16,15,14,13,12
Supabase wrappers v0.4.3 v0.12.6 Apache-2.0 17,16,15,14
TimescaleDB vectorscale v0.3.0 v0.12.5 PostgreSQL 17,16,15,14,13,12
kelvich pg_tiktoken v0.0.1 v0.12.6 Apache-2.0 16,15,14,13,12
PostgresML pgml v2.9.3 v0.11.3 MIT 16,15,14
Tembo pg_vectorize v0.17.0 v0.11.3 PostgreSQL 16,15,14 pgmq, pg_cron
Tembo pg_later v0.1.1 v0.11.3 PostgreSQL 16,15,14,13 pgmq
kaspermarstal plprql v0.1.0 v0.11.3 Apache-2.0 16,15,14,13,12
VADOSWARE pg_idkit v0.2.3 v0.12.5 Apache-2.0 17,16,15,14,13,12
pgsmcrypto pgsmcrypto v0.1.0 v0.12.6 MIT 17,16,15,14,13,12
rustprooflabs pgdd v0.5.2 v0.10.2 MIT 16,15,14,13,12
CrunchyData pg_parquet v0.1.0 v0.12.6 PostgreSQL 17, 16

下载并构建Rust扩展

cd ~;
cd ~; git clone --recursive [email protected]:postgresml/postgresml.git  ; cd ~/postgresml     && git checkout v2.9.3
cd ~; git clone [email protected]:supabase/pg_graphql.git                ; cd ~/pg_graphql     #&& git checkout v1.5.8             
cd ~; git clone [email protected]:supabase/pg_jsonschema.git             ; cd ~/pg_jsonschema  #&& git checkout v0.3.2       
cd ~; git clone [email protected]:supabase/wrappers.git                  ; cd ~/wrappers       && git checkout v0.4.3               
cd ~; git clone [email protected]:Vonng/pgsmcrypto.git                   ; cd ~/pgsmcrypto
cd ~; git clone [email protected]:Vonng/pg_tiktoken.git                  ; cd ~/pg_tiktoken
cd ~; git clone [email protected]:VADOSWARE/pg_idkit.git                 ; cd ~/pg_idkit       && git checkout v0.2.4             
cd ~; git clone [email protected]:timescale/pgvectorscale.git            ; cd ~/pgvectorscale  && git checkout 0.4.0                    

cd ~; git clone [email protected]:tembo-io/pg_vectorize.git              ; cd ~/pg_vectorize   && git checkout v0.18.3 
cd ~; git clone [email protected]:tembo-io/pg_later.git                  ; cd ~/pg_later       && git checkout v0.1.3           
cd ~; git clone [email protected]:kaspermarstal/plprql.git               ; cd ~/plprql         && git checkout v1.0.0
cd ~; git clone [email protected]:rustprooflabs/pgdd.git                 ; cd ~/pgdd           && git checkout 0.5.2

cd ~; [email protected]:CrunchyData/pg_parquet.git                       ; cd ~/pg_parquet     && git checkout 0.1.0

#cd ~; git clone [email protected]:tembo-io/pgmq.git                      ; cd ~/pgmq           && git checkout v1.2.1 #v1.3.3
#cd ~; git clone --recursive https://github.com/paradedb/paradedb.git  ; cd ~/paradedb       && git checkout v0.8.6
#cd ~/paradedb;     cargo update

您可以使用扩展别名,批量构建 Rust 扩展:

# pgrx 0.12.6
cd ~/pg_graphql;                  pg17 build; pg16 build; pg15 build; pg14 build;  
cd ~/pg_jsonschema;               pg17 build; pg16 build; pg15 build; pg14 build; pg13 build; pg12 build; 
cd ~/wrappers/wrappers;           pg17 build; pg16 build; pg15 build; pg14 build;
cd ~/pgsmcrypto;                  pg17 build; pg16 build; pg15 build; pg14 build; pg13 build; pg12 build; 
cd ~/pg_tiktoken;                 pg17 build; pg16 build; pg15 build; pg14 build; pg13 build; pg12 build; 
cd ~/pg_idkit;                    pg17 build; pg16 build; pg15 build; pg14 build; pg13 build; pg12 build; 
export RUSTFLAGS="-C target-feature=+avx2,+fma"
cd ~/pgvectorscale/pgvectorscale; pg17 build; pg16 build; pg15 build; pg14 build; pg13 build; 

# pgrx 0.11.3
cd ~/plprql/plprql;               pg16 build; pg15 build; pg14 build; pg13 build; pg12 build;
cd ~/pg_later;                    pg16 build; pg15 build; pg14 build; pg13 build; 
cd ~/pg_vectorize/extension;      pg16 build; pg15 build; pg14 build;
 
# pgrx 0.10.2
cd ~/pgdd;                        pg17 build; pg16 build; pg15 build; pg14 build; pg13 build; pg12 build; 

cd ~/pg_parquet;                  pg17 build; pg16 build;
cd ~/pg_polyline;                 pg17 build; pg16 build; pg15 build; pg14 build; pg13 build; pg12 build; 
cd ~/pg_explain_ui;               pg17 build; pg16 build; pg15 build; pg14 build; pg13 build; pg12 build; 
cd ~/pg_cardano;                  pg17 build; pg16 build; pg15 build; pg14 build; pg13 build; pg12 build; 
cd ~/pg_base58;                   pg17 build; pg16 build; pg15 build; pg14 build; pg13 build; pg12 build; 
cd ~/pg_summarize;                pg17 build; pg16 build; pg15 build; pg14 build; pg13 build; pg12 build; 

Last modified 2024-11-02: update extension stats (28af886b)