跳转到正文

Docker 验证证据 ​

PostgreSQL 已验证 · Verified 🕒 快照采集: 2026-08-23 15:15:53 UTC
🐳 镜像:server:由 POSTGRESQL_IMAGE 锁定
🛠️ 关键工具:postgrespsqlpg_dumppg_restorepg_isready
🚀 运行/交互CREATE TABLE → INSERT 3 rows → SELECT → \dt → EXPLAIN
docker-session.out.txt
$ PGPASSWORD=… psql -h 127.0.0.1 -U postgres -Atqc 'SELECT 1'
1

$ psql -h 127.0.0.1 -U postgres -v ON_ERROR_STOP=1 -c "DROP TABLE IF EXISTS hello_items; CREATE TABLE hello_items (id INT PRIMARY KEY, name VARCHAR(20), score INT); INSERT INTO hello_items VALUES (1,'Alice',30),(2,'Bob',20),(3,'Carol',40); SELECT id,name,score FROM hello_items WHERE score >= 30 ORDER BY score DESC; …"
DROP TABLE
CREATE TABLE
INSERT 0 3
 id | name  | score 
----+-------+-------
  3 | Carol |    40
  1 | Alice |    30
(2 rows)

 table_name  
-------------
 hello_items
(1 row)

                          QUERY PLAN                           
---------------------------------------------------------------
 Seq Scan on hello_items  (cost=0.00..20.75 rows=287 width=66)
   Filter: (score >= 30)
(2 rows)
NOTICE:  table "hello_items" does not exist, skipping

Released under the MIT License.