我是 PostgreSQL 的初学者,使用以下方法进行备份:
sudo -u postgres pg_dumpall > /~/postgreBackup.SQL
工作正常!现在我想备份方案“SchemeName”中的单个表“TableName”并尝试
sudo -u postgres pg_dump --table "SchemaName"."TableName" > /~/Dummy.SQL
pg_dump: no matching tables were found
如何让它发挥作用?
select distinct table_schema from information_schema.tables;
Run Code Online (Sandbox Code Playgroud)
提供类似的东西
table_schema
--------------------
mySchema
pg_catalog
information_schema
anotherSchem
(4 rows)
Run Code Online (Sandbox Code Playgroud)
如何修改命令,以便看不到前两行(table_schema 和 ---)或最后一行(... rows)?
我在 bash 脚本中使用 psql 命令。我怎样才能\pset tuples ...在那里添加?
应分析 txt 文件:它有许多行,每行有 20 个字段,由制表符分隔,每个字段可以包含任何类型的数据(整数、浮点数、日期时间、文本也包含空白和“”等),除此之外字段可以是空的,例如这样的一行会像
111TABTABWalterTAB11.1234TABThis is a sample TextTAB"Another sample"TABTABTAB555...
Run Code Online (Sandbox Code Playgroud)
如何将文件的每一行读入具有 20 列的数组 arrLine,例如
我想这个建议像
while IFS=$'\t' read -r -a arrLine; do
echo "${#arrLine[@]} items: ${arrLine[@]}"
echo "${arrLine[3]} || ${arrLine[4]} || ${arrLine[5]}"
done < "test.txt"
Run Code Online (Sandbox Code Playgroud)
但空列不会填充到数组中。
谢谢!