【標題】錯誤碼處理 【問題分類】鎖等待超時 【關鍵字】YAS-02024 【問題描述】執行語句時候,因鎖等待超時執行語句失敗 【問題原因分析】資料庫預設鎖等待時間為0秒,如果執行語句存在鎖等待過長會執行失敗 【解決/規避方法】 1、調整鎖等待的時間 SQL alter system set DDL_ ...
Deepin下安裝Postgresql
我的Deepin版本為
$ lsb_release -a
No LSB modules are available.
Distributor ID: Deepin
Description: Deepin 20.9
Release: 20.9
Codename: apricot
註意這裡Codename是apricot,後面會提到。
由於Deepin的apt連接的是Deepin官方源,其中的軟體版本十分老舊,直接使用
$ sudo apt install postgresql
下載的版本是 11,而這已經是PostgreSQL的不支持版本。
好在PostgreSQL下載文檔告訴我們他們提供了官方Apt倉庫,可以通過以下方式設置:
$ sudo apt install -y postgresql-common
$ sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
報錯
$ sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
This script will enable the PostgreSQL APT repository on apt.postgresql.org on
your system. The distribution codename used will be apricot-pgdg.
Your system is using the distribution codename apricot, but apricot-pgdg
does not seem to be a valid distribution on
http://apt.postgresql.org/pub/repos/apt/dists/
We abort the installation here. If you want to use a distribution different
from your system, you can call this script with an explicit codename, e.g.
"/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh precise".
Specifically, if you are using a non-LTS Ubuntu release, refer to
https://wiki.postgresql.org/wiki/Apt/FAQ#I_am_using_a_non-LTS_release_of_Ubuntu
For more information, refer to https://wiki.postgresql.org/wiki/Apt
or ask on the mailing list for assistance: [email protected]
看內容可以看出來,apricot不是合法的codename,因為我們畢竟不是在原生Debian上安裝。
前往報錯中提示的 http://apt.postgresql.org/pub/repos/apt/dists/ 查看
這實際上是Debian發行版本
而在PostgreSQL下載文檔,也列出了支持的Debian版本
查詢本系統基於的Debian版本:
$ cat /etc/debian_version
10.10
應該使用buster作為Codename,結合報錯信息中給的例子,重新執行
$ sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh buster
This script will enable the PostgreSQL APT repository on apt.postgresql.org on
your system. The distribution codename used will be buster-pgdg.
Press Enter to continue, or Ctrl-C to abort.
Writing /etc/apt/sources.list.d/pgdg.list ...
Importing repository signing key ...
OK
Running apt-get update ...
命中:1 https://pro-driver-packages.uniontech.com eagle InRelease
命中:2 https://dl.google.com/linux/chrome/deb stable InRelease
命中:4 https://community-packages.deepin.com/deepin apricot InRelease
命中:5 https://community-packages.deepin.com/driver driver InRelease
命中:3 https://packages.microsoft.com/repos/code stable InRelease
命中:6 https://community-packages.deepin.com/printer eagle InRelease
獲取:7 http://apt.postgresql.org/pub/repos/apt buster-pgdg InRelease [157 kB]
獲取:8 http://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 Packages [349 kB]
獲取:9 http://apt.postgresql.org/pub/repos/apt buster-pgdg/main i386 Packages [344 kB]
命中:10 https://app-store-files.uniontech.com/240709181548520/appstore deepin InRelease
已下載 850 kB,耗時 5秒 (188 kB/s)
正在讀取軟體包列表... 完成
You can now start installing packages from apt.postgresql.org.
Have a look at https://wiki.postgresql.org/wiki/Apt for more information;
most notably the FAQ at https://wiki.postgresql.org/wiki/Apt/FAQ
執行成功,查看postgresql最新版本
$ apt show postgresql
Package: postgresql
Version: 16+261.pgdg100+1
Priority: optional
Section: database
Source: postgresql-common (261.pgdg100+1)
Maintainer: Debian PostgreSQL Maintainers <[email protected]>
Installed-Size: 74.8 kB
Depends: postgresql-16
Suggests: postgresql-doc
Download-Size: 69.5 kB
APT-Sources: http://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 Packages
Description: object-relational SQL database (supported version)
This metapackage always depends on the currently supported PostgreSQL
database server version.
.
PostgreSQL is a fully featured object-relational database management
system. It supports a large part of the SQL standard and is designed
to be extensible by users in many aspects. Some of the features are:
ACID transactions, foreign keys, views, sequences, subqueries,
triggers, user-defined types and functions, outer joins, multiversion
concurrency control. Graphical user interfaces and bindings for many
programming languages are available as well.
N: 有 1 條附加記錄。請加上 ‘-a’ 參數來查看它們
更新軟體包
$ sudo apt upgrade
查看當前版本
$ sudo apt list postgresql
正在列表... 完成
postgresql/buster-pgdg,buster-pgdg,now 16+261.pgdg100+1 all [已安裝]
N: 還有 1 個版本。請使用 -a 選項來查看它(他們)。
在PostgreSQL中查看版本
$ psql --version
psql (PostgreSQL) 16.3 (Debian 16.3-1.pgdg100+1)
更新成功