File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed
Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -2236,18 +2236,16 @@ def _table_checksum__use_cn(
22362236 assert cursor is not None
22372237
22382238 try :
2239- cursor .execute ("SELECT t::text FROM {} as t" .format (
2239+ cursor .execute ("SELECT SUM(hashtext( t::text)) FROM {} as t" .format (
22402240 __class__ ._delim_sql_ident (table )
22412241 ))
22422242
2243- while True :
2244- row = cursor .fetchone ()
2245- if row is None :
2246- break
2247- assert type (row ) in [list , tuple ] # noqa: E721
2248- assert len (row ) == 1
2249- sum += hash (row [0 ])
2250- continue
2243+ row = cursor .fetchone ()
2244+ assert row is not None
2245+ assert type (row ) in [list , tuple ] # noqa: E721
2246+ assert len (row ) == 1
2247+ v = row [0 ]
2248+ sum += int (v if v is not None else 0 )
22512249 finally :
22522250 cursor .close ()
22532251
Original file line number Diff line number Diff line change @@ -2162,7 +2162,7 @@ def test_node__pgbench_table_checksums__one_table(
21622162
21632163 with cn .connection .cursor () as cursor :
21642164 assert cursor is not None
2165- cursor .execute ("SELECT t::text FROM \" t\" as t;" )
2165+ cursor .execute ("SELECT hashtext( t::text) FROM \" t\" as t;" )
21662166
21672167 checksum1 = 0
21682168 record_count = 0
@@ -2173,7 +2173,7 @@ def test_node__pgbench_table_checksums__one_table(
21732173 assert type (row ) in [list , tuple ] # noqa: E721
21742174 assert len (row ) == 1
21752175 record_count += 1
2176- checksum1 += hash (row [0 ])
2176+ checksum1 += int (row [0 ])
21772177 pass
21782178
21792179 assert record_count == table_checksum_test_data .record_count
You can’t perform that action at this time.
0 commit comments