小编StO*_*cha的帖子

PostgreSQL:单个表的 pg_dump

我是 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

如何让它发挥作用?

postgresql pg-dump

5
推荐指数
1
解决办法
1万
查看次数

PostgreSQL:没有页眉/页脚行的选择语句

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 ...在那里添加?

postgresql psql

3
推荐指数
1
解决办法
4387
查看次数

BASH:如何将带有空列的制表符分隔行从文件读取到数组中

应分析 txt 文件:它有许多行,每行有 20 个字段,由制表符分隔,每个字段可以包含任何类型的数据(整数、浮点数、日期时间、文本也包含空白和“”等),除此之外字段可以是空的,例如这样的一行会像

111TABTABWalterTAB11.1234TABThis is a sample TextTAB"Another sample"TABTABTAB555...
Run Code Online (Sandbox Code Playgroud)

如何将文件的每一行读入具有 20 列的数组 arrLine,例如

  • arrLine(0)=111
  • arrLine(1)=
  • arrLine(2)=沃尔特
  • ...

我想这个建议

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)

但空列不会填充到数组中。

谢谢!

arrays bash tabs

0
推荐指数
1
解决办法
167
查看次数

标签 统计

postgresql ×2

arrays ×1

bash ×1

pg-dump ×1

psql ×1

tabs ×1