安装包含本地参考和全部已发布模式的完整包。
install postgresqlpostgresqlpostgresql [options] · postgresql : <sql>postgresql显示当前
postgresql -c <host> <user> [database] [-p <port>] [-n] [-m [name]]连接;除非使用 -n,否则密码会单独询问
-use <database>重新连接到其他数据库
-l列出数据库
-t列出 public 表和视图
-s <table>显示列和数据类型
-n <table> [rows]预览表行
-f <table> <text> [rows]在表的各列中查找文本
-o <table> [-j|-csv] [file] [-f]导出表行
-a <table> : <json>从 JSON 对象插入一行
-w <table> <field> <value> : <json>用 JSON 对象更新匹配的行
-d <table> <field> <value>删除匹配的行
-m [name]把当前连接保存到 .lil.key;默认使用数据库名
-M <name>删除已保存的连接
-k [name]列出已保存的连接,或检查其中一个但不显示密码
-K <name>使用已保存的连接进行连接
-e断开连接并清除连接信息
postgresql : <sql>执行原生 SQL
postgresql load <file.sql|file.json>执行 SQL 或恢复 lil 逻辑 JSON 转储
postgresql dump [file.json] [-f]创建 public 表的逻辑 JSON 转储
常用形式都列在本地命令参考中。快捷操作负责检查和小范围修改;高级操作始终可以回到对应数据库的原生语法。
dump/load 的格式由驱动决定。若需要覆盖数据库全部能力的完整备份,请使用服务器侧的原生备份工具。
密码通过隐藏输入框提供,不会写入命令历史。生产环境应尽量使用权限受限的数据库账户。
lil JSON 转储只包含数据,不会重建架构对象或索引。JSON 恢复在事务中执行;单表超过 100000 行时会拒绝导出或转储。
未使用 -m 时,连接数据只保留在当前 PHP 会话中。-m [name] 会明确把配置保存到受保护的 .lil.key 文件(0600),-K <name> 使用它重新连接,-k 可列出或检查配置但不会泄露已保存的密码,-M <name> 删除一个配置。kill 会与其他核心状态一起删除 .lil.key。请把该文件视为敏感文件,因为主动保存的配置可能包含数据库凭据。
可直接在页面中运行预先准备的示例。结果已预先生成并在浏览器中显示;服务器不会执行任何终端命令。
安装当前兼容版本。完整功能请选择 Base,精简包请选择 Minimum;已安装模块的更新请使用 upgrade。
Base 与 Minimum 是同一当前模块版本的两个包。
安装包含本地参考和全部已发布模式的完整包。
install postgresql安装精简包。该包不包含本地参考;
install postgresql -m安装这个确切的已发布版本。
install postgresql -v 1.1.3让 upgrade 检查兼容性,仅在需要时替换已安装块。
upgrade postgresql删除扩展块,不影响核心和其他模块。
install postgresql -u示例可复制,但网站不会执行。请先检查路径、权限和破坏性选项。
postgresql -use shop | postgresql -t | postgresql -n products 5Database shop
products
orders
id sku name category price active
1 SHOE-1 City shoe shoes 79.90 t
2 SHOE-2 Trail shoe shoes 109.00 tpostgresql -c localhost app shopStatus connected
Server PostgreSQL 17
Host localhost:5432
User app
Database shoppostgresql -lpostgres
shop
template1postgresql -s productsColumn Type Nullable
id bigint no
sku text no
name text no
category text no
price numeric(10,2) no
active boolean nopostgresql -f products "shoe" 20id sku name category price
1 SHOE-1 City shoe shoes 79.90
2 SHOE-2 Trail shoe shoes 109.00postgresql -o products -j products.jsonSaved products.jsonpostgresql -a products : {"sku":"BAG-1","name":"Travel bag","price":49.90}Inserted 1postgresql -w products sku BAG-1 : {"price":44.90}Updated 1postgresql -d products sku BAG-1Deleted 1postgresql : SELECT COUNT(*) AS products FROM productsproducts
4postgresql dump shop.jsonSaved shop.jsonpostgresql load \sandbox\db\postgresql.sqlAffected 2
Time 2 mspostgresql -e+postgresql -s missing_table未找到表: missing_tablesandbox/db/postgresql.sql该示例使用受保护的 /sandbox/ 文档工作区中的文件或目录。
CREATE TABLE products (id BIGSERIAL PRIMARY KEY, sku text UNIQUE NOT NULL, name text NOT NULL, category text NOT NULL, price numeric(10,2) NOT NULL, active boolean NOT NULL DEFAULT true);
INSERT INTO products(sku,name,category,price,active) VALUES ('SHOE-1','City shoe','shoes',79.90,true),('BAG-1','Canvas bag','bags',44.50,true);