[英]Weird ghost records in PostgreSQL - what are they?
我在我们的Postgresql数据库上有一个很奇怪的问题。 我有一个名为“ statement”的表,其中包含一些奇怪的记录。
使用命令行控制台psql,我select * from customer.statement where type in ('QUOTE');
查询select * from customer.statement where type in ('QUOTE');
然后返回12行。 7列看上去正常,5列丢失了所有数据,但单列是可为空的列,但似乎保留了用户输入的实数值。 psql告诉我,即使有12行,也返回了7行。其他大多数列都不可为空。 奇怪的记录如下所示:
select * from customer.statement where type = 'QUOTE';
id | issuer_id | recipient_id | recipient_name | recipient_reference | source_statement_id | catalogue_id | reference | issue_date | due_date | description | total | currency | type | tax_level | rounding_mode | status | recall_requested | time_created | time_updated | time_paid
------------------+------------------+------------------+----------------+---------------------+---------------------+--------------+-----------+------------+------------+------------------------------------------------------------------+-----------+----------+-------+-----------+---------------+-----------+------------------+----------------------------+----------------------------+-----------
... 7 valid records removed ...
| | | | | | | | | | Build bulkheads and sheet with plasterboard. +| | | | | | | | | |
| | | | | | | | | | Patch all patches. +| | | | | | | | | |
| | | | | | | | | | Set and sand all joints ready for painting. +| | | | | | | | | |
| | | | | | | | | | Use wall angle on bulkhead in main bedroom. +| | | | | | | | | |
| | | | | | | | | | Build nib and sheet and set in entrance | | | | | | | | | |
(7 rows)
如果我使用pgAdmin运行相同的查询,则看不到那些奇怪的记录。
有人知道这些是什么吗?
分隔符( +|
)之前的加号表示在psql中显示的字符串值中的换行符。 因此,没有其他行,只是同一行继续有换行符。 引用中输出的最后一行确认了以下内容: (7 rows)
。
在pgAdmin中,只要不增加字段的高度(或将内容复制/粘贴到某处),就不会看到多余的行,但是也有多行。
在psql和pgAdmin中尝试:
test=# SELECT E'This\nis\na\ntest.' AS multi_line, 'foo' AS single_line;
multi_line | single_line
--------------+-------------
This +| foo
is +|
a +|
test. |
(1 row)
linestyle
将边界线绘制样式设置为
ascii
,old-ascii
或unicode
。 [...]默认设置为ascii
。 [...]
ascii
样式使用纯ASCII字符。 数据中的换行符在右边距中使用+
符号显示。 [...]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.